应用内更新可以了
This commit is contained in:
@@ -50,6 +50,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
|||||||
CustomMessageType_Hall = 32,
|
CustomMessageType_Hall = 32,
|
||||||
///房间礼物值
|
///房间礼物值
|
||||||
CustomMessageType_Room_GiftValue = 42,
|
CustomMessageType_Room_GiftValue = 42,
|
||||||
|
///版本升级
|
||||||
|
CustomMessageType_Version_Update = 49,
|
||||||
///公会超管
|
///公会超管
|
||||||
CustomMessageType_Hall_Super_Admin = 50,
|
CustomMessageType_Hall_Super_Admin = 50,
|
||||||
///动态
|
///动态
|
||||||
@@ -287,6 +289,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubRoomGiftValue) {
|
|||||||
Custom_Message_Sub_Room_GiftValue_Sync = 421
|
Custom_Message_Sub_Room_GiftValue_Sync = 421
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///first = CustomMessageType_Version_Update)
|
||||||
|
typedef NS_ENUM(NSUInteger, CustomMessageVersionUpdateValue) {
|
||||||
|
///版本升级
|
||||||
|
Custom_Message_Version_Update_Value = 491
|
||||||
|
};
|
||||||
|
|
||||||
///first = CustomMessageType_Hall_Super_Admin
|
///first = CustomMessageType_Hall_Super_Admin
|
||||||
typedef NS_ENUM(NSInteger, CustomMessageSubHallSuperAdmin) {
|
typedef NS_ENUM(NSInteger, CustomMessageSubHallSuperAdmin) {
|
||||||
///超管解除陪伴房的进房限制
|
///超管解除陪伴房的进房限制
|
||||||
|
@@ -305,7 +305,7 @@
|
|||||||
[self showErrorToast:@"目前已更新到最新版本"];
|
[self showErrorToast:@"目前已更新到最新版本"];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XPUpgradeView *view = [[XPUpgradeView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPUpgradeView *view = [[XPUpgradeView alloc] init];
|
||||||
view.versionModel = model;
|
view.versionModel = model;
|
||||||
TTPopupService * service = [[TTPopupService alloc] init];
|
TTPopupService * service = [[TTPopupService alloc] init];
|
||||||
service.contentView = view;
|
service.contentView = view;
|
||||||
|
@@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic,copy) NSString *updateVersion;
|
@property (nonatomic,copy) NSString *updateVersion;
|
||||||
@property (nonatomic,copy) NSString *updateDownloadLink;
|
@property (nonatomic,copy) NSString *updateDownloadLink;
|
||||||
@property (nonatomic,copy) NSString *updateFileMd5;
|
@property (nonatomic,copy) NSString *updateFileMd5;
|
||||||
|
///1线上版本,2审核中版本,3强制更新版本,4建议更新版本,5已删除版本
|
||||||
@property (nonatomic,assign)int updateStatus;
|
@property (nonatomic,assign)int updateStatus;
|
||||||
@property (nonatomic,copy) NSString *updateOs;
|
@property (nonatomic,copy) NSString *updateOs;
|
||||||
|
|
||||||
|
@@ -144,19 +144,12 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
|
|||||||
+(BOOL)isUpdateVersion:(XPVersionUpdateModel *)versionModel{
|
+(BOOL)isUpdateVersion:(XPVersionUpdateModel *)versionModel{
|
||||||
if(versionModel.updateStatus == 1 || versionModel.updateStatus == 2)return NO;
|
if(versionModel.updateStatus == 1 || versionModel.updateStatus == 2)return NO;
|
||||||
if(versionModel.updateStatus == 3)return YES;
|
if(versionModel.updateStatus == 3)return YES;
|
||||||
NSString *appVersion = [YYUtility appVersion];
|
NSString *appVersion = [YYUtility appVersion];
|
||||||
NSArray *appVersionList = [appVersion componentsSeparatedByString:@"."];
|
NSString *updateVersion = versionModel.updateVersion;
|
||||||
int appVersionNum = 0;
|
NSComparisonResult result = [appVersion compare:updateVersion options:NSNumericSearch];
|
||||||
if(appVersionList.count == 3){
|
if(result == NSOrderedSame || result == NSOrderedDescending){
|
||||||
appVersionNum = [appVersionList[0]intValue] * 100 + [appVersionList[1]intValue] * 10 + [appVersionList[2]intValue];
|
return NO;
|
||||||
}
|
}
|
||||||
NSString *updateVersion = versionModel.updateVersion;
|
|
||||||
NSArray *updateVersionList = [updateVersion componentsSeparatedByString:@"."];
|
|
||||||
int updateVersionNum = 0;
|
|
||||||
if(updateVersionList.count == 3){
|
|
||||||
updateVersionNum = [updateVersionList[0] intValue] * 100 + [updateVersionList[1] intValue] * 10 + [updateVersionList[2] intValue];
|
|
||||||
}
|
|
||||||
if(updateVersionNum <= appVersionNum)return NO;
|
|
||||||
NSDictionary *appVersionDic = [[NSUserDefaults standardUserDefaults]valueForKey:kUpdateVersionNum];
|
NSDictionary *appVersionDic = [[NSUserDefaults standardUserDefaults]valueForKey:kUpdateVersionNum];
|
||||||
if(appVersionDic == nil){
|
if(appVersionDic == nil){
|
||||||
[self saveDataWithVersion:versionModel.updateVersion updateVersionList:@[]];
|
[self saveDataWithVersion:versionModel.updateVersion updateVersionList:@[]];
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#import "StatisticsServiceHelper.h"
|
#import "StatisticsServiceHelper.h"
|
||||||
#import "Api+Monents.h"
|
#import "Api+Monents.h"
|
||||||
#import "XPAdImageTool.h"
|
#import "XPAdImageTool.h"
|
||||||
|
#import "YYUtility.h"
|
||||||
///Model
|
///Model
|
||||||
#import "AccountModel.h"
|
#import "AccountModel.h"
|
||||||
#import "RoomInfoModel.h"
|
#import "RoomInfoModel.h"
|
||||||
@@ -122,6 +123,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||||
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
|
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
|
||||||
|
[self.presenter getVersionUpdate];
|
||||||
[self.presenter juliandAdCallBackApi];
|
[self.presenter juliandAdCallBackApi];
|
||||||
[self.view addSubview:self.roomMineView];
|
[self.view addSubview:self.roomMineView];
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:kRoomMiniNotificationKey object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
[[NSNotificationCenter defaultCenter] addObserverForName:kRoomMiniNotificationKey object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
||||||
@@ -134,7 +136,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showNewUserRecharge) name:kNewUserRechargeKey object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showNewUserRecharge) name:kNewUserRechargeKey object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showAnchorCardKey:) name:kTabShowAnchorCardKey object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showAnchorCardKey:) name:kTabShowAnchorCardKey object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(teenagerStatusChange:) name:kTeenagerStatusChange object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(teenagerStatusChange:) name:kTeenagerStatusChange object:nil];
|
||||||
[self.presenter getVersionUpdate];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
@@ -308,12 +310,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
|
|
||||||
///获取更新版本信息成功
|
///获取更新版本信息成功
|
||||||
- (void)getVersionUpdate:(XPVersionUpdateModel *)versionModel {
|
- (void)getVersionUpdate:(XPVersionUpdateModel *)versionModel {
|
||||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC));
|
XPUpgradeView *view = [[XPUpgradeView alloc] init];
|
||||||
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
view.versionModel = versionModel;
|
||||||
XPUpgradeView *view = [[XPUpgradeView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
TTPopupService * service = [[TTPopupService alloc] init];
|
||||||
view.versionModel = versionModel;
|
service.contentView = view;
|
||||||
[[UIApplication sharedApplication].keyWindow addSubview:view];
|
service.shouldDismissOnBackgroundTouch = NO;
|
||||||
});
|
[TTPopup popupWithConfig:service];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - NIMLoginManagerDelegate
|
#pragma mark - NIMLoginManagerDelegate
|
||||||
@@ -446,6 +448,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
}
|
}
|
||||||
} else if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_ChannelNotify){///广播 年度飘屏
|
} else if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_ChannelNotify){///广播 年度飘屏
|
||||||
[self receiveBroadcastGift:attachment];
|
[self receiveBroadcastGift:attachment];
|
||||||
|
}else if(attachment.first == CustomMessageType_Version_Update && attachment.second == Custom_Message_Version_Update_Value){
|
||||||
|
NSString *osValue = attachment.data[@"updateOs"];
|
||||||
|
if([osValue isEqualToString:@"ios"]){
|
||||||
|
XPVersionUpdateModel *updateModel = [XPVersionUpdateModel modelWithDictionary:attachment.data];
|
||||||
|
[self getVersionUpdate:updateModel];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)initSubViews {
|
- (void)initSubViews {
|
||||||
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
|
|
||||||
[self addSubview:self.bgImageView];
|
[self addSubview:self.bgImageView];
|
||||||
|
|
||||||
[self.bgImageView addSubview:self.textView];
|
[self.bgImageView addSubview:self.textView];
|
||||||
@@ -45,10 +44,12 @@
|
|||||||
[self.stackView addArrangedSubview:self.updateBtn];
|
[self.stackView addArrangedSubview:self.updateBtn];
|
||||||
}
|
}
|
||||||
- (void)initSubViewConstraints {
|
- (void)initSubViewConstraints {
|
||||||
|
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.size.mas_equalTo(CGSizeMake(250, 311));
|
||||||
|
}];
|
||||||
|
|
||||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.center.equalTo(self);
|
make.edges.equalTo(self);
|
||||||
make.width.mas_equalTo(250);
|
|
||||||
make.height.mas_greaterThanOrEqualTo(311);
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
@@ -130,7 +131,7 @@
|
|||||||
if (!_updateBtn){
|
if (!_updateBtn){
|
||||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor],[ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor],[ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||||
_updateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
_updateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
[_updateBtn setTitle:@"记录更新" forState:UIControlStateNormal];
|
[_updateBtn setTitle:@"立即更新" forState:UIControlStateNormal];
|
||||||
_updateBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
_updateBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||||
_updateBtn.titleLabel.textColor = [ThemeColor confirmButtonTextColor];
|
_updateBtn.titleLabel.textColor = [ThemeColor confirmButtonTextColor];
|
||||||
[_updateBtn setBackgroundImage:image forState:UIControlStateNormal];
|
[_updateBtn setBackgroundImage:image forState:UIControlStateNormal];
|
||||||
@@ -146,7 +147,7 @@
|
|||||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor],[ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
UIImage *image = [UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor],[ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||||
[_cancelBtn setTitle:@"下次再说" forState:UIControlStateNormal];
|
[_cancelBtn setTitle:@"下次再说" forState:UIControlStateNormal];
|
||||||
_cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
_cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||||
_cancelBtn.titleLabel.textColor = [ThemeColor cancelButtonTextColor];
|
[_cancelBtn setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateNormal];
|
||||||
[_cancelBtn setBackgroundImage:image forState:UIControlStateNormal];
|
[_cancelBtn setBackgroundImage:image forState:UIControlStateNormal];
|
||||||
_cancelBtn.layer.cornerRadius = 32 / 2;
|
_cancelBtn.layer.cornerRadius = 32 / 2;
|
||||||
_cancelBtn.layer.masksToBounds = YES;
|
_cancelBtn.layer.masksToBounds = YES;
|
||||||
|
Reference in New Issue
Block a user