Commit d0ddacdf by ludi

接入两个分享

parent 1b677bd2
Showing with 584 additions and 32 deletions
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_icon_chat_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_icon_chat_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_Live_Instagram_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_Live_Instagram_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_Live_Messenger_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_Live_Messenger_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_Live_Wechat_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_Live_Wechat_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_Live_line_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_Live_line_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_Live_twitter_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_Live_twitter_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_Live_whatsapp_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_Live_whatsapp_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Share_live_facebook_large@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Share_live_facebook_large@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -399,6 +399,24 @@ ...@@ -399,6 +399,24 @@
}]; }];
} }
break; break;
case MessengerPlatform:
{
[shareManager fus_shareMessengerWithContentURL:urlString quote:content imageOrUrl:imageOrUrl from:from roomId:roomId viewController:viewController shareType:shareType success:^{
if(success)success();
} failure:^{
if(failure)failure();
}];
}
break;
case InstagramPlatform:
{
[shareManager fus_shareInstagramWithTitle:title content:content Image:image urlString:urlString from:from roomId:roomId shareType:shareType success:^{
if(success)success();
} failure:^{
if(failure)failure();
}];
}
break;
case WechatFriendPlatform: case WechatFriendPlatform:
{ {
//wechat分享结果都是成功回调 //wechat分享结果都是成功回调
......
...@@ -15,6 +15,8 @@ typedef NS_ENUM(NSUInteger, SocialSharePlatform) { ...@@ -15,6 +15,8 @@ typedef NS_ENUM(NSUInteger, SocialSharePlatform) {
WechatCirclePaltform, WechatCirclePaltform,
LineSharePlatform, LineSharePlatform,
WhatsAppPlatform, WhatsAppPlatform,
InstagramPlatform,
MessengerPlatform,
CopyLink, CopyLink,
BarcodePhotoPlatform, //二维码图片 BarcodePhotoPlatform, //二维码图片
FriendChatShare, // 分享给好友 FriendChatShare, // 分享给好友
...@@ -97,6 +99,28 @@ typedef NS_ENUM(NSInteger, FUSFrom) { ...@@ -97,6 +99,28 @@ typedef NS_ENUM(NSInteger, FUSFrom) {
success:(void(^_Nullable)(void))success success:(void(^_Nullable)(void))success
failure:(void(^_Nullable)(void))failure; failure:(void(^_Nullable)(void))failure;
/// messenger 分享
- (void)fus_shareMessengerWithContentURL:(NSString *)contentURL
quote:(NSString *)quote
imageOrUrl:(id)imageOrUrl
from:(FUSFrom)from
roomId:(NSString *)roomId
viewController:(UIViewController *)viewController
shareType:(FUSShareType)shareType
success:(void (^)(void))success
failure:(void (^)(void))failure;
/// Instagram 分享
- (void)fus_shareInstagramWithTitle:(NSString *)title
content:(NSString *)content
Image:(UIImage *)image
urlString:(NSString *)urlString
from:(FUSFrom)from
roomId:(NSString *)roomId
shareType:(FUSShareType)shareType
success:(void (^)(void))success
failure:(void (^)(void))failure;
/** /**
Twitter 分享(原生) Twitter 分享(原生)
......
...@@ -89,6 +89,118 @@ ...@@ -89,6 +89,118 @@
}]; }];
} }
- (void)fus_shareInstagramWithTitle:(NSString *)title
content:(NSString *)content
Image:(UIImage *)image
urlString:(NSString *)urlString
from:(FUSFrom)from
roomId:(NSString *)roomId
shareType:(FUSShareType)shareType
success:(void (^)(void))success
failure:(void (^)(void))failure{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"instagram://app"]] == NO) {
[FUSDialogView fus_showDialog:[NSString stringWithFormat:[NSString fus_localString:@"请先安装%@"],@"Instagram"]];
failure();
return;
}
self.shareSuccess = success;
self.shareFailure = failure;
if (shareType == FUSShareTypeText) {
NSString *url = [NSString stringWithFormat:@"instagram://sharesheet?text=%@",content ?: @""];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
// success();
}
else if (shareType == FUSShareTypeImage || shareType == FUSShareTypeImageWithText) {
// 其实 Instagram 只给分享image
UIImageWriteToSavedPhotosAlbum(image, self, @selector(fus_instagramSaveImage: didFinishSavingWithError: contextInfo:), nil);
}
else if (shareType == FUSShareTypeWebUrl) {
NSString *url = [NSString stringWithFormat:@"instagram://sharesheet?text=%@%@",title,urlString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
//上报分享请求数据
[self shareDataReportToSeverWithPlatform:InstagramPlatform from:from roomId:roomId];
}
-(void)fus_instagramSaveImage:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(id)contextInfo{
if (error != nil) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享失败"]];
self.shareFailure();
}
else {
NSURL *shareURL = [NSURL URLWithString:@"instagram://library?LocalIdentifier=latest"];
[[UIApplication sharedApplication] openURL:shareURL];
}
}
/// messenger分享
- (void)fus_shareMessengerWithContentURL:(NSString *)contentURL
quote:(NSString *)quote
imageOrUrl:(id)imageOrUrl
from:(FUSFrom)from
roomId:(NSString *)roomId
viewController:(UIViewController *)viewController
shareType:(FUSShareType)shareType
success:(void (^)(void))success
failure:(void (^)(void))failure{
self.shareSuccess = success;
self.shareFailure = failure;
_from = from;
_roomId = roomId;
MJWeakSelf
//上报分享请求数据
[self shareDataReportToSeverWithPlatform:MessengerPlatform from:from roomId:roomId];
if (shareType == FUSShareTypeImageWithText && [imageOrUrl isKindOfClass:[NSString class]] && ![NSString isNull:imageOrUrl]) {
// web 链接分享
[[FUSFacebookHelper shared] fus_messengerShareWithType:FUSFacebookHelperShareTypeImageWithText controller:viewController contentURL:contentURL image:nil imageUrl:(NSString *)imageOrUrl success:^{
//上报分享成功
[weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:MessengerPlatform shareSuccess:nil shareFailed:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
} failure:^(BOOL isCancel) {
if (isCancel) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享取消"]];
}else {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享失败"]];
}
}];
}else if(shareType == FUSShareTypeImage && [imageOrUrl isKindOfClass:[UIImage class]]){
[[FUSFacebookHelper shared] fus_messengerShareWithType:FUSFacebookHelperShareTypeImage controller:viewController contentURL:nil image:(UIImage *)imageOrUrl imageUrl:nil success:^{
//上报分享成功
[weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:MessengerPlatform shareSuccess:nil shareFailed:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
} failure:^(BOOL isCancel) {
if (isCancel) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享取消"]];
}else {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享失败"]];
}
}];
}else{
// web 链接分享
[[FUSFacebookHelper shared] fus_messengerShareWithType:FUSFacebookHelperShareTypeWebUrl controller:viewController contentURL:contentURL image:nil imageUrl:nil success:^{
//上报分享成功
[weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:MessengerPlatform shareSuccess:nil shareFailed:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
} failure:^(BOOL isCancel) {
if (isCancel) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享取消"]];
}else {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享失败"]];
}
}];
}
}
/** /**
facebook分享(原生) facebook分享(原生)
...@@ -125,7 +237,7 @@ ...@@ -125,7 +237,7 @@
[[FUSFacebookHelper shared] fus_facebookShareWithType:FUSFacebookHelperShareTypeImageWithText controller:viewController contentURL:contentURL image:nil imageUrl:(NSString *)imageOrUrl success:^{ [[FUSFacebookHelper shared] fus_facebookShareWithType:FUSFacebookHelperShareTypeImageWithText controller:viewController contentURL:contentURL image:nil imageUrl:(NSString *)imageOrUrl success:^{
//上报分享成功 //上报分享成功
[weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:TwitterPlatform shareSuccess:nil shareFailed:nil]; [weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:FacebookPlatform shareSuccess:nil shareFailed:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
} failure:^(BOOL isCancel) { } failure:^(BOOL isCancel) {
if (isCancel) { if (isCancel) {
...@@ -161,7 +273,7 @@ ...@@ -161,7 +273,7 @@
[[FUSFacebookHelper shared] fus_facebookShareWithType:FUSFacebookHelperShareTypeImage controller:viewController contentURL:nil image:(UIImage *)imageOrUrl imageUrl:nil success:^{ [[FUSFacebookHelper shared] fus_facebookShareWithType:FUSFacebookHelperShareTypeImage controller:viewController contentURL:nil image:(UIImage *)imageOrUrl imageUrl:nil success:^{
//上报分享成功 //上报分享成功
[weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:TwitterPlatform shareSuccess:nil shareFailed:nil]; [weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:FacebookPlatform shareSuccess:nil shareFailed:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
} failure:^(BOOL isCancel) { } failure:^(BOOL isCancel) {
if (isCancel) { if (isCancel) {
...@@ -184,7 +296,7 @@ ...@@ -184,7 +296,7 @@
[[FUSFacebookHelper shared] fus_facebookShareWithType:FUSFacebookHelperShareTypeWebUrl controller:viewController contentURL:contentURL image:nil imageUrl:nil success:^{ [[FUSFacebookHelper shared] fus_facebookShareWithType:FUSFacebookHelperShareTypeWebUrl controller:viewController contentURL:contentURL image:nil imageUrl:nil success:^{
//上报分享成功 //上报分享成功
[weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:TwitterPlatform shareSuccess:nil shareFailed:nil]; [weakSelf shareResultStateWithShareState:SSDKResponseStateSuccess andPlatform:FacebookPlatform shareSuccess:nil shareFailed:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
} failure:^(BOOL isCancel) { } failure:^(BOOL isCancel) {
if (isCancel) { if (isCancel) {
......
...@@ -15,6 +15,11 @@ import RxSwift ...@@ -15,6 +15,11 @@ import RxSwift
private let disposeBag = DisposeBag() private let disposeBag = DisposeBag()
// - OC PART // - OC PART
/// 当前是否登录
@objc public var oc_isLogin: Bool {
get{ FUSSwiftCacheDataShare.share.isLogin.value }
set{ FUSSwiftCacheDataShare.share.isLogin.accept(newValue) }
}
/// 用户信息 OC,这个数据的索引是在FUSCacheDataShare中的,修改数据的时候修改FUSCacheDataShare中的就行了 /// 用户信息 OC,这个数据的索引是在FUSCacheDataShare中的,修改数据的时候修改FUSCacheDataShare中的就行了
@objc public var oc_userInfo: FUSUserInfosModel?{ @objc public var oc_userInfo: FUSUserInfosModel?{
get{ FUSSwiftCacheDataShare.share.userInfo.value } get{ FUSSwiftCacheDataShare.share.userInfo.value }
...@@ -375,6 +380,29 @@ extension SocialSharePlatform { ...@@ -375,6 +380,29 @@ extension SocialSharePlatform {
} }
} }
public var shareLargeIcon: UIImage? {
switch self {
case .FacebookPlatform:
return UIImage.com_ImageNamed("Share_live_facebook_large")
case .TwitterPlatform:
return UIImage.com_ImageNamed("Share_Live_twitter_large")
case .WechatFriendPlatform:
return UIImage.com_ImageNamed("Share_Live_Wechat_large")
case .WechatCirclePaltform:
return UIImage.com_ImageNamed("Share_Live_Circle_large")
case .LineSharePlatform:
return .com_ImageNamed("Share_Live_line_large")
case .WhatsAppPlatform:
return .com_ImageNamed("Share_Live_whatsapp_large")
case .InstagramPlatform:
return .com_ImageNamed("Share_Live_Instagram_large")
case .MessengerPlatform:
return .com_ImageNamed("Share_Live_Messenger_large")
default:
return .init()
}
}
public var shareName: String { public var shareName: String {
switch self { switch self {
case .FacebookPlatform: case .FacebookPlatform:
...@@ -393,6 +421,10 @@ extension SocialSharePlatform { ...@@ -393,6 +421,10 @@ extension SocialSharePlatform {
return .fus_localString("好友") return .fus_localString("好友")
case .WhatsAppPlatform: case .WhatsAppPlatform:
return "WhatsApp" return "WhatsApp"
case .InstagramPlatform:
return "Instagram"
case .MessengerPlatform:
return "Messenger"
default: default:
return "" return ""
} }
......
...@@ -88,6 +88,8 @@ ...@@ -88,6 +88,8 @@
#define ROOM_CID_RoomPopularChanged 11019 // 人气值变化消息 #define ROOM_CID_RoomPopularChanged 11019 // 人气值变化消息
#define ROOM_CID_receivePatAudience 11025 // 接收撩一撩信息的cid #define ROOM_CID_receivePatAudience 11025 // 接收撩一撩信息的cid
#define ROOM_CID_receiveAnchorRewardChanged 11200 // fusi直播奖励数据变化 #define ROOM_CID_receiveAnchorRewardChanged 11200 // fusi直播奖励数据变化
/// 用户回归礼包socket通知
#define ROOM_CID_recallRewardPacket 11034
// 更新直播间互动游戏开关状态socket // 更新直播间互动游戏开关状态socket
#define ROOM_CID_liveInteractionGameStateDidChanged 20204 #define ROOM_CID_liveInteractionGameStateDidChanged 20204
......
...@@ -76,6 +76,9 @@ NSString * const kEVENT_RECHARGE_OFFICIAL_PAGE_RETURN = @"officialrecharge_retur ...@@ -76,6 +76,9 @@ NSString * const kEVENT_RECHARGE_OFFICIAL_PAGE_RETURN = @"officialrecharge_retur
// 通过什么途径过来的 // 通过什么途径过来的
@property (nonatomic, assign) FUSRechargePageFrom rechargePageFrom; @property (nonatomic, assign) FUSRechargePageFrom rechargePageFrom;
/// 加载完成的时候,显示打开回归大礼包H5配置
@property (nonatomic, assign) BOOL showRecallPacketIfIneed;
@end @end
@implementation FUSRechargeViewController @implementation FUSRechargeViewController
...@@ -179,6 +182,15 @@ NSString * const kEVENT_RECHARGE_OFFICIAL_PAGE_RETURN = @"officialrecharge_retur ...@@ -179,6 +182,15 @@ NSString * const kEVENT_RECHARGE_OFFICIAL_PAGE_RETURN = @"officialrecharge_retur
return [super initWithNibName:nibNameOrNil bundle:FUSCommonBundle.bundle]; return [super initWithNibName:nibNameOrNil bundle:FUSCommonBundle.bundle];
} }
- (instancetype)init
{
self = [super init];
if (self) {
self.showRecallPacketIfIneed = NO;
}
return self;
}
- (void)viewDidLoad - (void)viewDidLoad
{ {
// [FIRAnalytics logEventWithName:@"view_item_list" parameters:@{@"recharge_type":@"apple_iap"}]; // [FIRAnalytics logEventWithName:@"view_item_list" parameters:@{@"recharge_type":@"apple_iap"}];
...@@ -316,6 +328,19 @@ NSString * const kEVENT_RECHARGE_OFFICIAL_PAGE_RETURN = @"officialrecharge_retur ...@@ -316,6 +328,19 @@ NSString * const kEVENT_RECHARGE_OFFICIAL_PAGE_RETURN = @"officialrecharge_retur
[self getUsersDataWithType:ReadServerBegin]; [self getUsersDataWithType:ReadServerBegin];
} }
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
if (self.showRecallPacketIfIneed == YES) {
self.showRecallPacketIfIneed = NO;
[self onClickFirstChargeAction:self.firstChargeBtn];
}
}
-(void)fus_showRecallPacketIfIneed{
self.showRecallPacketIfIneed = YES;
}
#pragma mark - 初始化View #pragma mark - 初始化View
- (void)initView - (void)initView
{ {
......
...@@ -167,6 +167,50 @@ import FBSDKLoginKit ...@@ -167,6 +167,50 @@ import FBSDKLoginKit
dialog.show() dialog.show()
} }
} }
/// messenger分享,因为跟fb是用同一个sdk的,所以直接写在一起
public func fus_messengerShare(type: FUSFacebookHelperShareType, controller: UIViewController?, contentURL: String, image: UIImage?, imageUrl: String?, success: (() -> Void)?, failure: ((_ isCancel: Bool) -> Void)?){
self.shareSuccessHandle = success
self.shareFailureHandle = failure
let vc = controller ?? UIViewController.fus_top()
Settings.shared.appID = FUSConfig.sharedInstanced().sdkConfigs.facebookLoginKey
Settings.shared.clientToken = FUSConfig.sharedInstanced().sdkConfigs.facebookLoginSecret
if type == .imageWithText,
let imageUrl = imageUrl,
imageUrl.count > 0{
let shareContent = ShareLinkContent()
shareContent.contentURL = .init(string: "\(contentURL)?msg=\(imageUrl)")
shareContent.hashtag = .init("#FusiYa")
shareContent.ref = "FusiYa"
let dialog = MessageDialog(content: shareContent, delegate: self)
dialog.show()
}
else if type == .image,
let image = image{
let photo = SharePhoto(image: image, isUserGenerated: true)
let shareContent = SharePhotoContent()
shareContent.photos = [photo]
let dialog = MessageDialog(content: shareContent, delegate: self)
dialog.show()
}
else {
// web
let shareContent = ShareLinkContent()
shareContent.contentURL = .init(string: contentURL)
shareContent.hashtag = .init("#FusiYa")
shareContent.ref = "FusiYa"
let dialog = MessageDialog(content: shareContent, delegate: self)
dialog.show()
}
}
} }
extension FUSFacebookHelper: SharingDelegate{ extension FUSFacebookHelper: SharingDelegate{
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<key>FUSChatCenterBundle.xcscheme_^#shared#^_</key> <key>FUSChatCenterBundle.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>83</integer> <integer>81</integer>
</dict> </dict>
<key>FUSChatCenterModule.xcscheme_^#shared#^_</key> <key>FUSChatCenterModule.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>79</integer> <integer>80</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<key>FUSShowRoomBundle.xcscheme_^#shared#^_</key> <key>FUSShowRoomBundle.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>80</integer> <integer>79</integer>
</dict> </dict>
<key>FUSShowRoomModule.xcscheme_^#shared#^_</key> <key>FUSShowRoomModule.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>82</integer> <integer>83</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<key>FUSUserCenterModule.xcscheme_^#shared#^_</key> <key>FUSUserCenterModule.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>84</integer> <integer>82</integer>
</dict> </dict>
<key>FUSUserCenterModuleBundle.xcscheme_^#shared#^_</key> <key>FUSUserCenterModuleBundle.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>81</integer> <integer>84</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "InviteReward_recall_WellcomeLight_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "InviteReward_recall_WellcomeLight_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -102,10 +102,10 @@ class FUSInviteFunctionStepOneContentView: FUSInviteFunctionStepContentBaseView ...@@ -102,10 +102,10 @@ class FUSInviteFunctionStepOneContentView: FUSInviteFunctionStepContentBaseView
self.typeContentView.removeAllSubviews() self.typeContentView.removeAllSubviews()
if self.type == .media { if self.type == .media {
let shareTypeList: [SocialSharePlatform] = [.LineSharePlatform, .WhatsAppPlatform, .FacebookPlatform, .TwitterPlatform] let shareTypeList: [SocialSharePlatform] = [.LineSharePlatform, .WhatsAppPlatform, .FacebookPlatform, .TwitterPlatform, .InstagramPlatform, .MessengerPlatform]
let itemW:CGFloat = 45 let itemW:CGFloat = 58
let insentMargin: CGFloat = 15 let insentMargin: CGFloat = 18
var lineItemCount: Int = 6 var lineItemCount: Int = 4
var itemSpace: CGFloat = (UIView.fus_screenW() - 18*2 - insentMargin*2 - itemW*CGFloat(lineItemCount))/(CGFloat(lineItemCount) - 1) var itemSpace: CGFloat = (UIView.fus_screenW() - 18*2 - insentMargin*2 - itemW*CGFloat(lineItemCount))/(CGFloat(lineItemCount) - 1)
if itemSpace <= 0{ if itemSpace <= 0{
lineItemCount -= 1 lineItemCount -= 1
...@@ -131,7 +131,7 @@ class FUSInviteFunctionStepOneContentView: FUSInviteFunctionStepContentBaseView ...@@ -131,7 +131,7 @@ class FUSInviteFunctionStepOneContentView: FUSInviteFunctionStepContentBaseView
for (index, itemType) in shareTypeList.enumerated() { for (index, itemType) in shareTypeList.enumerated() {
let shareBtn = UIButton(type: .custom) let shareBtn = UIButton(type: .custom)
shareBtn.setBackgroundImage(itemType.shareIcon, for: .normal) shareBtn.setBackgroundImage(itemType.shareLargeIcon, for: .normal)
let numberOfItem = index%lineItemCount let numberOfItem = index%lineItemCount
let numberOfLine = index/lineItemCount let numberOfLine = index/lineItemCount
shareBtn.frame = CGRectMake(insentMargin + (itemW + itemSpace)*CGFloat(numberOfItem), topMargin + (itemW + lineSpace)*CGFloat(numberOfLine), itemW, itemW) shareBtn.frame = CGRectMake(insentMargin + (itemW + itemSpace)*CGFloat(numberOfItem), topMargin + (itemW + lineSpace)*CGFloat(numberOfLine), itemW, itemW)
......
...@@ -98,6 +98,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -98,6 +98,9 @@ NS_ASSUME_NONNULL_BEGIN
+(void)fus_inviteDataQrcodeGetWithSuccess:(void(^)(FUSInviteDataQrcodeGetModel *model))success +(void)fus_inviteDataQrcodeGetWithSuccess:(void(^)(FUSInviteDataQrcodeGetModel *model))success
failure:(void(^)(NSString *msg,int code))failure; failure:(void(^)(NSString *msg,int code))failure;
/// 特定分享推广二维码
+(void)fus_inviteDataQrcodeShareGetWithSuccess:(void (^)(NSString * _Nonnull))success failure:(void (^)(NSString * _Nonnull, int))failure;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -191,4 +191,15 @@ ...@@ -191,4 +191,15 @@
}]; }];
} }
/// 特定分享推广二维码
+(void)fus_inviteDataQrcodeShareGetWithSuccess:(void (^)(NSString * _Nonnull))success failure:(void (^)(NSString * _Nonnull, int))failure{
[FUSHttpHelper postRequestBinaryWithUrl:FUSUserCenterURLs.fus_URL_inviteDataQrcodeShareGet params:nil success:^(NSDictionary * _Nullable dataDict, int code) {
success([dataDict[@"shareQRUrl"] stringValue]);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE,code);
}
}];
}
@end @end
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
// //
import UIKit import UIKit
import RxSwift
import RxCocoa
class FUSInviteFunctionStepOneView: FUSInviteFunctionStepBaseView { class FUSInviteFunctionStepOneView: FUSInviteFunctionStepBaseView {
...@@ -116,6 +118,10 @@ class FUSInviteFunctionStepOneView: FUSInviteFunctionStepBaseView { ...@@ -116,6 +118,10 @@ class FUSInviteFunctionStepOneView: FUSInviteFunctionStepBaseView {
myInviteQRCodeView.fus_setCellType(type: .myEmissaryCode, currentRow: 0, maxRowCount: 1) myInviteQRCodeView.fus_setCellType(type: .myEmissaryCode, currentRow: 0, maxRowCount: 1)
} }
/// 分享图片的控制
var shareImageDisposedBag = DisposeBag()
let shareImageURLIsReady: BehaviorRelay<Bool> = .init(value: false)
func fus_clickedHandler(clickedType: FUSInviteFunctionStepOneContentView.FUSInviteFunctionStepOneContentClickedType) { func fus_clickedHandler(clickedType: FUSInviteFunctionStepOneContentView.FUSInviteFunctionStepOneContentClickedType) {
switch clickedType{ switch clickedType{
...@@ -124,23 +130,61 @@ class FUSInviteFunctionStepOneView: FUSInviteFunctionStepBaseView { ...@@ -124,23 +130,61 @@ class FUSInviteFunctionStepOneView: FUSInviteFunctionStepBaseView {
let uid = FUSSwiftCacheDataShare.share.userInfo.value?.uid let uid = FUSSwiftCacheDataShare.share.userInfo.value?.uid
else { return } else { return }
let shareType = inviteDataModel.shareData.fus_getPlafromShareType(type) var shareType = inviteDataModel.shareData.fus_getPlafromShareType(type)
var shareLink = inviteDataModel.shareData.shareContent.fus_getWebpage() var shareLink = inviteDataModel.shareData.shareContent.fus_getWebpage()
shareImageDisposedBag = .init()
shareImageURLIsReady.accept(false)
if type == .WhatsAppPlatform { if type == .WhatsAppPlatform {
// whatsApp会吞&字段,所以得用短链 // whatsApp会吞&字段,所以得用短链
// 其他的不用短链是因为锻炼会增加服务器消耗,能不用短链的地方则不使用短链 // 其他的不用短链是因为锻炼会增加服务器消耗,能不用短链的地方则不使用短链
shareLink = inviteDataModel.inviteShareLink shareLink = inviteDataModel.inviteShareLink
shareImageURLIsReady.accept(true)
} }
else if type == .InstagramPlatform{
inviteDataModel.shareData.shareContent.fus_getPic { image in // instagram 比较特殊,自己使用图片分享
shareType = .image
FUSSocialShareHelper.fus_shareOriginalUrl(withSocialPlatform: type, title: inviteDataModel.shareData.shareContent.title, content: inviteDataModel.shareData.shareContent.text, imageOrUrl: image, shareUrl: shareLink, from: .invitShare, viewController: UIViewController.fus_top(), roomId: uid, shareType: shareType) { if inviteDataModel.shareData.shareContent.picEN.count <= 0{
// 如果没有url,得先生成
} failure: { FUSLoadingIndicator.fus_show(canTouch: true)
FUSInviteRewardHttpHelper.fus_inviteDataQrcodeShareGet {[weak self] shareQRUrl in
FUSLoadingIndicator.fus_dismiss()
// 生成url,反赋值进去
inviteDataModel.shareData.shareContent.picEN = shareQRUrl
inviteDataModel.shareData.shareContent.pic = shareQRUrl
self?.shareImageURLIsReady.accept(true)
} failure: {[weak self] msg, code in
FUSLoadingIndicator.fus_dismiss()
FUSDialogView.fus_showDialog(msg)
self?.shareImageDisposedBag = .init()
}
}else{
// 有url直接请求分享
shareImageURLIsReady.accept(true)
} }
} }
else {
shareImageURLIsReady.accept(true)
}
shareImageURLIsReady
.filter({ $0 == true })
.take(1)
.subscribe(onNext: { _ in
FUSLoadingIndicator.fus_show(canTouch: true)
inviteDataModel.shareData.shareContent.fus_getPic { image in
FUSLoadingIndicator.fus_dismiss()
FUSSocialShareHelper.fus_shareOriginalUrl(withSocialPlatform: type, title: inviteDataModel.shareData.shareContent.title, content: inviteDataModel.shareData.shareContent.text, imageOrUrl: image, shareUrl: shareLink, from: .invitShare, viewController: UIViewController.fus_top(), roomId: uid, shareType: shareType) {
} failure: {
}
}
})
.disposed(by: shareImageDisposedBag)
case .copyWebShareLink: case .copyWebShareLink:
let pasteboard = UIPasteboard.general let pasteboard = UIPasteboard.general
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
import UIKit import UIKit
class FUSInviteRecallWellcomeAlertView: FUSBaseView { @objcMembers public class FUSInviteRecallWellcomeAlertView: FUSBaseView {
static public func fus_create(showOn: UIView? = nil, clickHandle: @escaping (Bool) -> Void) -> FUSInviteRecallWellcomeAlertView? { @objc static public func fus_create(showOn: UIView? = nil, clickHandle: @escaping (Bool) -> Void) -> FUSInviteRecallWellcomeAlertView? {
guard let showOnView = ((showOn != nil) ? showOn : UIViewController.fus_top()?.view) else { return nil } guard let showOnView = ((showOn != nil) ? showOn : UIViewController.fus_top()?.view) else { return nil }
let view = FUSInviteRecallWellcomeAlertView(frame: showOnView.bounds) let view = FUSInviteRecallWellcomeAlertView(frame: showOnView.bounds)
...@@ -25,12 +25,13 @@ class FUSInviteRecallWellcomeAlertView: FUSBaseView { ...@@ -25,12 +25,13 @@ class FUSInviteRecallWellcomeAlertView: FUSBaseView {
let bgBtn = UIButton(type: .custom) let bgBtn = UIButton(type: .custom)
let contentView = UIImageView() let contentView = UIImageView()
let titleLabel = UILabel() let titleLabel = UILabel()
let recallBgImageView = UIImageView(image: FUSUserCenterBunble.imageNamed("InviteReward_recall_WellcomeLight_bg"))
let recallImageView = UIImageView(image: FUSUserCenterBunble.imageNamed("inviteReward_recall_recallReward_img")) let recallImageView = UIImageView(image: FUSUserCenterBunble.imageNamed("inviteReward_recall_recallReward_img"))
let recallLabel = UILabel() let recallLabel = UILabel()
let descLabel = UILabel() let descLabel = UILabel()
let okBtn = FUSStyleButton(type: .custom) let okBtn = FUSStyleButton(type: .custom)
override func makeUI() { public override func makeUI() {
super.makeUI() super.makeUI()
self.alpha = 0 self.alpha = 0
...@@ -70,23 +71,29 @@ class FUSInviteRecallWellcomeAlertView: FUSBaseView { ...@@ -70,23 +71,29 @@ class FUSInviteRecallWellcomeAlertView: FUSBaseView {
make.left.right.equalToSuperview().inset(28) make.left.right.equalToSuperview().inset(28)
} }
contentView.addSubview(recallImageView) contentView.addSubview(recallBgImageView)
recallImageView.snp.makeConstraints { make in recallBgImageView.snp.makeConstraints { make in
make.centerX.equalToSuperview() make.centerX.equalToSuperview()
make.top.equalTo(descLabel.snp.bottom).offset(-20) make.top.equalTo(descLabel.snp.bottom).offset(-20)
make.width.height.equalTo(185) make.width.height.equalTo(185)
} }
contentView.addSubview(recallImageView)
recallImageView.snp.makeConstraints { make in
make.center.equalTo(recallBgImageView.snp.center)
make.size.equalTo(CGSizeMake(145, 92))
}
recallLabel.font = .fus_themeMediumFont(15) recallLabel.font = .fus_themeMediumFont(15)
recallLabel.textColor = .white recallLabel.textColor = .white
recallLabel.backgroundColor = .init(hexString: "#C1C0C0") recallLabel.backgroundColor = .init(hexString: "#C1C0C0")
recallLabel.text = " " + .fus_versionLocalString("回归大礼包") + " " recallLabel.text = " " + .fus_versionLocalString("回归大礼包") + " "
recallLabel.layer.cornerRadius = 14 recallLabel.layer.cornerRadius = 14
recallLabel.layer.masksToBounds = true recallLabel.layer.masksToBounds = true
recallImageView.addSubview(recallLabel) contentView.addSubview(recallLabel)
recallLabel.snp.makeConstraints { make in recallLabel.snp.makeConstraints { make in
make.centerX.equalToSuperview() make.centerX.equalToSuperview()
make.bottom.equalToSuperview().offset(-10) make.bottom.equalTo(recallBgImageView.snp.bottom).offset(-10)
make.height.equalTo(28) make.height.equalTo(28)
} }
...@@ -95,14 +102,14 @@ class FUSInviteRecallWellcomeAlertView: FUSBaseView { ...@@ -95,14 +102,14 @@ class FUSInviteRecallWellcomeAlertView: FUSBaseView {
okBtn.setTitle(.fus_versionLocalString("确认"), for: .normal) okBtn.setTitle(.fus_versionLocalString("确认"), for: .normal)
contentView.addSubview(okBtn) contentView.addSubview(okBtn)
okBtn.snp.makeConstraints { make in okBtn.snp.makeConstraints { make in
make.top.equalTo(recallImageView.snp.bottom).offset(2) make.top.equalTo(recallBgImageView.snp.bottom).offset(2)
make.centerX.equalToSuperview() make.centerX.equalToSuperview()
make.size.equalTo(CGSizeMake(214, 42)) make.size.equalTo(CGSizeMake(214, 42))
make.bottom.equalToSuperview().offset(-24) make.bottom.equalToSuperview().offset(-24)
} }
} }
override func bindViewModel() { public override func bindViewModel() {
super.bindViewModel() super.bindViewModel()
okBtn.rx.tap.subscribe(onNext: {[weak self] in okBtn.rx.tap.subscribe(onNext: {[weak self] in
......
...@@ -464,6 +464,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -464,6 +464,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 接收App上传的数据 /// 接收App上传的数据
+(NSString *)fus_URL_dataAppinfoStat; +(NSString *)fus_URL_dataAppinfoStat;
/// 特定分享推广二维码
+(NSString *)fus_URL_inviteDataQrcodeShareGet;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -752,4 +752,9 @@ ...@@ -752,4 +752,9 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/inviteData/qrcode/get"]; return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/inviteData/qrcode/get"];
} }
/// 特定分享推广二维码
+(NSString *)fus_URL_inviteDataQrcodeShareGet{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/inviteData/qrcode/share/get"];
}
@end @end
...@@ -65,6 +65,10 @@ ...@@ -65,6 +65,10 @@
- (void)setup { - (void)setup {
self.blackUserList = [NSMutableArray array]; self.blackUserList = [NSMutableArray array];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveAnchorRewardChanged:)
name:STR(ROOM_CID_recallRewardPacket)
object:nil];
} }
+ (instancetype)sharedInstance { + (instancetype)sharedInstance {
...@@ -76,6 +80,12 @@ ...@@ -76,6 +80,12 @@
return userCenter; return userCenter;
} }
- (void)dealloc
{
// 虽然单利不会销毁,还是谨慎点好
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - Protocal Methods #pragma mark - Protocal Methods
...@@ -496,6 +506,20 @@ ...@@ -496,6 +506,20 @@
return [FUSZoneDBOperate fus_writeDataToZoneInfosTableWithModel:zoneInfosModel]; return [FUSZoneDBOperate fus_writeDataToZoneInfosTableWithModel:zoneInfosModel];
} }
#pragma mark - notification
-(void)receiveAnchorRewardChanged:(NSNotification *)notification{
FUSSocketMessageModel *messageModel = notification.object;
NSDictionary *dict = [messageModel fus_getJsonDict];
NSDictionary *dataInfo = dict[@"dataInfo"];
NSString *userId = [dataInfo[@"userId"] stringValue];
if (FUSSwiftCacheDataShare.share.oc_isLogin == YES &&
[userId isEqualToString:[FUSSwiftCacheDataShare.share.oc_userInfo uid]]) {
FUSInviteRecallWellcomeAlertView *alertView = [FUSInviteRecallWellcomeAlertView fus_createWithShowOn:[UIWindow fus_keyWindow] clickHandle:^(BOOL clickedOK) {
}];
}
}
#pragma mark - Others #pragma mark - Others
- (void)fus_imageWithModel:(FUSAssetModel *)model resultHandler:(void(^)(UIImage *_Nullable result))resultHandler { - (void)fus_imageWithModel:(FUSAssetModel *)model resultHandler:(void(^)(UIImage *_Nullable result))resultHandler {
......
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 sign in to comment