diff --git a/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/AddRecordMediator.kt b/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/AddRecordMediator.kt index b2deb4ba7..1d58c76f1 100644 --- a/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/AddRecordMediator.kt +++ b/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/AddRecordMediator.kt @@ -21,6 +21,11 @@ class AddRecordMediator @Inject constructor( suspend fun doAfterAdd(typeId: Long) { notificationTypeInteractor.checkAndShow(typeId) notificationGoalTimeInteractor.checkAndReschedule(typeId) - widgetInteractor.updateWidgets(listOf(WidgetType.STATISTICS_CHART)) + widgetInteractor.updateWidgets( + listOf( + WidgetType.STATISTICS_CHART, + WidgetType.RECORD_TYPE, + ), + ) } } \ No newline at end of file diff --git a/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/RemoveRecordMediator.kt b/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/RemoveRecordMediator.kt index c7b3f4f17..6f0687ef1 100644 --- a/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/RemoveRecordMediator.kt +++ b/domain/src/main/java/com/example/util/simpletimetracker/domain/interactor/RemoveRecordMediator.kt @@ -18,6 +18,11 @@ class RemoveRecordMediator @Inject constructor( suspend fun doAfterRemove(typeId: Long) { notificationTypeInteractor.checkAndShow(typeId) notificationGoalTimeInteractor.checkAndReschedule(typeId) - widgetInteractor.updateWidgets(listOf(WidgetType.STATISTICS_CHART)) + widgetInteractor.updateWidgets( + listOf( + WidgetType.STATISTICS_CHART, + WidgetType.RECORD_TYPE, + ), + ) } } \ No newline at end of file diff --git a/features/feature_change_record/src/main/java/com/example/util/simpletimetracker/feature_change_record/viewModel/ChangeRecordViewModel.kt b/features/feature_change_record/src/main/java/com/example/util/simpletimetracker/feature_change_record/viewModel/ChangeRecordViewModel.kt index 11d7b2571..45cdb56d3 100644 --- a/features/feature_change_record/src/main/java/com/example/util/simpletimetracker/feature_change_record/viewModel/ChangeRecordViewModel.kt +++ b/features/feature_change_record/src/main/java/com/example/util/simpletimetracker/feature_change_record/viewModel/ChangeRecordViewModel.kt @@ -107,11 +107,11 @@ class ChangeRecordViewModel @Inject constructor( comment = newComment, tagIds = newCategoryIds ).let { + addRecordMediator.add(it) if (newTypeId != originalTypeId) { notificationTypeInteractor.checkAndShow(originalTypeId) notificationGoalTimeInteractor.checkAndReschedule(originalTypeId) } - addRecordMediator.add(it) router.back() } } diff --git a/features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/goalTime/interactor/NotificationGoalTimeInteractorImpl.kt b/features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/goalTime/interactor/NotificationGoalTimeInteractorImpl.kt index db21367c2..c38b4b21c 100644 --- a/features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/goalTime/interactor/NotificationGoalTimeInteractorImpl.kt +++ b/features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/goalTime/interactor/NotificationGoalTimeInteractorImpl.kt @@ -10,7 +10,9 @@ import com.example.util.simpletimetracker.domain.interactor.NotificationGoalTime import com.example.util.simpletimetracker.domain.interactor.RecordTypeGoalInteractor import com.example.util.simpletimetracker.domain.interactor.RecordTypeInteractor import com.example.util.simpletimetracker.domain.interactor.RunningRecordInteractor +import com.example.util.simpletimetracker.domain.interactor.WidgetInteractor import com.example.util.simpletimetracker.domain.model.RecordTypeGoal +import com.example.util.simpletimetracker.domain.model.WidgetType import com.example.util.simpletimetracker.feature_notification.goalTime.manager.NotificationGoalTimeManager import com.example.util.simpletimetracker.feature_notification.goalTime.scheduler.NotificationGoalTimeScheduler import com.example.util.simpletimetracker.feature_notification.goalTime.scheduler.NotificationRangeEndScheduler @@ -27,6 +29,7 @@ class NotificationGoalTimeInteractorImpl @Inject constructor( private val scheduler: NotificationGoalTimeScheduler, private val rangeEndScheduler: NotificationRangeEndScheduler, private val notificationGoalParamsInteractor: NotificationGoalParamsInteractor, + private val widgetInteractor: WidgetInteractor, ) : NotificationGoalTimeInteractor { override suspend fun checkAndReschedule() { @@ -134,6 +137,8 @@ class NotificationGoalTimeInteractorImpl @Inject constructor( range = goalRange, type = NotificationGoalParamsInteractor.Type.Duration, )?.let(manager::show) + // TODO update only by typeId, not all widgets. + widgetInteractor.updateWidgets(listOf(WidgetType.RECORD_TYPE)) } } } \ No newline at end of file diff --git a/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/delegate/SettingsAdditionalViewModelDelegate.kt b/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/delegate/SettingsAdditionalViewModelDelegate.kt index 9db84ef6d..b7b0eb308 100644 --- a/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/delegate/SettingsAdditionalViewModelDelegate.kt +++ b/features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/viewModel/delegate/SettingsAdditionalViewModelDelegate.kt @@ -106,7 +106,12 @@ class SettingsAdditionalViewModelDelegate @Inject constructor( delegateScope.launch { val newValue = prefsInteractor.getStartOfDayShift() * -1 prefsInteractor.setStartOfDayShift(newValue) - widgetInteractor.updateWidgets(listOf(WidgetType.STATISTICS_CHART)) + widgetInteractor.updateWidgets( + listOf( + WidgetType.STATISTICS_CHART, + WidgetType.RECORD_TYPE, + ), + ) notificationTypeInteractor.updateNotifications() notificationGoalTimeInteractor.checkAndReschedule() updateStartOfDayViewData() @@ -193,7 +198,12 @@ class SettingsAdditionalViewModelDelegate @Inject constructor( val wasPositive = prefsInteractor.getStartOfDayShift() >= 0 val newValue = settingsMapper.toStartOfDayShift(timestamp, wasPositive) prefsInteractor.setStartOfDayShift(newValue) - widgetInteractor.updateWidgets(listOf(WidgetType.STATISTICS_CHART)) + widgetInteractor.updateWidgets( + listOf( + WidgetType.STATISTICS_CHART, + WidgetType.RECORD_TYPE, + ), + ) notificationTypeInteractor.updateNotifications() notificationGoalTimeInteractor.checkAndReschedule() updateStartOfDayViewData()