Browse Source

1.优化瑞云闪退---结果待验证

huangxiaodong 1 year ago
parent
commit
8dca5e2362

+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/uploadFile_disk_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "uploadFile_disk_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "uploadFile_disk_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/uploadFile_disk_icon.imageset/uploadFile_disk_icon@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/uploadFile_disk_icon.imageset/uploadFile_disk_icon@3x.png


+ 16 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/view/diskListBgView.h

@@ -0,0 +1,16 @@
+//
+//  diskListBgView.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/23.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface diskListBgView : UIView
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 20 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/view/diskListBgView.m

@@ -0,0 +1,20 @@
+//
+//  diskListBgView.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/23.
+//
+
+#import "diskListBgView.h"
+
+@implementation diskListBgView
+
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+
+@end

+ 16 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/view/diskListTableCell.h

@@ -0,0 +1,16 @@
+//
+//  diskListTableCell.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/23.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface diskListTableCell : UITableViewCell
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 23 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/view/diskListTableCell.m

@@ -0,0 +1,23 @@
+//
+//  diskListTableCell.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/23.
+//
+
+#import "diskListTableCell.h"
+
+@implementation diskListTableCell
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end

+ 16 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/view/diskListTableView.h

@@ -0,0 +1,16 @@
+//
+//  diskListTableView.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/23.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface diskListTableView : UITableView
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 20 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/downLoadFile/view/diskListTableView.m

@@ -0,0 +1,20 @@
+//
+//  diskListTableView.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/23.
+//
+
+#import "diskListTableView.h"
+
+@implementation diskListTableView
+
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+
+@end

+ 41 - 53
创维盒子/双子星云手机/connectDeviceManager/connectDeviceManager.m

@@ -23,6 +23,8 @@ WHPingDelegate
     dispatch_queue_t initProxyQueue;
     
     WHPingTester *whPingTester;
+    
+    BOOL didRuiYunInitOkType;
 }
 
 @property (nonatomic, strong) NSTimer *connectCheckTimer;
@@ -147,8 +149,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
 #pragma mark 初始化瑞云的SDK等
 - (void)initRuiyunSDKFun{
     
-    bool connected = [RaylinkProxy.sharedManager isSdnConnected];
-    if(connected){
+    if(didRuiYunInitOkType){
         [self onConnectFun];
         return;
     }
@@ -173,11 +174,44 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
         [NSFileManager.defaultManager createDirectoryAtURL:logUrl withIntermediateDirectories:YES attributes:NULL error:NULL];
     }
     
+    KWeakSelf
     dispatch_async(initProxyQueue, ^{
         NSData *sdnInfo = [NSData dataWithContentsOfURL:[[NSBundle.mainBundle bundleURL] URLByAppendingPathComponent:@"planet.1ali_3ry_peer"]];
         
         /// 1. 初始化代理库
         [RaylinkProxy.sharedManager initProxy:logUrl.path rootSdnInfo:sdnInfo];
+        
+        self->didRuiYunInitOkType = YES;
+        
+        /// 启动定时器监听 SND 连接状态
+        self.connectCheckTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 repeats:YES block:^(NSTimer * _Nonnull timer) {
+            
+            /// 2. 监听SDN 连接状态
+            bool connected = [RaylinkProxy.sharedManager isSdnConnected];
+            if (self.sdnConnected == connected) {
+                return;
+            }
+            
+            self.sdnConnected = connected;
+            if (self.sdnConnected) {
+                
+                [weakSelf onConnectFun];
+                [self->_connectCheckTimer invalidate];
+                
+                //self.sdnConnectStateLab.text = @"SDN state: Connected";
+                //self.sdnIDLab.text = [@"My SDN ID: " stringByAppendingString:[RaylinkProxy.sharedManager getSdnId]];
+                
+                    
+            } else {
+                //self.sdnConnectStateLab.text = @"SDN state: Connectting";
+            }
+            
+            
+        }];
+        
+        [[NSRunLoop currentRunLoop] addTimer:self.connectCheckTimer forMode:NSRunLoopCommonModes];
+        [[NSRunLoop currentRunLoop] run];
+        
     });
     
     
@@ -189,62 +223,16 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
         NSLog(@"accept ok %d",self.serverSocket.localPort);
     }
     
-    KWeakSelf
-    /// 启动定时器监听 SND 连接状态
-    self.connectCheckTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 repeats:YES block:^(NSTimer * _Nonnull timer) {
-        
-        /// 2. 监听SDN 连接状态
-        bool connected = [RaylinkProxy.sharedManager isSdnConnected];
-        if (self.sdnConnected == connected) {
-            return;
-        }
-        
-        self.sdnConnected = connected;
-        
-        if (self.sdnConnected) {
-            
-            [weakSelf onConnectFun];
-            [self->_connectCheckTimer invalidate];
-            
-            //self.sdnConnectStateLab.text = @"SDN state: Connected";
-            //self.sdnIDLab.text = [@"My SDN ID: " stringByAppendingString:[RaylinkProxy.sharedManager getSdnId]];
-            
-                
-        } else {
-            //self.sdnConnectStateLab.text = @"SDN state: Connectting";
-        }
-        
-        
-    }];
-    
-    
-//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-//        mainBlock(^{
-//            [self onConnectFun];
-//        });
-//    });
 }
 
 
 - (void)onConnectFun{
     
-    // 2. 监听SDN 连接状态
-//    bool connected = [RaylinkProxy.sharedManager isSdnConnected];
-//
-//    HLog(@"协助瑞云看日志onConnectFun isSdnConnected:%d",connected);
-//
-//    if(!connected){
-//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-//            mainBlock(^{
-//                [self onConnectFun];
-//            });
-//        });
-//
-//        return;
-//    }
-    
-    if (self.peerConnected == YES) {
-        //[self disconnect];
+    if (self.peerConnected == YES
+        && _Pre_sdnId
+        && ![_Pre_sdnId isEqualToString:self.DeviceThirdIdMod.data.sdnId]) {
+        [self disconnect];
+
         //return;
     }