fix(ui): remove toast on non-main thread

This commit is contained in:
Ash 2024-04-02 12:01:46 +08:00
parent 826819a10b
commit 53aced9085
No known key found for this signature in database
3 changed files with 8 additions and 10 deletions

View File

@ -38,7 +38,6 @@ import me.ash.reader.ui.component.base.TextFieldDialog
import me.ash.reader.ui.ext.MimeType
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.roundClick
import me.ash.reader.ui.ext.showToast
import me.ash.reader.ui.page.home.feeds.FeedOptionView
@OptIn(
@ -57,8 +56,8 @@ fun SubscribeDialog(
it?.let { uri ->
context.contentResolver.openInputStream(uri)?.let { inputStream ->
subscribeViewModel.importFromInputStream(inputStream)
} ?: context.showToast("Cannot open Input Stream with content resolver")
} ?: context.showToast("Cannot get activity result with launcher")
}
}
}
LaunchedEffect(subscribeUiState.visible) {

View File

@ -110,8 +110,8 @@ fun AccountDetailsPage(
result?.let { uri ->
context.contentResolver.openOutputStream(uri)?.use { outputStream ->
outputStream.write(string.toByteArray())
} ?: context.showToast("Cannot open Input Stream with content resolver")
} ?: context.showToast("Cannot get activity result with launcher")
}
}
}
}

View File

@ -46,7 +46,6 @@ import me.ash.reader.ui.ext.MimeType
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.getCurrentVersion
import me.ash.reader.ui.ext.openURL
import me.ash.reader.ui.ext.showToast
import me.ash.reader.ui.ext.toString
import me.ash.reader.ui.page.settings.SettingItem
import me.ash.reader.ui.theme.palette.onLight
@ -69,8 +68,8 @@ fun TroubleshootingPage(
result?.let { uri ->
context.contentResolver.openOutputStream(uri)?.use { outputStream ->
outputStream.write(byteArray)
} ?: context.showToast("Cannot open Input Stream with content resolver")
} ?: context.showToast("Cannot get activity result with launcher")
}
}
}
}
@ -81,8 +80,8 @@ fun TroubleshootingPage(
context.contentResolver.openInputStream(uri)?.use { inputStream ->
byteArray = inputStream.readBytes()
viewModel.tryImport(context, byteArray)
} ?: context.showToast("Cannot open Input Stream with content resolver")
} ?: context.showToast("Cannot get activity result with launcher")
}
}
}
RYScaffold(