|
@@ -23,7 +23,7 @@
|
|
|
|
|
|
@property (nonatomic, strong) UIImage *shareImage;
|
|
|
|
|
|
-@property (nonatomic, strong) UIViewController *displayCtrl;
|
|
|
+@property (nonatomic, weak) UIViewController *displayCtrl;
|
|
|
|
|
|
@property (nonatomic, assign) KSSHARETYPE shareType;
|
|
|
|
|
@@ -80,24 +80,24 @@
|
|
|
}
|
|
|
|
|
|
- (void)openShareView {
|
|
|
- MJWeakSelf;
|
|
|
+
|
|
|
[UMSocialUIManager setShareMenuViewDelegate:self];
|
|
|
[UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {
|
|
|
if (platformType == UMSocialPlatformType_UserDefine_Begin+1) { // 分享到群组
|
|
|
- if (weakSelf.shareType == KSSHARETYPE_IMAGE) {
|
|
|
+ if (self.shareType == KSSHARETYPE_IMAGE) {
|
|
|
KSImageShareViewController *shareGroupCtrl = [[KSImageShareViewController alloc] init];
|
|
|
shareGroupCtrl.shareImage = self.shareImage;
|
|
|
[shareGroupCtrl shareGroupCallback:^(BOOL isSuccess, NSString *descMsg) {
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(isSuccess,descMsg);
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(isSuccess,descMsg);
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:descMsg];
|
|
|
}
|
|
|
}];
|
|
|
- [weakSelf.displayCtrl.navigationController pushViewController:shareGroupCtrl animated:YES];
|
|
|
+ [self.displayCtrl.navigationController pushViewController:shareGroupCtrl animated:YES];
|
|
|
}
|
|
|
else {
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(NO,@"仅支持图片分享到群组");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(NO,@"仅支持图片分享到群组");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"仅支持图片分享到群组"];
|
|
|
}
|
|
|
}
|
|
@@ -105,28 +105,28 @@
|
|
|
}
|
|
|
else if (platformType == UMSocialPlatformType_UserDefine_Begin+2) { // 图片保存到相册
|
|
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
|
|
- pasteboard.string = weakSelf.saveLinkUrl;
|
|
|
+ pasteboard.string = self.saveLinkUrl;
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"复制成功"];
|
|
|
}
|
|
|
else {
|
|
|
//创建分享消息对象
|
|
|
UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
|
|
|
NSString *shareTitle = @"";
|
|
|
- if (![NSString isEmptyString:weakSelf.shareTitle]) {
|
|
|
- shareTitle = weakSelf.shareTitle;
|
|
|
+ if (![NSString isEmptyString:self.shareTitle]) {
|
|
|
+ shareTitle = self.shareTitle;
|
|
|
}
|
|
|
NSString *descMessage = @"";
|
|
|
- if (weakSelf.shareMessage) {
|
|
|
+ if (self.shareMessage) {
|
|
|
descMessage = self.shareMessage;
|
|
|
}
|
|
|
// 创建分享对象
|
|
|
- if (weakSelf.shareType == KSSHARETYPE_IMAGE) {
|
|
|
+ if (self.shareType == KSSHARETYPE_IMAGE) {
|
|
|
UMShareImageObject *shareObj = [UMShareImageObject shareObjectWithTitle:shareTitle descr:descMessage thumImage:[UIImage imageNamed:@"shareImage"]];
|
|
|
shareObj.shareImage = self.shareImage;
|
|
|
//分享消息对象设置分享内容对象
|
|
|
messageObject.shareObject = shareObj;
|
|
|
}
|
|
|
- else if (weakSelf.shareType == KSSHARETYPE_VODEO) {
|
|
|
+ else if (self.shareType == KSSHARETYPE_VODEO) {
|
|
|
UMShareWebpageObject *shareObj = [UMShareWebpageObject shareObjectWithTitle:shareTitle descr:descMessage thumImage:[UIImage imageNamed:@"shareImage"]];
|
|
|
// NSString *shareUrl = [self.shareUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
shareObj.webpageUrl = self.shareUrl;
|
|
@@ -137,8 +137,8 @@
|
|
|
[[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:nil completion:^(id data, NSError *error) {
|
|
|
if (error) {
|
|
|
NSLog(@"************分享失败 %@*********",error);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(NO, @"分享失败");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(NO, @"分享失败");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享失败"];
|
|
|
}
|
|
|
}else{
|
|
@@ -146,8 +146,8 @@
|
|
|
UMSocialShareResponse *resp = data;
|
|
|
//分享结果消息
|
|
|
NSLog(@"************分享成功 %@*********",resp.message);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(YES,@"分享成功");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(YES,@"分享成功");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享成功"];
|
|
|
}
|
|
|
}else{
|
|
@@ -232,13 +232,12 @@
|
|
|
//分享消息对象设置分享内容对象
|
|
|
messageObject.shareObject = shareObj;
|
|
|
}
|
|
|
- MJWeakSelf;
|
|
|
//调用分享接口
|
|
|
[[UMSocialManager defaultManager] shareToPlatform:UMSocialPlatformType_WechatSession messageObject:messageObject currentViewController:nil completion:^(id data, NSError *error) {
|
|
|
if (error) {
|
|
|
NSLog(@"************分享失败 %@*********",error);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(NO, @"分享失败");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(NO, @"分享失败");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享失败"];
|
|
|
}
|
|
|
}else{
|
|
@@ -246,8 +245,8 @@
|
|
|
UMSocialShareResponse *resp = data;
|
|
|
//分享结果消息
|
|
|
NSLog(@"************分享成功 %@*********",resp.message);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(YES,@"分享成功");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(YES,@"分享成功");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享成功"];
|
|
|
}
|
|
|
}else{
|
|
@@ -292,12 +291,11 @@
|
|
|
messageObject.shareObject = shareObj;
|
|
|
}
|
|
|
//调用分享接口
|
|
|
- MJWeakSelf;
|
|
|
[[UMSocialManager defaultManager] shareToPlatform:UMSocialPlatformType_WechatTimeLine messageObject:messageObject currentViewController:nil completion:^(id data, NSError *error) {
|
|
|
if (error) {
|
|
|
NSLog(@"************分享失败 %@*********",error);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(NO, @"分享失败");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(NO, @"分享失败");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享失败"];
|
|
|
}
|
|
|
}else{
|
|
@@ -305,8 +303,8 @@
|
|
|
UMSocialShareResponse *resp = data;
|
|
|
//分享结果消息
|
|
|
NSLog(@"************分享成功 %@*********",resp.message);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(YES,@"分享成功");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(YES,@"分享成功");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享成功"];
|
|
|
}
|
|
|
}else{
|