Browse Source

1.单点登录重发逻辑方案更改

huangxiaodong 1 year ago
parent
commit
ae38d8726e

+ 8 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -195,6 +195,8 @@
 		6B21709D2B15CDB600656670 /* NSArray+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B21709B2B15CDB600656670 /* NSArray+Log.m */; };
 		6B2170A02B15D39900656670 /* privacyModeTipViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B21709E2B15D39900656670 /* privacyModeTipViewController.h */; };
 		6B2170A12B15D39900656670 /* privacyModeTipViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B21709F2B15D39900656670 /* privacyModeTipViewController.m */; };
+		6B3A4B152B6F69A500F74679 /* cloudPhoneCommonModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3A4B132B6F69A500F74679 /* cloudPhoneCommonModel.h */; };
+		6B3A4B162B6F69A500F74679 /* cloudPhoneCommonModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3A4B142B6F69A500F74679 /* cloudPhoneCommonModel.m */; };
 		6B3F96342AD2A15A008E349E /* netWorkManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3F96322AD2A15A008E349E /* netWorkManager.h */; };
 		6B3F96352AD2A15A008E349E /* netWorkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3F96332AD2A15A008E349E /* netWorkManager.m */; };
 		6B3F963A2AD2AD0B008E349E /* newWorkInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3F96392AD2AD0B008E349E /* newWorkInterface.h */; };
@@ -640,6 +642,8 @@
 		6B21709B2B15CDB600656670 /* NSArray+Log.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+Log.m"; sourceTree = "<group>"; };
 		6B21709E2B15D39900656670 /* privacyModeTipViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = privacyModeTipViewController.h; sourceTree = "<group>"; };
 		6B21709F2B15D39900656670 /* privacyModeTipViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = privacyModeTipViewController.m; sourceTree = "<group>"; };
+		6B3A4B132B6F69A500F74679 /* cloudPhoneCommonModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cloudPhoneCommonModel.h; sourceTree = "<group>"; };
+		6B3A4B142B6F69A500F74679 /* cloudPhoneCommonModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = cloudPhoneCommonModel.m; sourceTree = "<group>"; };
 		6B3F96322AD2A15A008E349E /* netWorkManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = netWorkManager.h; sourceTree = "<group>"; };
 		6B3F96332AD2A15A008E349E /* netWorkManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = netWorkManager.m; sourceTree = "<group>"; };
 		6B3F96392AD2AD0B008E349E /* newWorkInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = newWorkInterface.h; sourceTree = "<group>"; };
@@ -976,6 +980,8 @@
 				6B1CC2C52B677F3D00AD4217 /* extraMediaEventModel.m */,
 				6B1CC2CC2B6B6D6B00AD4217 /* commandSendCheckModel.h */,
 				6B1CC2CD2B6B6D6B00AD4217 /* commandSendCheckModel.m */,
+				6B3A4B132B6F69A500F74679 /* cloudPhoneCommonModel.h */,
+				6B3A4B142B6F69A500F74679 /* cloudPhoneCommonModel.m */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -2035,6 +2041,7 @@
 				6B0581602AFCD0DF00D37290 /* uploadImageOrVideoViewController.h in Headers */,
 				18F9CB092ABD7835003FF71A /* TipsQRCodeForChangeDeviceViewController.h in Headers */,
 				6B5B60722B3D8098009A2AE2 /* fileTransferPathCheckTableViewCell.h in Headers */,
+				6B3A4B152B6F69A500F74679 /* cloudPhoneCommonModel.h in Headers */,
 				6B05819F2AFCF4E800D37290 /* AJPhotoListView.h in Headers */,
 				18963B462AB84398006E7C50 /* GuideView.h in Headers */,
 				6B1FBD322B455DBD00926382 /* PlayerViewController+upLoadFile.h in Headers */,
@@ -2389,6 +2396,7 @@
 				183AE6592A8A2CF000B11CB0 /* AFSecurityPolicy.m in Sources */,
 				6B1CC2CB2B67A5FC00AD4217 /* USBInsertPopView.m in Sources */,
 				18E557262A3C6088005CC84B /* SetUsePWDViewController.m in Sources */,
+				6B3A4B162B6F69A500F74679 /* cloudPhoneCommonModel.m in Sources */,
 				183AE6D52A8CAFAE00B11CB0 /* UIView+View.m in Sources */,
 				6B5D40282B4BC402000965CF /* couldPhoneFileListModel.m in Sources */,
 				183AE64E2A8A2CF000B11CB0 /* AFNetworkActivityIndicatorManager.m in Sources */,

+ 21 - 0
创维盒子/双子星云手机/CloudPlayer/Model/cloudPhoneCommonModel.h

@@ -0,0 +1,21 @@
+//
+//  cloudPhoneCommonModel.h
+//  隐私保护
+//
+//  Created by xd h on 2024/2/4.
+//
+
+#import "SuperModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface cloudPhoneCommonDataModel : SuperModel
+@property (nonatomic, copy) NSString * msg;
+@end
+
+@interface cloudPhoneCommonModel : SuperModel
+@property (nonatomic, copy) cloudPhoneCommonDataModel * data;//
+@property (nonatomic, copy) NSString * type;//类型
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
创维盒子/双子星云手机/CloudPlayer/Model/cloudPhoneCommonModel.m

