wip: Android Gradle project, crash reports, docs, CI job, notices
This commit is contained in:
1 parent
47b7e02e81
commit
1b95e8b504
35 files changed
+1590
-9
No files matched your search
@@ -26,6 +26,7 @@ rustls-platform-verifier = "0.7.1"
|
||||
slint = { version = "1.18", default-features = false, features = ["std", "compat-1-2", "backend-android-activity-06"] }
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
tsc-media = { path = "../tsc-media", default-features = false }
|
||||
tsc-platform = { path = "../tsc-platform", default-features = false }
|
||||
tsc-store = { path = "../tsc-store" }
|
||||
tsc-ui = { path = "../tsc-ui" }
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//! (the process can outlive activities while voice runs in the service).
|
||||
//! Process-wide setup happens once; the window is built per activity.
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::{Mutex, Once, OnceLock, PoisonError};
|
||||
|
||||
use anyhow::Context as _;
|
||||
@@ -15,6 +16,9 @@ use crate::foreground::Foreground;
|
||||
use crate::host::EngineHost;
|
||||
use crate::{bridge, capture, secrets};
|
||||
|
||||
/// Store setting (`bool`): the user's opt-in to local crash reports.
|
||||
pub const CRASH_REPORTS_SETTING: &str = "crash_reports";
|
||||
|
||||
static HOST: OnceLock<EngineHost> = OnceLock::new();
|
||||
static FOREGROUND: Mutex<Option<Foreground>> = Mutex::new(None);
|
||||
|
||||
@@ -56,6 +60,8 @@ fn init_logging() {
|
||||
}
|
||||
|
||||
fn run(app: AndroidApp) -> anyhow::Result<()> {
|
||||
let data_dir = app.internal_data_path().context("the app has no internal storage path")?;
|
||||
install_crash_reports(&data_dir);
|
||||
jni::JavaVM::singleton()?.attach_current_thread(|env| -> jni::errors::Result<()> {
|
||||
bridge::init(env)?;
|
||||
// reqwest (HTTPS queries, tsclientlib) verifies certificates with
|
||||
@@ -74,7 +80,6 @@ fn run(app: AndroidApp) -> anyhow::Result<()> {
|
||||
warn!("requesting permissions: {e}");
|
||||
}
|
||||
|
||||
let data_dir = app.internal_data_path().context("the app has no internal storage path")?;
|
||||
slint::android::init(app).context("Slint Android backend")?;
|
||||
let attached = host.attach();
|
||||
tsc_ui::run(tsc_ui::RunOptions {
|
||||
@@ -88,6 +93,17 @@ fn run(app: AndroidApp) -> anyhow::Result<()> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Local crash reports in `<files dir>/crash-reports`, recorded only if the
|
||||
/// user opted in (off by default).
|
||||
fn install_crash_reports(data_dir: &Path) {
|
||||
tsc_platform::crash::set_app_version(env!("CARGO_PKG_VERSION"));
|
||||
let enabled = tsc_store::Store::open(&data_dir.join("client.db"))
|
||||
.ok()
|
||||
.and_then(|store| store.setting::<bool>(CRASH_REPORTS_SETTING).ok().flatten())
|
||||
.unwrap_or(false);
|
||||
tsc_platform::crash::install(data_dir.join(tsc_platform::crash::DIR_NAME), enabled);
|
||||
}
|
||||
|
||||
/// Keep the voice foreground service in step with the voice connections.
|
||||
fn watch_voice(host: &'static EngineHost) {
|
||||
let mut events = host.engine().subscribe();
|
||||
|
||||
@@ -391,8 +391,19 @@ export component MainWindow inherits Window {
|
||||
changed width => { narrow = self.width < 800px; }
|
||||
init => { narrow = self.width < 800px; }
|
||||
property <int> pane: 1;
|
||||
// Android: the space under the on-screen keyboard (the window is not
|
||||
// resized for it). Zero on desktop.
|
||||
property <length> keyboard-inset: 0;
|
||||
changed virtual-keyboard-size => {
|
||||
keyboard-inset = self.virtual-keyboard-size.height > 0 ? self.height - self.virtual-keyboard-position.y : 0;
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
// Android draws the window under the status and navigation bars.
|
||||
padding-top: root.safe-area-insets.top;
|
||||
padding-left: root.safe-area-insets.left;
|
||||
padding-right: root.safe-area-insets.right;
|
||||
padding-bottom: max(root.safe-area-insets.bottom, root.keyboard-inset);
|
||||
// Toolbar
|
||||
Rectangle {
|
||||
height: 48px;
|
||||
|
||||
Reference in new issue
Block a user