Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions QiniuSDK.xcodeproj/xcshareddata/xcschemes/QiniuSDK_Mac.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -28,16 +28,6 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DF2CDE0919DAC05500CE01FB"
BuildableName = "QiniuSDK_MacTests.xctest"
BlueprintName = "QiniuSDK_MacTests"
ReferencedContainer = "container:QiniuSDK.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down Expand Up @@ -66,13 +56,6 @@
ReferencedContainer = "container:QiniuSDK.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
2 changes: 2 additions & 0 deletions QiniuSDK/Common/QNALAssetFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "QNFileDelegate.h"

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
#if !TARGET_OS_MACCATALYST
@class ALAsset;
@interface QNALAssetFile : NSObject <QNFileDelegate>

Expand All @@ -26,3 +27,4 @@
error:(NSError *__autoreleasing *)error;
@end
#endif
#endif
3 changes: 2 additions & 1 deletion QiniuSDK/Common/QNALAssetFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#import "QNALAssetFile.h"

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#if !TARGET_OS_MACCATALYST
#import <AssetsLibrary/AssetsLibrary.h>

#import "QNResponseInfo.h"

@interface QNALAssetFile ()
Expand Down Expand Up @@ -84,3 +84,4 @@ - (int64_t)size {
}
@end
#endif
#endif
4 changes: 3 additions & 1 deletion QiniuSDK/Common/QNPHAssetFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

#import "QNFileDelegate.h"

API_AVAILABLE_BEGIN(macos(10.13), ios(9.1), tvos(10))
API_AVAILABLE_BEGIN(ios(9.1))
API_UNAVAILABLE_BEGIN(macos, tvos)

@class PHAsset;
@interface QNPHAssetFile : NSObject <QNFileDelegate>
Expand All @@ -27,3 +28,4 @@ API_AVAILABLE_BEGIN(macos(10.13), ios(9.1), tvos(10))
@end

API_AVAILABLE_END
API_UNAVAILABLE_END
4 changes: 4 additions & 0 deletions QiniuSDK/Common/QNPHAssetFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import <Photos/Photos.h>
#import "QNResponseInfo.h"

#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 90100)

@interface QNPHAssetFile ()

@property (nonatomic) PHAsset *phAsset;
Expand Down Expand Up @@ -180,3 +182,5 @@ - (NSString *)getInfo {
}

@end

#endif
4 changes: 3 additions & 1 deletion QiniuSDK/Common/QNPHAssetResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

#import "QNFileDelegate.h"

API_AVAILABLE_BEGIN(macos(10.15), ios(9), tvos(10))
API_AVAILABLE_BEGIN(ios(9))
API_UNAVAILABLE_BEGIN(macos, tvos)

@class PHAssetResource;

Expand All @@ -30,3 +31,4 @@ API_AVAILABLE_BEGIN(macos(10.15), ios(9), tvos(10))
@end

API_AVAILABLE_END
API_UNAVAILABLE_END
4 changes: 4 additions & 0 deletions QiniuSDK/Common/QNPHAssetResource.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import <Photos/Photos.h>
#import "QNResponseInfo.h"

#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000)

