礼物动效缓存

This commit is contained in:
liyuhua
2024-05-15 17:35:51 +08:00
parent e47967a1e6
commit 1723782767
12 changed files with 379 additions and 331 deletions

View File

@@ -575,6 +575,9 @@
[self.messages removeObjectsInArray:needRemoveMsgArray];
}
for (NIMMessage *message in messages) {
if (![self isCanAddMsg:message]){
return;
}
[self addTimeMessage:message];
if (message.isDeleted) {
continue;
@@ -599,7 +602,11 @@
if (message.session.sessionType != NIMSessionTypeChatroom) {
return;
}
if (![self isCanAddMsg:message]){
return;
}
[self addTimeMessage:message];
if (![self isExistMessages:message]) {
if ([self isCanAddMsg:message]){
[self addTimeMessage:message];

View File

@@ -2053,11 +2053,11 @@
/// SVGA
- (void)playGiftEffect:(NSString *)vggUrl {
if ([self isInSudGame]) {return;}
NSString *baseFileName = @"/GiftSvga";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vggUrl];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
NSString *fileName = [[vggUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
NSData *data=[NSData dataWithContentsOfFile:fullPath options:0 error:NULL];
[self.parser parseWithData:data cacheKey:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
@@ -2161,11 +2161,11 @@
/// vap
- (void)playGiftEffectWithVapUrl:(NSString *)vapUrl {
NSString *baseFileName = @"/GiftMp4";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vapUrl];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
vapUrl = filePath;
NSString *fileName = [[vapUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
vapUrl = fullPath;
self.vapGiftEffectView.hidden = NO;
if (self.vapGiftEffectView.superview == nil) {
@@ -2205,11 +2205,11 @@
if ([self isInSudGame]) {return;}
NSString *baseFileName = @"/GiftSvga";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vggUrl.absoluteString];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
NSString *fileName = [[vggUrl.absoluteString componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
NSData *data=[NSData dataWithContentsOfFile:fullPath options:0 error:NULL];
[self.parser parseWithData:data cacheKey:@"" completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
self.luckyGiftEffectView.hidden = NO;
@@ -2284,11 +2284,11 @@
/// vap
- (void)playLuckyGiftEffectWithVapUrl:(NSString *)vapUrl {
NSString *baseFileName = @"/GiftMp4";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vapUrl];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
vapUrl = filePath;
NSString *fileName = [[vapUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
vapUrl = fullPath;
self.luckyVapGiftEffectView.hidden = NO;
if (self.luckyVapGiftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.luckyVapGiftEffectView];

View File

@@ -77,8 +77,10 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)requestTwelveStarFirst:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
/// 请求缓存列表
/// @param complection 完成
/// @param roomUid 房间的roomuid
+ (void)requestCacheGiftList:(HttpRequestHelperCompletion)complection;
/// 请求新礼物动效缓存列表
/// @param complection 完成
+(void)requestCacheGiftDynamicEffectList:(HttpRequestHelperCompletion)complection;
@end
NS_ASSUME_NONNULL_END

View File

@@ -32,6 +32,12 @@
NSString * fang = @"gift/vgg";
[self makeRequest:fang method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
}
///
/// @param complection
+(void)requestCacheGiftDynamicEffectList:(HttpRequestHelperCompletion)complection{
NSString * fang = @"resource/effect";
[self makeRequest:fang method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
}
///
/// @param complection
+ (void)requestLuckGiftServerBagRecord:(HttpRequestHelperCompletion)complection {

View File

@@ -190,10 +190,11 @@
if(meQuence != nil){
[self enterRoomUpMicWith:meQuence];
}
//
[self initGiftValue];
}];
//
[self initGiftValue];
}
///
-(void)enterRoomUpMicWith:(MicroQueueModel *)sequence{

View File

@@ -480,12 +480,12 @@
make.edges.mas_equalTo(self.forestImageView);
}];
NSString *baseFileName = @"/GiftMp4";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:animtionName];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
NSString *fileName = [[animtionName componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
[view setMute:YES];
[view playHWDMP4:filePath repeatCount:1 delegate:self];
[view playHWDMP4:fullPath repeatCount:1 delegate:self];
}else{
[self.vapParser parseWithURL:filePath completionBlock:^(NSString * _Nullable videoUrl) {

View File

@@ -284,12 +284,12 @@
make.edges.equalTo(self.trialsBgImageView);
}];
}
NSString *baseFileName = @"/GiftMp4";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:animtionName];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
NSString *fileName = [[animtionName componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
[self.trialsView setMute:YES];
[self.trialsView playHWDMP4:filePath repeatCount:1 delegate:self];
[self.trialsView playHWDMP4:fullPath repeatCount:1 delegate:self];
}else{
[self.vapParser parseWithURL:filePath completionBlock:^(NSString * _Nullable videoUrl) {

View File

@@ -96,7 +96,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol, NIMLoginManagerDelegate, NIMSystemNotificationManagerDelegate, NIMChatManagerDelegate,XPLoginAuthCodeVCDelegate, XPAnchorCardViewDelegate, NIMBroadcastManagerDelegate, XPRoomYearActivityViewDelegate>
{
NSTimer * timer;
NSTimer * timer;
}
///
@property (nonatomic,strong) UserInfoModel *userInfo;
@@ -336,38 +336,49 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
///
-(void)requestGiftList{
[self dealWithDefaultSvga];
///
NSString *time = [NSDate getNowTimeTimestamp];
NSString *curTime = [NSDate timestampSwitchTime:[time integerValue] andFormatter:@"yyyy-MM-dd"];
NSDictionary *timeDic = [[NSUserDefaults standardUserDefaults]valueForKey:@"kRequestGiftList"];
if(timeDic == nil){
NSMutableDictionary *curDic = [[NSMutableDictionary alloc]initWithDictionary:timeDic];
[curDic setValue:@(YES) forKey:curTime];
[[NSUserDefaults standardUserDefaults]setValue:curDic forKey:@"kRequestGiftList"];
[[NSUserDefaults standardUserDefaults]synchronize];
}else{
if(timeDic[curTime]!= nil)return;
NSMutableDictionary *curDic = [[NSMutableDictionary alloc]initWithDictionary:timeDic];
[curDic removeAllObjects];
[curDic setValue:@(YES) forKey:curTime];
[[NSUserDefaults standardUserDefaults]setValue:curDic forKey:@"kRequestGiftList"];
[[NSUserDefaults standardUserDefaults]synchronize];
}
///
// NSString *time = [NSDate getNowTimeTimestamp];
// NSString *curTime = [NSDate timestampSwitchTime:[time integerValue] andFormatter:@"yyyy-MM-dd"];
// NSDictionary *timeDic = [[NSUserDefaults standardUserDefaults]valueForKey:@"kRequestGiftList"];
// if(timeDic == nil){
// NSMutableDictionary *curDic = [[NSMutableDictionary alloc]initWithDictionary:timeDic];
// [curDic setValue:@(YES) forKey:curTime];
// [[NSUserDefaults standardUserDefaults]setValue:curDic forKey:@"kRequestGiftList"];
// [[NSUserDefaults standardUserDefaults]synchronize];
// }else{
// if(timeDic[curTime]!= nil)return;
// NSMutableDictionary *curDic = [[NSMutableDictionary alloc]initWithDictionary:timeDic];
// [curDic removeAllObjects];
// [curDic setValue:@(YES) forKey:curTime];
// [[NSUserDefaults standardUserDefaults]setValue:curDic forKey:@"kRequestGiftList"];
// [[NSUserDefaults standardUserDefaults]synchronize];
// }
[Api requestCacheGiftList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
NSArray *giftList = [GiftInfoModel modelsWithArray:data.data];
for (GiftInfoModel *giftModel in giftList) {
if(giftModel.vggUrl.length > 0){
[self dealWithGiftListWithUrl:giftModel.vggUrl fileName:giftModel.vggUrl isSvga:YES];
NSString *url = [giftModel.vggUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
[self dealWithGiftListWithUrl:url isSvga:YES];
}else if(giftModel.viewUrl.length > 0){
[self dealWithGiftListWithUrl:giftModel.viewUrl fileName:giftModel.viewUrl isSvga:NO];
NSString *url = [giftModel.viewUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
[self dealWithGiftListWithUrl:url isSvga:NO];
}
}
}
}];
[Api requestCacheGiftDynamicEffectList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
NSArray *list = data.data;
NSSet *setList = [[NSSet alloc]initWithArray:list];
for (NSString *url in setList) {
NSString *encodingUrl = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
[self cacheGiftDynamicEffectList:encodingUrl];
}
}
}];
}
@@ -376,70 +387,90 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
///
NSArray *elfList = @[@"https://image.hfighting.com/fenjie2.mp4",@"https://image.hfighting.com/treasure_fairy_ten.mp4",@"https://image.hfighting.com/hecheng3.mp4",@"https://image.hfighting.com/treasure_fairy_one.mp4"];
for (NSString *url in elfList) {
[self dealWithGiftListWithUrl:url fileName:url isSvga:NO];
NSString *encodingUrl = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
[self cacheGiftDynamicEffectList:encodingUrl];
[self dealWithGiftListWithUrl:encodingUrl isSvga:NO];
}
}
-(void)dealWithGiftListWithUrl:(NSString *)url fileName:(NSString *)fileName isSvga:(BOOL)isSvga {
NSString *baseFileName = isSvga ? @"/GiftSvga":@"/GiftMp4";
NSString *filePaths = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:fileName];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePaths])return;
[[[NSURLSession sharedSession] downloadTaskWithURL:[NSURL URLWithString:url] completionHandler:^(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if(!error){
[fileManager createDirectoryAtPath:[filePaths stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil];
NSData *data = [NSData dataWithContentsOfURL:location];
[data writeToFile:filePaths atomically:YES];
}
}] resume];
///
-(void)cacheGiftDynamicEffectList:(NSString *)url{
NSString *fileName = [[url componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
return;
}
NSFileManager *fileMgr = [[NSFileManager alloc] init];
[fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
[UploadFile downloadAudioWithFileName:fileName musicUrl:url mainFileName:@"GiftDynamicEffectList" completion:^(BOOL isSuccess, NSString *editAudioPath) {
if(isSuccess){
}else{
}
}];
}
-(void)dealWithGiftListWithUrl:(NSString *)url isSvga:(BOOL)isSvga {
///
NSString *baseFileName = isSvga ? @"/GiftSvga":@"/GiftMp4";
NSString *oldFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:oldFilePath]) {
BOOL isSuccess = [[NSFileManager defaultManager]removeItemAtPath:oldFilePath error:nil];
if(isSuccess == YES){
NSLog(@"删除成功");
}
}
}
- (void)checkInviteUserInfoSuccess:(InviteUserInfoModel *)inviteInfo {
if (inviteInfo && inviteInfo.isInRoom) {
[XPRoomViewController openRoom:inviteInfo.roomUid fromNick:inviteInfo.inviteNick fromType:inviteInfo.fromType fromUid:inviteInfo.inviteUid viewController:self];
} else { //
[self.presenter getShortCutRecommendRoom];
}
if (inviteInfo && inviteInfo.isInRoom) {
[XPRoomViewController openRoom:inviteInfo.roomUid fromNick:inviteInfo.inviteNick fromType:inviteInfo.fromType fromUid:inviteInfo.inviteUid viewController:self];
} else { //
[self.presenter getShortCutRecommendRoom];
}
}
- (void)getShortCutRecommendRoomSuccces:(NSString *)roomUid {
if (roomUid.length > 0) {
[XPRoomViewController openRoom:roomUid viewController:self];
}
if (roomUid.length > 0) {
[XPRoomViewController openRoom:roomUid viewController:self];
}
}
#pragma mark - app
- (void)clientStartApp {
// [self.presenter clientStartApp];
// [self.presenter clientStartApp];
}
#pragma mark -
- (void)networkReachability{
// @kWeakify(self);
// [[AFNetworkReachabilityManager sharedManager] startMonitoring];
// [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
// @kStrongify(self);
// switch (status) {
// case AFNetworkReachabilityStatusUnknown:
// self.isFirstReachability = YES;
// break;
// case AFNetworkReachabilityStatusNotReachable:
// self.isFirstReachability = YES;
// break;
// case AFNetworkReachabilityStatusReachableViaWWAN:
// case AFNetworkReachabilityStatusReachableViaWiFi:
// {
// if (self.isFirstReachability) {
// [[NSNotificationCenter defaultCenter] postNotificationName:kNetworkReachabilityKey object:nil userInfo:nil];
// [self.presenter autoLogin];
// [[ClientConfig shareConfig] clientInit];
// }
// self.isFirstReachability = YES;
// }
// break;
// default:
// break;
// }
// }];
// @kWeakify(self);
// [[AFNetworkReachabilityManager sharedManager] startMonitoring];
// [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
// @kStrongify(self);
// switch (status) {
// case AFNetworkReachabilityStatusUnknown:
// self.isFirstReachability = YES;
// break;
// case AFNetworkReachabilityStatusNotReachable:
// self.isFirstReachability = YES;
// break;
// case AFNetworkReachabilityStatusReachableViaWWAN:
// case AFNetworkReachabilityStatusReachableViaWiFi:
// {
// if (self.isFirstReachability) {
// [[NSNotificationCenter defaultCenter] postNotificationName:kNetworkReachabilityKey object:nil userInfo:nil];
// [self.presenter autoLogin];
// [[ClientConfig shareConfig] clientInit];
// }
// self.isFirstReachability = YES;
// }
// break;
// default:
// break;
// }
// }];
}
#pragma mark - BaseMvpProtocol
@@ -448,7 +479,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:lvc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
kWindow.rootViewController = nav;
XPAdImageTool.shareImageTool.isImLogin = NO;
XPAdImageTool.shareImageTool.isImLogin = NO;
}
- (void)completeUserInfo {
@@ -481,12 +512,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
///
- (void)getVersionUpdate:(XPVersionUpdateModel *)versionModel {
XPUpgradeView *view = [[XPUpgradeView alloc] init];
view.versionModel = versionModel;
TTPopupService * service = [[TTPopupService alloc] init];
service.contentView = view;
service.shouldDismissOnBackgroundTouch = NO;
[TTPopup popupWithConfig:service];
XPUpgradeView *view = [[XPUpgradeView alloc] init];
view.versionModel = versionModel;
TTPopupService * service = [[TTPopupService alloc] init];
service.contentView = view;
service.shouldDismissOnBackgroundTouch = NO;
[TTPopup popupWithConfig:service];
}
#pragma mark - NIMLoginManagerDelegate
@@ -507,47 +538,47 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
}
- (void)onKickout:(NIMLoginKickoutResult *)result {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"TabbarViewController0")];
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
if ([rootViewController presentedViewController]) { //present dismiss
[[rootViewController presentedViewController] dismissViewControllerAnimated:YES completion:^{
if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
[[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
}
if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
if (tabVC.selectedViewController.navigationController) {
[tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabVC setSelectedIndex:0];
});
}
}];
}else { //present rootvcpush navvc pop
if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
[[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
}
if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
if (tabVC.selectedViewController) {
if ([tabVC.selectedViewController isKindOfClass:[UINavigationController class]]) {
[tabVC.selectedViewController popToRootViewControllerAnimated:YES];
} else {
[tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabVC setSelectedIndex:0];
});
}
}
}
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"TabbarViewController0")];
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
if ([rootViewController presentedViewController]) { //present dismiss
[[rootViewController presentedViewController] dismissViewControllerAnimated:YES completion:^{
if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
[[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
}
if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
if (tabVC.selectedViewController.navigationController) {
[tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabVC setSelectedIndex:0];
});
}
}];
}else { //present rootvcpush navvc pop
if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
[[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
}
if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
if (tabVC.selectedViewController) {
if ([tabVC.selectedViewController isKindOfClass:[UINavigationController class]]) {
[tabVC.selectedViewController popToRootViewControllerAnimated:YES];
} else {
[tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabVC setSelectedIndex:0];
});
}
}
}
if ([XPRoomMiniManager shareManager].getRoomInfo) {
[[RtcManager instance] exitRoom];
[[NIMSDK sharedSDK].chatroomManager exitChatroom:[NSString stringWithFormat:@"%ld", [XPRoomMiniManager shareManager].getRoomInfo.roomId] completion:nil];
[self.roomMineView hiddenRoomMiniView];
}
if ([XPRoomMiniManager shareManager].getRoomInfo) {
[[RtcManager instance] exitRoom];
[[NIMSDK sharedSDK].chatroomManager exitChatroom:[NSString stringWithFormat:@"%ld", [XPRoomMiniManager shareManager].getRoomInfo.roomId] completion:nil];
[self.roomMineView hiddenRoomMiniView];
}
[self.presenter logout];
}
@@ -557,55 +588,55 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
if (![ClientConfig shareConfig].canOpen || [AccountInfoStorage instance].getTicket.length == 0) {
return;
}
for (NIMMessage * message in messages) {
if (message.session.sessionType == NIMSessionTypeP2P) {
if(message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel * attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_FindNew && attachment.second == Custom_Message_Find_New_Greet_New_User) {
FindNewGreetMessageModel * greetInfo = [FindNewGreetMessageModel modelWithDictionary:attachment.data];
if (greetInfo.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue) {
[TTPopup dismiss];
XPSessionFindNewAlertView * alertView = [[XPSessionFindNewAlertView alloc] init];
alertView.userInfo = greetInfo;
TTPopupService *service = [[TTPopupService alloc] init];
service.contentView = alertView;
service.shouldDismissOnBackgroundTouch = NO;
service.style = TTPopupStyleAlert;
[TTPopup popupWithConfig:service];
}
for (NIMMessage * message in messages) {
if (message.session.sessionType == NIMSessionTypeP2P) {
if(message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel * attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_FindNew && attachment.second == Custom_Message_Find_New_Greet_New_User) {
FindNewGreetMessageModel * greetInfo = [FindNewGreetMessageModel modelWithDictionary:attachment.data];
if (greetInfo.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue) {
[TTPopup dismiss];
XPSessionFindNewAlertView * alertView = [[XPSessionFindNewAlertView alloc] init];
alertView.userInfo = greetInfo;
TTPopupService *service = [[TTPopupService alloc] init];
service.contentView = alertView;
service.shouldDismissOnBackgroundTouch = NO;
service.style = TTPopupStyleAlert;
[TTPopup popupWithConfig:service];
}
}
}
}
}
}
}
}
}
}
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage {
if (![ClientConfig shareConfig].canOpen || [AccountInfoStorage instance].getUid.length == 0) {
return;
}
if (broadcastMessage.content) {
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
if (![ClientConfig shareConfig].canOpen || [AccountInfoStorage instance].getUid.length == 0) {
return;
}
if (broadcastMessage.content) {
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
NSString *partitionId = [NSString stringWithFormat:@"%@",attachment.data[@"partitionId"]];
if(![partitionId isEqualToString:self.userInfo.partitionId]){
return;
}
if (attachment.first == CustomMessageType_RedPacket) {
if (attachment.first == CustomMessageType_RedPacket) {
[self receiveRedPacketDealWithData:attachment];
} else if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_ChannelNotify){///广
[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"] && [AccountInfoStorage instance].getUid.length > 0){
XPVersionUpdateModel *updateModel = [XPVersionUpdateModel modelWithDictionary:attachment.data];
[self getVersionUpdate:updateModel];
}
} else if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_ChannelNotify){///广
[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"] && [AccountInfoStorage instance].getUid.length > 0){
XPVersionUpdateModel *updateModel = [XPVersionUpdateModel modelWithDictionary:attachment.data];
[self getVersionUpdate:updateModel];
}
}else if(attachment.first == CustomMessageType_LuckyBag && attachment.second == Custom_Message_Sub_Room_Gift_LuckBag_FullScree){
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
@@ -632,14 +663,14 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
[self.roomAnimation receiveAnchorHourRank:attachment];
}else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Noble_LevelUp_Suspend) {///VIP
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
[self.roomAnimation receiveNobleLevelUp:attachment];
}else if (attachment.first == CustomMessageType_General_Floating_Screen && attachment.second == Custom_Message_Sub_General_Floating_Screen_All_Room){
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
[self.roomAnimation receiveRoomGeneralFloatingScreen:attachment];
}
}
}
}
///
-(void)receiveRedPacketDealWithData:(AttachmentModel *)attachment{
@@ -686,15 +717,15 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
* @discusssion
*/
- (void)onRecvRevokeMessageNotification:(NIMRevokeMessageNotification *)notification {
NIMMessage * message = notification.message;
if (message) {
NIMMessage * revokeMessage = [[NIMMessage alloc] init];
[revokeMessage setValue:message.session forKey:@"session"];
[revokeMessage setValue:@(NIMMessageTypeTip) forKey:@"messageType"];
revokeMessage.timestamp = [PLTimeUtil getNowTimeTimestampMillisecond].longLongValue;
revokeMessage.text = YMLocalizedString(@"TabbarViewController1");
[[NIMSDK sharedSDK].conversationManager saveMessage:revokeMessage forSession:message.session completion:nil];
}
NIMMessage * message = notification.message;
if (message) {
NIMMessage * revokeMessage = [[NIMMessage alloc] init];
[revokeMessage setValue:message.session forKey:@"session"];
[revokeMessage setValue:@(NIMMessageTypeTip) forKey:@"messageType"];
revokeMessage.timestamp = [PLTimeUtil getNowTimeTimestampMillisecond].longLongValue;
revokeMessage.text = YMLocalizedString(@"TabbarViewController1");
[[NIMSDK sharedSDK].conversationManager saveMessage:revokeMessage forSession:message.session completion:nil];
}
}
- (void)configTheme {
@@ -707,16 +738,16 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
}
- (void)initTabs:(BOOL)logined {
self.viewControllers = nil;
NSArray *normalImageNames = @[@"tab_gameHome_normal",@"tab_monents_normal",@"tab_message_normal", @"tab_mine_normal"];
NSArray *selectImageNames = @[@"tab_gameHome_selected",@"tab_monents_select",@"tab_message_selected", @"tab_mine_selected"];
NSArray *tabLabel = @[YMLocalizedString(@"TabbarViewController2"),YMLocalizedString(@"TabbarViewController3"),YMLocalizedString(@"TabbarViewController4"), YMLocalizedString(@"TabbarViewController5")];
self.viewControllers = nil;
NSArray *normalImageNames = @[@"tab_gameHome_normal",@"tab_monents_normal",@"tab_message_normal", @"tab_mine_normal"];
NSArray *selectImageNames = @[@"tab_gameHome_selected",@"tab_monents_select",@"tab_message_selected", @"tab_mine_selected"];
NSArray *tabLabel = @[YMLocalizedString(@"TabbarViewController2"),YMLocalizedString(@"TabbarViewController3"),YMLocalizedString(@"TabbarViewController4"), YMLocalizedString(@"TabbarViewController5")];
UIViewController *game;
UIViewController *msg;
UIViewController *me;
UIViewController * home;
UIViewController * monents;
UIViewController * home;
UIViewController * monents;
///ipXPNewHomeViewController
[[NSNotificationCenter defaultCenter]postNotificationName:@"kInLoginVC" object:nil];
if (logined) {
@@ -736,12 +767,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
game = [[XPBlankViewController alloc]init];
msg = [[XPSessionMainViewController alloc]init];
me = [[XPBlankViewController alloc]init];
home = [[XPBlankViewController alloc] init];
monents = [[XPBlankViewController alloc] init];
home = [[XPBlankViewController alloc] init];
monents = [[XPBlankViewController alloc] init];
}
[self createTabBarItem:home title:tabLabel[0] image:normalImageNames[0] selectedImage:selectImageNames[0]];
[self createTabBarItem:monents title:tabLabel[1] image:normalImageNames[1] selectedImage:selectImageNames[1]];
[self createTabBarItem:msg title:tabLabel[2] image:normalImageNames[2] selectedImage:selectImageNames[2]];
[self createTabBarItem:home title:tabLabel[0] image:normalImageNames[0] selectedImage:selectImageNames[0]];
[self createTabBarItem:monents title:tabLabel[1] image:normalImageNames[1] selectedImage:selectImageNames[1]];
[self createTabBarItem:msg title:tabLabel[2] image:normalImageNames[2] selectedImage:selectImageNames[2]];
[self createTabBarItem:me title:tabLabel[3] image:normalImageNames[3] selectedImage:selectImageNames[3]];
self.viewControllers = @[home,monents,msg,me];
self.selectedIndex = 0;
@@ -775,18 +806,18 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
#pragma mark -
- (void)monentsUnReadCount {
[Api monentsUnReadCount:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
MonentsUnReadModel * model = [MonentsUnReadModel modelWithDictionary:data.data];
NSString *badge = model.total > 0 ? @(model.total).stringValue : nil;
if (model.total > 99) {
badge = @"99+";
}
NSUInteger index = 1;
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
[item setBadgeValue:badge];
}
} uid:[AccountInfoStorage instance].getUid];
[Api monentsUnReadCount:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
MonentsUnReadModel * model = [MonentsUnReadModel modelWithDictionary:data.data];
NSString *badge = model.total > 0 ? @(model.total).stringValue : nil;
if (model.total > 99) {
badge = @"99+";
}
NSUInteger index = 1;
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
[item setBadgeValue:badge];
}
} uid:[AccountInfoStorage instance].getUid];
NSArray *recentList = [[NIMSDK sharedSDK].conversationManager.allRecentSessions mutableCopy];
__block NSInteger unreadCount = 0;
NSMutableArray<NSString *> * uids = [[NSMutableArray alloc] init];
@@ -794,34 +825,34 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[uids addObject:obj.session.sessionId];
unreadCount += obj.unreadCount;
}];
if(unreadCount > 0){
NSUInteger index = 2;
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
[item setBadgeValue:[NSString stringWithFormat:@"%ld",unreadCount]];
}
if(unreadCount > 0){
NSUInteger index = 2;
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
[item setBadgeValue:[NSString stringWithFormat:@"%ld",unreadCount]];
}
}
#pragma mark -
- (void)configRoomMiniNView:(NSDictionary *)dic {
UserInfoModel * userInfo = [UserInfoModel modelWithDictionary:dic[@"userInfo"]];
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:dic[@"roomInfo"]];
NSMutableDictionary * microQueue = dic[@"microQueue"];
[self.roomMineView configRoomMiniView:roomInfo userInfo:userInfo micQueue:microQueue];
UserInfoModel * userInfo = [UserInfoModel modelWithDictionary:dic[@"userInfo"]];
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:dic[@"roomInfo"]];
NSMutableDictionary * microQueue = dic[@"microQueue"];
[self.roomMineView configRoomMiniView:roomInfo userInfo:userInfo micQueue:microQueue];
}
#pragma mark -
- (void)initQuickEnterRoom {
NSString * key = [NSString stringWithFormat:@"%@_%@", kUserFirstLoginKey, [AccountInfoStorage instance].getUid];
BOOL isNotFirstLogin = [[NSUserDefaults standardUserDefaults] boolForKey:key];
if (!isNotFirstLogin) {
///
// [self.presenter getNewUserGreetInfo];
}
NSString * key = [NSString stringWithFormat:@"%@_%@", kUserFirstLoginKey, [AccountInfoStorage instance].getUid];
BOOL isNotFirstLogin = [[NSUserDefaults standardUserDefaults] boolForKey:key];
if (!isNotFirstLogin) {
///
// [self.presenter getNewUserGreetInfo];
}
}
/// linkedMe
- (void)completeUserInfoFinish:(NSString *)inviteCode {
self.inviteCode = inviteCode;
self.inviteCode = inviteCode;
}
#pragma mark -NIMSystemNotificationManagerDelegate
- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification {
@@ -960,98 +991,98 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
}
- (void)handleAnchorCardSwipeFrom:(UISwipeGestureRecognizer *)recognizer{
if(recognizer.direction == UISwipeGestureRecognizerDirectionUp) {
[UIView animateWithDuration:0.5 animations:^{
self.anchorCardView.frame = CGRectMake(0, -90-kStatusBarHeight, KScreenWidth, 90);
} completion:^(BOOL finished) {
[self.anchorCardView removeFromSuperview];
self.anchorCardView = nil;
self.needShowAnchorCard = NO;
}];
}
if(recognizer.direction == UISwipeGestureRecognizerDirectionUp) {
[UIView animateWithDuration:0.5 animations:^{
self.anchorCardView.frame = CGRectMake(0, -90-kStatusBarHeight, KScreenWidth, 90);
} completion:^(BOOL finished) {
[self.anchorCardView removeFromSuperview];
self.anchorCardView = nil;
self.needShowAnchorCard = NO;
}];
}
}
#pragma mark -
- (void)receiveBroadcastGift:(AttachmentModel *)attachment {
GiftReceiveInfoModel *giftNotifyInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
if (!giftNotifyInfo.ceremonyGift && giftNotifyInfo.isHomeShow == YES) {
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
if (!giftNotifyInfo.ceremonyGift && giftNotifyInfo.isHomeShow == YES) {
if([XPSkillCardPlayerManager shareInstance].isInRoomVC == YES)return;
[self.roomAnimation receiveGift:giftNotifyInfo];
return;
}
return;
}
if(giftNotifyInfo.isHomeShow == NO)return;
if (self.giftBroadcastQueue.count == 0) {
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
}
[self.giftBroadcastQueue addObject:giftNotifyInfo];
if (self.giftBroadcastQueue.count == 0) {
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
}
[self.giftBroadcastQueue addObject:giftNotifyInfo];
}
- (void)createGiftBroadcastViewAnimation:(GiftReceiveInfoModel *)giftModel {
XPRoomYearActivityView * view = [[XPRoomYearActivityView alloc] init];
view.delegate = self;
view.frame = CGRectMake(KScreenWidth, 35 + statusbarHeight, KScreenWidth, 150);
view.model = giftModel;
[[XCCurrentVCStackManager shareManager].getCurrentVC.view addSubview:view];
[self beginGiftBraodcastViewAnimation:view notifyStaySecond:giftModel.notifyStaySecond];
XPRoomYearActivityView * view = [[XPRoomYearActivityView alloc] init];
view.delegate = self;
view.frame = CGRectMake(KScreenWidth, 35 + statusbarHeight, KScreenWidth, 150);
view.model = giftModel;
[[XCCurrentVCStackManager shareManager].getCurrentVC.view addSubview:view];
[self beginGiftBraodcastViewAnimation:view notifyStaySecond:giftModel.notifyStaySecond];
}
- (void)beginGiftBraodcastViewAnimation:(XPRoomYearActivityView *)view notifyStaySecond:(int)notifyStaySecond{
CGFloat startTime = notifyStaySecond > 0 ? notifyStaySecond : 3.0;
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(0 + view.frame.size.width / 2, view.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
[self removeGiftBroadcastOutAnimation:view stayTime:startTime];
}
}];
[view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
CGFloat startTime = notifyStaySecond > 0 ? notifyStaySecond : 3.0;
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(0 + view.frame.size.width / 2, view.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
[self removeGiftBroadcastOutAnimation:view stayTime:startTime];
}
}];
[view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
}
- (void)removeGiftBroadcastOutAnimation:(XPRoomYearActivityView *)view stayTime:(CGFloat)stayTime{
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, view.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + stayTime;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[view removeFromSuperview];
if (self.giftBroadcastQueue.count > 0) {
[self.giftBroadcastQueue removeObjectAtIndex:0];
}
if (self.giftBroadcastQueue.count > 0) {
[self createGiftBroadcastViewAnimation:self.giftBroadcastQueue.firstObject];
}
}
}];
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, view.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + stayTime;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[view removeFromSuperview];
if (self.giftBroadcastQueue.count > 0) {
[self.giftBroadcastQueue removeObjectAtIndex:0];
}
if (self.giftBroadcastQueue.count > 0) {
[self createGiftBroadcastViewAnimation:self.giftBroadcastQueue.firstObject];
}
}
}];
[view pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
[view pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
#pragma mark - XPRoomGiftBroadcastViewDelegate
- (void)xPRoomYearActivityViewEnterRoom:(NSString *)roomUid{
if (roomUid.length > 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
if (roomUid.length > 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
}
#pragma mark - Getters And Setters
- (XPMiniRoomView *)roomMineView {
if (!_roomMineView) {
_roomMineView = [[XPMiniRoomView alloc] init];
_roomMineView.controller = self;
_roomMineView.hidden = YES;
}
return _roomMineView;
if (!_roomMineView) {
_roomMineView = [[XPMiniRoomView alloc] init];
_roomMineView.controller = self;
_roomMineView.hidden = YES;
}
return _roomMineView;
}
- (XPAnchorCardView *)anchorCardView {
@@ -1071,10 +1102,10 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
}
- (NSMutableArray<GiftReceiveInfoModel *> *)giftBroadcastQueue {
if (!_giftBroadcastQueue) {
_giftBroadcastQueue = [NSMutableArray array];
}
return _giftBroadcastQueue;
if (!_giftBroadcastQueue) {
_giftBroadcastQueue = [NSMutableArray array];
}
return _giftBroadcastQueue;
}
- (PIFullScreenBannerAnimation *)roomAnimation{
if(!_roomAnimation){

View File

@@ -260,7 +260,8 @@ static UploadFile* manager;
}
+(void)downloadAudioWithFileName:(NSString *)fileName musicUrl:(NSString *)musicUrl mainFileName:(NSString *)mainFileName completion:(void (^) (BOOL isSuccess, NSString *editAudioPath))completion {
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:musicUrl]];
NSURL *url = [NSURL URLWithString:[musicUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]];
NSURLRequest *request = [NSURLRequest requestWithURL :url];
NSURLSessionDownloadTask *download = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:mainFileName] stringByAppendingPathComponent:fileName];

View File

@@ -164,8 +164,8 @@
"PKIDLoginViewController2" = "Please contact customer service";
"PKIDLoginViewController3" = "LINEpekoyuyin";
"PKIDLoginViewController4" = "I understand";
"MessageLevelUpgradeModel0" = "Congratulations! Your charm level has reached Lv%@";
"MessageLevelUpgradeModel1" = "Congratulations! Your level has reached Lv%@";
"MessageLevelUpgradeModel0" = "Congratulations! Your charm level has reached %@";
"MessageLevelUpgradeModel1" = "Congratulations! Your level has reached %@";
"MessageTextModel0" = "Unknown message type";

View File

@@ -1962,8 +1962,8 @@
"PKIDLoginViewController2" = "请联繫客服处理";
"PKIDLoginViewController3" = "LINEpekoyuyin";
"PKIDLoginViewController4" = "我知道了";
"MessageLevelUpgradeModel0" = "恭喜!您的魅力等级已到达Lv%@";
"MessageLevelUpgradeModel1" = "恭喜!您的等级已到达Lv%@";
"MessageLevelUpgradeModel0" = "恭喜!您的魅力等级已到达%@";
"MessageLevelUpgradeModel1" = "恭喜!您的等级已到达%@";
"MessageTextModel0" = "未知消息类型";

View File

@@ -1957,8 +1957,8 @@
"PKIDLoginViewController2" = "請聯繫客服處理";
"PKIDLoginViewController3" = "LINEpekoyuyin";
"PKIDLoginViewController4" = "我知道了";
"MessageLevelUpgradeModel0" = "恭喜!您的魅力等級已到達Lv%@";
"MessageLevelUpgradeModel1" = "恭喜!您的等級已到達Lv%@";
"MessageLevelUpgradeModel0" = "恭喜!您的魅力等級已到達%@";
"MessageLevelUpgradeModel1" = "恭喜!您的等級已到達%@";
"MessageTextModel0" = "未知消息類型";