From 7ab063d5c658143b5bce7ca8e5ae9bfc700bb1d8 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 01 二月 2021 18:22:29 +0800
Subject: [PATCH] 2021-02-01 1.更新

---
 EZSDK/EZSDK/EZSDK.m |  272 ++++++++++++++++++++++++-----------------------------
 1 files changed, 123 insertions(+), 149 deletions(-)

diff --git a/EZSDK/EZSDK/EZSDK.m b/EZSDK/EZSDK/EZSDK.m
index 02954b8..700013e 100644
--- a/EZSDK/EZSDK/EZSDK.m
+++ b/EZSDK/EZSDK/EZSDK.m
@@ -20,11 +20,6 @@
 #import "EZDeviceTableViewController.h"
 #import "EZHCNetDeviceSDK.h"
 
-
-#define CURR_LANG ([[NSLocale preferredLanguages] objectAtIndex:0])
-#define LanguageIsChinese ([CURR_LANG rangeOfString:@"zh-Hans"].location != NSNotFound)
-
-
 @implementation EZSDK
 
 /**
@@ -35,8 +30,8 @@
 {
     static BOOL isHavelibInit=NO;
     if (!isHavelibInit) {
-//        isHavelibInit=YES;
-        NSLog(@"绗竴娆″垵濮嬪寲钀ょ煶搴�");
+        //        isHavelibInit=YES;
+        //        NSLog(@"绗竴娆″垵濮嬪寲钀ょ煶搴�");
         if (!LanguageIsChinese) {
             //娴峰鐗�
             isHavelibInit = [EZGlobalSDK initLibWithAppKey:globalAppKey];
@@ -53,6 +48,113 @@
     }
     return isHavelibInit;
 }
+
+/**
+ 璁剧疆SDK鐨刟ccessToken
+ */
++(void)setEZAccessToken:(NSString *) accessToken
+{
+    [[GlobalKit shareKit] setAccessToken:accessToken];
+    [EZOPENSDK setAccessToken:accessToken];
+}
+
+
+
+//鑾峰彇褰撳墠灞忓箷鏄剧ず鐨剉iewcontroller   (杩欓噷闈㈣幏鍙栫殑鐩稿綋浜巖ootViewController)
++(UINavigationController *)getCurrentVC
+{
+    UIWindow * window = [[UIApplication sharedApplication] keyWindow];
+    if (window.windowLevel != UIWindowLevelNormal)
+    {
+        NSArray *windows = [[UIApplication sharedApplication] windows];
+        for(UIWindow * tmpWin in windows)
+        {
+            if (tmpWin.windowLevel == UIWindowLevelNormal)
+            {
+                window = tmpWin;
+                break;
+            }
+        }
+    }
+    
+    return  (UINavigationController *)window.rootViewController;
+}
+
+
+/**
+ 鐩存帴璺宠浆鍒拌悿鐭虫憚鍍忓ご鍒楄〃
+ */
++(void)go2EZvizMonitor
+{
+    //    NSLog(@"go2EZvizMonitor");
+    //鑾峰彇EZMain鐨剆troyboard鏂囦欢
+    UIStoryboard *ezMainStoryboard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
+    //鑾峰彇EZMain.storyboard鐨勫疄渚媀iewController--鑾峰彇鎽勫儚澶村垪琛�
+    EZDeviceTableViewController *instanceVC = [ezMainStoryboard instantiateViewControllerWithIdentifier:@"EZCameraList"];
+    //push鎽勫儚澶村垪琛ㄧ殑viewController
+    [[self getCurrentVC] setNavigationBarHidden:NO];
+    //        NSLog(@"willpush********");
+    [[self getCurrentVC] pushViewController:instanceVC animated:YES];
+    //        NSLog(@"had pushed********");
+}
+
+/**
+ 璺宠浆娣诲姞娣诲姞璁惧
+ */
++(void)addEzvizMonitor
+{
+    //    NSLog(@"娣诲姞鎽勫儚澶�");
+    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
+        UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"AddDevice" bundle:nil];
+        EZAddByQRCodeViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"AddByQRCode"];
+        [[self getCurrentVC] setNavigationBarHidden:NO];
+        [[self getCurrentVC] pushViewController:rootViewController animated:YES];
+    } else {
+        //        [UIView dd_showMessage:@"iOS 7.0浠ヤ笅鎵爜鍔熻兘璇疯嚜琛屽疄鐜�"];
+        NSLog(@"iOS 7.0浠ヤ笅鎵爜鍔熻兘璇疯嚜琛屽疄鐜�");
+    }
+    
+}
+
+/**
+ 鏌ョ湅瑙嗛鐩戞帶鐩存挱
+ */
++(void)Play:(NSObject*)deviceInfo
+{
+    UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
+    EZLivePlayViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"EZLivePlayViewController"];
+    //        NSLog(@"play--iphone--rootViewController");
+    rootViewController.deviceInfo=(EZDeviceInfo *)deviceInfo;
+    NSLog(@"play--iphone--deviceName -%@",rootViewController.deviceInfo.deviceName);
+    //        rootViewController.cameraIndex=0;
+    [[self getCurrentVC] setNavigationBarHidden:NO];
+    [[self getCurrentVC] pushViewController:rootViewController animated:YES];
+}
+
+/**
+ 鎵撳紑鎽勫儚澶磋缃〉闈�
+ */
++(void)setting:(NSObject*)deviceInfo
+{
+    UIStoryboard *settingStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
+    EZSettingViewController *settingVC=[settingStoryBoard instantiateViewControllerWithIdentifier:@"EZSettingViewController"];
+    settingVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
+    [[self getCurrentVC] setNavigationBarHidden:NO];
+    [[self getCurrentVC] pushViewController:settingVC animated:YES];
+}
+
+/**
+ 鍥炴斁鎾斁鍘嗗彶
+ */
++(void)playBackVideo:(NSObject*)deviceInfo
+{
+    UIStoryboard *playBackStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
+    EZPlaybackViewController *playBackVC=[playBackStoryBoard instantiateViewControllerWithIdentifier:@"EZPlaybackViewController"];
+    playBackVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
+    [[self getCurrentVC] setNavigationBarHidden:NO];
+    [[self getCurrentVC] pushViewController:playBackVC animated:YES];
+}
+
 
 //+(void)MonitorPushMessage:(NSString *)MonitorType ID:(NSString *)ID
 //{
