mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -04:00
Fixed blank screen showing in custom application after giving permission from settings
This commit is contained in:
parent
585c5a1ecd
commit
8de9f28b0d
@ -268,7 +268,7 @@
|
||||
<string name="tag_text_only">Text Only</string>
|
||||
<string name="tag_short_text">Short Text</string>
|
||||
<string name="storage_permission_denied">Storage Permission Denied</string>
|
||||
<string name="grant_read_storage_permission">This app requires the ability to read storage permission to function. Please grant the storage permission in your app setting</string>
|
||||
<string name="grant_read_storage_permission">This app requires the ability to read storage to function. Please grant the permission in your settings</string>
|
||||
<string name="go_to_settings">Go to Hotspot Settings</string>
|
||||
<string name="no_results">No Results</string>
|
||||
<string name="no_bookmarks">No Bookmarks</string>
|
||||
@ -334,5 +334,5 @@
|
||||
<string name="forward_history">Forward history</string>
|
||||
<string name="clear_all_navigation_history_message">Clears all (backward, forward) navigation history</string>
|
||||
<string name="navigation_history_cleared">Navigation History Cleared</string>
|
||||
<string name="go_to_settings_label">Go to Setting</string>
|
||||
<string name="go_to_settings_label">Go to Settings</string>
|
||||
</resources>
|
||||
|
@ -70,6 +70,7 @@ class CustomReaderFragment : CoreReaderFragment() {
|
||||
@Inject
|
||||
var dialogShower: DialogShower? = null
|
||||
private var permissionRequiredDialog: Dialog? = null
|
||||
private var appSettingsLaunched = false
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
if (enforcedLanguage()) {
|
||||
@ -182,10 +183,13 @@ class CustomReaderFragment : CoreReaderFragment() {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (permissions.isNotEmpty() && permissions[0] == Manifest.permission.READ_EXTERNAL_STORAGE) {
|
||||
if (readStorageHasBeenPermanentlyDenied(grantResults)) {
|
||||
if (permissionRequiredDialog == null || permissionRequiredDialog?.isShowing == false) {
|
||||
if (permissionRequiredDialog?.isShowing != true) {
|
||||
permissionRequiredDialog = dialogShower?.create(
|
||||
KiwixDialog.ReadPermissionRequired,
|
||||
requireActivity()::navigateToAppSettings
|
||||
{
|
||||
requireActivity().navigateToAppSettings()
|
||||
appSettingsLaunched = true
|
||||
}
|
||||
)
|
||||
permissionRequiredDialog?.show()
|
||||
}
|
||||
@ -263,4 +267,12 @@ class CustomReaderFragment : CoreReaderFragment() {
|
||||
super.onDestroyView()
|
||||
permissionRequiredDialog = null
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (appSettingsLaunched) {
|
||||
appSettingsLaunched = false
|
||||
openObbOrZim()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user