浏览代码

1.完善webrtc部分功能

huangxiaodong 9 月之前
父节点
当前提交
f350dad5c8

+ 7 - 2
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/fileTransferPathCheckViewController.m

@@ -342,7 +342,9 @@
         tipStr = NSLocalizedString(@"File_upload_path_new_fail",nil);
     }
     
-    [[iToast makeText:tipStr] show];
+    mainBlock(^{
+        [[iToast makeText:tipStr] show];
+    });
     
     [self getFolderListFun];
     
@@ -400,7 +402,10 @@
         
     }
     
+    KWeakSelf
+    mainBlock(^{
+        [weakSelf.tableView reloadData];
+    });
     
-    [self.tableView reloadData];
 }
 @end

+ 2 - 0
创维盒子/双子星云手机/webRtc/webRtcManager/webRtcManager.h

@@ -9,11 +9,13 @@
 #import <WebRTC/AMediaStream.h>
 #import <WebRTC/RTCMacros.h>
 #import "webRtcMsgModel.h"
+#import "USBInsertPopView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface webRtcManager : NSObject
 {
+    USBInsertPopView *curUSBInsertPopV;
     //下载nas相关
     customDownloadOperation* curDownloadmodel;
 }

+ 90 - 17
创维盒子/双子星云手机/webRtc/webRtcManager/webRtcManager.m

@@ -343,6 +343,21 @@
     
 }
 
+#pragma mark 删除代理确认收到的消息
+-(void)deleteCommandSendTaskFunWith:(NSString*)type
+{
+    if(commandSendCheckArr && commandSendCheckArr.count >0){
+        
+        NSArray *taskArr = [NSArray arrayWithArray:commandSendCheckArr];
+        
+        for (commandSendCheckModel *model in taskArr) {
+            if([type isEqualToString:model.type]){
+                [commandSendCheckArr removeObject:model];
+            }
+        }
+    }
+}
+
 #pragma mark 复制手机消息到云机
 - (void)updateCopydata{
     UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
@@ -483,6 +498,64 @@
     [self send_data:commandStr];
 }
 
+#pragma mark 创建文件夹回调
+- (void)createFolderResponseFun:(NSDictionary *)dataDict
+{
+    couldPhoneCommonModel *model = [[couldPhoneCommonModel alloc] initWithDictionary:dataDict error:nil];
+    
+    if(model){
+        NSNumber *curNum = [NSNumber numberWithInteger:model.status];
+        [[NSNotificationCenter defaultCenter] postNotificationName:createFolderDoneNotification object:curNum];/*发送通知*/
+    }
+}
+
+- (void)getFolderListResponseFun:(NSDictionary *)dataDict
+{
+    [[NSNotificationCenter defaultCenter] postNotificationName:getFolderListDoneNotification object:dataDict];/*发送通知*/
+}
+
+- (void)searchFileListResponseFun:(NSDictionary *)dataDict
+{
+    [[NSNotificationCenter defaultCenter] postNotificationName:searchFileListDoneNotification object:dataDict];/*发送通知*/
+}
+
+#pragma mark U盘插入相关
+- (void)getExtraMediaEventResponseFun:(NSDictionary *)dataDict
+{
+
+    mainBlock((^{
+        extraMediaEventModel *model = [[extraMediaEventModel alloc] initWithDictionary:dataDict error:nil];
+        
+        NSString *tip = nil;
+        if(model.data.event == 0){
+            tip = NSLocalizedString(@"disk_insertion_tip",nil);
+            [self showInsertPopViewFun:model.data.name];
+        }
+        else if(model.data.event == 1){
+            tip = NSLocalizedString(@"disk_extract_tip",nil);
+        }
+        else if(model.data.event == 2){
+            tip = NSLocalizedString(@"disk_save_extract_tip",nil);
+        }
+        
+        NSString *totalTips = [[NSString alloc] initWithFormat:@"%@%@",model.data.name,tip];
+        
+        [[iToast makeText:totalTips] show];
+    }));
+}
+
+#pragma mark 显示插入UI弹框
+- (void)showInsertPopViewFun:(NSString*)name
+{
+    if(self->curUSBInsertPopV){
+        [self->curUSBInsertPopV removeFromSuperview];
+        self->curUSBInsertPopV = nil;
+    }
+    
+    self->curUSBInsertPopV = [[USBInsertPopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H) withName:name];
+    
+    [[iTools getKeyWindow] addSubview:self->curUSBInsertPopV];
+}
 
 
 #pragma mark 收到的webrtc消息处理
@@ -702,26 +775,26 @@
     else if ([messageType isEqualToString:@"reboot"]){/*重启*/
         //[weakSelf stopForceStartTimerFun];
     }
-//    else if ([messageType isEqualToString:@"mkdir"]){/*创建文件夹*/
-//        [weakSelf createFolderResponseFun:dataDict];
-//    }
-//    else if ([messageType isEqualToString:@"getBackupPath"]){/*创建文件夹*/
-//        [weakSelf getFolderListResponseFun:dataDict];
-//    }
-//    else if ([messageType isEqualToString:@"search"]){/*创建文件夹*/
-//        [weakSelf searchFileListResponseFun:dataDict];
-//    }
+    else if ([messageType isEqualToString:@"mkdir"]){/*创建文件夹*/
+        [self createFolderResponseFun:dataDict];
+    }
+    else if ([messageType isEqualToString:@"getBackupPath"]){/*创建文件夹*/
+        [self getFolderListResponseFun:dataDict];
+    }
+    else if ([messageType isEqualToString:@"search"]){/*创建文件夹*/
+        [self searchFileListResponseFun:dataDict];
+    }
     else if ([messageType isEqualToString:@"getExtraFiles"]){/*获取云机产品信息*/
         [self getExtraFilesResponseFun:dataDict];
     }
-//    else if ([messageType isEqualToString:@"extraMediaEvent"]){/*磁盘插拔*/
-//        [weakSelf getExtraMediaEventResponseFun:dataDict];
-//        [weakSelf getExtraFilesListFun];
-//    }
-//    else if ([messageType isEqualToString:@"reset"]){/**/
-//        [weakSelf deleteCommandSendTaskFunWith:@"reset"];
-//    }
-//    
+    else if ([messageType isEqualToString:@"extraMediaEvent"]){/*磁盘插拔*/
+        [self getExtraMediaEventResponseFun:dataDict];
+        [self getExtraFilesListFun];
+    }
+    else if ([messageType isEqualToString:@"reset"]){/**/
+        [self deleteCommandSendTaskFunWith:@"reset"];
+    }
+    
 }
 
 #pragma mark WebRTC 回调 MediaStreamClientEventsDelegate