@@ -122,68 +224,6 @@
 //    return ICommons;
 //}
 
-//鑾峰彇褰撳墠灞忓箷鏄剧ず鐨剉iewcontroller   (杩欓噷闈㈣幏鍙栫殑鐩稿綋浜巖ootViewController)
-+(UINavigationController *)getCurrentVC
-{
-    UIWindow * window = [[UIApplication sharedApplication] keyWindow];
-    if (window.windowLevel != UIWindowLevelNormal)
-    {
-        NSArray *windows = [[UIApplication sharedApplication] windows];
-        for(UIWindow * tmpWin in windows)
-        {
-            if (tmpWin.windowLevel == UIWindowLevelNormal)
-            {
-                window = tmpWin;
-                break;
-            }
-        }
-    }
-   
-   return  (UINavigationController *)window.rootViewController;
-}
-
-//+(void)login
-//{
-//    if ([GlobalKit shareKit].accessToken)
-//    {
-//        [EZOPENSDK setAccessToken:[GlobalKit shareKit].accessToken];
-//        NSLog(@"login---1");
-//    }
-//    else
-//    {
-//        [EZOPENSDK openLoginPage:^(EZAccessToken *accessToken) {
-//            [[GlobalKit shareKit] setAccessToken:accessToken.accessToken];
-//            [EZOPENSDK setAccessToken:accessToken.accessToken];
-//            NSLog(@"login---2");
-//        }];
-//    }
-//}
-
-+(void)go2EZvizMonitor
-{
-        NSLog(@"go2EZvizMonitor");
-//    if (isPad) {
-//        //鑾峰彇EZMain鐨剆troyboard鏂囦欢
-//        UIStoryboard *ezMainStoryboard = [UIStoryboard storyboardWithName:@"EZMainForIPad" bundle:nil];
-//        //鑾峰彇EZMain.storyboard鐨勫疄渚媀iewController--鑾峰彇鎽勫儚澶村垪琛�
-//        EZDeviceTableViewController *instanceVC = [ezMainStoryboard instantiateViewControllerWithIdentifier:@"EZCameraList"];
-//        //push鎽勫儚澶村垪琛ㄧ殑viewController
-//        [[self getCurrentVC] setNavigationBarHidden:NO];
-//        [[self getCurrentVC] pushViewController:instanceVC animated:YES];
-//    }else{
-    
-        //鑾峰彇EZMain鐨剆troyboard鏂囦欢
-        UIStoryboard *ezMainStoryboard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
-        //鑾峰彇EZMain.storyboard鐨勫疄渚媀iewController--鑾峰彇鎽勫儚澶村垪琛�
-        EZDeviceTableViewController *instanceVC = [ezMainStoryboard instantiateViewControllerWithIdentifier:@"EZCameraList"];
-        //push鎽勫儚澶村垪琛ㄧ殑viewController
-        [[self getCurrentVC] setNavigationBarHidden:NO];
-        NSLog(@"willpush********");
-        [[self getCurrentVC] pushViewController:instanceVC animated:YES];
-        NSLog(@"had pushed********");
-//    }
-
-}
 
 //+(NSArray *)getDeviceList:(int)pageIndex :(int)pageSize
 //{
