8000 [๐Ÿ†•] Replacing FirebaseJobDispatcher with WorkManager by eoji ยท Pull Request #806 ยท kickstarter/android-oss ยท GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[๐Ÿ†•] 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

Merged
merged 8 commits into from
Apr 1, 2020
Merged

Conversation

eoji
Copy link
Contributor
@eoji eoji commented Mar 27, 2020

Note: This is blocked by 2.4.0

๐Ÿ“ฒ What

Replacing FirebaseJobDispatcher with WorkManager

๐Ÿค” Why

FirebaseJobDispatcher is deprecatedโ„ข.

๐Ÿ›  How

I used these great migration docs

๐Ÿ‘€ See

It's all in the background ๐Ÿ˜Ž

๐Ÿ“‹ QA

After this is merged, tracking events and push token registration should not regress.

Story ๐Ÿ“–

NT-898

eoji and others added 7 commits March 18, 2020 16:43
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>
@eoji eoji merged commit 75ce182 into master Apr 1, 2020
@eoji eoji deleted the NT-898 branch April 1, 2020 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0