diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 73b38fd6..e0645d40 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -269,6 +269,8 @@ 9BDA3E7727FD41C200517FE6 /* XPAnchorFansTeamViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BDA3E7627FD41C200517FE6 /* XPAnchorFansTeamViewController.m */; }; 9BDA3E7A27FD43EF00517FE6 /* XPAnchorFansTeamEntranceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BDA3E7927FD43EF00517FE6 /* XPAnchorFansTeamEntranceView.m */; }; 9BDA3E7D27FD47AB00517FE6 /* XPAnchorFansTeamPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BDA3E7C27FD47AB00517FE6 /* XPAnchorFansTeamPresenter.m */; }; + 9BE01AC528913B2500B50299 /* XPNewUserRechargeSuccessView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE01AC428913B2500B50299 /* XPNewUserRechargeSuccessView.m */; }; + 9BE01AC828913D4C00B50299 /* XPNewUserRechargeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE01AC728913D4C00B50299 /* XPNewUserRechargeViewController.m */; }; 9BE29A6B27D1BFF700446AB5 /* anchor_room_speak.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9BE29A6927D1BFF700446AB5 /* anchor_room_speak.svga */; }; 9BE29A6D27D210A500446AB5 /* anchor_room_bg.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9BE29A6C27D210A500446AB5 /* anchor_room_bg.svga */; }; 9BE2FA90288010D300EF3D83 /* AnchorRoomSrollTipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE2FA8F288010D300EF3D83 /* AnchorRoomSrollTipView.m */; }; @@ -1411,6 +1413,10 @@ 9BDA3E7B27FD47AB00517FE6 /* XPAnchorFansTeamPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorFansTeamPresenter.h; sourceTree = ""; }; 9BDA3E7C27FD47AB00517FE6 /* XPAnchorFansTeamPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorFansTeamPresenter.m; sourceTree = ""; }; 9BDA3E7F27FD480D00517FE6 /* XPAnchorFansTeamProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorFansTeamProtocol.h; sourceTree = ""; }; + 9BE01AC328913B2500B50299 /* XPNewUserRechargeSuccessView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNewUserRechargeSuccessView.h; sourceTree = ""; }; + 9BE01AC428913B2500B50299 /* XPNewUserRechargeSuccessView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNewUserRechargeSuccessView.m; sourceTree = ""; }; + 9BE01AC628913D4C00B50299 /* XPNewUserRechargeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNewUserRechargeViewController.h; sourceTree = ""; }; + 9BE01AC728913D4C00B50299 /* XPNewUserRechargeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNewUserRechargeViewController.m; sourceTree = ""; }; 9BE29A6927D1BFF700446AB5 /* anchor_room_speak.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchor_room_speak.svga; sourceTree = ""; }; 9BE29A6C27D210A500446AB5 /* anchor_room_bg.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchor_room_bg.svga; sourceTree = ""; }; 9BE2FA8E288010D300EF3D83 /* AnchorRoomSrollTipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorRoomSrollTipView.h; sourceTree = ""; }; @@ -6035,6 +6041,10 @@ children = ( E8B3E7FC28489232009746AB /* XPNewUserGreetRoomAlertView.h */, E8B3E7FD28489232009746AB /* XPNewUserGreetRoomAlertView.m */, + 9BE01AC328913B2500B50299 /* XPNewUserRechargeSuccessView.h */, + 9BE01AC428913B2500B50299 /* XPNewUserRechargeSuccessView.m */, + 9BE01AC628913D4C00B50299 /* XPNewUserRechargeViewController.h */, + 9BE01AC728913D4C00B50299 /* XPNewUserRechargeViewController.m */, 189DD53226DE255300AB55B1 /* TabbarViewController.h */, 189DD53326DE255300AB55B1 /* TabbarViewController.m */, ); @@ -7345,6 +7355,7 @@ E80DE4072775665000BE5BCB /* XPFirstRechargeCollectionViewCell.m in Sources */, E8899C822785A694007944BE /* DatingInfoModel.m in Sources */, 9BB89DC327FE7F3A00586A83 /* XPAnchorFansRelationModel.m in Sources */, + 9BE01AC528913B2500B50299 /* XPNewUserRechargeSuccessView.m in Sources */, E8C6FFD72754BC61004DC9F0 /* XPHomeNavView.m in Sources */, E8AC723226F49710007D6E91 /* XPMineNotificationTableViewCell.m in Sources */, E8AC722926F488DA007D6E91 /* XPMineFeedbackProtocol.h in Sources */, @@ -8058,6 +8069,7 @@ E8C167332806CADF00ECB15C /* XPGuildSuperAdminMenuView.m in Sources */, E800808527FD8FC20055A8AB /* ClanMemberDetailInfoModel.m in Sources */, E8412FA92779C2ED006E1101 /* XPRoomSettingItemModel.m in Sources */, + 9BE01AC828913D4C00B50299 /* XPNewUserRechargeViewController.m in Sources */, 9B92A3692798145000AD168F /* XPSkillCardTypeModel.m in Sources */, 189DD58F26DF97E700AB55B1 /* LoginPresenter.m in Sources */, E8C167272806A68F00ECB15C /* GuildRoomInfoModel.m in Sources */, diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/Contents.json b/xplan-ios/Assets.xcassets/NewUserRecharge/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/xplan-ios/Assets.xcassets/NewUserRecharge/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/Contents.json new file mode 100644 index 00000000..18618204 --- /dev/null +++ b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "NewUserRecharge_bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "NewUserRecharge_bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/NewUserRecharge_bg@2x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/NewUserRecharge_bg@2x.png new file mode 100644 index 00000000..c64418b7 Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/NewUserRecharge_bg@2x.png differ diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/NewUserRecharge_bg@3x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/NewUserRecharge_bg@3x.png new file mode 100644 index 00000000..137cb616 Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_bg.imageset/NewUserRecharge_bg@3x.png differ diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/Contents.json b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/Contents.json new file mode 100644 index 00000000..eab3d9fd --- /dev/null +++ b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "NewUserRecharge_goto@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "NewUserRecharge_goto@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/NewUserRecharge_goto@2x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/NewUserRecharge_goto@2x.png new file mode 100644 index 00000000..719dac27 Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/NewUserRecharge_goto@2x.png differ diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/NewUserRecharge_goto@3x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/NewUserRecharge_goto@3x.png new file mode 100644 index 00000000..e7bbe7ee Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_goto.imageset/NewUserRecharge_goto@3x.png differ diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/Contents.json new file mode 100644 index 00000000..7acb0528 --- /dev/null +++ b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "NewUserRecharge_segment_normal_bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "NewUserRecharge_segment_normal_bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/NewUserRecharge_segment_normal_bg@2x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/NewUserRecharge_segment_normal_bg@2x.png new file mode 100644 index 00000000..be05b2c0 Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/NewUserRecharge_segment_normal_bg@2x.png differ diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/NewUserRecharge_segment_normal_bg@3x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/NewUserRecharge_segment_normal_bg@3x.png new file mode 100644 index 00000000..751ed3b2 Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_normal_bg.imageset/NewUserRecharge_segment_normal_bg@3x.png differ diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/Contents.json new file mode 100644 index 00000000..42d6995e --- /dev/null +++ b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "NewUserRecharge_segment_selected_bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "NewUserRecharge_segment_selected_bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/NewUserRecharge_segment_selected_bg@2x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/NewUserRecharge_segment_selected_bg@2x.png new file mode 100644 index 00000000..fc35c620 Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/NewUserRecharge_segment_selected_bg@2x.png differ diff --git a/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/NewUserRecharge_segment_selected_bg@3x.png b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/NewUserRecharge_segment_selected_bg@3x.png new file mode 100644 index 00000000..eeb4bb28 Binary files /dev/null and b/xplan-ios/Assets.xcassets/NewUserRecharge/NewUserRecharge_segment_selected_bg.imageset/NewUserRecharge_segment_selected_bg@3x.png differ diff --git a/xplan-ios/Base/MVP/Model/UserInfoModel.h b/xplan-ios/Base/MVP/Model/UserInfoModel.h index 07555f4a..181fe70b 100644 --- a/xplan-ios/Base/MVP/Model/UserInfoModel.h +++ b/xplan-ios/Base/MVP/Model/UserInfoModel.h @@ -51,6 +51,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic , assign) BOOL isBindPasswd; @property (nonatomic, assign) NSInteger visitNum;///访客数量 @property (nonatomic, assign) NSInteger inRoomNum;///足迹 +///是否需要展示限时首充列表 +@property (nonatomic, assign) BOOL showLimitCharge; +///限时首充结束时间 +@property (nonatomic, assign) long limitChargeEndTime; ///相册 @property (nonatomic, strong) NSArray *privatePhoto;//相册 ///签名 diff --git a/xplan-ios/Global/XPConstant.m b/xplan-ios/Global/XPConstant.m index 66dababa..368b5363 100644 --- a/xplan-ios/Global/XPConstant.m +++ b/xplan-ios/Global/XPConstant.m @@ -22,6 +22,7 @@ NSString * const kRoomBackMusicPlayMusicOrderKey = @"kRoomBackMusicPlayMusicOrde NSString * const kRoomBackMusicPlayMusicFinishKey = @"kRoomBackMusicPlayMusicFinishKey";///房间背景音乐 播放完毕的key NSString * const kUserCompleteInfoFinishKey = @"kUserCompleteInfoFinishKey";///补全资料完成 NSString * const kHadShowNewUserGiftKey = @"kHadShowNewUserGiftKey";//新用户房间礼物 +NSString * const kNewUserRechargeKey = @"kNewUserRechargeKey";//新用户充值优惠 不同于房间内首充 ///在里面进行判断当前环境是什么 NSString * const KeyWithType(KeyType type) { diff --git a/xplan-ios/Main/Room/View/XPRoomViewController.m b/xplan-ios/Main/Room/View/XPRoomViewController.m index 954eda99..1d2cd47f 100644 --- a/xplan-ios/Main/Room/View/XPRoomViewController.m +++ b/xplan-ios/Main/Room/View/XPRoomViewController.m @@ -59,8 +59,10 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; UIKIT_EXTERN NSString * const kRoomMiniNotificationKey; +UIKIT_EXTERN NSString * kNewUserRechargeKey; NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否展示过个播房上划用户引导 +NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出过非自己房间 @interface XPRoomViewController () ///背景 @@ -1169,6 +1171,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [[XPRoomMiniManager shareManager] resetLocalMessage]; [[RtcManager instance] exitRoom]; [self.presenter reportUserOutRoom:roomUid]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } cancelHandler:^{ @@ -1180,6 +1183,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [[XPRoomMiniManager shareManager] resetLocalMessage]; [[RtcManager instance] exitRoom]; [self.presenter reportUserOutRoom:roomUid]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } roomUid:roomUid operUid:uid page:@"1" pageSize:@"50"]; } else if(self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) { @@ -1203,6 +1207,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; [[XPRoomMiniManager shareManager] resetLocalMessage]; [[RtcManager instance] exitRoom]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } cancelHandler:^{ @@ -1213,6 +1218,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; [[XPRoomMiniManager shareManager] resetLocalMessage]; [[RtcManager instance] exitRoom]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } roomUid:roomUid operUid:uid page:@"1" pageSize:@"50"]; }else if(self.roomInfo.type == RoomType_MiniGame) { @@ -1227,6 +1233,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [[RtcManager instance] exitRoom]; [self.littleGameView handleSelfInExitEvent]; [self.littleGameView destroyMG]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; }); } cancelHandler:^{ @@ -1236,6 +1243,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [[RtcManager instance] exitRoom]; [self.littleGameView handleSelfInExitEvent]; [self.littleGameView destroyMG]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } } else { @@ -1243,6 +1251,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [[XPRoomMiniManager shareManager] resetLocalMessage]; [[RtcManager instance] exitRoom]; [self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } } @@ -1264,6 +1273,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [self.view endEditing:YES]; [self.littleGameView handleSelfInExitEvent]; [self.littleGameView destroyMG]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; }); } cancelHandler:^{ @@ -1277,6 +1287,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 [self.view endEditing:YES]; [self.littleGameView handleSelfInExitEvent]; [self.littleGameView destroyMG]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } }else { @@ -1286,6 +1297,7 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 NSDictionary * dic = @{@"roomInfo":self.roomInfo.model2dictionary, @"userInfo":self.userInfo.model2dictionary, @"microQueue":self.getMicroQueue}; [[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic]; [self.view endEditing:YES]; + [self handleFirstOutRoom]; [self dismissViewControllerAnimated:YES completion:nil]; } } @@ -1319,6 +1331,17 @@ NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否 - (CGPoint)animationPointAtStageViewByUid:(NSString *)uid { return [self.stageView animationPointAtStageViewByUid:uid]; } + +#pragma mark - 首次退出非自己的房间,处理是否需要弹新用户充值优惠 +- (void)handleFirstOutRoom { + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; +// if (![defaults boolForKey:kHadQuitOtherRoomKey] && self.userInfo.uid != self.roomInfo.uid) { +// [defaults setBool:YES forKey:kHadQuitOtherRoomKey]; +// [defaults synchronize]; + [[NSNotificationCenter defaultCenter] postNotificationName:kNewUserRechargeKey object:nil]; +// } +} + #pragma mark - XPRoomLittleGameContainerViewDelegate - (void)hiddenSudGamePostionView { [self.functionView hiddenSudGamePostionView]; diff --git a/xplan-ios/Main/Tabbar/Api/Api+Main.h b/xplan-ios/Main/Tabbar/Api/Api+Main.h index 5418c2b4..b3484af4 100644 --- a/xplan-ios/Main/Tabbar/Api/Api+Main.h +++ b/xplan-ios/Main/Tabbar/Api/Api+Main.h @@ -34,6 +34,11 @@ NS_ASSUME_NONNULL_BEGIN /// @param completion 完成 /// @param uid 用户的uid + (void)shortCutRecommendRoom:(HttpRequestHelperCompletion)completion uid:(NSString *)uid; + +/// 获取新用户充值优惠列表 +/// @param completion 完成 ++ (void)requestNewUserRechargeList:(HttpRequestHelperCompletion)completion; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Tabbar/Api/Api+Main.m b/xplan-ios/Main/Tabbar/Api/Api+Main.m index 3d294ec1..36ede53c 100644 --- a/xplan-ios/Main/Tabbar/Api/Api+Main.m +++ b/xplan-ios/Main/Tabbar/Api/Api+Main.m @@ -71,4 +71,10 @@ [self makeRequest:@"room/shortcut/recommend" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uid, nil]; } +/// 获取新用户充值优惠列表 +/// @param completion 完成 ++ (void)requestNewUserRechargeList:(HttpRequestHelperCompletion)completion { + [self makeRequest:@"first/charge/limit/list" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil]; +} + @end diff --git a/xplan-ios/Main/Tabbar/Presenter/MainPresenter.h b/xplan-ios/Main/Tabbar/Presenter/MainPresenter.h index de937aa5..7ff8c12d 100644 --- a/xplan-ios/Main/Tabbar/Presenter/MainPresenter.h +++ b/xplan-ios/Main/Tabbar/Presenter/MainPresenter.h @@ -28,6 +28,10 @@ NS_ASSUME_NONNULL_BEGIN /// 获取快捷推荐进房 - (void)getShortCutRecommendRoom; + +///获取新用户充值优惠 +- (void)getNewUserRechargeList; + @end diff --git a/xplan-ios/Main/Tabbar/Presenter/MainPresenter.m b/xplan-ios/Main/Tabbar/Presenter/MainPresenter.m index 9776e19b..310856ee 100644 --- a/xplan-ios/Main/Tabbar/Presenter/MainPresenter.m +++ b/xplan-ios/Main/Tabbar/Presenter/MainPresenter.m @@ -102,4 +102,13 @@ [[self getView] getShortCutRecommendRoomSuccces:roomUid]; }] uid:uid]; } + +///获取新用户充值优惠 +- (void)getNewUserRechargeList { + NSString * uid = [AccountInfoStorage instance].getUid; + [Api requestNewUserRechargeList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + NSLog(@"%@", data.data); + }]]; +} + @end diff --git a/xplan-ios/Main/Tabbar/View/TabbarViewController.m b/xplan-ios/Main/Tabbar/View/TabbarViewController.m index 3b3147a6..83d4c535 100644 --- a/xplan-ios/Main/Tabbar/View/TabbarViewController.m +++ b/xplan-ios/Main/Tabbar/View/TabbarViewController.m @@ -51,6 +51,7 @@ #import "XPNewUserGreetRoomAlertView.h" #import "XPSessionFindNewAlertView.h" #import "XPHomeLivesViewController.h" +#import "XPNewUserRechargeViewController.h" ///Present #import "MainPresenter.h" #import "MainProtocol.h" @@ -59,6 +60,7 @@ UIKIT_EXTERN NSString * kUserCompleteInfoFinishKey; NSString * const kUserFirstLoginKey = @"kUserFirstLoginKey"; UIKIT_EXTERN NSString * kHomeMoreScrollPageKey; +UIKIT_EXTERN NSString * kNewUserRechargeKey; @interface TabbarViewController () @@ -67,6 +69,9 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey; @property (nonatomic,strong) XPMiniRoomView *roomMineView; ///邀请码 @property (nonatomic,copy) NSString *inviteCode; +///需要显示新用户充值优惠弹窗 +@property (nonatomic, assign) BOOL needShowNewUserRecharge; + @end @implementation TabbarViewController @@ -89,6 +94,12 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey; [self completeUserInfoFinish:note.object]; }]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recommendMoreNotification:) name:kHomeMoreScrollPageKey object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showNewUserRecharge) name:kNewUserRechargeKey object:nil]; +} + +//新用户专享充值弹窗 +- (void)showNewUserRecharge { + self.needShowNewUserRecharge = YES; } - (void)viewWillAppear:(BOOL)animated { @@ -100,6 +111,15 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey; } } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + if (self.needShowNewUserRecharge) { + self.needShowNewUserRecharge = NO; + XPNewUserRechargeViewController *vc = [[XPNewUserRechargeViewController alloc] initWithNavigation:self.selectedViewController.navigationController]; + [self.selectedViewController.navigationController presentViewController:vc animated:YES completion:nil]; + } +} + - (MainPresenter *)presenter { if (_presenter == nil) { _presenter = [[MainPresenter alloc] init]; diff --git a/xplan-ios/Main/Tabbar/View/XPNewUserRechargeSuccessView.h b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeSuccessView.h new file mode 100644 index 00000000..3fdabdd3 --- /dev/null +++ b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeSuccessView.h @@ -0,0 +1,16 @@ +// +// XPNewUserRechargeView.h +// xplan-ios +// +// Created by GreenLand on 2022/7/27. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XPNewUserRechargeSuccessView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Tabbar/View/XPNewUserRechargeSuccessView.m b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeSuccessView.m new file mode 100644 index 00000000..4d63acae --- /dev/null +++ b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeSuccessView.m @@ -0,0 +1,14 @@ +// +// XPNewUserRechargeView.m +// xplan-ios +// +// Created by GreenLand on 2022/7/27. +// + +#import "XPNewUserRechargeSuccessView.h" + +@implementation XPNewUserRechargeSuccessView + + + +@end diff --git a/xplan-ios/Main/Tabbar/View/XPNewUserRechargeViewController.h b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeViewController.h new file mode 100644 index 00000000..9318a37f --- /dev/null +++ b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeViewController.h @@ -0,0 +1,18 @@ +// +// XPNewUserRechargeViewController.h +// xplan-ios +// +// Created by GreenLand on 2022/7/27. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPNewUserRechargeViewController : MvpViewController + +- (instancetype)initWithNavigation:(UINavigationController *)nav; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Tabbar/View/XPNewUserRechargeViewController.m b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeViewController.m new file mode 100644 index 00000000..ddc4fca3 --- /dev/null +++ b/xplan-ios/Main/Tabbar/View/XPNewUserRechargeViewController.m @@ -0,0 +1,328 @@ +// +// XPNewUserRechargeViewController.m +// xplan-ios +// +// Created by GreenLand on 2022/7/27. +// + +#import "XPNewUserRechargeViewController.h" +///Third +#import +///Tool +#import "XPMacro.h" +#import "ThemeColor+FirstRecharge.h" +#import "UIImage+Utils.h" +#import "XPFirstRechargeFlowLayout.h" +///Model +#import "FirstRechargeModel.h" +///View +#import "XPFirstRechargeCollectionViewCell.h" +///P +#import "MainPresenter.h" +#import "MainProtocol.h" +///VC +#import "XPMineRechargeViewController.h" + +@interface XPNewUserRechargeViewController () +///顶部的View +@property (nonatomic,strong) UIView * topView; +///底部的View +@property (nonatomic,strong) UIView * bottomView; +///背景图 +@property (nonatomic,strong) UIImageView *backImageView; +///关闭按钮 +@property (nonatomic, strong) UIButton *closeBtn; +///优惠倒计时 +@property (nonatomic, strong) UILabel *countDownLabel; +///奖励的容器 segment 额外奖励的 礼物的 +@property (nonatomic,strong) UIImageView * rewardBackView; +///tab 切换 +@property (nonatomic,strong) UIStackView * segmentView; +///额外的奖励说明 +@property (nonatomic,strong) UIButton *extraButton; +///列表 +@property (nonatomic,strong) UICollectionView *collectionView; +///立即充值 +@property (nonatomic, strong) UIButton *rechargeButton; +///数据源 +@property (nonatomic,strong) NSArray *rewardArray; +///初始数据源 +@property (nonatomic,strong) NSArray *originArray; +///当前的导航栏 +@property (nonatomic,weak) UINavigationController * currentNav; +@end + +@implementation XPNewUserRechargeViewController + +- (instancetype)initWithNavigation:(UINavigationController *)nav { + if (self = [super init]) { + self.modalPresentationStyle = UIModalPresentationOverFullScreen; + self.currentNav = nav; + } + return self; +} + +- (MainPresenter *)createPresenter { + return [[MainPresenter alloc] init]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self.presenter getNewUserRechargeList]; + [self initSubViews]; + [self initSubViewConstraints]; +} + +#pragma mark - Private Method +- (void)initSubViews { + self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.7]; + [self.view addSubview:self.topView]; + [self.view addSubview:self.backImageView]; + [self.view addSubview:self.bottomView]; + [self.view addSubview:self.closeBtn]; + [self.view addSubview:self.countDownLabel]; + + [self.backImageView addSubview:self.rechargeButton]; + [self.backImageView addSubview:self.rewardBackView]; + + [self.rewardBackView addSubview:self.segmentView]; + [self.rewardBackView addSubview:self.extraButton]; + [self.rewardBackView addSubview:self.collectionView]; +} + +- (void)initSubViewConstraints { + [self.topView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.mas_equalTo(self.view); + make.bottom.mas_equalTo(self.backImageView.mas_top); + }]; + + [self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.view); + make.height.mas_equalTo(405); + make.width.mas_equalTo(315); + }]; + + [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.bottom.mas_equalTo(self.view); + make.top.mas_equalTo(self.backImageView.mas_bottom); + }]; + [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self.backImageView.mas_top); + make.width.height.mas_equalTo(21); + make.right.mas_equalTo(self.backImageView).mas_offset(8); + }]; + [self.countDownLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.backImageView).mas_offset(87); + make.left.mas_equalTo(self.backImageView).mas_offset(47); + make.height.mas_equalTo(14); + }]; + [self.rechargeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(244, 44)); + make.centerX.mas_equalTo(self.backImageView); + make.bottom.mas_equalTo(self.backImageView.mas_bottom).offset(-28); + }]; + + [self.rewardBackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.backImageView).offset(128); + make.height.mas_equalTo(205); + make.width.mas_equalTo(266); + make.centerX.mas_equalTo(self.backImageView); + }]; + + [self.segmentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(266); + make.centerX.top.mas_equalTo(self.rewardBackView); + make.height.mas_equalTo(50); + }]; + + [self.extraButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(245, 17)); + make.top.mas_equalTo(self.segmentView.mas_bottom).offset(12); + make.centerX.mas_equalTo(self.rewardBackView); + }]; + + [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.extraButton.mas_bottom).offset(12); + make.left.right.mas_equalTo(self.rewardBackView); + make.bottom.mas_equalTo(self.rewardBackView); + }]; +} + +- (void)createExtraRewardAttrebute:(FirstRechargeModel *)model { + NSString * title = model.chargeProdTitle; + NSString * giveMoneyStr = [NSString stringWithFormat:@"%ld", model.giveMoney]; + NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14], NSForegroundColorAttributeName:UIColorFromRGB(0x845DFF)}]; + [attribute addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xFFA027) range:[title rangeOfString:giveMoneyStr]]; + [attribute addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:[title rangeOfString:giveMoneyStr]]; + [self.extraButton setAttributedTitle:attribute forState:UIControlStateNormal]; +} + +#pragma mark - XPFirstRechargeProtocol +- (void)getFirstRechargeListSuccess:(NSArray *)array { + if (array.count <= 0) return; + self.originArray = array; + if (self.segmentView.arrangedSubviews.count > 0) { + [[self.segmentView arrangedSubviews] enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [obj removeFromSuperview]; + }]; + } + for (int i = 0 ; i < array.count; i++) { + FirstRechargeModel * modelInfo = [array objectAtIndex:i]; + NSString * title = [NSString stringWithFormat:@"%ld元", modelInfo.chargeMoney]; + UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; + [button setTitleColor:[ThemeColor rewardSegmentTextColor] forState:UIControlStateSelected]; + [button setTitleColor:[ThemeColor rewardSegmentNormalTextColor] forState:UIControlStateNormal]; + button.titleLabel.font = [UIFont systemFontOfSize:18]; + [button setTitle:title forState:UIControlStateNormal]; + [button setTitle:title forState:UIControlStateSelected]; + button.adjustsImageWhenHighlighted = NO; + button.tag = i; + [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; + [button setBackgroundImage:[UIImage imageNamed:@"NewUserRecharge_segment_normal_bg"] forState:UIControlStateNormal]; + [button setBackgroundImage:[[UIImage imageNamed:@"NewUserRecharge_segment_selected_bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 30, 0, 30) resizingMode:UIImageResizingModeStretch] forState:UIControlStateSelected]; + if (i == 0) { + button.selected = YES; + [self createExtraRewardAttrebute:modelInfo]; + self.rewardArray = modelInfo.firstChargeRewardList; + [self.collectionView reloadData]; + } + [self.segmentView addArrangedSubview:button]; + } +} + +#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.rewardArray.count; +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + XPFirstRechargeCollectionViewCell * cell= [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPFirstRechargeCollectionViewCell class]) forIndexPath:indexPath]; + cell.rewardInfo = [self.rewardArray objectAtIndex:indexPath.row]; + return cell; +} + +#pragma mark - Event Response +- (void)dismissFirstRechargeVC { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)rechargeButtonAction:(UIButton *)sender { + [self dismissViewControllerAnimated:YES completion:nil]; + XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init]; + [self.currentNav pushViewController:rechargeVC animated:YES]; +} + +- (void)buttonAction:(UIButton *)sender { + if (sender.tag <= self.originArray.count) { + FirstRechargeModel * model = [self.originArray objectAtIndex:sender.tag]; + [self createExtraRewardAttrebute:model]; + self.rewardArray = model.firstChargeRewardList; + [self.collectionView reloadData]; + } + + [[self.segmentView arrangedSubviews] enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + UIButton * button = obj; + button.selected = NO; + }]; + sender.selected = !sender.selected; +} + +#pragma mark - Getters And Setters +- (UICollectionView *)collectionView{ + if (!_collectionView) { + XPFirstRechargeFlowLayout *layout = [[XPFirstRechargeFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(60, 60+ 16); + layout.minimumLineSpacing = 12; + layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + _collectionView.dataSource = self; + _collectionView.delegate = self; + _collectionView.backgroundColor = [UIColor clearColor]; + [_collectionView registerClass:[XPFirstRechargeCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPFirstRechargeCollectionViewCell class])]; + } + return _collectionView; +} + +- (UIView *)bottomView { + if (!_bottomView) { + _bottomView = [[UIView alloc] init]; + _bottomView.backgroundColor = [UIColor clearColor]; + UITapGestureRecognizer * tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissFirstRechargeVC)]; + [_bottomView addGestureRecognizer:tap]; + } + return _bottomView; +} + +- (UIView *)topView { + if (!_topView) { + _topView = [[UIView alloc] init]; + _topView.backgroundColor = [UIColor clearColor]; + UITapGestureRecognizer * tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissFirstRechargeVC)]; + [_topView addGestureRecognizer:tap]; + } + return _topView; +} + +- (UIImageView *)backImageView { + if (!_backImageView) { + _backImageView = [[UIImageView alloc] init]; + _backImageView.userInteractionEnabled = YES; + _backImageView.image = [UIImage imageNamed:@"NewUserRecharge_bg"]; + } + return _backImageView; +} + +- (UIButton *)closeBtn { + if (!_closeBtn) { + _closeBtn = [[UIButton alloc] init]; + [_closeBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal]; + } + return _closeBtn; +} + +- (UILabel *)countDownLabel { + if (!_countDownLabel) { + _countDownLabel = [[UILabel alloc] init]; + _countDownLabel.textColor = [UIColor whiteColor]; + _countDownLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium]; + } + return _countDownLabel; +} + +- (UIImageView *)rewardBackView { + if (!_rewardBackView) { + _rewardBackView = [[UIImageView alloc] init]; + _rewardBackView.userInteractionEnabled = YES; + _rewardBackView.backgroundColor = UIColorFromRGB(0xFCE9FC); + } + return _rewardBackView; +} + +- (UIButton *)extraButton { + if (!_extraButton) { + _extraButton = [UIButton buttonWithType:UIButtonTypeCustom]; + } + return _extraButton; +} + +- (UIButton *)rechargeButton { + if (!_rechargeButton) { + _rechargeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_rechargeButton setImage:[UIImage imageNamed:@"NewUserRecharge_goto"] forState:UIControlStateNormal]; + } + return _rechargeButton; +} + +- (UIStackView *)segmentView { + if (!_segmentView) { + _segmentView = [[UIStackView alloc] init]; + _segmentView.axis = UILayoutConstraintAxisHorizontal; + _segmentView.distribution = UIStackViewDistributionFillEqually; + _segmentView.alignment = UIStackViewAlignmentFill; + _segmentView.spacing = 4; + _segmentView.backgroundColor = UIColorFromRGB(0xE0B4FF); + } + return _segmentView; +} + +@end