Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.
ci: the UI check loads Home with a paired phone
Bee29c75a2b872d
diff --git a/core/nectarlink-core/src/lib.rs b/core/nectarlink-core/src/lib.rsindex 6f25c32..2205160 100644--- a/core/nectarlink-core/src/lib.rs+++ b/core/nectarlink-core/src/lib.rs@@ -190,6 +190,27 @@ pub(crate) fn now_unix_ms() -> i64 {.unwrap_or_default()}+/// Adds a made-up paired phone to the store in `data_dir`, so the desktop+/// app's UI check (`--ui-check`, in a throwaway data folder) also loads the+/// pages that only show with a phone. It never connects. Not for a real data+/// folder.+#[doc(hidden)]+pub fn add_ui_check_phone(data_dir: &std::path::Path) -> Result<DeviceId> {+ let id = device_id(&iroh::SecretKey::from_bytes(&[7; 32]).public());+ let info = DeviceInfo {+ name: "UI check phone".into(),+ kind: DeviceKind::Phone,+ os: "android".into(),+ os_ver: "16".into(),+ model: Some("Pixel".into()),+ accent: None,+ screen: None,+ install_id: None,+ };+ store::Store::open(data_dir)?.upsert_peer(&id, &info, now_unix())?;+ Ok(id)+}+/// On Android: lets the network code read the phone's own DNS servers/// (through Java), instead of falling back to public ones that some/// networks block. Call once, before any [`Node`] starts.diff --git a/desktop/app/src/main.rs b/desktop/app/src/main.rsindex 4e0c857..1276343 100644--- a/desktop/app/src/main.rs+++ b/desktop/app/src/main.rs@@ -518,6 +518,14 @@ fn main() -> ExitCode {}logging::init(&data_dir);install_panic_logging();+ // Home and the other phone pages only load with a paired phone, and a+ // page that fails to load must fail the check.+ if options.ui_check+ && let Err(e) = nectarlink_core::add_ui_check_phone(&data_dir)+ {+ eprintln!("nectarlink: --ui-check: can't add the pretend phone: {e}");+ return ExitCode::FAILURE;+ }if options.widget_provider {return win::widget::run_provider(&data_dir);}diff --git a/scripts/ui-check.ps1 b/scripts/ui-check.ps1index 0fced72..b72afc6 100644--- a/scripts/ui-check.ps1+++ b/scripts/ui-check.ps1@@ -12,6 +12,11 @@component that didn't load. The QML tests can't catch that for the app'swindows, which need the Rust singletons and NativeWindow.+ It runs twice: once on a fresh folder (the first-run walkthrough), and+ once with the walkthrough done, so Home opens. Both times the app adds a+ pretend paired phone to the folder, so the pages that only show with a+ phone load too.+-Exe defaults to the staged package (scripts\package.ps1), which has itsQt libraries next to it; for target\release, pass -Exe and have Qt's binfolder on PATH.@@ -28,19 +33,25 @@ $repo = Split-Path -Parent $PSScriptRootif (-not $Exe) { $Exe = Join-Path $repo 'target\package\Nectarlink\nectarlink-desktop.exe' }if (-not (Test-Path $Exe)) { throw "$Exe not found; run scripts\package.ps1 -StageOnly first, or pass -Exe" }-$data = Join-Path $repo 'target\ui-check'-if (Test-Path $data) { Remove-Item -Recurse -Force $data }-New-Item -ItemType Directory -Force $data | Out-Null-$stderr = Join-Path $data 'stderr.txt'+foreach ($pass in @('walkthrough', 'home')) {+ Write-Host "UI check: $pass"+ $data = Join-Path $repo "target\ui-check\$pass"+ if (Test-Path $data) { Remove-Item -Recurse -Force $data }+ New-Item -ItemType Directory -Force $data | Out-Null+ if ($pass -eq 'home') {+ [System.IO.File]::WriteAllText((Join-Path $data 'desktop-settings.json'), '{ "walkthroughCompleted": true }')+ }+ $stderr = Join-Path $data 'stderr.txt'-$env:NECTARLINK_NO_ADB = '1'-$app = Start-Process $Exe -ArgumentList '--ui-check', '--data-dir', "`"$data`"" `- -RedirectStandardError $stderr -PassThru -NoNewWindow-# Without the handle, ExitCode stays empty after the process exits.-$null = $app.Handle-if (-not $app.WaitForExit(120000)) {- $app.Kill()- throw "the app didn't quit within 2 minutes"+ $env:NECTARLINK_NO_ADB = '1'+ $app = Start-Process $Exe -ArgumentList '--ui-check', '--data-dir', "`"$data`"" `+ -RedirectStandardError $stderr -PassThru -NoNewWindow+ # Without the handle, ExitCode stays empty after the process exits.+ $null = $app.Handle+ if (-not $app.WaitForExit(120000)) {+ $app.Kill()+ throw "the app didn't quit within 2 minutes"+ }+ Get-Content $stderr | Write-Host+ if ($app.ExitCode -ne 0) { throw "UI check ($pass) failed (exit code $($app.ExitCode))" }}-Get-Content $stderr | Write-Host-if ($app.ExitCode -ne 0) { throw "UI check failed (exit code $($app.ExitCode))" }