@@ -0,0 +1,12 @@
+//
+//  cloudPhoneCommonModel.m
+//  隐私保护
+//
+//  Created by xd h on 2024/2/4.
+//
+
+#import "cloudPhoneCommonModel.h"
+
+@implementation cloudPhoneCommonModel
+
+@end

+ 1 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.h

@@ -37,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)handleDownloadResponseFunBy:(id)message;
 
 - (void)checkAllTaskFun;
+- (void)addCommandSendTaskFunWithType:(NSString*)type WithCommandStr:(NSString*)commandStr;
 - (void)deleteCommandSendTaskFunWith:(NSString*)type;
 - (void)getExtraFilesResponseFun:(NSDictionary *)dataDict;
 - (void)saveLastImageFun;

+ 33 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.mm

@@ -386,17 +386,49 @@
     [self checkCommandSendTaskFun];
 }
 
+-(void)addCommandSendTaskFunWithType:(NSString*)type WithCommandStr:(NSString*)commandStr
+{
+    if(!commandSendCheckArr){
+        commandSendCheckArr = [NSMutableArray new];
+    }
+    
+    BOOL didAddType = NO;
+        
+    for (commandSendCheckModel *model in commandSendCheckArr) {
+        if([model.type isEqualToString:type]){
+            didAddType = YES;
+            model.reSendNum = 0;
+            model.sendTimerStamp = [iTools getNowTimeStamp];
+            break;
+        }
+    }
+        
+    if(!didAddType){
+        commandSendCheckModel *model = [commandSendCheckModel new];
+        model.commandStr = commandStr;
+        model.type = type;
+        model.reSendNum = 0;
+        model.sendTimerStamp = [iTools getNowTimeStamp];
+        [commandSendCheckArr addObject:model];
+    }
+    
+}
+
 -(void)checkCommandSendTaskFun
 {
     if(commandSendCheckArr && commandSendCheckArr.count >0){
         for (commandSendCheckModel *model in commandSendCheckArr) {
-            if(model.reSendNum < 3){
+            if(model.reSendNum < 5){
                 model.reSendNum ++;
                 if(model.commandStr){
                     [self send_data:model.commandStr];
                     
                     HLog(@"\n\n\n任务重发 重发次数:%ld 指令:%@\n\n\n",model.reSendNum,model.commandStr);
                 }
+                
+                if([model.type isEqualToString:@"offline_notification"]){
+                    model.reSendNum = 1;//只要不收到
+                }
             }
         }
     }

+ 1 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.h

@@ -25,6 +25,7 @@
 #import "AFNetworkReachabilityManager.h"
 #import "couldPhoneFileListModel.h"
 #import "USBInsertPopView.h"
+#import "cloudPhoneCommonModel.h"
 
 @protocol PlayerViewControllerDelegate <NSObject>
 

+ 20 - 14
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -561,6 +561,17 @@ ComontAlretViewControllerDelegate>
             if ([messageType isEqualToString:@"cutting"]) {
                 //[[iToast makeText:@"复制成功"] show];
             }
+            else if ([messageType isEqualToString:@"forwardMsgRep"]){/*转发的回复*/
+                
+                cloudPhoneCommonModel *model = [[cloudPhoneCommonModel alloc] initWithDictionary:dataDict error:nil];
+                if(!model){
+                    return;
+                }
+                
+                if([model.data.msg isEqualToString:@"only one socket"]){
+                    [weakSelf deleteCommandSendTaskFunWith:@"offline_notification"];
+                }
+            }
             else if ([messageType isEqualToString:@"forwardMsg"]){/*转发*/
                 /*获取指令类型*/
                 NSString *code = nil;
@@ -1650,15 +1661,7 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
     _isResetingType = YES;
     
     //添加到任务监听
-    commandSendCheckModel *model = [commandSendCheckModel new];
-    model.commandStr = commondStr;
-    model.type = @"reset";
-    model.reSendNum = 0;
-    model.sendTimerStamp = [iTools getNowTimeStamp];
-    
-    if(commandSendCheckArr){
-        [commandSendCheckArr addObject:model];
-    }
+    [self addCommandSendTaskFunWithType:@"reset" WithCommandStr:commondStr];
     
 }
 
@@ -1754,6 +1757,9 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
     {
         NSString *commondStr  = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
         [self send_data:commondStr];
+        
+        [self addCommandSendTaskFunWithType:@"offline_notification" WithCommandStr:commondStr];
+        
         _didSendfristMsg = true;
         
         _isLoginAgainType = false;
@@ -2942,11 +2948,11 @@ static int  couneeee = 0;
         [self checkAllTaskFun];
         
         _offlineNotTime ++;
-        if(_offlineNotTime > 6 && self.commandChannelManager){
-            NSString *commondStr  = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
-            [self send_data:commondStr];
-            _offlineNotTime = 0;
-        }
+//        if(_offlineNotTime > 6 && self.commandChannelManager){
+//            NSString *commondStr  = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
+//            [self send_data:commondStr];
+//            _offlineNotTime = 0;
+//        }
     }
     
     //HLog(@"webSocketTime %ld",self.webSocketTaskTime);