Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
d603a5fb
提交
d603a5fb
authored
8月 22, 2018
作者:
JarvanMo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ios share
上级
451f258e
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
273 行增加
和
114 行删除
+273
-114
FluwxShareHandler.kt
...main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
+4
-4
AppDelegate.m
example/ios/Runner/AppDelegate.m
+16
-0
Info.plist
example/ios/Runner/Info.plist
+10
-12
FluwxPlugin.m
ios/Classes/FluwxPlugin.m
+1
-1
FluwxShareHandler.m
ios/Classes/handler/FluwxShareHandler.m
+134
-34
WXApiRequestHandler.h
ios/Classes/wechat/WXApiRequestHandler.h
+15
-0
WXApiRequestHandler.m
ios/Classes/wechat/WXApiRequestHandler.m
+83
-62
wechat_share_models.dart
lib/src/models/wechat_share_models.dart
+10
-1
没有找到文件。
android/src/main/kotlin/com/jarvan/fluwx/handler/FluwxShareHandler.kt
浏览文件 @
d603a5fb
...
@@ -135,12 +135,12 @@ object FluwxShareHandler {
...
@@ -135,12 +135,12 @@ object FluwxShareHandler {
miniProgramObj
.
miniprogramType
=
call
.
argument
(
"miniProgramType"
)
// 正式版:0,测试版:1,体验版:2
miniProgramObj
.
miniprogramType
=
call
.
argument
(
"miniProgramType"
)
// 正式版:0,测试版:1,体验版:2
miniProgramObj
.
userName
=
call
.
argument
(
"userName"
)
// 小程序原始id
miniProgramObj
.
userName
=
call
.
argument
(
"userName"
)
// 小程序原始id
miniProgramObj
.
path
=
call
.
argument
(
"path"
)
//小程序页面路径
miniProgramObj
.
path
=
call
.
argument
(
"path"
)
//小程序页面路径
miniProgramObj
.
withShareTicket
=
call
.
argument
(
"withShareTicket"
)
val
msg
=
WXMediaMessage
(
miniProgramObj
)
val
msg
=
WXMediaMessage
(
miniProgramObj
)
msg
.
title
=
call
.
argument
(
"title"
)
// 小程序消息title
msg
.
title
=
call
.
argument
(
WechatPluginKeys
.
TITLE
)
// 小程序消息title
msg
.
description
=
call
.
argument
(
"description"
)
// 小程序消息desc
msg
.
description
=
call
.
argument
(
"description"
)
// 小程序消息desc
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
val
thumbnail
:
String
?
=
call
.
argument
(
WechatPluginKeys
.
THUMBNAIL
)
launch
{
launch
{
if
(
thumbnail
.
isNullOrBlank
())
{
if
(
thumbnail
.
isNullOrBlank
())
{
msg
.
thumbData
=
null
msg
.
thumbData
=
null
...
@@ -234,7 +234,7 @@ object FluwxShareHandler {
...
@@ -234,7 +234,7 @@ object FluwxShareHandler {
val
music
=
WXMusicObject
()
val
music
=
WXMusicObject
()
val
musicUrl
:
String
?
=
call
.
argument
(
"musicUrl"
)
val
musicUrl
:
String
?
=
call
.
argument
(
"musicUrl"
)
val
musicLowBandUrl
:
String
?
=
call
.
argument
(
"musicLowBandUrl"
)
val
musicLowBandUrl
:
String
?
=
call
.
argument
(
"musicLowBandUrl"
)
if
(
musicUrl
!=
null
)
{
if
(
musicUrl
!=
null
&&
musicUrl
.
isNotBlank
()
)
{
music
.
musicUrl
=
musicUrl
music
.
musicUrl
=
musicUrl
music
.
musicDataUrl
=
call
.
argument
(
"musicDataUrl"
)
music
.
musicDataUrl
=
call
.
argument
(
"musicDataUrl"
)
}
else
{
}
else
{
...
@@ -265,7 +265,7 @@ object FluwxShareHandler {
...
@@ -265,7 +265,7 @@ object FluwxShareHandler {
val
video
=
WXVideoObject
()
val
video
=
WXVideoObject
()
val
videoUrl
:
String
?
=
call
.
argument
(
"videoUrl"
)
val
videoUrl
:
String
?
=
call
.
argument
(
"videoUrl"
)
val
videoLowBandUrl
:
String
?
=
call
.
argument
(
"videoLowBandUrl"
)
val
videoLowBandUrl
:
String
?
=
call
.
argument
(
"videoLowBandUrl"
)
if
(
videoUrl
!=
null
)
{
if
(
videoUrl
!=
null
&&
videoUrl
.
isNotBlank
()
)
{
video
.
videoUrl
=
videoUrl
video
.
videoUrl
=
videoUrl
}
else
{
}
else
{
video
.
videoLowBandUrl
=
videoLowBandUrl
video
.
videoLowBandUrl
=
videoLowBandUrl
...
...
example/ios/Runner/AppDelegate.m
浏览文件 @
d603a5fb
...
@@ -11,4 +11,20 @@
...
@@ -11,4 +11,20 @@
return
[
super
application
:
application
didFinishLaunchingWithOptions
:
launchOptions
];
return
[
super
application
:
application
didFinishLaunchingWithOptions
:
launchOptions
];
}
}
-
(
void
)
applicationWillResignActive
:(
UIApplication
*
)
application
{
}
-
(
void
)
applicationDidEnterBackground
:(
UIApplication
*
)
application
{
}
-
(
void
)
applicationWillEnterForeground
:(
UIApplication
*
)
application
{
}
-
(
void
)
applicationDidBecomeActive
:(
UIApplication
*
)
application
{
}
-
(
void
)
applicationWillTerminate
:(
UIApplication
*
)
application
{
}
@end
@end
example/ios/Runner/Info.plist
浏览文件 @
d603a5fb
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
en
<
/string
>
<
string
>
en
<
/string
>
<
k
e
y
>
CFBundleDisplayName
<
/k
e
y
>
<
k
e
y
>
CFBundleDisplayName
<
/k
e
y
>
<
string
>
$
{
PRO
JE
CT_NAME
}<
/string
>
<
string
>
$
{
PRO
DU
CT_NAME
}<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
...
@@ -35,8 +35,17 @@
...
@@ -35,8 +35,17 @@
<
/
a
rr
a
y
>
<
/
a
rr
a
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
string
>
1
<
/string
>
<
k
e
y
>
LSApplicationQueriesSchemes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
weixin
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
LSRequiresIPhoneOS
<
/k
e
y
>
<
k
e
y
>
LSRequiresIPhoneOS
<
/k
e
y
>
<
tru
e
/
>
<
tru
e
/
>
<
k
e
y
>
NSAppTransportSecurity
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSAllowsArbitraryLoads
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
k
e
y
>
UILaunchStoryboardName
<
/k
e
y
>
<
k
e
y
>
UILaunchStoryboardName
<
/k
e
y
>
<
string
>
LaunchScreen
<
/string
>
<
string
>
LaunchScreen
<
/string
>
<
k
e
y
>
UIMainStoryboardFile
<
/k
e
y
>
<
k
e
y
>
UIMainStoryboardFile
<
/k
e
y
>
...
@@ -56,16 +65,5 @@
...
@@ -56,16 +65,5 @@
<
/
a
rr
a
y
>
<
/
a
rr
a
y
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
fa
ls
e
/
>
<
fa
ls
e
/
>
<
k
e
y
>
LSApplicationQueriesSchemes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
weixin
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
NSAppTransportSecurity
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSAllowsArbitraryLoads
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
<
/plist
>
ios/Classes/FluwxPlugin.m
浏览文件 @
d603a5fb
...
@@ -69,7 +69,7 @@ BOOL isWeChatRegistered = NO;
...
@@ -69,7 +69,7 @@ BOOL isWeChatRegistered = NO;
return
;
return
;
}
}
NSString
*
appId
=
call
.
arguments
[
appId
];
NSString
*
appId
=
call
.
arguments
[
@"appId"
];
if
([
StringUtil
isBlank
:
appId
])
{
if
([
StringUtil
isBlank
:
appId
])
{
result
([
FlutterError
errorWithCode
:
@"invalid app id"
message
:
@"are you sure your app id is correct ? "
details
:
appId
]);
result
([
FlutterError
errorWithCode
:
@"invalid app id"
message
:
@"are you sure your app id is correct ? "
details
:
appId
]);
return
;
return
;
...
...
ios/Classes/handler/FluwxShareHandler.m
浏览文件 @
d603a5fb
...
@@ -43,6 +43,12 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -43,6 +43,12 @@ NSObject <FlutterPluginRegistrar> *_registrar;
[
self
shareImage
:
call
result
:
result
];
[
self
shareImage
:
call
result
:
result
];
}
else
if
([
shareWebPage
isEqualToString
:
call
.
method
])
{
}
else
if
([
shareWebPage
isEqualToString
:
call
.
method
])
{
[
self
shareWebPage
:
call
result
:
result
];
[
self
shareWebPage
:
call
result
:
result
];
}
else
if
([
shareMusic
isEqualToString
:
call
.
method
])
{
[
self
shareMusic
:
call
result
:
result
];
}
else
if
([
shareVideo
isEqualToString
:
call
.
method
])
{
[
self
shareVideo
:
call
result
:
result
];
}
else
if
([
shareMiniProgram
isEqualToString
:
call
.
method
]){
[
self
shareMiniProgram
:
call
result
:
result
];
}
}
...
@@ -52,7 +58,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -52,7 +58,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
}
}
...
@@ -91,7 +97,6 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -91,7 +97,6 @@ NSObject <FlutterPluginRegistrar> *_registrar;
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
...
@@ -101,7 +106,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -101,7 +106,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
Action:
fluwxKeyMessageAction
Action:
fluwxKeyMessageAction
ThumbImage:
thumbnailImage
ThumbImage:
thumbnailImage
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
...
@@ -110,7 +115,6 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -110,7 +115,6 @@ NSObject <FlutterPluginRegistrar> *_registrar;
}
}
-
(
void
)
shareAssetImage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
imagePath
:(
NSString
*
)
imagePath
{
-
(
void
)
shareAssetImage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
imagePath
:(
NSString
*
)
imagePath
{
...
@@ -124,7 +128,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -124,7 +128,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
0
,
0
);
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
0
,
0
);
dispatch_async
(
globalQueue
,
^
{
dispatch_async
(
globalQueue
,
^
{
NSData
*
imageData
=
[
NSData
dataWithContentsOfFile
:[
self
readImageFromAssets
:
imagePath
]];
NSData
*
imageData
=
[
NSData
dataWithContentsOfFile
:[
self
readImageFromAssets
:
imagePath
]];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
...
@@ -137,7 +141,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -137,7 +141,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
Action:
fluwxKeyMessageAction
Action:
fluwxKeyMessageAction
ThumbImage:
thumbnailImage
ThumbImage:
thumbnailImage
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
...
@@ -146,7 +150,6 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -146,7 +150,6 @@ NSObject <FlutterPluginRegistrar> *_registrar;
}
}
-
(
void
)
shareWebPage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
-
(
void
)
shareWebPage
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
1
,
1
);
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
1
,
1
);
...
@@ -154,45 +157,143 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -154,45 +157,143 @@ NSObject <FlutterPluginRegistrar> *_registrar;
NSString
*
thumbnail
=
call
.
arguments
[
fluwxKeyThumbnail
];
NSString
*
thumbnail
=
call
.
arguments
[
fluwxKeyThumbnail
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
NSData
*
imageData
=
[
NSData
dataWithContentsOfFile
:[
self
readImageFromAssets
:
@""
]];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
webPageUrl
=
call
.
arguments
[
@"webPage"
];
NSString
*
webPageUrl
=
call
.
arguments
[
@"webPage"
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendImageData
:
imageData
TagName
:
call
.
arguments
[
fluwxKeyMediaTagName
]
BOOL
done
=
[
WXApiRequestHandler
sendLinkURL
:
webPageUrl
MessageExt:
fluwxKeyMessageExt
TagName
:
call
.
arguments
[
fluwxKeyMediaTagName
]
Action:
fluwxKeyMessageAction
Title:
call
.
arguments
[
fluwxKeyTitle
]
ThumbImage:
thumbnailImage
Description:
call
.
arguments
[
fluwxKeyDescription
]
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
ThumbImage:
thumbnailImage
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
MessageExt:
call
.
arguments
[
fluwxKeyMessageExt
]
MessageAction:
call
.
arguments
[
fluwxKeyMessageAction
]
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
});
});
}
-
(
void
)
shareMusic
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
1
,
1
);
dispatch_async
(
globalQueue
,
^
{
NSString
*
thumbnail
=
call
.
arguments
[
fluwxKeyThumbnail
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
NSString
*
imagePath
=
call
.
arguments
[
fluwxKeyImage
];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendMusicURL
:
call
.
arguments
[
@"musicUrl"
]
dataURL
:
call
.
arguments
[
@"musicDataUrl"
]
MusicLowBandUrl:
call
.
arguments
[
@"musicLowBandUrl"
]
MusicLowBandDataUrl:
call
.
arguments
[
@"musicLowBandDataUrl"
]
Title:
call
.
arguments
[
fluwxKeyTitle
]
Description:
call
.
arguments
[
fluwxKeyDescription
]
ThumbImage:
thumbnailImage
MessageExt:
call
.
arguments
[
fluwxKeyMessageExt
]
MessageAction:
call
.
arguments
[
fluwxKeyMessageAction
]
TagName:
call
.
arguments
[
fluwxKeyMediaTagName
]
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
}
-
(
void
)
shareVideo
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
1
,
1
);
dispatch_async
(
globalQueue
,
^
{
NSString
*
thumbnail
=
call
.
arguments
[
fluwxKeyThumbnail
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
32
*
1024
];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendVideoURL
:
call
.
arguments
[
@"videoUrl"
]
VideoLowBandUrl
:
call
.
arguments
[
@"videoLowBandUrl"
]
Title:
call
.
arguments
[
fluwxKeyTitle
]
Description:
call
.
arguments
[
fluwxKeyDescription
]
ThumbImage:
thumbnailImage
MessageExt:
call
.
arguments
[
fluwxKeyMessageExt
]
MessageAction:
call
.
arguments
[
fluwxKeyMessageAction
]
TagName:
call
.
arguments
[
fluwxKeyMediaTagName
]
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
NSString
*
text
=
call
.
arguments
[
fluwxKeyText
];
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendText
:
text
InScene
:[
StringToWeChatScene
toScene
:
scene
]];
result
(
@
(
done
));
}
}
-
(
void
)
shareMiniProgram
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
dispatch_queue_t
globalQueue
=
dispatch_get_global_queue
(
1
,
1
);
dispatch_async
(
globalQueue
,
^
{
NSString
*
thumbnail
=
call
.
arguments
[
fluwxKeyThumbnail
];
UIImage
*
thumbnailImage
=
[
self
getThumbnail
:
thumbnail
size
:
120
*
1024
];
NSData
*
hdImageData
=
nil
;
NSString
*
hdImagePath
=
call
.
arguments
[
@"hdImagePath"
];
if
(
!
[
StringUtil
isBlank
:
hdImagePath
])
{
if
([
hdImagePath
hasPrefix
:
SCHEMA_ASSETS
])
{
hdImageData
=
[
NSData
dataWithContentsOfFile
:[
self
readImageFromAssets
:
hdImagePath
]];
}
else
if
([
hdImagePath
hasPrefix
:
SCHEMA_FILE
])
{
-
(
UIImage
*
)
getThumbnail
:(
NSString
*
)
thumbnail
size
:
(
NSUInteger
)
size
{
}
else
{
NSURL
*
hdImageURL
=
[
NSURL
URLWithString
:
hdImagePath
];
hdImageData
=
[
NSData
dataWithContentsOfURL
:
hdImageURL
];
}
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
scene
=
call
.
arguments
[
fluwxKeyScene
];
BOOL
done
=
[
WXApiRequestHandler
sendMiniProgramWebpageUrl
:
call
.
arguments
[
@"webPageUrl"
]
userName
:
call
.
arguments
[
@"userName"
]
path:
call
.
arguments
[
@"path"
]
title:
fluwxKeyTitle
Description:
fluwxKeyDescription
ThumbImage:
thumbnailImage
hdImageData:
hdImageData
withShareTicket:
[
call
.
arguments
[
@"withShareTicket"
]
boolValue
]
miniProgramType:
(
WXMiniProgramType
)
call
.
arguments
[
@"miniProgramType"
]
MessageExt:
call
.
arguments
[
fluwxKeyMessageExt
]
MessageAction:
call
.
arguments
[
fluwxKeyMessageAction
]
TagName:
call
.
arguments
[
fluwxKeyMediaTagName
]
InScene:
[
StringToWeChatScene
toScene
:
scene
]];
result
(@{
fluwxKeyPlatform
:
fluwxKeyIOS
,
fluwxKeyResult
:
@
(
done
)});
});
});
}
-
(
UIImage
*
)
getThumbnail
:(
NSString
*
)
thumbnail
size
:(
NSUInteger
)
size
{
UIImage
*
thumbnailImage
=
nil
;
UIImage
*
thumbnailImage
=
nil
;
...
@@ -219,26 +320,25 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -219,26 +320,25 @@ NSObject <FlutterPluginRegistrar> *_registrar;
}
}
return
thumbnailImage
;
return
thumbnailImage
;
}
}
-
(
NSString
*
)
readImageFromAssets
:
(
NSString
*
)
imagePath
{
-
(
NSString
*
)
readImageFromAssets
:(
NSString
*
)
imagePath
{
NSArray
*
array
=
[
self
formatAssets
:
imagePath
];
NSArray
*
array
=
[
self
formatAssets
:
imagePath
];
NSString
*
key
;
NSString
*
key
;
if
(
array
[
1
]
==
nil
)
{
if
(
array
[
1
]
==
nil
)
{
key
=
[
_registrar
lookupKeyForAsset
:
array
[
0
]];
key
=
[
_registrar
lookupKeyForAsset
:
array
[
0
]];
}
else
{
}
else
{
key
=
[
_registrar
lookupKeyForAsset
:
array
[
0
]
fromPackage
:
array
[
1
]];
key
=
[
_registrar
lookupKeyForAsset
:
array
[
0
]
fromPackage
:
array
[
1
]];
}
}
return
[[
NSBundle
mainBundle
]
pathForResource
:
key
ofType
:
nil
];
return
[[
NSBundle
mainBundle
]
pathForResource
:
key
ofType
:
nil
];
}
}
-
(
NSArray
*
)
formatAssets
:(
NSString
*
)
originPath
{
-
(
NSArray
*
)
formatAssets
:
(
NSString
*
)
originPath
{
NSString
*
path
=
nil
;
NSString
*
path
=
nil
;
NSString
*
packageName
=
nil
;
NSString
*
packageName
=
nil
;
int
from
=
[
SCHEMA_ASSETS
length
];
int
from
=
[
SCHEMA_ASSETS
length
];
...
@@ -246,11 +346,11 @@ NSObject <FlutterPluginRegistrar> *_registrar;
...
@@ -246,11 +346,11 @@ NSObject <FlutterPluginRegistrar> *_registrar;
NSString
*
pathWithoutSchema
=
[
originPath
substringFromIndex
:
from
toIndex
:
to
];
NSString
*
pathWithoutSchema
=
[
originPath
substringFromIndex
:
from
toIndex
:
to
];
int
indexOfPackage
=
[
pathWithoutSchema
lastIndexOfString
:
fluwxKeyPackage
];
int
indexOfPackage
=
[
pathWithoutSchema
lastIndexOfString
:
fluwxKeyPackage
];
if
(
indexOfPackage
!=
JavaNotFound
)
{
if
(
indexOfPackage
!=
JavaNotFound
)
{
path
=
[
pathWithoutSchema
substringFromIndex
:
0
toIndex
:
indexOfPackage
];
path
=
[
pathWithoutSchema
substringFromIndex
:
0
toIndex
:
indexOfPackage
];
int
begin
=
indexOfPackage
+
[
fluwxKeyPackage
length
];
int
begin
=
indexOfPackage
+
[
fluwxKeyPackage
length
];
packageName
=
[
pathWithoutSchema
substringFromIndex
:
begin
toIndex
:[
pathWithoutSchema
length
]];
packageName
=
[
pathWithoutSchema
substringFromIndex
:
begin
toIndex
:[
pathWithoutSchema
length
]];
}
else
{
}
else
{
path
=
pathWithoutSchema
;
path
=
pathWithoutSchema
;
}
}
...
...
ios/Classes/wechat/WXApiRequestHandler.h
浏览文件 @
d603a5fb
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import "WXApiObject.h"
#import "WXApiObject.h"
#import "StringUtil.h"
@interface
WXApiRequestHandler
:
NSObject
@interface
WXApiRequestHandler
:
NSObject
...
@@ -26,19 +27,30 @@
...
@@ -26,19 +27,30 @@
Title
:(
NSString
*
)
title
Title
:(
NSString
*
)
title
Description
:(
NSString
*
)
description
Description
:(
NSString
*
)
description
ThumbImage
:(
UIImage
*
)
thumbImage
ThumbImage
:(
UIImage
*
)
thumbImage
MessageExt
:(
NSString
*
)
messageExt
MessageAction
:(
NSString
*
)
messageAction
InScene
:(
enum
WXScene
)
scene
;
InScene
:(
enum
WXScene
)
scene
;
+
(
BOOL
)
sendMusicURL
:(
NSString
*
)
musicURL
+
(
BOOL
)
sendMusicURL
:(
NSString
*
)
musicURL
dataURL
:(
NSString
*
)
dataURL
dataURL
:(
NSString
*
)
dataURL
MusicLowBandUrl
:(
NSString
*
)
musicLowBandUrl
MusicLowBandDataUrl
:(
NSString
*
)
musicLowBandDataUrl
Title
:(
NSString
*
)
title
Title
:(
NSString
*
)
title
Description
:(
NSString
*
)
description
Description
:(
NSString
*
)
description
ThumbImage
:(
UIImage
*
)
thumbImage
ThumbImage
:(
UIImage
*
)
thumbImage
MessageExt
:(
NSString
*
)
messageExt
MessageAction
:(
NSString
*
)
messageAction
TagName
:(
NSString
*
)
tagName
InScene
:(
enum
WXScene
)
scene
;
InScene
:(
enum
WXScene
)
scene
;
+
(
BOOL
)
sendVideoURL
:(
NSString
*
)
videoURL
+
(
BOOL
)
sendVideoURL
:(
NSString
*
)
videoURL
VideoLowBandUrl
:(
NSString
*
)
videoLowBandUrl
Title
:(
NSString
*
)
title
Title
:(
NSString
*
)
title
Description
:(
NSString
*
)
description
Description
:(
NSString
*
)
description
ThumbImage
:(
UIImage
*
)
thumbImage
ThumbImage
:(
UIImage
*
)
thumbImage
MessageExt
:(
NSString
*
)
messageExt
MessageAction
:(
NSString
*
)
messageAction
TagName
:(
NSString
*
)
tagName
InScene
:(
enum
WXScene
)
scene
;
InScene
:(
enum
WXScene
)
scene
;
+
(
BOOL
)
sendEmotionData
:(
NSData
*
)
emotionData
+
(
BOOL
)
sendEmotionData
:(
NSData
*
)
emotionData
...
@@ -61,6 +73,9 @@
...
@@ -61,6 +73,9 @@
hdImageData
:(
NSData
*
)
hdImageData
hdImageData
:(
NSData
*
)
hdImageData
withShareTicket
:(
BOOL
)
withShareTicket
withShareTicket
:(
BOOL
)
withShareTicket
miniProgramType
:(
WXMiniProgramType
)
programType
miniProgramType
:(
WXMiniProgramType
)
programType
MessageExt
:(
NSString
*
)
messageExt
MessageAction
:(
NSString
*
)
messageAction
TagName
:(
NSString
*
)
tagName
InScene
:(
enum
WXScene
)
scene
;
InScene
:(
enum
WXScene
)
scene
;
+
(
BOOL
)
launchMiniProgramWithUserName
:(
NSString
*
)
userName
+
(
BOOL
)
launchMiniProgramWithUserName
:(
NSString
*
)
userName
...
...
ios/Classes/wechat/WXApiRequestHandler.m
浏览文件 @
d603a5fb
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
@implementation
WXApiRequestHandler
@implementation
WXApiRequestHandler
#pragma mark - Public Methods
#pragma mark - Public Methods
+
(
BOOL
)
sendText
:(
NSString
*
)
text
+
(
BOOL
)
sendText
:(
NSString
*
)
text
InScene
:(
enum
WXScene
)
scene
{
InScene
:(
enum
WXScene
)
scene
{
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
text
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
text
...
@@ -30,12 +31,11 @@
...
@@ -30,12 +31,11 @@
Action
:(
NSString
*
)
action
Action
:(
NSString
*
)
action
ThumbImage
:(
UIImage
*
)
thumbImage
ThumbImage
:(
UIImage
*
)
thumbImage
InScene
:(
enum
WXScene
)
scene
InScene
:(
enum
WXScene
)
scene
title
:(
NSString
*
)
title
title
:(
NSString
*
)
title
description
:
(
NSString
*
)
description
description
:(
NSString
*
)
description
{
{
WXImageObject
*
ext
=
[
WXImageObject
object
];
WXImageObject
*
ext
=
[
WXImageObject
object
];
ext
.
imageData
=
imageData
;
ext
.
imageData
=
imageData
;
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
Description
:
description
Description
:
description
Object:
ext
Object:
ext
...
@@ -43,12 +43,12 @@
...
@@ -43,12 +43,12 @@
MessageAction:
action
MessageAction:
action
ThumbImage:
thumbImage
ThumbImage:
thumbImage
MediaTag:
tagName
];
MediaTag:
tagName
];
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
return
[
WXApi
sendReq
:
req
];
return
[
WXApi
sendReq
:
req
];
}
}
...
@@ -57,6 +57,8 @@
...
@@ -57,6 +57,8 @@
Title
:(
NSString
*
)
title
Title
:(
NSString
*
)
title
Description
:(
NSString
*
)
description
Description
:(
NSString
*
)
description
ThumbImage
:(
UIImage
*
)
thumbImage
ThumbImage
:(
UIImage
*
)
thumbImage
MessageExt
:(
NSString
*
)
messageExt
MessageAction
:(
NSString
*
)
messageAction
InScene
:(
enum
WXScene
)
scene
{
InScene
:(
enum
WXScene
)
scene
{
WXWebpageObject
*
ext
=
[
WXWebpageObject
object
];
WXWebpageObject
*
ext
=
[
WXWebpageObject
object
];
ext
.
webpageUrl
=
urlString
;
ext
.
webpageUrl
=
urlString
;
...
@@ -64,12 +66,12 @@
...
@@ -64,12 +66,12 @@
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
Description
:
description
Description
:
description
Object:
ext
Object:
ext
MessageExt
:
nil
MessageExt:
messageExt
MessageAction
:
nil
MessageAction:
messageAction
ThumbImage:
thumbImage
ThumbImage:
thumbImage
MediaTag:
tagName
];
MediaTag:
tagName
];
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
...
@@ -78,46 +80,68 @@
...
@@ -78,46 +80,68 @@
+
(
BOOL
)
sendMusicURL
:(
NSString
*
)
musicURL
+
(
BOOL
)
sendMusicURL
:(
NSString
*
)
musicURL
dataURL
:(
NSString
*
)
dataURL
dataURL
:(
NSString
*
)
dataURL
MusicLowBandUrl
:(
NSString
*
)
musicLowBandUrl
MusicLowBandDataUrl
:(
NSString
*
)
musicLowBandDataUrl
Title
:(
NSString
*
)
title
Title
:(
NSString
*
)
title
Description
:(
NSString
*
)
description
Description
:(
NSString
*
)
description
ThumbImage
:(
UIImage
*
)
thumbImage
ThumbImage
:(
UIImage
*
)
thumbImage
MessageExt
:(
NSString
*
)
messageExt
MessageAction
:(
NSString
*
)
messageAction
TagName
:(
NSString
*
)
tagName
InScene
:(
enum
WXScene
)
scene
{
InScene
:(
enum
WXScene
)
scene
{
WXMusicObject
*
ext
=
[
WXMusicObject
object
];
WXMusicObject
*
ext
=
[
WXMusicObject
object
];
ext
.
musicUrl
=
musicURL
;
ext
.
musicDataUrl
=
dataURL
;
if
([
StringUtil
isBlank
:
musicURL
])
{
ext
.
musicLowBandUrl
=
musicLowBandUrl
;
ext
.
musicLowBandDataUrl
=
musicLowBandDataUrl
;
}
else
{
ext
.
musicUrl
=
musicURL
;
ext
.
musicDataUrl
=
dataURL
;
}
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
Description
:
description
Description
:
description
Object:
ext
Object:
ext
MessageExt
:
nil
MessageExt:
messageExt
MessageAction
:
nil
MessageAction:
messageAction
ThumbImage:
thumbImage
ThumbImage:
thumbImage
MediaTag
:
nil
];
MediaTag:
tagName
];
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
return
[
WXApi
sendReq
:
req
];
return
[
WXApi
sendReq
:
req
];
}
}
+
(
BOOL
)
sendVideoURL
:(
NSString
*
)
videoURL
+
(
BOOL
)
sendVideoURL
:(
NSString
*
)
videoURL
VideoLowBandUrl
:(
NSString
*
)
videoLowBandUrl
Title
:(
NSString
*
)
title
Title
:(
NSString
*
)
title
Description
:(
NSString
*
)
description
Description
:(
NSString
*
)
description
ThumbImage
:(
UIImage
*
)
thumbImage
ThumbImage
:(
UIImage
*
)
thumbImage
MessageExt
:(
NSString
*
)
messageExt
MessageAction
:(
NSString
*
)
messageAction
TagName
:(
NSString
*
)
tagName
InScene
:(
enum
WXScene
)
scene
{
InScene
:(
enum
WXScene
)
scene
{
WXMediaMessage
*
message
=
[
WXMediaMessage
message
];
WXMediaMessage
*
message
=
[
WXMediaMessage
message
];
message
.
title
=
title
;
message
.
title
=
title
;
message
.
description
=
description
;
message
.
description
=
description
;
message
.
messageExt
=
messageExt
;
message
.
messageAction
=
messageAction
;
message
.
mediaTagName
=
tagName
;
[
message
setThumbImage
:
thumbImage
];
[
message
setThumbImage
:
thumbImage
];
WXVideoObject
*
ext
=
[
WXVideoObject
object
];
WXVideoObject
*
ext
=
[
WXVideoObject
object
];
ext
.
videoUrl
=
videoURL
;
if
([
StringUtil
isBlank
:
videoURL
])
{
ext
.
videoLowBandUrl
=
videoLowBandUrl
;
}
else
{
ext
.
videoUrl
=
videoURL
;
}
message
.
mediaObject
=
ext
;
message
.
mediaObject
=
ext
;
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
...
@@ -129,13 +153,13 @@
...
@@ -129,13 +153,13 @@
InScene
:(
enum
WXScene
)
scene
{
InScene
:(
enum
WXScene
)
scene
{
WXMediaMessage
*
message
=
[
WXMediaMessage
message
];
WXMediaMessage
*
message
=
[
WXMediaMessage
message
];
[
message
setThumbImage
:
thumbImage
];
[
message
setThumbImage
:
thumbImage
];
WXEmoticonObject
*
ext
=
[
WXEmoticonObject
object
];
WXEmoticonObject
*
ext
=
[
WXEmoticonObject
object
];
ext
.
emoticonData
=
emotionData
;
ext
.
emoticonData
=
emotionData
;
message
.
mediaObject
=
ext
;
message
.
mediaObject
=
ext
;
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
...
@@ -152,14 +176,14 @@
...
@@ -152,14 +176,14 @@
message
.
title
=
title
;
message
.
title
=
title
;
message
.
description
=
description
;
message
.
description
=
description
;
[
message
setThumbImage
:
thumbImage
];
[
message
setThumbImage
:
thumbImage
];
WXFileObject
*
ext
=
[
WXFileObject
object
];
WXFileObject
*
ext
=
[
WXFileObject
object
];
ext
.
fileExtension
=
@"pdf"
;
ext
.
fileExtension
=
@"pdf"
;
ext
.
fileData
=
fileData
;
ext
.
fileData
=
fileData
;
message
.
mediaObject
=
ext
;
message
.
mediaObject
=
ext
;
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
...
@@ -175,8 +199,10 @@
...
@@ -175,8 +199,10 @@
hdImageData
:(
NSData
*
)
hdImageData
hdImageData
:(
NSData
*
)
hdImageData
withShareTicket
:(
BOOL
)
withShareTicket
withShareTicket
:(
BOOL
)
withShareTicket
miniProgramType
:(
WXMiniProgramType
)
programType
miniProgramType
:(
WXMiniProgramType
)
programType
InScene
:
(
enum
WXScene
)
scene
MessageExt
:(
NSString
*
)
messageExt
{
MessageAction
:(
NSString
*
)
messageAction
TagName
:(
NSString
*
)
tagName
InScene
:(
enum
WXScene
)
scene
{
WXMiniProgramObject
*
ext
=
[
WXMiniProgramObject
object
];
WXMiniProgramObject
*
ext
=
[
WXMiniProgramObject
object
];
ext
.
webpageUrl
=
webpageUrl
;
ext
.
webpageUrl
=
webpageUrl
;
ext
.
userName
=
userName
;
ext
.
userName
=
userName
;
...
@@ -184,35 +210,33 @@
...
@@ -184,35 +210,33 @@
ext
.
hdImageData
=
hdImageData
;
ext
.
hdImageData
=
hdImageData
;
ext
.
withShareTicket
=
withShareTicket
;
ext
.
withShareTicket
=
withShareTicket
;
ext
.
miniProgramType
=
programType
;
ext
.
miniProgramType
=
programType
;
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
WXMediaMessage
*
message
=
[
WXMediaMessage
messageWithTitle
:
title
Description
:
description
Description
:
description
Object:
ext
Object:
ext
MessageExt
:
nil
MessageExt:
messageExt
MessageAction
:
nil
MessageAction:
messageAction
ThumbImage:
thumbImage
ThumbImage:
thumbImage
MediaTag
:
nil
];
MediaTag:
tagName
];
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
return
[
WXApi
sendReq
:
req
];
return
[
WXApi
sendReq
:
req
];
}
}
+
(
BOOL
)
launchMiniProgramWithUserName
:(
NSString
*
)
userName
+
(
BOOL
)
launchMiniProgramWithUserName
:(
NSString
*
)
userName
path
:(
NSString
*
)
path
path
:(
NSString
*
)
path
type
:
(
WXMiniProgramType
)
miniProgramType
type
:(
WXMiniProgramType
)
miniProgramType
{
{
WXLaunchMiniProgramReq
*
launchMiniProgramReq
=
[
WXLaunchMiniProgramReq
object
];
WXLaunchMiniProgramReq
*
launchMiniProgramReq
=
[
WXLaunchMiniProgramReq
object
];
launchMiniProgramReq
.
userName
=
userName
;
launchMiniProgramReq
.
userName
=
userName
;
launchMiniProgramReq
.
path
=
path
;
launchMiniProgramReq
.
path
=
path
;
launchMiniProgramReq
.
miniProgramType
=
miniProgramType
;
launchMiniProgramReq
.
miniProgramType
=
miniProgramType
;
return
[
WXApi
sendReq
:
launchMiniProgramReq
];
}
return
[
WXApi
sendReq
:
launchMiniProgramReq
];
}
+
(
BOOL
)
sendAppContentData
:(
NSData
*
)
data
+
(
BOOL
)
sendAppContentData
:(
NSData
*
)
data
...
@@ -236,8 +260,8 @@
...
@@ -236,8 +260,8 @@
MessageAction:
action
MessageAction:
action
ThumbImage:
thumbImage
ThumbImage:
thumbImage
MediaTag:
nil
];
MediaTag:
nil
];
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
SendMessageToWXReq
*
req
=
[
SendMessageToWXReq
requestWithText
:
nil
OrMediaMessage
:
message
OrMediaMessage
:
message
bText:
NO
bText:
NO
InScene:
scene
];
InScene:
scene
];
...
@@ -245,7 +269,7 @@
...
@@ -245,7 +269,7 @@
}
}
+
(
BOOL
)
addCardsToCardPackage
:
(
NSArray
*
)
cardIds
cardExts
:
(
NSArray
*
)
cardExts
{
+
(
BOOL
)
addCardsToCardPackage
:(
NSArray
*
)
cardIds
cardExts
:(
NSArray
*
)
cardExts
{
NSMutableArray
*
cardItems
=
[
NSMutableArray
array
];
NSMutableArray
*
cardItems
=
[
NSMutableArray
array
];
for
(
NSString
*
cardId
in
cardIds
)
{
for
(
NSString
*
cardId
in
cardIds
)
{
WXCardItem
*
item
=
[[
WXCardItem
alloc
]
init
];
WXCardItem
*
item
=
[[
WXCardItem
alloc
]
init
];
...
@@ -253,13 +277,13 @@
...
@@ -253,13 +277,13 @@
item
.
appID
=
@"wxf8b4f85f3a794e77"
;
item
.
appID
=
@"wxf8b4f85f3a794e77"
;
[
cardItems
addObject
:
item
];
[
cardItems
addObject
:
item
];
}
}
for
(
NSInteger
index
=
0
;
index
<
cardItems
.
count
;
index
++
)
{
for
(
NSInteger
index
=
0
;
index
<
cardItems
.
count
;
index
++
)
{
WXCardItem
*
item
=
cardItems
[
index
];
WXCardItem
*
item
=
cardItems
[
index
];
NSString
*
ext
=
cardExts
[
index
];
NSString
*
ext
=
cardExts
[
index
];
item
.
extMsg
=
ext
;
item
.
extMsg
=
ext
;
}
}
AddCardToWXCardPackageReq
*
req
=
[[
AddCardToWXCardPackageReq
alloc
]
init
];
AddCardToWXCardPackageReq
*
req
=
[[
AddCardToWXCardPackageReq
alloc
]
init
];
req
.
cardAry
=
cardItems
;
req
.
cardAry
=
cardItems
;
return
[
WXApi
sendReq
:
req
];
return
[
WXApi
sendReq
:
req
];
...
@@ -269,8 +293,7 @@
...
@@ -269,8 +293,7 @@
cardSign
:(
NSString
*
)
cardSign
cardSign
:(
NSString
*
)
cardSign
nonceStr
:(
NSString
*
)
nonceStr
nonceStr
:(
NSString
*
)
nonceStr
signType
:(
NSString
*
)
signType
signType
:(
NSString
*
)
signType
timestamp
:
(
UInt32
)
timestamp
timestamp
:(
UInt32
)
timestamp
{
{
WXChooseCardReq
*
chooseCardReq
=
[[
WXChooseCardReq
alloc
]
init
];
WXChooseCardReq
*
chooseCardReq
=
[[
WXChooseCardReq
alloc
]
init
];
chooseCardReq
.
appID
=
appid
;
chooseCardReq
.
appID
=
appid
;
chooseCardReq
.
cardSign
=
cardSign
;
chooseCardReq
.
cardSign
=
cardSign
;
...
@@ -278,18 +301,18 @@
...
@@ -278,18 +301,18 @@
chooseCardReq
.
signType
=
signType
;
chooseCardReq
.
signType
=
signType
;
chooseCardReq
.
timeStamp
=
timestamp
;
chooseCardReq
.
timeStamp
=
timestamp
;
return
[
WXApi
sendReq
:
chooseCardReq
];
return
[
WXApi
sendReq
:
chooseCardReq
];
}
}
+
(
BOOL
)
sendAuthRequestScope
:(
NSString
*
)
scope
+
(
BOOL
)
sendAuthRequestScope
:(
NSString
*
)
scope
State
:(
NSString
*
)
state
State
:(
NSString
*
)
state
OpenID
:(
NSString
*
)
openID
OpenID
:(
NSString
*
)
openID
InViewController
:(
UIViewController
*
)
viewController
{
InViewController
:(
UIViewController
*
)
viewController
{
SendAuthReq
*
req
=
[[
SendAuthReq
alloc
]
init
];
SendAuthReq
*
req
=
[[
SendAuthReq
alloc
]
init
];
req
.
scope
=
scope
;
// @"post_timeline,sns"
req
.
scope
=
scope
;
// @"post_timeline,sns"
req
.
state
=
state
;
req
.
state
=
state
;
req
.
openID
=
openID
;
req
.
openID
=
openID
;
return
[
WXApi
sendAuthReq
:
req
return
[
WXApi
sendAuthReq
:
req
viewController
:
viewController
viewController
:
viewController
delegate:
[
WXApiManager
sharedManager
]];
delegate:
[
WXApiManager
sharedManager
]];
...
@@ -300,7 +323,7 @@
...
@@ -300,7 +323,7 @@
UserName
:(
NSString
*
)
userName
UserName
:(
NSString
*
)
userName
ExtMsg
:(
NSString
*
)
extMessage
{
ExtMsg
:(
NSString
*
)
extMessage
{
[
WXApi
registerApp
:
appID
];
[
WXApi
registerApp
:
appID
];
JumpToBizProfileReq
*
req
=
[[
JumpToBizProfileReq
alloc
]
init
];
JumpToBizProfileReq
*
req
=
[[
JumpToBizProfileReq
alloc
]
init
];
req
.
profileType
=
WXBizProfileType_Device
;
req
.
profileType
=
WXBizProfileType_Device
;
req
.
username
=
userName
;
req
.
username
=
userName
;
req
.
extMsg
=
extMessage
;
req
.
extMsg
=
extMessage
;
...
@@ -312,15 +335,14 @@
...
@@ -312,15 +335,14 @@
tousrname
:(
NSString
*
)
tousrname
tousrname
:(
NSString
*
)
tousrname
ExtMsg
:(
NSString
*
)
extMsg
{
ExtMsg
:(
NSString
*
)
extMsg
{
[
WXApi
registerApp
:
appID
];
[
WXApi
registerApp
:
appID
];
JumpToBizWebviewReq
*
req
=
[[
JumpToBizWebviewReq
alloc
]
init
];
JumpToBizWebviewReq
*
req
=
[[
JumpToBizWebviewReq
alloc
]
init
];
req
.
tousrname
=
tousrname
;
req
.
tousrname
=
tousrname
;
req
.
extMsg
=
extMsg
;
req
.
extMsg
=
extMsg
;
req
.
webType
=
WXMPWebviewType_Ad
;
req
.
webType
=
WXMPWebviewType_Ad
;
return
[
WXApi
sendReq
:
req
];
return
[
WXApi
sendReq
:
req
];
}
}
+
(
BOOL
)
openUrl
:
(
NSString
*
)
url
+
(
BOOL
)
openUrl
:(
NSString
*
)
url
{
{
OpenWebviewReq
*
req
=
[[
OpenWebviewReq
alloc
]
init
];
OpenWebviewReq
*
req
=
[[
OpenWebviewReq
alloc
]
init
];
req
.
url
=
url
;
req
.
url
=
url
;
return
[
WXApi
sendReq
:
req
];
return
[
WXApi
sendReq
:
req
];
...
@@ -330,8 +352,7 @@
...
@@ -330,8 +352,7 @@
cardSign
:(
NSString
*
)
cardSign
cardSign
:(
NSString
*
)
cardSign
nonceStr
:(
NSString
*
)
nonceStr
nonceStr
:(
NSString
*
)
nonceStr
signType
:(
NSString
*
)
signType
signType
:(
NSString
*
)
signType
timestamp
:
(
UInt32
)
timestamp
timestamp
:(
UInt32
)
timestamp
{
{
WXChooseInvoiceReq
*
chooseInvoiceReq
=
[[
WXChooseInvoiceReq
alloc
]
init
];
WXChooseInvoiceReq
*
chooseInvoiceReq
=
[[
WXChooseInvoiceReq
alloc
]
init
];
chooseInvoiceReq
.
appID
=
appid
;
chooseInvoiceReq
.
appID
=
appid
;
chooseInvoiceReq
.
cardSign
=
cardSign
;
chooseInvoiceReq
.
cardSign
=
cardSign
;
...
...
lib/src/models/wechat_share_models.dart
浏览文件 @
d603a5fb
...
@@ -76,6 +76,11 @@ class WeChatShareMiniProgramModel extends WeChatShareModel {
...
@@ -76,6 +76,11 @@ class WeChatShareMiniProgramModel extends WeChatShareModel {
final
String
thumbnail
;
final
String
thumbnail
;
final
String
hdImagePath
;
final
bool
withShareTicket
;
///[hdImagePath] only works on iOS.
WeChatShareMiniProgramModel
(
WeChatShareMiniProgramModel
(
{
@required
this
.
webPageUrl
,
{
@required
this
.
webPageUrl
,
int
miniProgramType
,
int
miniProgramType
,
...
@@ -84,6 +89,8 @@ class WeChatShareMiniProgramModel extends WeChatShareModel {
...
@@ -84,6 +89,8 @@ class WeChatShareMiniProgramModel extends WeChatShareModel {
this
.
title
,
this
.
title
,
this
.
description
,
this
.
description
,
this
.
thumbnail
,
this
.
thumbnail
,
this
.
withShareTicket
:
false
,
this
.
hdImagePath
,
String
transaction
,
String
transaction
,
WeChatScene
scene
,
WeChatScene
scene
,
String
messageExt
,
String
messageExt
,
...
@@ -112,7 +119,9 @@ class WeChatShareMiniProgramModel extends WeChatShareModel {
...
@@ -112,7 +119,9 @@ class WeChatShareMiniProgramModel extends WeChatShareModel {
"description"
:
description
,
"description"
:
description
,
_transaction:
transaction
,
_transaction:
transaction
,
_scene:
scene
.
toString
(),
_scene:
scene
.
toString
(),
_thumbnail:
thumbnail
_thumbnail:
thumbnail
,
"withShareTicket"
:
withShareTicket
,
"hdImagePath"
:
hdImagePath
};
};
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论