-
53common/js/qqLatLng.js
-
3config/api.js
-
65manifest.json
-
BINnativePlugins/AP-FaceDetectModule/.DS_Store
-
BINnativePlugins/AP-FaceDetectModule/android/.DS_Store
-
BINnativePlugins/AP-FaceDetectModule/android/APSecuritySDK-DeepSec-7.0.1.20220813.jiagu.aar
-
BINnativePlugins/AP-FaceDetectModule/android/Android-AliyunFaceGuard-10038.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-base-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-facade-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-face-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-faceaudio-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-facelanguage-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-nfc-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-ocr-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-photinus-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/aliyun-wishverify-2.2.8.1-20230721163000.aar
-
BINnativePlugins/AP-FaceDetectModule/android/uniplugin_module-release.aar
-
BINnativePlugins/AP-FaceDetectModule/ios/.DS_Store
-
68nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.bundle/en.strings
-
59nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.bundle/id.strings
-
59nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.bundle/ja.strings
-
59nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.bundle/ko.strings
-
68nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.bundle/zh-HK.strings
-
68nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.bundle/zh-Hans.strings
-
68nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.bundle/zh-Hant.strings
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/.DS_Store
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/APBToygerFacade
-
76nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerBaseTask.h
-
19nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerCherryDetectTask.h
-
26nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerCherryUploadTask.h
-
36nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerFacade.h
-
130nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerFacadeDefine.h
-
25nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerPresentTask.h
-
27nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerUploadTask.h
-
61nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerUtils.h
-
34nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Headers/APBToygerViewController.h
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Info.plist
-
6nativePlugins/AP-FaceDetectModule/ios/APBToygerFacade.framework/Modules/module.modulemap
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_angle.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_away.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_blink.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_closer.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_integrity.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_left_yaw.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_light.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_right_yaw.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/APBToygerFacadeSuitable.bundle/voiceUrl_stay.mp3
-
BINnativePlugins/AP-FaceDetectModule/ios/AliyunFaceAuthFacade.framework/AliyunFaceAuthFacade
-
BINnativePlugins/AP-FaceDetectModule/ios/AliyunFaceAuthFacade.framework/AliyunFaceAuthFacade-Info.plist
-
44nativePlugins/AP-FaceDetectModule/ios/AliyunFaceAuthFacade.framework/Headers/AliyunFaceAuthFacade.h
-
28nativePlugins/AP-FaceDetectModule/ios/AliyunFaceAuthFacade.framework/Headers/PoPGatewayNetwork.h
-
BINnativePlugins/AP-FaceDetectModule/ios/AliyunFaceAuthFacade.framework/Info.plist
-
BINnativePlugins/AP-FaceDetectModule/ios/AliyunFaceAuthFacade.framework/en.lproj/InfoPlist.strings
-
BINnativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/.DS_Store
-
BINnativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/AliyunOSSiOS
-
20nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/AliyunOSSiOS.h
-
19nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/NSDate+OSS.h
-
15nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/NSMutableData+OSS_CRC.h
-
15nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/NSMutableDictionary+OSS.h
-
32nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSAllRequestNeededMessage.h
-
26nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSBolts.h
-
42nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSCancellationToken.h
-
29nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenRegistration.h
-
60nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenSource.h
-
110nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSClient.h
-
75nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSCocoaLumberjack.h
-
104nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSConstants.h
-
860nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSDDLog.h
-
84nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSDefine.h
-
62nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSExecutor.h
-
509nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSFileLogger.h
-
37nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSHttpResponseParser.h
-
54nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSLog.h
-
82nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSLogMacros.h
-
292nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSModel.h
-
14nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSNSLogger.h
-
45nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSNetworking.h
-
79nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSNetworkingRequestDelegate.h
-
64nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSReachability.h
-
41nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSRequest.h
-
42nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSResult.h
-
28nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSService.h
-
281nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSTask.h
-
89nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSTaskCompletionSource.h
-
36nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSURLRequestRetryHandler.h
-
75nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSUtil.h
-
88nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Headers/OSSXMLDictionary.h
-
6nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/Modules/module.modulemap
-
11nativePlugins/AP-FaceDetectModule/ios/AliyunOSSiOS.framework/PrivateHeaders/aos_crc64.h
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.bundle/image/back.png
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.bundle/image/close.png
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.bundle/image/open.png
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.bundle/image/open_shuke.png
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.bundle/image/status_bar_cancel.png
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.bundle/image/status_bar_cancel_suitable.png
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.framework/.DS_Store
-
BINnativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.framework/BioAuthEngine
-
76nativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.framework/Headers/AFEAlertView.h
-
31nativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.framework/Headers/AFECircleProgressBar.h
-
70nativePlugins/AP-FaceDetectModule/ios/BioAuthEngine.framework/Headers/AFECircularView.h
@ -0,0 +1,53 @@ |
|||
|
|||
|
|||
var KJTencentLocation = uni.requireNativePlugin("KJ-TencentLocation"); |
|||
|
|||
var kic = { |
|||
"apiKey": "BPMBZ-VSKE3-MC23F-O3KZO-AZGI7-PXFJI", //ios才有效,andorid的在App原生插件配置里设置
|
|||
"deviceID": "oaid"//andorid必须设置,默认使用oaid,ios无需设置
|
|||
} |
|||
KJTencentLocation.init(kic); |
|||
|
|||
var dic = { |
|||
"coordinateType": "gcj02", //设置坐标系 GCJ02(火星坐标,即国测局坐标) WGS84(地球坐标,注:如果是海外,无论设置的是火星坐标还是地球坐标,返回的都是地球坐标)
|
|||
"requestLevel": 4, //请求等级 0(包含经纬度) 1(包含经纬度, 位置名称, 位置地址) 3(包含经纬度,位置所处的中国大陆行政区划) 4(包含经纬度,位置所处的中国大陆行政区划及周边POI列表)
|
|||
/**以下andorid有效**/ |
|||
"mockEnable": false, //是否允许mockGps数据 设置为true后将不对mockGps进行过滤,是否允许应用对GPS进行模拟
|
|||
"systemCacheEnable": false, //是否允许在定位失败情况下返回系统缓存位置
|
|||
//"deviceID":"xxx", //设备id
|
|||
"userAgreePrivacy": true, //设置用户是否同意隐私协议政策
|
|||
"allowCache": true, //是否允许使用缓存
|
|||
"allowDirection": true, //是否允许使用设备传感器获取方向
|
|||
"allowGPS": true, //是否允许使用GPS进行定位
|
|||
"gnssSource": 20, //设置优先卫星定位信号来源 改设置仅对连续定位生效,20(GPS) 21(北斗)
|
|||
"gpsFirst": false, //首次定位是否等待卫星定位结果,默认为false 当设置为true时,首次定位会等待卫星定位结果,默认等待时间为30s,超时将返回网络定位结果
|
|||
"gpsFirstTimeOut": 10000, //卫星定位优先时,等待卫星定位结果对的超时时间,单位: ms, 最多等待60s.
|
|||
"indoorLocationMode": true, //启动室内定位
|
|||
"interval": 5000, //定位周期(位置监听器回调周期), 单位为 ms (毫秒).
|
|||
"locMode": 10, //定位模式 10(高精度定位模式,将同时使用网络定位和卫星定位,优先返回精度高的定位) 11(仅网络定位模式,将不启动gps定位,只使用网络定位,可以减少耗电量,但定位精度有所降低) 12(仅GPS定位模式)
|
|||
// "phoneNumber": "111",
|
|||
// "qq": "xxx",
|
|||
// "smallAppKey": "xxx", //设置分渠道的key编码号,例如小程序里面区分业务.
|
|||
/**以下ios有效**/ |
|||
"distanceFilter": 0, //设置定位的最小更新距离
|
|||
"desiredAccuracy": "best", //设置定位精度 bestForNavigation best nearestTenMeters hundredMeters kilometer threeKilometers
|
|||
"pausesLocationUpdatesAutomatically": false, //定设置位是否会被系统自动暂停
|
|||
"allowsBackgroundLocationUpdates": true, //设置是否允许后台定位 为true 需要配置manifest.json->App常用其它设置->后台运行能力 location
|
|||
"activityType": 1, //设置用户的活动类型 1(未知的出行活动类型) 2(位置管理器专门为出行活动为汽车的时候导航) 3(位置管理器专门为步行、跑步、骑自行车等健身时,提供导航) 4(位置管理器专门为其他类型的大型交通工具导航,而不是汽车导航)
|
|||
//"headingFilter": 10, //设置当朝向改变时,每隔多少度调用一次
|
|||
"headingOrientation": 0, //设置设备当前的朝向 0(未知) 1(竖屏) 2(竖屏正方向,颠倒) 3(屏左方向,主按钮在右侧) 4(横屏右方向,主按钮在左侧) 5(设备正面朝上) 6(设备正面朝下)
|
|||
"poiUpdateInterval": 10, //指定POI的更新间隔 单位秒
|
|||
"enableAntiMockLocation": true //是否允许开启反作弊检查
|
|||
} |
|||
|
|||
KJTencentLocation.setLocationManagerInfo(dic) |
|||
|
|||
export function requestSingleFreshLocation() { |
|||
console.log(KJTencentLocation.requestSingleFreshLocation) |
|||
return new Promise((resolve,reject)=>{ |
|||
KJTencentLocation.requestSingleFreshLocation((res) => { |
|||
resolve(res) |
|||
}); |
|||
}) |
|||
|
|||
} |
@ -0,0 +1,68 @@ |
|||
/* |
|||
en.strings |
|||
APBToygerFacade |
|||
|
|||
Created by shouyi.www on 2017/6/1. |
|||
Copyright © 2017年 DTF. All rights reserved. |
|||
*/ |
|||
|
|||
"APBToygerFacade:取消"="Cancel"; |
|||
"APBToygerFacade:再试一次"="Try Again"; |
|||
"APBToygerFacade:退出"="Quit"; |
|||
"APBToygerFacade:确定"="OK"; |
|||
"APBToygerFacade:继续"="Continue"; |
|||
"APBToygerFacade:我知道了"="Got it"; |
|||
"APBToygerFacade:其他登录方式"="Another login method"; |
|||
"APBToygerFacade:刷脸失败"="Face scan failed"; |
|||
"APBToygerFacade:当前设备不支持刷脸"="Face scan not supported on your device"; |
|||
"APBToygerFacade:当前系统不支持刷脸"="Face scan not supported on your device system"; |
|||
"APBToygerFacade:无法启动相机"="No camera permission"; |
|||
"APBToygerFacade:请到\“设置-隐私-相机\”开启权限"="Please allow to access your camera in \"Settings\"-\"Privacy\"-\"Camera\""; |
|||
"APBToygerFacade:立即开启"="OK"; |
|||
"APBToygerFacade:刷脸仅在iOS7及以上系统可用"="Face scan is only available on iOS8 or above"; |
|||
"APBToygerFacade:系统错误"="System error"; |
|||
"APBToygerFacade:确定退出吗?"="Are you sure to quit face scan?"; |
|||
"APBToygerFacade:露个脸就能通过"="You can succeed by simply showing your face"; |
|||
"APBToygerFacade:操作超时"="Time out"; |
|||
"APBToygerFacade:正对手机,更容易成功"="Face straight at the phone and ensure you have enough light"; |
|||
"APBToygerFacade:提示:正对手机,更容易成功"="Face straight at the phone and ensure you have enough light"; |
|||
"APBToygerFacade:本次操作失败"="Sorry, face scan failed"; |
|||
"APBToygerFacade:网络不给力"="Network connection failed"; |
|||
"APBToygerFacade:登录中断"="Login interrupted"; |
|||
"APBToygerFacade:验证中断"="Face scan interrupted"; |
|||
|
|||
|
|||
"APBToygerFacade:刷脸验证"="Face Scan"; |
|||
"APBToygerFacade:请把脸放入框内保持不动"="Put your face into the frame"; |
|||
"APBToygerFacade:靠近一点"="Move closer"; |
|||
"APBToygerFacade:没有检测到脸"="No face"; |
|||
"APBToygerFacade:再清晰一点"="Face not clear"; |
|||
"APBToygerFacade:脸部亮一点"="More light"; |
|||
"APBToygerFacade:请正对手机"="No face"; |
|||
"APBToygerFacade:把脸移入圈内"="No face"; |
|||
"APBToygerFacade:离远一点"="Move farther"; |
|||
"APBToygerFacade:请保持不动"="Stay still"; |
|||
"APBToygerFacade:请注视屏幕"="Open your eyes"; |
|||
"APBToygerFacade:眨眨眼"="Blink"; |
|||
"APBToygerFacade:蚂蚁佐罗提供技术支持"=""; |
|||
|
|||
"APBToygerFacade:选择其他验证方式"="Use a different verification method"; |
|||
"APBToygerFacade:拿起手机眨眨眼"="Blink"; |
|||
"APBToygerFacade:拿起手机向左摇头"="Turn Head Left"; |
|||
"APBToygerFacade:拿起手机向右摇头"="Turn Head Right"; |
|||
"APBToygerFacade:向左摇头"="Turn Head Left"; |
|||
"APBToygerFacade:向右摇头"="Turn Head Right"; |
|||
|
|||
|
|||
"APBToygerFacade:正在处理"="Processing"; |
|||
"APBToygerFacade:首次使用,请开通刷脸"="For the first time use, please enable Face Scan"; |
|||
"APBToygerFacade:立即开通"="Enable"; |
|||
"APBToygerFacade:下次再说"="Later"; |
|||
|
|||
"APBToygerFacade:请把手机正对面部"="Face straight at the phone"; |
|||
"APBToygerFacade:即将开始人脸检测"="Get ready for face recognition"; |
|||
|
|||
"APBToygerFacade:没有认出你"="Face scan failed"; |
|||
"APBToygerFacade:未能识别人脸"="Face not detected"; |
|||
"APBToygerFacade:人脸检测中"="Face Scan"; |
|||
"APBToygerFacade:刷脸失败次数过多,请稍后再试"="Too many failed attempts, please try again later"; |
@ -0,0 +1,59 @@ |
|||
"APBToygerFacade:取消"="Batalkan"; |
|||
"APBToygerFacade:再试一次"="Harap coba lagi"; |
|||
"APBToygerFacade:退出"="Keluar"; |
|||
"APBToygerFacade:确定"="OK"; |
|||
"APBToygerFacade:继续"="Lanjutkan"; |
|||
"APBToygerFacade:我知道了"="OK"; |
|||
"APBToygerFacade:其他登录方式"="Ubah Metode Logon"; |
|||
"APBToygerFacade:刷脸失败"="Pengenalan wajah gagal"; |
|||
"APBToygerFacade:当前设备不支持刷脸"="Perangkat Anda tidak mendukung pengenalan wajah"; |
|||
"APBToygerFacade:当前系统不支持刷脸"="Sistem saat ini tidak mendukung pengenalan wajah"; |
|||
"APBToygerFacade:无法启动相机"="Tidak Memiliki Izin Akses Kamera"; |
|||
"APBToygerFacade:请到\“设置-隐私-相机\”开启权限"="Buka Pengaturan > Privasi > Kamera dan izinkan akses"; |
|||
"APBToygerFacade:立即开启"="OK"; |
|||
"APBToygerFacade:刷脸仅在iOS7及以上系统可用"="Hanya iOS 7 dan setelahnya yang mendukung pengenalan wajah"; |
|||
"APBToygerFacade:系统错误"="Terjadi Kesalahan Sistem"; |
|||
"APBToygerFacade:确定退出吗?"="Apakah Anda yakin ingin keluar?"; |
|||
"APBToygerFacade:露个脸就能通过"="Anda hanya perlu memperlihatkan wajah Anda"; |
|||
"APBToygerFacade:操作超时"="Waktu operasi habis"; |
|||
"APBToygerFacade:正对手机,更容易成功"="Arahkan wajah lurus menghadap ponsel untuk membuat wajah Anda lebih mudah dipindai"; |
|||
"APBToygerFacade:本次操作失败"="Operasi gagal"; |
|||
"APBToygerFacade:网络不给力"="Kondisi jaringan tidak memenuhi persyaratan"; |
|||
"APBToygerFacade:登录中断"="Logon Terganggu"; |
|||
"APBToygerFacade:验证中断"="Verifikasi terputus"; |
|||
|
|||
|
|||
"APBToygerFacade:刷脸验证"="Verifikasi dengan Pengenalan Wajah"; |
|||
"APBToygerFacade:请把脸放入框内保持不动"="Posisikan wajah Anda di dalam bingkai dan jangan bergerak"; |
|||
"APBToygerFacade:靠近一点"="Harap dekatkan wajah"; |
|||
"APBToygerFacade:没有检测到脸"="Tidak ada wajah terdeteksi"; |
|||
"APBToygerFacade:再清晰一点"="Perjelas wajah Anda"; |
|||
"APBToygerFacade:脸部亮一点"="Terangi wajah Anda"; |
|||
"APBToygerFacade:请正对手机"="Arahkan wajah lurus menghadap ponsel"; |
|||
"APBToygerFacade:请露出正脸"="Tunjukkan bagian depan wajah Anda"; |
|||
"APBToygerFacade:把脸移入圈内"="Posisikan wajah pada lingkaran"; |
|||
"APBToygerFacade:离远一点"="Harap jauhkan wajah"; |
|||
"APBToygerFacade:请保持不动"="Tetap tenang"; |
|||
"APBToygerFacade:请注视屏幕"="Lihat layar"; |
|||
"APBToygerFacade:眨眨眼"="Harap kedipkan mata"; |
|||
"APBToygerFacade:蚂蚁佐罗提供技术支持"=""; |
|||
|
|||
"APBToygerFacade:选择其他验证方式"="Ubah Metode Verifikasi"; |
|||
"APBToygerFacade:拿起手机眨眨眼"="Harap kedipkan mata"; |
|||
"APBToygerFacade:拿起手机向左摇头"="Harap menoleh ke kiri"; |
|||
"APBToygerFacade:拿起手机向右摇头"="Harap menoleh ke kanan"; |
|||
"APBToygerFacade:向左摇头"="Harap menoleh ke kiri"; |
|||
"APBToygerFacade:向右摇头"="Harap menoleh ke kanan"; |
|||
|
|||
"APBToygerFacade:正在处理"="Memproses"; |
|||
"APBToygerFacade:首次使用,请开通刷脸"="Aktifkan pengenalan wajah untuk melanjutkan"; |
|||
"APBToygerFacade:立即开通"="Aktifkan"; |
|||
"APBToygerFacade:下次再说"="Lain Kali"; |
|||
|
|||
"APBToygerFacade:请把手机正对面部"="Arahkan wajah lurus menghadap ponsel"; |
|||
"APBToygerFacade:即将开始人脸检测"="Memulai pengenalan wajah"; |
|||
|
|||
"APBToygerFacade:没有认出你"="Pengenalan wajah gagal"; |
|||
"APBToygerFacade:未能识别人脸"="Tidak ada wajah terdeteksi"; |
|||
"APBToygerFacade:人脸检测中"="Pengenalan wajah dalam proses"; |
|||
"APBToygerFacade:刷脸失败次数过多,请稍后再试"="Pengenalan wajah terlalu sering dilakukan. Harap coba lagi nanti"; |
@ -0,0 +1,59 @@ |
|||
"APBToygerFacade:取消"="キャンセル"; |
|||
"APBToygerFacade:再试一次"="もう一度お試しください"; |
|||
"APBToygerFacade:退出"="終了"; |
|||
"APBToygerFacade:确定"="OK"; |
|||
"APBToygerFacade:继续"="続行"; |
|||
"APBToygerFacade:我知道了"="OK"; |
|||
"APBToygerFacade:其他登录方式"="ログイン方法を切り替え"; |
|||
"APBToygerFacade:刷脸失败"="顔を認識できませんでした"; |
|||
"APBToygerFacade:当前设备不支持刷脸"="お使いのデバイスは顔認識をサポートしていません"; |
|||
"APBToygerFacade:当前系统不支持刷脸"="顔認識をサポートしていないシステムです"; |
|||
"APBToygerFacade:无法启动相机"="カメラにアクセスできません"; |
|||
"APBToygerFacade:请到\“设置-隐私-相机\”开启权限"="[設定] > [プライバシー] > [カメラ] に移動し、アクセスを許可してください"; |
|||
"APBToygerFacade:立即开启"="OK"; |
|||
"APBToygerFacade:刷脸仅在iOS7及以上系统可用"="顔認識は iOS 7 以降でサポートされています"; |
|||
"APBToygerFacade:系统错误"="システムエラー"; |
|||
"APBToygerFacade:确定退出吗?"="終了してもよろしいですか"; |
|||
"APBToygerFacade:露个脸就能通过"="顔を見せるだけです"; |
|||
"APBToygerFacade:操作超时"="操作がタイムアウトしました"; |
|||
"APBToygerFacade:正对手机,更容易成功"="顔をスキャンしやすいように、電話の方を向いてください"; |
|||
"APBToygerFacade:本次操作失败"="操作に失敗しました"; |
|||
"APBToygerFacade:网络不给力"="ネットワークの状態が要件を満たしていません"; |
|||
"APBToygerFacade:登录中断"="ログインが中断されました"; |
|||
"APBToygerFacade:验证中断"="検証が中断されました"; |
|||
|
|||
|
|||
"APBToygerFacade:刷脸验证"="顔認識による検証"; |
|||
"APBToygerFacade:请把脸放入框内保持不动"="フレームの内側に顔が入るようにして、動かないでください"; |
|||
"APBToygerFacade:靠近一点"="近づいてください"; |
|||
"APBToygerFacade:没有检测到脸"="顔が検出されません"; |
|||
"APBToygerFacade:再清晰一点"="顔をはっきりさせてください"; |
|||
"APBToygerFacade:脸部亮一点"="顔を明るくしてください"; |
|||
"APBToygerFacade:请正对手机"="電話の方を向いてください"; |
|||
"APBToygerFacade:请露出正脸"="顔の正面を見せてください"; |
|||
"APBToygerFacade:把脸移入圈内"="顔を円の中に入れてください"; |
|||
"APBToygerFacade:离远一点"="離れてください"; |
|||
"APBToygerFacade:请保持不动"="動かないでください"; |
|||
"APBToygerFacade:请注视屏幕"="画面を見てください"; |
|||
"APBToygerFacade:眨眨眼"="まばたきしてください"; |
|||
"APBToygerFacade:蚂蚁佐罗提供技术支持"=""; |
|||
|
|||
"APBToygerFacade:选择其他验证方式"="検証方法を変更"; |
|||
"APBToygerFacade:拿起手机眨眨眼"="まばたきしてください"; |
|||
"APBToygerFacade:拿起手机向左摇头"="頭を左に"; |
|||
"APBToygerFacade:拿起手机向右摇头"="頭を右に"; |
|||
"APBToygerFacade:向左摇头"="頭を左に"; |
|||
"APBToygerFacade:向右摇头"="頭を右に"; |
|||
|
|||
"APBToygerFacade:正在处理"="処理中"; |
|||
"APBToygerFacade:首次使用,请开通刷脸"="顔認識を有効化して続行します"; |
|||
"APBToygerFacade:立即开通"="有効化"; |
|||
"APBToygerFacade:下次再说"="後で"; |
|||
|
|||
"APBToygerFacade:请把手机正对面部"="電話の方を向いてください"; |
|||
"APBToygerFacade:即将开始人脸检测"="顔認識を開始"; |
|||
|
|||
"APBToygerFacade:没有认出你"="顔を認識できませんでした"; |
|||
"APBToygerFacade:未能识别人脸"="顔が検出されません"; |
|||
"APBToygerFacade:人脸检测中"="顔を認識中です"; |
|||
"APBToygerFacade:刷脸失败次数过多,请稍后再试"="顔認識が頻繁に実行されています。後でもう一度やり直してください"; |
@ -0,0 +1,59 @@ |
|||
"APBToygerFacade:取消"="취소"; |
|||
"APBToygerFacade:再试一次"="다시 시도하세요"; |
|||
"APBToygerFacade:退出"="종료"; |
|||
"APBToygerFacade:确定"="확인"; |
|||
"APBToygerFacade:继续"="계속"; |
|||
"APBToygerFacade:我知道了"="확인"; |
|||
"APBToygerFacade:其他登录方式"="로그온 방법 전환"; |
|||
"APBToygerFacade:刷脸失败"="안면 인식에 실패했습니다"; |
|||
"APBToygerFacade:当前设备不支持刷脸"="귀하의 디바이스는 안면 인식을 지원하지 않습니다"; |
|||
"APBToygerFacade:当前系统不支持刷脸"="현재 시스템은 안면 인식을 지원하지 않습니다"; |
|||
"APBToygerFacade:无法启动相机"="카메라 권한이 없습니다"; |
|||
"APBToygerFacade:请到\“设置-隐私-相机\”开启权限"="설정 > 개인 > 카메라에서 접근 권한을 부여하십시오"; |
|||
"APBToygerFacade:立即开启"="OK"; |
|||
"APBToygerFacade:刷脸仅在iOS7及以上系统可用"="iOS 7 및 그 이상의 버전에서만 안면 인식이 지원됩니다"; |
|||
"APBToygerFacade:系统错误"="시스템 오류"; |
|||
"APBToygerFacade:确定退出吗?"="정말로 종료하시겠습니까?"; |
|||
"APBToygerFacade:露个脸就能通过"="얼굴만 보여주시면 됩니다"; |
|||
"APBToygerFacade:操作超时"="작업 시간이 초과되었습니다"; |
|||
"APBToygerFacade:正对手机,更容易成功"="얼굴을 더 쉽게 스캔할 수 있도록 휴대전화를 정면으로 바라보세요"; |
|||
"APBToygerFacade:本次操作失败"="작동에 실패했습니다"; |
|||
"APBToygerFacade:网络不给力"="네트워크 상태가 요구 사항을 충족하지 않습니다"; |
|||
"APBToygerFacade:登录中断"="로그온이 중단되었습니다"; |
|||
"APBToygerFacade:验证中断"="확인이 중단되었습니다"; |
|||
|
|||
|
|||
"APBToygerFacade:刷脸验证"="안면 인식을 통한 인증"; |
|||
"APBToygerFacade:请把脸放入框内保持不动"="얼굴이 프레임 안으로 들어오도록 위치한 다음 움직이지 말고 가만히 계십시오"; |
|||
"APBToygerFacade:靠近一点"="더 가까이 움직이세요"; |
|||
"APBToygerFacade:没有检测到脸"="감지된 얼굴이 없습니다"; |
|||
"APBToygerFacade:再清晰一点"="얼굴을 좀더 선명하게 만드세요"; |
|||
"APBToygerFacade:脸部亮一点"="얼굴을 밝게 만드세요"; |
|||
"APBToygerFacade:请正对手机"="휴대전화를 정면으로 바라보세요"; |
|||
"APBToygerFacade:请露出正脸"="얼굴의 정면을 보여주세요"; |
|||
"APBToygerFacade:把脸移入圈内"="얼굴이 원 안에 들어오도록 움직이세요"; |
|||
"APBToygerFacade:离远一点"="더 멀리 움직이세요"; |
|||
"APBToygerFacade:请保持不动"="가만히 계십시오"; |
|||
"APBToygerFacade:请注视屏幕"="화면을 바라보세요"; |
|||
"APBToygerFacade:眨眨眼"="눈을 깜빡이세요"; |
|||
"APBToygerFacade:蚂蚁佐罗提供技术支持"=""; |
|||
|
|||
"APBToygerFacade:选择其他验证方式"="인증 방법을 변경합니다"; |
|||
"APBToygerFacade:拿起手机眨眨眼"="눈을 깜빡이세요"; |
|||
"APBToygerFacade:拿起手机向左摇头"="좌측으로 고개를 돌립니다"; |
|||
"APBToygerFacade:拿起手机向右摇头"="우측으로 고개를 돌립니다"; |
|||
"APBToygerFacade:向左摇头"="좌측으로 고개를 돌립니다"; |
|||
"APBToygerFacade:向右摇头"="우측으로 고개를 돌립니다"; |
|||
|
|||
"APBToygerFacade:正在处理"="처리 중"; |
|||
"APBToygerFacade:首次使用,请开通刷脸"="안면 인식을 활성화하여 계속 진행합니다"; |
|||
"APBToygerFacade:立即开通"="활성화하기"; |
|||
"APBToygerFacade:下次再说"="나중에 하기"; |
|||
|
|||
"APBToygerFacade:请把手机正对面部"="휴대전화를 정면으로 바라보세요"; |
|||
"APBToygerFacade:即将开始人脸检测"="안면 인식 시작"; |
|||
|
|||
"APBToygerFacade:没有认出你"="안면 인식에 실패했습니다"; |
|||
"APBToygerFacade:未能识别人脸"="감지된 얼굴이 없습니다"; |
|||
"APBToygerFacade:人脸检测中"="얼굴 인식 중"; |
|||
"APBToygerFacade:刷脸失败次数过多,请稍后再试"="안면 인식이 연속으로 실행되었습니다. 나중에 다시 시도하세요"; |
@ -0,0 +1,68 @@ |
|||
/* |
|||
zh-HK.strings |
|||
APBToygerFacade |
|||
|
|||
Created by shouyi.www on 2017/6/1. |
|||
Copyright © 2017年 DTF. All rights reserved. |
|||
*/ |
|||
|
|||
|
|||
"APBToygerFacade:取消"="取消"; |
|||
"APBToygerFacade:再试一次"="再試一次"; |
|||
"APBToygerFacade:退出"="退出"; |
|||
"APBToygerFacade:确定"="確定"; |
|||
"APBToygerFacade:继续"="继续"; |
|||
"APBToygerFacade:我知道了"="我知道了"; |
|||
"APBToygerFacade:其他登录方式"="其他登录方式"; |
|||
"APBToygerFacade:刷脸失败"="刷臉失敗"; |
|||
"APBToygerFacade:当前设备不支持刷脸"="目前系統不支援刷臉"; |
|||
"APBToygerFacade:当前系统不支持刷脸"="目前設備不支援刷臉"; |
|||
"APBToygerFacade:无法启动相机"="無法啟動相機"; |
|||
"APBToygerFacade:请到\“设置-隐私-相机\”开启权限"="請到“設置-隱私-相機”開啓權限"; |
|||
"APBToygerFacade:立即开启"="開通權限"; |
|||
"APBToygerFacade:刷脸仅在iOS7及以上系统可用"="刷脸仅在iOS7及以上系统可用"; |
|||
"APBToygerFacade:系统错误"="系統錯誤"; |
|||
"APBToygerFacade:确定退出吗?"="確定退出嗎?"; |
|||
"APBToygerFacade:露个脸就能通过"="露個臉就能通過"; |
|||
"APBToygerFacade:操作超时"="操作超時"; |
|||
"APBToygerFacade:正对手机,更容易成功"="對準手機,更容易成功"; |
|||
"APBToygerFacade:本次操作失败"="本次操作失敗"; |
|||
"APBToygerFacade:网络不给力"="網絡異常,請稍後再試"; |
|||
"APBToygerFacade:登录中断"="登入中斷"; |
|||
"APBToygerFacade:验证中断"="驗證中斷"; |
|||
|
|||
|
|||
"APBToygerFacade:刷脸验证"="刷臉驗證"; |
|||
"APBToygerFacade:请把脸放入框内保持不动"="請把臉移入圈內保持不動"; |
|||
"APBToygerFacade:靠近一点"="靠近一點"; |
|||
"APBToygerFacade:没有检测到脸"="沒有檢測到臉"; |
|||
"APBToygerFacade:再清晰一点"="再清晰一點"; |
|||
"APBToygerFacade:脸部亮一点"="光線再亮點"; |
|||
"APBToygerFacade:请正对手机"="請正視手機"; |
|||
"APBToygerFacade:请露出正脸"="請露出正臉"; |
|||
"APBToygerFacade:把脸移入圈内"="把臉移入框內"; |
|||
"APBToygerFacade:离远一点"="離遠一點"; |
|||
"APBToygerFacade:请保持不动"="請保持不動"; |
|||
"APBToygerFacade:请注视屏幕"="請注視屏幕"; |
|||
"APBToygerFacade:眨眨眼"="眨眨眼"; |
|||
"APBToygerFacade:蚂蚁佐罗提供技术支持"=""; |
|||
|
|||
"APBToygerFacade:选择其他验证方式"="選擇其他驗證方式"; |
|||
"APBToygerFacade:拿起手机眨眨眼"="拿起手機,眨眨眼"; |
|||
"APBToygerFacade:拿起手机向左摇头"="拿著手機,向左搖頭"; |
|||
"APBToygerFacade:拿起手机向右摇头"="拿著手機,向右搖頭"; |
|||
"APBToygerFacade:向左摇头"="向左搖頭"; |
|||
"APBToygerFacade:向右摇头"="向右搖頭"; |
|||
|
|||
"APBToygerFacade:正在处理"="正在處理"; |
|||
"APBToygerFacade:首次使用,请开通刷脸"="首次使用,請開通刷臉"; |
|||
"APBToygerFacade:立即开通"="立即開通"; |
|||
"APBToygerFacade:下次再说"="下次再說"; |
|||
|
|||
"APBToygerFacade:请把手机正对面部"="請把手機正對面部"; |
|||
"APBToygerFacade:即将开始人脸检测"="即將開始人臉檢測"; |
|||
|
|||
"APBToygerFacade:没有认出你"="沒有認出你"; |
|||
"APBToygerFacade:未能识别人脸"="未能識別人臉"; |
|||
"APBToygerFacade:人脸检测中"="人臉檢測中"; |
|||
"APBToygerFacade:刷脸失败次数过多,请稍后再试"="刷臉失敗次數過多,請稍後再試"; |
@ -0,0 +1,68 @@ |
|||
/* |
|||
zh-Hans.strings |
|||
APBToygerFacade |
|||
|
|||
Created by shouyi.www on 2017/6/1. |
|||
Copyright © 2017年 DTF. All rights reserved. |
|||
*/ |
|||
|
|||
|
|||
"APBToygerFacade:取消"="取消"; |
|||
"APBToygerFacade:再试一次"="再试一次"; |
|||
"APBToygerFacade:退出"="退出"; |
|||
"APBToygerFacade:确定"="确定"; |
|||
"APBToygerFacade:继续"="继续"; |
|||
"APBToygerFacade:我知道了"="我知道了"; |
|||
"APBToygerFacade:其他登录方式"="其他登录方式"; |
|||
"APBToygerFacade:刷脸失败"="刷脸失败"; |
|||
"APBToygerFacade:当前设备不支持刷脸"="当前设备不支持刷脸"; |
|||
"APBToygerFacade:当前系统不支持刷脸"="当前系统不支持刷脸"; |
|||
"APBToygerFacade:无法启动相机"="无法启动相机"; |
|||
"APBToygerFacade:请到\“设置-隐私-相机\”开启权限"="请到“设置-隐私-相机”开启权限"; |
|||
"APBToygerFacade:立即开启"="立即开启"; |
|||
"APBToygerFacade:刷脸仅在iOS8及以上版本可用"="刷脸仅在iOS8及以上版本可用"; |
|||
"APBToygerFacade:系统错误"="系统错误"; |
|||
"APBToygerFacade:确定退出吗?"="确定退出吗?"; |
|||
"APBToygerFacade:露个脸就能通过"="露个脸就能通过"; |
|||
"APBToygerFacade:操作超时"="操作超时"; |
|||
"APBToygerFacade:正对手机,更容易成功"="正对手机,更容易成功"; |
|||
"APBToygerFacade:本次操作失败"="本次操作失败"; |
|||
"APBToygerFacade:网络不给力"="网络不给力"; |
|||
"APBToygerFacade:登录中断"="登录中断"; |
|||
"APBToygerFacade:验证中断"="验证中断"; |
|||
|
|||
|
|||
"APBToygerFacade:刷脸验证"="刷脸验证"; |
|||
"APBToygerFacade:请把脸放入框内保持不动"="请把脸移入圈内保持不动"; |
|||
"APBToygerFacade:靠近一点"="靠近一点"; |
|||
"APBToygerFacade:没有检测到脸"="没有检测到脸"; |
|||
"APBToygerFacade:再清晰一点"="再清晰一点"; |
|||
"APBToygerFacade:脸部亮一点"="脸部亮一点"; |
|||
"APBToygerFacade:请正对手机"="请正对手机"; |
|||
"APBToygerFacade:请露出正脸"="请露出正脸"; |
|||
"APBToygerFacade:把脸移入圈内"="把脸移入圈内"; |
|||
"APBToygerFacade:离远一点"="离远一点"; |
|||
"APBToygerFacade:请保持不动"="请保持不动"; |
|||
"APBToygerFacade:请注视屏幕"="请注视屏幕"; |
|||
"APBToygerFacade:眨眨眼"="眨眨眼"; |
|||
"APBToygerFacade:蚂蚁佐罗提供技术支持"=""; |
|||
|
|||
"APBToygerFacade:选择其他验证方式"="选择其他验证方式"; |
|||
"APBToygerFacade:拿起手机眨眨眼"="拿起手机,眨眨眼"; |
|||
"APBToygerFacade:拿起手机向左摇头"="拿起手机,向左摇头"; |
|||
"APBToygerFacade:拿起手机向右摇头"="拿起手机,向右摇头"; |
|||
"APBToygerFacade:向左摇头"="向左摇头"; |
|||
"APBToygerFacade:向右摇头"="向右摇头"; |
|||
|
|||
"APBToygerFacade:正在处理"="正在处理"; |
|||
"APBToygerFacade:首次使用,请开通刷脸"="首次使用,请开通刷脸"; |
|||
"APBToygerFacade:立即开通"="立即开通"; |
|||
"APBToygerFacade:下次再说"="下次再说"; |
|||
|
|||
"APBToygerFacade:请把手机正对面部"="请把手机正对面部"; |
|||
"APBToygerFacade:即将开始人脸检测"="即将开始人脸检测"; |
|||
|
|||
"APBToygerFacade:没有认出你"="没有认出你"; |
|||
"APBToygerFacade:未能识别人脸"="未能识别人脸"; |
|||
"APBToygerFacade:人脸检测中"="人脸检测中"; |
|||
"APBToygerFacade:刷脸失败次数过多,请稍后再试"="刷脸失败次数过多,请稍后再试"; |
@ -0,0 +1,68 @@ |
|||
/* |
|||
zh-Hant.strings |
|||
APBToygerFacade |
|||
|
|||
Created by shouyi.www on 2017/6/1. |
|||
Copyright © 2017年 DTF. All rights reserved. |
|||
*/ |
|||
|
|||
|
|||
"APBToygerFacade:取消"="取消"; |
|||
"APBToygerFacade:再试一次"="再試一次"; |
|||
"APBToygerFacade:退出"="退出"; |
|||
"APBToygerFacade:确定"="確定"; |
|||
"APBToygerFacade:继续"="繼續"; |
|||
"APBToygerFacade:我知道了"="我知道了"; |
|||
"APBToygerFacade:其他登录方式"="其他登入方式"; |
|||
"APBToygerFacade:刷脸失败"="刷臉失敗"; |
|||
"APBToygerFacade:当前设备不支持刷脸"="目前設備不支援刷臉服務"; |
|||
"APBToygerFacade:当前系统不支持刷脸"="当前系统不支持刷脸"; |
|||
"APBToygerFacade:无法启动相机"="無法啟動相機"; |
|||
"APBToygerFacade:请到\“设置-隐私-相机\”开启权限"="請到“設置-隱私-相機”開啓權限"; |
|||
"APBToygerFacade:立即开启"="開通權限"; |
|||
"APBToygerFacade:刷脸仅在iOS8及以上系统可用"="刷脸仅在iOS8及以上系统可用"; |
|||
"APBToygerFacade:系统错误"="系統錯誤"; |
|||
"APBToygerFacade:确定退出吗?"="確定退出嗎?"; |
|||
"APBToygerFacade:露个脸就能通过"="露個臉就能通過"; |
|||
"APBToygerFacade:操作超时"="操作超時"; |
|||
"APBToygerFacade:正对手机,更容易成功"="對準手機,更容易成功"; |
|||
"APBToygerFacade:本次操作失败"="本次操作失敗"; |
|||
"APBToygerFacade:网络不给力"="網絡異常,請稍後再試"; |
|||
"APBToygerFacade:登录中断"="登入中斷"; |
|||
"APBToygerFacade:验证中断"="驗證中斷"; |
|||
|
|||
|
|||
"APBToygerFacade:刷脸验证"="刷臉驗證"; |
|||
"APBToygerFacade:请把脸放入框内保持不动"="請把臉移入圈內保持不動"; |
|||
"APBToygerFacade:靠近一点"="靠近一點"; |
|||
"APBToygerFacade:没有检测到脸"="沒有檢測到臉"; |
|||
"APBToygerFacade:再清晰一点"="再清晰一點"; |
|||
"APBToygerFacade:脸部亮一点"="光線再亮點"; |
|||
"APBToygerFacade:请正对手机"="請正視手機"; |
|||
"APBToygerFacade:请露出正脸"="請露出正臉"; |
|||
"APBToygerFacade:把脸移入圈内"="把臉移入框內"; |
|||
"APBToygerFacade:离远一点"="離遠一點"; |
|||
"APBToygerFacade:请保持不动"="請保持不動"; |
|||
"APBToygerFacade:请注视屏幕"="請注視屏幕"; |
|||
"APBToygerFacade:眨眨眼"="眨眨眼"; |
|||
"APBToygerFacade:蚂蚁佐罗提供技术支持"=""; |
|||
|
|||
"APBToygerFacade:选择其他验证方式"="選擇其他驗證方式"; |
|||
"APBToygerFacade:拿起手机眨眨眼"="拿起手機,眨眨眼"; |
|||
"APBToygerFacade:拿起手机向左摇头"="拿起手機,向左搖頭"; |
|||
"APBToygerFacade:拿起手机向右摇头"="拿起手機,向右搖頭"; |
|||
"APBToygerFacade:向左摇头"="向左搖頭"; |
|||
"APBToygerFacade:向右摇头"="向右搖頭"; |
|||
|
|||
"APBToygerFacade:正在处理"="正在處理"; |
|||
"APBToygerFacade:首次使用,请开通刷脸"="首次使用,請開通刷臉"; |
|||
"APBToygerFacade:立即开通"="立即開通"; |
|||
"APBToygerFacade:下次再说"="下次再說"; |
|||
|
|||
"APBToygerFacade:请把手机正对面部"="請把手機正對面部"; |
|||
"APBToygerFacade:即将开始人脸检测"="即將開始人臉檢測"; |
|||
|
|||
"APBToygerFacade:没有认出你"="沒有認出你"; |
|||
"APBToygerFacade:未能识别人脸"="未能識別人臉"; |
|||
"APBToygerFacade:人脸检测中"="人臉檢測中"; |
|||
"APBToygerFacade:刷脸失败次数过多,请稍后再试"="刷臉失敗次數過多,請稍後再試"; |
@ -0,0 +1,76 @@ |
|||
// |
|||
// APFBaseTask.h |
|||
// APFaceDetectBiz |
|||
// |
|||
// Created by 晗羽 on 8/25/16. |
|||
// Copyright © 2016 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <UIKit/UIKit.h> |
|||
#import <Foundation/Foundation.h> |
|||
#import <BioAuthEngine/IBioAuthTask.h> |
|||
#import <BioAuthEngine/APBTaskContext.h> |
|||
#import <BioAuthEngine/APBLogger.h> |
|||
#import <BioAuthEngine/AFEAlertView.h> |
|||
#import <APBToygerFacade/APBToygerUtils.h> |
|||
#import <BioAuthEngine/APBToygerRemoteConfig.h> |
|||
#import <BioAuthEngine/APBToygerBehavlogManager.h> |
|||
//#import "APBToygerDataCenter.h" |
|||
#import <BioAuthEngine/BioAuthCommonSetting.h> |
|||
#import <APBToygerFacade/APBToygerViewController.h> |
|||
|
|||
@class DTFLogMonitor,APBToygerDataCenter; |
|||
|
|||
typedef void (^APFAlertExtraAction)(); |
|||
|
|||
@interface APBToygerBaseTask : NSObject <IBioAuthTask> |
|||
|
|||
//协议定义的属性 |
|||
@property(nonatomic, copy)NSString *taskName; //任务名 |
|||
@property(nonatomic, strong)APBTaskContext *context; //任务数据 |
|||
@property(nonatomic, weak)NSMutableDictionary *pipeInfo; //共享数据 |
|||
//公用属性 |
|||
@property(nonatomic, weak)UIViewController *parentViewController; //父viewController |
|||
@property(nonatomic, weak)APBToygerViewController *currentViewController; //当前viewController |
|||
@property(nonatomic, weak)UIView *currentView; //当前显示的界面 |
|||
@property(nonatomic, copy)commandBlock bioCommandBlock; //对框架进行操作的block |
|||
@property(nonatomic, strong)APBToygerRemoteConfig * bisConfig; //bis下放的配置参数 |
|||
@property(nonatomic, strong)APBToygerDataCenter * dataCenter; //行为日志 |
|||
@property(nonatomic, copy)NSString *bisToken; //bisToken |
|||
@property(nonatomic, assign)NSInteger currentRetryCnt; //当前重试次数 |
|||
@property(nonatomic, assign)BOOL soundStatus; //当前声音状态 |
|||
//@property(nonatomic, assign)BOOL isLoginMode; //当前场景是否为登录场景 |
|||
@property(nonatomic, assign)BOOL isMYBank; //是否是网商银行 |
|||
@property(nonatomic, strong)DTFLogMonitor *monitor; //埋点 |
|||
|
|||
- (void)exitWithResult:(APBResultType)result failReason:(NSString *)failReason retCodeSub:(NSString *)retCodeSub retMessageSub:(NSString *)retMessageSub; |
|||
|
|||
- (void)eventQuitWithCompletionCallback:(BioAuthExecCallback)callback; |
|||
/** |
|||
* 用户选择重试 |
|||
*/ |
|||
- (void)handleRetryActionWithScene:(NSString *)scene |
|||
buttonTitle:(NSString *)title |
|||
extAction:(APFAlertExtraAction)action; |
|||
|
|||
/** |
|||
* 用户选择退出 |
|||
*/ |
|||
- (void)handleExitActionWithScene:(NSString *)scene |
|||
buttonTitle:(NSString *)title |
|||
exitReason:(APBResultType)reason |
|||
extAction:(APFAlertExtraAction)action; |
|||
|
|||
/** |
|||
* 用户选择继续 |
|||
*/ |
|||
- (void)handleContinueActionWithScene:(NSString *)scene |
|||
buttonTitle:(NSString *)title |
|||
extaction:(APFAlertExtraAction)action; |
|||
|
|||
/** |
|||
* 消除VC的方式,加菲和樱桃不同 |
|||
*/ |
|||
- (void)dismissViewControllerAnimated: (BOOL)flag completion:(void (^ __nullable)(void))completion; |
|||
|
|||
@end |
@ -0,0 +1,19 @@ |
|||
// |
|||
// APFCherryDetectTask.h |
|||
// APBToygerFacade |
|||
// |
|||
// Created by richard on 01/02/2018. |
|||
// Copyright © 2018 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <BioAuthEngine/AFEStatusBar.h> |
|||
#import <APBToygerFacade/APBToygerBaseTask.h> |
|||
#import <BioAuthEngine/BioAuthEngine.h> |
|||
#import <DTFUtility/CameraService.h> |
|||
|
|||
@interface APBToygerCherryDetectTask : APBToygerBaseTask <DTFCameraServiceDelegate, DTFFaceViewDelegate> |
|||
|
|||
@property(nonatomic, assign)BOOL photinusFlags; |
|||
|
|||
@end |
@ -0,0 +1,26 @@ |
|||
// |
|||
// APFCherryUploadTask.h |
|||
// APFaceDetectBiz |
|||
// |
|||
// Created by yukun.tyk on 28/11/2016. |
|||
// Copyright © 2016 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <APBToygerFacade/APBToygerUploadTask.h> |
|||
#import <BioAuthEngine/APBToygerDataCenter.h> |
|||
|
|||
typedef NS_ENUM(NSInteger, APBToygerRemoteCommand) |
|||
{ |
|||
APBToyger_REMOTE_COMMAND_PASS = 1001, //比对通过 |
|||
APBToyger_REMOTE_COMMAND_CONTINUE = 1002, //需要继续采集 |
|||
APBToyger_REMOTE_COMMAND_FAIL = 2001, //比对失败 |
|||
APBToyger_REMOTE_COMMAND_RETRY = 2002, //需要重试 |
|||
}; |
|||
|
|||
|
|||
@interface APBToygerCherryUploadTask : APBToygerUploadTask <APBToygerDataCenterDelegate> |
|||
|
|||
- (APBToygerRemoteCommand)remoteCommandFromString:(NSString *)code; |
|||
|
|||
@end |
@ -0,0 +1,36 @@ |
|||
// |
|||
// APFaceFacade.h |
|||
// APFaceDetectBiz |
|||
// |
|||
// Created by 晗羽 on 8/25/16. |
|||
// Copyright © 2016 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <BioAuthEngine/IBioAuthFactor.h> |
|||
|
|||
@interface APBToygerFacade : NSObject <IBioAuthFactor> |
|||
|
|||
+(void)setTokenid:(NSString*)info; |
|||
+(NSString*)getTokenid; |
|||
|
|||
@end |
|||
|
|||
#import <APBToygerFacade/APBToygerCherryDetectTask.h> |
|||
#import <APBToygerFacade/APBToygerBaseTask.h> |
|||
#import <APBToygerFacade/APBToygerPresentTask.h> |
|||
#import <APBToygerFacade/APBToygerCherryUploadTask.h> |
|||
#import <APBToygerFacade/APBToygerUtils.h> |
|||
#import <APBToygerFacade/APBToygerUploadTask.h> |
|||
#import <APBToygerFacade/APBToygerFacadeDefine.h> |
|||
#import <BioAuthEngine/APBToygerRemoteConfig.h> |
|||
#import <BioAuthEngine/APBToygerBehavlogManager.h> |
|||
#import <BioAuthEngine/APBToygerDataCenter.h> |
|||
#import <APBToygerFacade/APBToygerViewController.h> |
|||
#import <UIKit/UIKit.h> |
|||
|
|||
//! Project version number for APBToygerFacade. |
|||
FOUNDATION_EXPORT double APBToygerFacadeVersionNumber; |
|||
|
|||
//! Project version string for APBToygerFacade. |
|||
FOUNDATION_EXPORT const unsigned char APBToygerFacadeVersionString[]; |
@ -0,0 +1,130 @@ |
|||
// |
|||
// APFCherryDefine.h |
|||
// APBToygerFacade |
|||
// |
|||
// Created by shouyi.www on 27/02/2017. |
|||
// Copyright © 2017 DTF. All rights reserved. |
|||
// |
|||
|
|||
#ifndef APBToygerFacadeDefine_h |
|||
#define APBToygerFacadeDefine_h |
|||
|
|||
|
|||
static float normalized_distance(float current_value, float best_value, float range) { |
|||
return fabsf((current_value - best_value) / range); |
|||
} |
|||
|
|||
//typedef struct toyger_status_evaluator_t { |
|||
// float pitch; |
|||
// float yaw; |
|||
// float width; |
|||
// |
|||
// float best_pitch; |
|||
// float best_yaw; |
|||
// float best_width; |
|||
// float pitch_range; |
|||
// float yaw_range; |
|||
// float width_range; |
|||
// float pitch_weight; |
|||
// float yaw_weight; |
|||
// float width_weight; |
|||
// |
|||
// toyger_status_evaluator_t(float pitch_ = -0.3, float pitch_range_ = 0.7, float best_pitch_ = 0, float pitch_weight_ = 1, |
|||
// float yaw_ = -0.6, float yaw_range_ = 0.6, float best_yaw_ = 0, float yaw_weight_ = 1, |
|||
// float width_ = 0.2, float width_range_ = 1.2, float best_width_ = 0.7, float width_weight_ = 1){ |
|||
// pitch = pitch_; |
|||
// yaw = yaw_; |
|||
// width = width_; |
|||
// pitch_range = pitch_range_; |
|||
// yaw_range = yaw_range_; |
|||
// width_range = width_range_; |
|||
// best_pitch = best_pitch_; |
|||
// best_yaw = best_yaw_; |
|||
// best_width = best_width_; |
|||
// pitch_weight = pitch_weight_; |
|||
// yaw_weight = yaw_weight_; |
|||
// width_weight = width_weight_; |
|||
// } |
|||
// |
|||
// void reset(){ |
|||
// pitch = -0.3; |
|||
// yaw = -0.6; |
|||
// width = 0.2; |
|||
// } |
|||
// |
|||
// void update(float pitch_, float yaw_, float width_) { |
|||
// pitch = pitch_; |
|||
// yaw = yaw_; |
|||
// width = width_; |
|||
// } |
|||
// |
|||
// float evaluateProgress(float pitch_, float yaw_, float width_){ |
|||
// return |
|||
// (normalized_distance(pitch_, best_pitch, pitch_range) * pitch_weight + |
|||
// normalized_distance(yaw_, best_yaw, yaw_range) * yaw_weight + |
|||
// normalized_distance(width_, best_width, width_range) * width_weight) / |
|||
// (pitch_weight + yaw_weight + width_weight); |
|||
// } |
|||
// |
|||
// float evaluate(){ |
|||
// return 1 - |
|||
// (normalized_distance(pitch, best_pitch, pitch_range) * pitch_weight + |
|||
// normalized_distance(yaw, best_yaw, yaw_range) * yaw_weight + |
|||
// normalized_distance(width, best_width, width_range) * width_weight) / |
|||
// (pitch_weight + yaw_weight + width_weight); |
|||
// } |
|||
// |
|||
//}ToygerStatusEvaluator; |
|||
|
|||
|
|||
typedef struct apbtoyger_tip_evaluator_t { |
|||
bool pose_end; |
|||
bool has_face; |
|||
bool did_blink; |
|||
bool pos_okay; |
|||
bool quality_okay; |
|||
bool under_exposure; |
|||
bool face_width_too_small; |
|||
bool face_width_too_big; |
|||
bool integrity_fail; |
|||
bool yaw_fail; |
|||
bool pitch_fail; |
|||
bool tremble_fail; |
|||
bool did_checkSeven; |
|||
int tip_timer_wait_cnt; |
|||
bool tip_show_switch; |
|||
int tip_message; |
|||
|
|||
apbtoyger_tip_evaluator_t(){ |
|||
reset(); |
|||
} |
|||
|
|||
void reset(){ |
|||
has_face = false; |
|||
did_blink = false; |
|||
pos_okay = false; |
|||
under_exposure = false; |
|||
face_width_too_small = false; |
|||
integrity_fail = false; |
|||
pitch_fail = false; |
|||
face_width_too_big = false; |
|||
yaw_fail = false; |
|||
tremble_fail = false; |
|||
tip_timer_wait_cnt = 0; |
|||
tip_show_switch = true; |
|||
did_checkSeven = false; |
|||
quality_okay = false; |
|||
pose_end = false; |
|||
tip_message =0; |
|||
} |
|||
}APBToygerTipEvaluator; |
|||
|
|||
|
|||
//UI样式 |
|||
typedef enum : NSUInteger { |
|||
APBToygerUIStyleFPPCherry = 991, //991 FPP樱桃(废弃) |
|||
APBToygerUIStyleCherry, //992 zFace樱桃 |
|||
APBToygerUIStyleGarfield, //993 加菲 |
|||
} APBToygerUIStyle; |
|||
|
|||
#endif |
@ -0,0 +1,25 @@ |
|||
// |
|||
// APFPresentTask.h |
|||
// APFaceDetectBiz |
|||
// |
|||
// Created by 晗羽 on 8/26/16. |
|||
// Copyright © 2016 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <APBToygerFacade/APBToygerBaseTask.h> |
|||
#import <DTFUtility/CameraService.h> |
|||
#import <BioAuthEngine/DTFFaceViewProtocol.h> |
|||
/** |
|||
* @author Skye Ying, 16-08-26 13:08:04 |
|||
* |
|||
* 新建VC,启动整个view |
|||
*/ |
|||
@interface APBToygerPresentTask : APBToygerBaseTask |
|||
|
|||
@property(nonatomic, strong) id<DTFFaceViewProtocol> faceView; |
|||
|
|||
-(void) postCameraPresentwithCamera:(DTFCameraService *) cameraService; |
|||
|
|||
-(void) presentAnimated: (BOOL)flag completion:(void (^ __nullable)(void))completion; |
|||
|
|||
@end |
@ -0,0 +1,27 @@ |
|||
// |
|||
// APBToygerUploadTask.h |
|||
// APBToygerFacade |
|||
// |
|||
// Created by Dan Cong on 29/1/2018. |
|||
// Copyright © 2018 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <APBToygerFacade/APBToygerBaseTask.h> |
|||
|
|||
/** |
|||
上传基类,用于下沉多种UI(樱桃和加菲)下通用的逻辑 |
|||
*/ |
|||
@interface APBToygerUploadTask : APBToygerBaseTask |
|||
|
|||
- (void)uploadImage; |
|||
|
|||
- (void)didFinishUploadWithSuccess:(BOOL)success |
|||
retCode:(NSString *)retCode |
|||
retMessage:(NSString *)msg |
|||
extInfo:(NSString *)ext; |
|||
|
|||
- (void)handleFailWithRetCodeSub:(NSString *)retCodeSub retMessageSub:(NSString *)retMessageSub; |
|||
|
|||
- (void)requestAgain; |
|||
|
|||
@end |
@ -0,0 +1,61 @@ |
|||
// |
|||
// APFUtils.h |
|||
// APFaceDetectBiz |
|||
// |
|||
// Created by 晗羽 on 8/25/16. |
|||
// Copyright © 2016 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <APBToygerFacade/APBToygerFacadeDefine.h> |
|||
|
|||
//#import "APFaceDetectBizFacade.h" |
|||
|
|||
//主线程同步操作 |
|||
#define SYNC_MAINTHREAD_BEGIN_APBT [APBToygerUtils APBToygerMainThread:^{ |
|||
#define SYNC_MAINTHREAD_END_APBT }]; |
|||
|
|||
#define LOCK(locker, ...) dispatch_semaphore_wait(locker, DISPATCH_TIME_FOREVER); \ |
|||
__VA_ARGS__; \ |
|||
dispatch_semaphore_signal(locker); |
|||
|
|||
@class MGLivenessDetectionFrameEncodedData; |
|||
|
|||
@interface APBToygerUtils : NSObject |
|||
|
|||
+ (void)APBToygerMainThread:(dispatch_block_t)block; |
|||
|
|||
+ (NSString *)getTextContentforKey:(NSString*)keyName; |
|||
+ (NSString *)localizedTextForKey:(NSString *)key; |
|||
+ (NSBundle *)getBundle; |
|||
|
|||
+ (int)getCodefrom:(NSString *)bisToken withLength:(int)codeLen; |
|||
//+ (NSString *)getActionNoticeByActionType:(APFLiveActionType) actionType; |
|||
|
|||
//检查文件是否存在 |
|||
+ (BOOL) checkFileunderPath:(NSString *) filePath; |
|||
|
|||
//写入文件 |
|||
//如果文件存在,不重写,返回失败。 |
|||
//如果文件不再在,写入,返回写入结果 |
|||
+ (BOOL) writeFileunderPath:(NSString *) filePath; |
|||
|
|||
//删除文件 |
|||
+ (BOOL) removeFileunderPath:(NSString *) filePath; |
|||
|
|||
//随机文件名 |
|||
+ (NSString *)randomString:(NSInteger)len; |
|||
|
|||
+ (NSString *)localizedStringForKey:(NSString *)key; |
|||
|
|||
+ (UIImage *)loadImageFromBundleNamed:(NSString *)imageName; |
|||
|
|||
+ (UIWindow *)lastWindow; |
|||
|
|||
+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize; |
|||
|
|||
@end |
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,34 @@ |
|||
// |
|||
// APFViewController.h |
|||
// APFaceDetectBiz |
|||
// |
|||
// Created by 晗羽 on 8/25/16. |
|||
// Copyright © 2016 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <UIKit/UIKit.h> |
|||
#import <ToygerService/ToygerService.h> |
|||
#import <BioAuthEngine/DTFFaceViewProtocol.h> |
|||
|
|||
NSString *const kAbnormalClose = @"abnormalclose"; |
|||
@class APBToygerBaseTask; |
|||
@interface APBToygerViewController : UIViewController |
|||
|
|||
@property(nonatomic, strong) DTFLogMonitor *monitor; |
|||
@property(nonatomic, strong) id<DTFFaceViewProtocol> faceView; |
|||
@property(nonatomic, assign) BOOL isClose; |
|||
@property(nonatomic, strong) NSString *platformInfo; |
|||
@property(nonatomic, weak) APBToygerBaseTask *baseTask; |
|||
|
|||
- (void)startFaceRecognition:(AVCaptureVideoPreviewLayer *)layer; |
|||
- (void)addWebGuideView:(UIView *)guideView; |
|||
- (void)handleFaceStateChange:(ToygerMessage)state |
|||
stateTips:(NSString *)tips |
|||
actionGuide:(NSString *)guide |
|||
progress:(CGFloat)progress; |
|||
- (void)showLoadingView; |
|||
- (void)dismissLoadingView; |
|||
- (void)setPhotinusColor:(UIColor *)color; |
|||
- (void)showBlur:(UIImage *)image; |
|||
|
|||
@end |
@ -0,0 +1,6 @@ |
|||
framework module APBToygerFacade { |
|||
umbrella header "APBToygerFacade.h" |
|||
|
|||
export * |
|||
module * { export * } |
|||
} |
@ -0,0 +1,44 @@ |
|||
// |
|||
// AliyunFaaceAuthFacade.h |
|||
// AliyunFaceAuthFacade |
|||
// |
|||
// Created by 汪澌哲 on 2022/11/21. |
|||
// Copyright © 2022 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <DTFUtility/ZIMResponse.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@interface AliyunFaceAuthFacade : NSObject |
|||
|
|||
+ (void)init; |
|||
|
|||
+ (void)initSDK; |
|||
|
|||
/* IPV6的初始化接口 只有你的网络环境强制要求是IPV6的时候,才调用initIPv6。 |
|||
*/ |
|||
+ (void)initIPv6; |
|||
|
|||
+ (NSString *)getVersion; |
|||
|
|||
+ (NSString *)getNFCVersion; |
|||
|
|||
+ (void)preload:(NSDictionary *)param completion:(void (^)(BOOL success))completion; |
|||
|
|||
+ (NSDictionary *)getMetaInfo; |
|||
|
|||
+ (NSDictionary *)getNFCMetaInfo; |
|||
|
|||
+ (void)verifyWith:(NSString *)zimId |
|||
extParams:(NSDictionary *)params |
|||
onCompletion:(void (^)(ZIMResponse *response))callback; |
|||
|
|||
+ (void)nfcVerifyWith:(NSString *)zimId |
|||
extParams:(NSDictionary *)params |
|||
onCompletion:(void (^)(ZIMResponse *response))callback; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,28 @@ |
|||
// |
|||
// PoPGatewayNetwork.h |
|||
// ZimDemo |
|||
// |
|||
// Created by sanyuan.he on 2020/1/20. |
|||
// Copyright © 2020 com.. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@interface PoPGatewayNetwork : NSObject |
|||
|
|||
-(void)bizSendContent:(NSDictionary*)serviceParameters completionBlock:(void (^) (BOOL success,NSURLResponse *response, NSData *data))completionBlock; |
|||
|
|||
-(void)verifySendContent:(NSDictionary*)serviceParameters completionBlock:(void (^) (BOOL success,NSURLResponse *response, NSData *data))completionBlock; |
|||
|
|||
|
|||
-(void)sendInitFaceVerifyContent:(NSDictionary*)serviceParameters keyName:(NSString*)name initKey:(NSString *)initKey initSimpleValue:(NSString *)initSimpleValue completionBlock:(void (^) (BOOL success,NSURLResponse *response, NSData *data))completionBlock; |
|||
|
|||
-(void)sendOCRContent:(NSDictionary*)serviceParameters completionBlock:(void (^) (BOOL success,NSURLResponse *response, NSData *data))completionBlock; |
|||
|
|||
-(void)sendLogContent:(NSDictionary*)serviceParameters extraHeader:(NSDictionary *)header completionBlock:(void (^) (BOOL success,NSURLResponse *response, NSData *data))completionBlock; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,20 @@ |
|||
// |
|||
// AliyunOSSiOS.h |
|||
// AliyunOSSiOS |
|||
// |
|||
// Created by xuyecan on 28/11/2016. |
|||
// Copyright © 2016 xuyecan. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
//! Project version number for AliyunOSSiOS. |
|||
FOUNDATION_EXPORT double AliyunOSSiOSVersionNumber; |
|||
|
|||
//! Project version string for AliyunOSSiOS. |
|||
FOUNDATION_EXPORT const unsigned char AliyunOSSiOSVersionString[]; |
|||
|
|||
// In this header, you should import all the public headers of your framework using statements like #import <AliyunOSSiOS/PublicHeader.h> |
|||
|
|||
#import "OSSService.h" |
|||
#import "OSSXMLDictionary.h" |
@ -0,0 +1,19 @@ |
|||
// |
|||
// NSDate+OSS.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/7/31. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
/** |
|||
Categories NSDate |
|||
*/ |
|||
@interface NSDate (OSS) |
|||
+ (void)oss_setClockSkew:(NSTimeInterval)clockSkew; |
|||
+ (NSDate *)oss_dateFromString:(NSString *)string; |
|||
+ (NSDate *)oss_clockSkewFixedDate; |
|||
- (NSString *)oss_asStringValue; |
|||
@end |
@ -0,0 +1,15 @@ |
|||
// |
|||
// NSMutableData+OSS_CRC.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by 怀叙 on 2017/11/29. |
|||
// Copyright © 2017年 阿里云. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
@interface NSMutableData (OSS_CRC) |
|||
|
|||
- (uint64_t)oss_crc64; |
|||
|
|||
@end |
@ -0,0 +1,15 @@ |
|||
// |
|||
// NSMutableDictionary+OSS.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/8/1. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
@interface NSMutableDictionary (OSS) |
|||
|
|||
- (void)oss_setObject:(id)anObject forKey:(id <NSCopying>)aKey; |
|||
|
|||
@end |
@ -0,0 +1,32 @@ |
|||
// |
|||
// OSSAllRequestNeededMessage.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/1/22. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSConstants.h" |
|||
#import "OSSTask.h" |
|||
|
|||
/** |
|||
All necessary information in one OSS request. |
|||
*/ |
|||
@interface OSSAllRequestNeededMessage : NSObject |
|||
@property (nonatomic, strong) NSString *endpoint; |
|||
@property (nonatomic, strong) NSString *httpMethod; |
|||
@property (nonatomic, strong) NSString *bucketName; |
|||
@property (nonatomic, strong) NSString *objectKey; |
|||
@property (nonatomic, strong) NSString *contentType; |
|||
@property (nonatomic, strong) NSString *contentMd5; |
|||
@property (nonatomic, strong) NSString *date; |
|||
@property (nonatomic, strong) NSMutableDictionary *headerParams; |
|||
@property (nonatomic, copy) NSDictionary *params; |
|||
@property (nonatomic, copy) NSString *contentSHA1; |
|||
@property (nonatomic, assign) BOOL isHostInCnameExcludeList; |
|||
|
|||
|
|||
- (OSSTask *)validateRequestParamsInOperationType:(OSSOperationType)operType; |
|||
|
|||
@end |
@ -0,0 +1,26 @@ |
|||
/* |
|||
* Copyright (c) 2014, Facebook, Inc. |
|||
* All rights reserved. |
|||
* |
|||
* This source code is licensed under the BSD-style license found in the |
|||
* LICENSE file in the root directory of this source tree. An additional grant |
|||
* of patent rights can be found in the PATENTS file in the same directory. |
|||
* |
|||
*/ |
|||
|
|||
#import "OSSCancellationToken.h" |
|||
#import "OSSCancellationTokenRegistration.h" |
|||
#import "OSSCancellationTokenSource.h" |
|||
#import "OSSExecutor.h" |
|||
#import "OSSTask.h" |
|||
#import "OSSTaskCompletionSource.h" |
|||
|
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/** |
|||
A string containing the version of the Bolts Framework used by the current application. |
|||
*/ |
|||
extern NSString *const OSSBoltsFrameworkVersionString; |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,42 @@ |
|||
/* |
|||
* Copyright (c) 2014, Facebook, Inc. |
|||
* All rights reserved. |
|||
* |
|||
* This source code is licensed under the BSD-style license found in the |
|||
* LICENSE file in the root directory of this source tree. An additional grant |
|||
* of patent rights can be found in the PATENTS file in the same directory. |
|||
* |
|||
*/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
#import "OSSCancellationTokenRegistration.h" |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/*! |
|||
A block that will be called when a token is cancelled. |
|||
*/ |
|||
typedef void(^OSSCancellationBlock)(void); |
|||
|
|||
/*! |
|||
The consumer view of a CancellationToken. |
|||
Propagates notification that operations should be canceled. |
|||
A OSSCancellationToken has methods to inspect whether the token has been cancelled. |
|||
*/ |
|||
@interface OSSCancellationToken : NSObject |
|||
|
|||
/*! |
|||
Whether cancellation has been requested for this token source. |
|||
*/ |
|||
@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; |
|||
|
|||
/*! |
|||
Register a block to be notified when the token is cancelled. |
|||
If the token is already cancelled the delegate will be notified immediately. |
|||
*/ |
|||
- (OSSCancellationTokenRegistration *)registerCancellationObserverWithBlock:(OSSCancellationBlock)block; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,29 @@ |
|||
/* |
|||
* Copyright (c) 2014, Facebook, Inc. |
|||
* All rights reserved. |
|||
* |
|||
* This source code is licensed under the BSD-style license found in the |
|||
* LICENSE file in the root directory of this source tree. An additional grant |
|||
* of patent rights can be found in the PATENTS file in the same directory. |
|||
* |
|||
*/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/*! |
|||
Represents the registration of a cancellation observer with a cancellation token. |
|||
Can be used to unregister the observer at a later time. |
|||
*/ |
|||
@interface OSSCancellationTokenRegistration : NSObject |
|||
|
|||
/*! |
|||
Removes the cancellation observer registered with the token |
|||
and releases all resources associated with this registration. |
|||
*/ |
|||
- (void)dispose; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,60 @@ |
|||
/* |
|||
* Copyright (c) 2014, Facebook, Inc. |
|||
* All rights reserved. |
|||
* |
|||
* This source code is licensed under the BSD-style license found in the |
|||
* LICENSE file in the root directory of this source tree. An additional grant |
|||
* of patent rights can be found in the PATENTS file in the same directory. |
|||
* |
|||
*/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@class OSSCancellationToken; |
|||
|
|||
/*! |
|||
OSSCancellationTokenSource represents the producer side of a CancellationToken. |
|||
Signals to a CancellationToken that it should be canceled. |
|||
It is a cancellation token that also has methods |
|||
for changing the state of a token by cancelling it. |
|||
*/ |
|||
@interface OSSCancellationTokenSource : NSObject |
|||
|
|||
/*! |
|||
Creates a new cancellation token source. |
|||
*/ |
|||
+ (instancetype)cancellationTokenSource; |
|||
|
|||
/*! |
|||
The cancellation token associated with this CancellationTokenSource. |
|||
*/ |
|||
@property (nonatomic, strong, readonly) OSSCancellationToken *token; |
|||
|
|||
/*! |
|||
Whether cancellation has been requested for this token source. |
|||
*/ |
|||
@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; |
|||
|
|||
/*! |
|||
Cancels the token if it has not already been cancelled. |
|||
*/ |
|||
- (void)cancel; |
|||
|
|||
/*! |
|||
Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds. |
|||
@param millis The number of milliseconds to wait before completing the returned task. |
|||
If delay is `0` the cancel is executed immediately. If delay is `-1` any scheduled cancellation is stopped. |
|||
*/ |
|||
- (void)cancelAfterDelay:(int)millis; |
|||
|
|||
/*! |
|||
Releases all resources associated with this token source, |
|||
including disposing of all registrations. |
|||
*/ |
|||
- (void)dispose; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,110 @@ |
|||
// |
|||
// OSSClient.h |
|||
// oss_ios_sdk |
|||
// |
|||
// Created by zhouzhuo on 8/16/15. |
|||
// Copyright (c) 2015 aliyun.com. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
@class OSSGetServiceRequest; |
|||
@class OSSCreateBucketRequest; |
|||
@class OSSDeleteBucketRequest; |
|||
@class OSSHeadObjectRequest; |
|||
@class OSSGetBucketRequest; |
|||
@class OSSGetBucketACLRequest; |
|||
@class OSSGetObjectRequest; |
|||
@class OSSGetObjectACLRequest; |
|||
@class OSSPutObjectRequest; |
|||
@class OSSPutObjectACLRequest; |
|||
@class OSSDeleteObjectRequest; |
|||
@class OSSDeleteMultipleObjectsRequest; |
|||
@class OSSCopyObjectRequest; |
|||
@class OSSInitMultipartUploadRequest; |
|||
@class OSSUploadPartRequest; |
|||
@class OSSCompleteMultipartUploadRequest; |
|||
@class OSSListPartsRequest; |
|||
@class OSSListMultipartUploadsRequest; |
|||
@class OSSAbortMultipartUploadRequest; |
|||
@class OSSAppendObjectRequest; |
|||
@class OSSResumableUploadRequest; |
|||
@class OSSMultipartUploadRequest; |
|||
@class OSSCallBackRequest; |
|||
@class OSSImagePersistRequest; |
|||
@class OSSGetBucketInfoRequest; |
|||
@class OSSPutSymlinkRequest; |
|||
@class OSSGetSymlinkRequest; |
|||
@class OSSRestoreObjectRequest; |
|||
|
|||
@class OSSTask; |
|||
@class OSSExecutor; |
|||
@class OSSNetworking; |
|||
@class OSSClientConfiguration; |
|||
@protocol OSSCredentialProvider; |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/** |
|||
OSSClient is the entry class to access OSS in an iOS client. It provides all the methods to communicate with OSS. |
|||
Generally speaking, only one instance of OSSClient is needed in the whole app. |
|||
*/ |
|||
@interface OSSClient : NSObject |
|||
|
|||
/** |
|||
OSS endpoint. It varies in different regions. Please check out OSS official website for the exact endpoints for your data. |
|||
*/ |
|||
@property (nonatomic, strong) NSString * endpoint; |
|||
|
|||
/** |
|||
The networking instance for sending and receiving data |
|||
*/ |
|||
@property (nonatomic, strong) OSSNetworking * networking; |
|||
|
|||
/** |
|||
The credential provider instance |
|||
*/ |
|||
@property (nonatomic, strong) id<OSSCredentialProvider> credentialProvider; |
|||
|
|||
/** |
|||
Client configuration instance |
|||
*/ |
|||
@property (nonatomic, strong) OSSClientConfiguration * clientConfiguration; |
|||
|
|||
/** |
|||
oss operation task queue |
|||
*/ |
|||
@property (nonatomic, strong, readonly) OSSExecutor * ossOperationExecutor; |
|||
|
|||
/** |
|||
Initializes an OSSClient instance with the default client configuration. |
|||
@endpoint it specifies domain of the bucket's region. Starting 2017, the domain must be prefixed with "https://" to follow Apple's ATS policy. |
|||
For example: "https://oss-cn-hangzhou.aliyuncs.com" |
|||
@credentialProvider The credential provider |
|||
*/ |
|||
- (instancetype)initWithEndpoint:(NSString *)endpoint |
|||
credentialProvider:(id<OSSCredentialProvider>) credentialProvider; |
|||
|
|||
/** |
|||
Initializes an OSSClient with the custom client configuration. |
|||
@endpoint it specifies domain of the bucket's region. Starting 2017, the domain must be prefixed with "https://" to follow Apple's ATS policy. |
|||
For example: "https://oss-cn-hangzhou.aliyuncs.com" |
|||
@credentialProvider The credential provider |
|||
@conf The custom client configuration such as retry time, timeout values, etc. |
|||
*/ |
|||
- (instancetype)initWithEndpoint:(NSString *)endpoint |
|||
credentialProvider:(id<OSSCredentialProvider>)credentialProvider |
|||
clientConfiguration:(OSSClientConfiguration *)conf; |
|||
|
|||
@end |
|||
|
|||
@interface OSSClient (Object) |
|||
|
|||
/** |
|||
The corresponding RESTFul API: PutObject |
|||
Uploads a file. |
|||
*/ |
|||
- (OSSTask *)putObject:(OSSPutObjectRequest *)request; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,75 @@ |
|||
// Software License Agreement (BSD License) |
|||
// |
|||
// Copyright (c) 2010-2016, Deusty, LLC |
|||
// All rights reserved. |
|||
// |
|||
// Redistribution and use of this software in source and binary forms, |
|||
// with or without modification, are permitted provided that the following conditions are met: |
|||
// |
|||
// * Redistributions of source code must retain the above copyright notice, |
|||
// this list of conditions and the following disclaimer. |
|||
// |
|||
// * Neither the name of Deusty nor the names of its contributors may be used |
|||
// to endorse or promote products derived from this software without specific |
|||
// prior written permission of Deusty, LLC. |
|||
|
|||
/** |
|||
* Welcome to CocoaLumberjack! |
|||
* |
|||
* The project page has a wealth of documentation if you have any questions. |
|||
* |
|||
* If you're new to the project you may wish to read "Getting Started" at: |
|||
* Documentation/GettingStarted.md |
|||
* |
|||
* Otherwise, here is a quick refresher. |
|||
* There are three steps to using the macros: |
|||
* |
|||
* Step 1: |
|||
* Import the header in your implementation or prefix file: |
|||
* |
|||
* #import <CocoaLumberjack/CocoaLumberjack.h> |
|||
* |
|||
* Step 2: |
|||
* Define your logging level in your implementation file: |
|||
* |
|||
* // Log levels: off, error, warn, info, verbose |
|||
* static const DDLogLevel ddLogLevel = DDLogLevelVerbose; |
|||
* |
|||
* Step 2 [3rd party frameworks]: |
|||
* |
|||
* Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel: |
|||
* |
|||
* // #undef LOG_LEVEL_DEF // Undefine first only if needed |
|||
* #define LOG_LEVEL_DEF myLibLogLevel |
|||
* |
|||
* Define your logging level in your implementation file: |
|||
* |
|||
* // Log levels: off, error, warn, info, verbose |
|||
* static const DDLogLevel myLibLogLevel = DDLogLevelVerbose; |
|||
* |
|||
* Step 3: |
|||
* Replace your NSLog statements with DDLog statements according to the severity of the message. |
|||
* |
|||
* NSLog(@"Fatal error, no dohickey found!"); -> OSSLogError(@"Fatal error, no dohickey found!"); |
|||
* |
|||
* DDLog works exactly the same as NSLog. |
|||
* This means you can pass it multiple variables just like NSLog. |
|||
**/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
// Disable legacy macros |
|||
#ifndef OSSDD_LEGACY_MACROS |
|||
#define OSSDD_LEGACY_MACROS 0 |
|||
#endif |
|||
|
|||
// Core |
|||
#import "OSSDDLog.h" |
|||
|
|||
// Main macros |
|||
#import "OSSLogMacros.h" |
|||
|
|||
// Loggers |
|||
#import "OSSFileLogger.h" |
|||
#import "OSSNSLogger.h" |
|||
|
@ -0,0 +1,104 @@ |
|||
// |
|||
// OSSConstants.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/1/22. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef NSString* _Nullable (^OSSCustomSignContentBlock) (NSString * contentToSign, NSError **error); |
|||
typedef NSData * _Nullable (^OSSResponseDecoderBlock) (NSData * data); |
|||
|
|||
typedef void (^OSSNetworkingUploadProgressBlock) (int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend); |
|||
typedef void (^OSSNetworkingDownloadProgressBlock) (int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite); |
|||
typedef void (^OSSNetworkingRetryBlock) (void); |
|||
typedef void (^OSSNetworkingCompletionHandlerBlock) (id _Nullable responseObject, NSError * _Nullable error); |
|||
typedef void (^OSSNetworkingOnRecieveDataBlock) (NSData * data); |
|||
|
|||
/** |
|||
The flag of verification about crc64 |
|||
*/ |
|||
typedef NS_ENUM(NSUInteger, OSSRequestCRCFlag) { |
|||
OSSRequestCRCUninitialized, |
|||
OSSRequestCRCOpen, |
|||
OSSRequestCRCClosed |
|||
}; |
|||
|
|||
/** |
|||
Retry type definition |
|||
*/ |
|||
typedef NS_ENUM(NSInteger, OSSNetworkingRetryType) { |
|||
OSSNetworkingRetryTypeUnknown, |
|||
OSSNetworkingRetryTypeShouldRetry, |
|||
OSSNetworkingRetryTypeShouldNotRetry, |
|||
OSSNetworkingRetryTypeShouldRefreshCredentialsAndRetry, |
|||
OSSNetworkingRetryTypeShouldCorrectClockSkewAndRetry |
|||
}; |
|||
|
|||
/** |
|||
* @brief: The following constants are provided by OSSNetworking as possible operation types. |
|||
*/ |
|||
typedef NS_ENUM(NSInteger, OSSOperationType) { |
|||
OSSOperationTypePutObject, |
|||
}; |
|||
|
|||
/** |
|||
* @brief: The following constants are provided by OSSClient as possible error codes. |
|||
*/ |
|||
typedef NS_ENUM(NSInteger, OSSClientErrorCODE) { |
|||
OSSClientErrorCodeNetworkingFailWithResponseCode0, |
|||
OSSClientErrorCodeSignFailed, |
|||
OSSClientErrorCodeFileCantWrite, |
|||
OSSClientErrorCodeInvalidArgument, |
|||
OSSClientErrorCodeNilUploadid, |
|||
OSSClientErrorCodeTaskCancelled, |
|||
OSSClientErrorCodeNetworkError, |
|||
OSSClientErrorCodeInvalidCRC, |
|||
OSSClientErrorCodeCannotResumeUpload, |
|||
OSSClientErrorCodeExcpetionCatched, |
|||
OSSClientErrorCodeNotKnown |
|||
}; |
|||
|
|||
typedef NS_ENUM(NSInteger, OSSXMLDictionaryAttributesMode) |
|||
{ |
|||
OSSXMLDictionaryAttributesModePrefixed = 0, //default |
|||
OSSXMLDictionaryAttributesModeDictionary, |
|||
OSSXMLDictionaryAttributesModeUnprefixed, |
|||
OSSXMLDictionaryAttributesModeDiscard |
|||
}; |
|||
|
|||
|
|||
typedef NS_ENUM(NSInteger, OSSXMLDictionaryNodeNameMode) |
|||
{ |
|||
OSSXMLDictionaryNodeNameModeRootOnly = 0, //default |
|||
OSSXMLDictionaryNodeNameModeAlways, |
|||
OSSXMLDictionaryNodeNameModeNever |
|||
}; |
|||
|
|||
typedef NS_ENUM(NSInteger, OSSBucketStorageClass) |
|||
{ |
|||
OSSBucketStorageClassStandard, |
|||
OSSBucketStorageClassIA, |
|||
OSSBucketStorageClassArchive |
|||
}; |
|||
|
|||
typedef NSString * OSSXMLDictionaryAttributeName NS_EXTENSIBLE_STRING_ENUM; |
|||
|
|||
OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryAttributesKey; |
|||
OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryCommentsKey; |
|||
OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryTextKey; |
|||
OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryNodeNameKey; |
|||
OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryAttributePrefix; |
|||
|
|||
OBJC_EXTERN NSString * const OSSHTTPMethodHEAD; |
|||
OBJC_EXTERN NSString * const OSSHTTPMethodGET; |
|||
OBJC_EXTERN NSString * const OSSHTTPMethodPUT; |
|||
OBJC_EXTERN NSString * const OSSHTTPMethodPOST; |
|||
OBJC_EXTERN NSString * const OSSHTTPMethodDELETE; |
|||
|
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,860 @@ |
|||
// Software License Agreement (BSD License) |
|||
// |
|||
// Copyright (c) 2010-2016, Deusty, LLC |
|||
// All rights reserved. |
|||
// |
|||
// Redistribution and use of this software in source and binary forms, |
|||
// with or without modification, are permitted provided that the following conditions are met: |
|||
// |
|||
// * Redistributions of source code must retain the above copyright notice, |
|||
// this list of conditions and the following disclaimer. |
|||
// |
|||
// * Neither the name of Deusty nor the names of its contributors may be used |
|||
// to endorse or promote products derived from this software without specific |
|||
// prior written permission of Deusty, LLC. |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
// Enable 1.9.x legacy macros if imported directly |
|||
#ifndef OSSDD_LEGACY_MACROS |
|||
#define OSSDD_LEGACY_MACROS 1 |
|||
#endif |
|||
|
|||
#if OS_OBJECT_USE_OBJC |
|||
#define DISPATCH_QUEUE_REFERENCE_TYPE strong |
|||
#else |
|||
#define DISPATCH_QUEUE_REFERENCE_TYPE assign |
|||
#endif |
|||
|
|||
@class OSSDDLogMessage; |
|||
@class OSSDDLoggerInformation; |
|||
@protocol OSSDDLogger; |
|||
@protocol OSSDDLogFormatter; |
|||
|
|||
/** |
|||
* Define the standard options. |
|||
* |
|||
* We default to only 4 levels because it makes it easier for beginners |
|||
* to make the transition to a logging framework. |
|||
* |
|||
* More advanced users may choose to completely customize the levels (and level names) to suite their needs. |
|||
* For more information on this see the "Custom Log Levels" page: |
|||
* Documentation/CustomLogLevels.md |
|||
* |
|||
* Advanced users may also notice that we're using a bitmask. |
|||
* This is to allow for custom fine grained logging: |
|||
* Documentation/FineGrainedLogging.md |
|||
* |
|||
* -- Flags -- |
|||
* |
|||
* Typically you will use the LOG_LEVELS (see below), but the flags may be used directly in certain situations. |
|||
* For example, say you have a lot of warning log messages, and you wanted to disable them. |
|||
* However, you still needed to see your error and info log messages. |
|||
* You could accomplish that with the following: |
|||
* |
|||
* static const DDLogLevel ddLogLevel = DDLogFlagError | DDLogFlagInfo; |
|||
* |
|||
* When LOG_LEVEL_DEF is defined as ddLogLevel. |
|||
* |
|||
* Flags may also be consulted when writing custom log formatters, |
|||
* as the DDLogMessage class captures the individual flag that caused the log message to fire. |
|||
* |
|||
* -- Levels -- |
|||
* |
|||
* Log levels are simply the proper bitmask of the flags. |
|||
* |
|||
* -- Booleans -- |
|||
* |
|||
* The booleans may be used when your logging code involves more than one line. |
|||
* For example: |
|||
* |
|||
* if (LOG_VERBOSE) { |
|||
* for (id sprocket in sprockets) |
|||
* DDLogVerbose(@"sprocket: %@", [sprocket description]) |
|||
* } |
|||
* |
|||
* -- Async -- |
|||
* |
|||
* Defines the default asynchronous options. |
|||
* The default philosophy for asynchronous logging is very simple: |
|||
* |
|||
* Log messages with errors should be executed synchronously. |
|||
* After all, an error just occurred. The application could be unstable. |
|||
* |
|||
* All other log messages, such as debug output, are executed asynchronously. |
|||
* After all, if it wasn't an error, then it was just informational output, |
|||
* or something the application was easily able to recover from. |
|||
* |
|||
* -- Changes -- |
|||
* |
|||
* You are strongly discouraged from modifying this file. |
|||
* If you do, you make it more difficult on yourself to merge future bug fixes and improvements from the project. |
|||
* Instead, create your own MyLogging.h or ApplicationNameLogging.h or CompanyLogging.h |
|||
* |
|||
* For an example of customizing your logging experience, see the "Custom Log Levels" page: |
|||
* Documentation/CustomLogLevels.md |
|||
**/ |
|||
|
|||
/** |
|||
* Flags accompany each log. They are used together with levels to filter out logs. |
|||
*/ |
|||
typedef NS_OPTIONS(NSUInteger, OSSDDLogFlag){ |
|||
/** |
|||
* 0...00001 DDLogFlagError |
|||
*/ |
|||
OSSDDLogFlagError = (1 << 0), |
|||
|
|||
/** |
|||
* 0...00010 DDLogFlagWarning |
|||
*/ |
|||
OSSDDLogFlagWarning = (1 << 1), |
|||
|
|||
/** |
|||
* 0...00100 DDLogFlagInfo |
|||
*/ |
|||
OSSDDLogFlagInfo = (1 << 2), |
|||
|
|||
/** |
|||
* 0...01000 DDLogFlagDebug |
|||
*/ |
|||
OSSDDLogFlagDebug = (1 << 3), |
|||
|
|||
/** |
|||
* 0...10000 DDLogFlagVerbose |
|||
*/ |
|||
OSSDDLogFlagVerbose = (1 << 4) |
|||
}; |
|||
|
|||
/** |
|||
* Log levels are used to filter out logs. Used together with flags. |
|||
*/ |
|||
typedef NS_ENUM(NSUInteger, OSSDDLogLevel){ |
|||
/** |
|||
* No logs |
|||
*/ |
|||
OSSDDLogLevelOff = 0, |
|||
|
|||
/** |
|||
* Error logs only |
|||
*/ |
|||
OSSDDLogLevelError = (OSSDDLogFlagError), |
|||
|
|||
/** |
|||
* Error and warning logs |
|||
*/ |
|||
OSSDDLogLevelWarning = (OSSDDLogLevelError | OSSDDLogFlagWarning), |
|||
|
|||
/** |
|||
* Error, warning and info logs |
|||
*/ |
|||
OSSDDLogLevelInfo = (OSSDDLogLevelWarning | OSSDDLogFlagInfo), |
|||
|
|||
/** |
|||
* Error, warning, info and debug logs |
|||
*/ |
|||
OSSDDLogLevelDebug = (OSSDDLogLevelInfo | OSSDDLogFlagDebug), |
|||
|
|||
/** |
|||
* Error, warning, info, debug and verbose logs |
|||
*/ |
|||
OSSDDLogLevelVerbose = (OSSDDLogLevelDebug | OSSDDLogFlagVerbose), |
|||
|
|||
/** |
|||
* All logs (1...11111) |
|||
*/ |
|||
OSSDDLogLevelAll = NSUIntegerMax |
|||
}; |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/** |
|||
* Extracts just the file name, no path or extension |
|||
* |
|||
* @param filePath input file path |
|||
* @param copy YES if we want the result to be copied |
|||
* |
|||
* @return the file name |
|||
*/ |
|||
NSString * __nullable OSSDDExtractFileNameWithoutExtension(const char *filePath, BOOL copy); |
|||
|
|||
/** |
|||
* The THIS_FILE macro gives you an NSString of the file name. |
|||
* For simplicity and clarity, the file name does not include the full path or file extension. |
|||
* |
|||
* For example: DDLogWarn(@"%@: Unable to find thingy", THIS_FILE) -> @"MyViewController: Unable to find thingy" |
|||
**/ |
|||
#define THIS_FILE (DDExtractFileNameWithoutExtension(__FILE__, NO)) |
|||
|
|||
/** |
|||
* The THIS_METHOD macro gives you the name of the current objective-c method. |
|||
* |
|||
* For example: DDLogWarn(@"%@ - Requires non-nil strings", THIS_METHOD) -> @"setMake:model: requires non-nil strings" |
|||
* |
|||
* Note: This does NOT work in straight C functions (non objective-c). |
|||
* Instead you should use the predefined __FUNCTION__ macro. |
|||
**/ |
|||
#define THIS_METHOD NSStringFromSelector(_cmd) |
|||
|
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* The main class, exposes all logging mechanisms, loggers, ... |
|||
* For most of the users, this class is hidden behind the logging functions like `DDLogInfo` |
|||
*/ |
|||
@interface OSSDDLog : NSObject |
|||
|
|||
/** |
|||
* Returns the singleton `DDLog`. |
|||
* The instance is used by `DDLog` class methods. |
|||
*/ |
|||
@property (class, nonatomic, strong, readonly) OSSDDLog *sharedInstance; |
|||
|
|||
/** |
|||
* Provides access to the underlying logging queue. |
|||
* This may be helpful to Logger classes for things like thread synchronization. |
|||
**/ |
|||
@property (class, nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggingQueue; |
|||
|
|||
/** |
|||
* Logging Primitive. |
|||
* |
|||
* This method is used by the macros or logging functions. |
|||
* It is suggested you stick with the macros as they're easier to use. |
|||
* |
|||
* @param asynchronous YES if the logging is done async, NO if you want to force sync |
|||
* @param level the log level |
|||
* @param flag the log flag |
|||
* @param context the context (if any is defined) |
|||
* @param file the current file |
|||
* @param function the current function |
|||
* @param line the current code line |
|||
* @param tag potential tag |
|||
* @param format the log format |
|||
*/ |
|||
+ (void)log:(BOOL)asynchronous |
|||
level:(OSSDDLogLevel)level |
|||
flag:(OSSDDLogFlag)flag |
|||
context:(NSInteger)context |
|||
file:(const char *)file |
|||
function:(const char *)function |
|||
line:(NSUInteger)line |
|||
tag:(id __nullable)tag |
|||
format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10); |
|||
|
|||
/** |
|||
* Logging Primitive. |
|||
* |
|||
* This method is used by the macros or logging functions. |
|||
* It is suggested you stick with the macros as they're easier to use. |
|||
* |
|||
* @param asynchronous YES if the logging is done async, NO if you want to force sync |
|||
* @param level the log level |
|||
* @param flag the log flag |
|||
* @param context the context (if any is defined) |
|||
* @param file the current file |
|||
* @param function the current function |
|||
* @param line the current code line |
|||
* @param tag potential tag |
|||
* @param format the log format |
|||
*/ |
|||
- (void)log:(BOOL)asynchronous |
|||
level:(OSSDDLogLevel)level |
|||
flag:(OSSDDLogFlag)flag |
|||
context:(NSInteger)context |
|||
file:(const char *)file |
|||
function:(const char *)function |
|||
line:(NSUInteger)line |
|||
tag:(id __nullable)tag |
|||
format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10); |
|||
|
|||
/** |
|||
* Logging Primitive. |
|||
* |
|||
* This method can be used if you have a prepared va_list. |
|||
* Similar to `log:level:flag:context:file:function:line:tag:format:...` |
|||
* |
|||
* @param asynchronous YES if the logging is done async, NO if you want to force sync |
|||
* @param level the log level |
|||
* @param flag the log flag |
|||
* @param context the context (if any is defined) |
|||
* @param file the current file |
|||
* @param function the current function |
|||
* @param line the current code line |
|||
* @param tag potential tag |
|||
* @param format the log format |
|||
* @param argList the arguments list as a va_list |
|||
*/ |
|||
+ (void)log:(BOOL)asynchronous |
|||
level:(OSSDDLogLevel)level |
|||
flag:(OSSDDLogFlag)flag |
|||
context:(NSInteger)context |
|||
file:(const char *)file |
|||
function:(const char *)function |
|||
line:(NSUInteger)line |
|||
tag:(id __nullable)tag |
|||
format:(NSString *)format |
|||
args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:)); |
|||
|
|||
/** |
|||
* Logging Primitive. |
|||
* |
|||
* This method can be used if you have a prepared va_list. |
|||
* Similar to `log:level:flag:context:file:function:line:tag:format:...` |
|||
* |
|||
* @param asynchronous YES if the logging is done async, NO if you want to force sync |
|||
* @param level the log level |
|||
* @param flag the log flag |
|||
* @param context the context (if any is defined) |
|||
* @param file the current file |
|||
* @param function the current function |
|||
* @param line the current code line |
|||
* @param tag potential tag |
|||
* @param format the log format |
|||
* @param argList the arguments list as a va_list |
|||
*/ |
|||
- (void)log:(BOOL)asynchronous |
|||
level:(OSSDDLogLevel)level |
|||
flag:(OSSDDLogFlag)flag |
|||
context:(NSInteger)context |
|||
file:(const char *)file |
|||
function:(const char *)function |
|||
line:(NSUInteger)line |
|||
tag:(id __nullable)tag |
|||
format:(NSString *)format |
|||
args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:)); |
|||
|
|||
/** |
|||
* Logging Primitive. |
|||
* |
|||
* This method can be used if you manualy prepared DDLogMessage. |
|||
* |
|||
* @param asynchronous YES if the logging is done async, NO if you want to force sync |
|||
* @param logMessage the log message stored in a `DDLogMessage` model object |
|||
*/ |
|||
+ (void)log:(BOOL)asynchronous |
|||
message:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:)); |
|||
|
|||
/** |
|||
* Logging Primitive. |
|||
* |
|||
* This method can be used if you manualy prepared DDLogMessage. |
|||
* |
|||
* @param asynchronous YES if the logging is done async, NO if you want to force sync |
|||
* @param logMessage the log message stored in a `DDLogMessage` model object |
|||
*/ |
|||
- (void)log:(BOOL)asynchronous |
|||
message:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:)); |
|||
|
|||
/** |
|||
* Since logging can be asynchronous, there may be times when you want to flush the logs. |
|||
* The framework invokes this automatically when the application quits. |
|||
**/ |
|||
+ (void)flushLog; |
|||
|
|||
/** |
|||
* Since logging can be asynchronous, there may be times when you want to flush the logs. |
|||
* The framework invokes this automatically when the application quits. |
|||
**/ |
|||
- (void)flushLog; |
|||
|
|||
/** |
|||
* Loggers |
|||
* |
|||
* In order for your log statements to go somewhere, you should create and add a logger. |
|||
* |
|||
* You can add multiple loggers in order to direct your log statements to multiple places. |
|||
* And each logger can be configured separately. |
|||
* So you could have, for example, verbose logging to the console, but a concise log file with only warnings & errors. |
|||
**/ |
|||
|
|||
/** |
|||
* Adds the logger to the system. |
|||
* |
|||
* This is equivalent to invoking `[DDLog addLogger:logger withLogLevel:DDLogLevelAll]`. |
|||
**/ |
|||
+ (void)addLogger:(id <OSSDDLogger>)logger; |
|||
|
|||
/** |
|||
* Adds the logger to the system. |
|||
* |
|||
* This is equivalent to invoking `[DDLog addLogger:logger withLogLevel:DDLogLevelAll]`. |
|||
**/ |
|||
- (void)addLogger:(id <OSSDDLogger>)logger; |
|||
|
|||
/** |
|||
* Adds the logger to the system. |
|||
* |
|||
* The level that you provide here is a preemptive filter (for performance). |
|||
* That is, the level specified here will be used to filter out logMessages so that |
|||
* the logger is never even invoked for the messages. |
|||
* |
|||
* More information: |
|||
* When you issue a log statement, the logging framework iterates over each logger, |
|||
* and checks to see if it should forward the logMessage to the logger. |
|||
* This check is done using the level parameter passed to this method. |
|||
* |
|||
* For example: |
|||
* |
|||
* `[DDLog addLogger:consoleLogger withLogLevel:DDLogLevelVerbose];` |
|||
* `[DDLog addLogger:fileLogger withLogLevel:DDLogLevelWarning];` |
|||
* |
|||
* `DDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger |
|||
* `DDLogInfo(@"hi");` => gets forwarded to consoleLogger only |
|||
* |
|||
* It is important to remember that Lumberjack uses a BITMASK. |
|||
* Many developers & third party frameworks may define extra log levels & flags. |
|||
* For example: |
|||
* |
|||
* `#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000` |
|||
* |
|||
* So if you specify `DDLogLevelVerbose` to this method, you won't see the framework's trace messages. |
|||
* |
|||
* `(SOME_FRAMEWORK_LOG_FLAG_TRACE & DDLogLevelVerbose) => (01000000 & 00011111) => NO` |
|||
* |
|||
* Consider passing `DDLogLevelAll` to this method, which has all bits set. |
|||
* You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set, |
|||
* except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug: |
|||
* |
|||
* `((DDLogLevelAll ^ DDLogLevelVerbose) | DDLogLevelInfo)` |
|||
**/ |
|||
+ (void)addLogger:(id <OSSDDLogger>)logger withLevel:(OSSDDLogLevel)level; |
|||
|
|||
/** |
|||
* Adds the logger to the system. |
|||
* |
|||
* The level that you provide here is a preemptive filter (for performance). |
|||
* That is, the level specified here will be used to filter out logMessages so that |
|||
* the logger is never even invoked for the messages. |
|||
* |
|||
* More information: |
|||
* When you issue a log statement, the logging framework iterates over each logger, |
|||
* and checks to see if it should forward the logMessage to the logger. |
|||
* This check is done using the level parameter passed to this method. |
|||
* |
|||
* For example: |
|||
* |
|||
* `[DDLog addLogger:consoleLogger withLogLevel:DDLogLevelVerbose];` |
|||
* `[DDLog addLogger:fileLogger withLogLevel:DDLogLevelWarning];` |
|||
* |
|||
* `DDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger |
|||
* `DDLogInfo(@"hi");` => gets forwarded to consoleLogger only |
|||
* |
|||
* It is important to remember that Lumberjack uses a BITMASK. |
|||
* Many developers & third party frameworks may define extra log levels & flags. |
|||
* For example: |
|||
* |
|||
* `#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000` |
|||
* |
|||
* So if you specify `DDLogLevelVerbose` to this method, you won't see the framework's trace messages. |
|||
* |
|||
* `(SOME_FRAMEWORK_LOG_FLAG_TRACE & DDLogLevelVerbose) => (01000000 & 00011111) => NO` |
|||
* |
|||
* Consider passing `DDLogLevelAll` to this method, which has all bits set. |
|||
* You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set, |
|||
* except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug: |
|||
* |
|||
* `((DDLogLevelAll ^ DDLogLevelVerbose) | DDLogLevelInfo)` |
|||
**/ |
|||
- (void)addLogger:(id <OSSDDLogger>)logger withLevel:(OSSDDLogLevel)level; |
|||
|
|||
/** |
|||
* Remove the logger from the system |
|||
*/ |
|||
+ (void)removeLogger:(id <OSSDDLogger>)logger; |
|||
|
|||
/** |
|||
* Remove the logger from the system |
|||
*/ |
|||
- (void)removeLogger:(id <OSSDDLogger>)logger; |
|||
|
|||
/** |
|||
* Remove all the current loggers |
|||
*/ |
|||
+ (void)removeAllLoggers; |
|||
|
|||
/** |
|||
* Remove all the current loggers |
|||
*/ |
|||
- (void)removeAllLoggers; |
|||
|
|||
/** |
|||
* Return all the current loggers |
|||
*/ |
|||
@property (class, nonatomic, copy, readonly) NSArray<id<OSSDDLogger>> *allLoggers; |
|||
|
|||
/** |
|||
* Return all the current loggers |
|||
*/ |
|||
@property (nonatomic, copy, readonly) NSArray<id<OSSDDLogger>> *allLoggers; |
|||
|
|||
/** |
|||
* Return all the current loggers with their level (aka DDLoggerInformation). |
|||
*/ |
|||
@property (class, nonatomic, copy, readonly) NSArray<OSSDDLoggerInformation *> *allLoggersWithLevel; |
|||
|
|||
/** |
|||
* Return all the current loggers with their level (aka DDLoggerInformation). |
|||
*/ |
|||
@property (nonatomic, copy, readonly) NSArray<OSSDDLoggerInformation *> *allLoggersWithLevel; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* This protocol describes a basic logger behavior. |
|||
* Basically, it can log messages, store a logFormatter plus a bunch of optional behaviors. |
|||
* (i.e. flush, get its loggerQueue, get its name, ... |
|||
*/ |
|||
@protocol OSSDDLogger <NSObject> |
|||
|
|||
/** |
|||
* The log message method |
|||
* |
|||
* @param logMessage the message (model) |
|||
*/ |
|||
- (void)logMessage:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(log(message:)); |
|||
|
|||
/** |
|||
* Formatters may optionally be added to any logger. |
|||
* |
|||
* If no formatter is set, the logger simply logs the message as it is given in logMessage, |
|||
* or it may use its own built in formatting style. |
|||
**/ |
|||
@property (nonatomic, strong) id <OSSDDLogFormatter> logFormatter; |
|||
|
|||
@optional |
|||
|
|||
/** |
|||
* Since logging is asynchronous, adding and removing loggers is also asynchronous. |
|||
* In other words, the loggers are added and removed at appropriate times with regards to log messages. |
|||
* |
|||
* - Loggers will not receive log messages that were executed prior to when they were added. |
|||
* - Loggers will not receive log messages that were executed after they were removed. |
|||
* |
|||
* These methods are executed in the logging thread/queue. |
|||
* This is the same thread/queue that will execute every logMessage: invocation. |
|||
* Loggers may use these methods for thread synchronization or other setup/teardown tasks. |
|||
**/ |
|||
- (void)didAddLogger; |
|||
|
|||
/** |
|||
* Since logging is asynchronous, adding and removing loggers is also asynchronous. |
|||
* In other words, the loggers are added and removed at appropriate times with regards to log messages. |
|||
* |
|||
* - Loggers will not receive log messages that were executed prior to when they were added. |
|||
* - Loggers will not receive log messages that were executed after they were removed. |
|||
* |
|||
* These methods are executed in the logging thread/queue given in parameter. |
|||
* This is the same thread/queue that will execute every logMessage: invocation. |
|||
* Loggers may use the queue parameter to set specific values on the queue with dispatch_set_specific() function. |
|||
**/ |
|||
- (void)didAddLoggerInQueue:(dispatch_queue_t)queue; |
|||
|
|||
/** |
|||
* See the above description for `didAddLoger` |
|||
*/ |
|||
- (void)willRemoveLogger; |
|||
|
|||
/** |
|||
* Some loggers may buffer IO for optimization purposes. |
|||
* For example, a database logger may only save occasionaly as the disk IO is slow. |
|||
* In such loggers, this method should be implemented to flush any pending IO. |
|||
* |
|||
* This allows invocations of DDLog's flushLog method to be propogated to loggers that need it. |
|||
* |
|||
* Note that DDLog's flushLog method is invoked automatically when the application quits, |
|||
* and it may be also invoked manually by the developer prior to application crashes, or other such reasons. |
|||
**/ |
|||
- (void)flush; |
|||
|
|||
/** |
|||
* Each logger is executed concurrently with respect to the other loggers. |
|||
* Thus, a dedicated dispatch queue is used for each logger. |
|||
* Logger implementations may optionally choose to provide their own dispatch queue. |
|||
**/ |
|||
@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggerQueue; |
|||
|
|||
/** |
|||
* If the logger implementation does not choose to provide its own queue, |
|||
* one will automatically be created for it. |
|||
* The created queue will receive its name from this method. |
|||
* This may be helpful for debugging or profiling reasons. |
|||
**/ |
|||
@property (nonatomic, readonly) NSString *loggerName; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* This protocol describes the behavior of a log formatter |
|||
*/ |
|||
@protocol OSSDDLogFormatter <NSObject> |
|||
@required |
|||
|
|||
/** |
|||
* Formatters may optionally be added to any logger. |
|||
* This allows for increased flexibility in the logging environment. |
|||
* For example, log messages for log files may be formatted differently than log messages for the console. |
|||
* |
|||
* For more information about formatters, see the "Custom Formatters" page: |
|||
* Documentation/CustomFormatters.md |
|||
* |
|||
* The formatter may also optionally filter the log message by returning nil, |
|||
* in which case the logger will not log the message. |
|||
**/ |
|||
- (NSString * __nullable)formatLogMessage:(OSSDDLogMessage *)logMessage NS_SWIFT_NAME(format(message:)); |
|||
|
|||
@optional |
|||
|
|||
/** |
|||
* A single formatter instance can be added to multiple loggers. |
|||
* These methods provides hooks to notify the formatter of when it's added/removed. |
|||
* |
|||
* This is primarily for thread-safety. |
|||
* If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers. |
|||
* Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter), |
|||
* it could possibly use these hooks to switch to thread-safe versions of the code. |
|||
**/ |
|||
- (void)didAddToLogger:(id <OSSDDLogger>)logger; |
|||
|
|||
/** |
|||
* A single formatter instance can be added to multiple loggers. |
|||
* These methods provides hooks to notify the formatter of when it's added/removed. |
|||
* |
|||
* This is primarily for thread-safety. |
|||
* If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers. |
|||
* Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter), |
|||
* it could possibly use these hooks to switch to thread-safe versions of the code or use dispatch_set_specific() |
|||
.* to add its own specific values. |
|||
**/ |
|||
- (void)didAddToLogger:(id <OSSDDLogger>)logger inQueue:(dispatch_queue_t)queue; |
|||
|
|||
/** |
|||
* See the above description for `didAddToLogger:` |
|||
*/ |
|||
- (void)willRemoveFromLogger:(id <OSSDDLogger>)logger; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* This protocol describes a dynamic logging component |
|||
*/ |
|||
@protocol OSSDDRegisteredDynamicLogging |
|||
|
|||
/** |
|||
* Implement these methods to allow a file's log level to be managed from a central location. |
|||
* |
|||
* This is useful if you'd like to be able to change log levels for various parts |
|||
* of your code from within the running application. |
|||
* |
|||
* Imagine pulling up the settings for your application, |
|||
* and being able to configure the logging level on a per file basis. |
|||
* |
|||
* The implementation can be very straight-forward: |
|||
* |
|||
* ``` |
|||
* + (int)ddLogLevel |
|||
* { |
|||
* return ddLogLevel; |
|||
* } |
|||
* |
|||
* + (void)ddSetLogLevel:(DDLogLevel)level |
|||
* { |
|||
* ddLogLevel = level; |
|||
* } |
|||
* ``` |
|||
**/ |
|||
@property (class, nonatomic, readwrite, setter=ddSetLogLevel:) OSSDDLogLevel ossLogLevel; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#ifndef NS_DESIGNATED_INITIALIZER |
|||
#define NS_DESIGNATED_INITIALIZER |
|||
#endif |
|||
|
|||
/** |
|||
* Log message options, allow copying certain log elements |
|||
*/ |
|||
typedef NS_OPTIONS(NSInteger, OSSDDLogMessageOptions){ |
|||
/** |
|||
* Use this to use a copy of the file path |
|||
*/ |
|||
OSSDDLogMessageCopyFile = 1 << 0, |
|||
/** |
|||
* Use this to use a copy of the function name |
|||
*/ |
|||
OSSDDLogMessageCopyFunction = 1 << 1, |
|||
/** |
|||
* Use this to use avoid a copy of the message |
|||
*/ |
|||
OSSDDLogMessageDontCopyMessage = 1 << 2 |
|||
}; |
|||
|
|||
/** |
|||
* The `DDLogMessage` class encapsulates information about the log message. |
|||
* If you write custom loggers or formatters, you will be dealing with objects of this class. |
|||
**/ |
|||
@interface OSSDDLogMessage : NSObject <NSCopying> |
|||
{ |
|||
// Direct accessors to be used only for performance |
|||
@public |
|||
NSString *_message; |
|||
OSSDDLogLevel _level; |
|||
OSSDDLogFlag _flag; |
|||
NSInteger _context; |
|||
NSString *_file; |
|||
NSString *_fileName; |
|||
NSString *_function; |
|||
NSUInteger _line; |
|||
id _tag; |
|||
OSSDDLogMessageOptions _options; |
|||
NSDate *_timestamp; |
|||
NSString *_threadID; |
|||
NSString *_threadName; |
|||
NSString *_queueLabel; |
|||
} |
|||
|
|||
/** |
|||
* Default `init` for empty messages. |
|||
*/ |
|||
- (instancetype)init NS_DESIGNATED_INITIALIZER; |
|||
|
|||
/** |
|||
* Standard init method for a log message object. |
|||
* Used by the logging primitives. (And the macros use the logging primitives.) |
|||
* |
|||
* If you find need to manually create logMessage objects, there is one thing you should be aware of: |
|||
* |
|||
* If no flags are passed, the method expects the file and function parameters to be string literals. |
|||
* That is, it expects the given strings to exist for the duration of the object's lifetime, |
|||
* and it expects the given strings to be immutable. |
|||
* In other words, it does not copy these strings, it simply points to them. |
|||
* This is due to the fact that __FILE__ and __FUNCTION__ are usually used to specify these parameters, |
|||
* so it makes sense to optimize and skip the unnecessary allocations. |
|||
* However, if you need them to be copied you may use the options parameter to specify this. |
|||
* |
|||
* @param message the message |
|||
* @param level the log level |
|||
* @param flag the log flag |
|||
* @param context the context (if any is defined) |
|||
* @param file the current file |
|||
* @param function the current function |
|||
* @param line the current code line |
|||
* @param tag potential tag |
|||
* @param options a bitmask which supports DDLogMessageCopyFile and DDLogMessageCopyFunction. |
|||
* @param timestamp the log timestamp |
|||
* |
|||
* @return a new instance of a log message model object |
|||
*/ |
|||
- (instancetype)initWithMessage:(NSString *)message |
|||
level:(OSSDDLogLevel)level |
|||
flag:(OSSDDLogFlag)flag |
|||
context:(NSInteger)context |
|||
file:(NSString *)file |
|||
function:(NSString * __nullable)function |
|||
line:(NSUInteger)line |
|||
tag:(id __nullable)tag |
|||
options:(OSSDDLogMessageOptions)options |
|||
timestamp:(NSDate * __nullable)timestamp NS_DESIGNATED_INITIALIZER; |
|||
|
|||
/** |
|||
* Read-only properties |
|||
**/ |
|||
|
|||
/** |
|||
* The log message |
|||
*/ |
|||
@property (readonly, nonatomic) NSString *message; |
|||
@property (readonly, nonatomic) OSSDDLogLevel level; |
|||
@property (readonly, nonatomic) OSSDDLogFlag flag; |
|||
@property (readonly, nonatomic) NSInteger context; |
|||
@property (readonly, nonatomic) NSString *file; |
|||
@property (readonly, nonatomic) NSString *fileName; |
|||
@property (readonly, nonatomic) NSString * __nullable function; |
|||
@property (readonly, nonatomic) NSUInteger line; |
|||
@property (readonly, nonatomic) id __nullable tag; |
|||
@property (readonly, nonatomic) OSSDDLogMessageOptions options; |
|||
@property (readonly, nonatomic) NSDate *timestamp; |
|||
@property (readonly, nonatomic) NSString *threadID; // ID as it appears in NSLog calculated from the machThreadID |
|||
@property (readonly, nonatomic) NSString *threadName; |
|||
@property (readonly, nonatomic) NSString *queueLabel; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* The `DDLogger` protocol specifies that an optional formatter can be added to a logger. |
|||
* Most (but not all) loggers will want to support formatters. |
|||
* |
|||
* However, writting getters and setters in a thread safe manner, |
|||
* while still maintaining maximum speed for the logging process, is a difficult task. |
|||
* |
|||
* To do it right, the implementation of the getter/setter has strict requiremenets: |
|||
* - Must NOT require the `logMessage:` method to acquire a lock. |
|||
* - Must NOT require the `logMessage:` method to access an atomic property (also a lock of sorts). |
|||
* |
|||
* To simplify things, an abstract logger is provided that implements the getter and setter. |
|||
* |
|||
* Logger implementations may simply extend this class, |
|||
* and they can ACCESS THE FORMATTER VARIABLE DIRECTLY from within their `logMessage:` method! |
|||
**/ |
|||
@interface OSSDDAbstractLogger : NSObject <OSSDDLogger> |
|||
{ |
|||
// Direct accessors to be used only for performance |
|||
@public |
|||
id <OSSDDLogFormatter> _logFormatter; |
|||
dispatch_queue_t _loggerQueue; |
|||
} |
|||
|
|||
@property (nonatomic, strong, nullable) id <OSSDDLogFormatter> logFormatter; |
|||
@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE) dispatch_queue_t loggerQueue; |
|||
|
|||
// For thread-safety assertions |
|||
|
|||
/** |
|||
* Return YES if the current logger uses a global queue for logging |
|||
*/ |
|||
@property (nonatomic, readonly, getter=isOnGlobalLoggingQueue) BOOL onGlobalLoggingQueue; |
|||
|
|||
/** |
|||
* Return YES if the current logger uses the internal designated queue for logging |
|||
*/ |
|||
@property (nonatomic, readonly, getter=isOnInternalLoggerQueue) BOOL onInternalLoggerQueue; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
@interface OSSDDLoggerInformation : NSObject |
|||
|
|||
@property (nonatomic, readonly) id <OSSDDLogger> logger; |
|||
@property (nonatomic, readonly) OSSDDLogLevel level; |
|||
|
|||
+ (OSSDDLoggerInformation *)informationWithLogger:(id <OSSDDLogger>)logger |
|||
andLevel:(OSSDDLogLevel)level; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,84 @@ |
|||
// |
|||
// OSSDefine.h |
|||
// AliyunOSSiOS |
|||
// |
|||
// Created by zhouzhuo on 5/1/16. |
|||
// Copyright © 2016 zhouzhuo. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
#ifndef OSSDefine_h |
|||
#define OSSDefine_h |
|||
|
|||
#if TARGET_OS_IOS |
|||
#define OSSUAPrefix @"aliyun-sdk-ios" |
|||
#elif TARGET_OS_OSX |
|||
#define OSSUAPrefix @"aliyun-sdk-mac" |
|||
#endif |
|||
#define OSSSDKVersion @"2.10.12" |
|||
|
|||
#define OSSListBucketResultXMLTOKEN @"ListBucketResult" |
|||
#define OSSNameXMLTOKEN @"Name" |
|||
#define OSSDelimiterXMLTOKEN @"Delimiter" |
|||
#define OSSMarkerXMLTOKEN @"Marker" |
|||
#define OSSKeyMarkerXMLTOKEN @"KeyMarker" |
|||
#define OSSNextMarkerXMLTOKEN @"NextMarker" |
|||
#define OSSNextKeyMarkerXMLTOKEN @"NextKeyMarker" |
|||
#define OSSUploadIdMarkerXMLTOKEN @"UploadIdMarker" |
|||
#define OSSNextUploadIdMarkerXMLTOKEN @"NextUploadIdMarker" |
|||
#define OSSMaxKeysXMLTOKEN @"MaxKeys" |
|||
#define OSSMaxUploadsXMLTOKEN @"MaxUploads" |
|||
#define OSSIsTruncatedXMLTOKEN @"IsTruncated" |
|||
#define OSSContentsXMLTOKEN @"Contents" |
|||
#define OSSUploadXMLTOKEN @"Upload" |
|||
#define OSSKeyXMLTOKEN @"Key" |
|||
#define OSSLastModifiedXMLTOKEN @"LastModified" |
|||
#define OSSETagXMLTOKEN @"ETag" |
|||
#define OSSTypeXMLTOKEN @"Type" |
|||
#define OSSSizeXMLTOKEN @"Size" |
|||
#define OSSStorageClassXMLTOKEN @"StorageClass" |
|||
#define OSSCommonPrefixesXMLTOKEN @"CommonPrefixes" |
|||
#define OSSOwnerXMLTOKEN @"Owner" |
|||
#define OSSAccessControlListXMLTOKEN @"AccessControlList" |
|||
#define OSSGrantXMLTOKEN @"Grant" |
|||
#define OSSIDXMLTOKEN @"ID" |
|||
#define OSSDisplayNameXMLTOKEN @"DisplayName" |
|||
#define OSSBucketsXMLTOKEN @"Buckets" |
|||
#define OSSBucketXMLTOKEN @"Bucket" |
|||
#define OSSCreationDate @"CreationDate" |
|||
#define OSSPrefixXMLTOKEN @"Prefix" |
|||
#define OSSUploadIdXMLTOKEN @"UploadId" |
|||
#define OSSLocationXMLTOKEN @"Location" |
|||
#define OSSNextPartNumberMarkerXMLTOKEN @"NextPartNumberMarker" |
|||
#define OSSMaxPartsXMLTOKEN @"MaxParts" |
|||
#define OSSPartXMLTOKEN @"Part" |
|||
#define OSSPartNumberXMLTOKEN @"PartNumber" |
|||
|
|||
#define OSSClientErrorDomain @"com.aliyun.oss.clientError" |
|||
#define OSSServerErrorDomain @"com.aliyun.oss.serverError" |
|||
|
|||
#define OSSErrorMessageTOKEN @"ErrorMessage" |
|||
|
|||
#define OSSHttpHeaderContentDisposition @"Content-Disposition" |
|||
#define OSSHttpHeaderXOSSCallback @"x-oss-callback" |
|||
#define OSSHttpHeaderXOSSCallbackVar @"x-oss-callback-var" |
|||
#define OSSHttpHeaderContentEncoding @"Content-Encoding" |
|||
#define OSSHttpHeaderContentType @"Content-Type" |
|||
#define OSSHttpHeaderContentMD5 @"Content-MD5" |
|||
#define OSSHttpHeaderCacheControl @"Cache-Control" |
|||
#define OSSHttpHeaderExpires @"Expires" |
|||
#define OSSHttpHeaderHashSHA1 @"x-oss-hash-sha1" |
|||
#define OSSHttpHeaderBucketACL @"x-oss-acl" |
|||
#define OSSHttpHeaderObjectACL @"x-oss-object-acl" |
|||
#define OSSHttpHeaderCopySource @"x-oss-copy-source" |
|||
#define OSSHttpHeaderSymlinkTarget @"x-oss-symlink-target" |
|||
|
|||
#define OSSHttpQueryProcess @"x-oss-process" |
|||
|
|||
#define OSSDefaultRetryCount 3 |
|||
#define OSSDefaultMaxConcurrentNum 5 |
|||
#define OSSDefaultTimeoutForRequestInSecond 15 |
|||
#define OSSDefaultTimeoutForResourceInSecond 7 * 24 * 60 * 60 |
|||
|
|||
#endif /* OSSDefine_h */ |
@ -0,0 +1,62 @@ |
|||
/* |
|||
* Copyright (c) 2014, Facebook, Inc. |
|||
* All rights reserved. |
|||
* |
|||
* This source code is licensed under the BSD-style license found in the |
|||
* LICENSE file in the root directory of this source tree. An additional grant |
|||
* of patent rights can be found in the PATENTS file in the same directory. |
|||
* |
|||
*/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/*! |
|||
An object that can run a given block. |
|||
*/ |
|||
@interface OSSExecutor : NSObject |
|||
|
|||
/*! |
|||
Returns a default executor, which runs continuations immediately until the call stack gets too |
|||
deep, then dispatches to a new GCD queue. |
|||
*/ |
|||
+ (instancetype)defaultExecutor; |
|||
|
|||
/*! |
|||
Returns an executor that runs continuations on the thread where the previous task was completed. |
|||
*/ |
|||
+ (instancetype)immediateExecutor; |
|||
|
|||
/*! |
|||
Returns an executor that runs continuations on the main thread. |
|||
*/ |
|||
+ (instancetype)mainThreadExecutor; |
|||
|
|||
/*! |
|||
Returns a new executor that uses the given block to execute continuations. |
|||
@param block The block to use. |
|||
*/ |
|||
+ (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block; |
|||
|
|||
/*! |
|||
Returns a new executor that runs continuations on the given queue. |
|||
@param queue The instance of `dispatch_queue_t` to dispatch all continuations onto. |
|||
*/ |
|||
+ (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue; |
|||
|
|||
/*! |
|||
Returns a new executor that runs continuations on the given queue. |
|||
@param queue The instance of `NSOperationQueue` to run all continuations on. |
|||
*/ |
|||
+ (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue; |
|||
|
|||
/*! |
|||
Runs the given block using this executor's particular strategy. |
|||
@param block The block to execute. |
|||
*/ |
|||
- (void)execute:(void(^)(void))block; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,509 @@ |
|||
// Software License Agreement (BSD License) |
|||
// |
|||
// Copyright (c) 2010-2016, Deusty, LLC |
|||
// All rights reserved. |
|||
// |
|||
// Redistribution and use of this software in source and binary forms, |
|||
// with or without modification, are permitted provided that the following conditions are met: |
|||
// |
|||
// * Redistributions of source code must retain the above copyright notice, |
|||
// this list of conditions and the following disclaimer. |
|||
// |
|||
// * Neither the name of Deusty nor the names of its contributors may be used |
|||
// to endorse or promote products derived from this software without specific |
|||
// prior written permission of Deusty, LLC. |
|||
|
|||
// Disable legacy macros |
|||
#ifndef DD_LEGACY_MACROS |
|||
#define DD_LEGACY_MACROS 0 |
|||
#endif |
|||
|
|||
#import "OSSDDLog.h" |
|||
|
|||
@class OSSDDLogFileInfo; |
|||
|
|||
/** |
|||
* This class provides a logger to write log statements to a file. |
|||
**/ |
|||
|
|||
|
|||
// Default configuration and safety/sanity values. |
|||
// |
|||
// maximumFileSize -> kDDDefaultLogMaxFileSize |
|||
// rollingFrequency -> kDDDefaultLogRollingFrequency |
|||
// maximumNumberOfLogFiles -> kDDDefaultLogMaxNumLogFiles |
|||
// logFilesDiskQuota -> kDDDefaultLogFilesDiskQuota |
|||
// |
|||
// You should carefully consider the proper configuration values for your application. |
|||
|
|||
extern unsigned long long const osskDDDefaultLogMaxFileSize; |
|||
extern NSTimeInterval const osskDDDefaultLogRollingFrequency; |
|||
extern NSUInteger const osskDDDefaultLogMaxNumLogFiles; |
|||
extern unsigned long long const osskDDDefaultLogFilesDiskQuota; |
|||
|
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* The LogFileManager protocol is designed to allow you to control all aspects of your log files. |
|||
* |
|||
* The primary purpose of this is to allow you to do something with the log files after they have been rolled. |
|||
* Perhaps you want to compress them to save disk space. |
|||
* Perhaps you want to upload them to an FTP server. |
|||
* Perhaps you want to run some analytics on the file. |
|||
* |
|||
* A default LogFileManager is, of course, provided. |
|||
* The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property. |
|||
* |
|||
* This protocol provides various methods to fetch the list of log files. |
|||
* |
|||
* There are two variants: sorted and unsorted. |
|||
* If sorting is not necessary, the unsorted variant is obviously faster. |
|||
* The sorted variant will return an array sorted by when the log files were created, |
|||
* with the most recently created log file at index 0, and the oldest log file at the end of the array. |
|||
* |
|||
* You can fetch only the log file paths (full path including name), log file names (name only), |
|||
* or an array of `DDLogFileInfo` objects. |
|||
* The `DDLogFileInfo` class is documented below, and provides a handy wrapper that |
|||
* gives you easy access to various file attributes such as the creation date or the file size. |
|||
*/ |
|||
@protocol OSSDDLogFileManager <NSObject> |
|||
@required |
|||
|
|||
// Public properties |
|||
|
|||
/** |
|||
* The maximum number of archived log files to keep on disk. |
|||
* For example, if this property is set to 3, |
|||
* then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk. |
|||
* Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted. |
|||
* |
|||
* You may optionally disable this option by setting it to zero. |
|||
**/ |
|||
@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles; |
|||
|
|||
/** |
|||
* The maximum space that logs can take. On rolling logfile all old logfiles that exceed logFilesDiskQuota will |
|||
* be deleted. |
|||
* |
|||
* You may optionally disable this option by setting it to zero. |
|||
**/ |
|||
@property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota; |
|||
|
|||
// Public methods |
|||
|
|||
/** |
|||
* Returns the logs directory (path) |
|||
*/ |
|||
@property (nonatomic, readonly, copy) NSString *logsDirectory; |
|||
|
|||
/** |
|||
* Returns an array of `NSString` objects, |
|||
* each of which is the filePath to an existing log file on disk. |
|||
**/ |
|||
@property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFilePaths; |
|||
|
|||
/** |
|||
* Returns an array of `NSString` objects, |
|||
* each of which is the fileName of an existing log file on disk. |
|||
**/ |
|||
@property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFileNames; |
|||
|
|||
/** |
|||
* Returns an array of `DDLogFileInfo` objects, |
|||
* each representing an existing log file on disk, |
|||
* and containing important information about the log file such as it's modification date and size. |
|||
**/ |
|||
@property (nonatomic, readonly, strong) NSArray<OSSDDLogFileInfo *> *unsortedLogFileInfos; |
|||
|
|||
/** |
|||
* Just like the `unsortedLogFilePaths` method, but sorts the array. |
|||
* The items in the array are sorted by creation date. |
|||
* The first item in the array will be the most recently created log file. |
|||
**/ |
|||
@property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFilePaths; |
|||
|
|||
/** |
|||
* Just like the `unsortedLogFileNames` method, but sorts the array. |
|||
* The items in the array are sorted by creation date. |
|||
* The first item in the array will be the most recently created log file. |
|||
**/ |
|||
@property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFileNames; |
|||
|
|||
/** |
|||
* Just like the `unsortedLogFileInfos` method, but sorts the array. |
|||
* The items in the array are sorted by creation date. |
|||
* The first item in the array will be the most recently created log file. |
|||
**/ |
|||
@property (nonatomic, readonly, strong) NSArray<OSSDDLogFileInfo *> *sortedLogFileInfos; |
|||
|
|||
// Private methods (only to be used by DDFileLogger) |
|||
|
|||
/** |
|||
* Generates a new unique log file path, and creates the corresponding log file. |
|||
**/ |
|||
- (NSString *)createNewLogFile; |
|||
|
|||
@optional |
|||
|
|||
// Notifications from DDFileLogger |
|||
|
|||
/** |
|||
* Called when a log file was archieved |
|||
*/ |
|||
- (void)didArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didArchiveLogFile(atPath:)); |
|||
|
|||
/** |
|||
* Called when the roll action was executed and the log was archieved |
|||
*/ |
|||
- (void)didRollAndArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didRollAndArchiveLogFile(atPath:)); |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* Default log file manager. |
|||
* |
|||
* All log files are placed inside the logsDirectory. |
|||
* If a specific logsDirectory isn't specified, the default directory is used. |
|||
* On Mac, this is in `~/Library/Logs/<Application Name>`. |
|||
* On iPhone, this is in `~/Library/Caches/Logs`. |
|||
* |
|||
* Log files are named `"<bundle identifier> <date> <time>.log"` |
|||
* Example: `com.organization.myapp 2013-12-03 17-14.log` |
|||
* |
|||
* Archived log files are automatically deleted according to the `maximumNumberOfLogFiles` property. |
|||
**/ |
|||
@interface OSSDDLogFileManagerDefault : NSObject <OSSDDLogFileManager> |
|||
|
|||
/** |
|||
* Default initializer |
|||
*/ |
|||
- (instancetype)init; |
|||
|
|||
/** |
|||
* Designated initialized, requires the logs directory |
|||
*/ |
|||
- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory NS_DESIGNATED_INITIALIZER; |
|||
|
|||
#if TARGET_OS_IPHONE |
|||
/* |
|||
* Calling this constructor you can override the default "automagically" chosen NSFileProtection level. |
|||
* Useful if you are writing a command line utility / CydiaSubstrate addon for iOS that has no NSBundle |
|||
* or like SpringBoard no BackgroundModes key in the NSBundle: |
|||
* iPhone:~ root# cycript -p SpringBoard |
|||
* cy# [NSBundle mainBundle] |
|||
* #"NSBundle </System/Library/CoreServices/SpringBoard.app> (loaded)" |
|||
* cy# [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"]; |
|||
* null |
|||
* cy# |
|||
**/ |
|||
- (instancetype)initWithLogsDirectory:(NSString *)logsDirectory defaultFileProtectionLevel:(NSFileProtectionType)fileProtectionLevel; |
|||
#endif |
|||
|
|||
/* |
|||
* Methods to override. |
|||
* |
|||
* Log files are named `"<bundle identifier> <date> <time>.log"` |
|||
* Example: `com.organization.myapp 2013-12-03 17-14.log` |
|||
* |
|||
* If you wish to change default filename, you can override following two methods. |
|||
* - `newLogFileName` method would be called on new logfile creation. |
|||
* - `isLogFile:` method would be called to filter logfiles from all other files in logsDirectory. |
|||
* You have to parse given filename and return YES if it is logFile. |
|||
* |
|||
* **NOTE** |
|||
* `newLogFileName` returns filename. If appropriate file already exists, number would be added |
|||
* to filename before extension. You have to handle this case in isLogFile: method. |
|||
* |
|||
* Example: |
|||
* - newLogFileName returns `"com.organization.myapp 2013-12-03.log"`, |
|||
* file `"com.organization.myapp 2013-12-03.log"` would be created. |
|||
* - after some time `"com.organization.myapp 2013-12-03.log"` is archived |
|||
* - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`, |
|||
* file `"com.organization.myapp 2013-12-03 2.log"` would be created. |
|||
* - after some time `"com.organization.myapp 2013-12-03 1.log"` is archived |
|||
* - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`, |
|||
* file `"com.organization.myapp 2013-12-03 3.log"` would be created. |
|||
**/ |
|||
|
|||
/** |
|||
* Generates log file name with default format `"<bundle identifier> <date> <time>.log"` |
|||
* Example: `MobileSafari 2013-12-03 17-14.log` |
|||
* |
|||
* You can change it by overriding `newLogFileName` and `isLogFile:` methods. |
|||
**/ |
|||
@property (readonly, copy) NSString *newLogFileName; |
|||
|
|||
/** |
|||
* Default log file name is `"<bundle identifier> <date> <time>.log"`. |
|||
* Example: `MobileSafari 2013-12-03 17-14.log` |
|||
* |
|||
* You can change it by overriding `newLogFileName` and `isLogFile:` methods. |
|||
**/ |
|||
- (BOOL)isLogFile:(NSString *)fileName NS_SWIFT_NAME(isLogFile(withName:)); |
|||
|
|||
/* Inherited from DDLogFileManager protocol: |
|||
|
|||
@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles; |
|||
@property (readwrite, assign, atomic) NSUInteger logFilesDiskQuota; |
|||
|
|||
- (NSString *)logsDirectory; |
|||
|
|||
- (NSArray *)unsortedLogFilePaths; |
|||
- (NSArray *)unsortedLogFileNames; |
|||
- (NSArray *)unsortedLogFileInfos; |
|||
|
|||
- (NSArray *)sortedLogFilePaths; |
|||
- (NSArray *)sortedLogFileNames; |
|||
- (NSArray *)sortedLogFileInfos; |
|||
|
|||
*/ |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* Most users will want file log messages to be prepended with the date and time. |
|||
* Rather than forcing the majority of users to write their own formatter, |
|||
* we will supply a logical default formatter. |
|||
* Users can easily replace this formatter with their own by invoking the `setLogFormatter:` method. |
|||
* It can also be removed by calling `setLogFormatter:`, and passing a nil parameter. |
|||
* |
|||
* In addition to the convenience of having a logical default formatter, |
|||
* it will also provide a template that makes it easy for developers to copy and change. |
|||
**/ |
|||
@interface OSSDDLogFileFormatterDefault : NSObject <OSSDDLogFormatter> |
|||
|
|||
/** |
|||
* Default initializer |
|||
*/ |
|||
- (instancetype)init; |
|||
|
|||
/** |
|||
* Designated initializer, requires a date formatter |
|||
*/ |
|||
- (instancetype)initWithDateFormatter:(NSDateFormatter *)dateFormatter NS_DESIGNATED_INITIALIZER; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* The standard implementation for a file logger |
|||
*/ |
|||
@interface OSSDDFileLogger : OSSDDAbstractLogger <OSSDDLogger> { |
|||
OSSDDLogFileInfo *_currentLogFileInfo; |
|||
} |
|||
|
|||
/** |
|||
* Default initializer |
|||
*/ |
|||
- (instancetype)init; |
|||
|
|||
/** |
|||
* Designated initializer, requires a `DDLogFileManager` instance |
|||
*/ |
|||
- (instancetype)initWithLogFileManager:(id <OSSDDLogFileManager>)logFileManager NS_DESIGNATED_INITIALIZER; |
|||
|
|||
/** |
|||
* Called when the logger is about to write message. Call super before your implementation. |
|||
*/ |
|||
- (void)willLogMessage NS_REQUIRES_SUPER; |
|||
|
|||
/** |
|||
* Called when the logger wrote message. Call super after your implementation. |
|||
*/ |
|||
- (void)didLogMessage NS_REQUIRES_SUPER; |
|||
|
|||
/** |
|||
* Called when the logger checks archive or not current log file. |
|||
* Override this method to exdend standart behavior. By default returns NO. |
|||
*/ |
|||
- (BOOL)shouldArchiveRecentLogFileInfo:(OSSDDLogFileInfo *)recentLogFileInfo; |
|||
|
|||
/** |
|||
* Log File Rolling: |
|||
* |
|||
* `maximumFileSize`: |
|||
* The approximate maximum size (in bytes) to allow log files to grow. |
|||
* If a log file is larger than this value after a log statement is appended, |
|||
* then the log file is rolled. |
|||
* |
|||
* `rollingFrequency` |
|||
* How often to roll the log file. |
|||
* The frequency is given as an `NSTimeInterval`, which is a double that specifies the interval in seconds. |
|||
* Once the log file gets to be this old, it is rolled. |
|||
* |
|||
* `doNotReuseLogFiles` |
|||
* When set, will always create a new log file at application launch. |
|||
* |
|||
* Both the `maximumFileSize` and the `rollingFrequency` are used to manage rolling. |
|||
* Whichever occurs first will cause the log file to be rolled. |
|||
* |
|||
* For example: |
|||
* The `rollingFrequency` is 24 hours, |
|||
* but the log file surpasses the `maximumFileSize` after only 20 hours. |
|||
* The log file will be rolled at that 20 hour mark. |
|||
* A new log file will be created, and the 24 hour timer will be restarted. |
|||
* |
|||
* You may optionally disable rolling due to filesize by setting `maximumFileSize` to zero. |
|||
* If you do so, rolling is based solely on `rollingFrequency`. |
|||
* |
|||
* You may optionally disable rolling due to time by setting `rollingFrequency` to zero (or any non-positive number). |
|||
* If you do so, rolling is based solely on `maximumFileSize`. |
|||
* |
|||
* If you disable both `maximumFileSize` and `rollingFrequency`, then the log file won't ever be rolled. |
|||
* This is strongly discouraged. |
|||
**/ |
|||
@property (readwrite, assign) unsigned long long maximumFileSize; |
|||
|
|||
/** |
|||
* See description for `maximumFileSize` |
|||
*/ |
|||
@property (readwrite, assign) NSTimeInterval rollingFrequency; |
|||
|
|||
/** |
|||
* See description for `maximumFileSize` |
|||
*/ |
|||
@property (readwrite, assign, atomic) BOOL doNotReuseLogFiles; |
|||
|
|||
/** |
|||
* The DDLogFileManager instance can be used to retrieve the list of log files, |
|||
* and configure the maximum number of archived log files to keep. |
|||
* |
|||
* @see DDLogFileManager.maximumNumberOfLogFiles |
|||
**/ |
|||
@property (strong, nonatomic, readonly) id <OSSDDLogFileManager> logFileManager; |
|||
|
|||
/** |
|||
* When using a custom formatter you can set the `logMessage` method not to append |
|||
* `\n` character after each output. This allows for some greater flexibility with |
|||
* custom formatters. Default value is YES. |
|||
**/ |
|||
@property (nonatomic, readwrite, assign) BOOL automaticallyAppendNewlineForCustomFormatters; |
|||
|
|||
/** |
|||
* You can optionally force the current log file to be rolled with this method. |
|||
* CompletionBlock will be called on main queue. |
|||
*/ |
|||
- (void)rollLogFileWithCompletionBlock:(void (^)(void))completionBlock NS_SWIFT_NAME(rollLogFile(withCompletion:)); |
|||
|
|||
/** |
|||
* Method is deprecated. |
|||
* @deprecated Use `rollLogFileWithCompletionBlock:` method instead. |
|||
*/ |
|||
- (void)rollLogFile __attribute((deprecated)); |
|||
|
|||
// Inherited from DDAbstractLogger |
|||
|
|||
// - (id <DDLogFormatter>)logFormatter; |
|||
// - (void)setLogFormatter:(id <DDLogFormatter>)formatter; |
|||
|
|||
/** |
|||
* Returns the log file that should be used. |
|||
* If there is an existing log file that is suitable, |
|||
* within the constraints of `maximumFileSize` and `rollingFrequency`, then it is returned. |
|||
* |
|||
* Otherwise a new file is created and returned. |
|||
**/ |
|||
@property (nonatomic, readonly, strong) OSSDDLogFileInfo *currentLogFileInfo; |
|||
|
|||
@end |
|||
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
#pragma mark - |
|||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/** |
|||
* `DDLogFileInfo` is a simple class that provides access to various file attributes. |
|||
* It provides good performance as it only fetches the information if requested, |
|||
* and it caches the information to prevent duplicate fetches. |
|||
* |
|||
* It was designed to provide quick snapshots of the current state of log files, |
|||
* and to help sort log files in an array. |
|||
* |
|||
* This class does not monitor the files, or update it's cached attribute values if the file changes on disk. |
|||
* This is not what the class was designed for. |
|||
* |
|||
* If you absolutely must get updated values, |
|||
* you can invoke the reset method which will clear the cache. |
|||
**/ |
|||
@interface OSSDDLogFileInfo : NSObject |
|||
|
|||
@property (strong, nonatomic, readonly) NSString *filePath; |
|||
@property (strong, nonatomic, readonly) NSString *fileName; |
|||
|
|||
#if FOUNDATION_SWIFT_SDK_EPOCH_AT_LEAST(8) |
|||
@property (strong, nonatomic, readonly) NSDictionary<NSFileAttributeKey, id> *fileAttributes; |
|||
#else |
|||
@property (strong, nonatomic, readonly) NSDictionary<NSString *, id> *fileAttributes; |
|||
#endif |
|||
|
|||
@property (strong, nonatomic, readonly) NSDate *creationDate; |
|||
@property (strong, nonatomic, readonly) NSDate *modificationDate; |
|||
|
|||
@property (nonatomic, readonly) unsigned long long fileSize; |
|||
|
|||
@property (nonatomic, readonly) NSTimeInterval age; |
|||
|
|||
@property (nonatomic, readwrite) BOOL isArchived; |
|||
|
|||
+ (instancetype)logFileWithPath:(NSString *)filePath NS_SWIFT_UNAVAILABLE("Use init(filePath:)"); |
|||
|
|||
- (instancetype)init NS_UNAVAILABLE; |
|||
- (instancetype)initWithFilePath:(NSString *)filePath NS_DESIGNATED_INITIALIZER; |
|||
|
|||
- (void)reset; |
|||
- (void)renameFile:(NSString *)newFileName NS_SWIFT_NAME(renameFile(to:)); |
|||
|
|||
#if TARGET_IPHONE_SIMULATOR |
|||
|
|||
// So here's the situation. |
|||
// Extended attributes are perfect for what we're trying to do here (marking files as archived). |
|||
// This is exactly what extended attributes were designed for. |
|||
// |
|||
// But Apple screws us over on the simulator. |
|||
// Everytime you build-and-go, they copy the application into a new folder on the hard drive, |
|||
// and as part of the process they strip extended attributes from our log files. |
|||
// Normally, a copy of a file preserves extended attributes. |
|||
// So obviously Apple has gone to great lengths to piss us off. |
|||
// |
|||
// Thus we use a slightly different tactic for marking log files as archived in the simulator. |
|||
// That way it "just works" and there's no confusion when testing. |
|||
// |
|||
// The difference in method names is indicative of the difference in functionality. |
|||
// On the simulator we add an attribute by appending a filename extension. |
|||
// |
|||
// For example: |
|||
// "mylog.txt" -> "mylog.archived.txt" |
|||
// "mylog" -> "mylog.archived" |
|||
|
|||
- (BOOL)hasExtensionAttributeWithName:(NSString *)attrName; |
|||
|
|||
- (void)addExtensionAttributeWithName:(NSString *)attrName; |
|||
- (void)removeExtensionAttributeWithName:(NSString *)attrName; |
|||
|
|||
#else /* if TARGET_IPHONE_SIMULATOR */ |
|||
|
|||
// Normal use of extended attributes used everywhere else, |
|||
// such as on Macs and on iPhone devices. |
|||
|
|||
- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName; |
|||
|
|||
- (void)addExtendedAttributeWithName:(NSString *)attrName; |
|||
- (void)removeExtendedAttributeWithName:(NSString *)attrName; |
|||
|
|||
#endif /* if TARGET_IPHONE_SIMULATOR */ |
|||
|
|||
@end |
@ -0,0 +1,37 @@ |
|||
// |
|||
// OSSHttpResponseParser.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/1/22. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSConstants.h" |
|||
#import "OSSTask.h" |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/** |
|||
HTTP response parser |
|||
*/ |
|||
@interface OSSHttpResponseParser : NSObject |
|||
|
|||
@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveBlock; |
|||
|
|||
/** |
|||
* A Boolean value that determines whether verfifying crc64. |
|||
When set to YES, it will verify crc64 when transmission is completed normally. |
|||
The default value of this property is NO. |
|||
*/ |
|||
@property (nonatomic, assign) BOOL crc64Verifiable; |
|||
|
|||
- (instancetype)initForOperationType:(OSSOperationType)operationType; |
|||
- (void)consumeHttpResponse:(NSHTTPURLResponse *)response; |
|||
- (OSSTask *)consumeHttpResponseBody:(NSData *)data; |
|||
- (nullable id)constructResultObject; |
|||
- (void)reset; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,54 @@ |
|||
// |
|||
// OSSLog.h |
|||
// oss_ios_sdk |
|||
// |
|||
// Created by zhouzhuo on 8/16/15. |
|||
// Copyright (c) 2015 aliyun.com. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSCocoaLumberjack.h" |
|||
static const OSSDDLogLevel ossLogLevel = OSSDDLogLevelAll; |
|||
|
|||
// colorful log configuration |
|||
// see https://github.com/robbiehanson/XcodeColors |
|||
|
|||
#define XCODE_COLORS_ESCAPE @"\033[" |
|||
|
|||
#define XCODE_COLORS_RESET_FG XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color |
|||
#define XCODE_COLORS_RESET_BG XCODE_COLORS_ESCAPE @"bg;" // Clear any background color |
|||
#define XCODE_COLORS_RESET XCODE_COLORS_ESCAPE @";" // Clear any foreground or background color |
|||
|
|||
#define OSSLogVerbose(frmt, ...)\ |
|||
if ([OSSLog isLogEnable]) {\ |
|||
OSSDDLogVerbose(@"[Verbose]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ |
|||
} |
|||
|
|||
#define OSSLogDebug(frmt, ...)\ |
|||
if ([OSSLog isLogEnable]) {\ |
|||
OSSDDLogDebug(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ |
|||
} |
|||
|
|||
#define OSSLogDebugNoFile(frmt, ...)\ |
|||
if ([OSSLog isLogEnable]) {\ |
|||
NSLog(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ |
|||
} |
|||
|
|||
#define OSSLogError(frmt, ...)\ |
|||
if ([OSSLog isLogEnable]) {\ |
|||
OSSDDLogError(@"[Error]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ |
|||
} |
|||
|
|||
#define OSSLogWarn(frmt, ...)\ |
|||
if ([OSSLog isLogEnable]) {\ |
|||
OSSDDLogWarn(@"[Warning]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ |
|||
} |
|||
|
|||
static BOOL isEnable; |
|||
|
|||
@interface OSSLog : NSObject |
|||
|
|||
+ (void)enableLog; |
|||
+ (void)disableLog; |
|||
+ (BOOL)isLogEnable; |
|||
@end |
@ -0,0 +1,82 @@ |
|||
// Software License Agreement (BSD License) |
|||
// |
|||
// Copyright (c) 2010-2016, Deusty, LLC |
|||
// All rights reserved. |
|||
// |
|||
// Redistribution and use of this software in source and binary forms, |
|||
// with or without modification, are permitted provided that the following conditions are met: |
|||
// |
|||
// * Redistributions of source code must retain the above copyright notice, |
|||
// this list of conditions and the following disclaimer. |
|||
// |
|||
// * Neither the name of Deusty nor the names of its contributors may be used |
|||
// to endorse or promote products derived from this software without specific |
|||
// prior written permission of Deusty, LLC. |
|||
|
|||
// Disable legacy macros |
|||
#ifndef OSSDD_LEGACY_MACROS |
|||
#define OSSDD_LEGACY_MACROS 0 |
|||
#endif |
|||
|
|||
#import "OSSDDLog.h" |
|||
|
|||
/** |
|||
* The constant/variable/method responsible for controlling the current log level. |
|||
**/ |
|||
#ifndef OSSLOG_LEVEL_DEF |
|||
#define OSSLOG_LEVEL_DEF ossLogLevel |
|||
#endif |
|||
|
|||
/** |
|||
* Whether async should be used by log messages, excluding error messages that are always sent sync. |
|||
**/ |
|||
#ifndef OSSLOG_ASYNC_ENABLED |
|||
#define OSSLOG_ASYNC_ENABLED YES |
|||
#endif |
|||
|
|||
/** |
|||
* These are the two macros that all other macros below compile into. |
|||
* These big multiline macros makes all the other macros easier to read. |
|||
**/ |
|||
#define OSSLOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \ |
|||
[OSSDDLog log : isAsynchronous \ |
|||
level : lvl \ |
|||
flag : flg \ |
|||
context : ctx \ |
|||
file : __FILE__ \ |
|||
function : fnct \ |
|||
line : __LINE__ \ |
|||
tag : atag \ |
|||
format : (frmt), ## __VA_ARGS__] |
|||
|
|||
/** |
|||
* Define version of the macro that only execute if the log level is above the threshold. |
|||
* The compiled versions essentially look like this: |
|||
* |
|||
* if (logFlagForThisLogMsg & ddLogLevel) { execute log message } |
|||
* |
|||
* When LOG_LEVEL_DEF is defined as ddLogLevel. |
|||
* |
|||
* As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels. |
|||
* This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques. |
|||
* |
|||
* Note that when compiler optimizations are enabled (as they are for your release builds), |
|||
* the log messages above your logging threshold will automatically be compiled out. |
|||
* |
|||
* (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see |
|||
* if the 'if' statement would execute, and if not it strips it from the binary.) |
|||
* |
|||
* We also define shorthand versions for asynchronous and synchronous logging. |
|||
**/ |
|||
#define OSSLOG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, ...) \ |
|||
do { if(lvl & flg) OSSLOG_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0) |
|||
|
|||
/** |
|||
* Ready to use log macros with no context or tag. |
|||
**/ |
|||
#define OSSDDLogError(frmt, ...) OSSLOG_MAYBE(NO, OSSLOG_LEVEL_DEF, OSSDDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
|||
#define OSSDDLogWarn(frmt, ...) OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
|||
#define OSSDDLogInfo(frmt, ...) OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
|||
#define OSSDDLogDebug(frmt, ...) OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
|||
#define OSSDDLogVerbose(frmt, ...) OSSLOG_MAYBE(OSSLOG_ASYNC_ENABLED, OSSLOG_LEVEL_DEF, OSSDDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
|||
|
@ -0,0 +1,292 @@ |
|||
// |
|||
// OSSModel.h |
|||
// oss_ios_sdk |
|||
// |
|||
// Created by zhouzhuo on 8/16/15. |
|||
// Copyright (c) 2015 aliyun.com. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSRequest.h" |
|||
#import "OSSResult.h" |
|||
|
|||
@class OSSAllRequestNeededMessage; |
|||
@class OSSFederationToken; |
|||
@class OSSTask; |
|||
@class OSSClientConfiguration; |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
typedef OSSFederationToken * _Nullable (^OSSGetFederationTokenBlock) (void); |
|||
|
|||
/** |
|||
Categories NSDictionary |
|||
*/ |
|||
@interface NSDictionary (OSS) |
|||
- (NSString *)base64JsonString; |
|||
@end |
|||
|
|||
/** |
|||
A thread-safe dictionary |
|||
*/ |
|||
@interface OSSSyncMutableDictionary : NSObject |
|||
@property (nonatomic, strong) NSMutableDictionary *dictionary; |
|||
@property (nonatomic, strong) dispatch_queue_t dispatchQueue; |
|||
|
|||
- (id)objectForKey:(id)aKey; |
|||
- (NSArray *)allKeys; |
|||
- (void)setObject:(id)anObject forKey:(id <NSCopying>)aKey; |
|||
- (void)removeObjectForKey:(id)aKey; |
|||
@end |
|||
|
|||
/** |
|||
FederationToken class |
|||
*/ |
|||
@interface OSSFederationToken : NSObject |
|||
@property (nonatomic, copy) NSString * tAccessKey; |
|||
@property (nonatomic, copy) NSString * tSecretKey; |
|||
@property (nonatomic, copy) NSString * tToken; |
|||
|
|||
/** |
|||
Token's expiration time in milliseconds of the unix time. |
|||
*/ |
|||
@property (atomic, assign) int64_t expirationTimeInMilliSecond; |
|||
|
|||
/** |
|||
Token's expiration time in GMT format string. |
|||
*/ |
|||
@property (atomic, strong, nullable) NSString *expirationTimeInGMTFormat; |
|||
@end |
|||
|
|||
/** |
|||
CredentialProvider protocol, needs to implement sign API. |
|||
*/ |
|||
@protocol OSSCredentialProvider <NSObject> |
|||
@optional |
|||
- (nullable NSString *)sign:(NSString *)content error:(NSError **)error; |
|||
@end |
|||
|
|||
/** |
|||
The STS token's credential provider. |
|||
*/ |
|||
@interface OSSStsTokenCredentialProvider : NSObject <OSSCredentialProvider> |
|||
@property (nonatomic, copy) NSString * accessKeyId; |
|||
@property (nonatomic, copy) NSString * secretKeyId; |
|||
@property (nonatomic, copy) NSString * securityToken; |
|||
|
|||
- (OSSFederationToken *)getToken; |
|||
- (instancetype)initWithAccessKeyId:(NSString *)accessKeyId |
|||
secretKeyId:(NSString *)secretKeyId |
|||
securityToken:(NSString *)securityToken; |
|||
@end |
|||
|
|||
/** |
|||
OSSClient side configuration. |
|||
*/ |
|||
@interface OSSClientConfiguration : NSObject |
|||
|
|||
/** |
|||
Max retry count |
|||
*/ |
|||
@property (nonatomic, assign) uint32_t maxRetryCount; |
|||
|
|||
/** |
|||
Max concurrent requests |
|||
*/ |
|||
@property (nonatomic, assign) uint32_t maxConcurrentRequestCount; |
|||
|
|||
/** |
|||
Flag of enabling background file transmit service. |
|||
Note: it's only applicable for file upload. |
|||
*/ |
|||
@property (nonatomic, assign) BOOL enableBackgroundTransmitService; |
|||
|
|||
/** |
|||
Sets the session Id for background file transmission |
|||
*/ |
|||
@property (nonatomic, copy) NSString * backgroundSesseionIdentifier; |
|||
|
|||
/** |
|||
Sets request timeout |
|||
*/ |
|||
@property (nonatomic, assign) NSTimeInterval timeoutIntervalForRequest; |
|||
|
|||
/** |
|||
Sets single object download's max time |
|||
*/ |
|||
@property (nonatomic, assign) NSTimeInterval timeoutIntervalForResource; |
|||
|
|||
/** |
|||
Sets proxy host and port. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * proxyHost; |
|||
@property (nonatomic, strong) NSNumber * proxyPort; |
|||
|
|||
/** |
|||
Sets UA |
|||
*/ |
|||
@property (nonatomic, copy) NSString * userAgentMark; |
|||
|
|||
/** |
|||
Sets the flag of using Second Level Domain style to access the endpoint. By default it's false. |
|||
*/ |
|||
@property (nonatomic, assign) BOOL isPathStyleAccessEnable; |
|||
|
|||
/** |
|||
Sets the flag of using custom path prefix to access the endpoint. By default it's false. |
|||
*/ |
|||
@property (nonatomic, assign) BOOL isCustomPathPrefixEnable; |
|||
|
|||
/** |
|||
Sets CName excluded list. |
|||
*/ |
|||
@property (nonatomic, strong, setter=setCnameExcludeList:) NSArray * cnameExcludeList; |
|||
|
|||
/** |
|||
是否开启crc校验(当同时设置了此选项和请求中的checkCRC开关时,以请求中的checkCRC开关为准) |
|||
*/ |
|||
@property (nonatomic, assign) BOOL crc64Verifiable; |
|||
|
|||
@end |
|||
|
|||
@protocol OSSRequestInterceptor <NSObject> |
|||
- (OSSTask *)interceptRequestMessage:(OSSAllRequestNeededMessage *)request; |
|||
@end |
|||
|
|||
/** |
|||
Signs the request when it's being created. |
|||
*/ |
|||
@interface OSSSignerInterceptor : NSObject <OSSRequestInterceptor> |
|||
@property (nonatomic, strong) id<OSSCredentialProvider> credentialProvider; |
|||
|
|||
- (instancetype)initWithCredentialProvider:(id<OSSCredentialProvider>)credentialProvider; |
|||
@end |
|||
|
|||
/** |
|||
Updates the UA when creating the request. |
|||
*/ |
|||
@interface OSSUASettingInterceptor : NSObject <OSSRequestInterceptor> |
|||
@property (nonatomic, weak) OSSClientConfiguration *clientConfiguration; |
|||
- (instancetype)initWithClientConfiguration:(OSSClientConfiguration *) clientConfiguration; |
|||
@end |
|||
|
|||
/** |
|||
Fixes the time skew issue when creating the request. |
|||
*/ |
|||
@interface OSSTimeSkewedFixingInterceptor : NSObject <OSSRequestInterceptor> |
|||
@end |
|||
|
|||
#pragma mark RequestAndResultClass |
|||
|
|||
@interface OSSPutObjectRequest : OSSRequest |
|||
|
|||
/** |
|||
Bucket name |
|||
*/ |
|||
@property (nonatomic, copy) NSString * bucketName; |
|||
|
|||
/** |
|||
Object name |
|||
*/ |
|||
@property (nonatomic, copy) NSString * objectKey; |
|||
|
|||
/** |
|||
The in-memory data to upload. |
|||
*/ |
|||
@property (nonatomic, strong) NSData * uploadingData; |
|||
|
|||
/** |
|||
The local file path to upload. |
|||
*/ |
|||
@property (nonatomic, strong) NSURL * uploadingFileURL; |
|||
|
|||
/** |
|||
The callback parameters. |
|||
*/ |
|||
@property (nonatomic, copy) NSDictionary * callbackParam; |
|||
|
|||
/** |
|||
The callback variables. |
|||
*/ |
|||
@property (nonatomic, copy) NSDictionary * callbackVar; |
|||
|
|||
/** |
|||
The content type. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * contentType; |
|||
|
|||
/** |
|||
The content's MD5 digest. |
|||
It's calculated on the request body (not headers) according to RFC 1864 to get the 128 bit digest data. |
|||
Then use base64 encoding on the 128bit result to get this MD5 value. |
|||
This header is for integrity check on the data. And it's recommended to turn on for every body. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * contentMd5; |
|||
|
|||
/** |
|||
Specifies the download name of the object. Checks out RFC2616 for more details. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * contentDisposition; |
|||
|
|||
/** |
|||
Specifies the content encoding during the download. Checks out RFC2616 for more details. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * contentEncoding; |
|||
|
|||
/** |
|||
Specifies the cache behavior during the download. Checks out RFC2616 for more details. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * cacheControl; |
|||
|
|||
/** |
|||
Expiration time in milliseconds. Checks out RFC2616 for more details. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * expires; |
|||
|
|||
/** |
|||
The object's metadata. |
|||
When the object is being uploaded, it could be specified with http headers prefixed with x-oss-meta for user metadata. |
|||
The total size of all user metadata cannot be more than 8K. |
|||
It also could include standard HTTP headers in this object. |
|||
*/ |
|||
@property (nonatomic, copy) NSDictionary * objectMeta; |
|||
|
|||
/** |
|||
The upload progress callback. |
|||
It runs in background thread (not UI thread). |
|||
*/ |
|||
@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress; |
|||
|
|||
/** |
|||
The upload retry callback. |
|||
It runs in background thread (not UI thread). |
|||
*/ |
|||
@property (nonatomic, copy) OSSNetworkingRetryBlock uploadRetryCallback; |
|||
|
|||
/** |
|||
* the sha1 of content |
|||
*/ |
|||
@property (nonatomic, copy) NSString *contentSHA1; |
|||
|
|||
@end |
|||
|
|||
/** |
|||
The result class to put an object |
|||
*/ |
|||
@interface OSSPutObjectResult : OSSResult |
|||
|
|||
/** |
|||
ETag (entity tag) is the tag during the object creation in OSS server side. |
|||
It's the MD5 value for put object request. If the object is created by other APIs, the ETag is the UUID of the content. |
|||
ETag could be used to check if the object has been updated. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * eTag; |
|||
|
|||
/** |
|||
If the callback is specified, this is the callback response result. |
|||
*/ |
|||
@property (nonatomic, copy) NSString * serverReturnJsonString; |
|||
@end |
|||
|
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,14 @@ |
|||
// |
|||
// OSSNSLogger.h |
|||
// AliyunOSSiOS |
|||
// |
|||
// Created by jingdan on 2017/10/24. |
|||
// Copyright © 2017年 zhouzhuo. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSDDLog.h" |
|||
|
|||
@interface OSSNSLogger : OSSDDAbstractLogger <OSSDDLogger> |
|||
@property (class, readonly, strong) OSSNSLogger *sharedInstance; |
|||
@end |
@ -0,0 +1,45 @@ |
|||
// |
|||
// OSSNetworking.h |
|||
// oss_ios_sdk |
|||
// |
|||
// Created by zhouzhuo on 8/16/15. |
|||
// Copyright (c) 2015 aliyun.com. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSModel.h" |
|||
|
|||
@class OSSSyncMutableDictionary; |
|||
@class OSSNetworkingRequestDelegate; |
|||
@class OSSExecutor; |
|||
|
|||
|
|||
|
|||
/** |
|||
Network parameters |
|||
*/ |
|||
@interface OSSNetworkingConfiguration : NSObject |
|||
@property (nonatomic, assign) uint32_t maxRetryCount; |
|||
@property (nonatomic, assign) uint32_t maxConcurrentRequestCount; |
|||
@property (nonatomic, assign) BOOL enableBackgroundTransmitService; |
|||
@property (nonatomic, strong) NSString * backgroundSessionIdentifier; |
|||
@property (nonatomic, assign) NSTimeInterval timeoutIntervalForRequest; |
|||
@property (nonatomic, assign) NSTimeInterval timeoutIntervalForResource; |
|||
@property (nonatomic, strong) NSString * proxyHost; |
|||
@property (nonatomic, strong) NSNumber * proxyPort; |
|||
@end |
|||
|
|||
|
|||
/** |
|||
The network interface which OSSClient uses for network read and write operations. |
|||
*/ |
|||
@interface OSSNetworking : NSObject <NSURLSessionDelegate, NSURLSessionDataDelegate> |
|||
@property (nonatomic, strong) NSURLSession * session; |
|||
@property (nonatomic, assign) BOOL isUsingBackgroundSession; |
|||
@property (nonatomic, strong) OSSSyncMutableDictionary * sessionDelagateManager; |
|||
@property (nonatomic, strong) OSSNetworkingConfiguration * configuration; |
|||
@property (nonatomic, strong) OSSExecutor * taskExecutor; |
|||
|
|||
- (instancetype)initWithConfiguration:(OSSNetworkingConfiguration *)configuration; |
|||
- (OSSTask *)sendRequest:(OSSNetworkingRequestDelegate *)request; |
|||
@end |
@ -0,0 +1,79 @@ |
|||
// |
|||
// OSSNetworkingRequestDelegate.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/1/22. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSConstants.h" |
|||
#import "OSSTask.h" |
|||
|
|||
@class OSSAllRequestNeededMessage; |
|||
@class OSSURLRequestRetryHandler; |
|||
@class OSSHttpResponseParser; |
|||
|
|||
/** |
|||
The proxy object class for each OSS request. |
|||
*/ |
|||
@interface OSSNetworkingRequestDelegate : NSObject |
|||
|
|||
@property (nonatomic, strong) NSMutableArray * interceptors; |
|||
|
|||
@property (nonatomic, strong) NSMutableURLRequest *internalRequest; |
|||
@property (nonatomic, assign) OSSOperationType operType; |
|||
@property (nonatomic, assign) BOOL isAccessViaProxy; |
|||
|
|||
@property (nonatomic, assign) BOOL isRequestCancelled; |
|||
|
|||
@property (nonatomic, strong) OSSAllRequestNeededMessage *allNeededMessage; |
|||
@property (nonatomic, strong) OSSURLRequestRetryHandler *retryHandler; |
|||
@property (nonatomic, strong) OSSHttpResponseParser *responseParser; |
|||
|
|||
@property (nonatomic, strong) NSData * uploadingData; |
|||
@property (nonatomic, strong) NSURL * uploadingFileURL; |
|||
|
|||
@property (nonatomic, assign) int64_t payloadTotalBytesWritten; |
|||
|
|||
@property (nonatomic, assign) BOOL isBackgroundUploadFileTask; |
|||
@property (nonatomic, assign) BOOL isHttpdnsEnable; |
|||
|
|||
@property (nonatomic, assign) BOOL isPathStyleAccessEnable; |
|||
@property (nonatomic, assign) BOOL isCustomPathPrefixEnable; |
|||
@property (nonatomic, copy) NSArray * cnameExcludeList; |
|||
|
|||
@property (nonatomic, assign) uint32_t currentRetryCount; |
|||
@property (nonatomic, strong) NSError * error; |
|||
@property (nonatomic, assign) BOOL isHttpRequestNotSuccessResponse; |
|||
@property (nonatomic, strong) NSMutableData *httpRequestNotSuccessResponseBody; |
|||
|
|||
@property (atomic, strong) NSURLSessionDataTask *currentSessionTask; |
|||
|
|||
@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress; |
|||
@property (nonatomic, copy) OSSNetworkingDownloadProgressBlock downloadProgress; |
|||
@property (nonatomic, copy) OSSNetworkingRetryBlock retryCallback; |
|||
@property (nonatomic, copy) OSSNetworkingCompletionHandlerBlock completionHandler; |
|||
@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveData; |
|||
|
|||
/** |
|||
* when put object to server,client caculate crc64 code and assigns it to |
|||
* this property. |
|||
*/ |
|||
@property (nonatomic, copy) NSString *contentCRC; |
|||
|
|||
/** last crc64 code */ |
|||
@property (nonatomic, copy) NSString *lastCRC; |
|||
|
|||
/** |
|||
* determine whether to verify crc64 code |
|||
*/ |
|||
@property (nonatomic, assign) BOOL crc64Verifiable; |
|||
|
|||
|
|||
|
|||
- (OSSTask *)buildInternalHttpRequest; |
|||
- (void)reset; |
|||
- (void)cancel; |
|||
|
|||
@end |
@ -0,0 +1,64 @@ |
|||
/* |
|||
Copyright (C) 2016 Apple Inc. All Rights Reserved. |
|||
See LICENSE.txt for this sample’s licensing information |
|||
|
|||
Abstract: |
|||
Basic demonstration of how to use the SystemConfiguration Reachablity APIs. |
|||
*/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <SystemConfiguration/SystemConfiguration.h> |
|||
#import <netinet/in.h> |
|||
|
|||
|
|||
typedef enum : NSInteger { |
|||
OSSNotReachable = 0, |
|||
OSSReachableViaWiFi, |
|||
OSSReachableViaWWAN |
|||
} OSSNetworkStatus; |
|||
|
|||
#pragma mark IPv6 Support |
|||
//Reachability fully support IPv6. For full details, see ReadMe.md. |
|||
|
|||
|
|||
extern NSString *ossReachabilityChangedNotification; |
|||
|
|||
|
|||
@interface OSSReachability : NSObject |
|||
|
|||
/*! |
|||
* Use to check the reachability of a given host name. |
|||
*/ |
|||
+ (instancetype)reachabilityWithHostName:(NSString *)hostName; |
|||
|
|||
/*! |
|||
* Use to check the reachability of a given IP address. |
|||
*/ |
|||
+ (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress; |
|||
|
|||
/*! |
|||
* Checks whether the default route is available. Should be used by applications that do not connect to a particular host. |
|||
*/ |
|||
+ (instancetype)reachabilityForInternetConnection; |
|||
|
|||
|
|||
#pragma mark reachabilityForLocalWiFi |
|||
//reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information. |
|||
//+ (instancetype)reachabilityForLocalWiFi; |
|||
|
|||
/*! |
|||
* Start listening for reachability notifications on the current run loop. |
|||
*/ |
|||
- (BOOL)startNotifier; |
|||
- (void)stopNotifier; |
|||
|
|||
- (OSSNetworkStatus)currentReachabilityStatus; |
|||
|
|||
/*! |
|||
* WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand. |
|||
*/ |
|||
- (BOOL)connectionRequired; |
|||
|
|||
@end |
|||
|
|||
|
@ -0,0 +1,41 @@ |
|||
// |
|||
// OSSRequest.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/1/22. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSConstants.h" |
|||
|
|||
/** |
|||
The base class of request to OSS. |
|||
*/ |
|||
@interface OSSRequest : NSObject |
|||
/** |
|||
Flag of requiring authentication. It's per each request. |
|||
*/ |
|||
@property (nonatomic, assign) BOOL isAuthenticationRequired; |
|||
|
|||
/** |
|||
the flag of request canceled. |
|||
*/ |
|||
@property (atomic, assign) BOOL isCancelled; |
|||
|
|||
/** |
|||
the flag of verification about crc64 |
|||
*/ |
|||
@property (nonatomic, assign) OSSRequestCRCFlag crcFlag; |
|||
|
|||
/** |
|||
Cancels the request |
|||
*/ |
|||
- (void)cancel; |
|||
|
|||
/** |
|||
Gets the query parameters' dictionary according to the properties. |
|||
*/ |
|||
- (NSDictionary *)requestParams; |
|||
|
|||
@end |
@ -0,0 +1,42 @@ |
|||
// |
|||
// OSSResult.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/1/26. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
/** |
|||
The base class of result from OSS. |
|||
*/ |
|||
@interface OSSResult : NSObject |
|||
|
|||
/** |
|||
The http response code. |
|||
*/ |
|||
@property (nonatomic, assign) NSInteger httpResponseCode; |
|||
|
|||
/** |
|||
The http headers, in the form of key value dictionary. |
|||
*/ |
|||
@property (nonatomic, strong) NSDictionary * httpResponseHeaderFields; |
|||
|
|||
/** |
|||
The request Id. It's the value of header x-oss-request-id, which is created from OSS server. |
|||
It's a unique Id represents this request. This is used for troubleshooting when you contact OSS support. |
|||
*/ |
|||
@property (nonatomic, strong) NSString * requestId; |
|||
|
|||
/** |
|||
It's the value of header x-oss-hash-crc64ecma, which is created from OSS server. |
|||
*/ |
|||
@property (nonatomic, copy) NSString *remoteCRC64ecma; |
|||
|
|||
/** |
|||
It's the value of local Data. |
|||
*/ |
|||
@property (nonatomic, copy) NSString *localCRC64ecma; |
|||
|
|||
@end |
@ -0,0 +1,28 @@ |
|||
// |
|||
// OSSService.h |
|||
// oss_ios_sdk |
|||
// |
|||
// Created by zhouzhuo on 8/20/15. |
|||
// Copyright (c) 2015 aliyun.com. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
#define OSS_IOS_SDK_VERSION OSSSDKVersion |
|||
|
|||
#import "OSSDefine.h" |
|||
#import "OSSConstants.h" |
|||
|
|||
#import "OSSNetworking.h" |
|||
#import "OSSNetworkingRequestDelegate.h" |
|||
#import "OSSAllRequestNeededMessage.h" |
|||
#import "OSSURLRequestRetryHandler.h" |
|||
#import "OSSHttpResponseParser.h" |
|||
#import "OSSRequest.h" |
|||
|
|||
#import "OSSClient.h" |
|||
#import "OSSModel.h" |
|||
#import "OSSUtil.h" |
|||
#import "OSSLog.h" |
|||
|
|||
#import "OSSBolts.h" |
@ -0,0 +1,281 @@ |
|||
/* |
|||
* Copyright (c) 2014, Facebook, Inc. |
|||
* All rights reserved. |
|||
* |
|||
* This source code is licensed under the BSD-style license found in the |
|||
* LICENSE file in the root directory of this source tree. An additional grant |
|||
* of patent rights can be found in the PATENTS file in the same directory. |
|||
* |
|||
*/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
#import "OSSCancellationToken.h" |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/*! |
|||
Error domain used if there was multiple errors on <OSSTask taskForCompletionOfAllTasks:>. |
|||
*/ |
|||
extern NSString *const OSSTaskErrorDomain; |
|||
|
|||
/*! |
|||
An error code used for <OSSTask taskForCompletionOfAllTasks:>, if there were multiple errors. |
|||
*/ |
|||
extern NSInteger const kOSSMultipleErrorsError; |
|||
|
|||
/*! |
|||
An exception that is thrown if there was multiple exceptions on <OSSTask taskForCompletionOfAllTasks:>. |
|||
*/ |
|||
extern NSString *const OSSTaskMultipleExceptionsException; |
|||
|
|||
/*! |
|||
An error userInfo key used if there were multiple errors on <OSSTask taskForCompletionOfAllTasks:>. |
|||
Value type is `NSArray<NSError *> *`. |
|||
*/ |
|||
extern NSString *const OSSTaskMultipleErrorsUserInfoKey; |
|||
|
|||
/*! |
|||
An error userInfo key used if there were multiple exceptions on <OSSTask taskForCompletionOfAllTasks:>. |
|||
Value type is `NSArray<NSException *> *`. |
|||
*/ |
|||
extern NSString *const OSSTaskMultipleExceptionsUserInfoKey; |
|||
|
|||
@class OSSExecutor; |
|||
@class OSSTask; |
|||
|
|||
/*! |
|||
The consumer view of a Task. A OSSTask has methods to |
|||
inspect the state of the task, and to add continuations to |
|||
be run once the task is complete. |
|||
*/ |
|||
@interface OSSTask<__covariant ResultType> : NSObject |
|||
|
|||
/*! |
|||
A block that can act as a continuation for a task. |
|||
*/ |
|||
typedef __nullable id(^OSSContinuationBlock)(OSSTask<ResultType> *task); |
|||
|
|||
/*! |
|||
Creates a task that is already completed with the given result. |
|||
@param result The result for the task. |
|||
*/ |
|||
+ (instancetype)taskWithResult:(_Nullable ResultType)result; |
|||
|
|||
/*! |
|||
Creates a task that is already completed with the given error. |
|||
@param error The error for the task. |
|||
*/ |
|||
+ (instancetype)taskWithError:(NSError *)error; |
|||
|
|||
/*! |
|||
Creates a task that is already completed with the given exception. |
|||
@param exception The exception for the task. |
|||
*/ |
|||
+ (instancetype)taskWithException:(NSException *)exception; |
|||
|
|||
/*! |
|||
Creates a task that is already cancelled. |
|||
*/ |
|||
+ (instancetype)cancelledTask; |
|||
|
|||
/*! |
|||
Returns a task that will be completed (with result == nil) once |
|||
all of the input tasks have completed. |
|||
@param tasks An `NSArray` of the tasks to use as an input. |
|||
*/ |
|||
+ (instancetype)taskForCompletionOfAllTasks:(nullable NSArray<OSSTask *> *)tasks; |
|||
|
|||
/*! |
|||
Returns a task that will be completed once all of the input tasks have completed. |
|||
If all tasks complete successfully without being faulted or cancelled the result will be |
|||
an `NSArray` of all task results in the order they were provided. |
|||
@param tasks An `NSArray` of the tasks to use as an input. |
|||
*/ |
|||
+ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<OSSTask *> *)tasks; |
|||
|
|||
/*! |
|||
Returns a task that will be completed once there is at least one successful task. |
|||
The first task to successuly complete will set the result, all other tasks results are |
|||
ignored. |
|||
@param tasks An `NSArray` of the tasks to use as an input. |
|||
*/ |
|||
+ (instancetype)taskForCompletionOfAnyTask:(nullable NSArray<OSSTask *> *)tasks; |
|||
|
|||
/*! |
|||
Returns a task that will be completed a certain amount of time in the future. |
|||
@param millis The approximate number of milliseconds to wait before the |
|||
task will be finished (with result == nil). |
|||
*/ |
|||
+ (instancetype)taskWithDelay:(int)millis; |
|||
|
|||
/*! |
|||
Returns a task that will be completed a certain amount of time in the future. |
|||
@param millis The approximate number of milliseconds to wait before the |
|||
task will be finished (with result == nil). |
|||
@param token The cancellation token (optional). |
|||
*/ |
|||
+ (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable OSSCancellationToken *)token; |
|||
|
|||
/*! |
|||
Returns a task that will be completed after the given block completes with |
|||
the specified executor. |
|||
@param executor A OSSExecutor responsible for determining how the |
|||
continuation block will be run. |
|||
@param block The block to immediately schedule to run with the given executor. |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
+ (instancetype)taskFromExecutor:(OSSExecutor *)executor withBlock:(nullable id (^)(void))block; |
|||
|
|||
// Properties that will be set on the task once it is completed. |
|||
|
|||
/*! |
|||
The result of a successful task. |
|||
*/ |
|||
@property (nullable, nonatomic, strong, readonly) ResultType result; |
|||
|
|||
/*! |
|||
The error of a failed task. |
|||
*/ |
|||
@property (nullable, nonatomic, strong, readonly) NSError *error; |
|||
|
|||
/*! |
|||
The exception of a failed task. |
|||
*/ |
|||
@property (nullable, nonatomic, strong, readonly) NSException *exception; |
|||
|
|||
/*! |
|||
Whether this task has been cancelled. |
|||
*/ |
|||
@property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled; |
|||
|
|||
/*! |
|||
Whether this task has completed due to an error or exception. |
|||
*/ |
|||
@property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted; |
|||
|
|||
/*! |
|||
Whether this task has completed. |
|||
*/ |
|||
@property (nonatomic, assign, readonly, getter=isCompleted) BOOL completed; |
|||
|
|||
/*! |
|||
Enqueues the given block to be run once this task is complete. |
|||
This method uses a default execution strategy. The block will be |
|||
run on the thread where the previous task completes, unless the |
|||
the stack depth is too deep, in which case it will be run on a |
|||
dispatch queue with default priority. |
|||
@param block The block to be run once this task is complete. |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithBlock:(OSSContinuationBlock)block; |
|||
|
|||
/*! |
|||
Enqueues the given block to be run once this task is complete. |
|||
This method uses a default execution strategy. The block will be |
|||
run on the thread where the previous task completes, unless the |
|||
the stack depth is too deep, in which case it will be run on a |
|||
dispatch queue with default priority. |
|||
@param block The block to be run once this task is complete. |
|||
@param cancellationToken The cancellation token (optional). |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithBlock:(OSSContinuationBlock)block cancellationToken:(nullable OSSCancellationToken *)cancellationToken; |
|||
|
|||
/*! |
|||
Enqueues the given block to be run once this task is complete. |
|||
@param executor A OSSExecutor responsible for determining how the |
|||
continuation block will be run. |
|||
@param block The block to be run once this task is complete. |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor withBlock:(OSSContinuationBlock)block; |
|||
/*! |
|||
Enqueues the given block to be run once this task is complete. |
|||
@param executor A OSSExecutor responsible for determining how the |
|||
continuation block will be run. |
|||
@param block The block to be run once this task is complete. |
|||
@param cancellationToken The cancellation token (optional). |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
his method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor |
|||
block:(OSSContinuationBlock)block |
|||
cancellationToken:(nullable OSSCancellationToken *)cancellationToken; |
|||
|
|||
/*! |
|||
Identical to continueWithBlock:, except that the block is only run |
|||
if this task did not produce a cancellation, error, or exception. |
|||
If it did, then the failure will be propagated to the returned |
|||
task. |
|||
@param block The block to be run once this task is complete. |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithSuccessBlock:(OSSContinuationBlock)block; |
|||
|
|||
/*! |
|||
Identical to continueWithBlock:, except that the block is only run |
|||
if this task did not produce a cancellation, error, or exception. |
|||
If it did, then the failure will be propagated to the returned |
|||
task. |
|||
@param block The block to be run once this task is complete. |
|||
@param cancellationToken The cancellation token (optional). |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithSuccessBlock:(OSSContinuationBlock)block cancellationToken:(nullable OSSCancellationToken *)cancellationToken; |
|||
|
|||
/*! |
|||
Identical to continueWithExecutor:withBlock:, except that the block |
|||
is only run if this task did not produce a cancellation, error, or |
|||
exception. If it did, then the failure will be propagated to the |
|||
returned task. |
|||
@param executor A OSSExecutor responsible for determining how the |
|||
continuation block will be run. |
|||
@param block The block to be run once this task is complete. |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor withSuccessBlock:(OSSContinuationBlock)block; |
|||
|
|||
/*! |
|||
Identical to continueWithExecutor:withBlock:, except that the block |
|||
is only run if this task did not produce a cancellation, error, or |
|||
exception. If it did, then the failure will be propagated to the |
|||
returned task. |
|||
@param executor A OSSExecutor responsible for determining how the |
|||
continuation block will be run. |
|||
@param block The block to be run once this task is complete. |
|||
@param cancellationToken The cancellation token (optional). |
|||
@returns A task that will be completed after block has run. |
|||
If block returns a OSSTask, then the task returned from |
|||
this method will not be completed until that task is completed. |
|||
*/ |
|||
- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor |
|||
successBlock:(OSSContinuationBlock)block |
|||
cancellationToken:(nullable OSSCancellationToken *)cancellationToken; |
|||
|
|||
/*! |
|||
Waits until this operation is completed. |
|||
This method is inefficient and consumes a thread resource while |
|||
it's running. It should be avoided. This method logs a warning |
|||
message if it is used on the main thread. |
|||
*/ |
|||
- (void)waitUntilFinished; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,89 @@ |
|||
/* |
|||
* Copyright (c) 2014, Facebook, Inc. |
|||
* All rights reserved. |
|||
* |
|||
* This source code is licensed under the BSD-style license found in the |
|||
* LICENSE file in the root directory of this source tree. An additional grant |
|||
* of patent rights can be found in the PATENTS file in the same directory. |
|||
* |
|||
*/ |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
@class OSSTask<ResultType>; |
|||
|
|||
/*! |
|||
A OSSTaskCompletionSource represents the producer side of tasks. |
|||
It is a task that also has methods for changing the state of the |
|||
task by settings its completion values. |
|||
*/ |
|||
@interface OSSTaskCompletionSource<__covariant ResultType> : NSObject |
|||
|
|||
/*! |
|||
Creates a new unfinished task. |
|||
*/ |
|||
+ (instancetype)taskCompletionSource; |
|||
|
|||
/*! |
|||
The task associated with this TaskCompletionSource. |
|||
*/ |
|||
@property (nonatomic, strong, readonly) OSSTask<ResultType> *task; |
|||
|
|||
/*! |
|||
Completes the task by setting the result. |
|||
Attempting to set this for a completed task will raise an exception. |
|||
@param result The result of the task. |
|||
*/ |
|||
- (void)setResult:(nullable ResultType)result; |
|||
|
|||
/*! |
|||
Completes the task by setting the error. |
|||
Attempting to set this for a completed task will raise an exception. |
|||
@param error The error for the task. |
|||
*/ |
|||
- (void)setError:(NSError *)error; |
|||
|
|||
/*! |
|||
Completes the task by setting an exception. |
|||
Attempting to set this for a completed task will raise an exception. |
|||
@param exception The exception for the task. |
|||
*/ |
|||
- (void)setException:(NSException *)exception; |
|||
|
|||
/*! |
|||
Completes the task by marking it as cancelled. |
|||
Attempting to set this for a completed task will raise an exception. |
|||
*/ |
|||
- (void)cancel; |
|||
|
|||
/*! |
|||
Sets the result of the task if it wasn't already completed. |
|||
@returns whether the new value was set. |
|||
*/ |
|||
- (BOOL)trySetResult:(nullable ResultType)result; |
|||
|
|||
/*! |
|||
Sets the error of the task if it wasn't already completed. |
|||
@param error The error for the task. |
|||
@returns whether the new value was set. |
|||
*/ |
|||
- (BOOL)trySetError:(NSError *)error; |
|||
|
|||
/*! |
|||
Sets the exception of the task if it wasn't already completed. |
|||
@param exception The exception for the task. |
|||
@returns whether the new value was set. |
|||
*/ |
|||
- (BOOL)trySetException:(NSException *)exception; |
|||
|
|||
/*! |
|||
Sets the cancellation state of the task if it wasn't already completed. |
|||
@returns whether the new value was set. |
|||
*/ |
|||
- (BOOL)trySetCancelled; |
|||
|
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,36 @@ |
|||
// |
|||
// OSSURLRequestRetryHandler.h |
|||
// AliyunOSSSDK |
|||
// |
|||
// Created by huaixu on 2018/1/22. |
|||
// Copyright © 2018年 aliyun. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSConstants.h" |
|||
|
|||
@class OSSNetworkingRequestDelegate; |
|||
|
|||
|
|||
NS_ASSUME_NONNULL_BEGIN |
|||
|
|||
/** |
|||
The retry handler interface |
|||
*/ |
|||
@interface OSSURLRequestRetryHandler : NSObject |
|||
|
|||
@property (nonatomic, assign) uint32_t maxRetryCount; |
|||
|
|||
|
|||
+ (instancetype)defaultRetryHandler; |
|||
|
|||
- (OSSNetworkingRetryType)shouldRetry:(uint32_t)currentRetryCount |
|||
requestDelegate:(OSSNetworkingRequestDelegate *)delegate |
|||
response:(NSHTTPURLResponse *)response |
|||
error:(NSError *)error; |
|||
|
|||
- (NSTimeInterval)timeIntervalForRetry:(uint32_t)currentRetryCount |
|||
retryType:(OSSNetworkingRetryType)retryType; |
|||
@end |
|||
|
|||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,75 @@ |
|||
// |
|||
// OSSUtil.h |
|||
// oss_ios_sdk |
|||
// |
|||
// Created by zhouzhuo on 8/16/15. |
|||
// Copyright (c) 2015 aliyun.com. All rights reserved. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSFileLogger.h" |
|||
|
|||
#import "NSMutableDictionary+OSS.h" |
|||
#import "NSMutableData+OSS_CRC.h" |
|||
#import "NSDate+OSS.h" |
|||
|
|||
@class OSSFederationToken; |
|||
|
|||
@interface OSSUtil : NSObject |
|||
|
|||
+ (BOOL)isIncludeCnameExcludeList:(NSArray *)cnameExcludeList host:(NSString *)host; |
|||
+ (NSString *)calBase64Sha1WithData:(NSString *)data withSecret:(NSString *)key; |
|||
+ (NSString *)calBase64WithData:(uint8_t *)data; |
|||
+ (NSString *)encodeURL:(NSString *)url; |
|||
+ (NSData *)constructHttpBodyForDeleteMultipleObjects:(NSArray<NSString *> *)keys quiet:(BOOL)quiet; |
|||
+ (NSData *)constructHttpBodyForCreateBucketWithLocation:(NSString *)location __attribute__((deprecated("deprecated!"))); |
|||
+ (BOOL)validateBucketName:(NSString *)bucketName; |
|||
+ (BOOL)validateObjectKey:(NSString *)objectKey; |
|||
+ (BOOL)isOssOriginBucketHost:(NSString *)host; |
|||
+ (BOOL)isNetworkDelegateState; |
|||
|
|||
+ (NSData *)fileMD5:(NSString *)path; |
|||
+ (NSString *)dataMD5String:(NSData *)data; |
|||
+ (NSString *)fileMD5String:(NSString *)path; |
|||
+ (NSString *)base64Md5ForData:(NSData *)data; |
|||
+ (NSString *)base64Md5ForFilePath:(NSString *)filePath; |
|||
+ (NSString *)base64Md5ForFileURL:(NSURL *)fileURL; |
|||
+ (NSString *)base64ForData:(uint8_t *)input length:(int32_t)length; |
|||
|
|||
+ (NSString *)populateSubresourceStringFromParameter:(NSDictionary *)parameters; |
|||
+ (NSString *)populateQueryStringFromParameter:(NSDictionary *)parameters; |
|||
+ (BOOL)isSubresource:(NSString *)param; |
|||
+ (NSString *)sign:(NSString *)content withToken:(OSSFederationToken *)token; |
|||
+ (NSString *)getRelativePath:(NSString *)fullPath; |
|||
+ (NSString *)detemineMimeTypeForFilePath:(NSString *)filePath uploadName:(NSString *)uploadName; |
|||
+ (BOOL)hasPhoneFreeSpace; |
|||
+ (NSString*)buildNetWorkConnectedMsg; |
|||
+ (NSString*)buildOperatorMsg; |
|||
|
|||
+ (uint64_t)crc64ecma:(uint64_t)crc1 buffer:(void *)buffer length:(size_t)len; |
|||
|
|||
/** |
|||
* @brief: combine crc1 and crc2 |
|||
*/ |
|||
|
|||
+ (uint64_t)crc64ForCombineCRC1:(uint64_t)crc1 CRC2:(uint64_t)crc2 length:(size_t)len2; |
|||
|
|||
+ (NSString *)sha1WithString:(NSString *)string; |
|||
+ (NSString *)sha1WithData:(NSData *)data; |
|||
+ (NSString *)sha1WithFilePath:(NSString *)filePath; |
|||
|
|||
+ (NSData *)constructHttpBodyForTriggerCallback:(NSString *)callbackParams callbackVaribles:(NSString *)callbackVaribles; |
|||
|
|||
+ (NSData *)constructHttpBodyForImagePersist:(NSString *)action toBucket:(NSString *)toBucket toObjectKey:(NSString *)toObjectKey; |
|||
|
|||
@end |
|||
|
|||
@interface NSString (OSS) |
|||
|
|||
- (NSString *)oss_trim; |
|||
- (BOOL)oss_isNotEmpty; |
|||
- (NSString *)oss_stringByAppendingPathComponentForURL:(NSString *)path; |
|||
+ (NSString *)oss_documentDirectory; |
|||
- (NSString *)oss_urlEncodedString; |
|||
|
|||
@end |
@ -0,0 +1,88 @@ |
|||
// |
|||
// XMLDictionary.h |
|||
// |
|||
// Version 1.4 |
|||
// |
|||
// Created by Nick Lockwood on 15/11/2010. |
|||
// Copyright 2010 Charcoal Design. All rights reserved. |
|||
// |
|||
// Get the latest version of XMLDictionary from here: |
|||
// |
|||
// https://github.com/nicklockwood/XMLDictionary |
|||
// |
|||
// This software is provided 'as-is', without any express or implied |
|||
// warranty. In no event will the authors be held liable for any damages |
|||
// arising from the use of this software. |
|||
// |
|||
// Permission is granted to anyone to use this software for any purpose, |
|||
// including commercial applications, and to alter it and redistribute it |
|||
// freely, subject to the following restrictions: |
|||
// |
|||
// 1. The origin of this software must not be misrepresented; you must not |
|||
// claim that you wrote the original software. If you use this software |
|||
// in a product, an acknowledgment in the product documentation would be |
|||
// appreciated but is not required. |
|||
// |
|||
// 2. Altered source versions must be plainly marked as such, and must not be |
|||
// misrepresented as being the original software. |
|||
// |
|||
// 3. This notice may not be removed or altered from any source distribution. |
|||
// |
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import "OSSConstants.h" |
|||
|
|||
#pragma GCC diagnostic push |
|||
#pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" |
|||
@interface OSSXMLDictionaryParser : NSObject <NSCopying> |
|||
|
|||
+ (OSSXMLDictionaryParser *)sharedInstance; |
|||
|
|||
@property (nonatomic, assign) BOOL collapseTextNodes; // defaults to YES |
|||
@property (nonatomic, assign) BOOL stripEmptyNodes; // defaults to YES |
|||
@property (nonatomic, assign) BOOL trimWhiteSpace; // defaults to YES |
|||
@property (nonatomic, assign) BOOL alwaysUseArrays; // defaults to NO |
|||
@property (nonatomic, assign) BOOL preserveComments; // defaults to NO |
|||
@property (nonatomic, assign) BOOL wrapRootNode; // defaults to NO |
|||
|
|||
@property (nonatomic, assign) OSSXMLDictionaryAttributesMode attributesMode; |
|||
@property (nonatomic, assign) OSSXMLDictionaryNodeNameMode nodeNameMode; |
|||
|
|||
- (NSDictionary *)dictionaryWithParser:(NSXMLParser *)parser; |
|||
- (NSDictionary *)dictionaryWithData:(NSData *)data; |
|||
- (NSDictionary *)dictionaryWithString:(NSString *)string; |
|||
- (NSDictionary *)dictionaryWithFile:(NSString *)path; |
|||
|
|||
@end |
|||
|
|||
|
|||
@interface NSDictionary (OSSXMLDictionary) |
|||
|
|||
+ (NSDictionary *)oss_dictionaryWithXMLParser:(NSXMLParser *)parser; |
|||
+ (NSDictionary *)oss_dictionaryWithXMLData:(NSData *)data; |
|||
+ (NSDictionary *)oss_dictionaryWithXMLString:(NSString *)string; |
|||
+ (NSDictionary *)oss_dictionaryWithXMLFile:(NSString *)path; |
|||
|
|||
- (NSDictionary *)oss_attributes; |
|||
- (NSDictionary *)oss_childNodes; |
|||
- (NSArray *)oss_comments; |
|||
- (NSString *)oss_nodeName; |
|||
- (NSString *)oss_innerText; |
|||
- (NSString *)oss_innerXML; |
|||
- (NSString *)oss_XMLString; |
|||
|
|||
- (NSArray *)oss_arrayValueForKeyPath:(NSString *)keyPath; |
|||
- (NSString *)oss_stringValueForKeyPath:(NSString *)keyPath; |
|||
- (NSDictionary *)oss_dictionaryValueForKeyPath:(NSString *)keyPath; |
|||
|
|||
@end |
|||
|
|||
|
|||
@interface NSString (OSSXMLDictionary) |
|||
|
|||
- (NSString *)oss_XMLEncodedString; |
|||
|
|||
@end |
|||
|
|||
|
|||
#pragma GCC diagnostic pop |
@ -0,0 +1,6 @@ |
|||
framework module AliyunOSSiOS { |
|||
umbrella header "AliyunOSSiOS.h" |
|||
|
|||
export * |
|||
module * { export * } |
|||
} |
@ -0,0 +1,11 @@ |
|||
#ifndef LIBAOS_CRC_H |
|||
#define LIBAOS_CRC_H |
|||
|
|||
#include <_types/_uintmax_t.h> |
|||
#include <_types/_uint64_t.h> |
|||
#include <stddef.h> |
|||
|
|||
uint64_t aos_crc64(uint64_t crc, void *buf, size_t len); |
|||
uint64_t aos_crc64_combine(uint64_t crc1, uint64_t crc2, uintmax_t len2); |
|||
|
|||
#endif |
After Width: 26 | Height: 40 | Size: 438 B |
After Width: 144 | Height: 144 | Size: 1.4 KiB |
After Width: 144 | Height: 144 | Size: 1.1 KiB |
After Width: 144 | Height: 144 | Size: 1.1 KiB |
After Width: 88 | Height: 88 | Size: 646 B |
After Width: 60 | Height: 60 | Size: 476 B |
@ -0,0 +1,76 @@ |
|||
// |
|||
// AFEAlertView.h |
|||
// BioAuthEngine |
|||
// |
|||
// Created by shuhong.xsh on 16/8/3. |
|||
// Copyright © 2016年 DTF. All rights reserved. |
|||
// 弹出框管理类 |
|||
|
|||
#import <UIKit/UIKit.h> |
|||
|
|||
typedef void (^AFEAlertClickBlock) (); |
|||
|
|||
@interface AFEAlertView : NSObject |
|||
|
|||
@property(atomic, assign) BOOL isAlertViewShow; |
|||
|
|||
+(AFEAlertView*) sharedInstance; |
|||
|
|||
/** |
|||
* 当前alert是否显示 |
|||
*/ |
|||
- (BOOL)isAlertViewShow; |
|||
|
|||
/** |
|||
* 显示alert |
|||
* |
|||
* @param title 标题 |
|||
* @param msg 提示信息 |
|||
* @param firstTitle 第一个按钮提示文案(不可为空) |
|||
* @param secondTitle 第二课提示文案(可为空) |
|||
* @param fblk 第一个按钮点击事件callback(不可为空) |
|||
* @param sblk 第二个按钮点击事件callback(可为空) |
|||
*/ |
|||
- (void)displayAlertViewWithTitle:(NSString *)title |
|||
message:(NSString*)msg |
|||
firstButtonTitle:(NSString *)firstTitle |
|||
secondBittonTitle:(NSString *)secondTitle |
|||
firstCallBack:(AFEAlertClickBlock)fblk |
|||
secondCallBack:(AFEAlertClickBlock)sblk |
|||
withVC:(UIViewController*)parentViewController; |
|||
|
|||
|
|||
/** |
|||
* 活体失败 |
|||
* |
|||
*/ |
|||
- (void)displayLivnessFailAlertView:(NSString *)title |
|||
tips:(NSString*)tip |
|||
cancleTip:(NSString *)cancelTips |
|||
retryTip:(NSString *)retryTips |
|||
withCancelCallBack:(AFEAlertClickBlock)cancel |
|||
retryCallBack:(AFEAlertClickBlock)retry |
|||
withVC:(UIViewController*)parentViewController; |
|||
|
|||
/** |
|||
* 展示浮层提示框 |
|||
* @param superview 父view |
|||
* @param title 主文案,只能显示一行 |
|||
* @param detailTitle 副文案,最多显示两行 |
|||
* @param cancelTips 取消按钮文本 |
|||
* @param retryTips 再试一次按钮文本 |
|||
*/ |
|||
- (void)displayCameraPermissionAlert:(UIViewController *)parentViewController |
|||
title:(NSString *)title |
|||
detailTitle:(NSString *)detailTitle |
|||
cancleTip:(NSString *)cancelTips |
|||
retryTip:(NSString *)retryTips |
|||
cancelCallBack:(AFEAlertClickBlock)cancelCall |
|||
setCallBack:(AFEAlertClickBlock)setCall; |
|||
|
|||
// 判断最顶层视图是否是 APBAlertViewController |
|||
- (BOOL)isAPBAlertViewController; |
|||
|
|||
- (UIViewController *)currentViewController; |
|||
|
|||
@end |
@ -0,0 +1,31 @@ |
|||
// |
|||
// AFECircleProgressBar.h |
|||
// CircularView |
|||
// |
|||
// Created by shouyi.www on 2017/6/26. |
|||
// Copyright © 2017年 shouyi.www. All rights reserved. |
|||
// |
|||
|
|||
#import <UIKit/UIKit.h> |
|||
#import <QuartzCore/QuartzCore.h> |
|||
|
|||
@interface AFECircleProgressBar : CALayer |
|||
|
|||
@property (nonatomic, assign) BOOL clockWise; |
|||
@property (nonatomic, assign) CGFloat animateTime; |
|||
@property (nonatomic, assign) CGFloat endAngle; |
|||
@property (nonatomic, assign) CGFloat progressBarWidth; |
|||
@property (nonatomic, assign) CGFloat maxValue; |
|||
@property (nonatomic, assign) CGFloat minValue; |
|||
@property (nonatomic, assign) CGFloat startAngle; |
|||
@property (nonatomic, copy) NSArray<NSNumber *> *gradientLocation; |
|||
@property (nonatomic, strong) NSMutableArray<UIColor *> *gradientColors; |
|||
@property (nonatomic, assign) CGFloat progress; |
|||
@property (nonatomic, strong) UIColor *progressBarTrackColor; |
|||
|
|||
- (void)setProgress:(CGFloat)percent animation:(BOOL)animated; |
|||
- (void)_updateCircularPath; |
|||
- (void)stopAnimation; |
|||
|
|||
@end |
|||
|
@ -0,0 +1,70 @@ |
|||
// |
|||
// AFECircularView.h |
|||
// BioAuthEngine |
|||
// |
|||
// Created by yukun.tyk on 01/11/2016. |
|||
// Copyright © 2016 DTF. All rights reserved. |
|||
// |
|||
|
|||
#import <UIKit/UIKit.h> |
|||
#import <BioAuthEngine/AFEScanViewDelegate.h> |
|||
#import "DTFTextLayer.h" |
|||
#import "AFECircleProgressBar.h" |
|||
#import "DTFUIElementManager.h" |
|||
#import "DTFUploadWaveLayer.h" |
|||
|
|||
@class AFEStatusBar, AFECircleProgressBar, APBBlurView; |
|||
|
|||
@protocol AFECircularViewProtocol <NSObject> |
|||
|
|||
- (void)onStopScan; |
|||
|
|||
@optional |
|||
- (void)playBtn:(UIButton *)btn; |
|||
|
|||
@end |
|||
|
|||
@interface AFECircularView : UIView<AFEScanViewProtocol> |
|||
|
|||
@property (strong, nonatomic) AFEStatusBar *statusBar; |
|||
@property (nonatomic, strong) CALayer *compactLayer; |
|||
@property (nonatomic, strong) CALayer *cameraLayer; |
|||
@property (nonatomic, assign) float cameraStartY; |
|||
@property (nonatomic, assign) float cameraEndY; |
|||
@property (nonatomic, assign) BOOL isWish; |
|||
@property (nonatomic, strong) DTFTextLayer *bottomTipLayer; |
|||
@property (nonatomic, strong) DTFTextLayer *tipLayer; |
|||
@property (nonatomic, strong) CALayer *tipBackgroundLayer; |
|||
@property (nonatomic, strong) DTFTextLayer *powerByLayer; |
|||
@property (nonatomic, strong) AFECircleProgressBar *progressBar; |
|||
@property (nonatomic, strong) DTFUploadWaveLayer *waveLayer; |
|||
@property (nonatomic, strong) DTFTextLayer * stopScanTipLayer; |
|||
@property (nonatomic, weak) id<AFECircularViewProtocol> aFECirViewDelegate; |
|||
@property (nonatomic, strong) UIButton * stopScanTipButton; |
|||
@property (nonatomic, assign) double widthCoefficient; |
|||
@property (nonatomic, copy) NSDictionary *bottomTipAttrDict; |
|||
@property (nonatomic, copy) NSDictionary *tipAttrDict; |
|||
|
|||
- (void)showPercent:(CGFloat)stage; |
|||
- (void)showtip:(NSString *)tip; |
|||
- (void)showBottomTip:(NSString *)bottomTip; |
|||
- (void)addCameraPreviewLayer:(CALayer *)cameraPreviewLayer; |
|||
- (void)powerByLayerHidden:(BOOL)hidden; |
|||
- (void)setBottomTipHidden:(BOOL)hidden; |
|||
- (void)setScreenRotation:(BOOL)isRotation; |
|||
- (void)setPlayBtnIcon:(NSString *)platformInfo; |
|||
|
|||
- (void)setStopScanButtonHidden:(BOOL)hidden; |
|||
- (void)setMaskImage:(UIImage *)bestImage; |
|||
- (void)startWave; |
|||
- (void)stopWave; |
|||
- (void)setAFECirViewDelegate:(id<AFECircularViewProtocol>)delegate; |
|||
- (void)showBrandTip:(NSString *)brandTip; |
|||
- (void)showStopScanTip:(NSString *)stopScanTip; |
|||
- (void)hideViewList; |
|||
- (void)showViewList; |
|||
|
|||
- (void)_updateView; |
|||
|
|||
@end |
|||
|