diff --git a/core/common/src/main/java/com/twofasapp/common/domain/Service.kt b/core/common/src/main/java/com/twofasapp/common/domain/Service.kt index 680a40c3..8a84b5f0 100644 --- a/core/common/src/main/java/com/twofasapp/common/domain/Service.kt +++ b/core/common/src/main/java/com/twofasapp/common/domain/Service.kt @@ -58,6 +58,10 @@ data class Service( } companion object { + val DefaultAlgorithm = Algorithm.SHA1 + const val DefaultPeriod = 30 + const val DefaultDigits = 6 + val Empty = Service( id = 0L, serviceTypeId = null, diff --git a/feature/home/src/main/java/com/twofasapp/feature/home/ui/editservice/advancedsettings/AdvancedSettingsScreen.kt b/feature/home/src/main/java/com/twofasapp/feature/home/ui/editservice/advancedsettings/AdvancedSettingsScreen.kt index bc1eda9c..01aa3c88 100644 --- a/feature/home/src/main/java/com/twofasapp/feature/home/ui/editservice/advancedsettings/AdvancedSettingsScreen.kt +++ b/feature/home/src/main/java/com/twofasapp/feature/home/ui/editservice/advancedsettings/AdvancedSettingsScreen.kt @@ -15,9 +15,8 @@ import com.twofasapp.designsystem.TwTheme import com.twofasapp.designsystem.common.TwTopAppBar import com.twofasapp.designsystem.settings.SettingsDivider import com.twofasapp.designsystem.settings.SettingsLink -import com.twofasapp.locale.TwLocale import com.twofasapp.locale.R -import com.twofasapp.feature.home.ui.editservice.EditServiceViewModel +import com.twofasapp.locale.TwLocale @Composable internal fun AdvancedSettingsScreen( @@ -74,7 +73,7 @@ internal fun AdvancedSettingsScreen( item { SettingsLink( title = TwLocale.strings.addManualAlgorithm, - subtitle = service.algorithm?.name.orEmpty(), + subtitle = service.algorithm?.name ?: Service.DefaultAlgorithm.name, enabled = false, ) } @@ -83,7 +82,7 @@ internal fun AdvancedSettingsScreen( item { SettingsLink( title = TwLocale.strings.addManualRefreshTime, - subtitle = service.period.toString(), + subtitle = (service.period ?: Service.DefaultPeriod).toString(), enabled = false, ) } @@ -102,7 +101,7 @@ internal fun AdvancedSettingsScreen( item { SettingsLink( title = TwLocale.strings.addManualDigits, - subtitle = service.digits.toString(), + subtitle = (service.digits ?: Service.DefaultDigits).toString(), enabled = false, ) }