forked from github/wulkanowy-mirror
Fix NPE in SyncPresenter (#1582)
This commit is contained in:
parent
e3122127c0
commit
ac86737050
@ -74,7 +74,7 @@ class SyncManager @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun startOneTimeSyncWorker(): Flow<WorkInfo> {
|
||||
fun startOneTimeSyncWorker(): Flow<WorkInfo?> {
|
||||
val work = OneTimeWorkRequestBuilder<SyncWorker>()
|
||||
.setInputData(
|
||||
Data.Builder()
|
||||
|
@ -46,7 +46,7 @@ class SyncPresenter @Inject constructor(
|
||||
fun onSyncNowClicked() {
|
||||
view?.run {
|
||||
syncManager.startOneTimeSyncWorker().onEach { workInfo ->
|
||||
when (workInfo.state) {
|
||||
when (workInfo?.state) {
|
||||
WorkInfo.State.ENQUEUED -> {
|
||||
setSyncInProgress(true)
|
||||
Timber.i("Setting sync now started")
|
||||
@ -63,9 +63,9 @@ class SyncPresenter @Inject constructor(
|
||||
)
|
||||
analytics.logEvent("sync_now", "status" to "failed")
|
||||
}
|
||||
else -> Timber.d("Sync now state: ${workInfo.state}")
|
||||
else -> Timber.d("Sync now state: ${workInfo?.state}")
|
||||
}
|
||||
if (workInfo.state.isFinished) {
|
||||
if (workInfo?.state?.isFinished == true) {
|
||||
setSyncInProgress(false)
|
||||
setSyncDateInView()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user