|
|
@@ -381,32 +381,54 @@
|
|
|
|
|
|
|
|
|
UIApplication *application = [UIApplication sharedApplication];
|
|
|
- UINavigationController *rootVC = (UINavigationController *)application.keyWindow.rootViewController;
|
|
|
-
|
|
|
+
|
|
|
// 超时登出,登出中停止心跳
|
|
|
[weakself Logout];
|
|
|
+
|
|
|
+ if (![weakself.window isEqual:application.keyWindow]) {
|
|
|
+ UIWindow *window = application.keyWindow;
|
|
|
+ [window resignKeyWindow];
|
|
|
+ if (window.superview) {
|
|
|
+ [window removeFromSuperview];
|
|
|
+ }
|
|
|
+ window.hidden = YES;
|
|
|
+ window = nil;
|
|
|
+
|
|
|
+ [self.window makeKeyWindow];
|
|
|
+ }
|
|
|
+
|
|
|
+ UINavigationController *rootVC = (UINavigationController *)application.keyWindow.rootViewController;
|
|
|
// 提示登录
|
|
|
UIViewController* presentVC=rootVC.presentedViewController;
|
|
|
if (presentVC) { //如果当前已有模态对话框,则关闭当前的模态框
|
|
|
[presentVC dismissViewControllerAnimated:NO completion:^{
|
|
|
// 退回到初始视图
|
|
|
- [rootVC popToRootViewControllerAnimated:NO];
|
|
|
- RootViewController* topvc= (RootViewController*)rootVC.topViewController;
|
|
|
- [topvc dealWithUILogout];
|
|
|
- dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 0.25 * NSEC_PER_SEC);
|
|
|
- dispatch_after(time, dispatch_get_main_queue(), ^{
|
|
|
- [topvc presentLogin:topvc.ibSignin];
|
|
|
- });
|
|
|
+// [rootVC popToRootViewControllerAnimated:NO];
|
|
|
+// RootViewController* topvc= (RootViewController*)rootVC.topViewController;
|
|
|
+// [topvc dealWithUILogout];
|
|
|
+// // viewDidAppear会自动Present
|
|
|
+//// dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 0.25 * NSEC_PER_SEC);
|
|
|
+//// dispatch_after(time, dispatch_get_main_queue(), ^{
|
|
|
+//// [topvc presentLogin:topvc.ibSignin];
|
|
|
+//// });
|
|
|
+
|
|
|
+ // 递归解决多重Present后,dimiss不完全。
|
|
|
+ [weakself heartBeatTimeout];
|
|
|
+
|
|
|
}];
|
|
|
+
|
|
|
} else {
|
|
|
- // 退回到初始视图
|
|
|
- [rootVC popToRootViewControllerAnimated:NO];
|
|
|
+ if (rootVC.viewControllers.count > 1) {
|
|
|
+ // 退回到初始视图
|
|
|
+ [rootVC popToRootViewControllerAnimated:NO];
|
|
|
+ }
|
|
|
RootViewController* topvc= (RootViewController*)rootVC.topViewController;
|
|
|
[topvc dealWithUILogout];
|
|
|
dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 0.25 * NSEC_PER_SEC);
|
|
|
dispatch_after(time, dispatch_get_main_queue(), ^{
|
|
|
[topvc presentLogin:topvc.ibSignin];
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -425,13 +447,13 @@
|
|
|
// 心跳成功才处理计时
|
|
|
[self markHeartBeatTime];
|
|
|
|
|
|
- } else if (result == 4) { // 超时
|
|
|
+ } else if (result == 4) { // 心跳超时
|
|
|
|
|
|
[weakself heartBeatTimeout];
|
|
|
|
|
|
|
|
|
} else if ([weakself checkHearBeatTimeOut]) {// 本地检查超时(上一次成功心跳距现在的间隔时间超出1h)
|
|
|
-
|
|
|
+
|
|
|
[weakself heartBeatTimeout];
|
|
|
}
|
|
|
|