fix #1976, properly handle app protection at opening a default folder

This commit is contained in:
tibbi 2020-12-05 23:21:09 +01:00
parent 74777a7cb8
commit 49c809815f
1 changed files with 6 additions and 2 deletions

View File

@ -66,6 +66,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private var mWasProtectionHandled = false private var mWasProtectionHandled = false
private var mShouldStopFetching = false private var mShouldStopFetching = false
private var mIsSearchOpen = false private var mIsSearchOpen = false
private var mWasDefaultFolderChecked = false
private var mLatestMediaId = 0L private var mLatestMediaId = 0L
private var mLatestMediaDateId = 0L private var mLatestMediaDateId = 0L
private var mCurrentPathPrefix = "" // used at "Group direct subfolders" for navigation private var mCurrentPathPrefix = "" // used at "Group direct subfolders" for navigation
@ -92,8 +93,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
appLaunched(BuildConfig.APPLICATION_ID) appLaunched(BuildConfig.APPLICATION_ID)
if (savedInstanceState == null) { if (savedInstanceState == null) {
openDefaultFolder()
config.temporarilyShowHidden = false config.temporarilyShowHidden = false
config.tempSkipDeleteConfirmation = false config.tempSkipDeleteConfirmation = false
removeTempFolder() removeTempFolder()
@ -436,6 +435,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private fun tryLoadGallery() { private fun tryLoadGallery() {
handlePermission(PERMISSION_WRITE_STORAGE) { handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) { if (it) {
if (!mWasDefaultFolderChecked) {
openDefaultFolder()
mWasDefaultFolderChecked = true
}
if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.gallery")) { if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.gallery")) {
ConfirmationDialog(this, "", R.string.upgraded_from_free, R.string.ok, 0) {} ConfirmationDialog(this, "", R.string.upgraded_from_free, R.string.ok, 0) {}
config.wasUpgradedFromFreeShown = true config.wasUpgradedFromFreeShown = true