Skip to content

Commit fd0f5ae

Browse files
committed
add timeStarted to activity stopped broadcast event
1 parent 863f58b commit fd0f5ae

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

domain/src/main/java/com/example/util/simpletimetracker/domain/notifications/interactor/ActivityStartedStoppedBroadcastInteractor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface ActivityStartedStoppedBroadcastInteractor {
1414
typeId: Long,
1515
tagIds: List<Long>,
1616
comment: String,
17+
timeStarted: Long,
1718
)
1819

1920
suspend fun onGoalReached(

domain/src/main/java/com/example/util/simpletimetracker/domain/record/interactor/RemoveRunningRecordMediator.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class RemoveRunningRecordMediator @Inject constructor(
4242
typeId = runningRecord.id,
4343
tagIds = runningRecord.tags.map(RecordBase.Tag::tagId),
4444
comment = runningRecord.comment,
45+
timeStarted = runningRecord.timeStarted,
4546
)
4647
remove(
4748
typeId = runningRecord.id,

features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/external/ActivityStartedStoppedBroadcastInteractorImpl.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import com.example.util.simpletimetracker.core.utils.EXTRA_GOAL_TYPE
1111
import com.example.util.simpletimetracker.core.utils.EXTRA_GOAL_VALUE
1212
import com.example.util.simpletimetracker.core.utils.EXTRA_RECORD_COMMENT
1313
import com.example.util.simpletimetracker.core.utils.EXTRA_RECORD_TAG_NAME
14+
import com.example.util.simpletimetracker.core.utils.EXTRA_RECORD_TIME_STARTED
1415
import com.example.util.simpletimetracker.core.utils.EXTRA_RECORD_TYPE_ICON
1516
import com.example.util.simpletimetracker.core.utils.EXTRA_RECORD_TYPE_NOTE
1617
import com.example.util.simpletimetracker.domain.category.interactor.CategoryInteractor
17-
import com.example.util.simpletimetracker.domain.category.model.Category
1818
import com.example.util.simpletimetracker.domain.extension.orZero
1919
import com.example.util.simpletimetracker.domain.notifications.interactor.ActivityStartedStoppedBroadcastInteractor
2020
import com.example.util.simpletimetracker.domain.notifications.model.ExternalEventGoalType
@@ -49,13 +49,15 @@ class ActivityStartedStoppedBroadcastInteractorImpl @Inject constructor(
4949
tagNames = getTagNames(tagIds),
5050
note = type.note,
5151
icon = type.icon,
52+
timeStarted = null,
5253
)
5354
}
5455

5556
override suspend fun onActivityStopped(
5657
typeId: Long,
5758
tagIds: List<Long>,
5859
comment: String,
60+
timeStarted: Long,
5961
) {
6062
if (!prefsInteractor.getAutomatedTrackingSendEvents()) return
6163

@@ -67,6 +69,7 @@ class ActivityStartedStoppedBroadcastInteractorImpl @Inject constructor(
6769
tagNames = getTagNames(tagIds),
6870
note = type.note,
6971
icon = type.icon,
72+
timeStarted = timeStarted,
7073
)
7174
}
7275

@@ -101,6 +104,7 @@ class ActivityStartedStoppedBroadcastInteractorImpl @Inject constructor(
101104
tagNames: List<String>,
102105
note: String,
103106
icon: String,
107+
timeStarted: Long?,
104108
) {
105109
val tagsString = tagNames.joinToString(separator = ",")
106110
Intent().apply {
@@ -110,6 +114,7 @@ class ActivityStartedStoppedBroadcastInteractorImpl @Inject constructor(
110114
if (tagNames.isNotEmpty()) putExtra(EXTRA_RECORD_TAG_NAME, tagsString)
111115
if (note.isNotEmpty()) putExtra(EXTRA_RECORD_TYPE_NOTE, note)
112116
if (icon.isNotEmpty()) putExtra(EXTRA_RECORD_TYPE_ICON, icon)
117+
if (timeStarted != null) putExtra(EXTRA_RECORD_TIME_STARTED, timeStarted)
113118
}.let(context::sendBroadcast)
114119
}
115120

features/feature_settings/src/main/java/com/example/util/simpletimetracker/feature_settings/mapper/SettingsAutomatedTrackingMapper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class SettingsAutomatedTrackingMapper @Inject constructor(
183183
EXTRA_RECORD_TAG_NAME,
184184
EXTRA_RECORD_TYPE_NOTE,
185185
EXTRA_RECORD_TYPE_ICON,
186+
EXTRA_RECORD_TIME_STARTED,
186187
),
187188
optional = emptyList(),
188189
),

0 commit comments

Comments
 (0)