* Save a new path using storage access framework * @param {String} name * @returns {Promise<{name: String, uri: String, uuid: string}>}
(name, uuid)
| 25 | * @returns {Promise<{name: String, uri: String, uuid: string}>} |
| 26 | */ |
| 27 | async addPath(name, uuid) { |
| 28 | const res = await multiPrompt( |
| 29 | strings["add path"], |
| 30 | [ |
| 31 | { |
| 32 | id: "uri", |
| 33 | placeholder: strings["select folder"], |
| 34 | type: "text", |
| 35 | required: true, |
| 36 | readOnly: true, |
| 37 | onclick() { |
| 38 | sdcard.getStorageAccessPermission( |
| 39 | uuid, |
| 40 | (res) => { |
| 41 | const $name = tag.get("#name"); |
| 42 | if (!$name.value && res) { |
| 43 | const name = window |
| 44 | .decodeURIComponent(res) |
| 45 | ?.split(":") |
| 46 | .pop() |
| 47 | ?.split("/") |
| 48 | .pop(); |
| 49 | $name.value = name ?? ""; |
| 50 | } |
| 51 | this.value = res; |
| 52 | }, |
| 53 | (err) => { |
| 54 | helpers.error(err); |
| 55 | }, |
| 56 | ); |
| 57 | }, |
| 58 | }, |
| 59 | { |
| 60 | id: "name", |
| 61 | placeholder: strings["folder name"], |
| 62 | type: "text", |
| 63 | required: true, |
| 64 | value: name ?? "", |
| 65 | }, |
| 66 | ], |
| 67 | "https://acode.app/faqs/224761680", |
| 68 | ); |
| 69 | |
| 70 | if (!res) return; |
| 71 | |
| 72 | return { |
| 73 | name: res.name, |
| 74 | uri: res.uri, |
| 75 | uuid: helpers.uuid(), |
| 76 | }; |
| 77 | }, |
| 78 | }; |
nothing calls this directly
no test coverage detected