@@ -221,87 +261,21 @@
 //    return deviceListaArray  ;
 //}
 
-+(void)addEzvizMonitor
-{
-    NSLog(@"娣诲姞鎽勫儚澶�");
-    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
-        UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"AddDevice" bundle:nil];
-        EZAddByQRCodeViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"AddByQRCode"];
-        [[self getCurrentVC] setNavigationBarHidden:NO];
-        [[self getCurrentVC] pushViewController:rootViewController animated:YES];
-    } else {
-//        [UIView dd_showMessage:@"iOS 7.0浠ヤ笅鎵爜鍔熻兘璇疯嚜琛屽疄鐜�"];
-        NSLog(@"iOS 7.0浠ヤ笅鎵爜鍔熻兘璇疯嚜琛屽疄鐜�");
-    }
-
-}
-
-+(void)Play:(NSObject*)deviceInfo
-{
-//    if (isPad) {
-//        NSLog(@"play--ipad--");
-//        UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"EZMainForIPad" bundle:nil];
-//        EZLivePlayViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"EZLivePlayViewController"];
-//        rootViewController.deviceInfo=(EZDeviceInfo *)deviceInfo;
-//        rootViewController.cameraIndex=0;
-//        [[self getCurrentVC] setNavigationBarHidden:NO];
-//        [[self getCurrentVC] pushViewController:rootViewController animated:YES];
-//    }else{
-        NSLog(@"play--iphone--1225");
-        UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
-        EZLivePlayViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"EZLivePlayViewController"];
-        NSLog(@"play--iphone--rootViewController");
-        rootViewController.deviceInfo=(EZDeviceInfo *)deviceInfo;
-         NSLog(@"play--iphone--deviceName -%@",rootViewController.deviceInfo.deviceName);
-//        rootViewController.cameraIndex=0;
-        [[self getCurrentVC] setNavigationBarHidden:NO];
-        [[self getCurrentVC] pushViewController:rootViewController animated:YES];
+//+(void)login
+//{
+//    if ([GlobalKit shareKit].accessToken)
+//    {
+//        [EZOPENSDK setAccessToken:[GlobalKit shareKit].accessToken];
+//        NSLog(@"login---1");
 //    }
-
-
-}
-
-
-+(void)setting:(NSObject*)deviceInfo
-{
-//    if (isPad) {
-//        UIStoryboard *settingStoryBoard=[UIStoryboard storyboardWithName:@"EZMainForIPad" bundle:nil];
-//        EZSettingViewController *settingVC=[settingStoryBoard instantiateViewControllerWithIdentifier:@"EZSettingViewController"];
-//        settingVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
-//        [[self getCurrentVC] setNavigationBarHidden:NO];
-//        [[self getCurrentVC] pushViewController:settingVC animated:YES];
-//    }else{
-
-        UIStoryboard *settingStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
-        EZSettingViewController *settingVC=[settingStoryBoard instantiateViewControllerWithIdentifier:@"EZSettingViewController"];
-        settingVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
-        [[self getCurrentVC] setNavigationBarHidden:NO];
-        [[self getCurrentVC] pushViewController:settingVC animated:YES];
+//    else
+//    {
+//        [EZOPENSDK openLoginPage:^(EZAccessToken *accessToken) {
+//            [[GlobalKit shareKit] setAccessToken:accessToken.accessToken];
+//            [EZOPENSDK setAccessToken:accessToken.accessToken];
+//            NSLog(@"login---2");
+//        }];
 //    }
-
-
-}
-
-+(void)playBackVideo:(NSObject*)deviceInfo
-{
-
-//    if (isPad) {
-//        UIStoryboard *playBackStoryBoard=[UIStoryboard storyboardWithName:@"EZMainForIPad" bundle:nil];
-//        EZPlaybackViewController *playBackVC=[playBackStoryBoard instantiateViewControllerWithIdentifier:@"EZPlaybackViewController"];
-//        playBackVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
-//        playBackVC.cameraIndex=0;
-//        [[self getCurrentVC] setNavigationBarHidden:NO];
-//        [[self getCurrentVC] pushViewController:playBackVC animated:YES];
-//    }else{
-        UIStoryboard *playBackStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
-        EZPlaybackViewController *playBackVC=[playBackStoryBoard instantiateViewControllerWithIdentifier:@"EZPlaybackViewController"];
-        playBackVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
-//        playBackVC.cameraIndex=0;
-        [[self getCurrentVC] setNavigationBarHidden:NO];
-        [[self getCurrentVC] pushViewController:playBackVC animated:YES];
-//    }
-
-}
-
+//}
 
 @end

--
Gitblit v1.8.0