Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package neth.iecal.curbox.data.models


//You can setup a custom message to appear here!
data class AppBlockerWarningScreenConfig(
val message: String = "You can setup a custom message to appear here!",
val message: List<String> = listOf("Message 1", "Message 2"),
val timeInterval: Long = 120000L, // default cooldown period
val isDynamicIntervalSettingAllowed: Boolean = false,
val isProceedDisabled: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class WarningActivity : AppCompatActivity() {
}
.show()

binding.warningMsg.text = warningScreenConfig.message
binding.warningMsg.text = warningScreenConfig.message.random()

if (warningScreenConfig.isOnOpenConfig) {
binding.minsPicker.visibility = View.GONE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal class WarningConfigFormController(
)
updateProceedWindowInput(initialInputValue)

binding.warningMsgEdit.setText(config.message)
binding.warningMsgEdit.setText(config.message.joinToString(", "))
binding.switchVibrateBrightness.isChecked = config.vibrateAndIncBrightness
}

Expand Down Expand Up @@ -257,7 +257,11 @@ internal class WarningConfigFormController(
selectedSecondaryIndex(selectedChallengeIndex())
)
return AppBlockerWarningScreenConfig(
message = binding.warningMsgEdit.text.toString(),
message = binding.warningMsgEdit.text.toString()
.split(",")
.map { it.trim() }
.filter { it.isNotEmpty() },

timeInterval = numericInputValue(binding.fixedTimeInput) * 60_000L,
isDynamicIntervalSettingAllowed = flags.isDynamicIntervalSettingAllowed,
isProceedDisabled = flags.isProceedDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ object RestrictionComparator {

fun warningConfig(o: AppBlockerWarningScreenConfig, n: AppBlockerWarningScreenConfig): Boolean {
// Message and typing sentence wording never change how strong the block is
if (o.copy(message = "", typingSentence = "") == n.copy(message = "", typingSentence = "")) return true
if (o.copy(message = listOf(), typingSentence = "") == n.copy(message = listOf(), typingSentence = "")) return true

val onEachOpenOk = !o.isOnOpenConfig || n.isOnOpenConfig
val cooldownOk = n.isOnOpenConfig || n.timeInterval <= o.timeInterval
Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ksp) apply false
}
}