Open the bundled manual from Help and from Settings
The packages now carry the manual, but nothing in the application opened it: the help sheet listed gestures and stopped there. The help sheet gains a Manual button beside Done, and Settings a Manual row under About beside the version. Both go through dr_ui::manual, which finds the installed page through dr_plat::system_data_dirs (the package's share directory on Linux, the executable's directory on Windows), and a development build also in the checkout it was compiled from. A copy with no manual says so on the status line rather than doing nothing. On the desktop the page goes to the system browser. A section is a URL fragment, and xdg-open's generic mode and Windows' FileProtocolHandler both turn a file: URL into a path and drop the fragment, so a section is opened through a one-line redirect page written to the data directory: the opener gets a plain path, which every opener keeps, and the browser follows the redirect to index.html#section itself. The launcher behind the sign-in's open_in_browser is split out so both share it; the https check stays with the sign-in. Android has no path to give a browser: an asset is not a file, a copy in private storage is unreadable to other apps, a file: URI across apps is refused, and a content: URI leaves the browser resolving every picture against the provider. So ManualActivity, a WebView reading file:///android_asset/manual/index.html straight out of the APK, shows it, started by class name with the section as an extra. JavaScript is off, links off the page go to the browser, and the theme is day-night so the page's own light and dark follow the system. A test checks that the manifest, the Java class and dr_ui agree on the name and the extra.
This commit is contained in:
@@ -847,6 +847,16 @@ fn open_in_browser(url: &str) -> std::io::Result<()> {
|
||||
format!("refusing to open a sign-in address that is not https: {url}"),
|
||||
));
|
||||
}
|
||||
hand_to_system(url)
|
||||
}
|
||||
|
||||
/// Hand `target` — a URL, or a local file's path — to whatever the platform
|
||||
/// opens it with.
|
||||
///
|
||||
/// No check on what it is: [`open_in_browser`] is the caller with a server's
|
||||
/// URL in hand and refuses anything but https before it gets here, and
|
||||
/// `manual::open` hands over a page it wrote itself.
|
||||
pub(crate) fn hand_to_system(url: &str) -> std::io::Result<()> {
|
||||
// Not `target_os = "linux"`: Android is its own target_os, and reached this
|
||||
// arm's `Ok(())` fallback, so the browser silently never opened.
|
||||
#[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))]
|
||||
|
||||
Reference in New Issue
Block a user