|
@@ -23,7 +23,7 @@
|
|
|
|
|
|
@property (nonatomic, strong) UIImage *shareImage;
|
|
|
|
|
|
-@property (nonatomic, strong) UIViewController *displayCtrl;
|
|
|
+@property (nonatomic, weak) UIViewController *displayCtrl;
|
|
|
|
|
|
@property (nonatomic, assign) KSSHARETYPE shareType;
|
|
|
|
|
@@ -79,24 +79,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 = weakSelf.shareImage;
|
|
|
+ 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:@"仅支持图片分享到群组"];
|
|
|
}
|
|
|
}
|
|
@@ -104,30 +104,30 @@
|
|
|
}
|
|
|
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) {
|
|
|
- descMessage = 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 = weakSelf.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"]];
|
|
|
- shareObj.webpageUrl = weakSelf.shareUrl;
|
|
|
+ shareObj.webpageUrl = self.shareUrl;
|
|
|
//分享消息对象设置分享内容对象
|
|
|
messageObject.shareObject = shareObj;
|
|
|
}
|
|
@@ -135,8 +135,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{
|
|
@@ -144,8 +144,8 @@
|
|
|
UMSocialShareResponse *resp = data;
|
|
|
//分享结果消息
|
|
|
NSLog(@"************分享成功 %@*********",resp.message);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(YES,@"分享成功");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(YES,@"分享成功");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享成功"];
|
|
|
}
|
|
|
}else{
|
|
@@ -230,13 +230,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{
|
|
@@ -244,8 +243,8 @@
|
|
|
UMSocialShareResponse *resp = data;
|
|
|
//分享结果消息
|
|
|
NSLog(@"************分享成功 %@*********",resp.message);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(YES,@"分享成功");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(YES,@"分享成功");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享成功"];
|
|
|
}
|
|
|
}else{
|
|
@@ -290,12 +289,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{
|
|
@@ -303,8 +301,8 @@
|
|
|
UMSocialShareResponse *resp = data;
|
|
|
//分享结果消息
|
|
|
NSLog(@"************分享成功 %@*********",resp.message);
|
|
|
- if (weakSelf.callback) {
|
|
|
- weakSelf.callback(YES,@"分享成功");
|
|
|
+ if (self.callback) {
|
|
|
+ self.callback(YES,@"分享成功");
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:@"分享成功"];
|
|
|
}
|
|
|
}else{
|