123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707 |
- //
- // mineViewController.m
- // 双子星云手机
- //
- // Created by xd h on 2024/6/21.
- //
- #import "mineViewController.h"
- #import "MineCommonUsedView.h"
- #import "privacyModeViewController.h"
- #import "TipsQRCodeForChangeDeviceViewController.h"
- #import "AboutViewController.h"
- #import "clearCacheAlretViewController.h"
- #import "inputPWDViewController.h"
- #import "customerServiceViewController.h"
- #import "customDownloadCacheManager.h"
- #import "CustomerWebViewController.h"
- #import "audioPlayingView.h"
- #import "DFPlayer.h"
- #import "audioPlayerViewController.h"
- #import "scanToPCLoginViewController.h"
- #import "PCLoginViewController.h"
- #import "cloudPhoneModelViewController.h"
- @interface mineViewController ()
- @property(nonatomic,strong)UIButton *netButton;
- @property(nonatomic,strong)UILabel *snLabel;
- @property(nonatomic,strong)UIButton *snCopyButton;
- @property(nonatomic,strong)MineCommonUsedView *MineCommonUsedV;
- @end
- @implementation mineViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self.view setBackgroundColor:HWF5F7FAColor];
-
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
- [self.navBarBGView setHidden:YES];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PCLoginDidPopFun) name:showTabbarNotification object:nil];
-
- [self drawAnyView];
- }
- - (void)drawAnyView{
- //顶底底部图片
- UIImageView *topImageV = [UIImageView new];
- topImageV.image = [UIImage imageNamed:@"Nas_top_img"];
- [self.view addSubview:topImageV];
-
- [topImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(280.0*AUTOSCALE);
- }];
-
- UIButton *pcScanButton = [[UIButton alloc] init];
- [pcScanButton setImage:[UIImage imageNamed:@"pc_scan_icon"] forState:UIControlStateNormal];
- pcScanButton.tag = 100;
- [pcScanButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:pcScanButton];
-
- [pcScanButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(50);
- make.right.mas_equalTo(-15);
- make.width.mas_equalTo(40);
- make.height.mas_equalTo(40);
- }];
-
- CGFloat tipImageTop = 50 + 40;
-
- //商标图片
- UIImageView *TipImageV = [UIImageView new];
- TipImageV.image = [UIImage imageNamed:@"mine_head_icon"];
- [self.view addSubview:TipImageV];
-
- [TipImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(tipImageTop);
- make.left.mas_equalTo(16);
- make.width.mas_equalTo(48);
- make.height.mas_equalTo(48);
- }];
-
- _snLabel = [[UILabel alloc] init];
- _snLabel.font = [UIFont boldSystemFontOfSize:14.0];
- _snLabel.textColor = [UIColor hwColor:@"#0A132B"];
- //_fileNamelabel.backgroundColor = [UIColor greenColor];
- [self.view addSubview:_snLabel];
-
- [_snLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(TipImageV.mas_right).offset(5);
- make.right.mas_equalTo(-16);
- //make.centerY.mas_equalTo(TipImageV.mas_centerY).offset(0);
- make.top.mas_equalTo(TipImageV.mas_top).offset(0);
- make.height.mas_equalTo(20);
- }];
-
- // UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copySnFun)];
- // [_snLabel addGestureRecognizer:tap];
-
- _snCopyButton = [[UIButton alloc] init];
- _snCopyButton.tag = 1;
- [_snCopyButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:_snCopyButton];
- //_snCopyButton.backgroundColor = [UIColor redColor];
-
- [_snCopyButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(_snLabel.mas_left);
- make.top.equalTo(_snLabel.mas_top).offset(-5);
- make.right.mas_equalTo(_snLabel.mas_right);
- make.bottom.equalTo(_snLabel.mas_bottom).offset(2);
- }];
-
-
- _netButton = [[UIButton alloc] init];
- [_netButton setImage:[UIImage imageNamed:@"mine_net_icon"] forState:UIControlStateNormal];
- [_netButton setTitleColor:[UIColor hwColor:@"#058DFB"] forState:UIControlStateNormal];
- _netButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
- //[_netButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- _netButton.userInteractionEnabled = NO;
- [self.view addSubview:_netButton];
- _netButton.layer.cornerRadius = 12;
- _netButton.layer.borderWidth = 1.5;
- _netButton.layer.borderColor = [UIColor hwColor:@"#058DFB"].CGColor;
- _netButton.layer.masksToBounds = YES;
-
-
- [_netButton mas_makeConstraints:^(MASConstraintMaker *make) {
- //make.width.mas_equalTo(58);
- make.width.mas_equalTo(70);
- make.height.mas_equalTo(24);
- make.left.equalTo(TipImageV.mas_right).offset(5);
- make.bottom.mas_equalTo(TipImageV.mas_bottom).offset(0);
- }];
-
-
- //常用功能
- _MineCommonUsedV = [[MineCommonUsedView alloc] init];
- [self.view addSubview:_MineCommonUsedV];
-
- [_MineCommonUsedV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(TipImageV.mas_bottom).offset(15);
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(210);
- }];
-
-
- KWeakSelf
- _MineCommonUsedV.didClickButtonFun = ^(NSInteger tag) {
- [weakSelf didClickCommonUsedFunBy:tag];
- };
- }
- #pragma mark 点击常用模块模块
- - (void)didClickCommonUsedFunBy:(NSInteger)tag
- {
- if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
- {
- [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
- return;
- }
-
- switch (tag)
- {
- case 10:{//隐私模式
- inputPWDViewController *nextVC = [inputPWDViewController new];
- nextVC.isCheckPwdType = YES;
- [self pushViewController:nextVC animated:YES];
-
- KWeakSelf
- nextVC.didInputRightPwdFun = ^{
- [weakSelf gotoPrivacyModeVCFun];
- };
- }
- break;
- case 11:{//云手机模式
- cloudPhoneModelViewController *nextVC = [cloudPhoneModelViewController new];
- [self pushViewController:nextVC animated:YES];
- }
- break;
- case 12:{//帮助与反馈
-
- CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
- vc.titleStr = NSLocalizedString(@"mine_help_title",nil);
- NSString *url = [[NSString alloc] initWithFormat:@"%@/problemFeedback/#/pages/fileSharing/problem/index?sn=",CloudService];
- vc.webUrl = [[NSString alloc] initWithFormat:@"%@%@",url,ksharedAppDelegate.DeviceThirdIdMod.data.changeSn];
- [self pushViewController:vc animated:YES];
-
- //数据埋点
- [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Help_feedback"];
-
- }
- break;
- case 13:{//更换手机
- TipsQRCodeForChangeDeviceViewController *nextVC = [TipsQRCodeForChangeDeviceViewController new];
- [self pushViewController:nextVC animated:YES];
- break;
- }
-
- case 14:{//联系客服
- customerServiceViewController *vc = [customerServiceViewController new];
- [self pushViewController:vc animated:YES];
- }
- break;
-
- case 15:{//清理缓存
- [self clickClearCacheButtonFun];
- }
- case 16:{//版本信息
- AboutViewController *nextVC = [[AboutViewController alloc] init];
- nextVC.getSysInfo = ^{
- [[webRtcManager shareManager] getSysInfoFun];
- };
- [self pushViewController:nextVC animated:YES];
- }
- break;
-
- case 17:{//新手引导
- CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
- vc.titleStr = NSLocalizedString(@"mine_newuser_title",nil);
- NSString *url = [[NSString alloc] initWithFormat:@"%@/warrantyService/index.html#/novice",CloudService];
- vc.webUrl = url;
- [self pushViewController:vc animated:YES];
- }
- break;
-
- break;
-
- // case 17:{
- // [[iToast makeText:@"点击了注销"] show];
- // }
- // break;
- default:
- break;
- }
- }
- #pragma mark 去设置隐私
- - (void)gotoPrivacyModeVCFun
- {
- privacyModeViewController *nextVC = [[privacyModeViewController alloc] init];
- [self pushViewController:nextVC animated:YES];
- }
- #pragma mark 清理缓存相关
- - (void)clickClearCacheButtonFun
- {
- KWeakSelf
- /*弹窗提示清除缓存*/
- clearCacheAlretViewController *nextVC = [[clearCacheAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_clear_cache",nil)
- msg:NSLocalizedString(@"clear_cache_tip",nil)
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"other_clear",nil) isOkBtnHighlight:YES
- didClickOk:^(BOOL isSelect) {
- [weakSelf handleClearCacheFunWith:isSelect];
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
-
- }
- - (void)handleClearCacheFunWith:(BOOL)isSelectFileTransfer
- {
- [self ClearCommonCacheFun:isSelectFileTransfer];
- //数据埋点
- [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Clear_cache"];
- }
- - (void)ClearCommonCacheFun:(BOOL)isSelectFileTransfer
- {
- NSString *ruiyunLogPath = [NSString stringWithFormat:@"%@/logs/debug_0.log",CachesPatch];
- long logSize1 = [iTools fileSizeAtPath:ruiyunLogPath];
- [[NSFileManager defaultManager] removeItemAtPath:ruiyunLogPath error:nil];
-
- NSString *appLogPath = [NSString stringWithFormat:@"%@/logs/app.log",CachesPatch];
- long logSize2 = [iTools fileSizeAtPath:appLogPath];
-
- [[NSFileManager defaultManager] removeItemAtPath:appLogPath error:nil];
-
- //
- NSString *downLoadThumbnailPath = [NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch];
- long logSize3 = [iTools folderSizeAtPath:downLoadThumbnailPath];
-
- [[NSFileManager defaultManager] removeItemAtPath:downLoadThumbnailPath error:nil];
-
- NSString *downLoadNasDowmPath = [customDownloadCacheManager getFullDirector];
- long logSize4 = [iTools folderSizeAtPath:downLoadNasDowmPath];
-
- [[NSFileManager defaultManager] removeItemAtPath:downLoadNasDowmPath error:nil];
-
- long clearTotal = logSize1 + logSize2 + logSize3 +logSize4 ;
-
- if(isSelectFileTransfer){
- [self clearCacheByFileTransferFun:clearTotal];
- }
- else{
- [self showClearAllTipBy:clearTotal];
- }
-
- }
- - (void)showClearAllTipBy:(long)clearTotal
- {
- long clearTotalK = clearTotal /1024;
-
- NSString *tipStr1 = NSLocalizedString(@"my_set_no_clear_finish",nil);
- NSString *tipStr2 = @"";
-
- if(clearTotalK > 1024*1024){
- tipStr2 = [[NSString alloc] initWithFormat:@"%.02fGB",clearTotalK/1024.0/1024.0];
- }
- else if(clearTotalK > 1024){
- tipStr2 = [[NSString alloc] initWithFormat:@"%.02fMB",clearTotalK/1024.0];
- }
- else //if(clearTotalK > 0)
- {
- tipStr2 = [[NSString alloc] initWithFormat:@"%ldKB",clearTotalK];
- }
-
- NSString *tipfullStr = [[NSString alloc] initWithFormat:@"%@%@",tipStr1,tipStr2];
- //提示语
- [[iToast makeText:tipfullStr] show];
- }
- - (void)clearCacheByFileTransferFun:(long)clearTotal
- {
- //清理图片
- BOOL needReUploadingType = NO;
- NSString *ImagePath = [NSString stringWithFormat:@"%@/Image",CachesPatch];
- long imageAllSize = [iTools folderSizeAtPath:ImagePath];
-
- // if([uploadFileManager shareInstance].curUploadFileDataModel
- // && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeImage
- // && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType == uploadStateUploading){
- //
- // [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateSuspend;
- // needReUploadingType = YES;
- // }
-
- [[NSFileManager defaultManager] removeItemAtPath:ImagePath error:nil];
-
- // if(needReUploadingType){
- // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- // [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateUploading;
- // });
- // }
-
- //清理视频文件
- NSString *videoPath = [NSString stringWithFormat:@"%@/Video",CachesPatch];
- long vide0AllSizeBeforeClear = [iTools folderSizeAtPath:videoPath];
-
- NSString *backupsingVideoName = nil;
- if([nasBackupsManager shareInstance].curPhotosBackupsTaskMod
- && [nasBackupsManager shareInstance].curPhotosBackupsTaskMod.curUploadFileType == uploadFileTypeVideo){
- backupsingVideoName = [nasBackupsManager shareInstance].curPhotosBackupsTaskMod.filename;
- }
-
- NSString *uploadingVideoName = nil;
- // if([uploadFileManager shareInstance].curUploadFileDataModel
- // && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeVideo){
- // uploadingVideoName = [uploadFileManager shareInstance].curUploadFileDataModel.filename;
- // }
-
- if(backupsingVideoName || uploadingVideoName){
-
- NSMutableString *fileName = [NSMutableString new];
-
- if(backupsingVideoName){
- [fileName appendString:backupsingVideoName];
- }
-
- if(uploadingVideoName){
- if(fileName.length > 0){
- [fileName appendString:@"|"];
- }
-
- [fileName appendString:uploadingVideoName];
- }
-
- [self deleteFilesInDirectoryAtPath:videoPath withOutFileName:fileName];
- }
- else{
- [[NSFileManager defaultManager] removeItemAtPath:videoPath error:nil];
- }
-
- long vide0AllSizeAfterClear = [iTools folderSizeAtPath:videoPath];
-
-
- //清理下载中
- NSString *downLoadingPath = [NSString stringWithFormat:@"%@/DownLoadFlie",CachesPatch];
- long downLoadingSizeBeforeClear = [iTools folderSizeAtPath:downLoadingPath];
-
- // NSString *downLoadingFileName = nil;
- // if([downloadManager shareInstance].curDownloadFileModel
- // && ([downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateUploading
- // ||[downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateSuspend)){
- // downLoadingFileName = [[downloadManager shareInstance].curDownloadFileModel getFileNameFun];
- //
- // [self deleteFilesInDirectoryAtPath:downLoadingPath withOutFileName:downLoadingFileName];
- // }
- // else{
- // [[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
- // }
-
- [[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
- long downLoadingSizeAfterClear = [iTools folderSizeAtPath:downLoadingPath];
-
-
- //清理数据库表 完成的
-
- //下载完成
- NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
- NSString *curStr = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateDone]),bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateFail])];
- [where appendString:curStr];
- [couldPhoneFileModel bg_deleteAsync:download_tableName where:where complete:^(BOOL isSuccess) {
- }];
-
- //上传完成
- NSMutableString* where2 = [[NSMutableString alloc] initWithString:@"where "];
- NSString *curStr2 = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateDone]),
- bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateFail])];
- [where2 appendString:curStr2];
-
- [uploadFileDataModel bg_deleteAsync:upLoadFile_image_tableName where:where2 complete:^(BOOL isSuccess) {
- }];
-
- //清理音频播放缓存
- NSString *audioPlayPath = [NSString stringWithFormat:@"%@/%@",DocumentPath,@"playAudioCache"];;
- long audioPlayAllSize = [iTools folderSizeAtPath:audioPlayPath];
- [[NSFileManager defaultManager] removeItemAtPath:audioPlayPath error:nil];
-
- long curTotolSize = (downLoadingSizeBeforeClear - downLoadingSizeAfterClear) + (vide0AllSizeBeforeClear - vide0AllSizeAfterClear) + imageAllSize + clearTotal + audioPlayAllSize;
-
- [self showClearAllTipBy:curTotolSize];
- }
- - (BOOL)deleteFilesInDirectoryAtPath:(NSString *)path withOutFileName:(NSString*)fileNames {
- NSFileManager *fileManager = [NSFileManager defaultManager];
-
- NSArray *fileNameArr = [fileNames componentsSeparatedByString:@"|"];
-
-
- // 使用NSDirectoryEnumerator遍历目录
- NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:path];
- NSString *fileName;
- while ((fileName = [directoryEnumerator nextObject])) {
-
- BOOL canDelType = YES;
-
- for (NSString*noDelfileName in fileNameArr) {
- if([noDelfileName isEqualToString:fileName]){
- canDelType = NO;
- break;
- }
- }
-
- if(canDelType){
- NSString *filePath = [path stringByAppendingPathComponent:fileName];
-
- // 如果是文件,则删除它
- if ([fileManager fileExistsAtPath:filePath]) {
- BOOL success = [fileManager removeItemAtPath:filePath error:nil];
- if (!success) {
- // 如果删除失败,返回NO并处理错误
- return NO;
- }
- }
- }
-
- }
-
- // 所有文件都成功删除,返回YES
- return YES;
- }
- #pragma mark 数据设置
- - (void)setDataFun
- {
- NSString *SNLeftStr = [[NSString alloc] initWithFormat:@"SN:%@",ksharedAppDelegate.DeviceThirdIdMod.data.changeSn];
- NSString *SNMidStr = @" | ";
- NSString *SNRightStr = NSLocalizedString(@"common_copy",nil);
-
- NSString *fullTitle = [[NSString alloc] initWithFormat:@"%@%@%@",SNLeftStr,SNMidStr,SNRightStr];
- NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:fullTitle];
-
- NSRange midRange = NSMakeRange([fullTitle rangeOfString:SNMidStr].location, [fullTitle rangeOfString:SNMidStr].length);
- UIColor *midColor =[UIColor hwColor:@"#828D9A" alpha:1.0];
- [attrStr addAttribute:NSForegroundColorAttributeName value:midColor range:midRange];
-
- NSRange rightRange = NSMakeRange([fullTitle rangeOfString:SNRightStr].location, [fullTitle rangeOfString:SNRightStr].length);
- UIColor *rightColor =[UIColor hwColor:@"#058DFB" alpha:1.0];
- [attrStr addAttribute:NSForegroundColorAttributeName value:rightColor range:rightRange];
-
- _snLabel.attributedText = attrStr;
-
-
- NSString *NetButText = NSLocalizedString(@"mine_net_LAN",nil);
- if(![pingManager shareManager].isPingOk){
- NetButText = NSLocalizedString(@"mine_net_WAN",nil);
- }
-
- RTCDataChannelState state = [webRtcManager shareManager].channelState;
-
- if(state != RTCDataChannelStateOpen
- ||!ksharedAppDelegate.isWebSockLinkOKAginType//断开了
- )
- {
- NetButText = NSLocalizedString(@"mine_net_unLink",nil);
- }
- [_netButton setTitle:NetButText forState:UIControlStateNormal];
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self setDataFun];
-
- [self handelAudioPlayingViewFun];
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
-
- }
- - (void)pushViewController:(UIViewController*)vc animated:(BOOL)animated
- {
- [self.navigationController pushViewController:vc animated:animated];
- }
- #pragma mark 处理音频播放中的视图状态
- - (void)handelAudioPlayingViewFun
- {
- audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
-
- if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
- ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying
- ||[DFPlayer sharedPlayer].state == DFPlayerStatePause){//播放中
-
- [self showAudioPlayingViewFun];
- }
- else{
- [self hideAudioPlayingViewFun];
- }
-
- KWeakSelf
- audioPlayingV.didClickButtonFun = ^(NSInteger tag) {
- if(tag == 1){
- [weakSelf hideAudioPlayingViewFun];
- }
- else if(tag == 5){
- [weakSelf AudioPlayingGotoAudioPlayerVCFun];
- }
- };
- }
- - (void)AudioPlayingGotoAudioPlayerVCFun{
- audioPlayerViewController *vc = [audioPlayerViewController new];
- vc.isfirstEnterType = NO;
- [self.navigationController pushViewController:vc animated:YES];
- }
-
- #pragma mark 显示音频播放中的视图
- - (void)showAudioPlayingViewFun
- {
- audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
- [self.view addSubview:audioPlayingV];
-
- if([DFPlayer sharedPlayer].state == DFPlayerStatePlaying){
- [audioPlayingV startRotatingImage];
- }
- else if ([DFPlayer sharedPlayer].state == DFPlayerStatePause){
- [audioPlayingV stopRotatingImage];
- }
-
- [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(49);
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.bottom.mas_equalTo(-TABBARHEIGHT);
- }];
-
- }
- #pragma mark 隐藏音频播放中的视图
- - (void)hideAudioPlayingViewFun
- {
- // audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
- // [audioPlayingV removeFromSuperview];
- }
- #pragma mark 点击PC 扫码登录
- - (void)didClickButtonFun:(UIButton*)but
- {
-
- NSInteger tag = but.tag;
-
- if(tag == 100){
- //test code
- // [self getPCloginFun];
-
- scanToPCLoginViewController *nextVC = [scanToPCLoginViewController new];
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- else if(tag == 1){
- [self copySnFun];
- }
- }
- #pragma mark 复制SN
- - (void)copySnFun
- {
- NSString *snStr = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
- UIPasteboard * Pasteboard = [UIPasteboard generalPasteboard];
- Pasteboard.string = snStr;
-
- NSString *tipStr = NSLocalizedString(@"sn_copy_suc",nil);
- [[iToast makeText:tipStr] show];
- }
- #pragma mark PC 获取码登录
- -(void)getPCloginFun
- {
- NSMutableDictionary *paraDict = [NSMutableDictionary new];
-
- KWeakSelf
- [[netWorkManager shareInstance] CommonGetWithCallBackCode:@"/box/login/addAndGetOne" Parameters:paraDict success:^(id _Nonnull responseObject){
- SuperModel *ShareMarkMod = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
- if(ShareMarkMod){
- [weakSelf scanToPCloginFunWithID:responseObject[@"data"][@"boxLoginId"]];
- }
-
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- #pragma mark PC 扫码登录
- -(void)scanToPCloginFunWithID:(NSString*)idStr
- {
- NSString *changSN = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
- NSMutableDictionary *paraDict = [NSMutableDictionary new];
- [paraDict setValue:@1 forKey:@"status"];
- [paraDict setValue:idStr forKey:@"boxLoginId"];
- [paraDict setValue:changSN forKey:@"sn"];
-
- KWeakSelf
- [[netWorkManager shareInstance] CommonPostCallBackCode:updatePCLoginStateFun Parameters:paraDict success:^(id _Nonnull responseObject){
- SuperModel *curModel = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
-
- if(curModel && curModel.status == 0){
- [weakSelf gotoNextVCFunWithID:idStr];
- }
- else
- {
- if(curModel.msg){
- [[iToast makeText:curModel.msg] show];
- }
- else{
- [[iToast makeText:@"扫码信息错误"] show];
- }
-
- [weakSelf.navigationController popViewControllerAnimated:YES];
- }
-
- } failure:^(NSError * _Nonnull error) {
- //[[iToast makeText:@"扫码信息错误"] show];
- [weakSelf.navigationController popViewControllerAnimated:YES];
- }];
- }
- #pragma mark 跳转下个界面
- - (void)gotoNextVCFunWithID:(NSString*)idStr
- {
- PCLoginViewController *nextVC = [PCLoginViewController new];
- nextVC.loginIdString = idStr;
- [self.navigationController pushViewController:nextVC animated:YES];
- }
- #pragma mark Pc登录页面Pop出来
- - (void)PCLoginDidPopFun
- {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self showTabbarFun];
- });
- }
- @end
|