Merge remote-tracking branch 'origin/main' into wails-v3
This commit is contained in:
@@ -10,6 +10,35 @@
|
||||
// @ts-ignore: Unused imports
|
||||
import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
|
||||
/**
|
||||
* CheckStorageAccess asks the filesystem rather than the permission
|
||||
* system.
|
||||
*
|
||||
* On Android this app holds MANAGE_EXTERNAL_STORAGE, which the user
|
||||
* grants on a Settings screen rather than in a dialog — so it can be
|
||||
* refused, revoked later, or simply never answered, and the permission
|
||||
* API is one more thing that can disagree with reality. Reading the
|
||||
* directory is the question the library scanner will actually ask, so
|
||||
* it is the one worth answering.
|
||||
*
|
||||
* It is deliberately not an error return: "we cannot read your music
|
||||
* yet" is a state the UI renders, not a failure of the call.
|
||||
*/
|
||||
export function CheckStorageAccess(): $CancellablePromise<$models.StorageAccess> {
|
||||
return $Call.ByID(1661980006);
|
||||
}
|
||||
|
||||
/**
|
||||
* DefaultBrowseRoot is where a folder picker should open.
|
||||
*/
|
||||
export function DefaultBrowseRoot(): $CancellablePromise<string> {
|
||||
return $Call.ByID(497852148);
|
||||
}
|
||||
|
||||
/**
|
||||
* DirectoryPicker opens a directory selection dialog.
|
||||
*
|
||||
@@ -20,6 +49,22 @@ export function DirectoryPicker(): $CancellablePromise<string> {
|
||||
return $Call.ByID(3245034282);
|
||||
}
|
||||
|
||||
/**
|
||||
* HasNativeDirectoryPicker reports whether this platform can open a
|
||||
* directory dialog at all.
|
||||
*
|
||||
* It is asked of the backend rather than tested in the frontend with
|
||||
* `System.IsAndroid()`, for three reasons. The dialog *is* backend code
|
||||
* — `DirectoryPicker` above — so this is the same package saying what
|
||||
* it can do. It answers for iOS too without the frontend enumerating
|
||||
* platforms. And it makes the frontend's fallback testable through the
|
||||
* ordinary transport fake instead of a module mock of the Wails
|
||||
* runtime, whose platform helpers read build constants.
|
||||
*/
|
||||
export function HasNativeDirectoryPicker(): $CancellablePromise<boolean> {
|
||||
return $Call.ByID(1028901937);
|
||||
}
|
||||
|
||||
/**
|
||||
* ImageFilePicker opens a file selection dialog filtered to image
|
||||
* files (JPEG, PNG). Returns the selected file path, or empty
|
||||
@@ -29,6 +74,30 @@ export function ImageFilePicker(): $CancellablePromise<string> {
|
||||
return $Call.ByID(3408786006);
|
||||
}
|
||||
|
||||
/**
|
||||
* ListDirectories returns the directories directly inside path, so the
|
||||
* frontend can draw a folder picker.
|
||||
*
|
||||
* **It exists because Android has no directory picker.** Wails' file
|
||||
* dialog can choose directories on every desktop platform, and on
|
||||
* Android it returns an error: the Storage Access Framework yields tree
|
||||
* URIs rather than filesystem paths, and a path is what this app's
|
||||
* entire library model is keyed on. Rather than teach the backend about
|
||||
* tree URIs, the app browses the filesystem itself — which it can do
|
||||
* because it holds all-files access (see the manifest).
|
||||
*
|
||||
* Three rules, each of which a picker gets wrong if it is not stated:
|
||||
* only directories are returned, because the caller is choosing a
|
||||
* library root and files are noise; unreadable children are skipped
|
||||
* rather than failing the whole listing, since Android's storage root
|
||||
* contains directories no app may enter; and hidden directories are
|
||||
* omitted, because a music library is not in one and `.thumbnails`
|
||||
* alone would swamp the list.
|
||||
*/
|
||||
export function ListDirectories(path: string): $CancellablePromise<$models.DirListing> {
|
||||
return $Call.ByID(692624856, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* PlaylistFilePicker opens a file selection dialog filtered
|
||||
* to M3U/M3U8 playlist files. Multiple files may be selected.
|
||||
|
||||
@@ -5,3 +5,9 @@ import * as FrontendUtil from "./frontendutil.js";
|
||||
export {
|
||||
FrontendUtil
|
||||
};
|
||||
|
||||
export type {
|
||||
DirEntry,
|
||||
DirListing,
|
||||
StorageAccess
|
||||
} from "./models.js";
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* DirEntry is one selectable directory in a listing.
|
||||
*/
|
||||
export interface DirEntry {
|
||||
"name": string;
|
||||
"path": string;
|
||||
}
|
||||
|
||||
/**
|
||||
* DirListing is one level of the filesystem, as a folder picker needs
|
||||
* it: where we are, what is above, and the directories below.
|
||||
*
|
||||
* Parent is empty at a root, which is what tells the UI not to draw an
|
||||
* "up" affordance rather than having it compute that from the path
|
||||
* separator.
|
||||
*/
|
||||
export interface DirListing {
|
||||
"path": string;
|
||||
"parent": string;
|
||||
"entries": DirEntry[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* StorageAccess reports whether the app can actually read the place the
|
||||
* user's music lives.
|
||||
*/
|
||||
export interface StorageAccess {
|
||||
"root": string;
|
||||
"readable": boolean;
|
||||
"reason": string;
|
||||
}
|
||||
Reference in New Issue
Block a user