Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Core): bootstrap Auth configuration before other categories, and fixed analytics integration tests #475

Merged
merged 11 commits into from
May 22, 2020

Conversation

ruiguoamz
Copy link
Contributor

Description of changes:

  • Removed AWSMobileClient for getting identityId.
  • Move configuration file under "~/AWSPinpointPluginIntegrationTests" and add README.md as instruction to run the integration test.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ruiguoamz ruiguoamz requested review from lawmicha and royjit May 20, 2020 21:46
@ruiguoamz ruiguoamz added the analytics Issues related to the Analytics category label May 20, 2020
@lawmicha
Copy link
Contributor

can you change the name of this PR to something like
`feat(core): bootstrap Auth configure before other categories, fix analytics tests" ?

we are trying to follow conventional commits btw (https://www.conventionalcommits.org/en/v1.0.0/)

@lawmicha
Copy link
Contributor

this is a fairly important change, it would be good to update the description to talk about the change to configuring Auth first, or very least mention it

@ruiguoamz ruiguoamz changed the title Rui/analytics integration test `feat(core): bootstrap Auth configure before other categories, fix analytics integration tests" ? May 21, 2020
@ruiguoamz ruiguoamz changed the title `feat(core): bootstrap Auth configure before other categories, fix analytics integration tests" ? `feat(Core): bootstrap Auth configure before other categories, and fixed analytics integration tests May 21, 2020
@ruiguoamz ruiguoamz changed the title `feat(Core): bootstrap Auth configure before other categories, and fixed analytics integration tests feat(Core): bootstrap Auth configure before other categories, and fixed analytics integration tests May 21, 2020
@ruiguoamz ruiguoamz changed the title feat(Core): bootstrap Auth configure before other categories, and fixed analytics integration tests feat(Core): bootstrap Auth configuration before other categories, and fixed analytics integration tests May 21, 2020
.gitignore Show resolved Hide resolved
@ruiguoamz ruiguoamz force-pushed the rui/analyticsIntegrationTest branch from e4f043a to f286d6f Compare May 21, 2020 23:39
@ruiguoamz ruiguoamz requested a review from palpatim May 22, 2020 01:32
Copy link
Member

@palpatim palpatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify that removing the file AmplifyPlugins/Analytics/HostApp/Configuration/amplifyconfiguration.json still allows all of the frameworks, both library and test, to compile.

@@ -101,23 +101,24 @@ extension Amplify {
try configure(Logging, using: configuration)
try configure(Hub, using: configuration)

// Auth is a special case for other plugins which depend on using Auth when being configured themselves.
try configure(Auth, using: configuration)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set up an array of Categories to be initialized, in order, then we can inspect membership in the array rather than multiple not-equals checks below. We can aid this with an extension on CategoryType:

In CategoryType.swift

public extension CategoryType {
    var category: Category {
        switch self {
        case .analytics:
            return Amplify.Analytics
        case .api:
            return Amplify.API
        case .auth:
            return Amplify.Auth
        case .dataStore:
            return Amplify.DataStore
        case .hub:
            return Amplify.Hub
        case .logging:
            return Amplify.Logging
        case .predictions:
            return Amplify.Predictions
        case .storage:
            return Amplify.Storage
        }
    }
}

Then here in AmplifyConfiguration.swift:

let manuallyConfiguredCategories = [CategoryType.logging, .hub, .auth]
for categoryType in manuallyConfiguredCategories {
    try configure(categoryType.category, using: configuration)
}

let remainingCategories = CategoryType.allCases.filter { !manuallyConfiguredCategories.contains($0) }
...

.gitignore Show resolved Hide resolved
@ruiguoamz ruiguoamz merged commit c33bf1b into master May 22, 2020
@palpatim palpatim deleted the rui/analyticsIntegrationTest branch May 27, 2020 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analytics Issues related to the Analytics category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants