Skip to content

Commit 5d13b65

Browse files
committed
make sure we have write storage permission before doing anything at editor
1 parent 357286f commit 5d13b65

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.simplemobiletools.filemanager.activities
22

33
import android.os.Bundle
4+
import com.simplemobiletools.commons.extensions.toast
5+
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
46
import com.simplemobiletools.filemanager.R
57
import com.simplemobiletools.filemanager.extensions.config
68
import kotlinx.android.synthetic.main.activity_read_text.*
@@ -11,6 +13,17 @@ class ReadTextActivity : SimpleActivity() {
1113
super.onCreate(savedInstanceState)
1214
setContentView(R.layout.activity_read_text)
1315

16+
handlePermission(PERMISSION_WRITE_STORAGE) {
17+
if (it) {
18+
checkIntent()
19+
} else {
20+
toast(R.string.no_storage_permissions)
21+
finish()
22+
}
23+
}
24+
}
25+
26+
private fun checkIntent() {
1427
read_text_view.setTextColor(config.textColor)
1528
val uri = intent.data
1629
if (uri.scheme == "file") {

0 commit comments

Comments
 (0)