Kaynağa Gözat

1.插拔usb弹框显示

huangxiaodong 1 yıl önce
ebeveyn
işleme
1909d39a2f

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

@@ -165,6 +165,8 @@
 		6B05828A2B045E0B00D37290 /* uploadFileDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0582882B045E0B00D37290 /* uploadFileDataModel.m */; };
 		6B1CC2C62B677F3E00AD4217 /* extraMediaEventModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1CC2C42B677F3D00AD4217 /* extraMediaEventModel.h */; };
 		6B1CC2C72B677F3E00AD4217 /* extraMediaEventModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1CC2C52B677F3D00AD4217 /* extraMediaEventModel.m */; };
+		6B1CC2CA2B67A5FC00AD4217 /* USBInsertPopView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1CC2C82B67A5FC00AD4217 /* USBInsertPopView.h */; };
+		6B1CC2CB2B67A5FC00AD4217 /* USBInsertPopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1CC2C92B67A5FC00AD4217 /* USBInsertPopView.m */; };
 		6B1FBD222B43DAD200926382 /* backupsSetViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1FBD202B43DAD200926382 /* backupsSetViewController.h */; };
 		6B1FBD232B43DAD200926382 /* backupsSetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B1FBD212B43DAD200926382 /* backupsSetViewController.m */; };
 		6B1FBD262B4503E700926382 /* photosBackupsTaskModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1FBD242B4503E700926382 /* photosBackupsTaskModel.h */; };
@@ -606,6 +608,8 @@
 		6B0582882B045E0B00D37290 /* uploadFileDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = uploadFileDataModel.m; sourceTree = "<group>"; };
 		6B1CC2C42B677F3D00AD4217 /* extraMediaEventModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = extraMediaEventModel.h; sourceTree = "<group>"; };
 		6B1CC2C52B677F3D00AD4217 /* extraMediaEventModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = extraMediaEventModel.m; sourceTree = "<group>"; };
+		6B1CC2C82B67A5FC00AD4217 /* USBInsertPopView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = USBInsertPopView.h; sourceTree = "<group>"; };
+		6B1CC2C92B67A5FC00AD4217 /* USBInsertPopView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = USBInsertPopView.m; sourceTree = "<group>"; };
 		6B1FBD202B43DAD200926382 /* backupsSetViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = backupsSetViewController.h; sourceTree = "<group>"; };
 		6B1FBD212B43DAD200926382 /* backupsSetViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = backupsSetViewController.m; sourceTree = "<group>"; };
 		6B1FBD242B4503E700926382 /* photosBackupsTaskModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = photosBackupsTaskModel.h; sourceTree = "<group>"; };
@@ -1201,6 +1205,8 @@
 				6BFF26872AF8949F00FCB4F7 /* playerShowSecretkeyView.m */,
 				6B4D23AF2B33DDBB005B718A /* imageVersionRenewTipView.h */,
 				6B4D23B02B33DDBB005B718A /* imageVersionRenewTipView.m */,
+				6B1CC2C82B67A5FC00AD4217 /* USBInsertPopView.h */,
+				6B1CC2C92B67A5FC00AD4217 /* USBInsertPopView.m */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -2006,6 +2012,7 @@
 				6BED888A2B4E819000F76DDC /* downloadFileRecordTableView.h in Headers */,
 				6B0581AF2AFCF57300D37290 /* AJPhotoGroupCell.h in Headers */,
 				6B5D401A2B4A9850000965CF /* couldPhoneFolderListModel.h in Headers */,
+				6B1CC2CA2B67A5FC00AD4217 /* USBInsertPopView.h in Headers */,
 				6BED888E2B4E901900F76DDC /* downloadFileRecordCell.h in Headers */,
 				184C8ACC2A94557200F26650 /* HidenMaskSetViewController.h in Headers */,
 				18EC79DC2ABC109F0084836A /* SetPWDSecondViewController.h in Headers */,
