@@ -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 ;
@@ -138,7 +138,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
}
- ( void ) viewDidLoad {
[ super viewDidLoad ] ;
[ self . presenter autoLogin ] ;
[ self configTheme ] ;
@@ -151,7 +151,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[ [ NIMSDK sharedSDK ] . chatManager addDelegate : self ] ;
[ [ NIMSDK sharedSDK ] . systemNotificationManager addDelegate : self ] ;
[ [ NIMSDK sharedSDK ] . broadcastManager addDelegate : self ] ;
[ self networkReachability ] ;
[ self . view addSubview : self . roomMineView ] ;
@ kWeakify ( self ) ;
@@ -159,8 +159,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
@ kStrongify ( self ) ;
[ self configRoomMiniNView : note . userInfo ] ;
} ] ;
[ [ NSNotificationCenter defaultCenter ] addObserverForName : @ "reloadnewtab" object : nil queue : nil usingBlock : ^ ( NSNotification * _Nonnull note ) {
@ kStrongify ( self ) ;
if ( self . isInitReload = = NO ) {
@@ -171,12 +171,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[ [ 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 ( switchLanguage : ) name : @ "kSwitchLanguage" object : nil ] ;
}
- ( void ) switchLanguage : ( NSNotification * ) not {
[ self initTabs : YES ] ;
@@ -288,10 +288,10 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
self . inviteCode = nil ;
}
[ self monentsUnReadCount ] ;
}
}
- ( void ) loginIng {
if ( ( self . userInfo . nick = = nil || self . userInfo . avatar = = nil ) && self . isFormLogin = = NO ) {
@@ -310,7 +310,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
self . inviteCode = nil ;
}
[ self monentsUnReadCount ] ;
}
}
- ( void ) getAuthorizationCodeInfoWithPhonefail {
@@ -336,39 +336,50 @@ 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 ] ;
}
}
} ] ;
}
- ( void ) dealWithDefaultSvga {
@@ -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 ] ;
// / 缓 存 新 的 礼 物 动 效 数 据
- ( 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 {
}
} ] resume ] ;
} ] ;
}
- ( 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 出 来 的 就 有 可 能 是 rootvc 或 者 是 被 push 出 来 的 所 以 要 判 断 nav 是 不 是 只 有 一 个 vc 如 果 有 多 个 就 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 ] ;
}
[ 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 出 来 的 就 有 可 能 是 rootvc 或 者 是 被 push 出 来 的 所 以 要 判 断 nav 是 不 是 只 有 一 个 vc 如 果 有 多 个 就 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 ] ;
}
[ self . presenter logout ] ;
}
@@ -557,57 +588,57 @@ 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 ;
[ self . roomAnimation receiveLuckyGiftBigPrize : attachment ] ;
} else if ( attachment . first = = CustomMessageType_Graffiti _Star _Kitchen && attachment . second = = Custom_Message _Sub _Star _Kitchen _FullScreen ) {
@@ -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 {
@@ -651,7 +682,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
// 判 断 是 否 在 房 间
__block BOOL isInRoom ;
[ [ XCCurrentVCStackManager shareManager ] . getCurrentVC . navigationController . viewControllers enumerateObjectsUsingBlock : ^ ( __kindof UIViewController * _Nonnull obj , NSUInteger idx , BOOL * _Nonnull stop ) {
if ( [ obj isKindOfClass : [ XPRoomViewController class ] ] ) {
* stop = YES ;
@@ -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,23 +738,23 @@ 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 ;
// / 取 消 检 查 ip 定 时 器 , 释 放 XPNewHomeViewController
[ [ NSNotificationCenter defaultCenter ] postNotificationName : @ "kInLoginVC" object : nil ] ;
if ( logined ) {
msg = [ [ XPSessionMainViewController alloc ] init ] ;
if ( [ ClientConfig shareConfig ] . canOpen ) {
home = [ [ XPNewHomeViewController alloc ] init ] ;
monents = [ [ XPMonentsViewController alloc ] init ] ;
me = [ [ XPMineViewController alloc ] init ] ;
@@ -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 ] ;
}
}
} ] ;
[ view pop_addAnimation : moveAnimation forKey : @ "moveOutAnimation" ] ;
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" ] ;
}
# 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 ) {