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(datastore): Dispatch networkStatus event #766

Merged
merged 16 commits into from
Sep 29, 2020

Conversation

ruiguoamz
Copy link
Contributor

@ruiguoamz ruiguoamz commented Sep 13, 2020

Description of changes:

networkStatus

public struct NetworkStatusEvent {
    public let active: Bool

    public init(active: Bool) {
        self.active = active
    }
}

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

@ruiguoamz ruiguoamz self-assigned this Sep 13, 2020
@ruiguoamz ruiguoamz changed the title feat(datastore): Dispatch networkStatus event feat(datastore): Dispatch networkStatus, ready events Sep 15, 2020
@ruiguoamz ruiguoamz marked this pull request as ready for review September 16, 2020 16:54
@ruiguoamz ruiguoamz changed the title feat(datastore): Dispatch networkStatus, ready events feat(datastore): Dispatch networkStatus event Sep 18, 2020
@ruiguoamz ruiguoamz changed the base branch from main to feature/hub-events September 29, 2020 17:17
@ruiguoamz ruiguoamz added the datastore Issues related to the DataStore category label Sep 29, 2020
@@ -28,11 +28,21 @@ class DataStoreHubEventTests: HubEventsIntegrationTestBase {
/// - outboxStatus received, payload should be {isEmpty: true}
Copy link
Contributor

Choose a reason for hiding this comment

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

update testcomment accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@@ -62,6 +72,8 @@ class DataStoreHubEventTests: HubEventsIntegrationTestBase {
return
}

startAmplify()
Copy link
Contributor

Choose a reason for hiding this comment

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

how does this work? Amplify.Hub.listen is called before startAmplify() which calls Amplify.configure()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to Tim, listening for events should work prior to Amplify.configure() being called. and Combine flavor of listening is better to be used because of its better deterministic property. So I will change it to Hub.publisher.sink here

@ruiguoamz ruiguoamz merged commit 40dacd6 into feature/hub-events Sep 29, 2020
@ruiguoamz ruiguoamz deleted the datastore/networkstatus branch September 29, 2020 20:46
ruiguoamz added a commit that referenced this pull request Oct 2, 2020
* initialize networkStatus PR

* fixed an indentation

* fixed unit test

* added ready but not yet implemented

* ready for review

* removed one publisher

* fixed a typo

* updated passthroughSubject to CurrentValueSubject in NetworkReachabilityNotifier

* updated ReachabilityNotifierTests

* plural

* removed one log info

* Update DataStoreCategory+HubPayloadEventName.swift

* updated integration test

* updated integration test

Co-authored-by: Guo <[email protected]>
ruiguoamz added a commit that referenced this pull request Oct 20, 2020
* feat(datastore): Dispatch networkStatus event (#766)

* initialize networkStatus PR

* fixed an indentation

* fixed unit test

* added ready but not yet implemented

* ready for review

* removed one publisher

* fixed a typo

* updated passthroughSubject to CurrentValueSubject in NetworkReachabilityNotifier

* updated ReachabilityNotifierTests

* plural

* removed one log info

* Update DataStoreCategory+HubPayloadEventName.swift

* updated integration test

* updated integration test

Co-authored-by: Guo <[email protected]>

* feat(datastore): Dispatch networkStatus event (#766)

* initialize networkStatus PR

* fixed an indentation

* fixed unit test

* added ready but not yet implemented

* ready for review

* removed one publisher

* fixed a typo

* updated passthroughSubject to CurrentValueSubject in NetworkReachabilityNotifier

* updated ReachabilityNotifierTests

* plural

* removed one log info

* Update DataStoreCategory+HubPayloadEventName.swift

* updated integration test

* updated integration test

Co-authored-by: Guo <[email protected]>

* feat(datastore): Dispatch modelSynced, syncQueriesReady events (#758)

* switching branch

* switching branch

* initial modelsynced && syncQueriesReady PR

* updated some mock* files

* self.modelSyncedEvent.build()

* updated ReconcileAndLocalSave: query to check local store before deciding create or update mutationType

* added one integration test for modelsynced event

* update count to atomic operation

* update count to atomic operation

* did some clean up

* ready for review

* ready for review 2

* updated part of comments

* updated logic

* fixed one unit test

* modified reconcileAndLocalSave

* did some clean up

* reimplement logic: Added SyncEventEmitter & ModelSyncEventEmitter

* did some clean up and fixed a bug for causing a unit test to fail

* ready for review

* addressed some comments

* fixed some mock class

* removed testing part for modelsynced

* addressed some PR comments

* updated several unit tests and added ready event

* DispatchQueue.main -> DispatchQueue.global() in RemoteSyncEngine

* updated two unit tests

* removed ready event from this PR

* Added SyncEventEmitterTests

* added one unit test in ReconcileAndLocalSave test

* updated two unit tests class

* updated two unit test classes: InitialSyncOrchestratorTests and SyncEventEmitterTests

* 10/08/2020 comments addressed

* fixed some comments part1

* fixed one build error

* try to fix a cicd error

* addressed lots of comments

* fix underlying queue for InitialSyncOrchestrator

* ready for re-review

* abc

* remove one reset from setup()

* error handling in initialSyncOrchestrator

* updated some comments

Co-authored-by: Guo <[email protected]>
Co-authored-by: Tim Schmelter <[email protected]>

* feat(datastore): dispatch ready event (#812)

* switching branch

* switching branch

* initial modelsynced && syncQueriesReady PR

* updated some mock* files

* self.modelSyncedEvent.build()

* updated ReconcileAndLocalSave: query to check local store before deciding create or update mutationType

* added one integration test for modelsynced event

* update count to atomic operation

* update count to atomic operation

* did some clean up

* ready for review

* ready for review 2

* updated part of comments

* updated logic

* fixed one unit test

* modified reconcileAndLocalSave

* did some clean up

* reimplement logic: Added SyncEventEmitter & ModelSyncEventEmitter

* did some clean up and fixed a bug for causing a unit test to fail

* ready for review

* addressed some comments

* fixed some mock class

* removed testing part for modelsynced

* addressed some PR comments

* updated several unit tests and added ready event

* DispatchQueue.main -> DispatchQueue.global() in RemoteSyncEngine

* updated two unit tests

* removed ready event from this PR

* Added SyncEventEmitterTests

* Initialize Ready event PR

* remove dispatchGroup, use AtomicValue

* fixed a typo

* added one unit test in ReconcileAndLocalSave test

* updated two unit tests class

* Initialize Ready event PR

* remove dispatchGroup, use AtomicValue

* fixed a typo

* Revert "fixed a typo"

This reverts commit b7871af.

* fjk

* updated two unit test classes: InitialSyncOrchestratorTests and SyncEventEmitterTests

* 10/08/2020 comments addressed

* fixed some comments part1

* fixed one build error

* try to fix a cicd error

* addressed lots of comments

* fix underlying queue for InitialSyncOrchestrator

* ready for re-review

* abc

* remove one reset from setup()

* error handling in initialSyncOrchestrator

* addressed comments

* updated some comments

Co-authored-by: Guo <[email protected]>
Co-authored-by: Tim Schmelter <[email protected]>

Co-authored-by: Guo <[email protected]>
Co-authored-by: Tim Schmelter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants