Demo/EZOpensdk_iOS_4.15.1_build20201104/SDK/libEZOpenSDK.aBinary files differ
EZDemo/HDLEZDemo/HDLEZDemo.xcodeproj/project.pbxproj
@@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ 83780B092B58F42500E6DE3F /* libiconv.2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 83780B082B58F42500E6DE3F /* libiconv.2.tbd */; }; 83780B0B2B58F45500E6DE3F /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 83780B0A2B58F45500E6DE3F /* libiconv.tbd */; }; AE31FE2129CC31F200678568 /* EZOpenSDKFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE31FE2029CC31F200678568 /* EZOpenSDKFramework.framework */; }; AE31FE2229CC321500678568 /* EZOpenSDKFramework.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = AE31FE2029CC31F200678568 /* EZOpenSDKFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; AEC1E3F429B6DDC200A00548 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEC1E3F329B6DDC200A00548 /* NetworkExtension.framework */; }; @@ -33,7 +35,6 @@ AEDD956229B0555400EAA2CA /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEDD956129B0555400EAA2CA /* CoreTelephony.framework */; }; AEDD956429B0556000EAA2CA /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEDD956329B0556000EAA2CA /* SystemConfiguration.framework */; }; AEDD956629B0557000EAA2CA /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AEDD956529B0557000EAA2CA /* libc++.tbd */; }; AEDD956829B0557C00EAA2CA /* libiconv.2.4.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AEDD956729B0557C00EAA2CA /* libiconv.2.4.0.tbd */; }; AEDD956A29B0558400EAA2CA /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AEDD956929B0558400EAA2CA /* libbz2.tbd */; }; AEDD956C29B0558D00EAA2CA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AEDD956B29B0558D00EAA2CA /* libz.tbd */; }; AEDD957129B0650000EAA2CA /* EZSupportViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AEDD956D29B0650000EAA2CA /* EZSupportViewController.xib */; }; @@ -74,6 +75,8 @@ 835636642A3802FC009A992A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/AddDevice.strings"; sourceTree = "<group>"; }; 835636652A3802FC009A992A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/EZMain.strings"; sourceTree = "<group>"; }; 835636662A3802FC009A992A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; }; 83780B082B58F42500E6DE3F /* libiconv.2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.2.tbd; path = usr/lib/libiconv.2.tbd; sourceTree = SDKROOT; }; 83780B0A2B58F45500E6DE3F /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; AE31FE2029CC31F200678568 /* EZOpenSDKFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = EZOpenSDKFramework.framework; sourceTree = "<group>"; }; AEC1E3F329B6DDC200A00548 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; }; AEC1E40629B839E700A00548 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; }; @@ -201,9 +204,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 83780B0B2B58F45500E6DE3F /* libiconv.tbd in Frameworks */, 83780B092B58F42500E6DE3F /* libiconv.2.tbd in Frameworks */, AEDD956C29B0558D00EAA2CA /* libz.tbd in Frameworks */, AEDD956A29B0558400EAA2CA /* libbz2.tbd in Frameworks */, AEDD956829B0557C00EAA2CA /* libiconv.2.4.0.tbd in Frameworks */, AEDD956629B0557000EAA2CA /* libc++.tbd in Frameworks */, AEDD956429B0556000EAA2CA /* SystemConfiguration.framework in Frameworks */, AEDD956229B0555400EAA2CA /* CoreTelephony.framework in Frameworks */, @@ -388,6 +392,8 @@ AEDD955029B0550500EAA2CA /* Frameworks */ = { isa = PBXGroup; children = ( 83780B0A2B58F45500E6DE3F /* libiconv.tbd */, 83780B082B58F42500E6DE3F /* libiconv.2.tbd */, AEE4704629C0460A00480163 /* FQDateTimeSDK.framework */, AEC1E3F329B6DDC200A00548 /* NetworkExtension.framework */, AEDD956B29B0558D00EAA2CA /* libz.tbd */, @@ -723,7 +729,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = C9G3CHFW76; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = BVTA78PRYA; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -736,12 +742,15 @@ INFOPLIST_KEY_NSCameraUsageDescription = "访问摄像头"; INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "需要使用定位权限用于wifi配网"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "需要使用定位权限用于wifi配网"; INFOPLIST_KEY_NSMicrophoneUsageDescription = "麦克风"; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "此 App 需要您的同意才能访问相册权限"; INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "此 App 需要您的同意才能读取媒体资料库"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; IPHONEOS_DEPLOYMENT_TARGET = 9.1; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -754,10 +763,10 @@ ); MARKETING_VERSION = 1.0; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = com.hdl.onpro1; PRODUCT_BUNDLE_IDENTIFIER = com.hdl.home; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "HDLEZDemo-Development"; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "HDLHome20230925-dev"; SWIFT_EMIT_LOC_STRINGS = YES; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_WORKSPACE = YES; @@ -774,7 +783,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = C9G3CHFW76; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = BVTA78PRYA; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -787,12 +796,15 @@ INFOPLIST_KEY_NSCameraUsageDescription = "访问摄像头"; INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "需要使用定位权限用于wifi配网"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "需要使用定位权限用于wifi配网"; INFOPLIST_KEY_NSMicrophoneUsageDescription = "麦克风"; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "此 App 需要您的同意才能访问相册权限"; INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "此 App 需要您的同意才能读取媒体资料库"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; IPHONEOS_DEPLOYMENT_TARGET = 9.1; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -805,10 +817,10 @@ ); MARKETING_VERSION = 1.0; OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = com.hdl.onpro1; PRODUCT_BUNDLE_IDENTIFIER = com.hdl.home; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "HDLEZDemo-Development"; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "HDLHome20230925-dev"; SWIFT_EMIT_LOC_STRINGS = YES; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_WORKSPACE = YES; EZDemo/HDLEZDemo/HDLEZDemo/AppDelegate.m
@@ -25,10 +25,10 @@ // Override point for customization after application launch. [[EZSDK sharedInstance] initLibWithAppKey:@"1aa98a90489b4838b966b57018b4b04b" globalAppKey:@"1aa98a90489b4838b966b57018b4b04b"]; // [[EZSDK sharedInstance] initLibWithAppKey:@"941b1b72b6294998acfd36c14931b675" globalAppKey:@"941b1b72b6294998acfd36c14931b675"]; [[EZSDK sharedInstance] setHDlAccessToken:@"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI1N2YyOWRlNWNhNWY0MjAwOTFkMmM2NDdmMDcwNmQ5YiIsImNvbXBhbnlJZCI6IjAiLCJyb2xlIjoiIiwiaGVhZGVyUHJlZml4IjoiQmVhcmVyICIsInRlbmFudElkIjoiMjAiLCJ1c2VyVHlwZSI6IlVTRVJfQyIsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJOYW1lIjoic3hjXzAwNCIsInVzZXJEYXRhUmlnaHQiOiIxIiwib3BlbkFwcGxpY2F0aW9uSWQiOiIwIiwidXNlcklkIjoiMTU3NTA1OTM5MDAzMjYyNTY2NiIsImV4cCI6MTY5MDM0NjIxMiwibmJmIjoxNjkwMzM5MDEyfQ.CE_qD_vFzPHb_k0fXaLWNq85aLuposP6aubZLhJpc-CbIsAYGUUeiDC_fXResD9YIvCQLmCWDVGrFxabSF54uOzNX_-BXPqGvgRnmSMHeVCZ69BDKu9a3fm6fSc3LrVP_pPQ74O8yBLNjzsPWY7LI4twUhj5JazzN_vS3d71QhQ" refreshToken:@"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiIxMzI5OTExZGY1YzU0NzQ4ODFhZDg5MDdkY2I2ZDA1OCIsImNvbXBhbnlJZCI6IjAiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidGVuYW50SWQiOiIyMCIsInRva2VuVHlwZSI6InJlZnJlc2hfdG9rZW4iLCJvcGVuQXBwbGljYXRpb25JZCI6IjAiLCJ1c2VySWQiOiIxNTc1MDU5MzkwMDMyNjI1NjY2IiwiZXhwIjoxNjkwOTQzODEyLCJuYmYiOjE2OTAzMzkwMTJ9.XXd0-YKJER6Oabs-fqTNgi1quCJxIJmvfBQLtke1FnXZo2qp5x-VFYM1dDKhmdeo3v-bPClIfKl_Lng0HWbnNz8YmIrMt5S_uIkwntqpuCHmnnX2Jjcf0TyhO8NhT7XYIMcCUnJIb4A9L_sY4Lt6s_Cu7GCt5fw8QYiDt9OezPo"]; [[EZSDK sharedInstance] setRequestHttpsHostAndPlatform:@"https://test-gz.hdlcontrol.com" platform:1 homeId:@"1683653084909764610"]; [[EZSDK sharedInstance] setHDlAccessToken:@"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI3ZWRmMWFkMTQzN2Y0NjI0YTQxMWRiMDRmODVjNTRiZSIsImNvbXBhbnlJZCI6IjAiLCJyb2xlIjoiIiwiaGVhZGVyUHJlZml4IjoiQmVhcmVyICIsInRlbmFudElkIjoiMjAiLCJ1c2VyVHlwZSI6IlVTRVJfQyIsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJOYW1lIjoiS2FlZGUiLCJ1c2VyRGF0YVJpZ2h0IjoiMSIsIm9wZW5BcHBsaWNhdGlvbklkIjoiMCIsInVzZXJJZCI6IjEzNTAyODA5OTU5OTg4NjMzNjEiLCJleHAiOjE3MDU1NTQ5NjMsIm5iZiI6MTcwNTU0Nzc2M30.bkW07D2YnCMFw4MBvsDc0OqZJbB-w-NV9zVLJGyjBEU9ixp3TueFj76fPPUDn1XfMzigzXb74oPcFq9lIDkNkIBvSCM6YQttN9X4Y3O5JWcdMD5VQZBrxgLfzDdCjFZ2nwR5SlaixwEgYASFh_9jaBUqjyXyJ1pKFlCEwB2jVU0" refreshToken:@"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmNzA3OGQ0NTdlYmI0OWQ3YWJmZWIwMzZlNWYzMWQwMSIsImNvbXBhbnlJZCI6IjAiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidGVuYW50SWQiOiIyMCIsInRva2VuVHlwZSI6InJlZnJlc2hfdG9rZW4iLCJvcGVuQXBwbGljYXRpb25JZCI6IjAiLCJ1c2VySWQiOiIxMzUwMjgwOTk1OTk4ODYzMzYxIiwiZXhwIjoxNzA2MTUyNTYzLCJuYmYiOjE3MDU1NDc3NjN9.j7QjPk7vtsESSUHLq9t7FBUpCxfb63rMihs3yGF4Bx38iEqzSTzRRrJuZdFQC_oyJeBqbzXR5Wp7NFLdwhAIu_MHVJFDcm_I7e9NFKtdqMKdVXy_XgB8xe5Nr8jny2XtYBN4XfIhvCXLj8_O9_l498_lZm0ucfJOfS58oiGTjxo"]; [[EZSDK sharedInstance] setRequestHttpsHostAndPlatform:@"https://test-gz.hdlcontrol.com" platform:1 homeId:@"1674604669353717761"]; // [[EZSDK sharedInstance] setRequestHttpsHostAndPlatform:@"https://nearest.hdlcontrol.com" platform:1 homeId:@"1546324800135176193"]; [[EZSDK sharedInstance] setEZAccessToken:@"ra.d3159vy1d0oss4r0bfewp28d0l88hsdt-8oj76pwpx4-1x1hz7a-5e0llpjhh"]; [[EZSDK sharedInstance] setEZAccessToken:@"ra.ag6fktccckc2gxl84mu40e1o417agh8u-231ke8chyz-0vkjf4x-nqw225sxi"]; // [[EZSDK sharedInstance] setEZAccessToken:@"ra.3hkirwcadrpfmaa89wep99io3wto4yds-7zptb10d20-1wxg4f3-ygiojudee"]; EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/Playback/preview_enlarge_full.imageset/Contents.json
New file @@ -0,0 +1,22 @@ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "filename" : "preview_enlarge_full@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "preview_enlarge_full@3x.png", "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/Playback/preview_enlarge_full.imageset/preview_enlarge_full@2x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/Playback/preview_enlarge_full.imageset/preview_enlarge_full@3x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/Playback/preview_enlarge_full_btn_sel.imageset/Contents.json
New file @@ -0,0 +1,22 @@ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "filename" : "preview_enlarge_full_btn_sel@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "preview_enlarge_full_btn_sel@3x.png", "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/Playback/preview_enlarge_full_btn_sel.imageset/preview_enlarge_full_btn_sel@2x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/Playback/preview_enlarge_full_btn_sel.imageset/preview_enlarge_full_btn_sel@3x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_detection_normal.imageset/Contents.json
New file @@ -0,0 +1,22 @@ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "filename" : "hdl_ez_detection_normal@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "hdl_ez_detection_normal@3x.png", "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_detection_normal.imageset/hdl_ez_detection_normal@2x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_detection_normal.imageset/hdl_ez_detection_normal@3x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_detection_selected.imageset/Contents.json
New file @@ -0,0 +1,22 @@ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "filename" : "hdl_ez_detection_selected@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "hdl_ez_detection_selected@3x.png", "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_detection_selected.imageset/hdl_ez_detection_selected@2x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_detection_selected.imageset/hdl_ez_detection_selected@3x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_msg_answer.imageset/Contents.json
New file @@ -0,0 +1,22 @@ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "filename" : "hdl_ez_msg_answer@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "hdl_ez_msg_answer@3x.png", "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_msg_answer.imageset/hdl_ez_msg_answer@2x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_msg_answer.imageset/hdl_ez_msg_answer@3x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_msg_no_answer.imageset/Contents.json
New file @@ -0,0 +1,22 @@ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "filename" : "hdl_ez_msg_no_answer@2x.png", "idiom" : "universal", "scale" : "2x" }, { "filename" : "hdl_ez_msg_no_answer@3x.png", "idiom" : "universal", "scale" : "3x" } ], "info" : { "author" : "xcode", "version" : 1 } } EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_msg_no_answer.imageset/hdl_ez_msg_no_answer@2x.png
EZDemo/HDLEZDemo/HDLEZDemo/Assets.xcassets/hdl_ez_msg_no_answer.imageset/hdl_ez_msg_no_answer@3x.png
EZDemo/HDLEZDemo/HDLEZDemo/Info.plist
@@ -2,18 +2,14 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>privacy</key> <string></string> <key>NSMicrophoneUsageDescription</key> <string>麦克风</string> <key>NSPhotoLibraryUsageDescription</key> <string>此 App 需要您的同意才能读取媒体资料库</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>此 App 需要您的同意才能访问相册权限</string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> <key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key> <true/> <key>privacy</key> <string></string> </dict> </plist> EZDemo/HDLEZDemo/HDLEZDemo/libEZSDK.aBinary files differ
EZDemo/HDLEZDemo/HDLEZDemo/resources/en.lproj/Localizable.strings
@@ -120,6 +120,7 @@ "device_full_scene_exit_full" = "Exit"; "device_callout_answer" = "Answered"; "device_callout_no_answer" = "Missed"; "device_detection_type" = "Detection type"; "dmessage_title"="Message"; "message_read"="Mark as Read"; EZDemo/HDLEZDemo/HDLEZDemo/resources/zh-Hans.lproj/Localizable.strings
@@ -80,6 +80,7 @@ "device_full_scene_exit_full" = "退出全屏"; "device_callout_answer" = "已接"; "device_callout_no_answer" = "未接"; "device_detection_type" = "检测类型"; "device_open"="开门"; "device_open_success"="开门成功!"; EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.aBinary files differ
EZSDK.IOS/EZSDK.IOS/Properties/AssemblyInfo.cs
@@ -25,7 +25,7 @@ // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.6.9")] [assembly: AssemblyVersion("1.7.0")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. EZSDK/EZSDK.xcodeproj/project.pbxproj
@@ -8,7 +8,12 @@ /* Begin PBXBuildFile section */ 830957C32A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 830957C22A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m */; }; 8318A0DA2A8A591D0012B894 /* FCFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8318A0D92A8A591D0012B894 /* FCFileManager.m */; }; 8357F1DE2A42DEC000936D2E /* HDLEZVideoDoorToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8357F1DD2A42DEC000936D2E /* HDLEZVideoDoorToolView.m */; }; 83879A852A7DE42900E10A81 /* HDLEZDetectionTypeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83879A842A7DE42900E10A81 /* HDLEZDetectionTypeViewController.m */; }; 83879A882A7DE49900E10A81 /* HDLEZDetectionTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83879A872A7DE49900E10A81 /* HDLEZDetectionTypeView.m */; }; 83879A8B2A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 83879A8A2A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.m */; }; 83879A8E2A7DEEC500E10A81 /* HDLEZDetectionTypeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 83879A8D2A7DEEC500E10A81 /* HDLEZDetectionTypeModel.m */; }; 83D69FFA2A47D32A00871258 /* HDLEZVideoQualityBoxView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D69FF92A47D32A00871258 /* HDLEZVideoQualityBoxView.m */; }; 83EE503D2A41C9BA0006435D /* HDLEZOPButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 83EE503C2A41C9BA0006435D /* HDLEZOPButton.m */; }; AE31FE1F29CC2D2200678568 /* EZOpenSDKFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE31FE1E29CC2D2200678568 /* EZOpenSDKFramework.framework */; platformFilter = ios; }; @@ -190,8 +195,18 @@ /* Begin PBXFileReference section */ 830957C12A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZVideoDoorMsgCell.h; sourceTree = "<group>"; }; 830957C22A3AE3E1002B68AA /* HDLEZVideoDoorMsgCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZVideoDoorMsgCell.m; sourceTree = "<group>"; }; 8318A0D82A8A591D0012B894 /* FCFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FCFileManager.h; sourceTree = "<group>"; }; 8318A0D92A8A591D0012B894 /* FCFileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FCFileManager.m; sourceTree = "<group>"; }; 8357F1DC2A42DEC000936D2E /* HDLEZVideoDoorToolView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZVideoDoorToolView.h; sourceTree = "<group>"; }; 8357F1DD2A42DEC000936D2E /* HDLEZVideoDoorToolView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZVideoDoorToolView.m; sourceTree = "<group>"; }; 83879A832A7DE42900E10A81 /* HDLEZDetectionTypeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZDetectionTypeViewController.h; sourceTree = "<group>"; }; 83879A842A7DE42900E10A81 /* HDLEZDetectionTypeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZDetectionTypeViewController.m; sourceTree = "<group>"; }; 83879A862A7DE49900E10A81 /* HDLEZDetectionTypeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZDetectionTypeView.h; sourceTree = "<group>"; }; 83879A872A7DE49900E10A81 /* HDLEZDetectionTypeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZDetectionTypeView.m; sourceTree = "<group>"; }; 83879A892A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZDetectionTypeCell.h; sourceTree = "<group>"; }; 83879A8A2A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZDetectionTypeCell.m; sourceTree = "<group>"; }; 83879A8C2A7DEEC500E10A81 /* HDLEZDetectionTypeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZDetectionTypeModel.h; sourceTree = "<group>"; }; 83879A8D2A7DEEC500E10A81 /* HDLEZDetectionTypeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZDetectionTypeModel.m; sourceTree = "<group>"; }; 83D69FF82A47D32A00871258 /* HDLEZVideoQualityBoxView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZVideoQualityBoxView.h; sourceTree = "<group>"; }; 83D69FF92A47D32A00871258 /* HDLEZVideoQualityBoxView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLEZVideoQualityBoxView.m; sourceTree = "<group>"; }; 83EE503B2A41C9BA0006435D /* HDLEZOPButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLEZOPButton.h; sourceTree = "<group>"; }; @@ -627,6 +642,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 8318A0D72A8A591D0012B894 /* FCFileManager */ = { isa = PBXGroup; children = ( 8318A0D82A8A591D0012B894 /* FCFileManager.h */, 8318A0D92A8A591D0012B894 /* FCFileManager.m */, ); path = FCFileManager; sourceTree = "<group>"; }; AE5068C329B9CE40009EA09A /* TempPassword */ = { isa = PBXGroup; children = ( @@ -650,6 +674,8 @@ AEE4704B29C061AC00480163 /* HDLEZTempDetailViewController.m */, AEDBFB9D29C30126005F6512 /* HDLEZDeviceMsgListViewController.h */, AEDBFB9E29C30126005F6512 /* HDLEZDeviceMsgListViewController.m */, 83879A832A7DE42900E10A81 /* HDLEZDetectionTypeViewController.h */, 83879A842A7DE42900E10A81 /* HDLEZDetectionTypeViewController.m */, ); path = Controllers; sourceTree = "<group>"; @@ -679,6 +705,10 @@ 8357F1DD2A42DEC000936D2E /* HDLEZVideoDoorToolView.m */, 83D69FF82A47D32A00871258 /* HDLEZVideoQualityBoxView.h */, 83D69FF92A47D32A00871258 /* HDLEZVideoQualityBoxView.m */, 83879A862A7DE49900E10A81 /* HDLEZDetectionTypeView.h */, 83879A872A7DE49900E10A81 /* HDLEZDetectionTypeView.m */, 83879A892A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.h */, 83879A8A2A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.m */, ); path = Views; sourceTree = "<group>"; @@ -692,6 +722,8 @@ AEDBFB9B29C2FC8D005F6512 /* HDLEZDeviceMsgInfoModel.m */, AEDBFBA629C30DEF005F6512 /* HDLEZDevMsgListModel.h */, AEDBFBA729C30DEF005F6512 /* HDLEZDevMsgListModel.m */, 83879A8C2A7DEEC500E10A81 /* HDLEZDetectionTypeModel.h */, 83879A8D2A7DEEC500E10A81 /* HDLEZDetectionTypeModel.m */, ); path = Models; sourceTree = "<group>"; @@ -699,6 +731,7 @@ AEE84D3C29BAC3CA0078FDAD /* Base */ = { isa = PBXGroup; children = ( 8318A0D72A8A591D0012B894 /* FCFileManager */, AEF0148D29C188EC00D014FD /* HDLEZScrollView.h */, AEF0148E29C188ED00D014FD /* HDLEZScrollView.m */, AEDD437E29BED161001D9477 /* HDLEZButton.h */, @@ -1482,6 +1515,7 @@ B9BC99B725C0FFBD00C024FE /* MWZoomingScrollView.m in Sources */, B9EA4E8A25C7E806000FFDA2 /* MJRefreshBackGifFooter.m in Sources */, B9BC99B625C0FFBD00C024FE /* MWCaptionView.m in Sources */, 83879A852A7DE42900E10A81 /* HDLEZDetectionTypeViewController.m in Sources */, B9BC9A0B25C0FFBD00C024FE /* EZDeviceUpgradeViewController.m in Sources */, B9BC9A0C25C0FFBD00C024FE /* EZLocalCameraListViewController.m in Sources */, B9BC99B525C0FFBD00C024FE /* MWPhotoBrowser.m in Sources */, @@ -1497,6 +1531,7 @@ B9BC999F25C0FFBD00C024FE /* DALabeledCircularProgressView.m in Sources */, B9BC99B825C0FFBD00C024FE /* UIImage+MWPhotoBrowser.m in Sources */, B9BC99E025C0FFBD00C024FE /* AFHTTPRequestOperation.m in Sources */, 83879A8E2A7DEEC500E10A81 /* HDLEZDetectionTypeModel.m in Sources */, B9BC99CB25C0FFBD00C024FE /* UILabel+DDKit.m in Sources */, B9BC99F925C0FFBD00C024FE /* UIImageView+EzvizOpenSDK.m in Sources */, B9BC9A2425C0FFBD00C024FE /* UIAlertController+TextField.m in Sources */, @@ -1522,6 +1557,7 @@ AEE84D4329BAC7FE0078FDAD /* HDLEZConstants.m in Sources */, B9BC99BD25C0FFBD00C024FE /* MWGridCell.m in Sources */, B9BC9A0E25C0FFBD00C024FE /* EZLocalDeviceListViewController.m in Sources */, 8318A0DA2A8A591D0012B894 /* FCFileManager.m in Sources */, B9BC9A1125C0FFBD00C024FE /* EZDeviceRestartTipsViewController.m in Sources */, B9BC99CA25C0FFBD00C024FE /* UIImageView+DDKit.m in Sources */, B965BE0325EE0B0D00E58AFB /* EZHttpUtil.m in Sources */, @@ -1534,6 +1570,7 @@ B9BC99E625C0FFBD00C024FE /* SDWebImageManager.m in Sources */, B9BC99EC25C0FFBD00C024FE /* SDWebImageCompat.m in Sources */, B9BC99E125C0FFBD00C024FE /* AFNetworkReachabilityManager.m in Sources */, 83879A882A7DE49900E10A81 /* HDLEZDetectionTypeView.m in Sources */, AEE84D3B29BABAC00078FDAD /* HDLEZVisitorRecordViewController.m in Sources */, AEDBFB9929C2B90F005F6512 /* HDLEZAlertInputView.m in Sources */, B9BC9A1B25C0FFBD00C024FE /* EZWifiTipsViewController.m in Sources */, @@ -1585,6 +1622,7 @@ B9BC99D725C0FFBD00C024FE /* UIImageView+AFNetworking.m in Sources */, B9EA4E9125C7E806000FFDA2 /* MJRefreshStateHeader.m in Sources */, B9EA4E9425C7E806000FFDA2 /* MJRefreshHeader.m in Sources */, 83879A8B2A7DE7FC00E10A81 /* HDLEZDetectionTypeCell.m in Sources */, B9EA4E8B25C7E806000FFDA2 /* MJRefreshBackStateFooter.m in Sources */, B9BC99A125C0FFBD00C024FE /* DDCollectionViewFlowLayout.m in Sources */, B9BC9A1E25C0FFBD00C024FE /* EZWifiInfoViewController.m in Sources */, EZSDK/EZSDK/EZ/Base/FCFileManager/FCFileManager.h
New file @@ -0,0 +1,199 @@ // // FCFileManager.h // // Created by Fabio Caccamo on 28/01/14. // Copyright (c) 2014 Fabio Caccamo. All rights reserved. // #import <Foundation/Foundation.h> #import <ImageIO/ImageIO.h> #import <UIKit/UIKit.h> @interface FCFileManager : NSObject +(id)attributeOfItemAtPath:(NSString *)path forKey:(NSString *)key; +(id)attributeOfItemAtPath:(NSString *)path forKey:(NSString *)key error:(NSError **)error; +(NSDictionary *)attributesOfItemAtPath:(NSString *)path; +(NSDictionary *)attributesOfItemAtPath:(NSString *)path error:(NSError **)error; +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath; +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath error:(NSError **)error; +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite; +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite error:(NSError **)error; +(BOOL)createDirectoriesForFileAtPath:(NSString *)path; +(BOOL)createDirectoriesForFileAtPath:(NSString *)path error:(NSError **)error; +(BOOL)createDirectoriesForPath:(NSString *)path; +(BOOL)createDirectoriesForPath:(NSString *)path error:(NSError **)error; +(BOOL)createFileAtPath:(NSString *)path; +(BOOL)createFileAtPath:(NSString *)path error:(NSError **)error; +(BOOL)createFileAtPath:(NSString *)path overwrite:(BOOL)overwrite; +(BOOL)createFileAtPath:(NSString *)path overwrite:(BOOL)overwrite error:(NSError **)error; +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content; +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content error:(NSError **)error; +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content overwrite:(BOOL)overwrite; +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content overwrite:(BOOL)overwrite error:(NSError **)error; +(NSDate *)creationDateOfItemAtPath:(NSString *)path; +(NSDate *)creationDateOfItemAtPath:(NSString *)path error:(NSError **)error; +(NSDate *)modificationDateOfItemAtPath:(NSString *)path; +(NSDate *)modificationDateOfItemAtPath:(NSString *)path error:(NSError **)error; +(BOOL)emptyCachesDirectory; +(BOOL)emptyTemporaryDirectory; +(BOOL)existsItemAtPath:(NSString *)path; +(BOOL)isDirectoryItemAtPath:(NSString *)path; +(BOOL)isDirectoryItemAtPath:(NSString *)path error:(NSError **)error; +(BOOL)isEmptyItemAtPath:(NSString *)path; +(BOOL)isEmptyItemAtPath:(NSString *)path error:(NSError **)error; +(BOOL)isFileItemAtPath:(NSString *)path; +(BOOL)isFileItemAtPath:(NSString *)path error:(NSError **)error; +(BOOL)isExecutableItemAtPath:(NSString *)path; +(BOOL)isReadableItemAtPath:(NSString *)path; +(BOOL)isWritableItemAtPath:(NSString *)path; +(NSArray *)listDirectoriesInDirectoryAtPath:(NSString *)path; +(NSArray *)listDirectoriesInDirectoryAtPath:(NSString *)path deep:(BOOL)deep; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path deep:(BOOL)deep; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension deep:(BOOL)deep; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix deep:(BOOL)deep; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix; +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix deep:(BOOL)deep; +(NSArray *)listItemsInDirectoryAtPath:(NSString *)path deep:(BOOL)deep; +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath; +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath error:(NSError **)error; +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite; +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite error:(NSError **)error; +(NSString *)pathForApplicationSupportDirectory; +(NSString *)pathForApplicationSupportDirectoryWithPath:(NSString *)path; +(NSString *)pathForCachesDirectory; +(NSString *)pathForCachesDirectoryWithPath:(NSString *)path; +(NSString *)pathForDocumentsDirectory; +(NSString *)pathForDocumentsDirectoryWithPath:(NSString *)path; +(NSString *)pathForLibraryDirectory; +(NSString *)pathForLibraryDirectoryWithPath:(NSString *)path; +(NSString *)pathForMainBundleDirectory; +(NSString *)pathForMainBundleDirectoryWithPath:(NSString *)path; +(NSString *)pathForPlistNamed:(NSString *)name; +(NSString *)pathForTemporaryDirectory; +(NSString *)pathForTemporaryDirectoryWithPath:(NSString *)path; +(NSString *)readFileAtPath:(NSString *)path; +(NSString *)readFileAtPath:(NSString *)path error:(NSError **)error; +(NSArray *)readFileAtPathAsArray:(NSString *)path; +(NSObject *)readFileAtPathAsCustomModel:(NSString *)path; +(NSData *)readFileAtPathAsData:(NSString *)path; +(NSData *)readFileAtPathAsData:(NSString *)path error:(NSError **)error; +(NSDictionary *)readFileAtPathAsDictionary:(NSString *)path; +(UIImage *)readFileAtPathAsImage:(NSString *)path; +(UIImage *)readFileAtPathAsImage:(NSString *)path error:(NSError **)error; +(UIImageView *)readFileAtPathAsImageView:(NSString *)path; +(UIImageView *)readFileAtPathAsImageView:(NSString *)path error:(NSError **)error; +(NSJSONSerialization *)readFileAtPathAsJSON:(NSString *)path; +(NSJSONSerialization *)readFileAtPathAsJSON:(NSString *)path error:(NSError **)error; +(NSMutableArray *)readFileAtPathAsMutableArray:(NSString *)path; +(NSMutableData *)readFileAtPathAsMutableData:(NSString *)path; +(NSMutableData *)readFileAtPathAsMutableData:(NSString *)path error:(NSError **)error; +(NSMutableDictionary *)readFileAtPathAsMutableDictionary:(NSString *)path; +(NSString *)readFileAtPathAsString:(NSString *)path; +(NSString *)readFileAtPathAsString:(NSString *)path error:(NSError **)error; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path error:(NSError **)error; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension error:(NSError **)error; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix error:(NSError **)error; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix; +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix error:(NSError **)error; +(BOOL)removeItemsInDirectoryAtPath:(NSString *)path; +(BOOL)removeItemsInDirectoryAtPath:(NSString *)path error:(NSError **)error; +(BOOL)removeItemAtPath:(NSString *)path; +(BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error; +(BOOL)renameItemAtPath:(NSString *)path withName:(NSString *)name; +(BOOL)renameItemAtPath:(NSString *)path withName:(NSString *)name error:(NSError **)error; +(NSString *)sizeFormatted:(NSNumber *)size; +(NSString *)sizeFormattedOfDirectoryAtPath:(NSString *)path; +(NSString *)sizeFormattedOfDirectoryAtPath:(NSString *)path error:(NSError **)error; +(NSString *)sizeFormattedOfFileAtPath:(NSString *)path; +(NSString *)sizeFormattedOfFileAtPath:(NSString *)path error:(NSError **)error; +(NSString *)sizeFormattedOfItemAtPath:(NSString *)path; +(NSString *)sizeFormattedOfItemAtPath:(NSString *)path error:(NSError **)error; +(NSNumber *)sizeOfDirectoryAtPath:(NSString *)path; +(NSNumber *)sizeOfDirectoryAtPath:(NSString *)path error:(NSError **)error; +(NSNumber *)sizeOfFileAtPath:(NSString *)path; +(NSNumber *)sizeOfFileAtPath:(NSString *)path error:(NSError **)error; +(NSNumber *)sizeOfItemAtPath:(NSString *)path; +(NSNumber *)sizeOfItemAtPath:(NSString *)path error:(NSError **)error; +(NSURL *)urlForItemAtPath:(NSString *)path; +(BOOL)writeFileAtPath:(NSString *)path content:(NSObject *)content; +(BOOL)writeFileAtPath:(NSString *)path content:(NSObject *)content error:(NSError **)error; +(NSDictionary *)metadataOfImageAtPath:(NSString *)path; +(NSDictionary *)exifDataOfImageAtPath:(NSString *)path; +(NSDictionary *)tiffDataOfImageAtPath:(NSString *)path; +(NSDictionary *)xattrOfItemAtPath:(NSString *)path; +(NSString *)xattrOfItemAtPath:(NSString *)path getValueForKey:(NSString *)key; +(BOOL)xattrOfItemAtPath:(NSString *)path hasValueForKey:(NSString *)key; +(BOOL)xattrOfItemAtPath:(NSString *)path removeValueForKey:(NSString *)key; +(BOOL)xattrOfItemAtPath:(NSString *)path setValue:(NSString *)value forKey:(NSString *)key; @end EZSDK/EZSDK/EZ/Base/FCFileManager/FCFileManager.m
New file @@ -0,0 +1,1259 @@ // // FCFileManager.m // // Created by Fabio Caccamo on 28/01/14. // Copyright (c) 2014 Fabio Caccamo. All rights reserved. // #import "FCFileManager.h" #import <sys/xattr.h> @implementation FCFileManager +(NSMutableArray *)absoluteDirectories { static NSMutableArray *directories = nil; static dispatch_once_t token; dispatch_once(&token, ^{ directories = [NSMutableArray arrayWithObjects: [self pathForApplicationSupportDirectory], [self pathForCachesDirectory], [self pathForDocumentsDirectory], [self pathForLibraryDirectory], [self pathForMainBundleDirectory], [self pathForTemporaryDirectory], nil]; [directories sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { return (((NSString *)obj1).length > ((NSString *)obj2).length) ? 0 : 1; }]; }); return directories; } +(NSString *)absoluteDirectoryForPath:(NSString *)path { [self assertPath:path]; if([path isEqualToString:@"/"]) { return nil; } NSMutableArray *directories = [self absoluteDirectories]; for(NSString *directory in directories) { NSRange indexOfDirectoryInPath = [path rangeOfString:directory]; if(indexOfDirectoryInPath.location == 0) { return directory; } } return nil; } +(NSString *)absolutePath:(NSString *)path { [self assertPath:path]; NSString *defaultDirectory = [self absoluteDirectoryForPath:path]; if(defaultDirectory != nil) { return path; } else { return [self pathForDocumentsDirectoryWithPath:path]; } } +(void)assertPath:(NSString *)path { NSAssert(path != nil, @"Invalid path. Path cannot be nil."); NSAssert(![path isEqualToString:@""], @"Invalid path. Path cannot be empty string."); } +(id)attributeOfItemAtPath:(NSString *)path forKey:(NSString *)key { return [[self attributesOfItemAtPath:path] objectForKey:key]; } +(id)attributeOfItemAtPath:(NSString *)path forKey:(NSString *)key error:(NSError **)error { return [[self attributesOfItemAtPath:path error:error] objectForKey:key]; } +(NSDictionary *)attributesOfItemAtPath:(NSString *)path { return [self attributesOfItemAtPath:path error:nil]; } +(NSDictionary *)attributesOfItemAtPath:(NSString *)path error:(NSError **)error { return [[NSFileManager defaultManager] attributesOfItemAtPath:[self absolutePath:path] error:error]; } +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath { return [self copyItemAtPath:path toPath:toPath overwrite:NO error:nil]; } +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath error:(NSError **)error { return [self copyItemAtPath:path toPath:toPath overwrite:NO error:error]; } +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite { return [self copyItemAtPath:path toPath:toPath overwrite:overwrite error:nil]; } +(BOOL)copyItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite error:(NSError **)error { if(![self existsItemAtPath:toPath] || (overwrite && [self removeItemAtPath:toPath error:error] && [self isNotError:error])) { if([self createDirectoriesForFileAtPath:toPath error:error]) { BOOL copied = [[NSFileManager defaultManager] copyItemAtPath:[self absolutePath:path] toPath:[self absolutePath:toPath] error:error]; return (copied && [self isNotError:error]); } else { return NO; } } else { return NO; } } +(BOOL)createDirectoriesForFileAtPath:(NSString *)path { return [self createDirectoriesForFileAtPath:path error:nil]; } +(BOOL)createDirectoriesForFileAtPath:(NSString *)path error:(NSError **)error { NSString *pathLastChar = [path substringFromIndex:(path.length - 1)]; if([pathLastChar isEqualToString:@"/"]) { [NSException raise:@"Invalid path" format:@"file path can't have a trailing '/'."]; return NO; } return [self createDirectoriesForPath:[[self absolutePath:path] stringByDeletingLastPathComponent] error:error]; } +(BOOL)createDirectoriesForPath:(NSString *)path { return [self createDirectoriesForPath:path error:nil]; } +(BOOL)createDirectoriesForPath:(NSString *)path error:(NSError **)error { return [[NSFileManager defaultManager] createDirectoryAtPath:[self absolutePath:path] withIntermediateDirectories:YES attributes:nil error:error]; } +(BOOL)createFileAtPath:(NSString *)path { return [self createFileAtPath:path withContent:nil overwrite:NO error:nil]; } +(BOOL)createFileAtPath:(NSString *)path error:(NSError **)error { return [self createFileAtPath:path withContent:nil overwrite:NO error:error]; } +(BOOL)createFileAtPath:(NSString *)path overwrite:(BOOL)overwrite { return [self createFileAtPath:path withContent:nil overwrite:overwrite error:nil]; } +(BOOL)createFileAtPath:(NSString *)path overwrite:(BOOL)overwrite error:(NSError **)error { return [self createFileAtPath:path withContent:nil overwrite:overwrite error:error]; } +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content { return [self createFileAtPath:path withContent:content overwrite:NO error:nil]; } +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content error:(NSError **)error { return [self createFileAtPath:path withContent:content overwrite:NO error:error]; } +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content overwrite:(BOOL)overwrite { return [self createFileAtPath:path withContent:content overwrite:overwrite error:nil]; } +(BOOL)createFileAtPath:(NSString *)path withContent:(NSObject *)content overwrite:(BOOL)overwrite error:(NSError **)error { if(![self existsItemAtPath:path] || (overwrite && [self removeItemAtPath:path error:error] && [self isNotError:error])) { if([self createDirectoriesForFileAtPath:path error:error]) { BOOL created = [[NSFileManager defaultManager] createFileAtPath:[self absolutePath:path] contents:nil attributes:nil]; if(content != nil) { [self writeFileAtPath:path content:content error:error]; } return (created && [self isNotError:error]); } else { return NO; } } else { return NO; } } +(NSDate *)creationDateOfItemAtPath:(NSString *)path { return [self creationDateOfItemAtPath:path error:nil]; } +(NSDate *)creationDateOfItemAtPath:(NSString *)path error:(NSError **)error { return (NSDate *)[self attributeOfItemAtPath:path forKey:NSFileCreationDate error:error]; } +(NSDate *)modificationDateOfItemAtPath:(NSString *)path { return [self modificationDateOfItemAtPath:path error:nil]; } +(NSDate *)modificationDateOfItemAtPath:(NSString *)path error:(NSError **)error { return (NSDate *)[self attributeOfItemAtPath:path forKey:NSFileModificationDate error:error]; } +(BOOL)emptyCachesDirectory { return [self removeFilesInDirectoryAtPath:[self pathForCachesDirectory]]; } +(BOOL)emptyTemporaryDirectory { return [self removeFilesInDirectoryAtPath:[self pathForTemporaryDirectory]]; } +(BOOL)existsItemAtPath:(NSString *)path { return [[NSFileManager defaultManager] fileExistsAtPath:[self absolutePath:path]]; } +(BOOL)isDirectoryItemAtPath:(NSString *)path { return [self isDirectoryItemAtPath:path error:nil]; } +(BOOL)isDirectoryItemAtPath:(NSString *)path error:(NSError **)error { return ([self attributeOfItemAtPath:path forKey:NSFileType error:error] == NSFileTypeDirectory); } +(BOOL)isEmptyItemAtPath:(NSString *)path { return [self isEmptyItemAtPath:path error:nil]; } +(BOOL)isEmptyItemAtPath:(NSString *)path error:(NSError **)error { return ([self isFileItemAtPath:path error:error] && ([[self sizeOfItemAtPath:path error:error] intValue] == 0)) || ([self isDirectoryItemAtPath:path error:error] && ([[self listItemsInDirectoryAtPath:path deep:NO] count] == 0)); } +(BOOL)isFileItemAtPath:(NSString *)path { return [self isFileItemAtPath:path error:nil]; } +(BOOL)isFileItemAtPath:(NSString *)path error:(NSError **)error { return ([self attributeOfItemAtPath:path forKey:NSFileType error:error] == NSFileTypeRegular); } +(BOOL)isExecutableItemAtPath:(NSString *)path { return [[NSFileManager defaultManager] isExecutableFileAtPath:[self absolutePath:path]]; } +(BOOL)isNotError:(NSError **)error { //the first check prevents EXC_BAD_ACCESS error in case methods are called passing nil to error argument //the second check prevents that the methods returns always NO just because the error pointer exists (so the first condition returns YES) return ((error == nil) || ((*error) == nil)); } +(BOOL)isReadableItemAtPath:(NSString *)path { return [[NSFileManager defaultManager] isReadableFileAtPath:[self absolutePath:path]]; } +(BOOL)isWritableItemAtPath:(NSString *)path { return [[NSFileManager defaultManager] isWritableFileAtPath:[self absolutePath:path]]; } +(NSArray *)listDirectoriesInDirectoryAtPath:(NSString *)path { return [self listDirectoriesInDirectoryAtPath:path deep:NO]; } +(NSArray *)listDirectoriesInDirectoryAtPath:(NSString *)path deep:(BOOL)deep { NSArray *subpaths = [self listItemsInDirectoryAtPath:path deep:deep]; return [subpaths filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { NSString *subpath = (NSString *)evaluatedObject; return [self isDirectoryItemAtPath:subpath]; }]]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path { return [self listFilesInDirectoryAtPath:path deep:NO]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path deep:(BOOL)deep { NSArray *subpaths = [self listItemsInDirectoryAtPath:path deep:deep]; return [subpaths filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { NSString *subpath = (NSString *)evaluatedObject; return [self isFileItemAtPath:subpath]; }]]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension { return [self listFilesInDirectoryAtPath:path withExtension:extension deep:NO]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension deep:(BOOL)deep { NSArray *subpaths = [self listFilesInDirectoryAtPath:path deep:deep]; return [subpaths filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { NSString *subpath = (NSString *)evaluatedObject; NSString *subpathExtension = [[subpath pathExtension] lowercaseString]; NSString *filterExtension = [[extension lowercaseString] stringByReplacingOccurrencesOfString:@"." withString:@""]; return [subpathExtension isEqualToString:filterExtension]; }]]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix { return [self listFilesInDirectoryAtPath:path withPrefix:prefix deep:NO]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix deep:(BOOL)deep { NSArray *subpaths = [self listFilesInDirectoryAtPath:path deep:deep]; return [subpaths filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { NSString *subpath = (NSString *)evaluatedObject; NSString *fileName = [subpath lastPathComponent]; return ([fileName hasPrefix:prefix] || [fileName isEqualToString:prefix]); }]]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix { return [self listFilesInDirectoryAtPath:path withSuffix:suffix deep:NO]; } +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix deep:(BOOL)deep { NSArray *subpaths = [self listFilesInDirectoryAtPath:path deep:deep]; return [subpaths filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { NSString *subpath = (NSString *)evaluatedObject; NSString *subpathName = [subpath stringByDeletingPathExtension]; return ([subpath hasSuffix:suffix] || [subpath isEqualToString:suffix] || [subpathName hasSuffix:suffix] || [subpathName isEqualToString:suffix]); }]]; } +(NSArray *)listItemsInDirectoryAtPath:(NSString *)path deep:(BOOL)deep { NSString *absolutePath = [self absolutePath:path]; NSArray *relativeSubpaths = (deep ? [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:absolutePath error:nil] : [[NSFileManager defaultManager] contentsOfDirectoryAtPath:absolutePath error:nil]); NSMutableArray *absoluteSubpaths = [[NSMutableArray alloc] init]; for(NSString *relativeSubpath in relativeSubpaths) { NSString *absoluteSubpath = [absolutePath stringByAppendingPathComponent:relativeSubpath]; [absoluteSubpaths addObject:absoluteSubpath]; } return [NSArray arrayWithArray:absoluteSubpaths]; } +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath { return [self moveItemAtPath:path toPath:toPath overwrite:NO error:nil]; } +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath error:(NSError **)error { return [self moveItemAtPath:path toPath:toPath overwrite:NO error:error]; } +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite { return [self moveItemAtPath:path toPath:toPath overwrite:overwrite error:nil]; } +(BOOL)moveItemAtPath:(NSString *)path toPath:(NSString *)toPath overwrite:(BOOL)overwrite error:(NSError **)error { if(![self existsItemAtPath:toPath] || (overwrite && [self removeItemAtPath:toPath error:error] && [self isNotError:error])) { return ([self createDirectoriesForFileAtPath:toPath error:error] && [[NSFileManager defaultManager] moveItemAtPath:[self absolutePath:path] toPath:[self absolutePath:toPath] error:error]); } else { return NO; } } +(NSString *)pathForApplicationSupportDirectory { static NSString *path = nil; static dispatch_once_t token; dispatch_once(&token, ^{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); path = [paths lastObject]; }); return path; } +(NSString *)pathForApplicationSupportDirectoryWithPath:(NSString *)path { return [[FCFileManager pathForApplicationSupportDirectory] stringByAppendingPathComponent:path]; } +(NSString *)pathForCachesDirectory { static NSString *path = nil; static dispatch_once_t token; dispatch_once(&token, ^{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); path = [paths lastObject]; }); return path; } +(NSString *)pathForCachesDirectoryWithPath:(NSString *)path { return [[FCFileManager pathForCachesDirectory] stringByAppendingPathComponent:path]; } +(NSString *)pathForDocumentsDirectory { static NSString *path = nil; static dispatch_once_t token; dispatch_once(&token, ^{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); path = [paths lastObject]; }); return path; } +(NSString *)pathForDocumentsDirectoryWithPath:(NSString *)path { return [[FCFileManager pathForDocumentsDirectory] stringByAppendingPathComponent:path]; } +(NSString *)pathForLibraryDirectory { static NSString *path = nil; static dispatch_once_t token; dispatch_once(&token, ^{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); path = [paths lastObject]; }); return path; } +(NSString *)pathForLibraryDirectoryWithPath:(NSString *)path { return [[FCFileManager pathForLibraryDirectory] stringByAppendingPathComponent:path]; } +(NSString *)pathForMainBundleDirectory { return [NSBundle mainBundle].resourcePath; } +(NSString *)pathForMainBundleDirectoryWithPath:(NSString *)path { return [[FCFileManager pathForMainBundleDirectory] stringByAppendingPathComponent:path]; } +(NSString *)pathForPlistNamed:(NSString *)name { NSString *nameExtension = [name pathExtension]; NSString *plistExtension = @"plist"; if([nameExtension isEqualToString:@""]) { name = [name stringByAppendingPathExtension:plistExtension]; } return [self pathForMainBundleDirectoryWithPath:name]; } +(NSString *)pathForTemporaryDirectory { static NSString *path = nil; static dispatch_once_t token; dispatch_once(&token, ^{ path = NSTemporaryDirectory(); }); return path; } +(NSString *)pathForTemporaryDirectoryWithPath:(NSString *)path { return [[FCFileManager pathForTemporaryDirectory] stringByAppendingPathComponent:path]; } +(NSString *)readFileAtPath:(NSString *)path { return [self readFileAtPathAsString:path error:nil]; } +(NSString *)readFileAtPath:(NSString *)path error:(NSError **)error { return [self readFileAtPathAsString:path error:error]; } +(NSArray *)readFileAtPathAsArray:(NSString *)path { return [NSArray arrayWithContentsOfFile:[self absolutePath:path]]; } +(NSObject *)readFileAtPathAsCustomModel:(NSString *)path { return [NSKeyedUnarchiver unarchiveObjectWithFile:[self absolutePath:path]]; } +(NSData *)readFileAtPathAsData:(NSString *)path { return [self readFileAtPathAsData:path error:nil]; } +(NSData *)readFileAtPathAsData:(NSString *)path error:(NSError **)error { return [NSData dataWithContentsOfFile:[self absolutePath:path] options:NSDataReadingMapped error:error]; } +(NSDictionary *)readFileAtPathAsDictionary:(NSString *)path { return [NSDictionary dictionaryWithContentsOfFile:[self absolutePath:path]]; } +(UIImage *)readFileAtPathAsImage:(NSString *)path { return [self readFileAtPathAsImage:path error:nil]; } +(UIImage *)readFileAtPathAsImage:(NSString *)path error:(NSError **)error { NSData *data = [self readFileAtPathAsData:path error:error]; if([self isNotError:error]) { return [UIImage imageWithData:data]; } return nil; } +(UIImageView *)readFileAtPathAsImageView:(NSString *)path { return [self readFileAtPathAsImageView:path error:nil]; } +(UIImageView *)readFileAtPathAsImageView:(NSString *)path error:(NSError **)error { UIImage *image = [self readFileAtPathAsImage:path error:error]; if([self isNotError:error]) { UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [imageView sizeToFit]; return imageView; } return nil; } +(NSJSONSerialization *)readFileAtPathAsJSON:(NSString *)path { return [self readFileAtPathAsJSON:path error:nil]; } +(NSJSONSerialization *)readFileAtPathAsJSON:(NSString *)path error:(NSError **)error { NSData *data = [self readFileAtPathAsData:path error:error]; if([self isNotError:error]) { NSJSONSerialization *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:error]; if([NSJSONSerialization isValidJSONObject:json]) { return json; } } return nil; } +(NSMutableArray *)readFileAtPathAsMutableArray:(NSString *)path { return [NSMutableArray arrayWithContentsOfFile:[self absolutePath:path]]; } +(NSMutableData *)readFileAtPathAsMutableData:(NSString *)path { return [self readFileAtPathAsMutableData:path error:nil]; } +(NSMutableData *)readFileAtPathAsMutableData:(NSString *)path error:(NSError **)error { return [NSMutableData dataWithContentsOfFile:[self absolutePath:path] options:NSDataReadingMapped error:error]; } +(NSMutableDictionary *)readFileAtPathAsMutableDictionary:(NSString *)path { return [NSMutableDictionary dictionaryWithContentsOfFile:[self absolutePath:path]]; } +(NSString *)readFileAtPathAsString:(NSString *)path { return [self readFileAtPath:path error:nil]; } +(NSString *)readFileAtPathAsString:(NSString *)path error:(NSError **)error { return [NSString stringWithContentsOfFile:[self absolutePath:path] encoding:NSUTF8StringEncoding error:error]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path] error:nil]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path error:(NSError **)error { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path] error:error]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path withExtension:extension] error:nil]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withExtension:(NSString *)extension error:(NSError **)error { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path withExtension:extension] error:error]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path withPrefix:prefix] error:nil]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)prefix error:(NSError **)error { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path withPrefix:prefix] error:error]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path withSuffix:suffix] error:nil]; } +(BOOL)removeFilesInDirectoryAtPath:(NSString *)path withSuffix:(NSString *)suffix error:(NSError **)error { return [self removeItemsAtPaths:[self listFilesInDirectoryAtPath:path withSuffix:suffix] error:error]; } +(BOOL)removeItemsInDirectoryAtPath:(NSString *)path { return [self removeItemsInDirectoryAtPath:path error:nil]; } +(BOOL)removeItemsInDirectoryAtPath:(NSString *)path error:(NSError **)error { return [self removeItemsAtPaths:[self listItemsInDirectoryAtPath:path deep:NO] error:error]; } +(BOOL)removeItemAtPath:(NSString *)path { return [self removeItemAtPath:path error:nil]; } +(BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error { return [[NSFileManager defaultManager] removeItemAtPath:[self absolutePath:path] error:error]; } +(BOOL)removeItemsAtPaths:(NSArray *)paths { return [self removeItemsAtPaths:paths error:nil]; } +(BOOL)removeItemsAtPaths:(NSArray *)paths error:(NSError **)error { BOOL success = YES; for(NSString *path in paths) { success &= [self removeItemAtPath:[self absolutePath:path] error:error]; } return success; } +(BOOL)renameItemAtPath:(NSString *)path withName:(NSString *)name { return [self renameItemAtPath:path withName:name error:nil]; } +(BOOL)renameItemAtPath:(NSString *)path withName:(NSString *)name error:(NSError **)error { NSRange indexOfSlash = [name rangeOfString:@"/"]; if(indexOfSlash.location < name.length) { [NSException raise:@"Invalid name" format:@"file name can't contain a '/'."]; return NO; } return [self moveItemAtPath:path toPath:[[[self absolutePath:path] stringByDeletingLastPathComponent] stringByAppendingPathComponent:name] error:error]; } +(NSString *)sizeFormatted:(NSNumber *)size { double convertedValue = [size doubleValue]; int multiplyFactor = 0; NSArray *tokens = @[@"bytes", @"KB", @"MB", @"GB", @"TB"]; while(convertedValue > 1024){ convertedValue /= 1024; multiplyFactor++; } NSString *sizeFormat = ((multiplyFactor > 1) ? @"%4.2f %@" : @"%4.0f %@"); return [NSString stringWithFormat:sizeFormat, convertedValue, tokens[multiplyFactor]]; } +(NSString *)sizeFormattedOfDirectoryAtPath:(NSString *)path { return [self sizeFormattedOfDirectoryAtPath:path error:nil]; } +(NSString *)sizeFormattedOfDirectoryAtPath:(NSString *)path error:(NSError **)error { NSNumber *size = [self sizeOfDirectoryAtPath:path error:error]; if(size != nil && [self isNotError:error]) { return [self sizeFormatted:size]; } return nil; } +(NSString *)sizeFormattedOfFileAtPath:(NSString *)path { return [self sizeFormattedOfFileAtPath:path error:nil]; } +(NSString *)sizeFormattedOfFileAtPath:(NSString *)path error:(NSError **)error { NSNumber *size = [self sizeOfFileAtPath:path error:error]; if(size != nil && [self isNotError:error]) { return [self sizeFormatted:size]; } return nil; } +(NSString *)sizeFormattedOfItemAtPath:(NSString *)path { return [self sizeFormattedOfItemAtPath:path error:nil]; } +(NSString *)sizeFormattedOfItemAtPath:(NSString *)path error:(NSError **)error { NSNumber *size = [self sizeOfItemAtPath:path error:error]; if(size != nil && [self isNotError:error]) { return [self sizeFormatted:size]; } return nil; } +(NSNumber *)sizeOfDirectoryAtPath:(NSString *)path { return [self sizeOfDirectoryAtPath:path error:nil]; } +(NSNumber *)sizeOfDirectoryAtPath:(NSString *)path error:(NSError **)error { if([self isDirectoryItemAtPath:path error:error]) { if([self isNotError:error]) { NSNumber *size = [self sizeOfItemAtPath:path error:error]; double sizeValue = [size doubleValue]; if([self isNotError:error]) { NSArray *subpaths = [self listItemsInDirectoryAtPath:path deep:YES]; NSUInteger subpathsCount = [subpaths count]; for(NSUInteger i = 0; i < subpathsCount; i++) { NSString *subpath = [subpaths objectAtIndex:i]; NSNumber *subpathSize = [self sizeOfItemAtPath:subpath error:error]; if([self isNotError:error]) { sizeValue += [subpathSize doubleValue]; } else { return nil; } } return [NSNumber numberWithDouble:sizeValue]; } } } return nil; } +(NSNumber *)sizeOfFileAtPath:(NSString *)path { return [self sizeOfFileAtPath:path error:nil]; } +(NSNumber *)sizeOfFileAtPath:(NSString *)path error:(NSError **)error { if([self isFileItemAtPath:path error:error]) { if([self isNotError:error]) { return [self sizeOfItemAtPath:path error:error]; } } return nil; } +(NSNumber *)sizeOfItemAtPath:(NSString *)path { return [self sizeOfItemAtPath:path error:nil]; } +(NSNumber *)sizeOfItemAtPath:(NSString *)path error:(NSError **)error { return (NSNumber *)[self attributeOfItemAtPath:path forKey:NSFileSize error:error]; } +(NSURL *)urlForItemAtPath:(NSString *)path { return [NSURL fileURLWithPath:[self absolutePath:path]]; } +(BOOL)writeFileAtPath:(NSString *)path content:(NSObject *)content { return [self writeFileAtPath:path content:content error:nil]; } +(BOOL)writeFileAtPath:(NSString *)path content:(NSObject *)content error:(NSError **)error { if(content == nil) { [NSException raise:@"Invalid content" format:@"content can't be nil."]; } [self createFileAtPath:path withContent:nil overwrite:YES error:error]; NSString *absolutePath = [self absolutePath:path]; if([content isKindOfClass:[NSMutableArray class]]) { [((NSMutableArray *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSArray class]]) { [((NSArray *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSMutableData class]]) { [((NSMutableData *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSData class]]) { [((NSData *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSMutableDictionary class]]) { [((NSMutableDictionary *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSDictionary class]]) { [((NSDictionary *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSJSONSerialization class]]) { [((NSDictionary *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSMutableString class]]) { [[((NSString *)content) dataUsingEncoding:NSUTF8StringEncoding] writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[NSString class]]) { [[((NSString *)content) dataUsingEncoding:NSUTF8StringEncoding] writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[UIImage class]]) { [UIImagePNGRepresentation((UIImage *)content) writeToFile:absolutePath atomically:YES]; } else if([content isKindOfClass:[UIImageView class]]) { return [self writeFileAtPath:absolutePath content:((UIImageView *)content).image error:error]; } else if([content conformsToProtocol:@protocol(NSCoding)]) { [NSKeyedArchiver archiveRootObject:content toFile:absolutePath]; } else { [NSException raise:@"Invalid content type" format:@"content of type %@ is not handled.", NSStringFromClass([content class])]; return NO; } return YES; } +(NSDictionary *)metadataOfImageAtPath:(NSString *)path { if([self isFileItemAtPath:path]) { //http://blog.depicus.com/getting-exif-data-from-images-on-ios/ NSURL *url = [self urlForItemAtPath:path]; CGImageSourceRef sourceRef = CGImageSourceCreateWithURL((CFURLRef)url, NULL); NSDictionary *metadata = (NSDictionary *)CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(sourceRef, 0, NULL)); return metadata; } return nil; } +(NSDictionary *)exifDataOfImageAtPath:(NSString *)path { NSDictionary *metadata = [self metadataOfImageAtPath:path]; if(metadata) { return [metadata objectForKey:(NSString *)kCGImagePropertyExifDictionary]; } return nil; } +(NSDictionary *)tiffDataOfImageAtPath:(NSString *)path { NSDictionary *metadata = [self metadataOfImageAtPath:path]; if(metadata) { return [metadata objectForKey:(NSString *)kCGImagePropertyTIFFDictionary]; } return nil; } +(NSDictionary *)xattrOfItemAtPath:(NSString *)path { NSMutableDictionary *values = [[NSMutableDictionary alloc] init]; const char *upath = [path UTF8String]; ssize_t ukeysSize = listxattr(upath, NULL, 0, 0); if( ukeysSize > 0 ) { char *ukeys = malloc(ukeysSize); ukeysSize = listxattr(upath, ukeys, ukeysSize, 0); NSUInteger keyOffset = 0; NSString *key; NSString *value; while(keyOffset < ukeysSize) { key = [NSString stringWithUTF8String:(keyOffset + ukeys)]; keyOffset += ([key length] + 1); value = [self xattrOfItemAtPath:path getValueForKey:key]; [values setObject:value forKey:key]; } free(ukeys); } return [NSDictionary dictionaryWithObjects:[values allValues] forKeys:[values allKeys]]; } +(NSString *)xattrOfItemAtPath:(NSString *)path getValueForKey:(NSString *)key { NSString *value = nil; const char *ukey = [key UTF8String]; const char *upath = [path UTF8String]; ssize_t uvalueSize = getxattr(upath, ukey, NULL, 0, 0, 0); if( uvalueSize > -1 ) { if( uvalueSize == 0 ) { value = @""; } else { char *uvalue = malloc(uvalueSize); if( uvalue ) { getxattr(upath, ukey, uvalue, uvalueSize, 0, 0); uvalue[uvalueSize] = '\0'; value = [NSString stringWithUTF8String:uvalue]; free(uvalue); } } } return value; } +(BOOL)xattrOfItemAtPath:(NSString *)path hasValueForKey:(NSString *)key { return ([self xattrOfItemAtPath:path getValueForKey:key] != nil); } +(BOOL)xattrOfItemAtPath:(NSString *)path removeValueForKey:(NSString *)key { int result = removexattr([path UTF8String], [key UTF8String], 0); return (result == 0); } +(BOOL)xattrOfItemAtPath:(NSString *)path setValue:(NSString *)value forKey:(NSString *)key { if(value == nil) { return NO; } int result = setxattr([path UTF8String], [key UTF8String], [value UTF8String], [value length], 0, 0); return (result == 0); } @end EZSDK/EZSDK/EZ/Base/HDLEZAlertInputView.m
@@ -30,8 +30,8 @@ @param sureTitle 确认按钮标题 */ +(void)showInputAlertWithtitle:(NSString*)title cancleTitle:(NSString*)cancleTitle sureTitle:(NSString*)sureTitle keyboardType:(UIKeyboardType)keyboardType cancleBlock:(HDLEZAlertInputViewCancleBlock)cancle sureBlock:(HDLEZAlertInputViewSureBlock)sure{ [[[[UIApplication sharedApplication] windows] lastObject] makeKeyWindow]; [self showInputAlertToView:[[[UIApplication sharedApplication] windows] lastObject] title:title cancleTitle:cancleTitle sureTitle:sureTitle keyboardType:keyboardType cancleBlock:cancle sureBlock:sure]; [[self currentWindow] makeKeyWindow]; [self showInputAlertToView:[self currentWindow] title:title cancleTitle:cancleTitle sureTitle:sureTitle keyboardType:keyboardType cancleBlock:cancle sureBlock:sure]; } /*展示输入弹窗 @@ -204,4 +204,20 @@ } return window; } /*获取当前window */ +(UIWindow*)currentWindow{ UIWindow *window; if (@available(iOS 13.0, *)) { if ([UIApplication sharedApplication].delegate.window) { window=[UIApplication sharedApplication].delegate.window; }else{ window = [UIApplication sharedApplication].windows[0]; } } else { window = [UIApplication sharedApplication].delegate.window; } return window; } @end EZSDK/EZSDK/EZ/Global/EZHttpUtil.h
@@ -171,6 +171,24 @@ answerStatus:(NSString *)answerStatus completion:(void (^)(ResponseData *responseData))completion; /** * @since 获取摄像头智能算法列表和状态 * @param deviceSerial 设备序列号 * @param completion 回调block,error为空时表示成功 */ - (void)getAiSupportDetectionList:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion; /** * @since 设置摄像头智能算法 * @param deviceSerial 设备序列号 * @param code 智能算法编码 * @param completion 回调block,error为空时表示成功 */ - (void)setAiSupportDetection:(NSString *)deviceSerial code:(NSString *)code completion:(void (^)(ResponseData *responseData))completion; @end NS_ASSUME_NONNULL_END EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
@@ -33,10 +33,12 @@ #define API_POST_EZ_GetCoverSwitchStaus @"/home-wisdom/platform/yingshi/getCoverSwitchStatus"//获取萤石镜头遮蔽开关状态 #define API_POST_EZ_GetCoverSwitch @"/home-wisdom/platform/yingshi/coverSwitch"//设置萤石镜头遮蔽开关 #define AOI_POST_EZ_UpdateAnswerStatus @"/home-wisdom/platform/yingshi/lock/updateAnswerStatus" // 更改门铃通话状态(接听和未接) #define API_POST_EZ_GetAiSupportList @"/home-wisdom/platform/yingshi/getAiSupportList"//获取摄像头智能算法列表和状态 #define API_POST_EZ_SetAiSupport @"/home-wisdom/platform/yingshi/setAiSupport"//设置摄像头智能算法 #pragma mark APP_KEY #define APP_KEY @"HDL-HOME-APP-TEST" #define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss" #define APP_KEY @"QWERREWQ" #define SECRET_KEY @"CPBUCTRLCPBUABCD" #define TIME_OUT 30.0f @@ -501,6 +503,60 @@ }]; } /** * @since 获取摄像头智能算法列表和状态 * @param deviceSerial 设备序列号 * @param completion 回调block,error为空时表示成功 */ - (void)getAiSupportDetectionList:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion { //设置请求参数 NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; [parameters setValue:deviceSerial forKey:@"deviceSerial"]; // [parameters setValue:@(1) forKey:@"platform"]; // [parameters setValue:[NSString stringWithFormat:@"%@",[GlobalKit shareKit].hdlAppKey] forKey:@"appKey"]; // [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; parameters = [self GetSignRequestDictionary:parameters]; NSLog(@"获取设备消息参数:%@",parameters); [self requestHttpsPost:API_POST_EZ_GetAiSupportList parameters:parameters completion:^(ResponseData *responseData) { if (completion) { completion (responseData); } }]; } /** * @since 设置摄像头智能算法 * @param deviceSerial 设备序列号 * @param code 智能算法编码 * @param completion 回调block,error为空时表示成功 */ - (void)setAiSupportDetection:(NSString *)deviceSerial code:(NSString *)code completion:(void (^)(ResponseData *responseData))completion { //设置请求参数 NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; [parameters setValue:deviceSerial forKey:@"deviceSerial"]; [parameters setValue:code forKey:@"code"]; // [parameters setValue:@(1) forKey:@"platform"]; // [parameters setValue:[NSString stringWithFormat:@"%@",[GlobalKit shareKit].hdlAppKey] forKey:@"appKey"]; // [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; parameters = [self GetSignRequestDictionary:parameters]; NSLog(@"获取设备消息参数:%@",parameters); [self requestHttpsPost:API_POST_EZ_SetAiSupport parameters:parameters completion:^(ResponseData *responseData) { if (completion) { completion (responseData); } }]; } /// 刷新token /// @param block 结果 - (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{ @@ -629,6 +685,7 @@ UInt64 recordTime = [[NSDate date] timeIntervalSince1970]*1000; [params setValue:APP_KEY forKey:@"appKey"]; [params setValue:[NSString stringWithFormat:@"%llu",recordTime] forKey:@"timestamp"]; NSLog(@"##########APPKEY:%@, SECRET_KEY:%@", APP_KEY, SECRET_KEY); //1.对KEY升序 NSArray *keyArray = [params allKeys]; NSArray *sortKeyArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDetectionTypeViewController.h
New file @@ -0,0 +1,18 @@ // // HDLEZDetectionTypeViewController.h // EZSDK // // Created by Davin on 2023/8/5. // #import "HDLEZBaseViewController.h" NS_ASSUME_NONNULL_BEGIN @interface HDLEZDetectionTypeViewController : HDLEZBaseViewController @property (nonatomic, strong) EZDeviceInfo *deviceInfo; @end NS_ASSUME_NONNULL_END EZSDK/EZSDK/EZ/TempPassword/Controllers/HDLEZDetectionTypeViewController.m
New file @@ -0,0 +1,192 @@ // // HDLEZDetectionTypeViewController.m // EZSDK // // Created by Davin on 2023/8/5. // #import "HDLEZDetectionTypeViewController.h" #import "HDLEZDetectionTypeView.h" #import "MJRefreshNormalHeader.h" @interface HDLEZDetectionTypeViewController () @property (nonatomic, strong) HDLEZDetectionTypeView *detectionTypeView; @property (nonatomic, strong) MJRefreshNormalHeader *header;//刷新header @property (nonatomic, strong) UIButton *sureButton; @property (nonatomic, strong) NSArray <HDLEZDetectionTypeModel *>*detectionTypeArray; @property (nonatomic, strong) NSString *selectedCode; // 选中要设置的检测类型 @end @implementation HDLEZDetectionTypeViewController - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController.navigationBar setHidden:YES]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self setTopBarViewWithTitle:HDLEZLocallizedString(@"device_detection_type")]; [self.topBarView.bottomLine setHidden:YES]; // [self.navigationController.navigationBar setHidden:YES]; [self createSubviews]; } - (void)createSubviews { self.view.backgroundColor = HDLEZHEXCOLOR(0xF2F3F7, 1.); self.selectedCode = @""; [self.view addSubview:self.detectionTypeView]; [self.view addSubview:self.sureButton]; [self.detectionTypeView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view).offset(HDLEZ_APP_TOP_BAR_HEIGHT); make.left.right.equalTo(self.view); }]; [self.sureButton mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.detectionTypeView.mas_bottom).offset(16.); make.bottom.mas_equalTo(self.view.mas_bottom).offset(-56.); make.centerX.mas_equalTo(self.view.mas_centerX); make.width.mas_equalTo(220.); make.height.mas_equalTo(44.); }]; //#warning mock test // NSMutableArray *mArray = [NSMutableArray arrayWithCapacity:0]; // HDLEZDetectionTypeModel *firstModel = [[HDLEZDetectionTypeModel alloc] init]; // firstModel.title = @"AI人形或车型检测"; // firstModel.isSelected = NO; // [mArray addObject:firstModel]; // // HDLEZDetectionTypeModel *secondModel = [[HDLEZDetectionTypeModel alloc] init]; // secondModel.title = @"AI人形检测"; // secondModel.isSelected = NO; // [mArray addObject:secondModel]; // // HDLEZDetectionTypeModel *thirdmodel = [[HDLEZDetectionTypeModel alloc] init]; // thirdmodel.title = @"车型检测"; // thirdmodel.isSelected = NO; // [mArray addObject:thirdmodel]; // // HDLEZDetectionTypeModel *fourthModel = [[HDLEZDetectionTypeModel alloc] init]; // fourthModel.title = @"画面变化检测"; // fourthModel.isSelected = NO; // [mArray addObject:fourthModel]; // // HDLEZDetectionTypeModel *fifthModel = [[HDLEZDetectionTypeModel alloc] init]; // fifthModel.title = @"关闭活动检测提醒"; // fifthModel.isSelected = NO; // [mArray addObject:fifthModel]; // // self.detectionTypeView.detectionTypeList = mArray; __weak __typeof(self)weakSelf = self; [self.detectionTypeView didSelectedDetectionType:^(NSString * _Nonnull code) { weakSelf.selectedCode = code; }]; //下拉刷新 // 设置回调(一旦进入刷新状态,就调用target的action,也就是调用self的loadNewData方法) _header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshData)]; // 设置自动切换透明度(在导航栏下面自动隐藏) _header.automaticallyChangeAlpha = YES; // 隐藏时间 _header.lastUpdatedTimeLabel.hidden = YES; // 隐藏刷新状态文本 _header.stateLabel.hidden = YES; _detectionTypeView.mj_header=_header; //开始加载数据 [_header beginRefreshing]; [self.sureButton addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside]; } /*刷新数据 */ -(void)refreshData{ self.detectionTypeArray=[[NSMutableArray alloc] init]; [self getMsgList]; } /*获取历史记录 */ -(void)getMsgList{ __weak __typeof(self)weakSelf = self; [[EZHttpUtil sharedManager] getAiSupportDetectionList:self.deviceInfo.deviceSerial completion:^(ResponseData * _Nonnull responseData) { [weakSelf.header endRefreshing]; if (responseData.success) { weakSelf.detectionTypeArray=[NSArray yy_modelArrayWithClass:[HDLEZDetectionTypeModel class] json:responseData.data]; weakSelf.detectionTypeView.detectionTypeList = weakSelf.detectionTypeArray; }else{ [weakSelf.view makeToast:responseData.message duration:1.5 position:@"center"]; } }]; } #pragma mark - PrivateMethod - (void)checkSelectedCode { for (HDLEZDetectionTypeModel *typeModel in self.detectionTypeArray) { if (typeModel.status) { self.selectedCode = typeModel.code; break; } } } - (void)sureAction { if (self.selectedCode && self.selectedCode.length > 0) { __weak __typeof(self)weakSelf = self; [[EZHttpUtil sharedManager] setAiSupportDetection:self.deviceInfo.deviceSerial code:self.selectedCode completion:^(ResponseData * _Nonnull responseData) { if (responseData.success) { [weakSelf.view makeToast:HDLEZLocallizedString(@"setting_opration_success") duration:1.5 position:@"center"]; [weakSelf.navigationController popViewControllerAnimated:YES]; } else { [weakSelf.view makeToast:responseData.message duration:1.5 position:@"center"]; } }]; } } #pragma mark - Getter - (HDLEZDetectionTypeView *)detectionTypeView { if (!_detectionTypeView) { _detectionTypeView = [[HDLEZDetectionTypeView alloc] init]; _detectionTypeView.backgroundColor = [UIColor clearColor]; } return _detectionTypeView; } - (UIButton *)sureButton { if (!_sureButton) { _sureButton = [UIButton buttonWithType:UIButtonTypeCustom]; [_sureButton setTitle:HDLEZLocallizedString(@"device_temp_sure") forState:UIControlStateNormal]; [_sureButton setTitleColor:HDLEZ_COLOR_TITLE_BLACK forState:UIControlStateNormal]; _sureButton.titleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_16); _sureButton.backgroundColor = UIColor.whiteColor; _sureButton.layer.cornerRadius = 22.; _sureButton.clipsToBounds = YES; } return _sureButton; } @end EZSDK/EZSDK/EZ/TempPassword/Models/HDLEZDetectionTypeModel.h
New file @@ -0,0 +1,20 @@ // // HDLEZDetectionTypeModel.h // EZSDK // // Created by Davin on 2023/8/5. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @interface HDLEZDetectionTypeModel : NSObject @property (nonatomic, copy) NSString *code; // 智能算法编码 @property (nonatomic, copy) NSString *desc; // 算法描述 @property (nonatomic, assign) BOOL status; // 状态:true-选中,false-未选中 @end NS_ASSUME_NONNULL_END EZSDK/EZSDK/EZ/TempPassword/Models/HDLEZDetectionTypeModel.m
New file @@ -0,0 +1,12 @@ // // HDLEZDetectionTypeModel.m // EZSDK // // Created by Davin on 2023/8/5. // #import "HDLEZDetectionTypeModel.h" @implementation HDLEZDetectionTypeModel @end EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDetectionTypeCell.h
New file @@ -0,0 +1,22 @@ // // HDLEZDetectionTypeCell.h // EZSDK // // Created by Davin on 2023/8/5. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface HDLEZDetectionTypeCell : UITableViewCell /// 检测信息设置 /// - Parameters: /// - detectionType: 检测类型 /// - isSelected: 是否选中 - (void)configDetectionType:(NSString *)detectionType selected:(BOOL)isSelected; @end NS_ASSUME_NONNULL_END EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDetectionTypeCell.m
New file @@ -0,0 +1,74 @@ // // HDLEZDetectionTypeCell.m // EZSDK // // Created by Davin on 2023/8/5. // #import "HDLEZDetectionTypeCell.h" @interface HDLEZDetectionTypeCell () @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UIImageView *selectedIcon; @end @implementation HDLEZDetectionTypeCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self createSubviews]; } return self; } - (void)createSubviews { self.backgroundColor = [UIColor whiteColor]; self.contentView.backgroundColor = [UIColor whiteColor]; [self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.selectedIcon]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.contentView.mas_left).offset(16); make.centerY.mas_equalTo(self.contentView.mas_centerY); }]; [self.selectedIcon mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_right).offset(16); make.right.mas_equalTo(self.contentView.mas_right).offset(-25.); make.centerY.mas_equalTo(self.titleLabel.mas_centerY); make.width.height.mas_equalTo(23); }]; } #pragma mark - PublishMethod - (void)configDetectionType:(NSString *)detectionType selected:(BOOL)isSelected { self.titleLabel.text = detectionType ? : @""; if (isSelected) { [self.selectedIcon setImage:[UIImage imageNamed:@"hdl_ez_detection_selected"]]; } else { [self.selectedIcon setImage:[UIImage imageNamed:@"hdl_ez_detection_normal"]]; } } #pragma mark - Getter - (UILabel *)titleLabel { if (!_titleLabel) { _titleLabel=[[UILabel alloc] init]; _titleLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14); _titleLabel.textColor=HDLEZ_COLOR_TITLE_BLACK; } return _titleLabel; } - (UIImageView *)selectedIcon { if (!_selectedIcon) { _selectedIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hdl_ez_detection_normal"]]; _selectedIcon.contentMode = UIViewContentModeScaleAspectFill; _selectedIcon.backgroundColor = UIColor.clearColor; } return _selectedIcon; } @end EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDetectionTypeView.h
New file @@ -0,0 +1,21 @@ // // HDLEZDetectionTypeView.h // EZSDK // // Created by Davin on 2023/8/5. // #import <UIKit/UIKit.h> #import "HDLEZDetectionTypeModel.h" NS_ASSUME_NONNULL_BEGIN @interface HDLEZDetectionTypeView : UITableView @property (nonatomic, strong) NSArray <HDLEZDetectionTypeModel *>*detectionTypeList; - (void)didSelectedDetectionType:(void(^)(NSString *code))selectedBlock; @end NS_ASSUME_NONNULL_END EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDetectionTypeView.m
New file @@ -0,0 +1,104 @@ // // HDLEZDetectionTypeView.m // EZSDK // // Created by Davin on 2023/8/5. // #import "HDLEZDetectionTypeView.h" #import "HDLEZDetectionTypeCell.h" @interface HDLEZDetectionTypeView ()<UITableViewDataSource, UITableViewDelegate> { CGFloat cellHeight; } @property (nonatomic, copy) void(^selectedDetectionType)(NSString *code); @end @implementation HDLEZDetectionTypeView -(instancetype)init{ self = [super init]; if (self) { self.backgroundColor = HDLEZ_COLOR_VIEW_BACKGROUND; self.separatorStyle = NO; self.showsVerticalScrollIndicator=NO; self.delegate = self; self.dataSource = self; cellHeight=60; self.rowHeight = UITableViewAutomaticDimension; self.estimatedRowHeight = 60; [self registerClass:[HDLEZDetectionTypeCell class] forCellReuseIdentifier:@"HDLEZDetectionTypeCell"]; [self setSeparatorInset:UIEdgeInsetsZero]; } return self; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.detectionTypeList.count; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return UITableViewAutomaticDimension; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ HDLEZLog(@"初始化cell"); HDLEZDetectionTypeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLEZDetectionTypeCell" forIndexPath:indexPath]; if(cell == nil){ cell=[[HDLEZDetectionTypeCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"HDLEZVideoDoorMsgCell"]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; [self configCell:cell indexPath:indexPath]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (self.detectionTypeList.count <= indexPath.row) return; HDLEZDetectionTypeModel *typeModel = self.detectionTypeList[indexPath.row]; [self selelctedDetectionType:typeModel]; } #pragma mark - PublishMethod - (void)didSelectedDetectionType:(void(^)(NSString *code))selectedBlock { self.selectedDetectionType = selectedBlock; } #pragma mark - PrivateMethod - (void)configCell:(HDLEZDetectionTypeCell *)cell indexPath:(NSIndexPath *)indexPath { if (self.detectionTypeList.count <= indexPath.row) return; HDLEZDetectionTypeModel *typeModel = self.detectionTypeList[indexPath.row]; [cell configDetectionType:typeModel.desc selected:typeModel.status]; } - (void)selelctedDetectionType:(HDLEZDetectionTypeModel *)selectedModel { for (HDLEZDetectionTypeModel *model in self.detectionTypeList) { model.status = NO; } selectedModel.status = YES; [self reloadData]; if (self.selectedDetectionType) { self.selectedDetectionType(selectedModel.code); } } #pragma makr - Setter - (void)setDetectionTypeList:(NSArray<HDLEZDetectionTypeModel *> *)detectionTypeList { _detectionTypeList = detectionTypeList; [self reloadData]; } @end EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZVideoDoorMsgCell.m
@@ -10,7 +10,7 @@ @interface HDLEZVideoDoorMsgCell () @property (strong, nonatomic) UILabel *messageTitle; @property (strong, nonatomic) UILabel *statusLabel; //@property (strong, nonatomic) UILabel *statusLabel; @property (strong, nonatomic) UILabel *timeLabel; @property (strong, nonatomic) UIImageView *messageImageView; @property (strong, nonatomic) UIView *separatorLine; @@ -29,7 +29,7 @@ - (void)createSubviews { self.contentView.backgroundColor = UIColor.whiteColor; [self.contentView addSubview:self.messageTitle]; [self.contentView addSubview:self.statusLabel]; // [self.contentView addSubview:self.statusLabel]; [self.contentView addSubview:self.timeLabel]; [self.contentView addSubview:self.messageImageView]; [self.contentView addSubview:self.separatorLine]; @@ -37,15 +37,16 @@ [self.messageTitle mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.contentView.mas_top).offset(24.); make.left.mas_equalTo(self.contentView.mas_left).offset(16.); make.right.mas_lessThanOrEqualTo(self.messageImageView.mas_left).offset(-16.); }]; [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.messageTitle.mas_top).offset(0.); make.left.mas_equalTo(self.messageTitle.mas_right).offset(8.); make.right.mas_lessThanOrEqualTo(self.messageImageView.mas_left).offset(-8.); make.width.mas_equalTo(40); make.height.mas_equalTo(20); }]; // [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.mas_equalTo(self.messageTitle.mas_top).offset(0.); // make.left.mas_equalTo(self.messageTitle.mas_right).offset(8.); // make.right.mas_lessThanOrEqualTo(self.messageImageView.mas_left).offset(-8.); // make.width.mas_equalTo(40); // make.height.mas_equalTo(20); // }]; [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.messageTitle.mas_bottom).offset(4.); @@ -70,22 +71,38 @@ } #pragma mark - PublishMethod - (void)configMessageInfoWithTitle:(NSString *)title deviceStatus:(NSString *)deviceStatus messageTime:(NSString *)time messageImage:(NSString *)messageUrl { if (title && title.length > 0) { self.messageTitle.text = title; } - (void)configMessageInfoWithTitle:(NSString *)title deviceStatus:(NSString *)deviceStatus messageTime:(NSString *)time messageImage:(NSString *)messageUrl { if (deviceStatus && deviceStatus.length > 0) { self.statusLabel.text = deviceStatus; [self.statusLabel mas_updateConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(40.); }]; self.statusLabel.backgroundColor = [deviceStatus isEqualToString:@"已接"] ? HDLEZHEXCOLOR(0x00C22D, 1.) : HDLEZHEXCOLOR(0xFF4747, 1.); NSMutableAttributedString *abs = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ ", title]]; UIImage *image = [UIImage imageNamed:([deviceStatus isEqualToString:@"已接"] ? @"hdl_ez_msg_answer" : @"hdl_ez_msg_no_answer")]; NSTextAttachment *attach = [[NSTextAttachment alloc] init]; attach.image = image; NSAttributedString *imageStr = [NSAttributedString attributedStringWithAttachment:attach]; [abs appendAttributedString:imageStr]; [abs addAttribute:NSBaselineOffsetAttributeName value:@(-5) range:NSMakeRange(title.length + 2, 1)]; // +2是适配空格 self.messageTitle.attributedText = abs; } else { [self.statusLabel mas_updateConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(0.); }]; if (title && title.length > 0) { self.messageTitle.text = title; } } // if (deviceStatus && deviceStatus.length > 0) { // // // // self.statusLabel.text = deviceStatus; // [self.statusLabel mas_updateConstraints:^(MASConstraintMaker *make) { // make.width.mas_equalTo(40.); // }]; // self.statusLabel.backgroundColor = [deviceStatus isEqualToString:@"已接"] ? HDLEZHEXCOLOR(0x00C22D, 1.) : HDLEZHEXCOLOR(0xFF4747, 1.); // } else { // [self.statusLabel mas_updateConstraints:^(MASConstraintMaker *make) { // make.width.mas_equalTo(0.); // }]; // } if (time && time.length > 0) { self.timeLabel.text = time; @@ -93,10 +110,12 @@ if (messageUrl && messageUrl.length > 0) { [self.messageImageView sd_setImageWithURL:[NSURL URLWithString:messageUrl] placeholderImageScale:[UIImage imageNamed:@"hdl_ez_msg_placeholder"]]; [self.messageImageView mas_updateConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(self.contentView.mas_right).offset(-16.); make.width.mas_equalTo(72.); }]; } else { [self.messageImageView mas_updateConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(self.contentView.mas_right).offset(0.); make.width.mas_equalTo(0.); }]; } @@ -112,22 +131,23 @@ _messageTitle=[[UILabel alloc] init]; _messageTitle.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14); _messageTitle.textColor=HDLEZ_COLOR_TITLE_BLACK; _messageTitle.lineBreakMode = NSLineBreakByTruncatingMiddle; _messageTitle.numberOfLines = 2; } return _messageTitle; } - (UILabel *)statusLabel { if (!_statusLabel) { _statusLabel=[[UILabel alloc] init]; _statusLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12); _statusLabel.textColor = HDLEZ_COLOR_TEXT_WHITE; _statusLabel.textAlignment = NSTextAlignmentCenter; _statusLabel.layer.cornerRadius = 4; _statusLabel.clipsToBounds = YES; } return _statusLabel; } //- (UILabel *)statusLabel { // if (!_statusLabel) { // _statusLabel=[[UILabel alloc] init]; // _statusLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12); // _statusLabel.textColor = HDLEZ_COLOR_TEXT_WHITE; // _statusLabel.textAlignment = NSTextAlignmentCenter; // _statusLabel.layer.cornerRadius = 4; // _statusLabel.clipsToBounds = YES; // } // return _statusLabel; //} - (UILabel *)timeLabel { if (!_timeLabel) { EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
@@ -1007,6 +1007,10 @@ NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; } dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.largeButton setImage:[UIImage imageNamed:@"preview_enlarge_full"] forState:UIControlStateNormal]; [self.largeButton setImage:[UIImage imageNamed:@"preview_enlarge_full_btn_sel"] forState:UIControlStateHighlighted]; }); } - (IBAction)largeBack:(id)sender @@ -1059,6 +1063,10 @@ NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; } dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.largeButton setImage:[UIImage imageNamed:@"preview_enlarge"] forState:UIControlStateNormal]; [self.largeButton setImage:[UIImage imageNamed:@"preview_enlarge_btn_sel"] forState:UIControlStateHighlighted]; }); } - (IBAction)capture:(id)sender @@ -1464,6 +1472,7 @@ // [UIView dd_showMessage:@"忽略开发中..."]; self.isShowAlert = NO; self.isAnswering = NO; [self.navigationController popViewControllerAnimated:YES]; } - (IBAction)clickCalloutAnswerAction:(id)sender { @@ -1475,7 +1484,6 @@ HDLEZLog(@"###########接听####:%@", [responseData yy_modelToJSONString]); }]; } [self.navigationController popViewControllerAnimated:YES]; } @@ -1609,7 +1617,7 @@ } } // CGFloat averageWidth = [UIScreen mainScreen].bounds.size.width/5.0; UIImageView *lineImageView1 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; UIImageView *lineImageView1 = [UIView dd_instanceVerticalLine:20 color:HDLEZHEXCOLOR(0xFFFFFF, 0.16)]; // lineImageView1.frame = CGRectMake(averageWidth, 7, lineImageView1.frame.size.width, lineImageView1.frame.size.height); [self.toolBar addSubview:lineImageView1]; [lineImageView1 mas_makeConstraints:^(MASConstraintMaker *make) { @@ -1618,7 +1626,7 @@ make.width.mas_equalTo(lineImageView1.frame.size.width); make.height.mas_equalTo(lineImageView1.frame.size.height); }]; UIImageView *lineImageView2 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; UIImageView *lineImageView2 = [UIView dd_instanceVerticalLine:20 color:HDLEZHEXCOLOR(0xFFFFFF, 0.16)]; // lineImageView2.frame = CGRectMake(averageWidth * 2, 7, lineImageView2.frame.size.width, lineImageView2.frame.size.height); [self.toolBar addSubview:lineImageView2]; [lineImageView2 mas_makeConstraints:^(MASConstraintMaker *make) { @@ -1627,7 +1635,7 @@ make.width.mas_equalTo(lineImageView2.frame.size.width); make.height.mas_equalTo(lineImageView2.frame.size.height); }]; UIImageView *lineImageView3 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; UIImageView *lineImageView3 = [UIView dd_instanceVerticalLine:20 color:HDLEZHEXCOLOR(0xFFFFFF, 0.16)]; // lineImageView3.frame = CGRectMake(averageWidth * 3, 7, lineImageView3.frame.size.width, lineImageView3.frame.size.height); [self.toolBar addSubview:lineImageView3]; [lineImageView3 mas_makeConstraints:^(MASConstraintMaker *make) { @@ -1636,7 +1644,7 @@ make.width.mas_equalTo(lineImageView3.frame.size.width); make.height.mas_equalTo(lineImageView3.frame.size.height); }]; UIImageView *lineImageView4 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]]; UIImageView *lineImageView4 = [UIView dd_instanceVerticalLine:20 color:HDLEZHEXCOLOR(0xFFFFFF, 0.16)]; // lineImageView4.frame = CGRectMake(averageWidth * 4, 7, lineImageView4.frame.size.width, lineImageView4.frame.size.height); [self.toolBar addSubview:lineImageView4]; [lineImageView4 mas_makeConstraints:^(MASConstraintMaker *make) { EZSDK/EZSDK/EZ/UIViewControllers/EZPlaybackViewController.m
@@ -25,6 +25,9 @@ #import "Toast+UIView.h" #import "EZCustomTableView.h" #import <EZOpenSDKFramework/EZStreamPlayer.h> #import <Photos/Photos.h> #import "FCFileManager.h" #import <EZOpenSDKFramework/EZVideoTransformer.h> @interface EZPlaybackViewController ()<DDCollectionViewDelegateFlowLayout, UICollectionViewDataSource,EZPlayerDelegate, UIAlertViewDelegate, EZRecordCellDelegate, EZCustomTableViewDelegate,EZStreamPlayerDelegate> @@ -333,7 +336,7 @@ cell.isSelectedDevice = _isSelectedDevice; cell.delegate = self; //2021-07-21 隐藏下载按钮 [cell.downloadBtn setHidden:YES]; [cell.downloadBtn setHidden:NO]; if(_isSelectedDevice) { @@ -421,9 +424,16 @@ EZDeviceRecordFile *deviceFile = (EZDeviceRecordFile *)recordFile; NSString *path = [NSString stringWithFormat:@"%@/ezopensdk/DeviceRecord/%@.ps",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject], [dateformatter stringFromDate:deviceFile.startTime]]; NSString *path = [NSString stringWithFormat:@"%@/ezopensdk/DeviceRecord/%@.ps",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject], [dateformatter stringFromDate:deviceFile.startTime]]; NSLog(@"path: %@ ", path); [self startDeviceRecordDownload:path deviceFile:deviceFile]; __weak __typeof(self)weakSelf = self; [self authPhotoLibraries:^(BOOL isAblity) { if (isAblity) { [weakSelf startDeviceRecordDownload:path deviceFile:deviceFile]; } else { [weakSelf guideUserOpenAuth]; } }]; } else { @@ -454,10 +464,17 @@ NSLog(@"statuCode:%ld", (long)statusCode); switch (statusCode) { case EZRecordDownloaderStatusFinish: [self.navigationController.view makeToast:[NSString stringWithFormat:@"SDD Task:%lu-下载成功", (unsigned long)strongTask.taskID]]; case EZRecordDownloaderStatusFinish:{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSLog(@"#########开始保存视频!!!!%@", path); NSDateFormatter *dateformatter = [[NSDateFormatter alloc] init]; dateformatter.dateFormat = @"yyyyMMddHHmmss"; NSString *mp4Path = [NSString stringWithFormat:@"%@/ezopensdk/DeviceRecord/%@.mp4", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject], [dateformatter stringFromDate:deviceFile.startTime]]; [self videoFormatConvertAndSave2Album:path mp4Path:mp4Path]; }); } break; case EZRecordDownloaderStatusMoreToken: @@ -500,6 +517,40 @@ }]; } /** 如果需要把回放视频保存到相册,一定要先把.ps文件转成.mp4文件 注意:下载录像过程中因为网络原因导致.ps文件未下载完,也可以调用此方法将已下载的录像片段解码成.mp4文件。 */ - (void)videoFormatConvertAndSave2Album:(NSString *)psPath mp4Path:(NSString *)mp4Path { [FCFileManager createFileAtPath:mp4Path overwrite:YES]; __weak typeof(self) weakSelf = self; [EZVideoTransformer videoTransFormerPSPath:psPath toPath:mp4Path type:EZVideoTransformerTypeMP4 withKey:_verifyCode succBlock:^{ NSLog(@"转换成功"); // 将.mp4文件保存到相册 PHPhotoLibrary *photoLibrary = [PHPhotoLibrary sharedPhotoLibrary]; [photoLibrary performChanges:^{ [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:[NSURL fileURLWithPath:mp4Path]]; } completionHandler:^(BOOL success, NSError * _Nullable error) { if (success) { dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf.navigationController.view makeToast:HDLEZLocallizedString(@"device_save_gallery")]; }); NSLog(@"########保存成功!!!"); // 下载完成后删除.ps和.mp4文件 [FCFileManager removeItemAtPath:psPath]; [FCFileManager removeItemAtPath:mp4Path]; } else { dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf.navigationController.view makeToast:HDLEZLocallizedString(@"device_save_gallery_failure")]; }); } }]; } processBlock:^(int rate) { // 转换进度 } failBlock:^(int errCode) { NSLog(@"转换失败"); }]; } - (void) startCloudRecordDownload:(NSString*)path cloudFile:(EZCloudRecordFile *)cloudFile { EZCloudRecordDownloadTask *task = [[EZCloudRecordDownloadTask alloc] initTaskWithID:_selectedIndexPath.row cloudRecordFile:cloudFile verifyCode:self.verifyCode savePath:path]; @@ -512,9 +563,17 @@ NSLog(@"statuCode:%ld", (long)statusCode); switch (statusCode) { case EZRecordDownloaderStatusFinish: [self.navigationController.view makeToast:[NSString stringWithFormat:@"CD Task:%lu-下载成功", (unsigned long)strongTask.taskID]]; case EZRecordDownloaderStatusFinish: { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSLog(@"#########开始保存视频!!!!%@", path); NSDateFormatter *dateformatter = [[NSDateFormatter alloc] init]; dateformatter.dateFormat = @"yyyyMMddHHmmss"; NSString *mp4Path = [NSString stringWithFormat:@"%@/ezopensdk/DeviceRecord/%@.mp4", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject], [dateformatter stringFromDate:cloudFile.startTime]]; [self videoFormatConvertAndSave2Album:path mp4Path:mp4Path]; }); } break; case EZRecordDownloaderStatusMoreToken: @@ -553,6 +612,69 @@ } } #pragma mark 视频保存完毕的回调 - (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{ dispatch_async(dispatch_get_main_queue(), ^{ if (error) { [self.navigationController.view makeToast:HDLEZLocallizedString(@"device_save_gallery_failure")]; NSLog(@"保存视频过程中发生错误,错误信息:%@",error.localizedDescription); NSLog(@"保存视频过程中发生错误,错误信息:%@",error); }else{ [self.navigationController.view makeToast:HDLEZLocallizedString(@"device_save_gallery")]; NSLog(@"视频保存成功."); } }); } /*访问相册权限 */ -(void)authPhotoLibraries:(void(^)(BOOL isAblity))result { PHAuthorizationStatus author =[PHPhotoLibrary authorizationStatus]; if (author == PHAuthorizationStatusRestricted || author ==PHAuthorizationStatusDenied){ if (result) { result(NO); } } else if (author == PHAuthorizationStatusNotDetermined) { // 首次授权 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(queue, ^{ [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { if (status != PHAuthorizationStatusAuthorized) { if (result) { result(NO); } } else { if (result) { result(YES); } } }]; }); } else { if (result) { result(YES); } } } /*引导用户授权获取图片 */ - (void)guideUserOpenAuth{ UIAlertController *alertC = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"hdl_ez_download_tip", @"温馨提示") message:NSLocalizedString(@"hdl_ez_download_auth", @"请打开访问权限") preferredStyle:(UIAlertControllerStyleAlert)]; UIAlertAction *alertA = [UIAlertAction actionWithTitle:NSLocalizedString(@"hdl_ez_download_cancle", @"取消") style:(UIAlertActionStyleDefault) handler:nil]; UIAlertAction *act = [UIAlertAction actionWithTitle:NSLocalizedString(@"hdl_ez_download_toSet", @"去设置") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // 引导用户设置 NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; } }]; [alertC addAction:alertA]; [alertC addAction:act]; [self presentViewController:alertC animated:YES completion:nil]; } #pragma mark - PlayerDelegate Methods - (void)player:(EZPlayer *)player didPlayFailed:(NSError *)error EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
@@ -17,6 +17,7 @@ #import "EZDeviceUpgradeViewController.h" #import <EZOpenSDKFramework/EZStorageInfo.h> #import "Toast+UIView.h" #import "HDLEZDetectionTypeViewController.h" //#import "EzvizDeviceManager.h" @@ -25,6 +26,7 @@ @property (nonatomic, strong) NSMutableArray *settingList; @property (nonatomic, weak) IBOutlet UISwitch *videoSwitch; @property (nonatomic, weak) IBOutlet UISwitch *actionSwitch; @property (nonatomic, strong) UIImageView *actionRightArrow; @property (weak, nonatomic) IBOutlet UISwitch *hdSwitch; @property (weak, nonatomic) IBOutlet UISwitch *privacyMaskSwitch; @property (weak, nonatomic) IBOutlet UIImageView *rightArrowImg; @@ -223,6 +225,17 @@ cell.textLabel.textAlignment = NSTextAlignmentLeft; cell.accessoryType = UITableViewCellAccessoryNone; cell.accessoryView = nil; cell.selectionStyle = UITableViewCellSelectionStyleNone; UIView *separatorLine = [[UIView alloc] init]; separatorLine.hidden = YES; // 默认隐藏分割线 [cell.contentView addSubview:separatorLine]; separatorLine.backgroundColor = HDLEZHEXCOLOR(0xECEDEE, 1.); [separatorLine mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(cell.contentView.mas_left).offset(16.); make.bottom.mas_equalTo(cell.contentView.mas_bottom); make.right.mas_equalTo(cell.contentView.mas_right).offset(-16.); make.height.mas_equalTo(0.5); }]; if (indexPath.section == 0) { [cell.contentView addSubview:self.nameLabel]; @@ -243,23 +256,25 @@ [cell.contentView addSubview:self.serialLabel]; [self.serialLabel mas_remakeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(@140); make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-34); make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-16); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.height.mas_equalTo(@20); }]; self.serialLabel.text = self.deviceInfo.deviceSerial; separatorLine.hidden = NO; } else if (indexPath.section == 5) { [cell.contentView addSubview:self.hdSwitch]; [self.hdSwitch mas_remakeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(@(-17)); make.trailing.mas_equalTo(@(-16)); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.width.mas_equalTo(@51); make.height.mas_equalTo(@31); }]; BOOL hdStatus = [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"EZVideoPlayHardDecodingStatus_%@", self.deviceInfo.deviceSerial]]; self.hdSwitch.on = hdStatus; separatorLine.hidden = NO; } else if (indexPath.section == 6) { @@ -278,7 +293,7 @@ } else { // 摄像头 [cell.contentView addSubview:self.privacyMaskSwitch]; [self.privacyMaskSwitch mas_remakeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(@(-17)); make.trailing.mas_equalTo(@(-16)); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.width.mas_equalTo(@51); make.height.mas_equalTo(@31); @@ -289,7 +304,7 @@ { [cell.contentView addSubview:self.rightArrowImg]; [self.rightArrowImg mas_remakeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(@(-17)); make.trailing.mas_equalTo(@(-16)); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.width.mas_equalTo(@16); make.height.mas_equalTo(@16); @@ -311,23 +326,32 @@ } else if (indexPath.section == 3) { [cell.contentView addSubview:self.actionSwitch]; [self.actionSwitch mas_remakeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(@(-17)); // [cell.contentView addSubview:self.actionSwitch]; // [self.actionSwitch mas_remakeConstraints:^(MASConstraintMaker *make) { // make.trailing.mas_equalTo(@(-16)); // make.centerY.mas_equalTo(cell.contentView.mas_centerY); // make.width.mas_equalTo(@51); // make.height.mas_equalTo(@31); // }]; [cell.contentView addSubview:self.actionRightArrow]; [self.actionRightArrow mas_remakeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(@(-16)); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.width.mas_equalTo(@51); make.height.mas_equalTo(@31); make.width.mas_equalTo(@16); make.height.mas_equalTo(@16); }]; separatorLine.hidden = NO; } else if (indexPath.section == 4) { [cell.contentView addSubview:self.videoSwitch]; [self.videoSwitch mas_remakeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(@(-17)); make.trailing.mas_equalTo(@(-16)); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.width.mas_equalTo(@51); make.height.mas_equalTo(@31); }]; separatorLine.hidden = NO; } else { @@ -336,17 +360,18 @@ [cell.contentView addSubview:self.currentVersionLabel]; [self.currentVersionLabel mas_remakeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(@140); make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-34); make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-16); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.height.mas_equalTo(@20); }]; separatorLine.hidden = NO; } else { [cell.contentView addSubview:self.nVersionLabel]; [self.nVersionLabel mas_remakeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(@140); make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-34); make.trailing.mas_equalTo(cell.contentView.mas_trailing).offset(-16); make.centerY.mas_equalTo(cell.contentView.mas_centerY); make.height.mas_equalTo(@20); }]; @@ -417,6 +442,12 @@ else if (indexPath.section == 2 && indexPath.row == 1 && self.updateImageView.hidden == NO) { [self performSegueWithIdentifier:@"go2Upgrade" sender:nil]; }else if (indexPath.section == 3) { HDLEZDetectionTypeViewController *detectionTypeVC = [[HDLEZDetectionTypeViewController alloc] init]; detectionTypeVC.deviceInfo = self.deviceInfo; [self.navigationController pushViewController:detectionTypeVC animated:YES]; } else if (indexPath.section == 7) { @@ -738,4 +769,13 @@ return _privacyMaskButton; } - (UIImageView *)actionRightArrow { if (!_actionRightArrow) { _actionRightArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hdl_ez_list_next"]]; _actionRightArrow.contentMode = UIViewContentModeScaleAspectFill; _actionRightArrow.backgroundColor = UIColor.clearColor; } return _actionRightArrow; } @end