plat/apple_ios_services.rs (Apple)#
Source: lib/plat/apple_ios_services.rs
apple_ios_services -- iOS's system services of AP5b (docs/APPLE.md): the clipboard (UIPasteboard),
the system's file picker (UIDocumentPickerViewController), notifications (UNUserNotificationCenter).
clip_set / clip_set_many / clip_get / clip_has as on macOS (apple_mac.rs): one pasteboard item
with a representation per format (text as a string); CLIP_IMAGE gets a
PNG, else any image of the pasteboard (JPEG, HEIC, TIFF) made a PNG
through UIImage
file_dialog(flags, path, exts) -> (FD_PENDING, 0) the picker over the scene's window, as
Android's: FD_OPEN opens a document in place (its types from the
extensions), FD_FOLDER a folder, FD_SAVE exports an empty file of the
suggested name to where the user puts it (the app writes it then);
one at a time ((0, 0) while one is open), (-1, 0) without a window
file_dialog_poll() None while it is open, then once (1, 0, path) / (0, 0, "") -- the
path a security-scoped URL's, its access started for the session
bookmarks_restore() (the host's launch) the files and folders chosen in earlier runs
readable again: each choice leaves a bookmark in the app's
container ($HOME/Library/jfgui/bookmarks, newest first, at most
BM_MAX, a path once); the launch resolves them and starts their
access, so the same path opens again (a recent file, a saved
setting). A file moved meanwhile is kept under its new path (the
old one no longer opens); one gone is dropped
notes::* (tray.rs) notifications: no symbol of a notification area on iOS;
notify asks the user once (alert, sound) and hands the note to the
centre when allowed -- refused, it goes away at once (NoteClosed); one
arriving while the app is in front shows all the same; a tap opens the
app: NoteClicked. Only in an app (a bundle identifier).
Reading what another app copied makes iOS ask the user once ("Allow Paste"); asking which types the
pasteboard has does not.
fn clip_set(fmt: u32, data: &[u8]) -> boolCLIP_TEXT / CLIP_HTML / CLIP_RTF / CLIP_DOCX as clip_set_many; CLIP_PNG: the PNG file; CLIP_IMAGE: a CLIPIMG record (clipimg_pack): its PNG, else a PNG made of its BMPfn clip_set_many(entries: &[(u32, &[u8])]) -> boolseveral representations of one selection (text formats, cliprich.rs)fn clip_get(fmt: u32) -> Option<Vec<u8>>CLIP_IMAGE: the PNG, else any image of the pasteboard as a PNGfn clip_has(fmt: u32) -> boolthe pasteboard offers the format (nothing is read: no question to the user)fn file_dialog(flags: u32, path: &mut String, extensions: &[&str]) -> (i32, u32)the system's picker (see the module header) -> (FD_PENDING, 0), (0, 0) while one is open, (-1, 0) without a windowfn file_dialog_poll() -> Option<(i32, u32, String)>the picker's answer (see the module header)fn ios_bookmark_add(path: &str) -> bool(tests) a path kept as if the picker had chosen it -> its bookmark made and kept in frontfn ios_bookmark_paths() -> Vec<String>(tests) the kept paths, newest firstfn ios_bookmarks_restore()(tests) what the host's launch does: every kept bookmark resolved, the list renewedfn ios_bookmarks_clear()(tests) none kept