添加实名认证
@@ -7,6 +7,14 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
186A52E026FC559200D67B2C /* SecurityGuardSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A52DA26FC559200D67B2C /* SecurityGuardSDK.framework */; };
|
||||||
|
186A52E126FC559200D67B2C /* SGSecurityBody.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A52DB26FC559200D67B2C /* SGSecurityBody.framework */; };
|
||||||
|
186A52E226FC559200D67B2C /* RPSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A52DC26FC559200D67B2C /* RPSDK.framework */; };
|
||||||
|
186A52E326FC559200D67B2C /* RPSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 186A52DD26FC559200D67B2C /* RPSDK.bundle */; };
|
||||||
|
186A52E426FC559200D67B2C /* SGMain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A52DE26FC559200D67B2C /* SGMain.framework */; };
|
||||||
|
186A52E526FC559200D67B2C /* AliyunOSSiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A52DF26FC559200D67B2C /* AliyunOSSiOS.framework */; };
|
||||||
|
186A52E726FC559700D67B2C /* yw_1222_0769.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 186A52E626FC559700D67B2C /* yw_1222_0769.jpg */; };
|
||||||
|
186A531926FC592100D67B2C /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A531826FC591100D67B2C /* libresolv.tbd */; };
|
||||||
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEDB26E89B32002833B2 /* BaseModel.m */; };
|
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEDB26E89B32002833B2 /* BaseModel.m */; };
|
||||||
187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEE026E89BFB002833B2 /* AccountModel.m */; };
|
187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEE026E89BFB002833B2 /* AccountModel.m */; };
|
||||||
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEEE26E89FE8002833B2 /* AccountInfoStorage.m */; };
|
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEEE26E89FE8002833B2 /* AccountInfoStorage.m */; };
|
||||||
@@ -172,6 +180,14 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
186A52DA26FC559200D67B2C /* SecurityGuardSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SecurityGuardSDK.framework; sourceTree = "<group>"; };
|
||||||
|
186A52DB26FC559200D67B2C /* SGSecurityBody.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SGSecurityBody.framework; sourceTree = "<group>"; };
|
||||||
|
186A52DC26FC559200D67B2C /* RPSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RPSDK.framework; sourceTree = "<group>"; };
|
||||||
|
186A52DD26FC559200D67B2C /* RPSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = RPSDK.bundle; sourceTree = "<group>"; };
|
||||||
|
186A52DE26FC559200D67B2C /* SGMain.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SGMain.framework; sourceTree = "<group>"; };
|
||||||
|
186A52DF26FC559200D67B2C /* AliyunOSSiOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AliyunOSSiOS.framework; sourceTree = "<group>"; };
|
||||||
|
186A52E626FC559700D67B2C /* yw_1222_0769.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = yw_1222_0769.jpg; sourceTree = "<group>"; };
|
||||||
|
186A531826FC591100D67B2C /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; };
|
||||||
187EEEDA26E89B32002833B2 /* BaseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseModel.h; sourceTree = "<group>"; };
|
187EEEDA26E89B32002833B2 /* BaseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseModel.h; sourceTree = "<group>"; };
|
||||||
187EEEDB26E89B32002833B2 /* BaseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseModel.m; sourceTree = "<group>"; };
|
187EEEDB26E89B32002833B2 /* BaseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseModel.m; sourceTree = "<group>"; };
|
||||||
187EEEDF26E89BFB002833B2 /* AccountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountModel.h; sourceTree = "<group>"; };
|
187EEEDF26E89BFB002833B2 /* AccountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountModel.h; sourceTree = "<group>"; };
|
||||||
@@ -430,12 +446,18 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
18E7B25B26E8D4460064BC9B /* Flutter.xcframework in Frameworks */,
|
18E7B25B26E8D4460064BC9B /* Flutter.xcframework in Frameworks */,
|
||||||
|
186A52E526FC559200D67B2C /* AliyunOSSiOS.framework in Frameworks */,
|
||||||
73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */,
|
73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */,
|
||||||
18E7B25F26E8D44B0064BC9B /* FMDB.xcframework in Frameworks */,
|
18E7B25F26E8D44B0064BC9B /* FMDB.xcframework in Frameworks */,
|
||||||
|
186A52E426FC559200D67B2C /* SGMain.framework in Frameworks */,
|
||||||
18E7B26126E8D44D0064BC9B /* path_provider.xcframework in Frameworks */,
|
18E7B26126E8D44D0064BC9B /* path_provider.xcframework in Frameworks */,
|
||||||
18E7B26326E8D4500064BC9B /* sqflite.xcframework in Frameworks */,
|
18E7B26326E8D4500064BC9B /* sqflite.xcframework in Frameworks */,
|
||||||
|
186A531926FC592100D67B2C /* libresolv.tbd in Frameworks */,
|
||||||
18E7B26526E8D4510064BC9B /* Toast.xcframework in Frameworks */,
|
18E7B26526E8D4510064BC9B /* Toast.xcframework in Frameworks */,
|
||||||
|
186A52E026FC559200D67B2C /* SecurityGuardSDK.framework in Frameworks */,
|
||||||
18E7B25D26E8D4490064BC9B /* fluttertoast.xcframework in Frameworks */,
|
18E7B25D26E8D4490064BC9B /* fluttertoast.xcframework in Frameworks */,
|
||||||
|
186A52E226FC559200D67B2C /* RPSDK.framework in Frameworks */,
|
||||||
|
186A52E126FC559200D67B2C /* SGSecurityBody.framework in Frameworks */,
|
||||||
18E7B25926E8D4440064BC9B /* flutter_boost.xcframework in Frameworks */,
|
18E7B25926E8D4440064BC9B /* flutter_boost.xcframework in Frameworks */,
|
||||||
18E7B25726E8D4430064BC9B /* App.xcframework in Frameworks */,
|
18E7B25726E8D4430064BC9B /* App.xcframework in Frameworks */,
|
||||||
18E7B25326E8D43D0064BC9B /* FlutterPluginRegistrant.xcframework in Frameworks */,
|
18E7B25326E8D43D0064BC9B /* FlutterPluginRegistrant.xcframework in Frameworks */,
|
||||||
@@ -445,6 +467,28 @@
|
|||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
186A52D826FC551700D67B2C /* Library */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
186A52D926FC558500D67B2C /* RPSDK */,
|
||||||
|
);
|
||||||
|
path = Library;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
186A52D926FC558500D67B2C /* RPSDK */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
186A52DF26FC559200D67B2C /* AliyunOSSiOS.framework */,
|
||||||
|
186A52DC26FC559200D67B2C /* RPSDK.framework */,
|
||||||
|
186A52DA26FC559200D67B2C /* SecurityGuardSDK.framework */,
|
||||||
|
186A52DE26FC559200D67B2C /* SGMain.framework */,
|
||||||
|
186A52DB26FC559200D67B2C /* SGSecurityBody.framework */,
|
||||||
|
186A52DD26FC559200D67B2C /* RPSDK.bundle */,
|
||||||
|
186A52E626FC559700D67B2C /* yw_1222_0769.jpg */,
|
||||||
|
);
|
||||||
|
path = RPSDK;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
187EEEA926E62679002833B2 /* Api */ = {
|
187EEEA926E62679002833B2 /* Api */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -475,6 +519,7 @@
|
|||||||
189DD52B26DE255300AB55B1 /* xplan-ios */ = {
|
189DD52B26DE255300AB55B1 /* xplan-ios */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
186A52D826FC551700D67B2C /* Library */,
|
||||||
E81C279926EB64BA0031E639 /* Global */,
|
E81C279926EB64BA0031E639 /* Global */,
|
||||||
189DD56B26DF5B0900AB55B1 /* Base */,
|
189DD56B26DF5B0900AB55B1 /* Base */,
|
||||||
189DD56126DE45F800AB55B1 /* Main */,
|
189DD56126DE45F800AB55B1 /* Main */,
|
||||||
@@ -790,6 +835,7 @@
|
|||||||
BFB922F5D81845AC32D1E1ED /* Frameworks */ = {
|
BFB922F5D81845AC32D1E1ED /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
186A531826FC591100D67B2C /* libresolv.tbd */,
|
||||||
CACF623970097D653132D69A /* Pods_xplan_ios.framework */,
|
CACF623970097D653132D69A /* Pods_xplan_ios.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
@@ -1139,6 +1185,8 @@
|
|||||||
files = (
|
files = (
|
||||||
189DD53C26DE255600AB55B1 /* LaunchScreen.storyboard in Resources */,
|
189DD53C26DE255600AB55B1 /* LaunchScreen.storyboard in Resources */,
|
||||||
189DD53926DE255600AB55B1 /* Assets.xcassets in Resources */,
|
189DD53926DE255600AB55B1 /* Assets.xcassets in Resources */,
|
||||||
|
186A52E726FC559700D67B2C /* yw_1222_0769.jpg in Resources */,
|
||||||
|
186A52E326FC559200D67B2C /* RPSDK.bundle in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -1466,6 +1514,10 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
DEVELOPMENT_TEAM = 48UCG35Q9W;
|
DEVELOPMENT_TEAM = 48UCG35Q9W;
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(PROJECT_DIR)/xplan-ios/Library/RPSDK",
|
||||||
|
);
|
||||||
GCC_PREFIX_HEADER = "xplan-ios/Base/Base.pch";
|
GCC_PREFIX_HEADER = "xplan-ios/Base/Base.pch";
|
||||||
INFOPLIST_FILE = "xplan-ios/Info.plist";
|
INFOPLIST_FILE = "xplan-ios/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
@@ -1488,6 +1540,10 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
DEVELOPMENT_TEAM = 48UCG35Q9W;
|
DEVELOPMENT_TEAM = 48UCG35Q9W;
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(PROJECT_DIR)/xplan-ios/Library/RPSDK",
|
||||||
|
);
|
||||||
GCC_PREFIX_HEADER = "xplan-ios/Base/Base.pch";
|
GCC_PREFIX_HEADER = "xplan-ios/Base/Base.pch";
|
||||||
INFOPLIST_FILE = "xplan-ios/Info.plist";
|
INFOPLIST_FILE = "xplan-ios/Info.plist";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
|
BIN
xplan-ios/Library/RPSDK/AliyunOSSiOS.framework/AliyunOSSiOS
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// 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 "OSSCompat.h"
|
||||||
|
#import "OSSXMLDictionary.h"
|
||||||
|
#import "OSSIPv6Adapter.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,33 @@
|
|||||||
|
//
|
||||||
|
// 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 *range;
|
||||||
|
@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,445 @@
|
|||||||
|
//
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
#pragma mark restful-api
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: GetService
|
||||||
|
Gets all the buckets of the current user
|
||||||
|
Notes:
|
||||||
|
1. STS is not supported yet in this call.
|
||||||
|
2. When all buckets are returned, the xml in response body does not have nodes of Prefix, Marker, MaxKeys, IsTruncated and NextMarker.
|
||||||
|
If there're remaining buckets to return, the xml will have these nodes. The nextMarker is the value of marker in the next call.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)getService:(OSSGetServiceRequest *)request;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface OSSClient (Bucket)
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: PutBucket
|
||||||
|
Creates a bucket--it does not support anonymous access. By default, the datacenter used is oss-cn-hangzhou.
|
||||||
|
Callers could explicitly specify the datacenter for the bucket to optimize the performance and cost or meet the regulation requirement.
|
||||||
|
Notes:
|
||||||
|
1. STS is not supported yet.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)createBucket:(OSSCreateBucketRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: DeleteBucket
|
||||||
|
Deletes a bucket.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)deleteBucket:(OSSDeleteBucketRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: GetBucket
|
||||||
|
Lists all objects in a bucket. It could be specified with filters such as prefix, marker, delimeter and max-keys.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)getBucket:(OSSGetBucketRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: GetBucketInfo
|
||||||
|
Gets the {@link Bucket}'s basic information as well as its ACL.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)getBucketInfo:(OSSGetBucketInfoRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: GetBucketACL
|
||||||
|
Gets the bucket ACL.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)getBucketACL:(OSSGetBucketACLRequest *)request;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface OSSClient (Object)
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: HeadObject
|
||||||
|
Gets the object's metadata information. The object's content is not returned.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)headObject:(OSSHeadObjectRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: GetObject
|
||||||
|
Gets the whole object (includes content). It requires caller have read permission on the object.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)getObject:(OSSGetObjectRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: GetObjectACL
|
||||||
|
get the acl of an object.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)getObjectACL:(OSSGetObjectACLRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: PutObject
|
||||||
|
Uploads a file.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)putObject:(OSSPutObjectRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the object's ACL. Right now an object has three access permissions: private, public-ready, public-read-write.
|
||||||
|
The operation specifies the x-oss-object-acl header in the put request. The caller must be the owner of the object.
|
||||||
|
If succeeds, it returns HTTP status 200; otherwise it returns related error code and error messages.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)putObjectACL:(OSSPutObjectACLRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: AppendObject
|
||||||
|
Appends data to an existing or non-existing object. The object created by this operation is appendable.
|
||||||
|
As a comparison, the object created by Put Object is normal (non-appendable).
|
||||||
|
*/
|
||||||
|
- (OSSTask *)appendObject:(OSSAppendObjectRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Appends data to an existing or non-existing object on the OSS server.
|
||||||
|
* The object created by this operation is appendable.
|
||||||
|
* @request request
|
||||||
|
* @crc64ecma crc64ecma
|
||||||
|
* if object has been stored on OSS server, you need to invoke headObject
|
||||||
|
* api get object's crc64ecma,then use this api to append data to the
|
||||||
|
* object.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)appendObject:(OSSAppendObjectRequest *)request withCrc64ecma:(nullable NSString *)crc64ecma;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: copyObject
|
||||||
|
Copies an existing object to another one.The operation sends a PUT request with x-oss-copy-source header to specify the source object.
|
||||||
|
OSS server side will detect and copy the object. If it succeeds, the new object's metadata information will be returned.
|
||||||
|
The operation applies for files less than 1GB. For big files, use UploadPartCopy RESTFul API.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)copyObject:(OSSCopyObjectRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Batch deletes the specified files under a specific bucket. If the files
|
||||||
|
* are non-exist, the operation will still return successful.
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* A OSSDeleteMultipleObjectsRequest instance which specifies the
|
||||||
|
* bucket and file keys to delete.
|
||||||
|
* @return A OSSTask with result of OSSDeleteMultipleObjectsResult instance which specifies each
|
||||||
|
* file's result in normal mode or only failed deletions in quite
|
||||||
|
* mode. By default it's quite mode.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)deleteMultipleObjects:(OSSDeleteMultipleObjectsRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: DeleteObject
|
||||||
|
Deletes an object
|
||||||
|
*/
|
||||||
|
- (OSSTask *)deleteObject:(OSSDeleteObjectRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a symbol link to a target file under the bucket---this is not
|
||||||
|
* supported for archive class bucket.
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* A OSSPutSymlinkRequest instance that specifies the
|
||||||
|
* bucket name, symlink name.
|
||||||
|
* @return An instance of OSSTask. On successful execution, `task.result` will
|
||||||
|
* contain an instance of `OSSPutSymlinkResult`,otherwise will contain
|
||||||
|
* an instance of NSError.
|
||||||
|
*
|
||||||
|
* for more information,please refer to https://help.aliyun.com/document_detail/45126.html
|
||||||
|
*/
|
||||||
|
- (OSSTask *)putSymlink:(OSSPutSymlinkRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the symlink information for the given symlink name.
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* A OSSGetSymlinkRequest instance which specifies the bucket
|
||||||
|
* name and symlink name.
|
||||||
|
* @return An instance of OSSTask. On successful execution, `task.result` will
|
||||||
|
* contain an instance of `OSSGetSymlinkResult`,otherwise will contain
|
||||||
|
* an instance of NSError.
|
||||||
|
*
|
||||||
|
* for more information,please refer to https://help.aliyun.com/document_detail/45146.html
|
||||||
|
*/
|
||||||
|
- (OSSTask *)getSymlink:(OSSGetSymlinkRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restores the object of archive storage. The function is not applicable to
|
||||||
|
* Normal or IA storage. The restoreObject() needs to be called prior to
|
||||||
|
* calling getObject() on an archive object.
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* A container for the necessary parameters to execute the RestoreObject
|
||||||
|
* service method.
|
||||||
|
*
|
||||||
|
* @return An instance of OSSTask. On successful execution, `task.result` will
|
||||||
|
* contain an instance of `OSSRestoreObjectResult`,otherwise will contain
|
||||||
|
* an instance of NSError.
|
||||||
|
*
|
||||||
|
* for more information,please refer to https://help.aliyun.com/document_detail/52930.html
|
||||||
|
*/
|
||||||
|
- (OSSTask *)restoreObject:(OSSRestoreObjectRequest *)request;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface OSSClient (MultipartUpload)
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: InitiateMultipartUpload
|
||||||
|
Initiates a multipart upload to get a upload Id. It's needed before starting uploading parts data.
|
||||||
|
The upload Id is used for subsequential operations such as aborting the upload, querying the uploaded parts, etc.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)multipartUploadInit:(OSSInitMultipartUploadRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: UploadPart
|
||||||
|
After the multipart upload is initiated, this API could be called to upload the data to the target file with the upload Id.
|
||||||
|
Every uploaded part has a unique id called part number, which ranges from 1 to 10,000.
|
||||||
|
For a given upload Id, the part number identifies the specific range of the data in the whole file.
|
||||||
|
If the same part number is used for another upload, the existing data will be overwritten by the new upload.
|
||||||
|
Except the last part, all other part's minimal size is 100KB.
|
||||||
|
But no minimal size requirement on the last part.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)uploadPart:(OSSUploadPartRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: CompleteMultipartUpload
|
||||||
|
This API is to complete the multipart upload after all parts data have been uploaded.
|
||||||
|
It must be provided with a valid part list (each part has the part number and ETag).
|
||||||
|
OSS will validate every part and then complete the multipart upload.
|
||||||
|
If any part is invalid (e.g. the part is updated by another part upload), this API will fail.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)completeMultipartUpload:(OSSCompleteMultipartUploadRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: ListParts
|
||||||
|
Lists all uploaded parts of the specified upload id.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)listParts:(OSSListPartsRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: ListMultipartUploads
|
||||||
|
Lists all multipart uploads with the specified bucket.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)listMultipartUploads:(OSSListMultipartUploadsRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The corresponding RESTFul API: AbortMultipartUpload
|
||||||
|
Aborts the multipart upload by the specified upload Id.
|
||||||
|
Once the multipart upload is aborted by this API, all parts data will be deleted and the upload Id is invalid anymore.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)abortMultipartUpload:(OSSAbortMultipartUploadRequest *)request;
|
||||||
|
|
||||||
|
- (OSSTask *)abortResumableMultipartUpload:(OSSResumableUploadRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Multipart upload API
|
||||||
|
*/
|
||||||
|
- (OSSTask *)multipartUpload:(OSSMultipartUploadRequest *)request;
|
||||||
|
/**
|
||||||
|
TODOTODO
|
||||||
|
Resumable upload API
|
||||||
|
This API wraps the multipart upload and also enables resuming upload by reading/writing the checkpoint data.
|
||||||
|
For a new file, multipartUploadInit() needs to be called first to get the upload Id. Then use this upload id to call this API to upload the data.
|
||||||
|
If the upload fails, checks the error messages:
|
||||||
|
If it's a recoverable error, then call this API again with the same upload Id to retry. The uploaded data will not be uploaded again.
|
||||||
|
Otherwise then you may need to recreates a new upload Id and call this method again.
|
||||||
|
Check out demo for the detail.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)resumableUpload:(OSSResumableUploadRequest *)request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* multipart upload sequentially in order,support resume upload
|
||||||
|
*/
|
||||||
|
- (OSSTask *)sequentialMultipartUpload:(OSSResumableUploadRequest *)request;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface OSSClient (PresignURL)
|
||||||
|
|
||||||
|
/**
|
||||||
|
Generates a signed URL for the object and anyone has this URL will get the GET permission on the object.
|
||||||
|
@bucketName object's bucket name
|
||||||
|
@objectKey Object name
|
||||||
|
@interval Expiration time in seconds. The URL could be specified with the expiration time to limit the access window on the object.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
|
||||||
|
withObjectKey:(NSString *)objectKey
|
||||||
|
withExpirationInterval:(NSTimeInterval)interval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Generates a signed URL for the object and anyone has this URL will get the specified permission on the object.
|
||||||
|
@bucketName object's bucket name
|
||||||
|
@objectKey Object name
|
||||||
|
@interval Expiration time in seconds. The URL could be specified with the expiration time to limit the access window on the object.
|
||||||
|
@parameter it could specify allowed HTTP methods
|
||||||
|
*/
|
||||||
|
- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
|
||||||
|
withObjectKey:(NSString *)objectKey
|
||||||
|
withExpirationInterval:(NSTimeInterval)interval
|
||||||
|
withParameters:(NSDictionary *)parameters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Generates a signed URL for the object and anyone has this URL will get the specified permission on the object. currently only support get and head method.
|
||||||
|
@bucketName object's bucket name
|
||||||
|
@objectKey Object name
|
||||||
|
@httpMethod http method.currently only support get and head.
|
||||||
|
@interval Expiration time in seconds. The URL could be specified with the expiration time to limit the access window on the object.
|
||||||
|
@parameter it could specify allowed HTTP methods
|
||||||
|
*/
|
||||||
|
- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName
|
||||||
|
withObjectKey:(NSString *)objectKey
|
||||||
|
httpMethod:(NSString *)method
|
||||||
|
withExpirationInterval:(NSTimeInterval)interval
|
||||||
|
withParameters:(NSDictionary *)parameters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
If the object's ACL is public read or public read-write, use this API to generate a signed url for sharing.
|
||||||
|
@bucketName Object's bucket name
|
||||||
|
@objectKey Object name
|
||||||
|
*/
|
||||||
|
- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName
|
||||||
|
withObjectKey:(NSString *)objectKey;
|
||||||
|
|
||||||
|
/** TODOTODO
|
||||||
|
If the object's ACL is public read or public read-write, use this API to generate a signed url for sharing.
|
||||||
|
@bucketName Object's bucket name
|
||||||
|
@objectKey Object name
|
||||||
|
@parameter the request parameters.
|
||||||
|
*/
|
||||||
|
- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName
|
||||||
|
withObjectKey:(NSString *)objectKey
|
||||||
|
withParameters:(NSDictionary *)parameters;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface OSSClient (ImageService)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* image persist action
|
||||||
|
* https://help.aliyun.com/document_detail/55811.html
|
||||||
|
*/
|
||||||
|
- (OSSTask *)imageActionPersist:(OSSImagePersistRequest *)request;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface OSSClient (Utilities)
|
||||||
|
|
||||||
|
/**
|
||||||
|
Checks if the object exists
|
||||||
|
@bucketName Object's bucket name
|
||||||
|
@objectKey Object name
|
||||||
|
|
||||||
|
return YES Object exists
|
||||||
|
return NO && *error = nil Object does not exist
|
||||||
|
return NO && *error != nil Error occured.
|
||||||
|
*/
|
||||||
|
- (BOOL)doesObjectExistInBucket:(NSString *)bucketName
|
||||||
|
objectKey:(NSString *)objectKey
|
||||||
|
error:(const NSError **)error;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface OSSClient (Callback)
|
||||||
|
|
||||||
|
- (OSSTask *)triggerCallBack:(OSSCallBackRequest *)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,85 @@
|
|||||||
|
//
|
||||||
|
// OSSCompat.h
|
||||||
|
// oss_ios_sdk_new
|
||||||
|
//
|
||||||
|
// Created by zhouzhuo on 9/10/15.
|
||||||
|
// Copyright (c) 2015 aliyun.com. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "OSSService.h"
|
||||||
|
|
||||||
|
@class OSSCancellationTokenSource;
|
||||||
|
|
||||||
|
typedef OSSCancellationTokenSource OSSTaskHandler;
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface OSSClient (Compat)
|
||||||
|
|
||||||
|
/**
|
||||||
|
The old version's upload API.
|
||||||
|
Please use putObject instead.
|
||||||
|
*/
|
||||||
|
- (OSSTaskHandler *)uploadData:(NSData *)data
|
||||||
|
withContentType:(NSString *)contentType
|
||||||
|
withObjectMeta:(NSDictionary *)meta
|
||||||
|
toBucketName:(NSString *)bucketName
|
||||||
|
toObjectKey:(NSString *)objectKey
|
||||||
|
onCompleted:(void(^)(BOOL, NSError *))onCompleted
|
||||||
|
onProgress:(void(^)(float progress))onProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The old version's download API.
|
||||||
|
Please use getObject instead.
|
||||||
|
*/
|
||||||
|
- (OSSTaskHandler *)downloadToDataFromBucket:(NSString *)bucketName
|
||||||
|
objectKey:(NSString *)objectKey
|
||||||
|
onCompleted:(void(^)(NSData *, NSError *))onCompleted
|
||||||
|
onProgress:(void(^)(float progress))onProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The old version's upload API.
|
||||||
|
Please use putObject instead.
|
||||||
|
*/
|
||||||
|
- (OSSTaskHandler *)uploadFile:(NSString *)filePath
|
||||||
|
withContentType:(NSString *)contentType
|
||||||
|
withObjectMeta:(NSDictionary *)meta
|
||||||
|
toBucketName:(NSString *)bucketName
|
||||||
|
toObjectKey:(NSString *)objectKey
|
||||||
|
onCompleted:(void(^)(BOOL, NSError *))onCompleted
|
||||||
|
onProgress:(void(^)(float progress))onProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The old version's download API.
|
||||||
|
Please use getObject instead.
|
||||||
|
*/
|
||||||
|
- (OSSTaskHandler *)downloadToFileFromBucket:(NSString *)bucketName
|
||||||
|
objectKey:(NSString *)objectKey
|
||||||
|
toFile:(NSString *)filePath
|
||||||
|
onCompleted:(void(^)(BOOL, NSError *))onCompleted
|
||||||
|
onProgress:(void(^)(float progress))onProgress;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
The old version's upload API with resumable upload support.
|
||||||
|
Please use resumableUpload instead.
|
||||||
|
*/
|
||||||
|
- (OSSTaskHandler *)resumableUploadFile:(NSString *)filePath
|
||||||
|
withContentType:(NSString *)contentType
|
||||||
|
withObjectMeta:(NSDictionary *)meta
|
||||||
|
toBucketName:(NSString *)bucketName
|
||||||
|
toObjectKey:(NSString *)objectKey
|
||||||
|
onCompleted:(void(^)(BOOL, NSError *))onCompleted
|
||||||
|
onProgress:(void(^)(float progress))onProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The old version's delete API.
|
||||||
|
Please use deleteObject instead.
|
||||||
|
*/
|
||||||
|
- (void)deleteObjectInBucket:(NSString *)bucketName
|
||||||
|
objectKey:(NSString *)objectKey
|
||||||
|
onCompleted:(void(^)(BOOL, NSError *))onCompleted;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,129 @@
|
|||||||
|
//
|
||||||
|
// 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) {
|
||||||
|
OSSOperationTypeGetService,
|
||||||
|
OSSOperationTypeCreateBucket,
|
||||||
|
OSSOperationTypeDeleteBucket,
|
||||||
|
OSSOperationTypeGetBucket,
|
||||||
|
OSSOperationTypeGetBucketInfo,
|
||||||
|
OSSOperationTypeGetBucketACL,
|
||||||
|
OSSOperationTypeHeadObject,
|
||||||
|
OSSOperationTypeGetObject,
|
||||||
|
OSSOperationTypeGetObjectACL,
|
||||||
|
OSSOperationTypePutObject,
|
||||||
|
OSSOperationTypePutObjectACL,
|
||||||
|
OSSOperationTypeAppendObject,
|
||||||
|
OSSOperationTypeDeleteObject,
|
||||||
|
OSSOperationTypeDeleteMultipleObjects,
|
||||||
|
OSSOperationTypeCopyObject,
|
||||||
|
OSSOperationTypeInitMultipartUpload,
|
||||||
|
OSSOperationTypeUploadPart,
|
||||||
|
OSSOperationTypeCompleteMultipartUpload,
|
||||||
|
OSSOperationTypeAbortMultipartUpload,
|
||||||
|
OSSOperationTypeListMultipart,
|
||||||
|
OSSOperationTypeListMultipartUploads,
|
||||||
|
OSSOperationTypeTriggerCallBack,
|
||||||
|
OSSOperationTypeImagePersist,
|
||||||
|
OSSOperationTypeRestoreObject,
|
||||||
|
OSSOperationTypePutSymlink,
|
||||||
|
OSSOperationTypeGetSymlink,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.8"
|
||||||
|
|
||||||
|
#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,31 @@
|
|||||||
|
//
|
||||||
|
// OSSDeleteMultipleObjectsRequest.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/1/26.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "OSSRequest.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface OSSDeleteMultipleObjectsRequest : OSSRequest
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *bucketName;
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSArray<NSString *> *keys;
|
||||||
|
|
||||||
|
/**
|
||||||
|
invalid value is @"url"
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy, nullable) NSString *encodingType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
whether to show verbose result,the default value is YES.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL quiet;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// OSSDeleteMultipleObjectsResult.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/1/26.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSResult.h"
|
||||||
|
|
||||||
|
@interface OSSDeleteMultipleObjectsResult : OSSResult
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSArray<NSString *> *deletedObjects;
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *encodingType;
|
||||||
|
|
||||||
|
@end
|
@@ -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,15 @@
|
|||||||
|
//
|
||||||
|
// OSSGetBucketInfoRequest.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/7/10.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSRequest.h"
|
||||||
|
|
||||||
|
@interface OSSGetBucketInfoRequest : OSSRequest
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *bucketName;
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,57 @@
|
|||||||
|
//
|
||||||
|
// OSSGetBucketInfoResult.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/7/10.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSResult.h"
|
||||||
|
|
||||||
|
@interface OSSBucketOwner : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *userName;
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *userId;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface OSSAccessControlList : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *grant;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@interface OSSGetBucketInfoResult : OSSResult
|
||||||
|
|
||||||
|
/// Created date.
|
||||||
|
@property (nonatomic, copy) NSString *creationDate;
|
||||||
|
|
||||||
|
/// Bucket name.
|
||||||
|
@property (nonatomic, copy) NSString *bucketName;
|
||||||
|
|
||||||
|
/// Bucket location.
|
||||||
|
@property (nonatomic, copy) NSString *location;
|
||||||
|
|
||||||
|
/// Storage class (Standard, IA, Archive)
|
||||||
|
@property (nonatomic, copy) NSString *storageClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Internal endpoint. It could be accessed within AliCloud under the same
|
||||||
|
location.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *intranetEndpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
External endpoint.It could be accessed from anywhere.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *extranetEndpoint;
|
||||||
|
|
||||||
|
/// Bucket owner.
|
||||||
|
@property (nonatomic, strong) OSSBucketOwner *owner;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) OSSAccessControlList *acl;
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// OSSGetObjectACLRequest.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/1/26.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSRequest.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@interface OSSGetObjectACLRequest : OSSRequest
|
||||||
|
|
||||||
|
/**
|
||||||
|
the bucket's name which object stored
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *bucketName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
the name of object
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *objectName;
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// OSSGetObjectACLResult.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/1/26.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSResult.h"
|
||||||
|
|
||||||
|
@interface OSSGetObjectACLResult : OSSResult
|
||||||
|
|
||||||
|
/**
|
||||||
|
the ACL of object,valid values: @"private",@"public-read",@"public-read-write".
|
||||||
|
if object's ACL inherit from bucket,it will return @"default".
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *grant;
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// OSSGetSymlinkRequest.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/8/1.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSRequest.h"
|
||||||
|
|
||||||
|
@interface OSSGetSymlinkRequest : OSSRequest
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *bucketName;
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *objectKey;
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// OSSGetSymlinkResult.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/8/1.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSResult.h"
|
||||||
|
|
||||||
|
@interface OSSGetSymlinkResult : OSSResult
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) NSURL *downloadingFileURL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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,16 @@
|
|||||||
|
//
|
||||||
|
// OSSHttpdns.h
|
||||||
|
// AliyunOSSiOS
|
||||||
|
//
|
||||||
|
// Created by zhouzhuo on 5/1/16.
|
||||||
|
// Copyright © 2016 zhouzhuo. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface OSSHttpdns : NSObject
|
||||||
|
|
||||||
|
+ (instancetype)sharedInstance;
|
||||||
|
|
||||||
|
- (NSString *)asynGetIpByHost:(NSString *)host;
|
||||||
|
@end
|
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2000-2015 Apple Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||||
|
*
|
||||||
|
* This file contains Original Code and/or Modifications of Original Code
|
||||||
|
* as defined in and that are subject to the Apple Public Source License
|
||||||
|
* Version 2.0 (the 'License'). You may not use this file except in
|
||||||
|
* compliance with the License. The rights granted to you under the License
|
||||||
|
* may not be used to create, or enable the creation or redistribution of,
|
||||||
|
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||||
|
* circumvent, violate, or enable the circumvention or violation of, any
|
||||||
|
* terms of an Apple operating system software license agreement.
|
||||||
|
*
|
||||||
|
* Please obtain a copy of the License at
|
||||||
|
* https://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||||
|
*
|
||||||
|
* The Original Code and all software distributed under the License are
|
||||||
|
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||||
|
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||||
|
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||||
|
* Please see the License for the specific language governing rights and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1980, 1986, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @(#)route.h 8.3 (Berkeley) 4/19/94
|
||||||
|
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef AlicloudIPv6Adapter_h
|
||||||
|
#define AlicloudIPv6Adapter_h
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface OSSIPv6Adapter : NSObject
|
||||||
|
|
||||||
|
+ (instancetype)getInstance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if it's a IPv6-only network. If it's true, it's IPv6-only.
|
||||||
|
*
|
||||||
|
* @return return YES for IPv6-only network,otherWise return NO
|
||||||
|
*/
|
||||||
|
- (BOOL)isIPv6OnlyNetwork;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Refresh the IPV6-only check
|
||||||
|
*
|
||||||
|
* @return return YES for IPv6-only network,otherWise return NO
|
||||||
|
*/
|
||||||
|
- (BOOL)reResolveIPv6OnlyStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adapts the IPv4 address into IPv6 format under IPv6-only network.
|
||||||
|
* For example:
|
||||||
|
42.156.220.114 -> 64:ff9b::2a9c:dc72
|
||||||
|
* @param addr
|
||||||
|
* ip address
|
||||||
|
*
|
||||||
|
* @return return an IPv6 address
|
||||||
|
*/
|
||||||
|
- (NSString *)handleIpv4Address:(NSString *)addr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if it's an IPv4 address.
|
||||||
|
*
|
||||||
|
* @return return YES while addr is an IPv4 address,otherwise return NO
|
||||||
|
*/
|
||||||
|
- (BOOL)isIPv4Address:(NSString *)addr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if it's an IPv6 address
|
||||||
|
*
|
||||||
|
* @return return YES while addr is an IPv6 address,otherwise return NO
|
||||||
|
*/
|
||||||
|
- (BOOL)isIPv6Address:(NSString *)addr;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* OSSIPv6Adapter_h */
|
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// OSSIPv6PrefixResolver.h
|
||||||
|
//
|
||||||
|
// Created by lingkun on 16/5/16.
|
||||||
|
// Edit by zhouzhuo on 16/5/22
|
||||||
|
// Copyright © 2016 Ali. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef AlicloudIPv6PrefixResolver_h
|
||||||
|
#define AlicloudIPv6PrefixResolver_h
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface OSSIPv6PrefixResolver : NSObject
|
||||||
|
|
||||||
|
+ (instancetype)getInstance;
|
||||||
|
|
||||||
|
- (void)updateIPv6Prefix;
|
||||||
|
|
||||||
|
- (NSString *)convertIPv4toIPv6:(NSString *)ipv4;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* OSSIPv6PrefixResolver_h */
|
@@ -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__)
|
||||||
|
|
1498
xplan-ios/Library/RPSDK/AliyunOSSiOS.framework/Headers/OSSModel.h
Normal file
@@ -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,76 @@
|
|||||||
|
//
|
||||||
|
// 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) 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,25 @@
|
|||||||
|
//
|
||||||
|
// OSSPutSymlinkRequest.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/8/1.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSRequest.h"
|
||||||
|
|
||||||
|
@interface OSSPutSymlinkRequest : OSSRequest
|
||||||
|
|
||||||
|
/* bucket name */
|
||||||
|
@property (nonatomic, copy) NSString *bucketName;
|
||||||
|
|
||||||
|
/* object name */
|
||||||
|
@property (nonatomic, copy) NSString *objectKey;
|
||||||
|
|
||||||
|
/* target object name */
|
||||||
|
@property (nonatomic, copy) NSString *targetObjectName;
|
||||||
|
|
||||||
|
/* meta info in request header fields */
|
||||||
|
@property (nonatomic, copy) NSDictionary *objectMeta;
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// OSSPutSymlinkResult.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/8/1.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSResult.h"
|
||||||
|
|
||||||
|
@interface OSSPutSymlinkResult : OSSResult
|
||||||
|
|
||||||
|
@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,15 @@
|
|||||||
|
//
|
||||||
|
// OSSReachabilityManager.h
|
||||||
|
//
|
||||||
|
// Created by 亿刀 on 14-1-9.
|
||||||
|
// Edited by junmo on 15-5-16
|
||||||
|
// Copyright (c) 2014 Twitter. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface OSSReachabilityManager : NSObject
|
||||||
|
|
||||||
|
+ (OSSReachabilityManager *)shareInstance;
|
||||||
|
|
||||||
|
@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,17 @@
|
|||||||
|
//
|
||||||
|
// OSSRestoreObjectRequest.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/8/1.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSRequest.h"
|
||||||
|
|
||||||
|
@interface OSSRestoreObjectRequest : OSSRequest
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *bucketName;
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *objectKey;
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// OSSRestoreObjectResult.h
|
||||||
|
// AliyunOSSSDK
|
||||||
|
//
|
||||||
|
// Created by huaixu on 2018/8/1.
|
||||||
|
// Copyright © 2018年 aliyun. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OSSResult.h"
|
||||||
|
|
||||||
|
@interface OSSRestoreObjectResult : OSSResult
|
||||||
|
|
||||||
|
@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,40 @@
|
|||||||
|
//
|
||||||
|
// 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 "OSSGetObjectACLRequest.h"
|
||||||
|
#import "OSSGetObjectACLResult.h"
|
||||||
|
#import "OSSDeleteMultipleObjectsRequest.h"
|
||||||
|
#import "OSSDeleteMultipleObjectsResult.h"
|
||||||
|
#import "OSSGetBucketInfoRequest.h"
|
||||||
|
#import "OSSGetBucketInfoResult.h"
|
||||||
|
#import "OSSPutSymlinkRequest.h"
|
||||||
|
#import "OSSPutSymlinkResult.h"
|
||||||
|
#import "OSSGetSymlinkRequest.h"
|
||||||
|
#import "OSSGetSymlinkResult.h"
|
||||||
|
#import "OSSRestoreObjectRequest.h"
|
||||||
|
#import "OSSRestoreObjectResult.h"
|
||||||
|
|
||||||
|
#import "OSSClient.h"
|
||||||
|
#import "OSSModel.h"
|
||||||
|
#import "OSSUtil.h"
|
||||||
|
#import "OSSLog.h"
|
||||||
|
|
||||||
|
#import "OSSBolts.h"
|
281
xplan-ios/Library/RPSDK/AliyunOSSiOS.framework/Headers/OSSTask.h
Normal file
@@ -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,76 @@
|
|||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
+ (NSString *)calBase64Sha1WithData:(NSString *)data withSecret:(NSString *)key;
|
||||||
|
+ (NSString *)calBase64WithData:(uint8_t *)data;
|
||||||
|
+ (NSString *)encodeURL:(NSString *)url;
|
||||||
|
+ (NSData *)constructHttpBodyFromPartInfos:(NSArray *)partInfos;
|
||||||
|
+ (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;
|
||||||
|
+ (NSString *)getIpByHost:(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 * }
|
||||||
|
}
|
11
xplan-ios/Library/RPSDK/AliyunOSSiOS.framework/PrivateHeaders/aos_crc64.h
Executable file
@@ -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
|
103
xplan-ios/Library/RPSDK/RPSDK.bundle/RPSkin.json
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"global": {
|
||||||
|
"mainButton": {
|
||||||
|
"backgroundColor": "#00FFFFFF",
|
||||||
|
"backgroundImage": "face_confirm_button@2x.png",
|
||||||
|
"textColor": "#FFFFFF",
|
||||||
|
"fontSize": 32,
|
||||||
|
"textPadding": {
|
||||||
|
"left": 0,
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
"bottom": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"native": {
|
||||||
|
"global": {
|
||||||
|
"alertDialog": {
|
||||||
|
"positiveText": {
|
||||||
|
"textColor": "#60A3FC",
|
||||||
|
"fontSize": 32
|
||||||
|
},
|
||||||
|
"negativeText": {
|
||||||
|
"textColor": "#999999",
|
||||||
|
"fontSize": 32
|
||||||
|
},
|
||||||
|
"titleText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 32
|
||||||
|
},
|
||||||
|
"messageText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 28
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"navigator": {
|
||||||
|
"closeImageView": {
|
||||||
|
"src": "face_close_btn@2x.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"guidePage": {
|
||||||
|
"titleText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 40
|
||||||
|
},
|
||||||
|
"messageText": {
|
||||||
|
"textColor": "#8C94A8",
|
||||||
|
"fontSize": 24
|
||||||
|
},
|
||||||
|
"markMessageText": {
|
||||||
|
"textColor": "#4178FF",
|
||||||
|
"fontSize": 40
|
||||||
|
},
|
||||||
|
"actionTipText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 36
|
||||||
|
},
|
||||||
|
"privacyTipText": {
|
||||||
|
"textColor": "#999999",
|
||||||
|
"fontSize": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"detectPage": {
|
||||||
|
"actionTipText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 40
|
||||||
|
},
|
||||||
|
"messageText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 32
|
||||||
|
},
|
||||||
|
"markMessageText": {
|
||||||
|
"textColor": "#4178FF",
|
||||||
|
"fontSize": 32
|
||||||
|
},
|
||||||
|
"detectAnimation": {
|
||||||
|
"warningColor": "#F6493F",
|
||||||
|
"loadingColor": "#188FFF"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resultPage": {
|
||||||
|
"titleText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 40
|
||||||
|
},
|
||||||
|
"messageText": {
|
||||||
|
"textColor": "#333333",
|
||||||
|
"fontSize": 30
|
||||||
|
},
|
||||||
|
"markMessageText": {
|
||||||
|
"textColor": "#FF0000",
|
||||||
|
"fontSize": 30
|
||||||
|
},
|
||||||
|
"promptFailImageView": {
|
||||||
|
"src": "face_result_icon_fail@2x.png"
|
||||||
|
},
|
||||||
|
"promptSucceedImageView": {
|
||||||
|
"src": "face_result_icon_ok@2x.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 501 B |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/faceContinuity.bin
Normal file
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/fdmodel.bin
Normal file
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 582 B |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/icon/photo_camera_do@2x.png
Normal file
After Width: | Height: | Size: 722 B |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/icon/photo_flashBtn@2x.png
Normal file
After Width: | Height: | Size: 313 B |
After Width: | Height: | Size: 5.0 KiB |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/icon/web_backBtn@2x.png
Normal file
After Width: | Height: | Size: 501 B |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/images/face_guide_blink.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/images/face_guide_mouth.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/images/face_guide_pitch.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/images/face_guide_yaw.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/ldClassifier.bin
Normal file
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/ldmodel.bin
Normal file
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/sounds/face_blink.mp3
Normal file
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/sounds/face_ding.mp3
Normal file
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/sounds/face_open_mouth.mp3
Normal file
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/sounds/face_pitch_up.mp3
Normal file
BIN
xplan-ios/Library/RPSDK/RPSDK.bundle/upperBodyPic.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
@@ -0,0 +1,110 @@
|
|||||||
|
//
|
||||||
|
// RPConfiguration.h
|
||||||
|
// ALRealIdentity
|
||||||
|
//
|
||||||
|
// Created by Hank Zhang on 2020/2/20.
|
||||||
|
// Copyright © 2020 Alibaba. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
NS_ENUM(NSInteger, RPTransitionStyle)
|
||||||
|
实人认证页面弹出风格
|
||||||
|
*/
|
||||||
|
typedef NS_ENUM(NSInteger, RPTransitionStyle) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
present
|
||||||
|
*/
|
||||||
|
RPTransitionStylePresent = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
push
|
||||||
|
*/
|
||||||
|
RPTransitionStylePush,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
`RPViewControllerHandler` 活体检测视图控制器回调。
|
||||||
|
|
||||||
|
@param viewController 活体检测视图控制器。
|
||||||
|
*/
|
||||||
|
typedef void (^RPViewControllerHandler)(UIViewController *viewController);
|
||||||
|
|
||||||
|
/**
|
||||||
|
`RPConfiguration` 实人认证配置
|
||||||
|
*/
|
||||||
|
NS_SWIFT_NAME(RPConfiguration)
|
||||||
|
@interface RPConfiguration : NSObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
自定义UI path
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *customUIPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
是否默认关闭声音,默认开启声音。
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL isMutedByDefault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
是否在主动退出时弹窗确认,默认打开弹窗。
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL shouldAlertOnExit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
实人认证结束后是否恢复 webview 设置,默认恢复。
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL shouldRestoreWebview;
|
||||||
|
|
||||||
|
/**
|
||||||
|
是否显示错误结果页
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL showErrorResultPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
自定义活体检测页面展示方法。
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy, nullable) RPViewControllerHandler presentHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
自定义活体检测页面消失方法。
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy, nullable) RPViewControllerHandler dismissHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
页面弹出方式,默认为 present。
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) RPTransitionStyle transitionStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
是否开启页面弹窗动画,默认开启动画。
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL isTransitionAnimationEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
来源,一般来说接入方用不到, 不设置即可
|
||||||
|
*/
|
||||||
|
@property (nonatomic, strong, nullable) NSString *fromSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
实人认证默认配置
|
||||||
|
|
||||||
|
@return 实人认证配置
|
||||||
|
*/
|
||||||
|
+ (instancetype)configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
请使用 [RPConfiguration configuration] 生成配置。
|
||||||
|
|
||||||
|
@return 实人认证配置
|
||||||
|
*/
|
||||||
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
111
xplan-ios/Library/RPSDK/RPSDK.framework/Headers/RPResult.h
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
//
|
||||||
|
// RPResult.h
|
||||||
|
// ALRealIdentity
|
||||||
|
//
|
||||||
|
// Created by Hank Zhang on 2019/10/14.
|
||||||
|
// Copyright © 2019 Alibaba. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@class RPResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
NS_ENUM(NSInteger, RPPhase)
|
||||||
|
实人认证阶段
|
||||||
|
*/
|
||||||
|
typedef NS_ENUM(NSInteger, RPPhase) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
活体检测即将开始
|
||||||
|
*/
|
||||||
|
RPPhaseBiometricsWillStart,
|
||||||
|
|
||||||
|
/**
|
||||||
|
活体检测已经开始
|
||||||
|
*/
|
||||||
|
RPPhaseBiometricsDidStart,
|
||||||
|
|
||||||
|
/**
|
||||||
|
活体检测成功
|
||||||
|
*/
|
||||||
|
RPPhaseBiometricsDidSucceed,
|
||||||
|
|
||||||
|
/**
|
||||||
|
活体检测失败
|
||||||
|
*/
|
||||||
|
RPPhaseBiometricsDidFail,
|
||||||
|
|
||||||
|
/**
|
||||||
|
提交服务端认证开始
|
||||||
|
*/
|
||||||
|
RPPhaseVerificationDidStart,
|
||||||
|
|
||||||
|
/**
|
||||||
|
提交服务端认证开始
|
||||||
|
*/
|
||||||
|
RPPhaseVerificationDidFinish,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
NS_ENUM(NSInteger, RPState)
|
||||||
|
实人认证结果状态
|
||||||
|
*/
|
||||||
|
typedef NS_ENUM(NSInteger, RPState) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
未认证
|
||||||
|
*/
|
||||||
|
RPStateNotVerify = -1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
认证通过
|
||||||
|
*/
|
||||||
|
RPStatePass = 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
认证失败
|
||||||
|
*/
|
||||||
|
RPStateFail = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
`RPProgress` 实人认证过程回调。
|
||||||
|
|
||||||
|
@param phase 实人认证阶段。
|
||||||
|
*/
|
||||||
|
typedef void (^RPProgress)(RPPhase phase);
|
||||||
|
|
||||||
|
/**
|
||||||
|
`RPCompletion` 实人认证结果回调。
|
||||||
|
|
||||||
|
@param result 实人认证结果。
|
||||||
|
*/
|
||||||
|
typedef void (^RPCompletion)(RPResult *result);
|
||||||
|
|
||||||
|
/**
|
||||||
|
`RPResult` 实人认证结果
|
||||||
|
*/
|
||||||
|
NS_SWIFT_NAME(RPResult)
|
||||||
|
@interface RPResult : NSObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
实人认证结果状态
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) RPState state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
实人认证结果错误代码,可选值
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy, nullable) NSString *errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
实人认证结果信息,可选值
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy, nullable) NSString *message;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,74 @@
|
|||||||
|
//
|
||||||
|
// RPSDK+Deprecated.h
|
||||||
|
// ALRealIdentity
|
||||||
|
//
|
||||||
|
// Created by Hank Zhang on 2019/12/5.
|
||||||
|
// Copyright © 2019 Alibaba. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "RPSDKInterface.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
#pragma mark - 已废弃,预计于 2020.5.10 删除,请尽快迁移至新接口
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, RPSDKEnv) {
|
||||||
|
RPSDKEnvDaily,
|
||||||
|
RPSDKEnvPre,
|
||||||
|
RPSDKEnvOnline
|
||||||
|
} DEPRECATED_ATTRIBUTE;
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, RPVerifyState) {
|
||||||
|
RPVerifyStateNotVerify = -1,
|
||||||
|
RPVerifyStatePass = 1,
|
||||||
|
RPVerifyStateFail = 2,
|
||||||
|
} DEPRECATED_ATTRIBUTE;
|
||||||
|
|
||||||
|
typedef void (^RPCompletedHandler)(RPVerifyState verifyState, NSString * _Nullable code) DEPRECATED_ATTRIBUTE;
|
||||||
|
|
||||||
|
@interface RPSDK (Deprecated)
|
||||||
|
|
||||||
|
@property (class, nonatomic, assign) BOOL isPresentationAnimationEnabled
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("请替换为 RPConfiguration 的 isTransitionAnimationEnabled 属性。");
|
||||||
|
|
||||||
|
+ (void)initialize:(RPSDKEnv)env
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("RPSDK 不再需要初始化操作,请删除此方法调用。");
|
||||||
|
|
||||||
|
+ (void)initialize
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("RPSDK 不再需要初始化操作,请删除此方法调用。");
|
||||||
|
|
||||||
|
+ (void)initializeHasWV:(RPSDKEnv)env
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("RPSDK 不再需要初始化操作,请删除此方法调用。");
|
||||||
|
|
||||||
|
+ (void)setAppName:(NSString*)appName
|
||||||
|
appVersion:(NSString*)appVersion
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("RPSDK 不再需要设置应用名和版本,请删除此方法调用。");
|
||||||
|
|
||||||
|
+ (void)start:(NSString *)verifyToken
|
||||||
|
rpCompleted:(RPCompletedHandler)rpCompleted
|
||||||
|
withVC:(UINavigationController *)nav
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("请替换为 [RPSDK startWithVerifyToken:viewController:completion:] 方法。");
|
||||||
|
|
||||||
|
+ (void)startVerifyByNative:(NSString*)verifyToken
|
||||||
|
rpCompleted:(RPCompletedHandler)rpCompleted
|
||||||
|
withVC:(UIViewController*)nav
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("请替换为 [RPSDK startByNativeWithVerifyToken:viewController:completion:] 方法。");
|
||||||
|
|
||||||
|
+ (void)startVerifyByURL:(NSString *)urlString
|
||||||
|
rpCompleted:(RPCompletedHandler)rpCompleted
|
||||||
|
withVC:(UINavigationController *)nav
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("请替换为 [RPSDK startByURL:viewController:completion:] 方法。");
|
||||||
|
|
||||||
|
+ (void)setLocalAccelerate:(bool)open
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("RPSDK 不提供本地加速,请删除此方法调用。");
|
||||||
|
|
||||||
|
+ (NSString *)getSubCode
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("请从 RPResult 查看结果,此方法将返回空字符串,请删除此方法调用。");
|
||||||
|
|
||||||
|
+ (NSString *)getSubMessage
|
||||||
|
DEPRECATED_MSG_ATTRIBUTE("请从 RPResult 查看结果,此方法将返回空字符串,请删除此方法调用。");
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
16
xplan-ios/Library/RPSDK/RPSDK.framework/Headers/RPSDK.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// RPSDK.h
|
||||||
|
// ALRealIdentity
|
||||||
|
//
|
||||||
|
// Created by Hank Zhang on 2019/10/10.
|
||||||
|
// Copyright © 2019 Alibaba. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <RPSDK/RPSDKInterface.h>
|
||||||
|
#import <RPSDK/RPSDK+Deprecated.h>
|
||||||
|
|
||||||
|
// RPSDK 版本号
|
||||||
|
#define RPSDKVersionString @"4.10.0"
|
||||||
|
|
||||||
|
// RPSDK 发布时间
|
||||||
|
#define RPSDKReleaseDateString @"20210520"
|
107
xplan-ios/Library/RPSDK/RPSDK.framework/Headers/RPSDKInterface.h
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
//
|
||||||
|
// RPSDKInterface.h
|
||||||
|
// ALRealIdentity
|
||||||
|
//
|
||||||
|
// Created by Hank Zhang on 2019/11/1.
|
||||||
|
// Copyright © 2019 Alibaba. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#import "RPConfiguration.h"
|
||||||
|
#import "RPResult.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
`RPSDK` 实人认证 SDK 接口。
|
||||||
|
*/
|
||||||
|
NS_SWIFT_NAME(RPSDK)
|
||||||
|
@interface RPSDK : NSObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
实人认证初始化,建议应用启动时调用。
|
||||||
|
*/
|
||||||
|
+ (void)setup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
使用默认配置开始实人认证,适用于 H5 + Native 的认证方案。
|
||||||
|
使用 UI 默认配置。
|
||||||
|
|
||||||
|
@param verifyToken 实人认证流程的唯一标识,一般从接入方自己的服务端获取,有效时间 30 分钟。
|
||||||
|
@param viewController 调用实人认证的视图控制器。
|
||||||
|
@param completion 实人认证结果回调。
|
||||||
|
*/
|
||||||
|
+ (void)startWithVerifyToken:(NSString *)verifyToken
|
||||||
|
viewController:(UIViewController *)viewController
|
||||||
|
completion:(RPCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
开始实人认证,适用于纯 Native 的认证方案。
|
||||||
|
只支持纯人脸的登陆 / 解锁 / 认证功能,纯 H5 方案不支持此方法。
|
||||||
|
使用 UI 默认配置。
|
||||||
|
|
||||||
|
@param verifyToken 实人认证流程的唯一标识,一般从接入方自己的服务端获取,有效时间 30 分钟。
|
||||||
|
@param viewController 调用实人认证的视图控制器。
|
||||||
|
@param completion 实人认证结果回调。
|
||||||
|
*/
|
||||||
|
+ (void)startByNativeWithVerifyToken:(NSString *)verifyToken
|
||||||
|
viewController:(UIViewController *)viewController
|
||||||
|
completion:(RPCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
开始实人认证,使用指定的 H5 地址作为认证入口。
|
||||||
|
使用 UI 默认配置。
|
||||||
|
|
||||||
|
@param url 实人认证流程的地址。
|
||||||
|
@param viewController 调用实人认证的视图控制器。
|
||||||
|
@param completion 实人认证结果回调。
|
||||||
|
*/
|
||||||
|
+ (void)startByURL:(NSString *)url
|
||||||
|
viewController:(UIViewController *)viewController
|
||||||
|
completion:(RPCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
开始实人认证,适用于 H5 + Native 的认证方案。
|
||||||
|
|
||||||
|
@param verifyToken 实人认证流程的唯一标识,一般从接入方自己的服务端获取,有效时间 30 分钟。
|
||||||
|
@param viewController 调用实人认证的视图控制器。
|
||||||
|
@param configuration 实人认证配置。
|
||||||
|
@param completion 实人认证结果回调。
|
||||||
|
*/
|
||||||
|
+ (void)startWithVerifyToken:(NSString *)verifyToken
|
||||||
|
viewController:(UIViewController *)viewController
|
||||||
|
configuration:(RPConfiguration *)configuration
|
||||||
|
completion:(RPCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
开始实人认证,适用于纯 Native 的认证方案。
|
||||||
|
只支持纯人脸的登陆 / 解锁 / 认证功能,纯 H5 方案不支持此方法。
|
||||||
|
|
||||||
|
@param verifyToken 实人认证流程的唯一标识,一般从接入方自己的服务端获取,有效时间 30 分钟。
|
||||||
|
@param viewController 调用实人认证的视图控制器。
|
||||||
|
@param configuration 实人认证配置。
|
||||||
|
@param progress 实人认证过程回调。
|
||||||
|
@param completion 实人认证结果回调。
|
||||||
|
*/
|
||||||
|
+ (void)startByNativeWithVerifyToken:(NSString *)verifyToken
|
||||||
|
viewController:(UIViewController *)viewController
|
||||||
|
configuration:(RPConfiguration *)configuration
|
||||||
|
progress:(RPProgress _Nullable)progress
|
||||||
|
completion:(RPCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
开始实人认证,使用指定的 H5 地址作为认证入口。
|
||||||
|
|
||||||
|
@param url 实人认证流程的地址。
|
||||||
|
@param viewController 调用实人认证的视图控制器。
|
||||||
|
@param completion 实人认证结果回调。
|
||||||
|
*/
|
||||||
|
+ (void)startByURL:(NSString *)url
|
||||||
|
viewController:(UIViewController *)viewController
|
||||||
|
configuration:(RPConfiguration *)configuration
|
||||||
|
completion:(RPCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
BIN
xplan-ios/Library/RPSDK/RPSDK.framework/Info.plist
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
framework module RPSDK {
|
||||||
|
umbrella header "RPSDK.h"
|
||||||
|
|
||||||
|
export *
|
||||||
|
module * { export * }
|
||||||
|
}
|
BIN
xplan-ios/Library/RPSDK/RPSDK.framework/RPSDK
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenAtlasEncrypt.h
|
||||||
|
// SecurityGuardWhiteBox
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/9.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenAtlasEncrypt_h
|
||||||
|
#define ISecurityGuardOpenAtlasEncrypt_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenAtlasEncrypt/IOpenAtlasEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenAtlasEncrypt/IOpenAtlasEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenAtlasEncrypt <NSObject, IOpenAtlasEncryptComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenAtlasEncrypt_h */
|
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenDataCollection.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/10.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenDataCollection_h
|
||||||
|
#define ISecurityGuardOpenDataCollection_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenDataCollection/IOpenDataCollectionComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenDataCollection/IOpenDataCollectionComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenDataCollection <NSObject, IOpenDataCollectionComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenDataCollection_h */
|
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenDynamicDataEncrypt.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/10.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenDynamicDataEncrypt_h
|
||||||
|
#define ISecurityGuardOpenDynamicDataEncrypt_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenDynamicDataEncrypt/IOpenDynamicDataEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenDynamicDataEncrypt/IOpenDynamicDataEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenDynamicDataEncrypt <NSObject, IOpenDynamicDataEncryptComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenDynamicDataEncrypt_h */
|
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenDynamicDataStore.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/10.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenDynamicDataStore_h
|
||||||
|
#define ISecurityGuardOpenDynamicDataStore_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenDynamicDataStore/IOpenDynamicDataStoreComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenDynamicDataStore/IOpenDynamicDataStoreComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenDynamicDataStore <NSObject, IOpenDynamicDataStoreComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenDynamicDataStore_h */
|
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenInitialize.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/12.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenInitialize_h
|
||||||
|
#define ISecurityGuardOpenInitialize_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenInitialize/IOpenInitializeComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenInitialize/IOpenInitializeComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenInitialize <NSObject, IOpenInitializeComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenInitialize_h */
|
@@ -0,0 +1,155 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenLiteVMService.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/12/17.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenLiteVMService_h
|
||||||
|
#define ISecurityGuardOpenLiteVMService_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@class LiteVMInstance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
LVM参数封装类,目前支持 char、unsigned char、int、unsigned int、long、
|
||||||
|
unsigned long、long long、unsigned long long、NSString、NSData类型的入参
|
||||||
|
*/
|
||||||
|
@interface LiteVMParameterWrapper : NSObject
|
||||||
|
|
||||||
|
+ (LiteVMParameterWrapper*) createCharParameter: (char) value;
|
||||||
|
+ (LiteVMParameterWrapper*) createUnsignedCharParameter: (unsigned char) value;
|
||||||
|
|
||||||
|
+ (LiteVMParameterWrapper*) createIntParameter: (int) value;
|
||||||
|
+ (LiteVMParameterWrapper*) createUnsignedIntParameter: (unsigned int) value;
|
||||||
|
|
||||||
|
+ (LiteVMParameterWrapper*) createLongParameter: (long) value;
|
||||||
|
+ (LiteVMParameterWrapper*) createUnsignedLongParameter: (unsigned long) value;
|
||||||
|
|
||||||
|
+ (LiteVMParameterWrapper*) createLongLongParameter: (long long) value;
|
||||||
|
+ (LiteVMParameterWrapper*) createUnsignedLongLongParameter: (unsigned long long) value;
|
||||||
|
|
||||||
|
+ (LiteVMParameterWrapper*) createStringParameter: (NSString*) value;
|
||||||
|
+ (LiteVMParameterWrapper*) createDataParameter: (NSData*) value;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
LVM接口封装类
|
||||||
|
*/
|
||||||
|
@protocol ISecurityGuardOpenLiteVMService <NSObject, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
/**
|
||||||
|
创建LVM实例
|
||||||
|
|
||||||
|
@param authCode 保镖为业务方分配的标识id,与bianry一一对应
|
||||||
|
@param bizId 为binary code分配的name (一个binary中可以有多个binarycode,通过biz id来索引)
|
||||||
|
@param binary 存储待执行的bianry code的二进制
|
||||||
|
@param symbolArray binary code依赖符号的数组,可为空
|
||||||
|
@param error 错误
|
||||||
|
@return 根据bizId和binaryCode生成的vm实例
|
||||||
|
*/
|
||||||
|
- (LiteVMInstance*) createLiteVMInstanceWithAuthCode: (NSString*) authCode
|
||||||
|
bizId: (NSString*) bizId
|
||||||
|
binary: (NSData*) binary
|
||||||
|
requiredSymbol: (NSArray*) symbolArray
|
||||||
|
error: (NSError**) error;
|
||||||
|
|
||||||
|
- (LiteVMInstance*) createLiteVMInstanceWithAuthCodeAndSymbols: (NSString*) authCode
|
||||||
|
bizId: (NSString*) bizId
|
||||||
|
binary: (NSData*) binary
|
||||||
|
requiredSymbol: (void*) symbolArray
|
||||||
|
error: (NSError**) error;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
让LVM实例重新加载binary code
|
||||||
|
|
||||||
|
@param instance LVM实例
|
||||||
|
@param binaryCode 需要重新加载的binary code
|
||||||
|
@param error 错误
|
||||||
|
*/
|
||||||
|
- (void) reloadLiteVMInstance: (LiteVMInstance*) instance
|
||||||
|
binary: (NSData*) binaryCode
|
||||||
|
error: (NSError**) error;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
销毁LVM实例
|
||||||
|
|
||||||
|
@param instance LVM实例
|
||||||
|
@param error 错误
|
||||||
|
*/
|
||||||
|
- (void) destroyLiteVMInstance: (LiteVMInstance*) instance
|
||||||
|
error: (NSError**) error;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
调用无返回值的LVM函数
|
||||||
|
|
||||||
|
@param instance LVM实例
|
||||||
|
@param index 要调用的函数在binary code中的index (一个binary code中可以有多个函数,以0为开始的下标来标识)
|
||||||
|
@param param 参数数组
|
||||||
|
@param error 错误
|
||||||
|
*/
|
||||||
|
- (void) callLiteVMVoidMethod: (LiteVMInstance*) instance
|
||||||
|
funtionIndex: (int) index
|
||||||
|
paramArray: (NSArray<LiteVMParameterWrapper*>*) param
|
||||||
|
error: (NSError**) error;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
调用返回值为long(整型)的LVM函数
|
||||||
|
|
||||||
|
@param instance LVM实例
|
||||||
|
@param index 要调用的函数在binary code中的index (一个binary code中可以有多个函数,以0为开始的下标来标识)
|
||||||
|
@param param 参数数组
|
||||||
|
@param error 错误
|
||||||
|
@return long型结果
|
||||||
|
*/
|
||||||
|
- (long) callLiteVMLongMethod: (LiteVMInstance*) instance
|
||||||
|
funtionIndex: (int) index
|
||||||
|
paramArray: (NSArray<LiteVMParameterWrapper*>*) param
|
||||||
|
error: (NSError**) error;
|
||||||
|
/**
|
||||||
|
调用返回值为NSString类型的LVM函数
|
||||||
|
|
||||||
|
@param instance LVM实例
|
||||||
|
@param index 要调用的函数在binary code中的index (一个binary code中可以有多个函数,以0为开始的下标来标识)
|
||||||
|
@param param 参数数组
|
||||||
|
@param error 错误
|
||||||
|
@return NSString返回值
|
||||||
|
*/
|
||||||
|
- (NSString*) callLiteVMStringMethod: (LiteVMInstance*) instance
|
||||||
|
funtionIndex: (int) index
|
||||||
|
paramArray: (NSArray<LiteVMParameterWrapper*>*) param
|
||||||
|
error: (NSError**) error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
调用返回值为NSData类型的LVM函数
|
||||||
|
|
||||||
|
@param instance LVM实例
|
||||||
|
@param index 要调用的函数在binary code中的index (一个binary code中可以有多个函数,以0为开始的下标来标识)
|
||||||
|
@param param 参数数组
|
||||||
|
@param error 错误
|
||||||
|
@return NSData返回值
|
||||||
|
*/
|
||||||
|
- (NSData*) callLiteVMByteMethod: (LiteVMInstance*) instance
|
||||||
|
funtionIndex: (int) index
|
||||||
|
paramArray: (NSArray<LiteVMParameterWrapper*>*) param
|
||||||
|
error: (NSError**) error;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenLiteVMService_h */
|
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenOpenSDK.h
|
||||||
|
// SecurityGuardTAE
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/9.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenOpenSDK_h
|
||||||
|
#define ISecurityGuardOpenOpenSDK_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenOpenSDK/IOpenOpenSDKComponent.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#import <SecurityGuardSDK/Open/OpenOpenSDK/IOpenOpenSDKComponent.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenOpenSDK <NSObject, IOpenOpenSDKComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenOpenSDK_h */
|
@@ -0,0 +1,109 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenSafeToken.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by chenkong on 15/12/17.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenSafeToken_h
|
||||||
|
#define ISecurityGuardOpenSafeToken_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenSafeToken <NSObject, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储token
|
||||||
|
* @param value 存储的value
|
||||||
|
* @param key token值对应的key
|
||||||
|
* @return 存储操作的结果
|
||||||
|
*/
|
||||||
|
- (BOOL) saveToken: (NSString*) value
|
||||||
|
forKey: (NSString*) key
|
||||||
|
additional: (NSString*) additional
|
||||||
|
flag: (int) flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测token是否存在
|
||||||
|
* @param key string值对应的key
|
||||||
|
* @return 检测token是否存在的结果
|
||||||
|
*/
|
||||||
|
- (BOOL) isTokenExist: (NSString*) key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除本地存储的token
|
||||||
|
* @param key 存储值要使用的key
|
||||||
|
* @return 存储操作结果
|
||||||
|
*/
|
||||||
|
- (void) removeToken: (NSString*) key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用token加密数据
|
||||||
|
* @param key token值对应的key
|
||||||
|
* @param plaintext 待加密的byte数组
|
||||||
|
* @param flag 扩展参数,缺省为0
|
||||||
|
* @return 返回加密结果,加密失败返回nil
|
||||||
|
*/
|
||||||
|
- (NSData*) encryptWithToken: (NSString*) key
|
||||||
|
inputData: (NSData*) plaintext
|
||||||
|
flag: (int) flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用token解密数据
|
||||||
|
* @param key token值对应的key
|
||||||
|
* @param encrypted 待解密的数据
|
||||||
|
* @param flag 扩展参数,缺省为0
|
||||||
|
* @return 返回解密结果,解密失败返回nil
|
||||||
|
*/
|
||||||
|
- (NSData*) decryptWithToken: (NSString*) key
|
||||||
|
inputData: (NSData*) encrypted
|
||||||
|
flag: (int) flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用token对数据进行签名
|
||||||
|
* @param key token值对应的key
|
||||||
|
* @param data 待签名的byte数组
|
||||||
|
* @param flag 扩展参数,缺省为0
|
||||||
|
* @return 返回签名结果,签名失败返回nil
|
||||||
|
*/
|
||||||
|
- (NSString*) signWithToken: (NSString*) key
|
||||||
|
inputData: (NSData*) data
|
||||||
|
flag: (int) flag;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Otp验证码,目前只适用于支付宝钱包
|
||||||
|
* @param key token值对应的key
|
||||||
|
* @param flag 对应不同的算法和配置,目前只支持0,即支付宝的otp算法
|
||||||
|
* @param strings 传入具体的参数。根据支付宝OTP的要求,需要传入:servertime、codetype和可扩展的extinfo参数。其中,servertime 需要是大于0的长整形,codetype只允许“0”和“1”,extinfo可为空
|
||||||
|
* @param byteArgs 扩展字段,暂未使用
|
||||||
|
* @return 返回长度为18或者16的byte数组,失败返回nil
|
||||||
|
*/
|
||||||
|
- (NSData*) getOtp: (NSString*) key
|
||||||
|
flag: (int) flag
|
||||||
|
strings: (NSArray*) strings
|
||||||
|
byteArgs: (NSData*) byteArgs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Otp验证码,目前只适用于支付宝钱包
|
||||||
|
* @param key token值对应的key
|
||||||
|
* @param flag 对应不同的算法和配置,目前只支持0,即支付宝的otp算法
|
||||||
|
* @param strings 传入具体的参数。根据支付宝OTP的要求,需要传入:servertime、codetype和可扩展的extinfo参数。其中,servertime 需要是大于0的长整形,codetype只允许“0”和“1”,extinfo可为空
|
||||||
|
* @param byteArgs 扩展字段,暂未使用
|
||||||
|
* @return 返回长度为18或者16的byte数组,失败返回nil
|
||||||
|
*/
|
||||||
|
- (NSData*) getOtp: (NSString*) key
|
||||||
|
flag: (int) flag
|
||||||
|
strings: (NSArray*) strings
|
||||||
|
byteArgs: (NSData*) byteArgs
|
||||||
|
authCode: (NSString*) authCode;
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenSafeToken_h */
|
@@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenSecureSignature.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/10.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenSecureSignature_h
|
||||||
|
#define ISecurityGuardOpenSecureSignature_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenSecureSignature/IOpenSecureSignatureComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenSecureSignature/OpenSecureSignatureDefine.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenSecurityGuardParamContext.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenSecureSignature/IOpenSecureSignatureComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/OpenSecureSignature/OpenSecureSignatureDefine.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#import <SecurityGuardSDK/Open/OpenSecurityGuardParamContext.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenSecureSignature <NSObject>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenSecureSignature_h */
|
@@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenStaticDataEncrypt.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/10.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenStaticDataEncrypt_h
|
||||||
|
#define ISecurityGuardOpenStaticDataEncrypt_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenStaticDataEncrypt/IOpenStaticDataEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenStaticDataEncrypt/OpenStaticDataEncryptDefine.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenStaticDataEncrypt/IOpenStaticDataEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/OpenStaticDataEncrypt/OpenStaticDataEncryptDefine.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenStaticDataEncrypt <NSObject, IOpenStaticDataEncryptComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenStaticDataEncrypt_h */
|
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenStaticDataStore.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/7.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenStaticDataStore_h
|
||||||
|
#define ISecurityGuardOpenStaticDataStore_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenStaticDataStore/IOpenStaticDataStoreComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenStaticDataStore/OpenStaticDataStoreDefine.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenStaticDataStore/IOpenStaticDataStoreComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/OpenStaticDataStore/OpenStaticDataStoreDefine.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenStaticDataStore <NSObject, IOpenStaticDataStoreComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenStaticDataStore_h */
|
@@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenStaticKeyEncrypt.h
|
||||||
|
// SecurityGuardTAE
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/9.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenStaticKeyEncrypt_h
|
||||||
|
#define ISecurityGuardOpenStaticKeyEncrypt_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenStaticKeyEncrypt/IOpenStaticKeyEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenStaticKeyEncrypt/OpenStaticKeyEncryptDefine.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#import <SecurityGuardSDK/Open/OpenStaticKeyEncrypt/IOpenStaticKeyEncryptComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/OpenStaticKeyEncrypt/OpenStaticKeyEncryptDefine.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenStaticKeyEncrypt <NSObject, IOpenStaticKeyEncryptComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenStaticKeyEncrypt_h */
|
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// ISecurityGuardOpenUMID.h
|
||||||
|
// SecurityGuardMain
|
||||||
|
//
|
||||||
|
// Created by lifengzhong on 15/11/10.
|
||||||
|
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef ISecurityGuardOpenUMID_h
|
||||||
|
#define ISecurityGuardOpenUMID_h
|
||||||
|
|
||||||
|
#if TARGET_OS_WATCH
|
||||||
|
#import <SecurityGuardSDKWatch/Open/OpenUMID/IOpenUMIDComponent.h>
|
||||||
|
#import <SecurityGuardSDKWatch/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#else
|
||||||
|
#import <SecurityGuardSDK/Open/OpenUMID/IOpenUMIDComponent.h>
|
||||||
|
#import <SecurityGuardSDK/Open/IOpenSecurityGuardPlugin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@protocol ISecurityGuardOpenUMID <NSObject, IOpenUMIDComponent, IOpenSecurityGuardPluginInterface>
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ISecurityGuardOpenUMID_h */
|