Skip to content

Commit

Permalink
fix(ui): remove toast on non-main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashinch committed Apr 2, 2024
1 parent 826819a commit 53aced9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
}
}
}
}

Expand All @@ -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(
Expand Down

0 comments on commit 53aced9

Please sign in to comment.