Open NobleMathews opened 4 months ago
To address the issue with the root folder of internal storage being bannable and not unbannable in the app, follow these steps:
Modify the removeDir
method in MedialibraryUtils.kt
to include a check that prevents the root folder from being banned. Use the following code snippet:
fun removeDir(path: String) {
if (path != "/storage/emulated/0") {
runIO(Runnable { Medialibrary.getInstance().removeFolder(path) })
}
}
In the part of the UI code where context options are created, ensure that the option to ban the root folder is either not presented or is disabled. This change will prevent users from accidentally banning the root folder.
Provide a way to unban the root folder if it has been previously banned. This could involve making the unbanFolder
JNI method accessible in the UI, particularly in the Medialibrary folder selection screen.
If the UI context options are managed within StorageBrowserAdapter.kt
or VideoGridFragment.kt
, insert the necessary logic to avoid the root folder from being banned.
After implementing these changes, thoroughly test the application to confirm that the root folder can no longer be banned and that any previously banned root folder can be successfully unbanned through the user interface.
application/vlc-android/src/org/videolan/vlc/gui/helpers/MedialibraryUtils.kt:1-66 | Contains 'removeDir' method to be modified to prevent banning the root folder and methods to check if a folder is banned.
application/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.kt:52-167 | Includes logic for context menu options in storage browser, relevant for preventing root folder ban.
application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt:510-597 | Handles video context options, may need updates to allow unbanning of folders.
application/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt:66-208 | Related to storage browser UI, necessary for implementing root folder unbanning feature.
💡 To rerun Mayil, comment mayil-ai rerun
. Mayil will incorporate any new context added to the ticket. Include details in your rerun comment to guide Mayil!
If you have videos present at the root of your internal storage, when grouping by folder, you will have a folder with the name "0" (/storage/emulated/0) with videos inside. If you decide to ban this folder from the context options in the video section, without thinking that it is the medialibrary root, you will be able to re-enable it through Medialibrary folder selection screen, it will fail because the folder is banned. Problem, on this view, you can't do a long press to unban a folder, requiring the user to reset the medialibrary, as all folders in the root are also banned by extension.
Expected behavior You should not be able to ban a medialibrary root. From the app at least.