@@ -2373,6 +2380,7 @@
 				A031DD7F27EC78C800909527 /* HWAgreementViewController.m in Sources */,
 				183AE64F2A8A2CF000B11CB0 /* UIImageView+AFNetworking.m in Sources */,
 				183AE6592A8A2CF000B11CB0 /* AFSecurityPolicy.m in Sources */,
+				6B1CC2CB2B67A5FC00AD4217 /* USBInsertPopView.m in Sources */,
 				18E557262A3C6088005CC84B /* SetUsePWDViewController.m in Sources */,
 				183AE6D52A8CAFAE00B11CB0 /* UIView+View.m in Sources */,
 				6B5D40282B4BC402000965CF /* couldPhoneFileListModel.m in Sources */,

+ 2 - 2
创维盒子/双子星云手机/Assets.xcassets/qidongye_pic.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "qidongye_pic@2x.png",
+      "filename" : "usb_pop_image@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "qidongye_pic@3x.png",
+      "filename" : "usb_pop_image@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

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


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


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


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


+ 5 - 1
创维盒子/双子星云手机/CloudPlayer/Model/extraMediaEventModel.h

@@ -9,9 +9,13 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface extraMediaEventModel : SuperModel
+@interface extraMediaEventDataModel : SuperModel
 @property (nonatomic, copy) NSString * name;// 文件夹名称(磁盘)
 @property (nonatomic, assign) int  event;//0  插入  1拔出 2 安全拔出
 @end
 
+@interface extraMediaEventModel : SuperModel
+@property (nonatomic, strong)extraMediaEventDataModel*data;
+@end
+
 NS_ASSUME_NONNULL_END

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

@@ -7,6 +7,10 @@
 
 #import "extraMediaEventModel.h"
 
+@implementation extraMediaEventDataModel
+
+@end
+
 @implementation extraMediaEventModel
 
 @end

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

@@ -41,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)saveLastImageFun;
 - (void)readLastImageFun;
 - (void)getExtraMediaEventResponseFun:(NSDictionary *)dataDict;
+- (void)showInsertPopViewFun:(NSString*)name;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -22,6 +22,7 @@
 #import "AppDelegate.h"
 #import "cachesFileManager.h"
 #import "extraMediaEventModel.h"
+#import "USBInsertPopView.h"
 
 @implementation PlayerViewController (otherDelegate)
 
@@ -421,21 +422,37 @@
     extraMediaEventModel *model = [[extraMediaEventModel alloc] initWithDictionary:dataDict error:nil];
     
     NSString *tip = nil;