enum {
kAMASSETMETADATA_PENDINGREADS = 1,
kAMASSETMETADATA_ALLFINISHED = 0
Expand Down Expand Up @@ -167,3 +169,5 @@ - (NSData *)fetchDataFromAsset:(PHAssetResource *)videoResource error:(NSError *
}

@end

#endif
13 changes: 9 additions & 4 deletions QiniuSDK/Storage/QNUploadManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
@class QNResponseInfo;
@class QNUploadOption;
@class QNConfiguration;
@class ALAsset;
@class PHAsset;
@class PHAssetResource;

#if !TARGET_OS_MACCATALYST
@class ALAsset;
#endif

/**
* 上传完成后的回调函数
*
Expand Down Expand Up @@ -106,6 +109,7 @@ typedef void (^QNUpCompletionHandler)(QNResponseInfo *info, NSString *key, NSDic
complete:(QNUpCompletionHandler)completionHandler
option:(QNUploadOption *)option;

#if !TARGET_OS_MACCATALYST
/**
* 上传ALAsset文件
*
Expand All @@ -119,7 +123,8 @@ typedef void (^QNUpCompletionHandler)(QNResponseInfo *info, NSString *key, NSDic
key:(NSString *)key
token:(NSString *)token
complete:(QNUpCompletionHandler)completionHandler
option:(QNUploadOption *)option;
option:(QNUploadOption *)option API_UNAVAILABLE(macos, tvos);
#endif

/**
* 上传PHAsset文件(IOS8 andLater)
Expand All @@ -134,7 +139,7 @@ typedef void (^QNUpCompletionHandler)(QNResponseInfo *info, NSString *key, NSDic
key:(NSString *)key
token:(NSString *)token
complete:(QNUpCompletionHandler)completionHandler
option:(QNUploadOption *)option API_AVAILABLE(macos(10.15), ios(9.1), tvos(10));
option:(QNUploadOption *)option API_AVAILABLE(ios(9.1)) API_UNAVAILABLE(macos, tvos);

/**
* 上传PHAssetResource文件(IOS9.1 andLater)
Expand All @@ -150,6 +155,6 @@ typedef void (^QNUpCompletionHandler)(QNResponseInfo *info, NSString *key, NSDic
key:(NSString *)key
token:(NSString *)token
complete:(QNUpCompletionHandler)completionHandler
option:(QNUploadOption *)option API_AVAILABLE(macos(10.15), ios(9), tvos(10));
option:(QNUploadOption *)option API_AVAILABLE(ios(9)) API_UNAVAILABLE(macos, tvos);

@end
17 changes: 14 additions & 3 deletions QiniuSDK/Storage/QNUploadManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
#import <Foundation/Foundation.h>

#if __IPHONE_OS_VERSION_MIN_REQUIRED
#import "QNALAssetFile.h"
#import <AssetsLibrary/AssetsLibrary.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import <UIKit/UIKit.h>

#if !TARGET_OS_MACCATALYST
#import <AssetsLibrary/AssetsLibrary.h>
#import "QNALAssetFile.h"
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
#import "QNPHAssetFile.h"
#import <Photos/Photos.h>
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90100
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
#import "QNPHAssetResource.h"
#endif

Expand Down Expand Up @@ -279,11 +282,13 @@ - (void)putFile:(NSString *)filePath
}
}

#if !TARGET_OS_MACCATALYST
- (void)putALAsset:(ALAsset *)asset
key:(NSString *)key
token:(NSString *)token
complete:(QNUpCompletionHandler)completionHandler
option:(QNUploadOption *)option {
#if __IPHONE_OS_VERSION_MIN_REQUIRED
if ([QNUploadManager checkAndNotifyError:key token:token input:asset complete:completionHandler]) {
return;
}
Expand All @@ -300,13 +305,16 @@ - (void)putALAsset:(ALAsset *)asset
}
[self putFileInternal:file key:key token:token complete:completionHandler option:option];
}
#endif
}
#endif

- (void)putPHAsset:(PHAsset *)asset
key:(NSString *)key
token:(NSString *)token
complete:(QNUpCompletionHandler)completionHandler
option:(QNUploadOption *)option {
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 90100)
if ([QNUploadManager checkAndNotifyError:key token:token input:asset complete:completionHandler]) {
return;
}
Expand All @@ -323,13 +331,15 @@ - (void)putPHAsset:(PHAsset *)asset
}
[self putFileInternal:file key:key token:token complete:completionHandler option:option];
}
#endif
}

- (void)putPHAssetResource:(PHAssetResource *)assetResource
key:(NSString *)key
token:(NSString *)token
complete:(QNUpCompletionHandler)completionHandler
option:(QNUploadOption *)option {
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000)
if ([QNUploadManager checkAndNotifyError:key token:token input:assetResource complete:completionHandler]) {
return;
}
Expand All @@ -345,6 +355,7 @@ - (void)putPHAssetResource:(PHAssetResource *)assetResource
}
[self putFileInternal:file key:key token:token complete:completionHandler option:option];
}
#endif
}

@end