@@ -7,12 +7,12 @@ import android.provider.Settings
77import org.fossify.commons.activities.BaseSimpleActivity
88import org.fossify.commons.dialogs.ConfirmationAdvancedDialog
99import org.fossify.commons.extensions.hasPermission
10+ import android.net.Uri
1011import org.fossify.commons.extensions.showErrorToast
1112import org.fossify.commons.extensions.toast
1213import org.fossify.commons.helpers.PERMISSION_WRITE_STORAGE
1314import org.fossify.commons.helpers.isRPlus
1415import org.fossify.filemanager.R
15- import androidx.core.net.toUri
1616
1717open class SimpleActivity : BaseSimpleActivity () {
1818 override fun getAppIconIDs () = arrayListOf (
@@ -82,13 +82,16 @@ open class SimpleActivity : BaseSimpleActivity() {
8282 try {
8383 val intent = Intent (Settings .ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION )
8484 intent.addCategory(" android.intent.category.DEFAULT" )
85- " package:$packageName " .toUri(). also { intent.data = it }
85+ intent.data = Uri .parse( " package:$packageName " )
8686 startActivityForResult(intent, MANAGE_STORAGE_RC )
87- } catch (e: Exception ) {
88- toast( R .string.no_storage_permissions )
87+ } catch (e: android.content. ActivityNotFoundException ) {
88+ showErrorToast(e )
8989 val intent = Intent ()
9090 intent.action = Settings .ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
9191 startActivityForResult(intent, MANAGE_STORAGE_RC )
92+ } catch (e: SecurityException ) {
93+ showErrorToast(e)
94+ finish()
9295 }
9396 } else {
9497 finish()
0 commit comments