Skip to content
Merged
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
Expand Up @@ -8,9 +8,7 @@ import at.bitfire.icsdroid.HttpUtils
import at.bitfire.icsdroid.db.entity.Credential
import at.bitfire.icsdroid.db.entity.Subscription
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class SubscriptionSettingsUseCase @Inject constructor() {
data class UiState(
val url: String? = null,
Expand All @@ -35,6 +33,8 @@ class SubscriptionSettingsUseCase @Inject constructor() {
val validUrlInput: Boolean = url?.let { url ->
HttpUtils.acceptedProtocol(url.toUri())
} ?: false

fun isInitialized() = url != null || title != null || color != null
}

var uiState by mutableStateOf(UiState())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ fun AddSubscriptionScreen(
}

LaunchedEffect(title, color, url) {
if (model.subscriptionSettingsUseCase.uiState.isInitialized())
return@LaunchedEffect
model.subscriptionSettingsUseCase.setInitialValues(title, color, url)

if (url != null) {
Expand Down