|
@@ -298,42 +298,55 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
|
|
|
if ([GlobalData shareInstance].isSearchToLoad) {
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:user_info];
|
|
|
}else {
|
|
|
- [self waitingToBeClickNoti:user_info withIndex:@"0" isLinke:@"0"];
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"0" isOpenLinke:NO];
|
|
|
}
|
|
|
}else if ([menuname isEqualToString:@"subscribe"]) {
|
|
|
- [GlobalData shareInstance].isClickNotiStatus = YES;
|
|
|
- tab.selectedIndex = 1;//切换底部栏
|
|
|
- if ([GlobalData shareInstance].isSubToLoad) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:user_info];
|
|
|
+ if ([LXUserDefaults isExistToken]) {
|
|
|
+ [GlobalData shareInstance].isClickNotiStatus = YES;
|
|
|
+ tab.selectedIndex = 1;//切换底部栏
|
|
|
+ if ([GlobalData shareInstance].isSubToLoad) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:user_info];
|
|
|
+ }else {
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"1" isOpenLinke:NO];
|
|
|
+ }
|
|
|
}else {
|
|
|
- [self waitingToBeClickNoti:user_info withIndex:@"1" isLinke:@"0"];
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"1" isOpenLinke:NO];
|
|
|
}
|
|
|
}else if ([menuname isEqualToString:@"box"]) {
|
|
|
- [GlobalData shareInstance].isClickNotiStatus = YES;
|
|
|
- tab.selectedIndex = 2;//切换底部栏
|
|
|
- if ([GlobalData shareInstance].isBoxToLoad) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:user_info];
|
|
|
+ if ([LXUserDefaults isExistToken]) {
|
|
|
+ [GlobalData shareInstance].isClickNotiStatus = YES;
|
|
|
+ tab.selectedIndex = 2;//切换底部栏
|
|
|
+ if ([GlobalData shareInstance].isBoxToLoad) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:user_info];
|
|
|
+ }else {
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"2" isOpenLinke:NO];
|
|
|
+ }
|
|
|
}else {
|
|
|
- [self waitingToBeClickNoti:user_info withIndex:@"2" isLinke:@"0"];
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"2" isOpenLinke:NO];
|
|
|
}
|
|
|
}else if ([menuname isEqualToString:@"me"]) {
|
|
|
- [GlobalData shareInstance].isClickNotiStatus = YES;
|
|
|
- tab.selectedIndex = 3;//切换底部栏
|
|
|
- if ([GlobalData shareInstance].isMineToLoad) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:user_info];
|
|
|
+ if ([LXUserDefaults isExistToken]) {
|
|
|
+ [GlobalData shareInstance].isClickNotiStatus = YES;
|
|
|
+ tab.selectedIndex = 3;//切换底部栏
|
|
|
+ if ([GlobalData shareInstance].isMineToLoad) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:user_info];
|
|
|
+ }else {
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"3" isOpenLinke:NO];
|
|
|
+ }
|
|
|
}else {
|
|
|
- [self waitingToBeClickNoti:user_info withIndex:@"3" isLinke:@"0"];
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"3" isOpenLinke:NO];
|
|
|
}
|
|
|
+
|
|
|
}else if ([menuname isEqualToString:@"other"]) {
|
|
|
//打开外链
|
|
|
if ([GlobalData shareInstance].isWakeUpStatus) {
|
|
|
- [self waitingToBeClickNoti:user_info withIndex:@"0" isLinke:@"1"];
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"0" isOpenLinke:YES];
|
|
|
}else {
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
|
|
|
}
|
|
|
}else {
|
|
|
if ([GlobalData shareInstance].isWakeUpStatus) {
|
|
|
- [self waitingToBeClickNoti:user_info withIndex:@"0" isLinke:@"0"];
|
|
|
+ [self waitingToBeClickNoti:user_info withIndex:@"0" isOpenLinke:NO];
|
|
|
}else {
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
|
|
|
}
|
|
@@ -369,12 +382,13 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
|
|
|
[GlobalData shareInstance].isWakeUpStatus = NO;
|
|
|
}
|
|
|
|
|
|
--(void)waitingToBeClickNoti:(NSDictionary *)userInfo withIndex:(NSString *)index isLinke:(NSString *)links{
|
|
|
+-(void)waitingToBeClickNoti:(NSDictionary *)userInfo withIndex:(NSString *)index isOpenLinke:(BOOL)isLinks {
|
|
|
NSLog(@"点击通知-延迟监听处理");
|
|
|
+ NSString *linksStr = isLinks?@"0":@"1";
|
|
|
NSDictionary *dict = @{
|
|
|
@"userInfo":userInfo,
|
|
|
@"index":index,
|
|
|
- @"links":links,
|
|
|
+ @"links":linksStr,
|
|
|
};
|
|
|
self.timerClick = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerClickMethod:) userInfo:dict repeats:YES];
|
|
|
[self.timerClick fire];
|
|
@@ -384,37 +398,47 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
|
|
|
self.timerIndex++;
|
|
|
NSDictionary *infoDict = [timer userInfo];
|
|
|
NSInteger index = [infoDict[@"index"] integerValue];
|
|
|
- NSInteger links = [infoDict[@"index"] integerValue];
|
|
|
+ BOOL isLinks = [infoDict[@"links"] integerValue]==0?NO:YES;
|
|
|
NSDictionary *userInfo = infoDict[@"userInfo"];
|
|
|
-// NSLog(@"执行一次:%@~%ld",userInfo,(long)index);
|
|
|
- if (index==0) {
|
|
|
- if ([GlobalData shareInstance].isSearchToLoad) {
|
|
|
- if (links==1) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:userInfo];
|
|
|
- }else {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:userInfo];
|
|
|
+
|
|
|
+ if ([LXUserDefaults isExistToken]) {//登录正常状态
|
|
|
+ if (index==0) {
|
|
|
+ if ([GlobalData shareInstance].isSearchToLoad) {
|
|
|
+ if (isLinks) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:userInfo];
|
|
|
+ }else {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:userInfo];
|
|
|
+ }
|
|
|
+ [self clearTimer];
|
|
|
}
|
|
|
- [self clearTimer];
|
|
|
- }
|
|
|
- }else if (index==1) {
|
|
|
- if ([GlobalData shareInstance].isSubToLoad) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:userInfo];
|
|
|
- [self clearTimer];
|
|
|
- }
|
|
|
- }else if (index==2) {
|
|
|
- if ([GlobalData shareInstance].isBoxToLoad) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:userInfo];
|
|
|
- [self clearTimer];
|
|
|
+ }else if (index==1) {
|
|
|
+ if ([GlobalData shareInstance].isSubToLoad) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:userInfo];
|
|
|
+ [self clearTimer];
|
|
|
+ }
|
|
|
+ }else if (index==2) {
|
|
|
+ if ([GlobalData shareInstance].isBoxToLoad) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:userInfo];
|
|
|
+ [self clearTimer];
|
|
|
+ }
|
|
|
+ }else if (index==3) {
|
|
|
+ if ([GlobalData shareInstance].isMineToLoad) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:userInfo];
|
|
|
+ [self clearTimer];
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+
|
|
|
}
|
|
|
- }else if (index==3) {
|
|
|
- if ([GlobalData shareInstance].isMineToLoad) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:userInfo];
|
|
|
+ }else { //未登录异常状态
|
|
|
+ if ([GlobalData shareInstance].isSearchToLoad) {
|
|
|
+ NSLog(@"未登录状态-等待:%@",infoDict[@"index"]);
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:LoginIndexTabBar object:nil userInfo:@{@"item_index":infoDict[@"index"]}];
|
|
|
[self clearTimer];
|
|
|
}
|
|
|
- }else {
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
if (self.timerIndex>10) {
|
|
|
[self clearTimer];
|
|
|
}
|