-
Notifications
You must be signed in to change notification settings - Fork 990
[๐] Replacing FirebaseJobDispatcher with WorkManager #806
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
Conversation
This file contains hidden or 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
Initializing `WorkManager` in `KSApplication` Added some utils I know we'll need when creating work.
* - Removed abstract methods `backgroundServiceClass`, `eventKey`, `eventNameKey`, `tag` from `TrackingClient` and it's subclasses. ## 1TrackingClientType` - Added `Type` enum with values `KOALA` and `LAKE` - Added abstract method `type` to return `Type` enum - Renamed `cleanProperties` to `lakeProperties` - Renamed `defaultProperties` to `koalaProperties` ## `TrackingWorker` - Created base abstract class `TrackingWorker` because both of the background workers for tracking are very similar - Replaced `KoalaBackgroundService` with `KoalaWorker` - Replaced `LakeBackgroundService` with `LakeWorker` - Removed both services from `AndroidManifest` ## `IntentKey` - Replaced `KOALA_EVENT`, `KOALA_EVENT_NAME`, `LAKE_EVENT`, and `LAKE_EVENT_NAME` with `EVENT_DATA` and `EVENT_NAME` - Added `TRACKING_CLIENT_TYPE_TAG` ## Tests - Initializing `MockTrackingClient` with helper method instead of repeating myself * Not retrying client level failures. * Adding http code to error message.
* I used these great [migration docs](https://developer.android.com/topic/libraries/architecture/workmanager/migrating-fb) ## `DeviceRegistrar` - Converted this file to Kotlin to take advantage of the language - Added `registerToken` method to schedule some work to register a push token - Added `unregisterToken` method to schedule some work to unregister the current push token ## `ApiService` - `registerPushToken` returns a `JsonObject` instead of an `Empty` so we can properly handle failures ## New `TokenWorker`s - Replaced `RegisterService` with `RegisterTokenWorker` - 4XX responses are considered hard failures and won't be retried - Replaced `UnregisterService` with `UnregisterTokenWorker` - Removed both services from `AndroidManifest` ## `IntentKey` - Added `PUSH_TOKEN` as key for token string * PR feedback from Yatrik and Jonathan: Adding error logging if we cannot deserialize ErrorEnvelope. Adding const for backoff delay. * Update app/src/main/java/com/kickstarter/libs/DeviceRegistrar.kt Co-authored-by: jgsamudio <jonathan.samudio@wework.com>
jgsamudio
reviewed
Apr 1, 2020
jgsamudio
approved these changes
Apr 1, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: This is blocked by 2.4.0
๐ฒ What
Replacing
FirebaseJobDispatcher
withWorkManager
๐ค Why
FirebaseJobDispatcher is deprecatedโข.
๐ How
I used these great migration docs
Dispatcher.kt
because they're no longer used.๐ See
It's all in the background ๐
๐ QA
After this is merged, tracking events and push token registration should not regress.
Story ๐
NT-898