开通贵族逻辑优化,贵族升级全局弹窗
This commit is contained in:
@@ -165,6 +165,7 @@
|
||||
9BBC028B2786E05A0007C24B /* XPNobleCenterEntranceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BBC028A2786E05A0007C24B /* XPNobleCenterEntranceView.m */; };
|
||||
9BBC028E2786FA060007C24B /* NobleCardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BBC028D2786FA060007C24B /* NobleCardModel.m */; };
|
||||
9BBC02912786FC570007C24B /* XPMineNobleCardTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BBC02902786FC570007C24B /* XPMineNobleCardTableViewCell.m */; };
|
||||
9BC5B58727915CF6004960AE /* XPGlobalMessageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5B58627915CF6004960AE /* XPGlobalMessageManager.m */; };
|
||||
9BC5C8E9277AB6AE007C8719 /* XPFacePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5C8E8277AB6AE007C8719 /* XPFacePresenter.m */; };
|
||||
9BC5C8ED277AFF63007C8719 /* XPNobleCenterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5C8EC277AFF63007C8719 /* XPNobleCenterViewController.m */; };
|
||||
9BC5C8F6277B0263007C8719 /* XPNobleCenterListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5C8F5277B0263007C8719 /* XPNobleCenterListViewController.m */; };
|
||||
@@ -831,6 +832,8 @@
|
||||
9BBC028D2786FA060007C24B /* NobleCardModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NobleCardModel.m; sourceTree = "<group>"; };
|
||||
9BBC028F2786FC570007C24B /* XPMineNobleCardTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineNobleCardTableViewCell.h; sourceTree = "<group>"; };
|
||||
9BBC02902786FC570007C24B /* XPMineNobleCardTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineNobleCardTableViewCell.m; sourceTree = "<group>"; };
|
||||
9BC5B58527915CF6004960AE /* XPGlobalMessageManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGlobalMessageManager.h; sourceTree = "<group>"; };
|
||||
9BC5B58627915CF6004960AE /* XPGlobalMessageManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGlobalMessageManager.m; sourceTree = "<group>"; };
|
||||
9BC5C8E7277AB6AE007C8719 /* XPFacePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFacePresenter.h; sourceTree = "<group>"; };
|
||||
9BC5C8E8277AB6AE007C8719 /* XPFacePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFacePresenter.m; sourceTree = "<group>"; };
|
||||
9BC5C8EB277AFF63007C8719 /* XPNobleCenterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNobleCenterViewController.h; sourceTree = "<group>"; };
|
||||
@@ -3671,6 +3674,8 @@
|
||||
E8AEAED5271412EC0017FCE0 /* XPRoomViewController.m */,
|
||||
E816C11327608A7500C84014 /* XPRoomMiniManager.h */,
|
||||
E816C11427608A7500C84014 /* XPRoomMiniManager.m */,
|
||||
9BC5B58527915CF6004960AE /* XPGlobalMessageManager.h */,
|
||||
9BC5B58627915CF6004960AE /* XPGlobalMessageManager.m */,
|
||||
181D7F222727DB1E00B7C059 /* RoomHostDelegate.h */,
|
||||
180806F827298F9B001FD836 /* RoomGuestDelegate.h */,
|
||||
186F8B472733F2AE007A17BC /* MicroQueueProtocol.h */,
|
||||
@@ -4693,6 +4698,7 @@
|
||||
189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */,
|
||||
E83DB4842746661800D8CBD1 /* XPRoomGiftBroadcastView.m in Sources */,
|
||||
E84150C527747E0900A7F548 /* FirstRechargeRewardModel.m in Sources */,
|
||||
9BC5B58727915CF6004960AE /* XPGlobalMessageManager.m in Sources */,
|
||||
E8A1E4572762092700B294CA /* XPCandyTreePresenter.m in Sources */,
|
||||
E86596542701A55500846EBD /* StatisticsServiceHelper.m in Sources */,
|
||||
E8E70D8C26F2F5A500F03460 /* XPMineMatchCollectionViewCell.m in Sources */,
|
||||
|
@@ -218,7 +218,7 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubFirstRecharge) {
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubNobleVIP) {
|
||||
/// 开通贵族房内消息(公屏显示)
|
||||
Custom_Message_Sub_Room_Open_Noble_VIP = 851,
|
||||
/// 开通贵族成功消息
|
||||
/// 开通贵族成功通知消息
|
||||
Custom_Message_Sub_Open_Noble_Success = 852,
|
||||
/// 贵族升级房内消息(公屏显示)
|
||||
Custom_Message_Sub_Room_Noble_LevelUp = 853,
|
||||
|
@@ -18,6 +18,21 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///获取开通贵族产品列表
|
||||
+ (void)getChargeList:(HttpRequestHelperCompletion)completion channelType:(NSString *)channelType;
|
||||
|
||||
/// 苹果下单
|
||||
/// @param completion 完成
|
||||
/// @param chargeProdId 充值id
|
||||
/// @param uid 用户的uid
|
||||
/// @param roomUid 房间的Uid
|
||||
/// @param ticket ticket
|
||||
/// @param deviceInfo uuid
|
||||
/// @param clientIp ip地址
|
||||
+ (void)requestNobleIAPRecharge:(HttpRequestHelperCompletion)completion
|
||||
chargeProdId:(NSString *)chargeProdId
|
||||
uid:(NSString *)uid
|
||||
roomUid:(NSString *)roomUid
|
||||
ticket:(NSString *)ticket
|
||||
deviceInfo:(NSString *)deviceInfo
|
||||
clientIp:(NSString *)clientIp;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -20,4 +20,25 @@
|
||||
[self makeRequest:@"chargeprod/listV2" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, channelType, nil];
|
||||
}
|
||||
|
||||
/// 苹果下单
|
||||
/// @param completion 完成
|
||||
/// @param chargeProdId 充值id
|
||||
/// @param uid 用户的uid
|
||||
/// @param roomUid 房间的Uid
|
||||
/// @param ticket ticket
|
||||
/// @param deviceInfo uuid
|
||||
/// @param clientIp ip地址
|
||||
+ (void)requestNobleIAPRecharge:(HttpRequestHelperCompletion)completion
|
||||
chargeProdId:(NSString *)chargeProdId
|
||||
uid:(NSString *)uid
|
||||
roomUid:(NSString *)roomUid
|
||||
ticket:(NSString *)ticket
|
||||
deviceInfo:(NSString *)deviceInfo
|
||||
clientIp:(NSString *)clientIp {
|
||||
if (!roomUid) {
|
||||
roomUid = NULL;
|
||||
}
|
||||
[self makeRequest:@"order/placeV2" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, roomUid, ticket, deviceInfo, clientIp, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 生成贵族充值的订单
|
||||
/// @param chargeProdId 苹果服务器的充值 的id
|
||||
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId;
|
||||
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId roomUid:(NSString *)roomUid ;
|
||||
|
||||
/// 充值成功二次验证
|
||||
/// @param receipt 凭据
|
||||
@@ -30,6 +30,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param transcationId 商品id
|
||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId;
|
||||
|
||||
/// 批量验证内购掉单
|
||||
/// @param transcations 凭据的数组
|
||||
- (void)checkTranscationIds:(NSArray *)transcations;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -51,17 +51,17 @@
|
||||
|
||||
/// 生成贵族充值的订单
|
||||
/// @param chargeProdId 苹果服务器的充值 的id
|
||||
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
|
||||
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId roomUid:(NSString *)roomUid {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
NSString * deviceInfo = [YYUtility deviceID];
|
||||
NSString * clientIp= [YYUtility ipAddress];
|
||||
[Api requestIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[Api requestNobleIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] requestIAPRechargeOrderFail:msg code:code];
|
||||
}] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
}] chargeProdId:chargeProdId uid:uid roomUid:roomUid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
}
|
||||
|
||||
/// 充值成功二次验证
|
||||
@@ -76,4 +76,13 @@
|
||||
} showLoading:YES] receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||
}
|
||||
|
||||
/// 批量验证内购掉单
|
||||
/// @param transcations 凭据的数组
|
||||
- (void)checkTranscationIds:(NSArray *)transcations {
|
||||
NSString * transcationIdStr = [transcations toJSONString];
|
||||
[Api requestCheckTranscationIds:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] checkTranscationIdsSuccess];
|
||||
}] transcationIdStr:transcationIdStr];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -27,4 +27,7 @@
|
||||
///二次校验成功
|
||||
- (void)checkReceiptSuccess:(NSString *)transcationId;
|
||||
|
||||
///批量验证凭据成功
|
||||
- (void)checkTranscationIdsSuccess;
|
||||
|
||||
@end
|
||||
|
@@ -8,19 +8,25 @@
|
||||
#import "XPNobleUpgradeLevelView.h"
|
||||
///tool
|
||||
#import "ThemeColor+NobleCenter.h"
|
||||
//SVGA动画播放
|
||||
#import "SVGA.h"
|
||||
#import "XPMacro.h"
|
||||
///third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "TTPopup.h"
|
||||
#import "NetImageView.h"
|
||||
///model
|
||||
#import "NobleLevelUpModel.h"
|
||||
///View
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "XPNobleCenterViewController.h"
|
||||
|
||||
@interface XPNobleUpgradeLevelView ()
|
||||
|
||||
///背景
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
///icon
|
||||
@property (nonatomic, strong) NetImageView *iconImageView;
|
||||
///贵族logo
|
||||
@property (nonatomic, strong) SVGAImageView *svgDisplayView;
|
||||
///主标题
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
///等级提升标题
|
||||
@@ -32,6 +38,8 @@
|
||||
///跳转按钮
|
||||
@property (nonatomic, strong) UIButton *jumpButton;
|
||||
|
||||
@property (strong, nonatomic) SVGAParser *parser;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPNobleUpgradeLevelView
|
||||
@@ -57,15 +65,7 @@
|
||||
self.titleLabel.textColor = [ThemeColor hightNobleLightTextColor];
|
||||
[self addSubview:self.titleLabel];
|
||||
|
||||
self.iconImageView = [[NetImageView alloc] init];
|
||||
self.iconImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:self.iconImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.text = @"升级啦!";
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
|
||||
self.titleLabel.textColor = [ThemeColor hightNobleLightTextColor];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.svgDisplayView];
|
||||
|
||||
self.subTitleLabel = [[UILabel alloc] init];
|
||||
self.subTitleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
|
||||
@@ -87,7 +87,7 @@
|
||||
[self.jumpButton setBackgroundImage:[UIImage imageNamed:@"noble_upgrade_jumpBtn"] forState:UIControlStateNormal];
|
||||
[self.jumpButton setTitle:@"前往贵族中心" forState:UIControlStateNormal];
|
||||
self.jumpButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||
self.jumpButton.titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
[self.jumpButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
[self.jumpButton addTarget:self action:@selector(onJumpButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:self.jumpButton];
|
||||
}
|
||||
@@ -102,14 +102,15 @@
|
||||
make.centerX.mas_equalTo(0);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
[self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom);
|
||||
make.centerX.mas_equalTo(self.bgImageView);
|
||||
make.width.mas_equalTo(94);
|
||||
make.height.mas_equalTo(85);
|
||||
make.width.mas_equalTo(182);
|
||||
make.height.mas_equalTo(126);
|
||||
}];
|
||||
|
||||
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.iconImageView.mas_bottom).mas_offset(16);
|
||||
make.top.mas_equalTo(self.svgDisplayView.mas_bottom);
|
||||
make.centerX.mas_equalTo(self.bgImageView);
|
||||
make.height.mas_equalTo(22);
|
||||
}];
|
||||
@@ -138,12 +139,37 @@
|
||||
}
|
||||
|
||||
- (void)onJumpButtonClick:(UIButton *)button {
|
||||
|
||||
[TTPopup dismiss];
|
||||
XPNobleCenterViewController * nobleVC = [[XPNobleCenterViewController alloc] initWithRoomUid:nil];
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:nobleVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)setLevelUpInfo:(NobleLevelUpModel *)levelUpInfo {
|
||||
self.subTitleLabel.text = [NSString stringWithFormat:@"恭喜贵族等级提升到『%@』", levelUpInfo.vipName];
|
||||
self.iconImageView.imageUrl = levelUpInfo.vipLogo;
|
||||
@kWeakify(self);
|
||||
[self.parser parseWithURL:[NSURL URLWithString:levelUpInfo.vipLogo] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
@kStrongify(self);
|
||||
self.svgDisplayView.loops = INT_MAX;
|
||||
self.svgDisplayView.clearsAfterStop = NO;
|
||||
self.svgDisplayView.videoItem = videoItem;
|
||||
[self.svgDisplayView startAnimation];
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
|
||||
- (SVGAImageView *)svgDisplayView {
|
||||
if (!_svgDisplayView) {
|
||||
_svgDisplayView = [[SVGAImageView alloc] init];
|
||||
_svgDisplayView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _svgDisplayView;
|
||||
}
|
||||
|
||||
- (SVGAParser *)parser {
|
||||
if (!_parser) {
|
||||
_parser = [[SVGAParser alloc]init];
|
||||
}
|
||||
return _parser;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||||
#import <Base64/MF_Base64Additions.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "ThemeColor+NobleCenter.h"
|
||||
@@ -37,8 +38,9 @@
|
||||
#import "NobleCenterModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "NobleRechargeModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
|
||||
@interface XPNobleCenterViewController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, XPIAPHelperDelegate>
|
||||
@interface XPNobleCenterViewController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, XPIAPHelperDelegate, NIMSystemNotificationManagerDelegate>
|
||||
///分页标题
|
||||
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
||||
///分页控件
|
||||
@@ -87,6 +89,7 @@
|
||||
[super viewDidLoad];
|
||||
|
||||
[XPIAPHelper shareHelper].delegate = self;
|
||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||
[self requestHttp];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
@@ -151,9 +154,19 @@
|
||||
///请求贵族中心数据
|
||||
- (void)requestHttp {
|
||||
[self.presenter getUserInfo];
|
||||
[self checkTranscationIds];
|
||||
[self.presenter getNobleChargeProductListWithChannelType:@"10"];
|
||||
}
|
||||
|
||||
///批量验证
|
||||
- (void)checkTranscationIds {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||
if (array.count > 0) {
|
||||
[self.presenter checkTranscationIds:array];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPNobleCenterProtocol
|
||||
///获取用户信息成功
|
||||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
||||
@@ -164,9 +177,13 @@
|
||||
- (void)getNobleCenterInfoSuccess:(NobleCenterModel *)model {
|
||||
self.model = model;
|
||||
__block NSMutableArray<NSString *> *names = [NSMutableArray array];
|
||||
NSInteger defaultSelectIndex = 0;
|
||||
for (int index = 0; index < model.vipInfos.count; index++) {
|
||||
NobleInfo *tagInfo = [model.vipInfos objectAtIndex:index];
|
||||
[names addObject:tagInfo.vipName];
|
||||
if (tagInfo.vipLevel == model.currLevel) {
|
||||
defaultSelectIndex = index;
|
||||
}
|
||||
}
|
||||
self.titles = names.copy;
|
||||
self.titleView.titles = self.titles;
|
||||
@@ -175,6 +192,7 @@
|
||||
if (self.userInfo.userVipInfoVO) {
|
||||
self.myNobleView.model = model;
|
||||
}
|
||||
self.titleView.defaultSelectedIndex = defaultSelectIndex;
|
||||
[self.titleView reloadData];
|
||||
[self.lineView reloadData];
|
||||
}
|
||||
@@ -228,6 +246,7 @@
|
||||
|
||||
@kWeakify(self);
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
@kStrongify(self);
|
||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
webVC.url = URLWithType(kIdentityURL);
|
||||
[self.navigationController pushViewController:webVC animated:YES];
|
||||
@@ -238,9 +257,14 @@
|
||||
///二次校验成功
|
||||
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||
///刷新一下用户的💎
|
||||
[self.presenter getUserInfo];
|
||||
self.orderId = nil;
|
||||
//5秒之后如果没有收到开通成功的云信消息,则请求一次用户信息
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if (!self.userInfo.userVipInfoVO) {
|
||||
///刷新一下用户的信息
|
||||
[self.presenter getUserInfo];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
///删除本地保存的
|
||||
@@ -252,6 +276,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)checkTranscationIdsSuccess {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[RechargeStorage delegateAllTranscationIdsWithUid:uid];
|
||||
}
|
||||
|
||||
#pragma mark - XPIAPHelperDelegate
|
||||
///当前充值的状态
|
||||
- (void)rechargeProcessStatus:(PaymentStatus)status {
|
||||
@@ -318,6 +347,24 @@
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
|
||||
}
|
||||
|
||||
#pragma mark -NIMSystemNotificationManagerDelegate
|
||||
- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification {
|
||||
if (notification.receiverType == NIMSessionTypeP2P) {
|
||||
if (notification.content != nil) {
|
||||
NSData *jsonData = [notification.content dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSError *err;
|
||||
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
|
||||
if(err) {
|
||||
NSLog(@"json解析失败:%@",err);
|
||||
return;
|
||||
}
|
||||
if ([dic[@"first"] intValue] == CustomMessageType_Noble_VIP && [dic[@"second"] intValue] == Custom_Message_Sub_Open_Noble_Success) { // 开通贵族成功
|
||||
[self.presenter getUserInfo];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPNobleCenterNavViewDelegate
|
||||
- (void)xPNobleCenterNavView:(XPNobleCenterNavView *)view didClickBackButton:(UIButton *)sender {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
@@ -334,7 +381,7 @@
|
||||
[self showLoading];
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventVipOpenClick];
|
||||
RechargeListModel *rechargeModel = [self.rechargeModel.list lookin_safeObjectAtIndex:0];
|
||||
[self.presenter requestNobleIAPRechargeOrderWithChargeProdId:rechargeModel.chargeProdId];
|
||||
[self.presenter requestNobleIAPRechargeOrderWithChargeProdId:rechargeModel.chargeProdId roomUid:self.roomUid ? [NSString stringWithFormat:@"%zd", self.roomUid] : nil];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
@@ -387,7 +387,7 @@
|
||||
- (void)createNobleLevelUpBannerAnimation:(NSDictionary *)dic {
|
||||
XPRoomNobleLevelUpView *nobleLevelUpView = [[XPRoomNobleLevelUpView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 90)];
|
||||
nobleLevelUpView.nobleInfo = dic;
|
||||
[self.middleLevelView addSubview:nobleLevelUpView];
|
||||
[self.highLevleView addSubview:nobleLevelUpView];
|
||||
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
springAnimation.springSpeed = 12;
|
||||
springAnimation.springBounciness = 10.f;
|
||||
|
@@ -13,22 +13,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///用户昵称
|
||||
@property (nonatomic, strong) NSString *nick;
|
||||
///用户ID
|
||||
@property (nonatomic, assign) long long erbanNo;
|
||||
///当前贵族等级
|
||||
///UID
|
||||
@property (nonatomic, assign) long long uid;
|
||||
///贵族等级
|
||||
@property (nonatomic, assign) NSInteger vipLevel;
|
||||
///当前的贵族名称
|
||||
///贵族名称
|
||||
@property (nonatomic, strong) NSString *vipName;
|
||||
///升级前的贵族名称
|
||||
@property (nonatomic, strong) NSString *preVipName;
|
||||
///升级所在房间uid
|
||||
@property (nonatomic, assign) long long roomUid;
|
||||
///当前贵族logo
|
||||
@property (nonatomic, copy) NSString *vipLogo;
|
||||
///贵族icon
|
||||
@property (nonatomic, copy) NSString *vipIcon;
|
||||
|
||||
//vipLevel":2,"vipName":"贵族2","vipIcon":"http://img.uat.lecheng163.com/贵族.jpg","vipLogo":"http://img.uat.lecheng163.com/贵族.jpg","levelKeepScore":500,"levelUpScore":1000,"comingSoon":1,"createTime":"Dec 23, 2021 2:42:51 PM","updateTime":"Dec 23, 2021 3:09:50 PM"}}
|
||||
@property (nonatomic, copy) NSString *floatPic;
|
||||
///头像
|
||||
@property (nonatomic, copy) NSString *vipIcon;
|
||||
///贵族logo动图
|
||||
@property (nonatomic, copy) NSString *vipLogo;
|
||||
|
||||
@end
|
||||
|
||||
|
25
xplan-ios/Main/Room/View/XPGlobalMessageManager.h
Normal file
25
xplan-ios/Main/Room/View/XPGlobalMessageManager.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// XPGlobalMessageManager.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/1/14.
|
||||
//
|
||||
|
||||
/**
|
||||
需要全局处理的消息,用户在不在房间都需要处理,比如用户等级提升、魅力值提升、贵族等级提升消息
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPGlobalMessageManager : NSObject
|
||||
|
||||
+ (instancetype)shareManager;
|
||||
|
||||
- (void)addDelegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
73
xplan-ios/Main/Room/View/XPGlobalMessageManager.m
Normal file
73
xplan-ios/Main/Room/View/XPGlobalMessageManager.m
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// XPGlobalMessageManager.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/1/14.
|
||||
//
|
||||
|
||||
#import "XPGlobalMessageManager.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
///Model
|
||||
#import "AttachmentModel.h"
|
||||
#import "NobleLevelUpModel.h"
|
||||
//View
|
||||
#import "XPNobleUpgradeLevelView.h"
|
||||
#import "XPNobleUpgradeLevelView.h"
|
||||
//Tool
|
||||
#import "TTPopup.h"
|
||||
|
||||
@interface XPGlobalMessageManager ()<NIMSystemNotificationManagerDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPGlobalMessageManager
|
||||
|
||||
+ (instancetype)shareManager {
|
||||
static dispatch_once_t onceToken = 0;
|
||||
static id instance;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[XPGlobalMessageManager alloc] init];
|
||||
});
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
- (void)addDelegate {
|
||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||
}
|
||||
|
||||
#pragma mark -NIMSystemNotificationManagerDelegate
|
||||
- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification {
|
||||
if (notification.receiverType == NIMSessionTypeP2P) {
|
||||
if (notification.content != nil) {
|
||||
NSData *jsonData = [notification.content dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSError *err;
|
||||
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
|
||||
if(err) {
|
||||
NSLog(@"json解析失败:%@",err);
|
||||
return;
|
||||
}
|
||||
if ([dic[@"first"] intValue] == CustomMessageType_Noble_VIP && [dic[@"second"] intValue] == Custom_Message_Sub_Noble_LevelUp_User) { // 用户贵族升级
|
||||
if ([dic isKindOfClass:[NSDictionary class]]) {
|
||||
[self receiveNobleLevelUp:dic];
|
||||
}
|
||||
} else if ([dic[@"first"] integerValue] == 48) {
|
||||
// 青少年模式下,房间在线时长达到上限
|
||||
if ([dic[@"second"] integerValue] == 481) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (notification.receiverType == NIMSessionTypeTeam) {
|
||||
} else if (notification.receiverType == NIMSessionTypeChatroom) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (void)receiveNobleLevelUp:(NSDictionary *)data {
|
||||
XPNobleUpgradeLevelView *view = [[XPNobleUpgradeLevelView alloc] initWithFrame:CGRectMake(0, 0, 300, 285)];
|
||||
NobleLevelUpModel *receiveInfo = [NobleLevelUpModel modelWithDictionary:data[@"data"]];
|
||||
view.levelUpInfo = receiveInfo;
|
||||
[TTPopup popupView:view style:TTPopupStyleAlert];
|
||||
}
|
||||
|
||||
@end
|
@@ -21,6 +21,7 @@
|
||||
#import "ClientConfig.h"
|
||||
#import "RtcManager.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "XPGlobalMessageManager.h"
|
||||
///Model
|
||||
#import "AccountModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
@@ -113,6 +114,8 @@
|
||||
}
|
||||
[self initTabs:YES];
|
||||
[self showTeenagerAlertView:userInfo];
|
||||
|
||||
[[XPGlobalMessageManager shareManager] addDelegate];
|
||||
}
|
||||
|
||||
#pragma mark - BaseMvpProtocol
|
||||
|
Reference in New Issue
Block a user