🛠️ Prevent crash when no file manager app
* When choosing a folder in Browse (scan) it crashed when there is no file manager app to handle such action Resolves: #198
This commit is contained in:
parent
ba3f5f3b7a
commit
87b53745e9
3 changed files with 15 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.core.components.common.IconButton
|
import ua.acclorite.book_story.presentation.core.components.common.IconButton
|
||||||
import ua.acclorite.book_story.presentation.core.components.common.StyledText
|
import ua.acclorite.book_story.presentation.core.components.common.StyledText
|
||||||
import ua.acclorite.book_story.presentation.core.util.noRippleClickable
|
import ua.acclorite.book_story.presentation.core.util.noRippleClickable
|
||||||
|
import ua.acclorite.book_story.presentation.core.util.showToast
|
||||||
import ua.acclorite.book_story.ui.browse.BrowseScreen
|
import ua.acclorite.book_story.ui.browse.BrowseScreen
|
||||||
import ua.acclorite.book_story.ui.settings.SettingsEvent
|
import ua.acclorite.book_story.ui.settings.SettingsEvent
|
||||||
import ua.acclorite.book_story.ui.settings.SettingsModel
|
import ua.acclorite.book_story.ui.settings.SettingsModel
|
||||||
|
|
@ -108,7 +109,14 @@ fun BrowseScanOption() {
|
||||||
|
|
||||||
BrowseScanAction(
|
BrowseScanAction(
|
||||||
requestPersistableUriPermission = {
|
requestPersistableUriPermission = {
|
||||||
|
try {
|
||||||
persistedUriIntent.launch(null)
|
persistedUriIntent.launch(null)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
|
||||||
|
context.getString(R.string.error_no_file_manager_app)
|
||||||
|
.showToast(context, longToast = false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@
|
||||||
<string name="error_no_dictionary">Не знайдено жодного словника.</string>
|
<string name="error_no_dictionary">Не знайдено жодного словника.</string>
|
||||||
<string name="error_no_browser">Не знайдено жодного браузера.</string>
|
<string name="error_no_browser">Не знайдено жодного браузера.</string>
|
||||||
<string name="error_no_share_app">Не знайдено застосунка щоб поділитися.</string>
|
<string name="error_no_share_app">Не знайдено застосунка щоб поділитися.</string>
|
||||||
|
<string name="error_no_translator">Жодного перекладача не знайдено.</string>
|
||||||
|
<string name="error_no_dictionary">Жодного словника не знайдено.</string>
|
||||||
|
<string name="error_no_browser">Жодного браузера не знайдено.</string>
|
||||||
|
<string name="error_no_share_app">Не знайдено застосунок, щоб поділитися.</string>
|
||||||
|
<string name="error_no_file_manager_app">Не знайдено застосунку для вибору теки.</string>
|
||||||
<string name="error_could_not_get_text">
|
<string name="error_could_not_get_text">
|
||||||
Файл порожній, відсутній або недоступний.
|
Файл порожній, відсутній або недоступний.
|
||||||
Перевірте файл, налаштування сканування або змініть шлях і спробуйте ще раз.
|
Перевірте файл, налаштування сканування або змініть шлях і спробуйте ще раз.
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@
|
||||||
<string name="error_no_dictionary">No dictionary app found.</string>
|
<string name="error_no_dictionary">No dictionary app found.</string>
|
||||||
<string name="error_no_browser">No browser app found.</string>
|
<string name="error_no_browser">No browser app found.</string>
|
||||||
<string name="error_no_share_app">No app to share found.</string>
|
<string name="error_no_share_app">No app to share found.</string>
|
||||||
|
<string name="error_no_file_manager_app">No app to choose folder found.</string>
|
||||||
<string name="error_could_not_get_text">
|
<string name="error_could_not_get_text">
|
||||||
File is empty, missing, or inaccessible.
|
File is empty, missing, or inaccessible.
|
||||||
Verify the file, scan settings or change the path, then try again.
|
Verify the file, scan settings or change the path, then try again.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue