Commit ba05d8b3 authored by lwq's avatar lwq

fix 分享一张图片时添加客户端安装检查

parent 4717a01e
...@@ -45,7 +45,9 @@ ...@@ -45,7 +45,9 @@
+ (BOOL)isClientInstalled:(GMSharePlatform)platformType{ + (BOOL)isClientInstalled:(GMSharePlatform)platformType{
if (platformType == GMSharePlatformQQ) { if (platformType == GMSharePlatformQQ ||
platformType == GMSharePlatformQQSpace ||
platformType == GMSharePlatformQQFriend) {
return [QQApiInterface isQQInstalled] ? YES : NO; return [QQApiInterface isQQInstalled] ? YES : NO;
} else if ((platformType == GMSharePlatformWechatTimeline) | (platformType == GMSharePlatformWechatSession) | (platformType == GMSharePlatformWechat)) { } else if ((platformType == GMSharePlatformWechatTimeline) | (platformType == GMSharePlatformWechatSession) | (platformType == GMSharePlatformWechat)) {
return [WXApi isWXAppInstalled] ? YES : NO; return [WXApi isWXAppInstalled] ? YES : NO;
...@@ -218,6 +220,13 @@ ...@@ -218,6 +220,13 @@
只分享一张图片 只分享一张图片
*/ */
- (void)shareImage:(UIImage *)image platform:(GMSharePlatform)platformType { - (void)shareImage:(UIImage *)image platform:(GMSharePlatform)platformType {
if (![GMShareSDK isClientInstalled:platformType]) {
NSString *platfomName = [self getPlatformNameWithType:platformType];
if (platfomName) {
[UIAlertController showgm_OKAlertWithTitle:@"提示" message:[NSString stringWithFormat:@"未安装%@",platfomName] actionTitle:@"取消" actionHandler:^{}];
return;
}
}
switch (platformType) { switch (platformType) {
case GMSharePlatformQQFriend: { case GMSharePlatformQQFriend: {
[self QQFriendShareWithImage:image]; [self QQFriendShareWithImage:image];
...@@ -641,5 +650,23 @@ ...@@ -641,5 +650,23 @@
// req.mpInfo = [DouyinOpenSDKMPInfo mpInfoWithIdentifier:@"you_mp_identifier" title:@"title" desc:@"desc" startPageURL:nil]; // req.mpInfo = [DouyinOpenSDKMPInfo mpInfoWithIdentifier:@"you_mp_identifier" title:@"title" desc:@"desc" startPageURL:nil];
} }
- (NSString *)getPlatformNameWithType:(GMSharePlatform)platformType {
switch (platformType) {
case GMSharePlatformSinaWeibo:
return @"微博客户端";
case GMSharePlatformQQSpace:
return @"QQ客户端";
case GMSharePlatformQQFriend:
return @"QQ客户端";
case GMSharePlatformWechatSession:
return @"微信客户端";
case GMSharePlatformWechatTimeline:
return @"微信客户端";
default:
break;
}
return nil;
}
@end @end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment