Commit 63e9013a authored by 汪洋's avatar 汪洋

Merge branch 'wy/daka'

parents 87bfdd09 38424173
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
/** 取消分享 */ /** 取消分享 */
- (void)cancleShareView; - (void)cancleShareView;
- (void)shareViewDidClose;
@end @end
...@@ -128,5 +130,5 @@ ...@@ -128,5 +130,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)];
} }
...@@ -196,14 +196,13 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier"; ...@@ -196,14 +196,13 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
[_imageArray removeObject:@"share_qq"]; [_imageArray removeObject:@"share_qq"];
[_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{
...@@ -513,6 +526,9 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier"; ...@@ -513,6 +526,9 @@ static NSString *shareCellIdentifier = @"shareCellIdentifier";
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
} completion:^(BOOL finished) { } completion:^(BOOL finished) {
[self removeFromSuperview]; [self removeFromSuperview];
if ([self.delegate respondsToSelector:@selector(shareViewDidClose)]) {
[self.delegate shareViewDidClose];
}
}]; }];
} }
......
...@@ -136,22 +136,39 @@ ...@@ -136,22 +136,39 @@
} }
switch (platformType) { switch (platformType) {
case GMSharePlatformQQFriend:{ case GMSharePlatformQQFriend:{
[self QQFriendShareWithParameters:parameters]; if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self QQFriendShareWithParameters:parameters];
}
[self shareWithName:kQQShare onStateChanged:stateChangedHandler]; [self shareWithName:kQQShare onStateChanged:stateChangedHandler];
} }
break; break;
case GMSharePlatformQQSpace:{ case GMSharePlatformQQSpace:{
[self QQSpaceShareWithParameters:parameters]; if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self QQSpaceShareWithParameters:parameters];
}
[self shareWithName:kQQShare onStateChanged:stateChangedHandler]; [self shareWithName:kQQShare onStateChanged:stateChangedHandler];
break; break;
} }
case GMSharePlatformWechatSession:{ case GMSharePlatformWechatSession:{
[self wechatSessionShareWithParameters:parameters scene:WXSceneSession]; if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[self wechatSessionShareWithParameters:parameters scene:WXSceneSession];
}
[self shareWithName:kWechatShare onStateChanged:stateChangedHandler]; [self shareWithName:kWechatShare onStateChanged:stateChangedHandler];
break; break;
} }
case GMSharePlatformWechatTimeline:{ case GMSharePlatformWechatTimeline:{
[self wechatSessionShareWithParameters:parameters scene:WXSceneTimeline]; if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[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:{
[self weiboShareWithParameters:parameters]; if (parameters[@"onlyImage"]) {
[[GMShareSDK shareInstance] shareImage:parameters[@"image"] platform:platformType];
} else {
[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