[Android] Prevent ML scan to be ran during onboarding
Nicolas Pomepuy
git at videolan.org
Mon Jul 5 11:12:29 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Jun 23 06:49:14 2021 +0200| [e7c70a79be6131866faee7905668ed4de673a228] | committer: Nicolas Pomepuy
Prevent ML scan to be ran during onboarding
> https://code.videolan.org/videolan/vlc-android/commit/e7c70a79be6131866faee7905668ed4de673a228
---
.../org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt
index 58af2fbf1..ace31f178 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt
@@ -47,6 +47,8 @@ import org.videolan.resources.util.startMedialibrary
import org.videolan.tools.INITIAL_PERMISSION_ASKED
import org.videolan.tools.Settings
import org.videolan.tools.putSingle
+import org.videolan.vlc.gui.onboarding.ONBOARDING_DONE_KEY
+import org.videolan.vlc.gui.onboarding.OnboardingActivity
import org.videolan.vlc.util.FileUtils
import org.videolan.vlc.util.Permissions
import org.videolan.vlc.util.Permissions.canReadStorage
@@ -138,11 +140,13 @@ class StoragePermissionsDelegate : BaseHeadlessFragment() {
val intent = intent
val upgrade = intent?.getBooleanExtra(EXTRA_UPGRADE, false) ?: false
val firstRun = upgrade && intent.getBooleanExtra(EXTRA_FIRST_RUN, false)
+ val settings = Settings.getInstance(this)
lifecycleScope.launch {
val granted = getStoragePermission(write)
val model : PermissionViewmodel by viewModels()
if (model.permissionPending) model.deferredGrant.complete(granted)
- if (granted) (cb ?: getAction(this at askStoragePermission, firstRun, upgrade)).run()
+ if (granted && withContext(Dispatchers.IO) { settings.getBoolean(ONBOARDING_DONE_KEY, false) })
+ (cb ?: getAction(this at askStoragePermission, firstRun, upgrade)).run()
}
}
More information about the Android
mailing list