Skip to content

Commit

Permalink
fix instant activity not updating from wear
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Nov 17, 2024
1 parent ff1d9c9 commit 1acf082
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ class UpdateExternalViewsInteractor @Inject constructor(
)
}

suspend fun onInstantRecordAdd() {
runUpdates(
Update.Wear,
)
}

// Called after record add.
suspend fun onRecordChangeType(
originalTypeId: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package com.example.util.simpletimetracker.feature_wear

import com.example.util.simpletimetracker.core.interactor.RecordRepeatInteractor
import com.example.util.simpletimetracker.domain.extension.orZero
import com.example.util.simpletimetracker.domain.interactor.AddRunningRecordMediator
import com.example.util.simpletimetracker.domain.interactor.GetSelectableTagsInteractor
import com.example.util.simpletimetracker.domain.interactor.PrefsInteractor
Expand All @@ -16,6 +17,7 @@ import com.example.util.simpletimetracker.domain.interactor.RemoveRunningRecordM
import com.example.util.simpletimetracker.domain.interactor.RunningRecordInteractor
import com.example.util.simpletimetracker.domain.interactor.SettingsDataUpdateInteractor
import com.example.util.simpletimetracker.domain.interactor.ShouldShowRecordDataSelectionInteractor
import com.example.util.simpletimetracker.domain.interactor.UpdateExternalViewsInteractor
import com.example.util.simpletimetracker.domain.interactor.WidgetInteractor
import com.example.util.simpletimetracker.domain.model.RecordDataSelectionDialogResult
import com.example.util.simpletimetracker.domain.model.WidgetType
Expand Down Expand Up @@ -44,6 +46,7 @@ class WearDataRepo @Inject constructor(
private val removeRunningRecordMediator: Lazy<RemoveRunningRecordMediator>,
private val addRunningRecordMediator: Lazy<AddRunningRecordMediator>,
private val recordRepeatInteractor: Lazy<RecordRepeatInteractor>,
private val updateExternalViewsInteractor: Lazy<UpdateExternalViewsInteractor>,
private val router: Router,
private val widgetInteractor: WidgetInteractor,
private val settingsDataUpdateInteractor: SettingsDataUpdateInteractor,
Expand Down Expand Up @@ -89,6 +92,9 @@ class WearDataRepo @Inject constructor(
tagIds = request.tagIds,
comment = "",
)
if (recordTypeInteractor.get(request.id)?.defaultDuration.orZero() > 0) {
updateExternalViewsInteractor.get().onInstantRecordAdd()
}
}

override suspend fun stopActivity(request: WearStopActivityRequest) {
Expand Down

0 comments on commit 1acf082

Please sign in to comment.