-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from aws-amplify/mdlaw/wip
Adding AWSS3StoragePlugin framework and AmplifyAppExample and podspecs
- Loading branch information
Showing
32 changed files
with
3,307 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,44 @@ | ||
# OS generated files # | ||
###################### | ||
.COMPONENT_CACHED | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
Icon? | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Xcode setups | ||
**/xcuserdata | ||
**/*.xcuserdata | ||
|
||
*.xcworkspace/ | ||
Amplify.xcodeproj/xcuserdata | ||
Amplify.xcworkspace/xcuserdata | ||
xcuserdata | ||
xcuserdata | ||
|
||
# Patched code # | ||
###################### | ||
*.bak | ||
|
||
# Built assets # | ||
###################### | ||
build | ||
builtFramework | ||
AWS*.framework | ||
|
||
# Stuff that can't be committed # | ||
###################### | ||
credentials.json | ||
Pods | ||
Podfile.lock | ||
Documentation | ||
Scripts/build.sh | ||
Scripts/gcovr | ||
Scripts/jenkins.py | ||
Scripts/ocunit2junit | ||
__pycache__/ | ||
awsconfiguration.json | ||
credentials-mc.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Be sure to run `pod spec lint AWSS3StoragePlugin.podspec' to ensure this is a | ||
# valid spec and to remove all comments including this before submitting the spec. | ||
# | ||
# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html | ||
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ | ||
# | ||
|
||
Pod::Spec.new do |s| | ||
|
||
s.name = 'AWSS3StoragePlugin' | ||
s.version = '0.0.1' | ||
s.summary = 'Amazon Web Services Amplify for iOS.' | ||
|
||
s.description = 'AWS Amplify for iOS provides a declarative library for application development using cloud services' | ||
|
||
s.homepage = 'http://aws.amazon.com/mobile/sdk' | ||
s.license = 'Apache License, Version 2.0' | ||
s.author = { 'Amazon Web Services' => 'amazonwebservices' } | ||
s.platform = :ios, '8.0' | ||
s.source = { :git => 'https://github.com/aws-amplify/amplify-ios.git', :tag => s.version} | ||
|
||
s.requires_arc = true | ||
s.dependency 'Amplify', '0.0.1' | ||
s.source_files = 'AWSS3StoragePlugin/**/*.swift' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// Copyright 2018-2019 Amazon.com, | ||
// Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import Foundation | ||
import Amplify | ||
import AWSS3 | ||
|
||
public class AWSS3StorageGetOperation: AmplifyOperation<Progress, StorageGetResult, StorageGetError>, StorageGetOperation { | ||
|
||
var key: String | ||
|
||
var refGetTask: AWSS3TransferUtilityDownloadTask? | ||
var onEvent: ((AsyncEvent<Progress, StorageGetResult, StorageGetError>) -> Void)? | ||
init(key: String) { | ||
self.key = key | ||
super.init(categoryType: .storage) | ||
} | ||
|
||
// implements Resumable | ||
public func pause() { | ||
self.refGetTask?.suspend() | ||
} | ||
|
||
// implements Resumbable | ||
public func resume() { | ||
self.refGetTask?.resume() | ||
} | ||
|
||
// override AmplifyOperation : Cancellable | ||
override public func cancel() { | ||
self.refGetTask?.cancel() | ||
cancel() | ||
} | ||
|
||
func emitEvent(progress: Progress) { | ||
self.onEvent?(AsyncEvent.inProcess(progress)) | ||
} | ||
|
||
func emitSuccess(data: Data) { | ||
let result = StorageGetResult(data: data) | ||
self.onEvent?(AsyncEvent.completed(result)) | ||
} | ||
|
||
override public func main() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// Copyright 2018-2019 Amazon.com, | ||
// Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import Amplify | ||
import AWSS3 | ||
|
||
public class AWSS3StoragePlugin : StorageCategoryPlugin { | ||
|
||
private let queue: OperationQueue = OperationQueue() | ||
|
||
public init() { | ||
|
||
} | ||
|
||
public var key: PluginKey { | ||
return "AWSS3StoragePlugin" | ||
} | ||
|
||
public func configure(using configuration: Any) throws { | ||
if let configuration = configuration as? [String: Any] { | ||
let bucket = configuration["Bucket"] as! String | ||
let region = configuration["Region"] as! String | ||
let credentialsProvider = configuration["CredentialsProvider"] as! [String:Any] | ||
let poolId = credentialsProvider["PoolId"] as! String | ||
let credentialsProviderRegion = credentialsProvider["Region"] as! String | ||
|
||
let credentialProvider = AWSCognitoCredentialsProvider(regionType: credentialsProviderRegion.aws_regionTypeValue(), identityPoolId: poolId) | ||
let serviceConfiguration: AWSServiceConfiguration = AWSServiceConfiguration(region: region.aws_regionTypeValue(), credentialsProvider: credentialProvider) | ||
|
||
AWSS3TransferUtility.register(with: serviceConfiguration, forKey: key) | ||
AWSS3PreSignedURLBuilder.register(with: serviceConfiguration, forKey: key) | ||
AWSS3.register(with: serviceConfiguration, forKey: key) | ||
} | ||
} | ||
|
||
public func reset() { | ||
} | ||
|
||
|
||
public func get(key: String, options: Any?) -> StorageGetOperation { | ||
let operation = AWSS3StorageGetOperation(key: key) | ||
queue.addOperation(operation) | ||
return operation | ||
} | ||
|
||
public func stub() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Copyright 2018-2019 Amazon.com, | ||
// Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import XCTest | ||
@testable import AWSS3StoragePlugin | ||
|
||
class AWSS3StoragePluginTests: XCTestCase { | ||
|
||
override func setUp() { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDown() { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
func testExample() { | ||
// This is an example of a functional test case. | ||
// Use XCTAssert and related functions to verify your tests produce the correct results. | ||
} | ||
|
||
func testPerformanceExample() { | ||
// This is an example of a performance test case. | ||
self.measure { | ||
// Put the code you want to measure the time of here. | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# Be sure to run `pod spec lint Amplify.podspec' to ensure this is a | ||
# valid spec and to remove all comments including this before submitting the spec. | ||
# | ||
# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html | ||
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ | ||
# | ||
|
||
Pod::Spec.new do |s| | ||
|
||
s.name = 'Amplify' | ||
s.version = '0.0.1' | ||
s.summary = 'Amazon Web Services Amplify for iOS.' | ||
|
||
s.description = 'AWS Amplify for iOS provides a declarative library for application development using cloud services' | ||
|
||
s.homepage = 'https://aws.amazon.com/amplify/' | ||
s.license = 'Apache License, Version 2.0' | ||
s.author = { 'Amazon Web Services' => 'amazonwebservices' } | ||
s.platform = :ios, '9.0' | ||
s.source = { :git => 'https://github.com/aws-amplify/amplify-ios.git', :tag => s.version} | ||
|
||
s.requires_arc = true | ||
s.source_files = 'Amplify/**/*.swift' | ||
|
||
end |
Oops, something went wrong.