mirror of
https://github.com/readest/readest.git
synced 2026-04-29 20:10:55 +00:00
feat(android): support custom data location on external sdcard (#2292)
Some checks are pending
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
Some checks are pending
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
This commit is contained in:
parent
34a5e58872
commit
50d7f9a9dd
13 changed files with 131 additions and 9 deletions
|
|
@ -588,6 +588,23 @@ class NativeBridgePlugin(private val activity: Activity): Plugin(activity) {
|
|||
}
|
||||
}
|
||||
|
||||
@Command
|
||||
fun get_external_sdcard_path(invoke: Invoke) {
|
||||
val result = JSObject()
|
||||
val externalDirs = activity.getExternalFilesDirs(null)
|
||||
for (file in externalDirs) {
|
||||
if (file != null && Environment.isExternalStorageRemovable(file)) {
|
||||
val pathParts = file.absolutePath.split("/Android/")
|
||||
if (pathParts.isNotEmpty()) {
|
||||
result.put("path", pathParts[0])
|
||||
invoke.resolve(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
result.put("path", null)
|
||||
invoke.resolve(result)
|
||||
}
|
||||
|
||||
@Command
|
||||
fun request_manage_storage_permission(invoke: Invoke) {
|
||||
val ret = JSObject()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue