|
@@ -13,10 +13,12 @@
|
|
|
#import "webSocketManager+upLoadFile.h"
|
|
|
#import "webSocketManager+backupsFile.h"
|
|
|
#import "errorAlertTool.h"
|
|
|
+#import "RcGameWQKeyChain.h"
|
|
|
|
|
|
@interface webSocketManager ()
|
|
|
{
|
|
|
NSMutableArray *commandSendCheckArr;//需要检测任务是否发出的的指令
|
|
|
+ ComontAlretViewController *logoutAlertVC;
|
|
|
}
|
|
|
|
|
|
@property(copy,nonatomic)NSString *curIp;
|
|
@@ -163,7 +165,7 @@ static webSocketManager *webSocketManagerInstance = nil;
|
|
|
NSString * dataStr = (NSString*)data;
|
|
|
if([dataStr isEqualToString:@"offline_notification"]){
|
|
|
HLog(@"被别人挤下线了");
|
|
|
- //[weakSelf LogoutByOtherFun];
|
|
|
+ [weakSelf LogoutByOtherFun];
|
|
|
}
|
|
|
|
|
|
return;
|
|
@@ -430,7 +432,7 @@ static webSocketManager *webSocketManagerInstance = nil;
|
|
|
{
|
|
|
if(commandSendCheckArr && commandSendCheckArr.count >0){
|
|
|
for (commandSendCheckModel *model in commandSendCheckArr) {
|
|
|
- if(model.reSendNum < 3){
|
|
|
+ if(model.reSendNum < 2){
|
|
|
model.reSendNum ++;
|
|
|
if(model.commandStr){
|
|
|
[self send_data:model.commandStr];
|
|
@@ -499,9 +501,15 @@ static webSocketManager *webSocketManagerInstance = nil;
|
|
|
{
|
|
|
[self getSysInfoFun];
|
|
|
|
|
|
-// NSString *commondStr = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
|
|
|
-// [self send_data:commondStr];
|
|
|
-// [self addCommandSendTaskFunWithType:@"offline_notification" WithCommandStr:commondStr];
|
|
|
+ NSString *curOaidStr = [RcGameWQKeyChain getOaidStringFun];
|
|
|
+ if(!curOaidStr){
|
|
|
+ curOaidStr = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString *commondStr = [[NSString alloc] initWithFormat:@"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\",\"sign\":\"%@\"}",curOaidStr];
|
|
|
+ //NSString *commondStr = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
|
|
|
+ [self send_data:commondStr];
|
|
|
+ [self addCommandSendTaskFunWithType:@"offline_notification" WithCommandStr:commondStr];
|
|
|
|
|
|
_didSendfristMsg = true;
|
|
|
|
|
@@ -938,4 +946,60 @@ static webSocketManager *webSocketManagerInstance = nil;
|
|
|
[self send_data:commondStr];
|
|
|
}
|
|
|
|
|
|
+#pragma mark 单点登录被挤下线弹框
|
|
|
+- (void)LogoutByOtherFun
|
|
|
+{
|
|
|
+ if(logoutAlertVC){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //通知音视频断开链接
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:logoutByOtherNotification object:nil];
|
|
|
+
|
|
|
+ //yyyy-MM-dd HH:mm:ss
|
|
|
+ NSString*dateStr = [iTools getNowTimeString2];
|
|
|
+ if(dateStr && dateStr.length == 19){
|
|
|
+ dateStr = [dateStr substringWithRange:NSMakeRange(11, 5)];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString *LogoutTimerStr = [[NSString alloc] initWithFormat:@"%@%@%@",NSLocalizedString(@"single_sign_on_Tips_one",nil),dateStr,NSLocalizedString(@"single_sign_on_Tips_two",nil)];
|
|
|
+
|
|
|
+
|
|
|
+ NSString * loginAgainStr = NSLocalizedString(@"single_sign_on_login_again",nil);
|
|
|
+ BOOL isOkBtnHighlight = YES;
|
|
|
+ if(![connectDeviceManager shareInstance].DeviceThirdIdMod.data.isPrivacyMode){
|
|
|
+ loginAgainStr = @"";
|
|
|
+ isOkBtnHighlight = NO;
|
|
|
+ }
|
|
|
+
|
|
|
+ _isLogoutByOtherType = YES;
|
|
|
+
|
|
|
+ //被挤下线 ws断开
|
|
|
+ [self.commandChannelManager rc_close];
|
|
|
+ self.commandChannelManager = nil;
|
|
|
+
|
|
|
+ /*弹窗提示重启*/
|
|
|
+ //KWeakSelf
|
|
|
+ logoutAlertVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"single_sign_on_Tips_logout",nil)
|
|
|
+ msg:LogoutTimerStr
|
|
|
+ imageStr:@""
|
|
|
+ cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
|
|
|
+ okTitle:loginAgainStr isOkBtnHighlight:isOkBtnHighlight
|
|
|
+ didClickOk:^{
|
|
|
+ //[weakSelf tryAgain];
|
|
|
+ //[[webSocketManager shareInstance] WebSocketNeedRelinkFun];
|
|
|
+
|
|
|
+ self->_isLogoutByOtherType = NO;
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:lockBypwdNotification object:nil];
|
|
|
+
|
|
|
+ } didClickCancel:^{
|
|
|
+ exit(0);/*强制退出app*/
|
|
|
+ }];
|
|
|
+ logoutAlertVC.modalPresentationStyle = UIModalPresentationCustom;
|
|
|
+
|
|
|
+ [[iTools appRootViewController] presentViewController:logoutAlertVC animated:YES completion:^{
|
|
|
+ self->logoutAlertVC.view.superview.backgroundColor = [UIColor clearColor];
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
@end
|