Fixed unnecessary note creating on app resume

This commit is contained in:
Agnieszka C 2022-02-22 18:44:27 +01:00
parent 3ddc03f442
commit d55b3282d7

View File

@ -338,6 +338,8 @@ class MainActivity : SimpleActivity() {
if (action == Intent.ACTION_VIEW) {
val realPath = intent.getStringExtra(REAL_FILE_PATH)
val isFromHistory = intent.flags and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY != 0
if (!isFromHistory) {
if (realPath != null && hasPermission(PERMISSION_READ_STORAGE)) {
val file = File(realPath)
handleUri(Uri.fromFile(file))
@ -350,8 +352,11 @@ class MainActivity : SimpleActivity() {
} else {
handleUri(data!!)
}
}
intent.removeCategory(Intent.CATEGORY_DEFAULT)
intent.action = null
intent.removeExtra(NEW_CHECKLIST)
intent.removeExtra(NEW_TEXT_NOTE)
}
}
}