-
Notifications
You must be signed in to change notification settings - Fork 199
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 #2 from aws-amplify/palpatim/wip
Palpatim/wip
- Loading branch information
Showing
51 changed files
with
1,111 additions
and
1,314 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,16 @@ | ||
// | ||
// Copyright 2018-2019 Amazon.com, | ||
// Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import Foundation | ||
|
||
public struct APICategoryConfiguration: CategoryConfiguration { | ||
public let plugins: [String: JSONValue] | ||
|
||
public init(plugins: [String: JSONValue] = [:]) { | ||
self.plugins = plugins | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Amplify/Categories/API/Internal/APICategory+CategoryConfigurable.swift
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,42 @@ | ||
// | ||
// Copyright 2018-2019 Amazon.com, | ||
// Inc. or its affiliates. All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
extension APICategory: CategoryConfigurable { | ||
|
||
func configure(using configuration: CategoryConfiguration) throws { | ||
guard !isConfigured else { | ||
let error = ConfigurationError.amplifyAlreadyConfigured( | ||
"\(categoryType.displayName) has already been configured.", | ||
""" | ||
Either remove the duplicate call to `Amplify.configure()`, or call \ | ||
`Amplify.reset()` before issuing the second call to `configure()` | ||
""" | ||
) | ||
throw error | ||
} | ||
|
||
for (pluginKey, pluginConfiguration) in configuration.plugins { | ||
let plugin = try getPlugin(for: pluginKey) | ||
try plugin.configure(using: pluginConfiguration) | ||
} | ||
|
||
isConfigured = true | ||
} | ||
|
||
func configure(using amplifyConfiguration: AmplifyConfiguration) throws { | ||
guard let configuration = categoryConfiguration(from: amplifyConfiguration) else { | ||
return | ||
} | ||
try configure(using: configuration) | ||
} | ||
|
||
func reset() { | ||
plugins.values.forEach { $0.reset() } | ||
isConfigured = false | ||
} | ||
|
||
} |
76 changes: 0 additions & 76 deletions
76
Amplify/Categories/Analytics/AnalyticsCategory+ClientBehavior.swift
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.