Commit 40120c0f authored by 汪洋's avatar 汪洋

针对打卡添加相关逻辑

parent 18b8bdd4
...@@ -128,5 +128,5 @@ ...@@ -128,5 +128,5 @@
- (void)shareWithType:(GMSharePlatform)type; - (void)shareWithType:(GMSharePlatform)type;
@property (nonatomic, strong) WMShareObject *shareObject; @property (nonatomic, strong) WMShareObject *shareObject;
@property (nonatomic, assign) BOOL onlyShareImage;
@end @end
...@@ -159,7 +159,7 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier"; ...@@ -159,7 +159,7 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
if (!_showCancelFollow) { if (!_showCancelFollow) {
[_titleArray removeObject:@"取消关注"]; [_titleArray removeObject:@"取消关注"];
[_imageArray removeObject:@"quxiaoguanzhu"]; [_imageArray removeObject:@"cancel_follow"];
[_shareTypeArray removeObject:@(GMSharePlatformCancelFollow)]; [_shareTypeArray removeObject:@(GMSharePlatformCancelFollow)];
} }
...@@ -197,13 +197,12 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier"; ...@@ -197,13 +197,12 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
[_shareTypeArray removeObject:@(GMSharePlatformQQFriend)]; [_shareTypeArray removeObject:@(GMSharePlatformQQFriend)];
} }
if (!_shareObject.qqzone.title.isNonEmpty || ((!_shareObject.qqzone.content.isNonEmpty) && _shareObject != nil) || ![QQApiInterface isQQInstalled]) { if (!_shareObject.qqzone.title.isNonEmpty || ((!_shareObject.qqzone.content.isNonEmpty) && _shareObject != nil) || ![QQApiInterface isQQInstalled]) {
[_titleArray removeObject:@"QQ空间"]; [_titleArray removeObject:@"QQ空间"];
[_imageArray removeObject:@"share_qq_space"]; [_imageArray removeObject:@"share_qq_space"];
[_shareTypeArray removeObject:@(GMSharePlatformQQSpace)]; [_shareTypeArray removeObject:@(GMSharePlatformQQSpace)];
} }
if ((_shareObject.douyin == nil && _shareObject != nil) || ![DouyinOpenSDKApi isAppInstalled]) { if ((_shareObject.douyin == nil && _shareObject != nil) || ![DouyinOpenSDKApi isAppInstalled]) {
[_titleArray removeObject:@"抖音"]; [_titleArray removeObject:@"抖音"];
[_imageArray removeObject:@"share_douyin"]; [_imageArray removeObject:@"share_douyin"];
...@@ -238,6 +237,20 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier"; ...@@ -238,6 +237,20 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
} }
make.top.mas_equalTo(_shareCollectionView).offset(217/2.0); make.top.mas_equalTo(_shareCollectionView).offset(217/2.0);
}]; }];
if (self.onlyShareImage) {
[_titleArray addObject:@"QQ"];
[_imageArray addObject:@"share_qq"];
[_shareTypeArray addObject:@(GMSharePlatformQQFriend)];
[_titleArray addObject:@"QQ空间"];
[_imageArray addObject:@"share_qq_space"];
[_shareTypeArray addObject:@(GMSharePlatformQQSpace)];
[_titleArray removeObject:@"抖音"];
[_imageArray removeObject:@"share_douyin"];
[_shareTypeArray removeObject:@(GMSharePlatformDouyin)];
}
} }
- (void)updateConstraints{ - (void)updateConstraints{
......
...@@ -136,22 +136,39 @@ ...@@ -136,22 +136,39 @@
} }
switch (platformType) { switch (platformType) {
case GMSharePlatformQQFriend:{ case GMSharePlatformQQFriend:{
if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self QQFriendShareWithParameters:parameters]; [self QQFriendShareWithParameters:parameters];
}
[self shareWithName:kQQShare onStateChanged:stateChangedHandler]; [self shareWithName:kQQShare onStateChanged:stateChangedHandler];
} }
break; break;
case GMSharePlatformQQSpace:{ case GMSharePlatformQQSpace:{
if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self QQSpaceShareWithParameters:parameters]; [self QQSpaceShareWithParameters:parameters];
}
[self shareWithName:kQQShare onStateChanged:stateChangedHandler]; [self shareWithName:kQQShare onStateChanged:stateChangedHandler];
break; break;
} }
case GMSharePlatformWechatSession:{ case GMSharePlatformWechatSession:{
if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self wechatSessionShareWithParameters:parameters scene:WXSceneSession]; [self wechatSessionShareWithParameters:parameters scene:WXSceneSession];
}
[self shareWithName:kWechatShare onStateChanged:stateChangedHandler]; [self shareWithName:kWechatShare onStateChanged:stateChangedHandler];
break; break;
} }
case GMSharePlatformWechatTimeline:{ case GMSharePlatformWechatTimeline:{
if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self wechatSessionShareWithParameters:parameters scene:WXSceneTimeline]; [self wechatSessionShareWithParameters:parameters scene:WXSceneTimeline];
}
[self shareWithName:kWechatShare onStateChanged:stateChangedHandler]; [self shareWithName:kWechatShare onStateChanged:stateChangedHandler];
break; break;
} }
...@@ -171,7 +188,11 @@ ...@@ -171,7 +188,11 @@
break; break;
} }
case GMSharePlatformSinaWeibo:{ case GMSharePlatformSinaWeibo:{
if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self weiboShareWithParameters:parameters]; [self weiboShareWithParameters:parameters];
}
[self shareWithName:kSinaShare onStateChanged:stateChangedHandler]; [self shareWithName:kSinaShare onStateChanged:stateChangedHandler];
break; break;
} }
...@@ -203,6 +224,10 @@ ...@@ -203,6 +224,10 @@
[self QQFriendShareWithImage:image]; [self QQFriendShareWithImage:image];
} }
break; break;
case GMSharePlatformQQSpace: {
[self QZoneShareWithImage:image];
}
break;
case GMSharePlatformWechatSession: { case GMSharePlatformWechatSession: {
[self wechatImageShareWithParameters:@{@"images": image} scene:WXSceneSession]; [self wechatImageShareWithParameters:@{@"images": image} scene:WXSceneSession];
...@@ -242,6 +267,26 @@ ...@@ -242,6 +267,26 @@
[self handleSendResult:sent]; [self handleSendResult:sent];
} }
/// QQ 空间分享图片
- (void)QZoneShareWithImage:(UIImage *)image {
NSData *imageData = UIImagePNGRepresentation(image);
//如果图片大于10M 需要对图片压缩 不然分享不出去 微信qq 要求图片在10m 以内
if (imageData.length > (10*1024*1024)) {
imageData = UIImageJPEGRepresentation(image, 0.1);
} else if (imageData.length > (1024*1024)) {
imageData = UIImageJPEGRepresentation(image, 0.6);
}
QQApiImageArrayForQZoneObject *imgObj = [[QQApiImageArrayForQZoneObject alloc] initWithImageArrayData:@[imageData] title:nil extMap:nil];
// QQApiImageObject *imgObj = [QQApiImageObject objectWithData:imageData previewImageData:nil title:@"更美app" description:@"我是图片"];
SendMessageToQQReq* req = [SendMessageToQQReq reqWithContent:imgObj];
imgObj.shareDestType = ShareDestTypeQQ;
QQApiSendResultCode sent = [QQApiInterface sendReq:req];
[self handleSendResult:sent];
}
- (void)QQFriendShareWithParameters: (NSDictionary *)parameters { - (void)QQFriendShareWithParameters: (NSDictionary *)parameters {
id image = parameters[@"images"]; id image = parameters[@"images"];
UIImage * thumbImage = image; UIImage * thumbImage = image;
......
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