-    if(model.event == 0){
+    if(model.data.event == 0){
         tip = NSLocalizedString(@"disk_insertion_tip",nil);
+        [self showInsertPopViewFun:model.data.name];
     }
-    else if(model.event == 1){
+    else if(model.data.event == 1){
         tip = NSLocalizedString(@"disk_extract_tip",nil);
     }
-    else if(model.event == 2){
+    else if(model.data.event == 2){
         tip = NSLocalizedString(@"disk_save_extract_tip",nil);
     }
     
-    NSString *totalTips = [[NSString alloc] initWithFormat:@"%@%@",model.name,tip];
+    NSString *totalTips = [[NSString alloc] initWithFormat:@"%@%@",model.data.name,tip];
     
     mainBlock(^{
         [[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];
+    
+    UIViewController*lastVC =  self.navigationController.viewControllers.lastObject;
+    //[[iTools getKeyWindow] addSubview:self->curUSBInsertPopV];
+    [lastVC.view addSubview:self->curUSBInsertPopV];
+}
+
 @end

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

@@ -24,6 +24,7 @@
 #import "photosBackupsTaskModel.h"
 #import "AFNetworkReachabilityManager.h"
 #import "couldPhoneFileListModel.h"
+#import "USBInsertPopView.h"
 
 @protocol PlayerViewControllerDelegate <NSObject>
 
@@ -55,6 +56,7 @@
     RCMAACPlayer *aacPlayer;
     
     UIView *wattingView;
+    USBInsertPopView *curUSBInsertPopV;
 }
 
 @property(copy,nonatomic)NSString * _Nullable internetVideoPort;

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

@@ -449,6 +449,9 @@ ComontAlretViewControllerDelegate>
         }
         
         self.isNeedRecyclResource = YES;
+    
+    //test code
+    //[self showInsertPopViewFun:@"222"];
 }
 
 - (void)opencommandChannelManagerrc_openURL

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/View/PlayerView.m

@@ -71,7 +71,7 @@ ShowImageViewDelegate>{
                   inRect:CGRectMake(0, 0, glkshowImageView.drawableWidth, glkshowImageView.drawableHeight)
                 fromRect:[ciImage extent]];
     
-    [self->glkshowImageView display];
+    //[self->glkshowImageView display];
 }
 
 - (void)showIMage

+ 16 - 0
创维盒子/双子星云手机/CloudPlayer/View/USBInsertPopView.h

@@ -0,0 +1,16 @@
+//
+//  USBInsertPopView.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/29.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface USBInsertPopView : UIView
+- (id)initWithFrame:(CGRect)frame withName:(NSString*)name;
+@end
+
+NS_ASSUME_NONNULL_END

+ 146 - 0
创维盒子/双子星云手机/CloudPlayer/View/USBInsertPopView.m

@@ -0,0 +1,146 @@
+//
+//  USBInsertPopView.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/29.
+//
+
+#import "USBInsertPopView.h"
+
+@interface USBInsertPopView ()
+@property (nonatomic,strong) UIView* whiteBgView;
+@property (nonatomic,copy) NSString* name;
+@end
+
+@implementation USBInsertPopView
+
+- (id)initWithFrame:(CGRect)frame withName:(NSString*)name{
+    self = [super initWithFrame:frame];
+    self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
+    _name = name;
+    [self drawAnyView];
+    
+    return self;
+}
+
+- (void)drawAnyView{
+    _whiteBgView = [UIView new];
+    _whiteBgView.layer.cornerRadius = 8;
+    _whiteBgView.backgroundColor = [UIColor whiteColor];
+    [self addSubview:_whiteBgView];
+    
+    [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(390 + safeArea  + 20);
+        make.left.mas_equalTo(0.f);
+        make.right.mas_equalTo(0.f);
+        make.bottom.mas_equalTo(20.f);
+    }];
+    
+    NSString *titleRightStr = NSLocalizedString(@"disk_insertion_pop_title",nil);
+    NSString *curTitleStr = [[NSString alloc] initWithFormat:@"[%@]%@",_name,titleRightStr];
+    UILabel *titleLab = [[UILabel alloc] init];
+    titleLab.text = curTitleStr;
+    titleLab.textAlignment = NSTextAlignmentCenter;
+    titleLab.numberOfLines = 0;
+    titleLab.textColor = [UIColor blackColor];
+    titleLab.font = [UIFont boldSystemFontOfSize:18.0];
+    [_whiteBgView addSubview:titleLab];
+    
+    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(20);
+        make.right.mas_equalTo(0.f);
+        make.left.mas_equalTo(25.f);
+        make.top.mas_equalTo(20.f);
+    }];
+    
+    NSString *curTip1Str = NSLocalizedString(@"disk_insertion_pop_tip",nil);
+    UILabel *tip1Lab = [[UILabel alloc] init];
+    tip1Lab.text = curTip1Str;
+    tip1Lab.numberOfLines = 0;
+    tip1Lab.textAlignment = NSTextAlignmentCenter;
+    tip1Lab.textColor = [UIColor hwColor:@"#151515" alpha:0.5];
+    tip1Lab.font = [UIFont systemFontOfSize:14.0];
+    [_whiteBgView addSubview:tip1Lab];
+    
+    CGFloat curHeight = [curTip1Str boundingRectWithSize:CGSizeMake((SCREEN_W - 80), 1000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.height;
+    
+    curHeight += 15;
+    
+    [tip1Lab mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(curHeight);
+        make.right.mas_equalTo(-40.f);
+        make.left.mas_equalTo(40.f);
+        make.top.mas_equalTo(titleLab.mas_bottom).offset(10.f);
+    }];
+    
+    CGFloat imageW = SCREEN_W - 15.0*2;
+    CGFloat imageH = 184.0*imageW/343.0;
+    
+    UIImageView *topImage = [[UIImageView alloc] init];
+    topImage.image = [UIImage imageNamed:@"usb_pop_image"];
+    [_whiteBgView addSubview:topImage];
+    
+    [topImage mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(imageH);
+        make.width.mas_equalTo(imageW);
+        make.left.mas_equalTo(15.f);
+        make.top.mas_equalTo(tip1Lab.mas_bottom).offset(20);
+    }];
+    
+    NSString *subTip1 = NSLocalizedString(@"disk_insertion_pop_tip_sub1",nil);
+    NSString *subTip2 = NSLocalizedString(@"disk_insertion_pop_tip_sub2",nil);
+    NSString *subTip3 = NSLocalizedString(@"disk_insertion_pop_tip_sub3",nil);
+  
+    NSArray *titleArr = @[subTip1,subTip2,subTip3];
+    CGFloat labelSpace = 10.0;
+    CGFloat labelWidth = (imageW -20)/3.0;
+    
+    for (int i=0; i<titleArr.count; i++) {
+        
+        UILabel *subTipLab = [[UILabel alloc] init];
+        subTipLab.text = titleArr[i];
+        subTipLab.numberOfLines = 0;
+        subTipLab.textAlignment = NSTextAlignmentCenter;
+        subTipLab.textColor = [UIColor hwColor:@"##0A132B" alpha:1.0];
+        subTipLab.font = [UIFont systemFontOfSize:14.0];
+        [topImage addSubview:subTipLab];
+        
+        [subTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.height.mas_equalTo(40);
+            make.width.mas_equalTo(labelWidth);
+            make.left.mas_equalTo(i*(labelSpace + labelWidth));
+            make.bottom.mas_equalTo(0);
+        }];
+    }
+
+    UIButton *konwBut = [[UIButton alloc] init];
+    [konwBut setTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil) forState:UIControlStateNormal];
+    konwBut.layer.cornerRadius = 8;
+    konwBut.layer.masksToBounds = YES;
+    [konwBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
+    [_whiteBgView addSubview:konwBut];
+    
+    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
+    gradientLayer.startPoint = CGPointMake(0, 0.5);
+    gradientLayer.endPoint = CGPointMake(0.97, 0.5);
+    gradientLayer.frame = CGRectMake(0, 0, imageW, 48);
+    gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
+    gradientLayer.locations = @[@(0), @(1.0f)];
+    [konwBut.layer addSublayer:gradientLayer];
+    
+    [konwBut mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(48);
+        make.width.mas_equalTo(imageW);
+        make.centerX.mas_equalTo(0.f);
+        make.bottom.mas_equalTo(-(30 + safeArea));
+    }];
+    
+}
+
+
+- (void)colseFun
+{
+    [self removeFromSuperview];
+}
+
+@end

+ 5 - 0
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -382,3 +382,8 @@
 "disk_extract_tip"   = "磁盘拔出";
 "disk_save_extract_tip"   = "磁盘安全拔出";
 "disk_insertion_tip"   = "磁盘插入";
+"disk_insertion_pop_title"   = "已插入";
+"disk_insertion_pop_tip"   = "不要直接拔出U盘,请到文件管理安全弹出避免造成磁盘损害,数据丢失的风险";
+"disk_insertion_pop_tip_sub1" = "01桌面";
+"disk_insertion_pop_tip_sub2" = "02文件管理";
+"disk_insertion_pop_tip_sub3" = "03文件设置";