Commit 7fbda6687c6b6b521a71f4227fb329c94572189c
1 parent
59cde36e
no message
Showing
17 changed files
with
87 additions
and
1029 deletions
CNLiveScioLive.xcodeproj/project.pbxproj
| @@ -7,15 +7,9 @@ | @@ -7,15 +7,9 @@ | ||
| 7 | objects = { | 7 | objects = { |
| 8 | 8 | ||
| 9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
| 10 | - 080AB4C1217AD47D008BA78F /* TemplateShareButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */; }; | ||
| 11 | - 080AB4C2217AD47D008BA78F /* TemplateShareButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */; }; | ||
| 12 | - 080AB4C3217AD47D008BA78F /* TemplateShareButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */; }; | ||
| 13 | 080AB4C6217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; | 10 | 080AB4C6217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; |
| 14 | 080AB4C7217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; | 11 | 080AB4C7217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; |
| 15 | 080AB4C8217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; | 12 | 080AB4C8217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; |
| 16 | - 080AB4CB217AD51A008BA78F /* XWShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4CA217AD51A008BA78F /* XWShareView.m */; }; | ||
| 17 | - 080AB4CC217AD51A008BA78F /* XWShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4CA217AD51A008BA78F /* XWShareView.m */; }; | ||
| 18 | - 080AB4CD217AD51A008BA78F /* XWShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4CA217AD51A008BA78F /* XWShareView.m */; }; | ||
| 19 | 083847E1215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; | 13 | 083847E1215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; |
| 20 | 083847E2215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; | 14 | 083847E2215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; |
| 21 | 083847E3215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; | 15 | 083847E3215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; |
| @@ -782,12 +776,8 @@ | @@ -782,12 +776,8 @@ | ||
| 782 | /* End PBXCopyFilesBuildPhase section */ | 776 | /* End PBXCopyFilesBuildPhase section */ |
| 783 | 777 | ||
| 784 | /* Begin PBXFileReference section */ | 778 | /* Begin PBXFileReference section */ |
| 785 | - 080AB4BF217AD47D008BA78F /* TemplateShareButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TemplateShareButton.h; sourceTree = "<group>"; }; | ||
| 786 | - 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TemplateShareButton.m; sourceTree = "<group>"; }; | ||
| 787 | 080AB4C4217AD4F4008BA78F /* TemplateShareManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TemplateShareManager.h; sourceTree = "<group>"; }; | 779 | 080AB4C4217AD4F4008BA78F /* TemplateShareManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TemplateShareManager.h; sourceTree = "<group>"; }; |
| 788 | 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TemplateShareManager.m; sourceTree = "<group>"; }; | 780 | 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TemplateShareManager.m; sourceTree = "<group>"; }; |
| 789 | - 080AB4C9217AD51A008BA78F /* XWShareView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XWShareView.h; sourceTree = "<group>"; }; | ||
| 790 | - 080AB4CA217AD51A008BA78F /* XWShareView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XWShareView.m; sourceTree = "<group>"; }; | ||
| 791 | 083847DF215C5DDD00186618 /* VPImageCropperViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPImageCropperViewController.h; sourceTree = "<group>"; }; | 781 | 083847DF215C5DDD00186618 /* VPImageCropperViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPImageCropperViewController.h; sourceTree = "<group>"; }; |
| 792 | 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VPImageCropperViewController.m; sourceTree = "<group>"; }; | 782 | 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VPImageCropperViewController.m; sourceTree = "<group>"; }; |
| 793 | 0838483C215C838B00186618 /* CNLiveENTabBarController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveENTabBarController.h; sourceTree = "<group>"; }; | 783 | 0838483C215C838B00186618 /* CNLiveENTabBarController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveENTabBarController.h; sourceTree = "<group>"; }; |
| @@ -1320,12 +1310,8 @@ | @@ -1320,12 +1310,8 @@ | ||
| 1320 | 080AB4BE217AD457008BA78F /* ShareTool */ = { | 1310 | 080AB4BE217AD457008BA78F /* ShareTool */ = { |
| 1321 | isa = PBXGroup; | 1311 | isa = PBXGroup; |
| 1322 | children = ( | 1312 | children = ( |
| 1323 | - 080AB4BF217AD47D008BA78F /* TemplateShareButton.h */, | ||
| 1324 | - 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */, | ||
| 1325 | 080AB4C4217AD4F4008BA78F /* TemplateShareManager.h */, | 1313 | 080AB4C4217AD4F4008BA78F /* TemplateShareManager.h */, |
| 1326 | 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */, | 1314 | 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */, |
| 1327 | - 080AB4C9217AD51A008BA78F /* XWShareView.h */, | ||
| 1328 | - 080AB4CA217AD51A008BA78F /* XWShareView.m */, | ||
| 1329 | ); | 1315 | ); |
| 1330 | path = ShareTool; | 1316 | path = ShareTool; |
| 1331 | sourceTree = "<group>"; | 1317 | sourceTree = "<group>"; |
| @@ -3065,7 +3051,6 @@ | @@ -3065,7 +3051,6 @@ | ||
| 3065 | 08C08FE3214FA01B00E23D16 /* CNLiveViewController.m in Sources */, | 3051 | 08C08FE3214FA01B00E23D16 /* CNLiveViewController.m in Sources */, |
| 3066 | 0838483E215C838B00186618 /* CNLiveENTabBarController.m in Sources */, | 3052 | 0838483E215C838B00186618 /* CNLiveENTabBarController.m in Sources */, |
| 3067 | 085D86C7215A20A50037D480 /* CNLiveUserSettingViewController.m in Sources */, | 3053 | 085D86C7215A20A50037D480 /* CNLiveUserSettingViewController.m in Sources */, |
| 3068 | - 080AB4CB217AD51A008BA78F /* XWShareView.m in Sources */, | ||
| 3069 | 084ACE0F21547F9F0089E035 /* DBAction.m in Sources */, | 3054 | 084ACE0F21547F9F0089E035 /* DBAction.m in Sources */, |
| 3070 | 08C0909C2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, | 3055 | 08C0909C2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, |
| 3071 | 08585D59215B4C7200FC2CA2 /* PGDatePickManager.m in Sources */, | 3056 | 08585D59215B4C7200FC2CA2 /* PGDatePickManager.m in Sources */, |
| @@ -3151,7 +3136,6 @@ | @@ -3151,7 +3136,6 @@ | ||
| 3151 | 08585DDA215B70DA00FC2CA2 /* JSONKit.m in Sources */, | 3136 | 08585DDA215B70DA00FC2CA2 /* JSONKit.m in Sources */, |
| 3152 | 084ACE1D2154895E0089E035 /* GCPlaceholderTextView.m in Sources */, | 3137 | 084ACE1D2154895E0089E035 /* GCPlaceholderTextView.m in Sources */, |
| 3153 | 08940D882154F6FD00F85DB6 /* CNLiveNewsDetailModel.m in Sources */, | 3138 | 08940D882154F6FD00F85DB6 /* CNLiveNewsDetailModel.m in Sources */, |
| 3154 | - 080AB4C1217AD47D008BA78F /* TemplateShareButton.m in Sources */, | ||
| 3155 | 084ACE0221547B4D0089E035 /* CNLiveMyCollectionViewController.m in Sources */, | 3139 | 084ACE0221547B4D0089E035 /* CNLiveMyCollectionViewController.m in Sources */, |
| 3156 | 084ACE1221547F9F0089E035 /* NoticeData.m in Sources */, | 3140 | 084ACE1221547F9F0089E035 /* NoticeData.m in Sources */, |
| 3157 | 08C08F81214F997F00E23D16 /* main.m in Sources */, | 3141 | 08C08F81214F997F00E23D16 /* main.m in Sources */, |
| @@ -3283,7 +3267,6 @@ | @@ -3283,7 +3267,6 @@ | ||
| 3283 | 08FB876A215DD1C200DA5423 /* VoiceViewController.m in Sources */, | 3267 | 08FB876A215DD1C200DA5423 /* VoiceViewController.m in Sources */, |
| 3284 | 08585D48215B4C7200FC2CA2 /* UIColor+PGHex.m in Sources */, | 3268 | 08585D48215B4C7200FC2CA2 /* UIColor+PGHex.m in Sources */, |
| 3285 | 08C08F8B214F998000E23D16 /* CNLiveScioLiveTests.m in Sources */, | 3269 | 08C08F8B214F998000E23D16 /* CNLiveScioLiveTests.m in Sources */, |
| 3286 | - 080AB4C2217AD47D008BA78F /* TemplateShareButton.m in Sources */, | ||
| 3287 | 08C090772150C79C00E23D16 /* ZXWSegment.m in Sources */, | 3270 | 08C090772150C79C00E23D16 /* ZXWSegment.m in Sources */, |
| 3288 | 085D869C2159CBBB0037D480 /* CNLivePlayerController.m in Sources */, | 3271 | 085D869C2159CBBB0037D480 /* CNLivePlayerController.m in Sources */, |
| 3289 | 08585CE6215B302C00FC2CA2 /* CNLiveSearchViewController.m in Sources */, | 3272 | 08585CE6215B302C00FC2CA2 /* CNLiveSearchViewController.m in Sources */, |
| @@ -3306,7 +3289,6 @@ | @@ -3306,7 +3289,6 @@ | ||
| 3306 | 08C0909D2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, | 3289 | 08C0909D2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, |
| 3307 | C3E502DB2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */, | 3290 | C3E502DB2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */, |
| 3308 | 08585D6F215B4C7200FC2CA2 /* PGPickerView.m in Sources */, | 3291 | 08585D6F215B4C7200FC2CA2 /* PGPickerView.m in Sources */, |
| 3309 | - 080AB4CC217AD51A008BA78F /* XWShareView.m in Sources */, | ||
| 3310 | 08C090472150BC6500E23D16 /* CNMyTableViewHeaderView.m in Sources */, | 3292 | 08C090472150BC6500E23D16 /* CNMyTableViewHeaderView.m in Sources */, |
| 3311 | 08B5C56A215334CC00F5476E /* CNLiveSettingViewController.m in Sources */, | 3293 | 08B5C56A215334CC00F5476E /* CNLiveSettingViewController.m in Sources */, |
| 3312 | 08C090B621510E4B00E23D16 /* CNLiveTableViewCell.m in Sources */, | 3294 | 08C090B621510E4B00E23D16 /* CNLiveTableViewCell.m in Sources */, |
| @@ -3441,7 +3423,6 @@ | @@ -3441,7 +3423,6 @@ | ||
| 3441 | 08FB876B215DD1C200DA5423 /* VoiceViewController.m in Sources */, | 3423 | 08FB876B215DD1C200DA5423 /* VoiceViewController.m in Sources */, |
| 3442 | 08585D49215B4C7200FC2CA2 /* UIColor+PGHex.m in Sources */, | 3424 | 08585D49215B4C7200FC2CA2 /* UIColor+PGHex.m in Sources */, |
| 3443 | 08C08F96214F998000E23D16 /* CNLiveScioLiveUITests.m in Sources */, | 3425 | 08C08F96214F998000E23D16 /* CNLiveScioLiveUITests.m in Sources */, |
| 3444 | - 080AB4C3217AD47D008BA78F /* TemplateShareButton.m in Sources */, | ||
| 3445 | 08C090782150C79C00E23D16 /* ZXWSegment.m in Sources */, | 3426 | 08C090782150C79C00E23D16 /* ZXWSegment.m in Sources */, |
| 3446 | 085D869D2159CBBB0037D480 /* CNLivePlayerController.m in Sources */, | 3427 | 085D869D2159CBBB0037D480 /* CNLivePlayerController.m in Sources */, |
| 3447 | 08585CE7215B302C00FC2CA2 /* CNLiveSearchViewController.m in Sources */, | 3428 | 08585CE7215B302C00FC2CA2 /* CNLiveSearchViewController.m in Sources */, |
| @@ -3464,7 +3445,6 @@ | @@ -3464,7 +3445,6 @@ | ||
| 3464 | 08C0909E2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, | 3445 | 08C0909E2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, |
| 3465 | C3E502DC2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */, | 3446 | C3E502DC2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */, |
| 3466 | 08585D70215B4C7200FC2CA2 /* PGPickerView.m in Sources */, | 3447 | 08585D70215B4C7200FC2CA2 /* PGPickerView.m in Sources */, |
| 3467 | - 080AB4CD217AD51A008BA78F /* XWShareView.m in Sources */, | ||
| 3468 | 08C090482150BC6500E23D16 /* CNMyTableViewHeaderView.m in Sources */, | 3448 | 08C090482150BC6500E23D16 /* CNMyTableViewHeaderView.m in Sources */, |
| 3469 | 08B5C56B215334CC00F5476E /* CNLiveSettingViewController.m in Sources */, | 3449 | 08B5C56B215334CC00F5476E /* CNLiveSettingViewController.m in Sources */, |
| 3470 | 08C090B721510E4B00E23D16 /* CNLiveTableViewCell.m in Sources */, | 3450 | 08C090B721510E4B00E23D16 /* CNLiveTableViewCell.m in Sources */, |
CNLiveScioLive/AppDelegate.m
| @@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
| 46 | [MobClick startWithAppkey:uMengKey reportPolicy:BATCH channelId:nil]; | 46 | [MobClick startWithAppkey:uMengKey reportPolicy:BATCH channelId:nil]; |
| 47 | [MobClick setLogEnabled:NO]; | 47 | [MobClick setLogEnabled:NO]; |
| 48 | 48 | ||
| 49 | - [[TemplateShareManager shareSingleton] shareConfig]; | 49 | + [[TemplateShareManager manager] shareConfig]; |
| 50 | 50 | ||
| 51 | //语言 | 51 | //语言 |
| 52 | [self setApplicationLanguage]; | 52 | [self setApplicationLanguage]; |
CNLiveScioLive/Pages/Home/新闻详情/Controller/ArticleDetailViewController.m
| @@ -239,52 +239,8 @@ | @@ -239,52 +239,8 @@ | ||
| 239 | break; | 239 | break; |
| 240 | case 1002://分享 | 240 | case 1002://分享 |
| 241 | { | 241 | { |
| 242 | - NSArray* imageArray = weakSelf.model.img?@[weakSelf.model.img]:@[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 243 | - if (imageArray) { | ||
| 244 | - NSString *text = [NSString stringWithFormat:@"%@",weakSelf.model.subTitle]; | ||
| 245 | - if ([text isEqualToString:@"<null>"]) { | ||
| 246 | - text = weakSelf.model.title; | ||
| 247 | - } | ||
| 248 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 249 | - [shareParams SSDKSetupShareParamsByText:text images:imageArray url:[NSURL URLWithString:weakSelf.model.pageUrl] title:weakSelf.model.title type:SSDKContentTypeWebPage]; | ||
| 250 | - NSArray *items = @[ | ||
| 251 | - @(SSDKPlatformTypeQQ), | ||
| 252 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 253 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 254 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 255 | - ]; | ||
| 256 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 257 | - NSLog(@"%lu",(unsigned long)state); | ||
| 258 | - switch (state) { | ||
| 259 | - case SSDKResponseStateSuccess: | ||
| 260 | - { | ||
| 261 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 262 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 263 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 264 | - | ||
| 265 | - }]; | ||
| 266 | - [alert addAction:action1]; | ||
| 267 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 268 | - break; | ||
| 269 | - } | ||
| 270 | - case SSDKResponseStateFail: | ||
| 271 | - { | ||
| 272 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 273 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 274 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 275 | - | ||
| 276 | - }]; | ||
| 277 | - [alert addAction:action1]; | ||
| 278 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 279 | - break; | ||
| 280 | - } | ||
| 281 | - default: | ||
| 282 | - break; | ||
| 283 | - } | ||
| 284 | - | ||
| 285 | - }]; | ||
| 286 | - | ||
| 287 | - } | 242 | + [[TemplateShareManager manager] shareImage:self.model.img title:self.model.title text:self.model.desc?self.model.desc:self.model.title url:self.model.pageUrl controller:self]; |
| 243 | + return; | ||
| 288 | } | 244 | } |
| 289 | break; | 245 | break; |
| 290 | 246 |
CNLiveScioLive/Pages/Home/新闻详情/Controller/VideoDetailViewController.m
| @@ -242,52 +242,8 @@ static NSString *newsLeftPicTableViewCell = @"CNLiveNewsLeftPicTableViewCell"; | @@ -242,52 +242,8 @@ static NSString *newsLeftPicTableViewCell = @"CNLiveNewsLeftPicTableViewCell"; | ||
| 242 | break; | 242 | break; |
| 243 | case 1002://分享 | 243 | case 1002://分享 |
| 244 | { | 244 | { |
| 245 | - NSArray* imageArray = weakSelf.model.img?@[weakSelf.model.img]:@[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 246 | - if (imageArray) { | ||
| 247 | - NSString *text = [NSString stringWithFormat:@"%@",weakSelf.model.subTitle]; | ||
| 248 | - if ([text isEqualToString:@"<null>"]) { | ||
| 249 | - text = weakSelf.model.title; | ||
| 250 | - } | ||
| 251 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 252 | - [shareParams SSDKSetupShareParamsByText:text images:imageArray url:[NSURL URLWithString:weakSelf.model.pageUrl] title:weakSelf.model.title type:SSDKContentTypeWebPage]; | ||
| 253 | - NSArray *items = @[ | ||
| 254 | - @(SSDKPlatformTypeQQ), | ||
| 255 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 256 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 257 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 258 | - ]; | ||
| 259 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 260 | - NSLog(@"%lu",(unsigned long)state); | ||
| 261 | - switch (state) { | ||
| 262 | - case SSDKResponseStateSuccess: | ||
| 263 | - { | ||
| 264 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 265 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 266 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 267 | - | ||
| 268 | - }]; | ||
| 269 | - [alert addAction:action1]; | ||
| 270 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 271 | - break; | ||
| 272 | - } | ||
| 273 | - case SSDKResponseStateFail: | ||
| 274 | - { | ||
| 275 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 276 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 277 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 278 | - | ||
| 279 | - }]; | ||
| 280 | - [alert addAction:action1]; | ||
| 281 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 282 | - break; | ||
| 283 | - } | ||
| 284 | - default: | ||
| 285 | - break; | ||
| 286 | - } | ||
| 287 | - | ||
| 288 | - }]; | ||
| 289 | - | ||
| 290 | - } | 245 | + [[TemplateShareManager manager] shareImage:self.model.img title:self.model.title text:self.model.desc?self.model.desc:self.model.title url:self.model.pageUrl controller:self]; |
| 246 | + return; | ||
| 291 | } | 247 | } |
| 292 | break; | 248 | break; |
| 293 | 249 |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldArticleDetailViewController.m
| @@ -217,66 +217,13 @@ | @@ -217,66 +217,13 @@ | ||
| 217 | } | 217 | } |
| 218 | } | 218 | } |
| 219 | } else if (30000 == btn.tag) { | 219 | } else if (30000 == btn.tag) { |
| 220 | - __weak typeof(self) weakSelf = self; | ||
| 221 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; | 220 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; |
| 222 | - NSArray* imageArray = nil; | ||
| 223 | - if (0 == [img length]) { | ||
| 224 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 225 | - } else { | ||
| 226 | - imageArray = @[img]; | ||
| 227 | - } | ||
| 228 | - if (imageArray) { | ||
| 229 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"desc"]]; | ||
| 230 | - if ([text isEqualToString:@"<null>"]||[text isEqualToString:@""]) { | ||
| 231 | - text = _dictionary[@"title"]; | ||
| 232 | - } | ||
| 233 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 234 | - [shareParams SSDKSetupShareParamsByText:text | ||
| 235 | - images:imageArray | ||
| 236 | - url:[NSURL URLWithString:_dictionary[@"pageUrl"]] | ||
| 237 | - title:_dictionary[@"title"] | ||
| 238 | - type:SSDKContentTypeWebPage]; | ||
| 239 | - NSArray *items = @[ | ||
| 240 | - @(SSDKPlatformTypeQQ), | ||
| 241 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 242 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 243 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 244 | - ]; | ||
| 245 | - [ShareSDK showShareActionSheet:nil | ||
| 246 | - items:items | ||
| 247 | - shareParams:shareParams | ||
| 248 | - onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 249 | - NSLog(@"%lu",(unsigned long)state); | ||
| 250 | - switch (state) { | ||
| 251 | - case SSDKResponseStateSuccess: | ||
| 252 | - { | ||
| 253 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 254 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 255 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 256 | - | ||
| 257 | - }]; | ||
| 258 | - [alert addAction:action1]; | ||
| 259 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 260 | - break; | ||
| 261 | - } | ||
| 262 | - case SSDKResponseStateFail: | ||
| 263 | - { | ||
| 264 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 265 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 266 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 267 | - | ||
| 268 | - }]; | ||
| 269 | - [alert addAction:action1]; | ||
| 270 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 271 | - break; | ||
| 272 | - } | ||
| 273 | - default: | ||
| 274 | - break; | ||
| 275 | - } | ||
| 276 | - } | ||
| 277 | - ];} | ||
| 278 | - | 221 | + NSString *title = [NSString stringWithFormat:@"%@",_dictionary[@"title"]]; |
| 222 | + NSString *text = [NSString stringWithFormat:@"%@",!_dictionary[@"desc"]||[_dictionary[@"desc"] isEqualToString:@""]?title:_dictionary[@"desc"]]; | ||
| 223 | + NSString *url = [NSString stringWithFormat:@"%@",_dictionary[@"pageUrl"]]; | ||
| 224 | + [[TemplateShareManager manager] shareImage:img title:title text:text url:url controller:self]; | ||
| 279 | return; | 225 | return; |
| 226 | + | ||
| 280 | } | 227 | } |
| 281 | } | 228 | } |
| 282 | - (void)viewDidLoad { | 229 | - (void)viewDidLoad { |
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
| @@ -159,63 +159,13 @@ | @@ -159,63 +159,13 @@ | ||
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| 161 | } else if (30000 == btn.tag) { | 161 | } else if (30000 == btn.tag) { |
| 162 | - __weak typeof(self) weakSelf = self; | ||
| 163 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; | 162 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; |
| 164 | - NSArray* imageArray = nil; | ||
| 165 | - if (0 == [img length]) { | ||
| 166 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 167 | - } else { | ||
| 168 | - imageArray = @[img]; | ||
| 169 | - } | ||
| 170 | - if (imageArray) { | ||
| 171 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"desc"]]; | ||
| 172 | - if ([text isEqualToString:@"<null>"]||[text isEqualToString:@""]) { | ||
| 173 | - text = _dictionary[@"title"]; | ||
| 174 | - } | ||
| 175 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 176 | - [shareParams SSDKSetupShareParamsByText:text images:imageArray url:[NSURL URLWithString:_dictionary[@"pageUrl"]] title:_dictionary[@"title"] type:SSDKContentTypeWebPage]; | ||
| 177 | - //2、分享(可以弹出我们的分享菜单和编辑界面) | ||
| 178 | - NSArray *items = @[ | ||
| 179 | - @(SSDKPlatformTypeQQ), | ||
| 180 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 181 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 182 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 183 | - ]; | ||
| 184 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 185 | - | ||
| 186 | - switch (state) { | ||
| 187 | - case SSDKResponseStateSuccess: | ||
| 188 | - { | ||
| 189 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 190 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 191 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 192 | - | ||
| 193 | - }]; | ||
| 194 | - [alert addAction:action1]; | ||
| 195 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 196 | - break; | ||
| 197 | - } | ||
| 198 | - case SSDKResponseStateFail: | ||
| 199 | - { | ||
| 200 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 201 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 202 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 203 | - | ||
| 204 | - }]; | ||
| 205 | - [alert addAction:action1]; | ||
| 206 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 207 | - break; | ||
| 208 | - } | ||
| 209 | - default: | ||
| 210 | - break; | ||
| 211 | - } | ||
| 212 | - | ||
| 213 | - | ||
| 214 | - } | ||
| 215 | - | ||
| 216 | - ];} | ||
| 217 | - | 163 | + NSString *title = [NSString stringWithFormat:@"%@",_dictionary[@"title"]]; |
| 164 | + NSString *text = [NSString stringWithFormat:@"%@",!_dictionary[@"desc"]||[_dictionary[@"desc"] isEqualToString:@""]?title:_dictionary[@"desc"]]; | ||
| 165 | + NSString *url = [NSString stringWithFormat:@"%@",_dictionary[@"pageUrl"]]; | ||
| 166 | + [[TemplateShareManager manager] shareImage:img title:title text:text url:url controller:self]; | ||
| 218 | return; | 167 | return; |
| 168 | + | ||
| 219 | } | 169 | } |
| 220 | } | 170 | } |
| 221 | - (void)viewWillAppear:(BOOL)animated { | 171 | - (void)viewWillAppear:(BOOL)animated { |
CNLiveScioLive/Pages/Home/新闻详情/OldController/SCIOSpecialViewController.m
| @@ -122,67 +122,13 @@ | @@ -122,67 +122,13 @@ | ||
| 122 | } | 122 | } |
| 123 | } | 123 | } |
| 124 | } else if (30000 == btn.tag) { | 124 | } else if (30000 == btn.tag) { |
| 125 | - __weak typeof(self) weakSelf = self; | ||
| 126 | - | ||
| 127 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; | 125 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; |
| 128 | - NSArray* imageArray = nil; | ||
| 129 | - if (0 == [img length]) { | ||
| 130 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 131 | - } else { | ||
| 132 | - imageArray = @[img]; | ||
| 133 | - } | ||
| 134 | - if (imageArray) { | ||
| 135 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"subTitle"]]; | ||
| 136 | - if ([text isEqualToString:@"<null>"]) { | ||
| 137 | - text = _dictionary[@"title"]; | ||
| 138 | - } | ||
| 139 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 140 | - [shareParams SSDKSetupShareParamsByText:text | ||
| 141 | - images:imageArray | ||
| 142 | - url:[NSURL URLWithString:_dictionary[@"pageUrl"]] | ||
| 143 | - title:_dictionary[@"title"] | ||
| 144 | - type:SSDKContentTypeWebPage]; | ||
| 145 | - NSArray *items = @[ | ||
| 146 | - @(SSDKPlatformTypeQQ), | ||
| 147 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 148 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 149 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 150 | - ]; | ||
| 151 | - [ShareSDK showShareActionSheet:nil | ||
| 152 | - items:items | ||
| 153 | - shareParams:shareParams | ||
| 154 | - onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 155 | - NSLog(@"%lu",(unsigned long)state); | ||
| 156 | - switch (state) { | ||
| 157 | - case SSDKResponseStateSuccess: | ||
| 158 | - { | ||
| 159 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 160 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 161 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 162 | - | ||
| 163 | - }]; | ||
| 164 | - [alert addAction:action1]; | ||
| 165 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 166 | - break; | ||
| 167 | - } | ||
| 168 | - case SSDKResponseStateFail: | ||
| 169 | - { | ||
| 170 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 171 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 172 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 173 | - | ||
| 174 | - }]; | ||
| 175 | - [alert addAction:action1]; | ||
| 176 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 177 | - break; | ||
| 178 | - } | ||
| 179 | - default: | ||
| 180 | - break; | ||
| 181 | - } | ||
| 182 | - } | ||
| 183 | - ];} | ||
| 184 | - | 126 | + NSString *title = [NSString stringWithFormat:@"%@",_dictionary[@"title"]]; |
| 127 | + NSString *text = [NSString stringWithFormat:@"%@",!_dictionary[@"desc"]||[_dictionary[@"desc"] isEqualToString:@""]?title:_dictionary[@"desc"]]; | ||
| 128 | + NSString *url = [NSString stringWithFormat:@"%@",_dictionary[@"pageUrl"]]; | ||
| 129 | + [[TemplateShareManager manager] shareImage:img title:title text:text url:url controller:self]; | ||
| 185 | return; | 130 | return; |
| 131 | + | ||
| 186 | } | 132 | } |
| 187 | } | 133 | } |
| 188 | - (void)viewDidLoad { | 134 | - (void)viewDidLoad { |
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.m
| @@ -191,67 +191,11 @@ | @@ -191,67 +191,11 @@ | ||
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | - (void)shareButton:(UIButton *)btn{ | 193 | - (void)shareButton:(UIButton *)btn{ |
| 194 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"Description"]]; | ||
| 195 | - NSString *shareUrl = [NSString stringWithFormat:@"%@",_dictionary[@"shareUrl"]]; | ||
| 196 | - | ||
| 197 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"poster"]]; | 194 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"poster"]]; |
| 198 | - NSArray* imageArray = nil; | ||
| 199 | - if (0 == [img length]) { | ||
| 200 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 201 | - } else { | ||
| 202 | - imageArray = @[img]; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - if ([text isEqualToString:@"<null>"]) { | ||
| 206 | - text = _dictionary[@"title"]; | ||
| 207 | - } | ||
| 208 | - if ([shareUrl isEqualToString:@"<null>"]||[shareUrl isEqualToString:@"(null)"]) { | ||
| 209 | - shareUrl = @"http://app.scio.gov.cn/gxbShare.html"; | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 213 | - [shareParams SSDKSetupShareParamsByText:text | ||
| 214 | - images:imageArray | ||
| 215 | - url:[NSURL URLWithString:shareUrl] | ||
| 216 | - title:_dictionary[@"title"] | ||
| 217 | - type:SSDKContentTypeWebPage]; | ||
| 218 | - //2、分享(可以弹出我们的分享菜单和编辑界面) | ||
| 219 | - //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响 | ||
| 220 | - NSArray *items = @[ | ||
| 221 | - @(SSDKPlatformTypeQQ), | ||
| 222 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 223 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 224 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 225 | - ]; | ||
| 226 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 227 | - | ||
| 228 | - switch (state) { | ||
| 229 | - case SSDKResponseStateSuccess: | ||
| 230 | - { | ||
| 231 | - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess") | ||
| 232 | - message:nil | ||
| 233 | - delegate:nil | ||
| 234 | - cancelButtonTitle:CustomStr(@"Sure") | ||
| 235 | - otherButtonTitles:nil]; | ||
| 236 | - [alertView show]; | ||
| 237 | - break; | ||
| 238 | - } | ||
| 239 | - case SSDKResponseStateFail: | ||
| 240 | - { | ||
| 241 | - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure") | ||
| 242 | - message:[NSString stringWithFormat:@"%@",error] | ||
| 243 | - delegate:nil | ||
| 244 | - cancelButtonTitle:CustomStr(@"Sure") | ||
| 245 | - otherButtonTitles:nil, nil]; | ||
| 246 | - [alert show]; | ||
| 247 | - break; | ||
| 248 | - } | ||
| 249 | - default: | ||
| 250 | - break; | ||
| 251 | - | ||
| 252 | - } | ||
| 253 | - | ||
| 254 | - }]; | 195 | + NSString *title = [NSString stringWithFormat:@"%@",_dictionary[@"title"]]; |
| 196 | + NSString *text = [NSString stringWithFormat:@"%@",!_dictionary[@"Description"]||[_dictionary[@"Description"] isEqualToString:@""]?title:_dictionary[@"Description"]]; | ||
| 197 | + NSString *url = [NSString stringWithFormat:@"%@",_dictionary[@"shareUrl"]]; | ||
| 198 | + [[TemplateShareManager manager] shareImage:img title:title text:text url:url controller:self]; | ||
| 255 | 199 | ||
| 256 | } | 200 | } |
| 257 | 201 |
CNLiveScioLive/Pages/Live/Controller/TopNoticeViewController.m
| @@ -217,65 +217,13 @@ | @@ -217,65 +217,13 @@ | ||
| 217 | } | 217 | } |
| 218 | } | 218 | } |
| 219 | } else if (30000 == btn.tag) { | 219 | } else if (30000 == btn.tag) { |
| 220 | - __weak typeof(self) weakSelf = self; | ||
| 221 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"programs"][0][@"img"]]; | 220 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"programs"][0][@"img"]]; |
| 222 | - NSArray* imageArray = nil; | ||
| 223 | - if (!_dictionary[@"programs"][0][@"img"]||[img isEqualToString:@""]) { | ||
| 224 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 225 | - } else { | ||
| 226 | - imageArray = @[img]; | ||
| 227 | - } | ||
| 228 | - if (imageArray) { | ||
| 229 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"programs"][0][@"subTitle"]]; | ||
| 230 | - if (!_dictionary[@"programs"][0][@"subTitle"]||[text isEqualToString:@""]) { | ||
| 231 | - text = _dictionary[@"programs"][0][@"title"]; | ||
| 232 | - } | ||
| 233 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 234 | - [shareParams SSDKSetupShareParamsByText:text | ||
| 235 | - images:imageArray | ||
| 236 | - url:[NSURL URLWithString:_dictionary[@"programs"][0][@"pageUrl"]] | ||
| 237 | - title:_dictionary[@"programs"][0][@"title"] | ||
| 238 | - type:SSDKContentTypeWebPage]; | ||
| 239 | - NSArray *items = @[ | ||
| 240 | - @(SSDKPlatformTypeQQ), | ||
| 241 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 242 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 243 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 244 | - ]; | ||
| 245 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams | ||
| 246 | - onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 247 | - NSLog(@"%lu",(unsigned long)state); | ||
| 248 | - switch (state) { | ||
| 249 | - case SSDKResponseStateSuccess: | ||
| 250 | - { | ||
| 251 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 252 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 253 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 254 | - | ||
| 255 | - }]; | ||
| 256 | - [alert addAction:action1]; | ||
| 257 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 258 | - break; | ||
| 259 | - } | ||
| 260 | - case SSDKResponseStateFail: | ||
| 261 | - { | ||
| 262 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 263 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 264 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 265 | - | ||
| 266 | - }]; | ||
| 267 | - [alert addAction:action1]; | ||
| 268 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 269 | - break; | ||
| 270 | - } | ||
| 271 | - default: | ||
| 272 | - break; | ||
| 273 | - } | ||
| 274 | - } | ||
| 275 | - ]; | ||
| 276 | - | ||
| 277 | - } | 221 | + NSString *title = [NSString stringWithFormat:@"%@",_dictionary[@"programs"][0][@"title"]]; |
| 222 | + NSString *text = [NSString stringWithFormat:@"%@",!_dictionary[@"programs"][0][@"desc"]||[_dictionary[@"programs"][0][@"desc"] isEqualToString:@""]?title:_dictionary[@"programs"][0][@"desc"]]; | ||
| 223 | + NSString *url = [NSString stringWithFormat:@"%@",_dictionary[@"programs"][0][@"pageUrl"]]; | ||
| 224 | + [[TemplateShareManager manager] shareImage:img title:title text:text url:url controller:self]; | ||
| 278 | return; | 225 | return; |
| 226 | + | ||
| 279 | } | 227 | } |
| 280 | } | 228 | } |
| 281 | 229 |
CNLiveScioLive/Pages/Live/Controller/VideoPlayBackViewController.m
| @@ -14,6 +14,8 @@ | @@ -14,6 +14,8 @@ | ||
| 14 | 14 | ||
| 15 | @interface VideoPlayBackViewController ()<CNLivePlayerControllerDelegate> { | 15 | @interface VideoPlayBackViewController ()<CNLivePlayerControllerDelegate> { |
| 16 | BOOL isPlay; | 16 | BOOL isPlay; |
| 17 | + UIButton *_shareButton; | ||
| 18 | + | ||
| 17 | } | 19 | } |
| 18 | 20 | ||
| 19 | @end | 21 | @end |
| @@ -139,7 +141,7 @@ | @@ -139,7 +141,7 @@ | ||
| 139 | [shareButton addTarget:self action:@selector(shareButtonTaped:) forControlEvents:UIControlEventTouchUpInside]; | 141 | [shareButton addTarget:self action:@selector(shareButtonTaped:) forControlEvents:UIControlEventTouchUpInside]; |
| 140 | [self.view addSubview:shareButton]; | 142 | [self.view addSubview:shareButton]; |
| 141 | [shareButton setTag:30000]; | 143 | [shareButton setTag:30000]; |
| 142 | - | 144 | + _shareButton = shareButton; |
| 143 | } | 145 | } |
| 144 | - (void)shareButtonTaped:(id)sender { | 146 | - (void)shareButtonTaped:(id)sender { |
| 145 | UIButton *btn = (UIButton *)sender; | 147 | UIButton *btn = (UIButton *)sender; |
| @@ -168,62 +170,10 @@ | @@ -168,62 +170,10 @@ | ||
| 168 | } | 170 | } |
| 169 | } else if (30000 == btn.tag) { | 171 | } else if (30000 == btn.tag) { |
| 170 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; | 172 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; |
| 171 | - NSArray* imageArray = nil; | ||
| 172 | - if (0 == [img length]) { | ||
| 173 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 174 | - } else { | ||
| 175 | - imageArray = @[img]; | ||
| 176 | - } | ||
| 177 | - if (imageArray) { | ||
| 178 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"desc"]]; | ||
| 179 | - if ([text isEqualToString:@"<null>"]||[text isEqualToString:@""]) { | ||
| 180 | - text = _dictionary[@"title"]; | ||
| 181 | - } | ||
| 182 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 183 | - [shareParams SSDKSetupShareParamsByText:text | ||
| 184 | - images:imageArray | ||
| 185 | - url:[NSURL URLWithString:_dictionary[@"pageUrl"]] | ||
| 186 | - title:_dictionary[@"title"] | ||
| 187 | - type:SSDKContentTypeWebPage]; | ||
| 188 | - //2、分享(可以弹出我们的分享菜单和编辑界面) | ||
| 189 | - //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响 | ||
| 190 | - NSArray *items = @[ | ||
| 191 | - @(SSDKPlatformTypeQQ), | ||
| 192 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 193 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 194 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 195 | - ]; | ||
| 196 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 197 | - | ||
| 198 | - switch (state) { | ||
| 199 | - case SSDKResponseStateSuccess: | ||
| 200 | - { | ||
| 201 | - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess") | ||
| 202 | - message:nil | ||
| 203 | - delegate:nil | ||
| 204 | - cancelButtonTitle:CustomStr(@"Sure") | ||
| 205 | - otherButtonTitles:nil]; | ||
| 206 | - [alertView show]; | ||
| 207 | - break; | ||
| 208 | - } | ||
| 209 | - case SSDKResponseStateFail: | ||
| 210 | - { | ||
| 211 | - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure") | ||
| 212 | - message:[NSString stringWithFormat:@"%@",error] | ||
| 213 | - delegate:nil | ||
| 214 | - cancelButtonTitle:CustomStr(@"Sure") | ||
| 215 | - otherButtonTitles:nil, nil]; | ||
| 216 | - [alert show]; | ||
| 217 | - break; | ||
| 218 | - } | ||
| 219 | - default: | ||
| 220 | - break; | ||
| 221 | - } | ||
| 222 | - } | ||
| 223 | - | ||
| 224 | - ]; | ||
| 225 | - } | ||
| 226 | - | 173 | + NSString *title = [NSString stringWithFormat:@"%@",_dictionary[@"title"]]; |
| 174 | + NSString *text = [NSString stringWithFormat:@"%@",!_dictionary[@"desc"]||[_dictionary[@"desc"] isEqualToString:@""]?title:_dictionary[@"desc"]]; | ||
| 175 | + NSString *url = [NSString stringWithFormat:@"%@",_dictionary[@"pageUrl"]]; | ||
| 176 | + [[TemplateShareManager manager] shareImage:img title:title text:text url:url controller:self]; | ||
| 227 | return; | 177 | return; |
| 228 | } | 178 | } |
| 229 | } | 179 | } |
| @@ -542,61 +492,7 @@ | @@ -542,61 +492,7 @@ | ||
| 542 | } | 492 | } |
| 543 | 493 | ||
| 544 | - (void)shareButtonCNLivePlayerController:(CNLivePlayerController *)view{ | 494 | - (void)shareButtonCNLivePlayerController:(CNLivePlayerController *)view{ |
| 545 | - NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; | ||
| 546 | - NSArray* imageArray = nil; | ||
| 547 | - if (0 == [img length]) { | ||
| 548 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 549 | - } else { | ||
| 550 | - imageArray = @[img]; | ||
| 551 | - } | ||
| 552 | - if (imageArray) { | ||
| 553 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"desc"]]; | ||
| 554 | - if ([text isEqualToString:@"<null>"]||[text isEqualToString:@""]) { | ||
| 555 | - text = _dictionary[@"title"]; | ||
| 556 | - } | ||
| 557 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 558 | - [shareParams SSDKSetupShareParamsByText:text | ||
| 559 | - images:imageArray | ||
| 560 | - url:[NSURL URLWithString:_dictionary[@"pageUrl"]] | ||
| 561 | - title:_dictionary[@"title"] | ||
| 562 | - type:SSDKContentTypeWebPage]; | ||
| 563 | - //2、分享(可以弹出我们的分享菜单和编辑界面) | ||
| 564 | - //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响 | ||
| 565 | - NSArray *items = @[ | ||
| 566 | - @(SSDKPlatformTypeQQ), | ||
| 567 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 568 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 569 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 570 | - ]; | ||
| 571 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams | ||
| 572 | - onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 573 | - | ||
| 574 | - switch (state) { | ||
| 575 | - case SSDKResponseStateSuccess: | ||
| 576 | - { | ||
| 577 | - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess") | ||
| 578 | - message:nil | ||
| 579 | - delegate:nil | ||
| 580 | - cancelButtonTitle:CustomStr(@"Sure") | ||
| 581 | - otherButtonTitles:nil]; | ||
| 582 | - [alertView show]; | ||
| 583 | - break; | ||
| 584 | - } | ||
| 585 | - case SSDKResponseStateFail: | ||
| 586 | - { | ||
| 587 | - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure") | ||
| 588 | - message:[NSString stringWithFormat:@"%@",error] | ||
| 589 | - delegate:nil | ||
| 590 | - cancelButtonTitle:CustomStr(@"Sure") | ||
| 591 | - otherButtonTitles:nil, nil]; | ||
| 592 | - [alert show]; | ||
| 593 | - break; | ||
| 594 | - } | ||
| 595 | - default: | ||
| 596 | - break; | ||
| 597 | - } | ||
| 598 | - } | ||
| 599 | - ];} | 495 | + [self shareButtonTaped:_shareButton]; |
| 600 | 496 | ||
| 601 | } | 497 | } |
| 602 | 498 |
CNLiveScioLive/Pages/Newsound/OldController/VoiceViewController.m
| @@ -1060,66 +1060,12 @@ static const NSInteger margin = 34; | @@ -1060,66 +1060,12 @@ static const NSInteger margin = 34; | ||
| 1060 | } | 1060 | } |
| 1061 | #pragma mark - Action | 1061 | #pragma mark - Action |
| 1062 | - (void)shareBtnClicked:(id)sender { | 1062 | - (void)shareBtnClicked:(id)sender { |
| 1063 | - __weak typeof(self) weakSelf = self; | ||
| 1064 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; | 1063 | NSString *img = [NSString stringWithFormat:@"%@",_dictionary[@"img"]]; |
| 1065 | - NSArray* imageArray = nil; | ||
| 1066 | - if (0 == [img length]) { | ||
| 1067 | - imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 1068 | - } else { | ||
| 1069 | - imageArray = @[img]; | ||
| 1070 | - } | ||
| 1071 | - if (imageArray) { | ||
| 1072 | - NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"subTitle"]]; | ||
| 1073 | - if ([text isEqualToString:@"<null>"]) { | ||
| 1074 | - text = _dictionary[@"title"]; | ||
| 1075 | - } | ||
| 1076 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 1077 | - [shareParams SSDKSetupShareParamsByText:text | ||
| 1078 | - images:imageArray | ||
| 1079 | - url:[NSURL URLWithString:_dictionary[@"pageUrl"]] | ||
| 1080 | - title:_dictionary[@"title"] | ||
| 1081 | - type:SSDKContentTypeWebPage]; | ||
| 1082 | - //2、分享(可以弹出我们的分享菜单和编辑界面) | ||
| 1083 | - NSArray *items = @[ | ||
| 1084 | - @(SSDKPlatformTypeQQ), | ||
| 1085 | - @(SSDKPlatformSubTypeWechatTimeline), | ||
| 1086 | - @(SSDKPlatformSubTypeWechatSession), | ||
| 1087 | - @(SSDKPlatformTypeSinaWeibo) | ||
| 1088 | - ]; | ||
| 1089 | - [ShareSDK showShareActionSheet:nil items:items shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 1090 | - | ||
| 1091 | - switch (state) { | ||
| 1092 | - case SSDKResponseStateSuccess: | ||
| 1093 | - { | ||
| 1094 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 1095 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 1096 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 1097 | - | ||
| 1098 | - }]; | ||
| 1099 | - [alert addAction:action1]; | ||
| 1100 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 1101 | - break; | ||
| 1102 | - } | ||
| 1103 | - case SSDKResponseStateFail: | ||
| 1104 | - { | ||
| 1105 | - UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; | ||
| 1106 | - UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 1107 | - NSLog(@"点击了确定,进入确定的事件"); | ||
| 1108 | - | ||
| 1109 | - }]; | ||
| 1110 | - [alert addAction:action1]; | ||
| 1111 | - [weakSelf presentViewController:alert animated:YES completion:nil]; | ||
| 1112 | - break; | ||
| 1113 | - } | ||
| 1114 | - default: | ||
| 1115 | - break; | ||
| 1116 | - } | ||
| 1117 | - | ||
| 1118 | - }]; | ||
| 1119 | - | ||
| 1120 | - } | 1064 | + NSString *title = [NSString stringWithFormat:@"%@",_dictionary[@"title"]]; |
| 1065 | + NSString *text = [NSString stringWithFormat:@"%@",!_dictionary[@"desc"]||[_dictionary[@"desc"] isEqualToString:@""]?title:_dictionary[@"desc"]]; | ||
| 1066 | + NSString *url = [NSString stringWithFormat:@"%@",_dictionary[@"pageUrl"]]; | ||
| 1067 | + [[TemplateShareManager manager] shareImage:img title:title text:text url:url controller:self]; | ||
| 1121 | 1068 | ||
| 1122 | - return; | ||
| 1123 | } | 1069 | } |
| 1124 | 1070 | ||
| 1125 | - (void)favoriteBtnClicked:(id)sender { | 1071 | - (void)favoriteBtnClicked:(id)sender { |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareButton.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// TemplateShareButton.h | ||
| 3 | -// CNLiveScioLive | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2018/10/20. | ||
| 6 | -// Copyright © 2018年 CNLive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | - | ||
| 11 | -NS_ASSUME_NONNULL_BEGIN | ||
| 12 | -typedef NS_ENUM(NSUInteger, TemplateShareButtonType) { | ||
| 13 | - TemplateShareButtonTypeWeiBo = 0,//微博 | ||
| 14 | - TemplateShareButtonTypeWeiXin = 1,//微信好友 | ||
| 15 | - TemplateShareButtonTypePengYouQuan = 2,//微信朋友圈 | ||
| 16 | - TemplateShareButtonTypeQQ = 3,//QQ好友 | ||
| 17 | - TemplateShareButtonTypeQQZone = 4,//QQ空间 | ||
| 18 | - TemplateShareButtonTypeTXWeiBo = 5,//腾讯微博 | ||
| 19 | - TemplateShareButtonTypeXLWeiBo = 6,//新浪微博 | ||
| 20 | - TemplateShareButtonTypeRenRen = 7,//人人网 | ||
| 21 | - TemplateShareButtonTypeJuBao = 8//举报 | ||
| 22 | -}; | ||
| 23 | - | ||
| 24 | -@interface TemplateShareButton : UIButton | ||
| 25 | - | ||
| 26 | -/** | ||
| 27 | - * 分享的类型(新浪微博,微信,朋友圈,QQ,QQ空间,腾讯微博,人人,举报) | ||
| 28 | - */ | ||
| 29 | -@property (nonatomic,assign) TemplateShareButtonType shareButtonType; | ||
| 30 | - | ||
| 31 | -/** | ||
| 32 | - * 各个渠道的title | ||
| 33 | - */ | ||
| 34 | -@property (nonatomic,strong) NSString *title; | ||
| 35 | - | ||
| 36 | -/** | ||
| 37 | - * 各个渠道的图标 | ||
| 38 | - */ | ||
| 39 | -@property (nonatomic,strong) NSString *image; | ||
| 40 | - | ||
| 41 | -@end | ||
| 42 | - | ||
| 43 | -NS_ASSUME_NONNULL_END |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareButton.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// TemplateShareButton.m | ||
| 3 | -// CNLiveScioLive | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2018/10/20. | ||
| 6 | -// Copyright © 2018年 CNLive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "TemplateShareButton.h" | ||
| 10 | - | ||
| 11 | -@implementation TemplateShareButton{ | ||
| 12 | - UILabel *_titleLabel; | ||
| 13 | -} | ||
| 14 | - | ||
| 15 | -- (id)initWithFrame:(CGRect)frame{ | ||
| 16 | - self = [super initWithFrame:frame]; | ||
| 17 | - if (self) { | ||
| 18 | - self.imageEdgeInsets = UIEdgeInsetsMake(10.0f,10.0f, 10.0f, 10.0f); | ||
| 19 | - _titleLabel = [[UILabel alloc]init]; | ||
| 20 | - _titleLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:12.f]; | ||
| 21 | - _titleLabel.textColor = [ UIColor colorWithRed:255.0 green:255.0 blue:255.0 alpha:1]; | ||
| 22 | - _titleLabel.textAlignment = NSTextAlignmentCenter; | ||
| 23 | - [self addSubview:_titleLabel]; | ||
| 24 | - | ||
| 25 | - } | ||
| 26 | - return self; | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -#pragma mark -- Getter and Setter | ||
| 30 | -- (void)setTitle:(NSString *)title{ | ||
| 31 | - _title = title; | ||
| 32 | - _titleLabel.text = _title; | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | -- (void)setImage:(NSString *)image{ | ||
| 36 | - _image = image; | ||
| 37 | - [self setImage:[UIImage imageNamed:image] forState:UIControlStateNormal]; | ||
| 38 | - | ||
| 39 | -} | ||
| 40 | - | ||
| 41 | -- (void)layoutSubviews{ | ||
| 42 | - [super layoutSubviews]; | ||
| 43 | - _titleLabel.frame = CGRectMake(0, self.frame.size.width, self.frame.size.width, 12.0f); | ||
| 44 | - | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -@end |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareManager.h
| @@ -7,13 +7,12 @@ | @@ -7,13 +7,12 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
| 10 | -#import "TemplateShareButton.h" | ||
| 11 | 10 | ||
| 12 | NS_ASSUME_NONNULL_BEGIN | 11 | NS_ASSUME_NONNULL_BEGIN |
| 13 | 12 | ||
| 14 | @interface TemplateShareManager : NSObject | 13 | @interface TemplateShareManager : NSObject |
| 15 | 14 | ||
| 16 | -+ (instancetype)shareSingleton; | 15 | ++ (instancetype)manager; |
| 17 | 16 | ||
| 18 | /** | 17 | /** |
| 19 | * 注册分享以及配置信息 | 18 | * 注册分享以及配置信息 |
| @@ -23,12 +22,13 @@ NS_ASSUME_NONNULL_BEGIN | @@ -23,12 +22,13 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 23 | /** | 22 | /** |
| 24 | * 设置分享内容 | 23 | * 设置分享内容 |
| 25 | * | 24 | * |
| 26 | - * @param type 分享渠道 | ||
| 27 | - * @param shareText 分享内嵌文字 | ||
| 28 | - * @param shareImage 分享内嵌图片,可以传入UIImage或者NSData类型 | ||
| 29 | - * @param shareUrl 分享消息url地址 | 25 | + * @param title 分享内嵌文字 |
| 26 | + * @param text 分享内嵌文字 | ||
| 27 | + * @param image 分享内嵌图片,可以传入UIImage或者NSData类型 | ||
| 28 | + * @param url 分享消息url地址 | ||
| 29 | + * @param controller 控制器 | ||
| 30 | */ | 30 | */ |
| 31 | -- (void)shareType:(TemplateShareButtonType)type shareImage:(id)shareImage shareTitle:(NSString *)shareTitle shareText:(NSString *)shareText shareUrl:(NSString *)shareUrl; | 31 | +- (void)shareImage:(NSString *)image title:(NSString *)title text:(NSString *)text url:(NSString *)url controller:(UIViewController *)controller; |
| 32 | 32 | ||
| 33 | @end | 33 | @end |
| 34 | 34 |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareManager.m
| @@ -7,23 +7,21 @@ | @@ -7,23 +7,21 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "TemplateShareManager.h" | 9 | #import "TemplateShareManager.h" |
| 10 | -#import "TemplateShareButton.h" | ||
| 11 | 10 | ||
| 12 | @implementation TemplateShareManager | 11 | @implementation TemplateShareManager |
| 12 | +static TemplateShareManager *shareManager = nil; | ||
| 13 | 13 | ||
| 14 | -static TemplateShareManager *shareManaager = nil; | ||
| 15 | -+ (TemplateShareManager *)shareSingleton{ | 14 | ++ (TemplateShareManager *)manager{ |
| 16 | @synchronized(self){ | 15 | @synchronized(self){ |
| 17 | - if (shareManaager == nil) { | ||
| 18 | - shareManaager = [[TemplateShareManager alloc] init]; | 16 | + if (shareManager == nil) { |
| 17 | + shareManager = [[TemplateShareManager alloc] init]; | ||
| 19 | } | 18 | } |
| 20 | } | 19 | } |
| 21 | - return shareManaager; | 20 | + return shareManager; |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | -#pragma mark 注册友盟分享以及配置信息 | ||
| 25 | -- (void)shareConfig | ||
| 26 | -{ | 23 | +#pragma mark 注册ShareSDK分享以及配置信息 |
| 24 | +- (void)shareConfig { | ||
| 27 | [ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) { | 25 | [ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) { |
| 28 | 26 | ||
| 29 | [platformsRegister setupQQWithAppId:@"1105424006" appkey:@"EneqtYjiKSswk05g"]; | 27 | [platformsRegister setupQQWithAppId:@"1105424006" appkey:@"EneqtYjiKSswk05g"]; |
| @@ -36,108 +34,54 @@ static TemplateShareManager *shareManaager = nil; | @@ -36,108 +34,54 @@ static TemplateShareManager *shareManaager = nil; | ||
| 36 | 34 | ||
| 37 | }]; | 35 | }]; |
| 38 | 36 | ||
| 39 | -// [ShareSDK registerApp:@"134f952a9e004" activePlatforms:@[@(SSDKPlatformTypeSinaWeibo), | ||
| 40 | -// @(SSDKPlatformSubTypeWechatSession), | ||
| 41 | -// @(SSDKPlatformSubTypeWechatTimeline), | ||
| 42 | -// @(SSDKPlatformTypeQQ)] | ||
| 43 | -// onImport:^(SSDKPlatformType platformType) | ||
| 44 | -// { | ||
| 45 | -// switch (platformType) | ||
| 46 | -// { | ||
| 47 | -// case SSDKPlatformTypeWechat: | ||
| 48 | -// [ShareSDKConnector connectWeChat:[WXApi class]]; | ||
| 49 | -// break; | ||
| 50 | -// case SSDKPlatformTypeQQ: | ||
| 51 | -// [ShareSDKConnector connectQQ:[QQApiInterface class] tencentOAuthClass:[TencentOAuth class]]; | ||
| 52 | -// break; | ||
| 53 | -// case SSDKPlatformTypeSinaWeibo: | ||
| 54 | -// [ShareSDKConnector connectWeibo:[WeiboSDK class]]; | ||
| 55 | -// break; | ||
| 56 | -// default: | ||
| 57 | -// break; | ||
| 58 | -// } | ||
| 59 | -// } | ||
| 60 | -// onConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary *appInfo) | ||
| 61 | -// { | ||
| 62 | -// | ||
| 63 | -// switch (platformType) | ||
| 64 | -// { | ||
| 65 | -// case SSDKPlatformTypeSinaWeibo: | ||
| 66 | -// //设置新浪微博应用信息,其中authType设置为使用SSO+Web形式授权 | ||
| 67 | -// [appInfo SSDKSetupSinaWeiboByAppKey:@"604714517" | ||
| 68 | -// appSecret:@"542573f3d166742a230634d5c2576157" | ||
| 69 | -// redirectUri:@"https://api.weibo.com/oauth2/default.html" | ||
| 70 | -// authType:SSDKAuthTypeBoth]; | ||
| 71 | -// break; | ||
| 72 | -// case SSDKPlatformTypeWechat: | ||
| 73 | -// [appInfo SSDKSetupWeChatByAppId:@"wx1eb184b8425c2503" | ||
| 74 | -// appSecret:@"4d250e1ef3b7f5f1bc3579237fd4ee62"]; | ||
| 75 | -// break; | ||
| 76 | -// case SSDKPlatformTypeQQ: | ||
| 77 | -// [appInfo SSDKSetupQQByAppId:@"1105424006" | ||
| 78 | -// appKey:@"EneqtYjiKSswk05g" | ||
| 79 | -// authType:SSDKAuthTypeBoth]; | ||
| 80 | -// break; | ||
| 81 | -// default: | ||
| 82 | -// break; | ||
| 83 | -// } | ||
| 84 | -// }]; | ||
| 85 | - | ||
| 86 | } | 37 | } |
| 87 | 38 | ||
| 88 | -- (void)shareType:(TemplateShareButtonType)type shareImage:(id)shareImage shareTitle:(NSString *)shareTitle shareText:(NSString *)shareText shareUrl:(NSString *)shareUrl{ | ||
| 89 | - | ||
| 90 | - //1、创建分享参数 | ||
| 91 | - NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 92 | - [shareParams SSDKSetupShareParamsByText:shareText images:shareImage url:[NSURL URLWithString:shareUrl] title:shareTitle type:SSDKContentTypeWebPage]; | ||
| 93 | - | ||
| 94 | - //2、分享 | ||
| 95 | - if (type == TemplateShareButtonTypeWeiXin){ | ||
| 96 | - //微信 | ||
| 97 | - [self startSharePlatform:SSDKPlatformTypeWechat parameters:shareParams]; | ||
| 98 | - | ||
| 99 | - } | ||
| 100 | - else if (type == TemplateShareButtonTypePengYouQuan) { | ||
| 101 | - //朋友圈 | ||
| 102 | - [self startSharePlatform:SSDKPlatformSubTypeWechatTimeline parameters:shareParams]; | 39 | +- (void)shareImage:(NSString *)image title:(NSString *)title text:(NSString *)text url:(NSString *)url controller:(UIViewController *)controller { |
| 40 | + NSArray *imageArray = nil; | ||
| 41 | + if (!image||[image isEqualToString:@""]) { | ||
| 42 | + imageArray = @[[UIImage imageNamed:@"cnlive_zhouxin_icon"]]; | ||
| 43 | + } else { | ||
| 44 | + imageArray = @[image]; | ||
| 103 | } | 45 | } |
| 104 | - else if (type == TemplateShareButtonTypeXLWeiBo){ | ||
| 105 | - //新浪微博 | ||
| 106 | - [self startSharePlatform:SSDKPlatformTypeSinaWeibo parameters:shareParams]; | ||
| 107 | - | ||
| 108 | - } | ||
| 109 | - else if (type == TemplateShareButtonTypeQQ){ | ||
| 110 | |||
| 111 | - [self startSharePlatform:SSDKPlatformTypeQQ parameters:shareParams]; | ||
| 112 | - | ||
| 113 | - } | ||
| 114 | - else if (type == TemplateShareButtonTypeQQZone){ | ||
| 115 | - //qq空间 | ||
| 116 | - [self startSharePlatform:SSDKPlatformSubTypeQZone parameters:shareParams]; | ||
| 117 | - | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | -} | ||
| 121 | -- (void)startSharePlatform:(SSDKPlatformType)platform parameters:(NSMutableDictionary *)parameters{ | 46 | + NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; |
| 47 | + [shareParams SSDKSetupShareParamsByText:text images:imageArray url:[NSURL URLWithString:url?url:@"http://app.scio.gov.cn/gxbShare.html"] title:title type:SSDKContentTypeWebPage]; | ||
| 48 | + NSArray *items = @[ | ||
| 49 | + @(SSDKPlatformSubTypeWechatSession), | ||
| 50 | + @(SSDKPlatformSubTypeWechatTimeline), | ||
| 51 | + @(SSDKPlatformTypeQQ), | ||
| 52 | + @(SSDKPlatformTypeSinaWeibo) | ||
| 53 | + ]; | ||
| 122 | 54 | ||
| 123 | - [ShareSDK share:platform parameters:parameters onStateChanged:^(SSDKResponseState state, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error) { | ||
| 124 | - | 55 | + [ShareSDK showShareActionSheet:nil customItems:items shareParams:shareParams sheetConfiguration:nil onStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { |
| 125 | switch (state) { | 56 | switch (state) { |
| 126 | case SSDKResponseStateSuccess: | 57 | case SSDKResponseStateSuccess: |
| 127 | { | 58 | { |
| 128 | - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess") message:nil delegate:nil cancelButtonTitle:CustomStr(@"Sure") otherButtonTitles:nil]; | ||
| 129 | - [alertView show]; | 59 | + UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareSuccess") message:nil preferredStyle:UIAlertControllerStyleAlert]; |
| 60 | + UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 61 | + NSLog(@"点击了确定,进入确定的事件"); | ||
| 62 | + | ||
| 63 | + }]; | ||
| 64 | + [alert addAction:action1]; | ||
| 65 | + [controller presentViewController:alert animated:YES completion:nil]; | ||
| 130 | break; | 66 | break; |
| 131 | } | 67 | } |
| 132 | case SSDKResponseStateFail: | 68 | case SSDKResponseStateFail: |
| 133 | { | 69 | { |
| 134 | - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure") message:[NSString stringWithFormat:@"%@",error] delegate:nil cancelButtonTitle:CustomStr(@"Sure") otherButtonTitles:nil]; | ||
| 135 | - [alertView show]; | 70 | + UIAlertController *alert = [UIAlertController alertControllerWithTitle:CustomStr(@"ShareFailure") message:nil preferredStyle:UIAlertControllerStyleAlert]; |
| 71 | + UIAlertAction *action1 = [UIAlertAction actionWithTitle:CustomStr(@"Sure") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | ||
| 72 | + NSLog(@"点击了确定,进入确定的事件"); | ||
| 73 | + | ||
| 74 | + }]; | ||
| 75 | + [alert addAction:action1]; | ||
| 76 | + [controller presentViewController:alert animated:YES completion:nil]; | ||
| 136 | break; | 77 | break; |
| 137 | } | 78 | } |
| 138 | default: | 79 | default: |
| 139 | break; | 80 | break; |
| 140 | } | 81 | } |
| 82 | + | ||
| 141 | }]; | 83 | }]; |
| 84 | + | ||
| 142 | } | 85 | } |
| 86 | + | ||
| 143 | @end | 87 | @end |
CNLiveScioLive/Pages/Tools/ShareTool/XWShareView.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// XWShareView.h | ||
| 3 | -// CNLiveScioLive | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2018/10/20. | ||
| 6 | -// Copyright © 2018年 CNLive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | -#import "TemplateShareButton.h" | ||
| 11 | - | ||
| 12 | -NS_ASSUME_NONNULL_BEGIN | ||
| 13 | -@protocol XWShareViewDelegate <NSObject> | ||
| 14 | - | ||
| 15 | -@required | ||
| 16 | - | ||
| 17 | -- (void)shareBtnClickWithType:(TemplateShareButtonType)type andShareVC:(UIViewController *)shareVC; | ||
| 18 | - | ||
| 19 | -@end | ||
| 20 | -@interface XWShareView : UIView | ||
| 21 | - | ||
| 22 | - | ||
| 23 | -@property (nonatomic,weak) id<XWShareViewDelegate> shareDelegate; | ||
| 24 | - | ||
| 25 | -/** | ||
| 26 | - * 自定义初始化方法 | ||
| 27 | - * | ||
| 28 | - * @param frame frame | ||
| 29 | - * @param shareTitle reportButton是否隐藏 | ||
| 30 | - * @param shareText reportButton是否隐藏 | ||
| 31 | - * @param shareImg reportButton是否隐藏 | ||
| 32 | - * @param shareUrl reportButton是否隐藏 | ||
| 33 | - * | ||
| 34 | - * @return 返回一个XWShareView对象 | ||
| 35 | - */ | ||
| 36 | - | ||
| 37 | - | ||
| 38 | -- (instancetype)initWithFrame:(CGRect)frame ShareImg:(NSString *)shareImg ShareTitle:(NSString *)shareTitle ShareText:(NSString *)shareText ShareUrl:(NSString *)shareUrl; | ||
| 39 | - | ||
| 40 | -- (void)show; | ||
| 41 | - | ||
| 42 | -- (void)configibutton; | ||
| 43 | - | ||
| 44 | -@end | ||
| 45 | - | ||
| 46 | -NS_ASSUME_NONNULL_END |
CNLiveScioLive/Pages/Tools/ShareTool/XWShareView.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// XWShareView.m | ||
| 3 | -// CNLiveScioLive | ||
| 4 | -// | ||
| 5 | -// Created by CNLive-zxw on 2018/10/20. | ||
| 6 | -// Copyright © 2018年 CNLive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "XWShareView.h" | ||
| 10 | -#import "TemplateShareManager.h" | ||
| 11 | - | ||
| 12 | - | ||
| 13 | -@interface XWShareView (){ | ||
| 14 | - UIToolbar *_toolBar; | ||
| 15 | - | ||
| 16 | - UIView *_contentView; | ||
| 17 | - TemplateShareButton *_weiboButton; | ||
| 18 | - TemplateShareButton *_weixinButton; | ||
| 19 | - TemplateShareButton *_pengyouquanButton; | ||
| 20 | - TemplateShareButton *_qqButton; | ||
| 21 | - TemplateShareButton *_qqZoneButton; | ||
| 22 | - TemplateShareButton *_txweiboButton; | ||
| 23 | - TemplateShareButton *_xlweiboButton; | ||
| 24 | - TemplateShareButton *_renrenButton; | ||
| 25 | - TemplateShareButton *_reportButton; | ||
| 26 | - | ||
| 27 | - NSString *_title; | ||
| 28 | - NSString *_shareText; | ||
| 29 | - NSString *_shareImg; | ||
| 30 | - NSString *_shareUrl; | ||
| 31 | - BOOL _isShowing; | ||
| 32 | - | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | -@end | ||
| 36 | - | ||
| 37 | -@implementation XWShareView | ||
| 38 | - | ||
| 39 | -- (instancetype)initWithFrame:(CGRect)frame ShareImg:(NSString *)shareImg ShareTitle:(NSString *)shareTitle ShareText:(NSString *)shareText ShareUrl:(NSString *)shareUrl{ | ||
| 40 | - | ||
| 41 | - self = [super initWithFrame:frame]; | ||
| 42 | - if (self) { | ||
| 43 | - _isShowing = YES; | ||
| 44 | - _title = shareTitle; | ||
| 45 | - _shareText = [self getZZwithString:shareText]; | ||
| 46 | - _shareImg = shareImg; | ||
| 47 | - _shareUrl = shareUrl; | ||
| 48 | - | ||
| 49 | - } | ||
| 50 | - return self; | ||
| 51 | - | ||
| 52 | -} | ||
| 53 | - | ||
| 54 | -- (void)dealloc{ | ||
| 55 | - NSLog(@"%s DESTROYED-----------",__func__); | ||
| 56 | - | ||
| 57 | -} | ||
| 58 | - | ||
| 59 | -- (void)layoutSubviews{ | ||
| 60 | - [super layoutSubviews]; | ||
| 61 | - | ||
| 62 | -} | ||
| 63 | - | ||
| 64 | -#pragma mark -- Show Method | ||
| 65 | -- (void)show{ | ||
| 66 | - UIWindow *window = [UIApplication sharedApplication].keyWindow; | ||
| 67 | - [window addSubview:self]; | ||
| 68 | - [self mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 69 | - make.edges.equalTo(window); | ||
| 70 | - }]; | ||
| 71 | - | ||
| 72 | - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(btnCancel)]; | ||
| 73 | - [self addGestureRecognizer:tap]; | ||
| 74 | - [self configibutton]; | ||
| 75 | - | ||
| 76 | -} | ||
| 77 | -#pragma mark -- UI | ||
| 78 | -- (void)configibutton{ | ||
| 79 | - | ||
| 80 | - self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3]; | ||
| 81 | - | ||
| 82 | - _contentView = [[UIView alloc]initWithFrame:CGRectMake(0, MainScreenHeight - 200, MainScreenWidth, 200)]; | ||
| 83 | - _contentView.backgroundColor = [UIColor whiteColor]; | ||
| 84 | - [self addSubview:_contentView]; | ||
| 85 | - | ||
| 86 | - UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(100, 15, MainScreenWidth - 200, 22)]; | ||
| 87 | - title.textAlignment = NSTextAlignmentCenter; | ||
| 88 | - title.text = @"分享到"; //@"分享到"; | ||
| 89 | - title.font = Font(16); | ||
| 90 | - [_contentView addSubview:title]; | ||
| 91 | - | ||
| 92 | - UIButton *close = [[UIButton alloc]initWithFrame:CGRectMake(MainScreenWidth - 44, 0, 44, 44)]; | ||
| 93 | - [close setImage:[UIImage imageNamed:@"cnlive_icon"] forState:UIControlStateNormal]; | ||
| 94 | - [close addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; | ||
| 95 | - [_contentView addSubview:close]; | ||
| 96 | - | ||
| 97 | - CGFloat shareWH = 80, shareMarginS = (MainScreenWidth - 3 * shareWH)/4.0; | ||
| 98 | - | ||
| 99 | - //朋友圈 | ||
| 100 | - _pengyouquanButton = [TemplateShareButton buttonWithType:UIButtonTypeCustom]; | ||
| 101 | - _pengyouquanButton.frame = CGRectMake(shareMarginS, 80, 80, 80); | ||
| 102 | - _pengyouquanButton.shareButtonType = TemplateShareButtonTypePengYouQuan; | ||
| 103 | - _pengyouquanButton.image = @"朋友圈";//@"朋友圈"; | ||
| 104 | - [_pengyouquanButton addTarget:self action:@selector(didClickShareButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 105 | - [_contentView addSubview:_pengyouquanButton]; | ||
| 106 | - | ||
| 107 | - //微信 | ||
| 108 | - _weixinButton = [TemplateShareButton buttonWithType:UIButtonTypeCustom]; | ||
| 109 | - _weixinButton.frame = CGRectMake(2 * shareMarginS + shareWH, 80, 80, 80); | ||
| 110 | - _weixinButton.shareButtonType = TemplateShareButtonTypeWeiXin; | ||
| 111 | - _weixinButton.image = @"微信";//@"微信"; | ||
| 112 | - [_weixinButton addTarget:self action:@selector(didClickShareButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 113 | - [_contentView addSubview:_weixinButton]; | ||
| 114 | - | ||
| 115 | - //新浪微博 | ||
| 116 | - _xlweiboButton = [TemplateShareButton buttonWithType:UIButtonTypeCustom]; | ||
| 117 | - _xlweiboButton.frame = CGRectMake(3 * shareMarginS + 2 * shareWH, 80, 80, 80); | ||
| 118 | - _xlweiboButton.shareButtonType = TemplateShareButtonTypeXLWeiBo; | ||
| 119 | -// _xlweiboButton.image = CustomStr(@"Weibo");//@"新浪微博"; | ||
| 120 | - _xlweiboButton.image = @"新浪微博";//@"新浪微博"; | ||
| 121 | - [_xlweiboButton addTarget:self action:@selector(didClickShareButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 122 | - [_contentView addSubview:_xlweiboButton]; | ||
| 123 | - | ||
| 124 | -} | ||
| 125 | - | ||
| 126 | -//取消分享 | ||
| 127 | -- (void)dismiss{ | ||
| 128 | - [self removeFromSuperview]; | ||
| 129 | -} | ||
| 130 | - | ||
| 131 | -#pragma mark -- Event Response | ||
| 132 | -//取消分享 | ||
| 133 | -- (void)btnCancel{ | ||
| 134 | - [self removeFromSuperview]; | ||
| 135 | - | ||
| 136 | -} | ||
| 137 | -- (void)didClickShareButtonAction:(TemplateShareButton *)button{ | ||
| 138 | - [self dismiss]; | ||
| 139 | - switch (button.shareButtonType) { | ||
| 140 | - | ||
| 141 | - case TemplateShareButtonTypePengYouQuan:case TemplateShareButtonTypeWeiXin: | ||
| 142 | - if ([WXApi isWXAppInstalled] && [WXApi isWXAppSupportApi]){ | ||
| 143 | - TemplateShareManager *manger = [TemplateShareManager shareSingleton]; | ||
| 144 | - [manger shareType:button.shareButtonType shareImage:_shareImg shareTitle:_title shareText:_shareText shareUrl:_shareUrl]; | ||
| 145 | - | ||
| 146 | - } | ||
| 147 | - else{ | ||
| 148 | - //未安装微信 | ||
| 149 | - | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - break; | ||
| 153 | - case TemplateShareButtonTypeXLWeiBo: | ||
| 154 | - | ||
| 155 | - if ([WeiboSDK isCanShareInWeiboAPP] || [WeiboSDK isCanSSOInWeiboApp]){ | ||
| 156 | - TemplateShareManager *manger = [TemplateShareManager shareSingleton]; | ||
| 157 | - [manger shareType:button.shareButtonType shareImage:_shareImg shareTitle:_title shareText:_shareText shareUrl:_shareUrl]; | ||
| 158 | - | ||
| 159 | - } | ||
| 160 | - else{ | ||
| 161 | - //未安装新浪微博 | ||
| 162 | - | ||
| 163 | - } | ||
| 164 | - break; | ||
| 165 | - | ||
| 166 | - case TemplateShareButtonTypeQQ:case TemplateShareButtonTypeQQZone: | ||
| 167 | - | ||
| 168 | - if ([QQApiInterface isQQInstalled]){ | ||
| 169 | - TemplateShareManager *manger = [TemplateShareManager shareSingleton]; | ||
| 170 | - [manger shareType:button.shareButtonType shareImage:_shareImg shareTitle:_title shareText:_shareText shareUrl:_shareUrl]; | ||
| 171 | - | ||
| 172 | - } | ||
| 173 | - else{ | ||
| 174 | - //未安装qq | ||
| 175 | - } | ||
| 176 | - break; | ||
| 177 | - | ||
| 178 | - default: | ||
| 179 | - break; | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | -} | ||
| 183 | -#pragma mark - 去标签Tool | ||
| 184 | -- (NSString *)getZZwithString:(NSString *)string{ | ||
| 185 | - | ||
| 186 | - if (!string || [string isEqualToString:@""] || [(NSNull *)string isEqual:[NSNull null]]) { | ||
| 187 | - return @""; | ||
| 188 | - } | ||
| 189 | - | ||
| 190 | - | ||
| 191 | - NSRegularExpression *regularScriptExpretion=[NSRegularExpression regularExpressionWithPattern:@"<script[^>]*?>[\\s\\S]*?<\\/script>" | ||
| 192 | - options:0 | ||
| 193 | - error:nil]; | ||
| 194 | - | ||
| 195 | - string=[regularScriptExpretion stringByReplacingMatchesInString:string options:NSMatchingReportProgress range:NSMakeRange(0, string.length) withTemplate:@""]; | ||
| 196 | - | ||
| 197 | - | ||
| 198 | - | ||
| 199 | - NSRegularExpression *regularExpretion=[NSRegularExpression regularExpressionWithPattern:@"<style[^>]*?>[\\s\\S]*?<\\/style>" | ||
| 200 | - options:0 | ||
| 201 | - error:nil]; | ||
| 202 | - string=[regularExpretion stringByReplacingMatchesInString:string options:NSMatchingReportProgress range:NSMakeRange(0, string.length) withTemplate:@""]; | ||
| 203 | - | ||
| 204 | - | ||
| 205 | - | ||
| 206 | - | ||
| 207 | - NSRegularExpression *regularHtmlExpretion=[NSRegularExpression regularExpressionWithPattern:@"<[^>]+>" | ||
| 208 | - options:0 | ||
| 209 | - error:nil]; | ||
| 210 | - string=[regularHtmlExpretion stringByReplacingMatchesInString:string options:NSMatchingReportProgress range:NSMakeRange(0, string.length) withTemplate:@""]; | ||
| 211 | - | ||
| 212 | - | ||
| 213 | - | ||
| 214 | - string = [string stringByReplacingOccurrencesOfString:@" " withString:@""]; // 过滤 等标签 | ||
| 215 | - | ||
| 216 | - return string; | ||
| 217 | -} | ||
| 218 | - | ||
| 219 | -@end |