Fix OPML import crashing when entry doesnt't have a name

This commit is contained in:
Shinokuni 2024-08-18 18:00:24 +02:00
parent c54a14e616
commit 96e3bca4a2
4 changed files with 10 additions and 10 deletions

View File

@ -134,7 +134,7 @@ class AccountScreenModel(
openDialog(
DialogState.OPMLImport(
currentFeed = foldersAndFeeds.values.first().first().name!!,
currentFeed = foldersAndFeeds.values.first().first().name,
feedCount = 0,
feedMax = foldersAndFeeds.values.flatten().size
)
@ -148,7 +148,7 @@ class AccountScreenModel(
it.copy(
dialog = dialog.copy(
currentFeed = feed.name!!,
currentFeed = feed.name,
feedCount = dialog.feedCount + 1
)
)
@ -225,7 +225,7 @@ data class AccountState(
sealed interface DialogState {
data object DeleteAccount : DialogState
data object NewAccount : DialogState
data class OPMLImport(val currentFeed: String, val feedCount: Int, val feedMax: Int) :
data class OPMLImport(val currentFeed: String?, val feedCount: Int, val feedMax: Int) :
DialogState
data class ErrorList(val errorResult: ErrorResult) : DialogState

View File

@ -4,12 +4,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.readrops.app.R
import com.readrops.app.util.components.dialog.BaseDialog
import com.readrops.app.util.components.RefreshIndicator
import com.readrops.app.util.components.dialog.BaseDialog
@Composable
fun OPMLImportProgressDialog(
currentFeed: String,
currentFeed: String?,
feedCount: Int,
feedMax: Int,
) {

View File

@ -84,7 +84,7 @@ class AccountSelectionScreenModel(
mutableState.update {
it.copy(
showOPMLImportDialog = true,
currentFeed = foldersAndFeeds.values.first().first().name!!,
currentFeed = foldersAndFeeds.values.first().first().name,
feedCount = 0,
feedMax = foldersAndFeeds.values.flatten().size
)
@ -98,7 +98,7 @@ class AccountSelectionScreenModel(
onUpdate = { feed ->
mutableState.update {
it.copy(
currentFeed = feed.name!!,
currentFeed = feed.name,
feedCount = it.feedCount + 1
)
}
@ -121,7 +121,7 @@ data class AccountSelectionState(
val showOPMLImportDialog: Boolean = false,
val navState: NavState = NavState.Idle,
val exception: Exception? = null,
val currentFeed: String = "",
val currentFeed: String? = null,
val feedCount: Int = 0,
val feedMax: Int = 0
)

View File

@ -29,7 +29,7 @@ fun RefreshScreen(
@Composable
fun RefreshIndicator(
currentFeed: String,
currentFeed: String?,
feedCount: Int,
feedMax: Int
) {
@ -44,7 +44,7 @@ fun RefreshIndicator(
VeryShortSpacer()
Text(
text = "$currentFeed ($feedCount/$feedMax)",
text = "${currentFeed.orEmpty()} ($feedCount/$feedMax)",
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)