Skip to content

Commit d16f935

Browse files
authored
Merge pull request #173 from hossain-khan/increase-limit-check
[UPDATE] Increase the limit of checker interval
2 parents 8d5a51d + 06f9285 commit d16f935

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

app/src/main/java/dev/hossain/remotenotify/ui/alertmediumlist/NotificationMediumListScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ class NotificationMediumListPresenter
172172
LaunchedEffect(Unit) {
173173
// Set up debounced updates to avoid frequent worker setup
174174
workerIntervalFlow
175-
// Wait for 500ms of inactivity
176-
.debounce(500L)
175+
// Wait for 1 second of inactivity
176+
.debounce(1_000L)
177177
.collect { minutes ->
178178
Timber.d("Worker interval updated: $minutes minutes")
179179
appPreferencesDataStore.saveWorkerInterval(minutes)

app/src/main/java/dev/hossain/remotenotify/ui/alertmediumlist/WorkerCheckIntervalConfigUi.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ internal fun WorkerConfigCard(
3737
modifier: Modifier = Modifier,
3838
) {
3939
var intervalSliderValue by remember { mutableFloatStateOf(state.workerIntervalMinutes.toFloat()) }
40+
val alertCheckIntervalRangeStart = 60f // 1 hour
41+
val alertCheckIntervalRangeEnd = 720f // 12 hours
42+
4043
Card(
4144
modifier = modifier,
4245
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp),
@@ -80,8 +83,7 @@ internal fun WorkerConfigCard(
8083
intervalSliderValue = intervalValue // Update UI immediately
8184
state.eventSink(NotificationMediumListScreen.Event.OnWorkerIntervalUpdated(intervalValue.toLong()))
8285
},
83-
valueRange = 30f..300f,
84-
// steps = 270, // (300-30)/1 to have steps of 1 minute
86+
valueRange = alertCheckIntervalRangeStart..alertCheckIntervalRangeEnd,
8587
modifier = Modifier.fillMaxWidth(),
8688
colors =
8789
SliderDefaults.colors(
@@ -98,12 +100,12 @@ internal fun WorkerConfigCard(
98100
horizontalArrangement = Arrangement.SpaceBetween,
99101
) {
100102
Text(
101-
text = "30m",
103+
text = "${(alertCheckIntervalRangeStart / 60).toInt()}h",
102104
style = MaterialTheme.typography.bodySmall,
103105
color = MaterialTheme.colorScheme.onSurfaceVariant,
104106
)
105107
Text(
106-
text = "5h",
108+
text = "${(alertCheckIntervalRangeEnd / 60).toInt()}h",
107109
style = MaterialTheme.typography.bodySmall,
108110
color = MaterialTheme.colorScheme.onSurfaceVariant,
109111
)

app/src/main/java/dev/hossain/remotenotify/worker/WorkerRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import androidx.work.WorkManager
1212
import androidx.work.WorkRequest
1313
import java.util.concurrent.TimeUnit
1414

15-
internal const val DEFAULT_PERIODIC_INTERVAL_MINUTES = 60L
15+
internal const val DEFAULT_PERIODIC_INTERVAL_MINUTES = 120L
1616
internal const val DEVICE_VITALS_CHECKER_DEBUG_WORKER_ID = "onetime-debug-request"
1717
internal const val DEVICE_VITALS_CHECKER_WORKER_ID = "periodic-health-check"
1818

0 commit comments

Comments
 (0)