SHA256
Compare commits
5
Commits
11bf4ca620
...
40a7962307
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
40a7962307 | ||
|
|
1433e1670a | ||
|
|
8c480ddca3 | ||
|
|
81973c3c45 | ||
|
|
97570b7fdf |
No files matched your search
@@ -16,3 +16,4 @@ max_line_length = 140
|
||||
ktlint_code_style = android_studio
|
||||
ij_kotlin_allow_trailing_comma = true
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = true
|
||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||
@@ -37,8 +37,16 @@ jobs:
|
||||
python3 -m py_compile scripts/*.py
|
||||
python3 scripts/test-verifier.py
|
||||
python3 scripts/test-ci-runner.py
|
||||
python3 scripts/test-integration-evidence.py
|
||||
- name: Check dependencies against OSV
|
||||
run: python3 scripts/check-dependencies.py
|
||||
- name: Upload installable native debug preview
|
||||
uses: https://gitea.com/actions/upload-artifact@c6a3b2bd78b3985e4b2f15397fec357f0fd808de
|
||||
with:
|
||||
name: android-native-debug-apk
|
||||
path: android/app/build/outputs/apk/debug/app-debug.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
- uses: https://gitea.com/actions/upload-artifact@c6a3b2bd78b3985e4b2f15397fec357f0fd808de # v3.2.2-node20 (Gitea artifact protocol)
|
||||
if: always()
|
||||
with:
|
||||
@@ -96,7 +104,9 @@ jobs:
|
||||
if: always()
|
||||
with:
|
||||
name: android-device-test-reports-${{ matrix.api }}
|
||||
path: android/app/build/reports/androidTests/
|
||||
path: |
|
||||
android/app/build/reports/androidTests/
|
||||
android/app/build/outputs/native-screenshots/
|
||||
retention-days: 14
|
||||
- name: Remove only this job's allocated upstream fixture
|
||||
if: always()
|
||||
|
||||
@@ -14,6 +14,25 @@ jobs:
|
||||
runs-on: macos-arm64
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Bootstrap verified native Node before JavaScript actions
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test "$(uname -s)" = Darwin && test "$(uname -m)" = arm64
|
||||
cache="${RUNNER_TOOL_CACHE:-$HOME/.cache/yuvomi-tools}"
|
||||
target="$cache/yuvomi-node-22.22.1-darwin-arm64"
|
||||
mkdir -p "$cache"
|
||||
if [ ! -x "$target/bin/node" ]; then
|
||||
test ! -e "$target"
|
||||
temporary=$(mktemp -d "$cache/yuvomi-node-bootstrap.XXXXXX")
|
||||
trap 'rm -rf -- "$temporary"' EXIT
|
||||
curl --fail --location https://nodejs.org/dist/v22.22.1/node-v22.22.1-darwin-arm64.tar.gz -o "$temporary/node.tar.gz"
|
||||
printf '%s %s\n' 679ad4966339e4ef4900f57996714864e4211b898825bb840c3086c419fbcef2 "$temporary/node.tar.gz" | shasum -a 256 -c -
|
||||
tar -xzf "$temporary/node.tar.gz" -C "$temporary"
|
||||
mv "$temporary/node-v22.22.1-darwin-arm64" "$target"
|
||||
fi
|
||||
test "$("$target/bin/node" -p 'process.arch')" = arm64
|
||||
echo "$target/bin" >> "$GITHUB_PATH"
|
||||
"$target/bin/node" --version
|
||||
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
env:
|
||||
GIT_DEFAULT_HASH: sha256
|
||||
@@ -29,7 +48,7 @@ jobs:
|
||||
bash scripts/install-xcodegen.sh "$YUVOMI_CI_TEMP/xcodegen"
|
||||
"$YUVOMI_CI_TEMP/xcodegen/xcodegen/bin/xcodegen" generate --spec ios/project.yml
|
||||
xcodebuild -version
|
||||
- name: Portable URL policy tests and Swift syntax
|
||||
- name: Portable native API/contract tests and Swift syntax
|
||||
run: |
|
||||
swift test --package-path ios --scratch-path "$YUVOMI_CI_TEMP/SwiftPolicy"
|
||||
swiftc -frontend -parse ios/Sources/*.swift ios/Tests/*.swift ios/UITests/*.swift
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Begin the genuine native rebuild: Compose/SwiftUI screens, direct HTTPS API,
|
||||
protected native session storage and initial auth/dashboard/task/note/shopping
|
||||
flows. Archive the rejected WebView renderer and its tests. Full PWA parity is
|
||||
explicitly incomplete; see `docs/native-parity.md`.
|
||||
|
||||
- Gitea workflows for the maintainer's Ubuntu pool and native M4 Pro runner,
|
||||
explicit SDK/KVM prerequisites, SHA-256 checkout and unsigned-only CI release builds.
|
||||
|
||||
|
||||
+3
-1
@@ -11,7 +11,9 @@ Add regression tests with security fixes, and demonstrate that the test fails
|
||||
without the fix. Do not commit build outputs, credentials, private signing keys,
|
||||
local servers, generated fixture certificates, or production household data.
|
||||
|
||||
Keep platform integrations native and dependencies minimal. The server owns
|
||||
Keep all application screens native (Compose/SwiftUI), not just platform
|
||||
integrations. No WebView fallback for unfinished modules; use the parity tracker
|
||||
and never count archived browser tests as native evidence. Keep dependencies minimal. The server owns
|
||||
business logic, authentication, CSRF, and authorization. Never solve compatibility
|
||||
by disabling TLS, accepting every origin, or copying a browser's session cookies.
|
||||
Upstream prohibits frontend frameworks, bundlers, and transpilers in its own
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
# Yuvomi Mobile
|
||||
|
||||
Independent, community-maintained Android (Kotlin/WebView) and iOS
|
||||
(SwiftUI/WKWebView) companions for user-owned [Yuvomi](https://github.com/ulsklyc/yuvomi)
|
||||
servers. Not affiliated with or endorsed by upstream.
|
||||
Independent native Android (Kotlin/Jetpack Compose) and iOS (SwiftUI) clients for
|
||||
user-owned [Yuvomi](https://github.com/ulsklyc/yuvomi) servers. Not affiliated with
|
||||
or endorsed by upstream.
|
||||
|
||||
**Development build - not production-ready.** See [validation status](docs/validation.md).
|
||||
**Native rebuild in progress — not full PWA parity or production-ready.**
|
||||
The previous WebView wrapper did not meet the requested native implementation.
|
||||
It is archived under `legacy/` and is not the shipped application surface.
|
||||
Read the [feature-by-feature parity tracker](docs/native-parity.md) and
|
||||
[current validation](docs/validation.md) before installing a preview.
|
||||
No mobile backend, advertisements, telemetry, tracking, subscriptions, or mandatory cloud.
|
||||
The configured server supplies the application and retains responsibility for its own
|
||||
integrations, version checks, security and privacy.
|
||||
The apps render native controls and call the existing server API. The server owns
|
||||
authorization, recurrence, synchronization and household business rules.
|
||||
|
||||
Use a root-hosted HTTPS instance with a valid certificate, including private servers
|
||||
accessible through your VPN. Custom ports are supported. HTTP and subpath deployments
|
||||
are intentionally rejected. Enter the server on first launch; use Server settings to
|
||||
reconnect or erase local browsing data and switch installations.
|
||||
are intentionally rejected. Enter the server on first launch; use **Mehr** to
|
||||
remove the native session and switch installations. The native client does not
|
||||
import a browser/WebView session; sign in again after upgrading the prototype.
|
||||
|
||||
- [Architecture](docs/architecture.md)
|
||||
- [Native preview delivery report](docs/native-delivery-report.md)
|
||||
- [Android build](docs/build-android.md) / [iOS build](docs/build-ios.md)
|
||||
- [Compatibility and authentication](docs/server-compatibility.md)
|
||||
- [Release process](docs/release-process.md)
|
||||
|
||||
+53
-1
@@ -1,4 +1,56 @@
|
||||
# Security policy
|
||||
# Security policy — native rebuild
|
||||
|
||||
**The current native client is an incomplete development preview, not an audited
|
||||
release or full PWA replacement.** See [native parity](docs/native-parity.md).
|
||||
|
||||
Report vulnerabilities privately to the repository owner through an established
|
||||
private channel. No reporting mailbox has been provided; do not invent one or put
|
||||
cookies, keys, household records or exploit details into public issues. Upstream
|
||||
server vulnerabilities belong in its private reporting channel.
|
||||
|
||||
## Current native security model
|
||||
|
||||
- Native Compose/SwiftUI screens call one configured HTTPS origin. System TLS
|
||||
validation is mandatory and API redirects are refused. No WebView/WKWebView is
|
||||
shipped as the app surface or used as a missing-feature fallback.
|
||||
- Passwords and second-factor codes exist transiently for the API request; they
|
||||
are not saved to preferences, keychains, logs, artifacts or application state
|
||||
restoration. Server cookies, not passwords, persist the session.
|
||||
- Android persists allow-listed Secure cookies with their absolute expiry in
|
||||
AES-GCM ciphertext backed by AndroidKeyStore, with the origin authenticated as
|
||||
additional data. iOS uses a private ephemeral URLSession jar and origin-scoped
|
||||
Keychain items protected with WhenUnlockedThisDeviceOnly.
|
||||
- CSRF tokens follow the upstream API protocol. Only an explicit `csrf_invalid`
|
||||
rejection allows one refresh/retry. Other permission errors or ambiguous network
|
||||
failures never cause automatic mutation replay. The server remains authoritative
|
||||
for authorization, recurrence, reward accounting and cross-module rules.
|
||||
- Reads are bounded and timed out. There is no offline mutation queue or native
|
||||
remote push implementation. Missing features are documented, not simulated.
|
||||
- Logout attempts remote revocation and clears the native local session. Local
|
||||
server removal is not remote revocation. Old prototype WebKit data is not
|
||||
imported; use OS app-data removal/reinstall to erase that legacy installation.
|
||||
- Android screenshots are blocked. The iOS view is obscured while inactive. The
|
||||
Android integration test temporarily permits a screenshot only of its synthetic
|
||||
private fixture, restores the restriction and never uses real household data.
|
||||
- The owner-authorized initial signing key is backed up outside the repository.
|
||||
Four repository signing secrets exist, but signing/release changes are parked
|
||||
during the native rebuild. No private key belongs in Git or downloadable CI
|
||||
artifacts. Protect trusted-branch write access and isolate persistent runners.
|
||||
|
||||
## Mandatory gates
|
||||
|
||||
Native transports, secure storage, session erasure, actual Apple SDK compilation,
|
||||
real-device behavior, accessibility, supported authentication flows and dependency
|
||||
resolution need review and evidence before release. OIDC, file transfers, offline
|
||||
storage and the remaining modules are not implemented native capabilities yet.
|
||||
Advisory scans and parser/unit checks are not a guarantee that code is secure.
|
||||
|
||||
The superseded prototype policy is retained below as historical context only;
|
||||
it must not be used to claim capabilities of the native rebuild.
|
||||
|
||||
---
|
||||
|
||||
## Historical WebView prototype policy
|
||||
|
||||
**Development software: no production-readiness claim.** Only the current
|
||||
development branch is maintained; no stable mobile release exists yet.
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
Yuvomi Mobile is an independent community contribution, not an official Yuvomi
|
||||
product. Yuvomi's name identifies the server with which it interoperates.
|
||||
Visual color values follow upstream DESIGN.md. No upstream logo is redistributed.
|
||||
Native design-token mappings follow upstream DESIGN.md/styles. The native
|
||||
three-circle brand mark is redrawn from upstream's published brand geometry and
|
||||
colors (`public/utils/brand-mark.js` and `docs/logo.svg`); its MIT attribution is
|
||||
preserved below. No affiliation or trademark ownership is implied.
|
||||
|
||||
Upstream Yuvomi: https://github.com/ulsklyc/yuvomi
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -9,8 +10,8 @@ android {
|
||||
applicationId = "community.yuvomi.mobile"
|
||||
minSdk = 26
|
||||
targetSdk = 37
|
||||
versionCode = 1
|
||||
versionName = "0.1.0"
|
||||
versionCode = 2
|
||||
versionName = "0.2.0-native-preview"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
@@ -33,6 +34,11 @@ android {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
buildFeatures { compose = true }
|
||||
sourceSets.getByName("androidTest").kotlin.directories.apply {
|
||||
clear()
|
||||
add("src/androidTestNative/java")
|
||||
}
|
||||
lint {
|
||||
abortOnError = true
|
||||
warningsAsErrors = true
|
||||
@@ -41,7 +47,7 @@ android {
|
||||
testBuildType = "integration"
|
||||
sourceSets.getByName(
|
||||
"androidTest",
|
||||
).kotlin.directories.add("src/androidTestIntegration/java")
|
||||
).kotlin.directories.add("src/androidTestNativeIntegration/java")
|
||||
val testResources = providers.environmentVariable("YUVOMI_TEST_RES").get()
|
||||
sourceSets.getByName("integration").res.directories.add(testResources)
|
||||
defaultConfig.testInstrumentationRunnerArguments["server"] =
|
||||
@@ -89,9 +95,13 @@ configurations.configureEach {
|
||||
dependencies {
|
||||
implementation("androidx.activity:activity-ktx:1.10.1")
|
||||
implementation("androidx.core:core-ktx:1.16.0")
|
||||
implementation("androidx.webkit:webkit:1.14.0")
|
||||
implementation("androidx.activity:activity-compose:1.10.1")
|
||||
implementation("androidx.compose.material3:material3:1.4.0")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.9.4")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("org.json:json:20260814")
|
||||
androidTestImplementation("androidx.test:runner:1.6.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.9.0")
|
||||
}
|
||||
+99
-48
@@ -2,33 +2,86 @@
|
||||
# Manual edits can break the build and are not advised.
|
||||
# This file is expected to be part of source control.
|
||||
# To regenerate this file, run: ./gradlew :app:dependencies --write-locks
|
||||
androidx.activity:activity-ktx:1.10.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.activity:activity:1.10.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.annotation:annotation-experimental:1.4.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.annotation:annotation-jvm:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.annotation:annotation:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.arch.core:core-common:2.2.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.arch.core:core-runtime:2.2.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.collection:collection-jvm:1.4.2=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.collection:collection:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,releaseCompileClasspath
|
||||
androidx.collection:collection:1.4.2=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.activity:activity-compose:1.10.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.activity:activity-ktx:1.10.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.activity:activity:1.10.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.annotation:annotation-experimental:1.4.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.annotation:annotation-jvm:1.9.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.annotation:annotation:1.9.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.arch.core:core-common:2.2.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.arch.core:core-runtime:2.2.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.autofill:autofill:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.collection:collection-jvm:1.5.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.collection:collection-ktx:1.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.collection:collection:1.5.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.animation:animation-android:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.animation:animation-core-android:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.animation:animation-core:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.animation:animation:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.foundation:foundation-android:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.foundation:foundation-layout-android:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.foundation:foundation-layout:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.foundation:foundation:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.material3:material3-android:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.material3:material3:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.material:material-ripple-android:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.material:material-ripple:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.runtime:runtime-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.runtime:runtime-annotation-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.runtime:runtime-annotation:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.runtime:runtime-saveable-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.runtime:runtime-saveable:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.runtime:runtime:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-geometry-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-geometry:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-graphics-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-graphics:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-test-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.compose.ui:ui-test-junit4-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.compose.ui:ui-test-junit4:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.compose.ui:ui-test:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.compose.ui:ui-text-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-text:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-unit-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-unit:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-util-android:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui-util:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.compose.ui:ui:1.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.concurrent:concurrent-futures-ktx:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.concurrent:concurrent-futures:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.core:core-ktx:1.16.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.core:core-viewtree:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.core:core:1.16.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.interpolator:interpolator:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-common:2.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-livedata-core:2.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime-ktx:2.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime:2.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel:2.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.profileinstaller:profileinstaller:1.4.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.savedstate:savedstate-ktx:1.2.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.savedstate:savedstate:1.2.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.startup:startup-runtime:1.1.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.core:core-ktx:1.16.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.core:core-viewtree:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.core:core:1.16.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.customview:customview-poolingcontainer:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.emoji2:emoji2:1.4.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.graphics:graphics-path:1.0.1=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.interpolator:interpolator:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-common-java8:2.9.4=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-common-jvm:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-common:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-livedata-core:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-process:2.9.4=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime-android:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime-compose-android:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime-compose:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime-ktx-android:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime-ktx:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-runtime:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-android:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-compose-android:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-compose:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.lifecycle:lifecycle-viewmodel:2.9.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.profileinstaller:profileinstaller:1.4.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.savedstate:savedstate-android:1.3.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.savedstate:savedstate-compose-android:1.3.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.savedstate:savedstate-compose:1.3.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.savedstate:savedstate-ktx:1.3.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.savedstate:savedstate:1.3.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.startup:startup-runtime:1.1.1=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.test.espresso:espresso-core:3.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.test.espresso:espresso-idling-resource:3.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.test.ext:junit:1.2.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
@@ -38,8 +91,7 @@ androidx.test:monitor:1.7.2=debugAndroidTestCompileClasspath,debugAndroidTestLin
|
||||
androidx.test:runner:1.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
androidx.tracing:tracing:1.1.0=debugAndroidTestCompileClasspath
|
||||
androidx.tracing:tracing:1.2.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.versionedparcelable:versionedparcelable:1.1.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.webkit:webkit:1.14.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
androidx.versionedparcelable:versionedparcelable:1.1.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
com.android.tools.analytics-library:protos:32.4.1=androidLintTool
|
||||
com.android.tools.analytics-library:shared:32.4.1=androidLintTool
|
||||
com.android.tools.analytics-library:tracker:32.4.1=androidLintTool
|
||||
@@ -107,6 +159,7 @@ org.glassfish.jaxb:jaxb-runtime:2.3.2=androidLintTool
|
||||
org.glassfish.jaxb:txw2:2.3.2=androidLintTool
|
||||
org.hamcrest:hamcrest-core:1.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath
|
||||
org.hamcrest:hamcrest-library:1.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
org.jetbrains.kotlin:compose-group-mapping:2.4.21=composeMappingProducerClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-tools-api:2.4.0=kotlinAbiValidationCompatClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-tools-api:2.4.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-tools-compat:2.4.21=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
@@ -118,6 +171,7 @@ org.jetbrains.kotlin:kotlin-compiler-embeddable:2.4.0=kotlinAbiValidationCompatC
|
||||
org.jetbrains.kotlin:kotlin-compiler-embeddable:2.4.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains.kotlin:kotlin-compiler-runner:2.4.0=kotlinAbiValidationCompatClasspath
|
||||
org.jetbrains.kotlin:kotlin-compiler-runner:2.4.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.4.21=kotlin-extension,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathIntegration,kotlinCompilerPluginClasspathRelease
|
||||
org.jetbrains.kotlin:kotlin-daemon-client:2.4.0=kotlinAbiValidationCompatClasspath
|
||||
org.jetbrains.kotlin:kotlin-daemon-client:2.4.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains.kotlin:kotlin-daemon-embeddable:2.4.0=kotlinAbiValidationCompatClasspath
|
||||
@@ -126,36 +180,31 @@ org.jetbrains.kotlin:kotlin-reflect:1.6.10=kotlinAbiValidationCompatClasspath,ko
|
||||
org.jetbrains.kotlin:kotlin-reflect:2.2.10=androidLintTool
|
||||
org.jetbrains.kotlin:kotlin-script-runtime:2.4.0=kotlinAbiValidationCompatClasspath
|
||||
org.jetbrains.kotlin:kotlin-script-runtime:2.4.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-common:2.4.21=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0=debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,releaseCompileClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-common:2.4.21=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.2.10=androidLintTool,unified-test-platform-gradle-work-action
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0=debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,releaseCompileClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.2.10=androidLintTool,unified-test-platform-gradle-work-action
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.2.10=androidLintTool,unified-test-platform-gradle-work-action
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.2.21=composeMappingProducerClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.4.0=kotlinAbiValidationCompatClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.4.21=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-tooling-core:2.4.21=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4=debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,releaseCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1=debugAndroidTestCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4=debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,releaseCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.1=debugAndroidTestCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.3=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0=androidLintTool,unified-test-platform-gradle-work-action
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,releaseCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.1=debugAndroidTestCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0=androidLintTool,unified-test-platform-gradle-work-action
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4=debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,releaseCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1=debugAndroidTestCompileClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0=androidLintTool,unified-test-platform-gradle-work-action
|
||||
org.jetbrains:annotations:13.0=debugCompileClasspath,debugUnitTestCompileClasspath,integrationCompileClasspath,kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,releaseCompileClasspath
|
||||
org.jetbrains:annotations:23.0.0=androidLintTool,debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,unified-test-platform-gradle-work-action
|
||||
org.jspecify:jspecify:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.jetbrains:annotations:13.0=composeMappingProducerClasspath,kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
|
||||
org.jetbrains:annotations:23.0.0=androidLintTool,debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,unified-test-platform-gradle-work-action
|
||||
org.json:json:20260814=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath
|
||||
org.jspecify:jspecify:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,integrationCompileClasspath,integrationLintChecksClasspath,integrationRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath
|
||||
org.junit.platform:junit-platform-commons:1.13.3=unified-test-platform-gradle-work-action
|
||||
org.junit.platform:junit-platform-engine:1.13.3=unified-test-platform-gradle-work-action
|
||||
org.junit.platform:junit-platform-launcher:1.13.3=unified-test-platform-gradle-work-action
|
||||
@@ -165,5 +214,7 @@ org.opentest4j:opentest4j:1.3.0=unified-test-platform-gradle-work-action
|
||||
org.ow2.asm:asm-analysis:9.9=androidLintTool
|
||||
org.ow2.asm:asm-commons:9.9=androidLintTool
|
||||
org.ow2.asm:asm-tree:9.9=androidLintTool
|
||||
org.ow2.asm:asm-tree:9.9.1=composeMappingProducerClasspath
|
||||
org.ow2.asm:asm:9.9=androidLintTool
|
||||
empty=androidApis,androidJdkImage,androidTestUtil,coreLibraryDesugaring,debugAndroidTestAnnotationProcessorClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAnnotationProcessorClasspath,debugImplementationDependenciesMetadata,debugReverseMetadataValues,debugUnitTestAnnotationProcessorClasspath,debugUnitTestImplementationDependenciesMetadata,integrationAnnotationProcessorClasspath,integrationImplementationDependenciesMetadata,integrationReverseMetadataValues,kotlinCompilerPluginClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathIntegration,kotlinCompilerPluginClasspathRelease,lintChecks,lintPublish,releaseAnnotationProcessorClasspath,releaseImplementationDependenciesMetadata,releaseReverseMetadataValues
|
||||
org.ow2.asm:asm:9.9.1=composeMappingProducerClasspath
|
||||
empty=androidApis,androidJdkImage,androidTestUtil,coreLibraryDesugaring,debugAndroidTestAnnotationProcessorClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAnnotationProcessorClasspath,debugImplementationDependenciesMetadata,debugReverseMetadataValues,debugUnitTestAnnotationProcessorClasspath,debugUnitTestImplementationDependenciesMetadata,integrationAnnotationProcessorClasspath,integrationImplementationDependenciesMetadata,integrationReverseMetadataValues,kotlinCompilerPluginClasspath,lintChecks,lintPublish,releaseAnnotationProcessorClasspath,releaseImplementationDependenciesMetadata,releaseReverseMetadataValues
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performTextInput
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.ExternalResource
|
||||
|
||||
class NativeOnboardingTest {
|
||||
@get:Rule(order = 0)
|
||||
val reset = object : ExternalResource() {
|
||||
override fun before() {
|
||||
ApplicationProvider.getApplicationContext<Context>().getSharedPreferences(
|
||||
"native-server",
|
||||
Context.MODE_PRIVATE,
|
||||
).edit().clear().commit()
|
||||
}
|
||||
}
|
||||
|
||||
@get:Rule(order = 1)
|
||||
val compose = createAndroidComposeRule<MainActivity>()
|
||||
|
||||
@Test fun onboardingIsNativeAndHasNoWebView() {
|
||||
compose.onNodeWithTag("server-url").assertIsDisplayed()
|
||||
compose.onNodeWithTag("connect").assertIsDisplayed()
|
||||
compose.activityRule.scenario.onActivity { assertFalse(containsWebView(it.window.decorView)) }
|
||||
}
|
||||
|
||||
@Test fun rejectsHttpBeforeAnyNetworkCall() {
|
||||
compose.onNodeWithTag("server-url").performTextInput("http://family.example")
|
||||
compose.onNodeWithTag("connect").performClick()
|
||||
compose.onNodeWithText("Bitte eine gültige HTTPS-Adresse ohne Unterpfad eingeben.").assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test fun rejectsSubpathBeforeAnyNetworkCall() {
|
||||
compose.onNodeWithTag("server-url").performTextInput("https://family.example/subpath")
|
||||
compose.onNodeWithTag("connect").performClick()
|
||||
compose.onNodeWithText("Bitte eine gültige HTTPS-Adresse ohne Unterpfad eingeben.").assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test fun recreatesNativeOnboarding() {
|
||||
compose.activityRule.scenario.recreate()
|
||||
compose.onNodeWithTag("server-url").assertIsDisplayed()
|
||||
compose.onNodeWithTag("connect").assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test fun blocksScreenshots() {
|
||||
compose.activityRule.scenario.onActivity {
|
||||
assertTrue(it.window.attributes.flags and WindowManager.LayoutParams.FLAG_SECURE != 0)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun nativeCookiesAreEncryptedAndBoundToOrigin() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val first = NativeSession(context, "https://native-vault-test.example")
|
||||
val second = NativeSession(context, "https://other-vault-test.example")
|
||||
try {
|
||||
first.save("synthetic-private-session")
|
||||
assertEquals("synthetic-private-session", first.load())
|
||||
val preferences = context.getSharedPreferences("native-session", Context.MODE_PRIVATE)
|
||||
val encrypted = preferences.getString("https://native-vault-test.example", null)
|
||||
assertNotNull(encrypted)
|
||||
assertFalse(requireNotNull(encrypted).contains("synthetic-private-session"))
|
||||
preferences.edit().putString("https://other-vault-test.example", encrypted).commit()
|
||||
assertEquals(null, second.load())
|
||||
} finally {
|
||||
first.clear()
|
||||
second.clear()
|
||||
}
|
||||
}
|
||||
|
||||
private fun containsWebView(view: View): Boolean {
|
||||
if (view.javaClass.name.contains("WebView")) return true
|
||||
if (view is ViewGroup) for (index in 0 until view.childCount) if (containsWebView(view.getChildAt(index))) return true
|
||||
return false
|
||||
}
|
||||
}
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.view.WindowManager
|
||||
import androidx.compose.ui.graphics.asAndroidBitmap
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.captureToImage
|
||||
import androidx.compose.ui.test.hasText
|
||||
import androidx.compose.ui.test.isEnabled
|
||||
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.onRoot
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performScrollTo
|
||||
import androidx.compose.ui.test.performTextInput
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.platform.io.PlatformTestStorageRegistry
|
||||
import java.time.LocalDate
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.ExternalResource
|
||||
|
||||
/** Drives native semantics and real upstream API calls; never evaluates JavaScript. */
|
||||
class NativeUpstreamTest {
|
||||
@get:Rule(order = 0)
|
||||
val reset = object : ExternalResource() {
|
||||
override fun before() {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
context.getSharedPreferences("native-server", Context.MODE_PRIVATE).edit().clear().commit()
|
||||
context.getSharedPreferences("native-session", Context.MODE_PRIVATE).edit().clear().commit()
|
||||
if (android.os.Build.VERSION.SDK_INT >= 37) {
|
||||
InstrumentationRegistry.getInstrumentation().uiAutomation.grantRuntimePermission(
|
||||
context.packageName,
|
||||
android.Manifest.permission.ACCESS_LOCAL_NETWORK,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@get:Rule(order = 1)
|
||||
val compose = createAndroidComposeRule<MainActivity>()
|
||||
|
||||
@Test fun nativeLoginDashboardTaskNoteShoppingAndLogoutAgainstRealServer() {
|
||||
val arguments = InstrumentationRegistry.getArguments()
|
||||
val origin = requireNotNull(arguments.getString("server"))
|
||||
val password = requireNotNull(arguments.getString("password"))
|
||||
val seed = NativeApi(ServerAddress.parse(origin), NativeCookies(ServerAddress.parse(origin)), {})
|
||||
seed.request("/auth/login", "POST", org.json.JSONObject().put("username", "mobiletest").put("password", password))
|
||||
seed.request(
|
||||
"/tasks",
|
||||
"POST",
|
||||
org.json.JSONObject().put(
|
||||
"title",
|
||||
"Gemeinsam den Alltag planen",
|
||||
).put("priority", "high").put("due_date", LocalDate.now().toString()),
|
||||
)
|
||||
seed.request(
|
||||
"/notes",
|
||||
"POST",
|
||||
org.json.JSONObject().put("title", "Willkommen zuhause").put("content", "Native Oberfläche, eigener Server.").put("pinned", 1),
|
||||
)
|
||||
val seedList = seed.request(
|
||||
"/shopping",
|
||||
"POST",
|
||||
org.json.JSONObject().put("name", "Wochenmarkt"),
|
||||
).getJSONObject("data").getLong("id")
|
||||
seed.request("/shopping/$seedList/items", "POST", org.json.JSONObject().put("name", "Äpfel").put("quantity", "4"))
|
||||
seed.request("/auth/logout", "POST")
|
||||
compose.onNodeWithTag("server-url").performTextInput(origin)
|
||||
compose.onNodeWithTag("connect").performClick()
|
||||
awaitTag("username")
|
||||
compose.onNodeWithTag("username").performTextInput("mobiletest")
|
||||
compose.onNodeWithTag("password").performTextInput(password)
|
||||
compose.onNodeWithTag("login").performScrollTo().performClick()
|
||||
awaitTag("native-dashboard")
|
||||
captureFixtureDashboard()
|
||||
compose.activityRule.scenario.moveToState(Lifecycle.State.CREATED)
|
||||
compose.activityRule.scenario.moveToState(Lifecycle.State.RESUMED)
|
||||
compose.activityRule.scenario.recreate()
|
||||
awaitTag("native-dashboard")
|
||||
|
||||
compose.onNodeWithTag("nav-TASKS").performClick()
|
||||
awaitText("Hinzufügen")
|
||||
compose.onNodeWithText("Hinzufügen").performClick()
|
||||
compose.onNodeWithTag("entry-title").performTextInput("Native task regression")
|
||||
compose.onNodeWithTag("entry-detail").performTextInput("Created with native controls")
|
||||
compose.onNodeWithTag("entry-save").performClick()
|
||||
awaitText("Native task regression")
|
||||
assertTrue(readApi(origin).request("/tasks").rows().any { it.text("title") == "Native task regression" })
|
||||
|
||||
compose.onNodeWithTag("nav-NOTES").performClick()
|
||||
awaitText("Hinzufügen")
|
||||
compose.onNodeWithText("Hinzufügen").performClick()
|
||||
compose.onNodeWithTag("entry-title").performTextInput("Native note regression")
|
||||
compose.onNodeWithTag("entry-detail").performTextInput("Not an embedded web page")
|
||||
compose.onNodeWithTag("entry-save").performClick()
|
||||
awaitText("Native note regression")
|
||||
assertTrue(readApi(origin).request("/notes").rows().any { it.text("content") == "Not an embedded web page" })
|
||||
|
||||
compose.onNodeWithTag("nav-SHOPPING").performClick()
|
||||
awaitText("Neue Liste")
|
||||
compose.onNodeWithText("Neue Liste").performClick()
|
||||
compose.onNodeWithTag("entry-title").performTextInput("Native shopping regression")
|
||||
compose.onNodeWithTag("entry-save").performClick()
|
||||
awaitText("Native shopping regression")
|
||||
compose.onNodeWithText("Native shopping regression").performClick()
|
||||
awaitText("Hinzufügen")
|
||||
compose.onNodeWithText("Hinzufügen").performClick()
|
||||
compose.onNodeWithTag("entry-title").performTextInput("Native apples")
|
||||
compose.onNodeWithTag("entry-detail").performTextInput("3")
|
||||
compose.onNodeWithTag("entry-save").performClick()
|
||||
awaitText("Native apples")
|
||||
val api = readApi(origin)
|
||||
val list = api.request("/shopping").rows().first { it.text("name") == "Native shopping regression" }
|
||||
assertEquals(
|
||||
"3",
|
||||
api.request("/shopping/${list.getLong("id")}/items").rows().first {
|
||||
it.text("name") == "Native apples"
|
||||
}.text("quantity"),
|
||||
)
|
||||
|
||||
// Verify the same native transport rejects a cross-origin OIDC redirect.
|
||||
try {
|
||||
api.request("/auth/oidc/start")
|
||||
throw AssertionError("Native API followed an authentication redirect")
|
||||
} catch (error: NativeApiError) {
|
||||
assertEquals(302, error.status)
|
||||
}
|
||||
|
||||
compose.onNodeWithTag("nav-MORE").performClick()
|
||||
awaitText("Abmelden")
|
||||
compose.onNodeWithText("Abmelden").performScrollTo().performClick()
|
||||
awaitTag("username")
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
assertEquals(null, NativeSession(context, origin).load())
|
||||
}
|
||||
|
||||
private fun readApi(origin: String): NativeApi {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
val vault = NativeSession(context, origin)
|
||||
val api = NativeApi(ServerAddress.parse(origin), NativeCookies(ServerAddress.parse(origin), vault.load()), {})
|
||||
api.request("/auth/me")
|
||||
return api
|
||||
}
|
||||
|
||||
private fun captureFixtureDashboard() {
|
||||
// Only this temporary-fixture test clears the screenshot restriction.
|
||||
// Ordinary builds always retain FLAG_SECURE, including native login.
|
||||
compose.activityRule.scenario.onActivity { it.window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) }
|
||||
try {
|
||||
compose.waitForIdle()
|
||||
// Capture the native window through PixelCopy, not a potentially stale
|
||||
// secure compositor frame returned by UiAutomation immediately after clearing.
|
||||
val image = compose.onRoot().captureToImage().asAndroidBitmap()
|
||||
try {
|
||||
val first = image.getPixel(0, 0)
|
||||
assertTrue(
|
||||
"Native fixture screenshot is blank",
|
||||
(0 until image.height step 8).any { y ->
|
||||
(0 until image.width step 8).any { x -> image.getPixel(x, y) != first }
|
||||
},
|
||||
)
|
||||
// AGP collects this test output before uninstalling the fixture APK.
|
||||
PlatformTestStorageRegistry.getInstance().openOutputFile("native-dashboard.png").use {
|
||||
check(image.compress(Bitmap.CompressFormat.PNG, 100, it))
|
||||
}
|
||||
} finally {
|
||||
image.recycle()
|
||||
}
|
||||
} finally {
|
||||
compose.activityRule.scenario.onActivity { it.window.addFlags(WindowManager.LayoutParams.FLAG_SECURE) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun awaitTag(tag: String) {
|
||||
try {
|
||||
compose.waitUntil(30_000) { compose.onAllNodes(androidx.compose.ui.test.hasTestTag(tag)).fetchSemanticsNodes().isNotEmpty() }
|
||||
} catch (error: Exception) {
|
||||
var diagnostic = ""
|
||||
compose.activityRule.scenario.onActivity {
|
||||
val state = ViewModelProvider(it)[NativeController::class.java].state
|
||||
diagnostic = "busy=${state.busy}, signedIn=${state.user != null}, error=${state.error}"
|
||||
}
|
||||
throw AssertionError("Native screen '$tag' not reached: $diagnostic", error)
|
||||
}
|
||||
compose.onNodeWithTag(tag).assertIsDisplayed()
|
||||
}
|
||||
|
||||
private fun awaitText(text: String) {
|
||||
compose.waitUntil(30_000) { compose.onAllNodes(hasText(text) and isEnabled()).fetchSemanticsNodes().isNotEmpty() }
|
||||
compose.onNodeWithText(text).assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
@@ -1,689 +1,31 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.net.http.SslError
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.MediaStore
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.GeolocationPermissions
|
||||
import android.webkit.PermissionRequest
|
||||
import android.webkit.RenderProcessGoneDetail
|
||||
import android.webkit.SslErrorHandler
|
||||
import android.webkit.URLUtil
|
||||
import android.webkit.ValueCallback
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebResourceError
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebResourceResponse
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebStorage
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.ScrollView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.webkit.WebStorageCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import java.util.concurrent.Executors
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
|
||||
/** The shipped entry point is Compose. No WebView is created or embedded. */
|
||||
class MainActivity : ComponentActivity() {
|
||||
private var worker = Executors.newSingleThreadExecutor()
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val preferences by lazy { getSharedPreferences("server", MODE_PRIVATE) }
|
||||
private var server: ServerAddress? = null
|
||||
private var web: WebView? = null
|
||||
private var authDialog: AlertDialog? = null
|
||||
private lateinit var root: LinearLayout
|
||||
private lateinit var content: FrameLayout
|
||||
private lateinit var progress: ProgressBar
|
||||
private var fileCallback: ValueCallback<Array<Uri>>? = null
|
||||
private var capture: Uri? = null
|
||||
private var pendingDownload: String? = null
|
||||
private var generation = 0
|
||||
private val uploadSelection = SelectionGate()
|
||||
private val downloadSelection = SelectionGate()
|
||||
private val loadTimeout =
|
||||
Runnable { showError("The server is taking too long. Check your connection or try again.") }
|
||||
private val localNetworkPermission =
|
||||
registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
|
||||
if (granted) {
|
||||
toast("Private-network access allowed. Retry your server connection.")
|
||||
} else {
|
||||
toast("Private-network access was not granted. Public HTTPS servers can still be used.")
|
||||
}
|
||||
}
|
||||
|
||||
private val picker =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||
val accepted = uploadSelection.consume(generation)
|
||||
val callback = fileCallback
|
||||
fileCallback = null
|
||||
val uris = if (!accepted || result.resultCode != RESULT_OK) {
|
||||
null
|
||||
} else {
|
||||
val data = result.data
|
||||
data?.clipData?.let { clip ->
|
||||
Array(clip.itemCount.coerceAtMost(50)) { clip.getItemAt(it).uri }
|
||||
}
|
||||
?: data?.data?.let { arrayOf(it) } ?: capture?.let { arrayOf(it) }
|
||||
}
|
||||
callback?.onReceiveValue(uris?.filter { it.scheme == "content" }?.toTypedArray())
|
||||
revokeCapture()
|
||||
capture = null
|
||||
}
|
||||
private val saveDocument =
|
||||
registerForActivityResult(
|
||||
ActivityResultContracts.CreateDocument("application/octet-stream"),
|
||||
) { destination ->
|
||||
val accepted = downloadSelection.consume(generation)
|
||||
val url = pendingDownload
|
||||
pendingDownload = null
|
||||
if (!accepted) return@registerForActivityResult
|
||||
val current = server
|
||||
if (destination != null && url != null && current != null &&
|
||||
BlobTransfer.owns(current, url)
|
||||
) {
|
||||
val view = web ?: return@registerForActivityResult
|
||||
val epoch = generation
|
||||
BlobTransfer.save(
|
||||
current,
|
||||
view,
|
||||
url,
|
||||
contentResolver,
|
||||
destination,
|
||||
worker,
|
||||
{ !isDestroyed && epoch == generation },
|
||||
) { success ->
|
||||
if (!success) runCatching { contentResolver.delete(destination, null, null) }
|
||||
if (!isDestroyed &&
|
||||
epoch == generation
|
||||
) {
|
||||
toast(
|
||||
if (success) "Export saved" else "Export failed or exceeded the 25 MB limit.",
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if (destination != null && url != null && current != null && current.owns(url)) {
|
||||
val cookies = CookieManager.getInstance().getCookie(url)
|
||||
val epoch = generation
|
||||
worker.execute {
|
||||
val success = runCatching {
|
||||
FileTransfer.save(current, url, cookies, contentResolver, destination)
|
||||
}.isSuccess
|
||||
if (!success) runCatching { contentResolver.delete(destination, null, null) }
|
||||
runOnUiThread {
|
||||
if (!isDestroyed && epoch == generation) {
|
||||
if (success) {
|
||||
toast("Download saved")
|
||||
} else {
|
||||
toast(
|
||||
"Download failed. Check your connection and sign-in, then retry.",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private val localNetwork = registerForActivityResult(ActivityResultContracts.RequestPermission()) { recreate() }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (savedInstanceState?.getBoolean("uploadOutstanding") == true) uploadSelection.restoreOutstanding()
|
||||
if (savedInstanceState?.getBoolean("downloadOutstanding") == true) downloadSelection.restoreOutstanding()
|
||||
// Household data is hidden from screenshots and the recent-apps preview.
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
WebView.setWebContentsDebuggingEnabled(false)
|
||||
root = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL }
|
||||
ViewCompat.setOnApplyWindowInsetsListener(root) { view, insets ->
|
||||
val bars = insets.getInsets(
|
||||
WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime(),
|
||||
)
|
||||
view.setPadding(bars.left, bars.top, bars.right, bars.bottom)
|
||||
insets
|
||||
}
|
||||
setContentView(root)
|
||||
onBackPressedDispatcher.addCallback(
|
||||
this,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (web?.canGoBack() == true) {
|
||||
web?.goBack()
|
||||
} else if (web != null) {
|
||||
moveTaskToBack(true)
|
||||
} else {
|
||||
isEnabled = false
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
File(cacheDir, "captures").listFiles()?.filter {
|
||||
it.lastModified() <
|
||||
System.currentTimeMillis() - 86_400_000
|
||||
}
|
||||
?.forEach { it.delete() }
|
||||
server =
|
||||
preferences.getString("origin", null)?.let {
|
||||
runCatching { ServerAddress.parse(it) }.getOrNull()
|
||||
}
|
||||
if (server == null) onboarding() else browser()
|
||||
}
|
||||
|
||||
private fun column(): LinearLayout = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setPadding(dp(24), dp(20), dp(24), dp(20))
|
||||
}
|
||||
private fun text(value: String, size: Float = 17f) = TextView(this).apply {
|
||||
text = value
|
||||
textSize = size
|
||||
setPadding(0, dp(8), 0, dp(8))
|
||||
}
|
||||
private fun button(label: String, action: () -> Unit) = Button(this).apply {
|
||||
text = label
|
||||
isAllCaps = false
|
||||
minHeight = dp(48)
|
||||
setOnClickListener { action() }
|
||||
}
|
||||
private fun dp(value: Int) = (value * resources.displayMetrics.density).toInt()
|
||||
|
||||
private fun onboarding() {
|
||||
root.removeAllViews()
|
||||
val form = column()
|
||||
form.addView(text("Your home, connected", 30f))
|
||||
form.addView(
|
||||
text("Connect to your own Yuvomi server. Your data stays with your household."),
|
||||
)
|
||||
val address = EditText(this).apply {
|
||||
hint = "https://family.example.com"
|
||||
inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI
|
||||
setSingleLine(true)
|
||||
contentDescription = "Yuvomi server URL"
|
||||
setText(server?.origin.orEmpty())
|
||||
id = View.generateViewId()
|
||||
}
|
||||
val label =
|
||||
text("HTTPS required. Custom ports supported. Use a dedicated hostname, not a subpath.")
|
||||
label.accessibilityLiveRegion = View.ACCESSIBILITY_LIVE_REGION_POLITE
|
||||
lateinit var connect: Button
|
||||
connect = button("Connect securely") {
|
||||
val candidate = runCatching { ServerAddress.parse(address.text.toString()) }.getOrElse {
|
||||
address.error = it.message
|
||||
return@button
|
||||
}
|
||||
connect.isEnabled = false
|
||||
address.isEnabled = false
|
||||
label.setText(R.string.checking_server)
|
||||
val epoch = generation
|
||||
worker.execute {
|
||||
val result = runCatching { ServerProbe.check(candidate) }
|
||||
runOnUiThread {
|
||||
if (isDestroyed || epoch != generation) return@runOnUiThread
|
||||
connect.isEnabled = true
|
||||
address.isEnabled = true
|
||||
if (result.isSuccess) {
|
||||
server = candidate
|
||||
preferences.edit {
|
||||
putString("origin", candidate.origin)
|
||||
remove("path")
|
||||
}
|
||||
browser()
|
||||
} else {
|
||||
// Exception details may contain URL parameters; never expose them.
|
||||
label.setText(R.string.probe_failed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
form.addView(address)
|
||||
form.addView(label)
|
||||
localNetworkButton()?.let { form.addView(it) }
|
||||
form.addView(connect)
|
||||
form.addView(
|
||||
text("Independent community app. No telemetry or mandatory cloud service.", 14f),
|
||||
)
|
||||
root.addView(ScrollView(this).apply { addView(form) })
|
||||
}
|
||||
|
||||
private fun browser() {
|
||||
val current = server ?: return onboarding()
|
||||
root.removeAllViews()
|
||||
val toolbar = LinearLayout(this)
|
||||
toolbar.addView(button("Server settings") { settings() })
|
||||
toolbar.addView(
|
||||
button("Share server") {
|
||||
startActivity(
|
||||
Intent.createChooser(
|
||||
Intent(Intent.ACTION_SEND).apply {
|
||||
type = "text/plain"
|
||||
putExtra(Intent.EXTRA_TEXT, current.origin)
|
||||
},
|
||||
"Share server address",
|
||||
),
|
||||
)
|
||||
},
|
||||
)
|
||||
root.addView(toolbar)
|
||||
progress = ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal).apply {
|
||||
contentDescription = "Loading Yuvomi"
|
||||
max = 100
|
||||
}
|
||||
root.addView(progress, LinearLayout.LayoutParams(-1, dp(4)))
|
||||
content = FrameLayout(this)
|
||||
root.addView(content, LinearLayout.LayoutParams(-1, 0, 1f))
|
||||
val view = WebView(this)
|
||||
web = view
|
||||
secure(view)
|
||||
BlobTransfer.install(view, current)
|
||||
CookieManager.getInstance().setAcceptCookie(true)
|
||||
CookieManager.getInstance().setAcceptThirdPartyCookies(view, false)
|
||||
view.webViewClient = object : WebViewClient() {
|
||||
override fun shouldInterceptRequest(v: WebView, request: WebResourceRequest): WebResourceResponse? {
|
||||
if (!current.owns(request.url.toString())) {
|
||||
return WebResourceResponse(
|
||||
"text/plain",
|
||||
"UTF-8",
|
||||
403,
|
||||
"Blocked",
|
||||
emptyMap(),
|
||||
ByteArrayInputStream(ByteArray(0)),
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
override fun shouldOverrideUrlLoading(v: WebView, request: WebResourceRequest): Boolean {
|
||||
val url = request.url.toString()
|
||||
if (current.owns(url)) return false
|
||||
if (request.isForMainFrame) external(url)
|
||||
return true
|
||||
}
|
||||
override fun onPageStarted(v: WebView, url: String, icon: Bitmap?) {
|
||||
if (!current.owns(url)) {
|
||||
v.stopLoading()
|
||||
external(url)
|
||||
return
|
||||
}
|
||||
progress.visibility = View.VISIBLE
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
handler.postDelayed(loadTimeout, 30_000)
|
||||
}
|
||||
override fun onPageFinished(v: WebView, url: String) {
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
progress.visibility = View.GONE
|
||||
CookieManager.getInstance().flush()
|
||||
if (current.owns(url)) {
|
||||
val path = URI(url).rawPath.orEmpty()
|
||||
if (!listOf("auth", "reset", "invite", "login").any {
|
||||
path.contains(it, true)
|
||||
}
|
||||
) {
|
||||
preferences.edit { putString("path", path) }
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onReceivedError(v: WebView, r: WebResourceRequest, e: WebResourceError) {
|
||||
if (r.isForMainFrame) {
|
||||
showError(
|
||||
"Unable to connect. Cached content may still be available. Check your network or VPN.",
|
||||
val controller = ViewModelProvider(this)[NativeController::class.java]
|
||||
setContent {
|
||||
NativeApp(
|
||||
controller,
|
||||
needsLocalNetwork =
|
||||
Build.VERSION.SDK_INT >= 37 &&
|
||||
checkSelfPermission(Manifest.permission.ACCESS_LOCAL_NETWORK) != PackageManager.PERMISSION_GRANTED,
|
||||
requestLocalNetwork = { if (Build.VERSION.SDK_INT >= 37) localNetwork.launch(Manifest.permission.ACCESS_LOCAL_NETWORK) },
|
||||
)
|
||||
}
|
||||
}
|
||||
override fun onReceivedHttpError(v: WebView, r: WebResourceRequest, e: WebResourceResponse) {
|
||||
if (r.isForMainFrame &&
|
||||
e.statusCode >= 400
|
||||
) {
|
||||
showError("The server is unavailable (HTTP ${e.statusCode}).")
|
||||
}
|
||||
}
|
||||
override fun onReceivedSslError(v: WebView, h: SslErrorHandler, e: SslError) {
|
||||
h.cancel()
|
||||
showError(
|
||||
"The server certificate could not be verified. Contact your server administrator.",
|
||||
)
|
||||
}
|
||||
override fun onRenderProcessGone(v: WebView, detail: RenderProcessGoneDetail): Boolean {
|
||||
releaseWeb()
|
||||
browser()
|
||||
toast("Yuvomi recovered after a browser interruption.")
|
||||
return true
|
||||
}
|
||||
}
|
||||
view.webChromeClient = object : WebChromeClient() {
|
||||
override fun onProgressChanged(v: WebView, value: Int) {
|
||||
progress.progress = value
|
||||
}
|
||||
override fun onPermissionRequest(request: PermissionRequest) {
|
||||
request.deny()
|
||||
}
|
||||
override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) {
|
||||
callback.invoke(origin, false, false)
|
||||
}
|
||||
override fun onShowFileChooser(v: WebView, callback: ValueCallback<Array<Uri>>, params: FileChooserParams): Boolean {
|
||||
if (!current.owns(v.url.orEmpty())) return false
|
||||
if (!uploadSelection.begin(generation)) {
|
||||
callback.onReceiveValue(null)
|
||||
toast("Finish or cancel the existing system file picker first.")
|
||||
return true
|
||||
}
|
||||
fileCallback?.onReceiveValue(null)
|
||||
fileCallback = callback
|
||||
runCatching {
|
||||
val types = params.acceptTypes.filter {
|
||||
it.matches(Regex("[a-zA-Z0-9.+*-]+/[a-zA-Z0-9.+*-]+"))
|
||||
}
|
||||
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
type = types.singleOrNull() ?: "*/*"
|
||||
if (types.size > 1) putExtra(Intent.EXTRA_MIME_TYPES, types.toTypedArray())
|
||||
putExtra(
|
||||
Intent.EXTRA_ALLOW_MULTIPLE,
|
||||
params.mode == FileChooserParams.MODE_OPEN_MULTIPLE,
|
||||
)
|
||||
}
|
||||
val chooser = Intent.createChooser(intent, "Select a file")
|
||||
if (types.any { it.startsWith("image/") }) {
|
||||
val directory = File(cacheDir, "captures").apply { mkdirs() }
|
||||
capture =
|
||||
FileProvider.getUriForFile(
|
||||
this@MainActivity,
|
||||
"$packageName.files",
|
||||
File.createTempFile("capture-", ".jpg", directory),
|
||||
)
|
||||
chooser.putExtra(
|
||||
Intent.EXTRA_INITIAL_INTENTS,
|
||||
arrayOf(
|
||||
Intent(MediaStore.ACTION_IMAGE_CAPTURE).apply {
|
||||
putExtra(MediaStore.EXTRA_OUTPUT, capture)
|
||||
clipData =
|
||||
android.content.ClipData.newRawUri("Yuvomi photo", capture)
|
||||
addFlags(
|
||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION,
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
picker.launch(chooser)
|
||||
}.onFailure {
|
||||
uploadSelection.consume(generation)
|
||||
fileCallback?.onReceiveValue(null)
|
||||
fileCallback = null
|
||||
toast("No compatible file picker is available.")
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
view.setDownloadListener { url, _, disposition, mime, _ ->
|
||||
if (!current.owns(url) &&
|
||||
!BlobTransfer.owns(current, url)
|
||||
) {
|
||||
toast("Only downloads from your server are supported.")
|
||||
} else if (pendingDownload == null && downloadSelection.begin(generation)) {
|
||||
pendingDownload = url
|
||||
val name = URLUtil.guessFileName(
|
||||
url,
|
||||
disposition,
|
||||
mime,
|
||||
).replace(Regex("[^a-zA-Z0-9._ -]"), "_").take(120)
|
||||
runCatching { saveDocument.launch(name.ifBlank { "download" }) }.onFailure {
|
||||
downloadSelection.consume(generation)
|
||||
pendingDownload = null
|
||||
toast("No compatible document provider is available.")
|
||||
}
|
||||
}
|
||||
}
|
||||
content.addView(view, FrameLayout.LayoutParams(-1, -1))
|
||||
val path = preferences.getString("path", "/").orEmpty()
|
||||
view.loadUrl(
|
||||
current.origin + if (path.startsWith("/") && !path.startsWith("//")) path else "/",
|
||||
)
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private fun secure(view: WebView) {
|
||||
view.settings.apply {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
allowFileAccess = false
|
||||
allowContentAccess = false
|
||||
mixedContentMode = WebSettings.MIXED_CONTENT_NEVER_ALLOW
|
||||
javaScriptCanOpenWindowsAutomatically = false
|
||||
setSupportMultipleWindows(false)
|
||||
mediaPlaybackRequiresUserGesture = true
|
||||
safeBrowsingEnabled = true
|
||||
setGeolocationEnabled(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun external(value: String) {
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
progress.visibility = View.GONE
|
||||
val uri = runCatching { URI(value) }.getOrNull() ?: return
|
||||
if (uri.scheme != "https" || uri.host.isNullOrBlank() || uri.rawUserInfo != null) {
|
||||
toast("This link type is blocked for your security.")
|
||||
return
|
||||
}
|
||||
AlertDialog.Builder(this).setTitle("Leave your Yuvomi server?")
|
||||
.setMessage(
|
||||
"Destination: ${uri.host}\n\nOpen normal links in your browser. For SSO, use the isolated sign-in window only if you trust this provider. Providers that require a system browser cannot transfer a session back to this app.",
|
||||
)
|
||||
.setPositiveButton("Browser") { _, _ -> openBrowser(value) }
|
||||
.setNeutralButton("Sign-in window") { _, _ -> authentication(value) }
|
||||
.setNegativeButton("Cancel", null).show()
|
||||
}
|
||||
|
||||
private fun authentication(value: String) {
|
||||
if (authDialog != null) return
|
||||
val auth = WebView(this)
|
||||
secure(auth)
|
||||
CookieManager.getInstance().setAcceptThirdPartyCookies(auth, false)
|
||||
auth.webChromeClient = object : WebChromeClient() {
|
||||
override fun onPermissionRequest(request: PermissionRequest) {
|
||||
request.deny()
|
||||
}
|
||||
}
|
||||
auth.webViewClient = object : WebViewClient() {
|
||||
override fun onPageStarted(v: WebView, url: String, favicon: Bitmap?) {
|
||||
authDialog?.setTitle(
|
||||
"Sign in: ${runCatching {
|
||||
URI(url).host
|
||||
}.getOrNull().orEmpty()}",
|
||||
)
|
||||
}
|
||||
override fun shouldOverrideUrlLoading(v: WebView, request: WebResourceRequest): Boolean {
|
||||
val uri = request.url
|
||||
return uri.scheme != "https" || !uri.userInfo.isNullOrEmpty()
|
||||
}
|
||||
override fun onReceivedSslError(v: WebView, h: SslErrorHandler, e: SslError) {
|
||||
h.cancel()
|
||||
}
|
||||
override fun onPageFinished(v: WebView, url: String) {
|
||||
if (server?.owns(url) == true && !URI(url).path.startsWith("/api/")) {
|
||||
CookieManager.getInstance().flush()
|
||||
authDialog?.dismiss()
|
||||
web?.loadUrl(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
authDialog = AlertDialog.Builder(this).setTitle("Isolated web sign-in")
|
||||
.setView(auth).setNegativeButton("Close", null).create().also { dialog ->
|
||||
dialog.setOnDismissListener {
|
||||
auth.stopLoading()
|
||||
auth.removeAllViews()
|
||||
auth.destroy()
|
||||
authDialog = null
|
||||
}
|
||||
dialog.show()
|
||||
dialog.window?.setLayout(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
}
|
||||
auth.loadUrl(value)
|
||||
}
|
||||
|
||||
private fun openBrowser(value: String) {
|
||||
runCatching {
|
||||
startActivity(
|
||||
Intent(Intent.ACTION_VIEW, value.toUri()).addCategory(Intent.CATEGORY_BROWSABLE),
|
||||
)
|
||||
}
|
||||
.onFailure { toast("No browser is available.") }
|
||||
}
|
||||
|
||||
private fun showError(message: String) {
|
||||
if (isDestroyed || web == null) return
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
progress.visibility = View.GONE
|
||||
if (content.childCount > 1) return
|
||||
val panel = column().apply {
|
||||
addView(text("Connection interrupted", 25f))
|
||||
addView(text(message))
|
||||
addView(
|
||||
button("Retry") {
|
||||
content.removeView(this)
|
||||
web?.reload()
|
||||
},
|
||||
)
|
||||
addView(button("Keep viewing") { content.removeView(this) })
|
||||
addView(button("Server settings") { settings() })
|
||||
localNetworkButton()?.let { addView(it) }
|
||||
}
|
||||
val dark =
|
||||
resources.configuration.uiMode and android.content.res.Configuration.UI_MODE_NIGHT_MASK ==
|
||||
android.content.res.Configuration.UI_MODE_NIGHT_YES
|
||||
panel.setBackgroundColor(if (dark) 0xff191816.toInt() else 0xfff5f3ed.toInt())
|
||||
content.addView(panel, FrameLayout.LayoutParams(-1, -1))
|
||||
panel.accessibilityLiveRegion = View.ACCESSIBILITY_LIVE_REGION_POLITE
|
||||
ViewCompat.setAccessibilityPaneTitle(panel, "Connection interrupted")
|
||||
}
|
||||
|
||||
private fun settings() {
|
||||
AlertDialog.Builder(this).setTitle("Server settings")
|
||||
.setMessage(
|
||||
"${server?.origin.orEmpty()}\n\nSwitching servers erases all app cookies, storage and cached household data. Downloads saved outside the app remain. This does not revoke the server session; sign out in Yuvomi first where possible.",
|
||||
)
|
||||
.setPositiveButton("Erase and change server") { _, _ ->
|
||||
generation++
|
||||
worker.shutdownNow()
|
||||
worker = Executors.newSingleThreadExecutor()
|
||||
authDialog?.dismiss()
|
||||
releaseWeb()
|
||||
val captures = File(cacheDir, "captures")
|
||||
val capturesErased = !captures.exists() || captures.listFiles()?.all { !it.exists() || it.delete() } == true
|
||||
if (capturesErased && WebViewFeature.isFeatureSupported(WebViewFeature.DELETE_BROWSING_DATA)) {
|
||||
WebStorageCompat.deleteBrowsingData(WebStorage.getInstance()) {
|
||||
CookieManager.getInstance().removeAllCookies {
|
||||
CookieManager.getInstance().flush()
|
||||
preferences.edit { clear() }
|
||||
server = null
|
||||
onboarding()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Older engines cannot reliably erase CacheStorage/IndexedDB.
|
||||
// OS reset is complete and scoped to this application, but closes it.
|
||||
val reset = getSystemService(
|
||||
android.app.ActivityManager::class.java,
|
||||
).clearApplicationUserData()
|
||||
if (!reset) {
|
||||
toast("Local data could not be erased. Clear this app's storage in Android settings before switching servers.")
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
.setNeutralButton("Open server in browser") { _, _ ->
|
||||
server?.let { openBrowser(it.origin) }
|
||||
}
|
||||
.setNegativeButton("Continue", null).show()
|
||||
}
|
||||
|
||||
private fun localNetworkButton(): Button? {
|
||||
if (android.os.Build.VERSION.SDK_INT < 37 ||
|
||||
checkSelfPermission(android.Manifest.permission.ACCESS_LOCAL_NETWORK) ==
|
||||
android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
return null
|
||||
}
|
||||
return button("Allow private-network servers") {
|
||||
AlertDialog.Builder(this).setTitle("Private server access")
|
||||
.setMessage(
|
||||
"Android requires permission to connect to a Yuvomi server on your local network. The app connects only to your configured server; it does not scan for devices. Public internet servers do not need this permission.",
|
||||
)
|
||||
.setPositiveButton("Continue") { _, _ ->
|
||||
localNetworkPermission.launch(android.Manifest.permission.ACCESS_LOCAL_NETWORK)
|
||||
}
|
||||
.setNegativeButton("Cancel", null).show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun releaseWeb() {
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
fileCallback?.onReceiveValue(null)
|
||||
fileCallback = null
|
||||
pendingDownload = null
|
||||
revokeCapture()
|
||||
capture = null
|
||||
web?.let { view ->
|
||||
BlobTransfer.forget(view)
|
||||
view.stopLoading()
|
||||
(view.parent as? ViewGroup)?.removeView(view)
|
||||
view.removeAllViews()
|
||||
view.destroy()
|
||||
}
|
||||
web = null
|
||||
}
|
||||
private fun revokeCapture() {
|
||||
capture?.let {
|
||||
revokeUriPermission(it, Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||
}
|
||||
}
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
outState.putBoolean("uploadOutstanding", uploadSelection.outstanding)
|
||||
outState.putBoolean("downloadOutstanding", downloadSelection.outstanding)
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
private fun toast(message: String) = Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
||||
override fun onPause() {
|
||||
web?.onPause()
|
||||
CookieManager.getInstance().flush()
|
||||
super.onPause()
|
||||
}
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
web?.onResume()
|
||||
}
|
||||
override fun onDestroy() {
|
||||
generation++
|
||||
authDialog?.dismiss()
|
||||
releaseWeb()
|
||||
worker.shutdownNow()
|
||||
super.onDestroy()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.net.HttpCookie
|
||||
import java.net.URI
|
||||
import javax.net.ssl.HttpsURLConnection
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
data class SessionCookie(val name: String, val value: String, val expires: Long)
|
||||
|
||||
/** An explicit same-origin jar; never installs a process-wide CookieHandler. */
|
||||
class NativeCookies(private val server: ServerAddress, serialized: String? = null) {
|
||||
private val values = linkedMapOf<String, SessionCookie>()
|
||||
|
||||
init {
|
||||
if (serialized != null) {
|
||||
runCatching {
|
||||
val rows = JSONArray(serialized)
|
||||
for (index in 0 until rows.length()) {
|
||||
val row = rows.getJSONObject(index)
|
||||
val cookie = SessionCookie(row.getString("name"), row.getString("value"), row.getLong("expires"))
|
||||
if (allowed(cookie.name) && safe(cookie.value) &&
|
||||
cookie.expires > System.currentTimeMillis()
|
||||
) {
|
||||
values[cookie.name] = cookie
|
||||
}
|
||||
}
|
||||
}.onFailure { values.clear() }
|
||||
}
|
||||
}
|
||||
|
||||
fun accept(headers: List<String>, now: Long = System.currentTimeMillis()) {
|
||||
val host = URI(server.origin).host
|
||||
for (header in headers) {
|
||||
val parsed = runCatching { HttpCookie.parse(header) }.getOrDefault(emptyList())
|
||||
for (cookie in parsed) {
|
||||
if (!allowed(cookie.name) || !cookie.secure || !safe(cookie.value)) continue
|
||||
if (cookie.domain != null && !cookie.domain.trimStart('.').equals(host, true)) continue
|
||||
if (cookie.path != null && cookie.path != "/") continue
|
||||
if (cookie.maxAge == 0L) {
|
||||
values.remove(cookie.name)
|
||||
} else {
|
||||
// Session-only cookies never become persistent across launches.
|
||||
val expiry = if (cookie.maxAge < 0) Long.MAX_VALUE else now + cookie.maxAge.coerceAtMost(31_536_000L) * 1000
|
||||
values[cookie.name] = SessionCookie(cookie.name, cookie.value, expiry)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun header(now: Long = System.currentTimeMillis()): String = values.values.filter {
|
||||
it.expires > now
|
||||
}.joinToString("; ") { "${it.name}=${it.value}" }
|
||||
|
||||
fun serialized(now: Long = System.currentTimeMillis()): String = JSONArray().apply {
|
||||
values.values.filter { it.expires > now && it.expires != Long.MAX_VALUE }.forEach {
|
||||
put(JSONObject().put("name", it.name).put("value", it.value).put("expires", it.expires))
|
||||
}
|
||||
}.toString()
|
||||
|
||||
fun clear() = values.clear()
|
||||
|
||||
private fun allowed(name: String) = name == "yuvomi.sid" || name == "csrf-token"
|
||||
private fun safe(value: String) = value.length <= 8192 && value.none { it <= ' ' || it == ';' || it == ',' || it == '\u007f' }
|
||||
}
|
||||
|
||||
class NativeApiError(val status: Int, val reason: String = "") : Exception() {
|
||||
fun userMessage(): String = when (status) {
|
||||
401 -> "Anmeldung oder Sitzung ist nicht mehr gültig."
|
||||
403 -> "Diese Aktion ist nicht erlaubt. Bitte prüfe deine Berechtigungen."
|
||||
409 -> "Der Eintrag wurde inzwischen geändert. Bitte neu laden."
|
||||
429 -> "Zu viele Versuche. Bitte warte einen Moment."
|
||||
in 500..599 -> "Der Server ist derzeit nicht verfügbar."
|
||||
else -> "Die Anfrage konnte nicht abgeschlossen werden (HTTP $status)."
|
||||
}
|
||||
}
|
||||
|
||||
/** Synchronous transport; the controller always invokes it on its worker thread. */
|
||||
class NativeApi(val server: ServerAddress, private val cookies: NativeCookies, private val persist: (String) -> Unit) {
|
||||
private var csrf = ""
|
||||
|
||||
fun clear() {
|
||||
csrf = ""
|
||||
cookies.clear()
|
||||
}
|
||||
|
||||
fun request(path: String, method: String = "GET", body: JSONObject? = null, retry: Boolean = true): JSONObject {
|
||||
require(path.startsWith("/") && !path.startsWith("//") && !path.contains('#') && !path.contains('\\'))
|
||||
val target = URI(server.origin + "/api/v1" + path)
|
||||
require(server.owns(target.toString()))
|
||||
val connection = target.toURL().openConnection() as HttpsURLConnection
|
||||
val mutation = method in setOf("POST", "PUT", "PATCH", "DELETE")
|
||||
try {
|
||||
connection.instanceFollowRedirects = false
|
||||
connection.requestMethod = method
|
||||
connection.connectTimeout = 10_000
|
||||
connection.readTimeout = 15_000
|
||||
connection.setRequestProperty("Accept", "application/json")
|
||||
connection.setRequestProperty("Cache-Control", "no-store")
|
||||
connection.setRequestProperty("Cookie", cookies.header())
|
||||
if (mutation) {
|
||||
connection.setRequestProperty("Content-Type", "application/json")
|
||||
connection.setRequestProperty("X-CSRF-Token", csrf)
|
||||
connection.doOutput = true
|
||||
connection.outputStream.use { it.write((body ?: JSONObject()).toString().toByteArray()) }
|
||||
}
|
||||
val status = connection.responseCode
|
||||
if (status in 300..399) throw NativeApiError(status, "redirect_refused")
|
||||
cookies.accept(connection.headerFields.filterKeys { it.equals("Set-Cookie", true) }.values.flatten())
|
||||
persist(cookies.serialized())
|
||||
val input = if (status in 200..299) connection.inputStream else connection.errorStream
|
||||
val bytes = input?.use { stream ->
|
||||
val output = ByteArrayOutputStream()
|
||||
val buffer = ByteArray(8192)
|
||||
val deadline = System.nanoTime() + 30_000_000_000L
|
||||
while (true) {
|
||||
check(System.nanoTime() < deadline)
|
||||
val count = stream.read(buffer)
|
||||
if (count < 0) break
|
||||
require(output.size() + count <= 4 * 1024 * 1024)
|
||||
output.write(buffer, 0, count)
|
||||
}
|
||||
output.toByteArray()
|
||||
} ?: ByteArray(0)
|
||||
val data = if (bytes.isEmpty()) {
|
||||
JSONObject()
|
||||
} else {
|
||||
runCatching {
|
||||
JSONObject(String(bytes, Charsets.UTF_8))
|
||||
}.getOrElse { throw NativeApiError(status, "invalid_json") }
|
||||
}
|
||||
val updated = connection.getHeaderField("X-CSRF-Token") ?: data.optString("csrfToken")
|
||||
if (updated.isNotBlank()) csrf = updated
|
||||
if (status == 403 && mutation && retry && data.optString("reason") == "csrf_invalid") {
|
||||
request("/auth/me", retry = false)
|
||||
return request(path, method, body, retry = false)
|
||||
}
|
||||
if (status !in 200..299) throw NativeApiError(status, data.optString("reason"))
|
||||
return data
|
||||
} finally {
|
||||
connection.disconnect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun JSONObject.rows(key: String = "data"): List<JSONObject> = optJSONArray(key)?.let { array ->
|
||||
(0 until array.length()).mapNotNull { array.optJSONObject(it) }
|
||||
}.orEmpty()
|
||||
|
||||
fun JSONObject.text(key: String): String = if (isNull(key)) "" else optString(key)
|
||||
|
||||
fun JSONObject.countText(key: String): String = if (opt(key) is Number) get(key).toString() else "—"
|
||||
@@ -0,0 +1,859 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.FilterChip
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import java.time.LocalDate
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Locale
|
||||
import org.json.JSONObject
|
||||
|
||||
private val Violet = Color(0xFF6C3AED)
|
||||
private val PageShape = RoundedCornerShape(16.dp)
|
||||
|
||||
@Composable
|
||||
fun NativeApp(controller: NativeController, needsLocalNetwork: Boolean = false, requestLocalNetwork: () -> Unit = {}) {
|
||||
val dark = isSystemInDarkTheme()
|
||||
val palette = if (dark) {
|
||||
darkColorScheme(
|
||||
primary = Color(0xFFA78BFA),
|
||||
background = Color(0xFF191816),
|
||||
surface = Color(0xFF2B2825),
|
||||
onSurface = Color(0xFFF5F3ED),
|
||||
onSurfaceVariant = Color(0xFFB4AEA5),
|
||||
outline = Color(0xFF948E85),
|
||||
onBackground = Color(0xFFF5F3ED),
|
||||
)
|
||||
} else {
|
||||
lightColorScheme(
|
||||
primary = Violet,
|
||||
background = Color(0xFFF5F3ED),
|
||||
surface = Color.White,
|
||||
onSurface = Color(0xFF1D1B17),
|
||||
onSurfaceVariant = Color(0xFF63615B),
|
||||
outline = Color(0xFF8C8880),
|
||||
onBackground = Color(0xFF1D1B17),
|
||||
)
|
||||
}
|
||||
MaterialTheme(colorScheme = palette) {
|
||||
val state = controller.state
|
||||
var confirmForget by remember { mutableStateOf(false) }
|
||||
var editor by remember { mutableStateOf<JSONObject?>(null) }
|
||||
var editing by remember { mutableStateOf(false) }
|
||||
var submitted by remember { mutableStateOf(false) }
|
||||
var remove by remember { mutableStateOf<String?>(null) }
|
||||
var info by remember { mutableStateOf<String?>(null) }
|
||||
LaunchedEffect(state.user?.text("id"), state.server) {
|
||||
editing = false
|
||||
editor = null
|
||||
submitted = false
|
||||
}
|
||||
LaunchedEffect(state.busy, state.error) {
|
||||
if (submitted && !state.busy) {
|
||||
submitted = false
|
||||
if (state.error == null) editing = false
|
||||
}
|
||||
}
|
||||
BackHandler(state.user != null && (state.page != NativePage.HOME || state.listId != null)) {
|
||||
if (!state.busy) controller.navigate(if (state.listId != null) NativePage.SHOPPING else NativePage.HOME)
|
||||
}
|
||||
Surface(Modifier.fillMaxSize(), color = palette.background) {
|
||||
if (state.server.isEmpty() || state.user == null) {
|
||||
AuthenticationScreen(
|
||||
state,
|
||||
needsLocalNetwork,
|
||||
requestLocalNetwork,
|
||||
controller::connect,
|
||||
controller::login,
|
||||
controller::verify,
|
||||
controller::cancelTwoFactor,
|
||||
{ confirmForget = true }, {
|
||||
info =
|
||||
"SSO wird für den nativen API-Client noch nicht unterstützt. " +
|
||||
"Es wird keine Browser-Sitzung als native Anmeldung vorgetäuscht."
|
||||
},
|
||||
)
|
||||
} else {
|
||||
Scaffold(
|
||||
containerColor = palette.background,
|
||||
bottomBar = {
|
||||
Surface(
|
||||
Modifier.padding(horizontal = 12.dp, vertical = 8.dp).fillMaxWidth(),
|
||||
shape = RoundedCornerShape(32.dp),
|
||||
shadowElevation = 8.dp,
|
||||
) {
|
||||
Row(Modifier.padding(6.dp), horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
NativePage.entries.filter {
|
||||
it == NativePage.HOME || it == NativePage.MORE ||
|
||||
state.access(it.name.lowercase()) != "none"
|
||||
}.forEach { page ->
|
||||
Column(
|
||||
Modifier.weight(1f).clip(CircleShape).clickable(enabled = !state.busy) {
|
||||
controller.navigate(page)
|
||||
}.padding(vertical = 8.dp).testTag("nav-${page.name}"),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Glyph(page, if (state.page == page) palette.primary else palette.onSurfaceVariant)
|
||||
Text(
|
||||
page.title,
|
||||
fontSize = 11.sp,
|
||||
color = if (state.page ==
|
||||
page
|
||||
) {
|
||||
palette.primary
|
||||
} else {
|
||||
palette.onSurfaceVariant
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
) { padding ->
|
||||
Column(Modifier.padding(padding).fillMaxSize()) {
|
||||
Row(
|
||||
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
if (state.listId ==
|
||||
null
|
||||
) {
|
||||
state.page.title
|
||||
} else {
|
||||
state.listName
|
||||
},
|
||||
fontSize = 34.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
TextButton(onClick = controller::refresh, enabled = !state.busy) { Text("Aktualisieren") }
|
||||
}
|
||||
if (state.busy) LinearProgressIndicator(Modifier.fillMaxWidth())
|
||||
state.error?.let { ErrorCard(it, controller::dismissError) }
|
||||
when (state.page) {
|
||||
NativePage.HOME -> DashboardScreen(state, controller::navigate)
|
||||
NativePage.MORE -> MoreScreen(state, { controller.logout() }, { confirmForget = true })
|
||||
else -> {
|
||||
val module = state.page.name.lowercase()
|
||||
val write = state.access(module) == "write" && !state.busy
|
||||
Row(Modifier.padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
if (state.listId !=
|
||||
null
|
||||
) {
|
||||
TextButton(onClick = {
|
||||
controller.navigate(NativePage.SHOPPING)
|
||||
}, enabled = !state.busy) { Text("Alle Listen") }
|
||||
}
|
||||
Spacer(Modifier.weight(1f))
|
||||
if (write) {
|
||||
Button(colors = nativeButtonColors(), onClick = {
|
||||
editor = null
|
||||
editing = true
|
||||
}) {
|
||||
Text(
|
||||
if (state.page ==
|
||||
NativePage.SHOPPING &&
|
||||
state.listId == null
|
||||
) {
|
||||
"Neue Liste"
|
||||
} else {
|
||||
"Hinzufügen"
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
NativeCollection(
|
||||
state,
|
||||
write,
|
||||
onEdit = {
|
||||
editor = it
|
||||
editing = true
|
||||
},
|
||||
onTask = controller::completeTask,
|
||||
onPin = controller::pinNote,
|
||||
onItem = controller::checkItem,
|
||||
onList = { controller.openList(it.getLong("id"), it.text("name")) },
|
||||
onRemove = { remove = it },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (editing) {
|
||||
EntryEditor(state, editor, onDismiss = { editing = false }) { title, detail, priority, date ->
|
||||
when (state.page) {
|
||||
NativePage.TASKS -> controller.saveTask(editor?.getLong("id"), title, detail, priority, date)
|
||||
NativePage.NOTES -> controller.saveNote(editor?.getLong("id"), title, detail)
|
||||
NativePage.SHOPPING -> controller.saveShopping(editor?.getLong("id"), title, detail)
|
||||
else -> Unit
|
||||
}
|
||||
submitted = true
|
||||
}
|
||||
}
|
||||
if (confirmForget) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { confirmForget = false },
|
||||
title = { Text("Server entfernen?") },
|
||||
text = {
|
||||
Text(
|
||||
"Die lokale native Sitzung und geladene Inhalte werden gelöscht. " +
|
||||
"Eine entfernte Sitzung wird dadurch nicht widerrufen; melde dich möglichst zuerst ab.",
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(onClick = {
|
||||
confirmForget = false
|
||||
controller.forgetLocalServer()
|
||||
}, enabled = !state.busy) { Text("Lokal entfernen") }
|
||||
},
|
||||
dismissButton = { TextButton(onClick = { confirmForget = false }) { Text("Abbrechen") } },
|
||||
)
|
||||
}
|
||||
remove?.let { path ->
|
||||
AlertDialog(
|
||||
onDismissRequest = { remove = null },
|
||||
title = { Text("Eintrag löschen?") },
|
||||
text = { Text("Der Eintrag wird auf deinem Server gelöscht. Diese Aktion kann nicht zurückgenommen werden.") },
|
||||
confirmButton = {
|
||||
TextButton(onClick = {
|
||||
remove = null
|
||||
controller.remove(path)
|
||||
}) { Text("Löschen") }
|
||||
},
|
||||
dismissButton = { TextButton(onClick = { remove = null }) { Text("Abbrechen") } },
|
||||
)
|
||||
}
|
||||
info?.let { message ->
|
||||
AlertDialog(onDismissRequest = {
|
||||
info = null
|
||||
}, title = { Text("Native Anmeldung") }, text = { Text(message) }, confirmButton = {
|
||||
TextButton(onClick = {
|
||||
info =
|
||||
null
|
||||
}) { Text("Verstanden") }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AuthenticationScreen(
|
||||
state: NativeState,
|
||||
needsNetwork: Boolean,
|
||||
requestNetwork: () -> Unit,
|
||||
connect: (String) -> Unit,
|
||||
login: (String, String, String) -> Unit,
|
||||
verify: (String) -> Unit,
|
||||
cancelTwoFactor: () -> Unit,
|
||||
forget: () -> Unit,
|
||||
sso: () -> Unit,
|
||||
) {
|
||||
val keyboard = LocalSoftwareKeyboardController.current
|
||||
var address by remember { mutableStateOf("") }
|
||||
var username by remember { mutableStateOf("") }
|
||||
var password by remember { mutableStateOf("") }
|
||||
var name by remember { mutableStateOf("") }
|
||||
var code by remember { mutableStateOf("") }
|
||||
var invalidAddress by remember { mutableStateOf(false) }
|
||||
Column(
|
||||
Modifier.fillMaxSize().imePadding().verticalScroll(rememberScrollState()).padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Surface(shape = RoundedCornerShape(26.dp), modifier = Modifier.widthIn(max = 412.dp).fillMaxWidth()) {
|
||||
Column(
|
||||
Modifier.padding(24.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||
) {
|
||||
BrandMark()
|
||||
Text(state.appName, fontSize = 34.sp, fontWeight = FontWeight.Bold)
|
||||
Text(
|
||||
if (state.server.isEmpty()) {
|
||||
"Dein Zuhause. Dein Server."
|
||||
} else if (state.twoFactor) {
|
||||
"Bestätige deine Anmeldung"
|
||||
} else {
|
||||
"Alles für euren Alltag an einem Ort."
|
||||
},
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
if (state.server.isEmpty()) {
|
||||
NativeField(address, {
|
||||
address = it
|
||||
invalidAddress = false
|
||||
}, "Server-Adresse", Modifier.testTag("server-url"), keyboard = KeyboardType.Uri)
|
||||
if (invalidAddress) {
|
||||
Text(
|
||||
"Bitte eine gültige HTTPS-Adresse ohne Unterpfad eingeben.",
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
"HTTPS · eigener Server · keine zentrale Cloud",
|
||||
fontSize = 12.sp,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
if (needsNetwork) TextButton(onClick = requestNetwork) { Text("Zugriff auf private Netzwerke erlauben") }
|
||||
Button(
|
||||
colors = nativeButtonColors(),
|
||||
modifier = Modifier.fillMaxWidth().height(48.dp).testTag("connect"),
|
||||
enabled =
|
||||
!state.busy && address.isNotBlank(),
|
||||
onClick = {
|
||||
keyboard?.hide()
|
||||
if (runCatching { ServerAddress.parse(address) }.isSuccess) connect(address) else invalidAddress = true
|
||||
},
|
||||
) { Text("Verbinden") }
|
||||
} else if (state.twoFactor) {
|
||||
NativeField(code, { code = it }, "Code oder Wiederherstellungscode", Modifier.testTag("two-factor-code"))
|
||||
Button(colors = nativeButtonColors(), onClick = {
|
||||
keyboard?.hide()
|
||||
verify(code)
|
||||
code = ""
|
||||
}, enabled = !state.busy && code.isNotBlank(), modifier = Modifier.fillMaxWidth()) { Text("Bestätigen") }
|
||||
TextButton(onClick = cancelTwoFactor, enabled = !state.busy) { Text("Zurück zur Anmeldung") }
|
||||
} else {
|
||||
if (state.setup) NativeField(name, { name = it }, "Anzeigename")
|
||||
if (state.passwordAllowed || state.setup) {
|
||||
NativeField(username, { username = it }, "Benutzername", Modifier.testTag("username"))
|
||||
NativeField(password, { password = it }, "Passwort", Modifier.testTag("password"), password = true)
|
||||
Button(
|
||||
colors = nativeButtonColors(),
|
||||
onClick = {
|
||||
keyboard?.hide()
|
||||
val submitted = password
|
||||
password = ""
|
||||
login(username, submitted, name)
|
||||
},
|
||||
enabled =
|
||||
!state.busy && username.isNotBlank() && password.isNotEmpty(),
|
||||
modifier = Modifier.fillMaxWidth().height(48.dp).testTag("login"),
|
||||
) {
|
||||
Text(if (state.setup) "Haushalt einrichten" else "Anmelden")
|
||||
}
|
||||
}
|
||||
if (state.oidc) TextButton(onClick = sso) { Text("SSO – noch in Umsetzung") }
|
||||
TextButton(onClick = forget, enabled = !state.busy) { Text("Anderen Server verwenden") }
|
||||
}
|
||||
if (state.busy) CircularProgressIndicator(Modifier.size(24.dp))
|
||||
state.error?.let { Text(it, color = MaterialTheme.colorScheme.error, modifier = Modifier.testTag("auth-error")) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DashboardScreen(state: NativeState, navigate: (NativePage) -> Unit) {
|
||||
val data = state.dashboard
|
||||
LazyColumn(
|
||||
contentPadding = PaddingValues(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||
modifier = Modifier.testTag("native-dashboard"),
|
||||
) {
|
||||
item {
|
||||
Text(
|
||||
"Hallo, ${state.user?.text("display_name").orEmpty().ifBlank {
|
||||
state.user?.text("username").orEmpty()
|
||||
}}",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
)
|
||||
Text(
|
||||
LocalDate.now().format(DateTimeFormatter.ofPattern("EEEE, d. MMMM", Locale.GERMAN)),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
if (state.access("tasks") != "none" && state.widget("tasks")) {
|
||||
item {
|
||||
DashboardCard("Aufgaben", "${data.countText("openTaskCount")} offen", NativePage.TASKS, { navigate(NativePage.TASKS) }) {
|
||||
val tasks = data.rows("urgentTasks")
|
||||
if (tasks.isEmpty()) EmptyHint("Keine dringenden Aufgaben")
|
||||
tasks.forEach { PreviewRow(it.text("title"), it.text("due_date")) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.access("calendar") != "none" && state.widget("calendar")) {
|
||||
item {
|
||||
DashboardCard("Kalender", "Nächste Termine", null, {}) {
|
||||
val events = data.rows("upcomingEvents")
|
||||
if (events.isEmpty()) EmptyHint("Keine anstehenden Termine")
|
||||
events.forEach { PreviewRow(it.text("title"), it.text("start_datetime").replace('T', ' ').take(16)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.access("shopping") != "none" && state.widget("shopping")) {
|
||||
item {
|
||||
DashboardCard("Einkauf", "${data.countText("shoppingOpenCount")} offene Artikel", NativePage.SHOPPING, {
|
||||
navigate(NativePage.SHOPPING)
|
||||
}) {
|
||||
data.rows("shoppingLists").forEach { PreviewRow(it.text("name"), "${it.optInt("open_count")} offen") }
|
||||
if (data.rows("shoppingLists").isEmpty()) EmptyHint("Alles eingekauft")
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state.access("notes") != "none" && state.widget("notes")) {
|
||||
item {
|
||||
DashboardCard("Notizen", "Angeheftet", NativePage.NOTES, { navigate(NativePage.NOTES) }) {
|
||||
val notes = data.rows("pinnedNotes")
|
||||
if (notes.isEmpty()) EmptyHint("Noch keine Notizen")
|
||||
notes.forEach { PreviewRow(it.text("title").ifBlank { "Notiz" }, it.text("content").take(140)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DashboardCard(
|
||||
title: String,
|
||||
subtitle: String,
|
||||
page: NativePage?,
|
||||
onClick: () -> Unit,
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
) {
|
||||
Surface(shape = PageShape, modifier = Modifier.fillMaxWidth()) {
|
||||
Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
if (page != null) {
|
||||
Glyph(page, MaterialTheme.colorScheme.primary)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
}
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(title, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
|
||||
Text(subtitle, fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
if (page != null) TextButton(onClick = onClick) { Text("Alle") }
|
||||
}
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NativeCollection(
|
||||
state: NativeState,
|
||||
write: Boolean,
|
||||
onEdit: (JSONObject) -> Unit,
|
||||
onTask: (JSONObject) -> Unit,
|
||||
onPin: (JSONObject) -> Unit,
|
||||
onItem: (JSONObject) -> Unit,
|
||||
onList: (JSONObject) -> Unit,
|
||||
onRemove: (String) -> Unit,
|
||||
) {
|
||||
var query by remember(state.page, state.listId) { mutableStateOf("") }
|
||||
var status by remember { mutableStateOf("open") }
|
||||
Column(Modifier.fillMaxSize()) {
|
||||
NativeField(query, { query = it }, "Suchen", Modifier.padding(16.dp))
|
||||
if (state.page == NativePage.TASKS) {
|
||||
Row(Modifier.padding(horizontal = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
listOf("open" to "Offen", "done" to "Erledigt", "all" to "Alle").forEach { (value, label) ->
|
||||
FilterChip(
|
||||
selected =
|
||||
status == value,
|
||||
onClick = { status = value },
|
||||
label = { Text(label) },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
val rows = state.rows.filter { row ->
|
||||
val title = if (state.page == NativePage.SHOPPING) row.text("name") else row.text("title")
|
||||
val matches = query.isBlank() || (title + row.text("content") + row.text("description")).contains(query, true)
|
||||
matches &&
|
||||
(
|
||||
state.page != NativePage.TASKS || status == "all" ||
|
||||
if (status == "done") row.text("status") == "done" else row.text("status") != "done"
|
||||
)
|
||||
}
|
||||
LazyColumn(
|
||||
contentPadding = PaddingValues(start = 16.dp, end = 16.dp, bottom = 16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
if (rows.isEmpty() &&
|
||||
!state.busy
|
||||
) {
|
||||
item { EmptyHint(if (query.isBlank()) "Hier gibt es noch keine Einträge." else "Keine passenden Einträge.") }
|
||||
}
|
||||
items(rows, key = { it.getLong("id") }) { row ->
|
||||
Surface(shape = PageShape, modifier = Modifier.fillMaxWidth()) {
|
||||
Column(Modifier.padding(12.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
val checked = if (state.page ==
|
||||
NativePage.TASKS
|
||||
) {
|
||||
row.text("status") == "done"
|
||||
} else {
|
||||
row.optInt("is_checked") == 1
|
||||
}
|
||||
if (state.page == NativePage.TASKS ||
|
||||
(state.page == NativePage.SHOPPING && state.listId != null)
|
||||
) {
|
||||
Checkbox(checked, onCheckedChange = {
|
||||
if (state.page ==
|
||||
NativePage.TASKS
|
||||
) {
|
||||
onTask(row)
|
||||
} else {
|
||||
onItem(row)
|
||||
}
|
||||
}, enabled = write)
|
||||
}
|
||||
val title = if (state.page == NativePage.SHOPPING) row.text("name") else row.text("title").ifBlank { "Notiz" }
|
||||
Column(
|
||||
Modifier.weight(1f).clip(RoundedCornerShape(8.dp)).clickable(
|
||||
enabled =
|
||||
!state.busy && (write || state.page == NativePage.SHOPPING && state.listId == null),
|
||||
) {
|
||||
if (state.page == NativePage.SHOPPING && state.listId == null) onList(row) else onEdit(row)
|
||||
}.padding(4.dp),
|
||||
) {
|
||||
Text(
|
||||
title,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
textDecoration = if (checked) TextDecoration.LineThrough else null,
|
||||
)
|
||||
val detail = when (state.page) {
|
||||
NativePage.TASKS -> listOf(
|
||||
row.text("category"),
|
||||
row.text("due_date"),
|
||||
row.text("priority").takeUnless {
|
||||
it ==
|
||||
"none"
|
||||
}.orEmpty(),
|
||||
).filter { it.isNotBlank() }.joinToString(" · ")
|
||||
NativePage.NOTES -> row.text("content")
|
||||
NativePage.SHOPPING -> if (state.listId !=
|
||||
null
|
||||
) {
|
||||
listOf(row.text("quantity"), row.text("category")).filter {
|
||||
it.isNotBlank()
|
||||
}.joinToString(" · ")
|
||||
} else {
|
||||
"${row.optInt("item_total")} Artikel"
|
||||
}
|
||||
else -> ""
|
||||
}
|
||||
if (detail.isNotBlank()) Text(detail, color = MaterialTheme.colorScheme.onSurfaceVariant, fontSize = 14.sp)
|
||||
}
|
||||
if (state.page == NativePage.NOTES &&
|
||||
write
|
||||
) {
|
||||
TextButton(onClick = { onPin(row) }) { Text(if (row.optInt("pinned") == 1) "Lösen" else "Anheften") }
|
||||
}
|
||||
}
|
||||
if (write) {
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
|
||||
TextButton(onClick = {
|
||||
onRemove(
|
||||
when (state.page) {
|
||||
NativePage.TASKS -> "/tasks/${row.getLong("id")}"
|
||||
NativePage.NOTES -> "/notes/${row.getLong("id")}"
|
||||
else -> if (state.listId ==
|
||||
null
|
||||
) {
|
||||
"/shopping/${row.getLong("id")}"
|
||||
} else {
|
||||
"/shopping/items/${row.getLong("id")}"
|
||||
}
|
||||
},
|
||||
)
|
||||
}) { Text("Löschen", color = MaterialTheme.colorScheme.error) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun EntryEditor(state: NativeState, entry: JSONObject?, onDismiss: () -> Unit, save: (String, String, String, String) -> Unit) {
|
||||
val keyboard = LocalSoftwareKeyboardController.current
|
||||
var title by remember { mutableStateOf(entry?.text(if (state.page == NativePage.SHOPPING) "name" else "title").orEmpty()) }
|
||||
var detail by remember {
|
||||
mutableStateOf(
|
||||
entry?.text(
|
||||
when (state.page) {
|
||||
NativePage.NOTES -> "content"
|
||||
NativePage.SHOPPING -> "quantity"
|
||||
else -> "description"
|
||||
},
|
||||
).orEmpty(),
|
||||
)
|
||||
}
|
||||
var priority by remember { mutableStateOf(entry?.text("priority")?.ifBlank { "none" } ?: "none") }
|
||||
var date by remember { mutableStateOf(entry?.text("due_date").orEmpty()) }
|
||||
val validDate = date.isBlank() || runCatching { LocalDate.parse(date) }.isSuccess
|
||||
AlertDialog(onDismissRequest = { if (!state.busy) onDismiss() }, title = {
|
||||
Text(
|
||||
if (entry ==
|
||||
null
|
||||
) {
|
||||
"Hinzufügen"
|
||||
} else {
|
||||
"Bearbeiten"
|
||||
},
|
||||
)
|
||||
}, text = {
|
||||
Column(Modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
state.error?.let { Text(it, color = MaterialTheme.colorScheme.error) }
|
||||
NativeField(title, { title = it }, if (state.page == NativePage.SHOPPING) "Name" else "Titel", Modifier.testTag("entry-title"))
|
||||
if (state.page != NativePage.SHOPPING ||
|
||||
state.listId != null
|
||||
) {
|
||||
NativeField(
|
||||
detail,
|
||||
{ detail = it },
|
||||
when (state.page) {
|
||||
NativePage.NOTES -> "Inhalt"
|
||||
NativePage.SHOPPING -> "Menge"
|
||||
else -> "Beschreibung"
|
||||
},
|
||||
Modifier.testTag("entry-detail"),
|
||||
singleLine =
|
||||
state.page == NativePage.SHOPPING,
|
||||
)
|
||||
}
|
||||
if (state.page == NativePage.TASKS) {
|
||||
Text("Priorität")
|
||||
Column {
|
||||
listOf(
|
||||
"none" to "Keine",
|
||||
"low" to "Niedrig",
|
||||
"medium" to "Mittel",
|
||||
"high" to "Hoch",
|
||||
"urgent" to "Dringend",
|
||||
).forEach { (value, label) ->
|
||||
FilterChip(selected = priority == value, onClick = { priority = value }, label = { Text(label) })
|
||||
}
|
||||
}
|
||||
NativeField(date, { date = it }, "Fällig am (JJJJ-MM-TT)")
|
||||
if (!validDate) Text("Bitte ein gültiges Datum eingeben.", color = MaterialTheme.colorScheme.error)
|
||||
}
|
||||
}
|
||||
}, confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
keyboard?.hide()
|
||||
save(title, detail, priority, date)
|
||||
},
|
||||
enabled =
|
||||
validDate && !state.busy && (title.isNotBlank() || state.page == NativePage.NOTES && detail.isNotBlank()) &&
|
||||
(state.page != NativePage.NOTES || detail.isNotBlank()),
|
||||
modifier = Modifier.testTag("entry-save"),
|
||||
) { Text("Speichern") }
|
||||
}, dismissButton = { TextButton(onClick = onDismiss, enabled = !state.busy) { Text("Abbrechen") } })
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MoreScreen(state: NativeState, logout: () -> Unit, forget: () -> Unit) {
|
||||
LazyColumn(contentPadding = PaddingValues(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
item {
|
||||
DashboardCard("Dein Haushalt", state.appName, null, {}) {
|
||||
Text(state.user?.text("display_name").orEmpty())
|
||||
Text(state.server, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
item {
|
||||
DashboardCard("Konto", "Native Sitzung", null, {}) {
|
||||
TextButton(onClick = logout, enabled = !state.busy) { Text("Abmelden") }
|
||||
TextButton(onClick = forget, enabled = !state.busy) { Text("Server und lokale Sitzung entfernen") }
|
||||
}
|
||||
}
|
||||
item {
|
||||
DashboardCard("Nativer Neubau", "Noch keine vollständige PWA-Parität", null, {}) {
|
||||
Text(
|
||||
"Kalender, Schichtplan, Geburtstage, Küche, Vorrat, Budget, Kontakte, Dokumente, Inventar, " +
|
||||
"Haushaltshilfe, Abfall, Belohnungen, Gesundheit und Einstellungen werden separat nativ nachgebaut. " +
|
||||
"Es gibt keinen Browser-Fallback.",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun nativeButtonColors() = ButtonDefaults.buttonColors(
|
||||
containerColor = if (isSystemInDarkTheme()) Color(0xFF7C3AED) else Violet,
|
||||
contentColor = Color.White,
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun NativeField(
|
||||
value: String,
|
||||
change: (String) -> Unit,
|
||||
label: String,
|
||||
modifier: Modifier = Modifier,
|
||||
password: Boolean = false,
|
||||
keyboard: KeyboardType = KeyboardType.Text,
|
||||
singleLine: Boolean = true,
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value,
|
||||
change,
|
||||
label = { Text(label) },
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
singleLine = singleLine,
|
||||
visualTransformation = if (password) PasswordVisualTransformation() else VisualTransformation.None,
|
||||
keyboardOptions = KeyboardOptions(keyboardType = if (password) KeyboardType.Password else keyboard),
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun EmptyHint(text: String) {
|
||||
Text(text, Modifier.padding(vertical = 20.dp), color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PreviewRow(title: String, detail: String) {
|
||||
Column(Modifier.fillMaxWidth().padding(vertical = 4.dp)) {
|
||||
Text(title, fontWeight = FontWeight.Medium)
|
||||
if (detail.isNotBlank()) Text(detail, fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ErrorCard(text: String, dismiss: () -> Unit) {
|
||||
Surface(Modifier.padding(horizontal = 16.dp).fillMaxWidth(), shape = PageShape, color = MaterialTheme.colorScheme.errorContainer) {
|
||||
Row(Modifier.padding(12.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(text, Modifier.weight(1f))
|
||||
TextButton(onClick = dismiss) { Text("Schließen") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun BrandMark() {
|
||||
Canvas(Modifier.size(64.dp).semantics { contentDescription = "Yuvomi" }) {
|
||||
drawRoundRect(Brush.linearGradient(listOf(Color(0xFF8B5CF6), Violet)), cornerRadius = CornerRadius(size.width * .225f))
|
||||
listOf(Triple(64f, 72f, 27f), Triple(100f, 78f, 25f), Triple(80f, 106f, 24f)).forEach { (x, y, radius) ->
|
||||
drawCircle(Color.White.copy(alpha = .82f), radius * size.width / 160, Offset(x * size.width / 160, y * size.height / 160))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Glyph(page: NativePage, color: Color) {
|
||||
Canvas(Modifier.size(24.dp)) {
|
||||
val scale = size.width / 24
|
||||
val path = Path()
|
||||
when (page) {
|
||||
NativePage.HOME -> {
|
||||
path.moveTo(3 * scale, 10 * scale)
|
||||
path.lineTo(12 * scale, 3 * scale)
|
||||
path.lineTo(21 * scale, 10 * scale)
|
||||
path.lineTo(21 * scale, 21 * scale)
|
||||
path.lineTo(3 * scale, 21 * scale)
|
||||
path.close()
|
||||
}
|
||||
NativePage.TASKS -> {
|
||||
path.moveTo(4 * scale, 12 * scale)
|
||||
path.lineTo(10 * scale, 18 * scale)
|
||||
path.lineTo(21 * scale, 5 * scale)
|
||||
}
|
||||
NativePage.SHOPPING -> {
|
||||
path.moveTo(2 * scale, 3 * scale)
|
||||
path.lineTo(5 * scale, 3 * scale)
|
||||
path.lineTo(8 * scale, 16 * scale)
|
||||
path.lineTo(20 * scale, 16 * scale)
|
||||
path.lineTo(22 * scale, 7 * scale)
|
||||
path.lineTo(6 * scale, 7 * scale)
|
||||
drawCircle(
|
||||
color,
|
||||
1.5f * scale,
|
||||
Offset(9 * scale, 21 * scale),
|
||||
)
|
||||
drawCircle(color, 1.5f * scale, Offset(19 * scale, 21 * scale))
|
||||
}
|
||||
NativePage.NOTES -> {
|
||||
path.moveTo(5 * scale, 3 * scale)
|
||||
path.lineTo(19 * scale, 3 * scale)
|
||||
path.lineTo(19 * scale, 21 * scale)
|
||||
path.lineTo(5 * scale, 21 * scale)
|
||||
path.close()
|
||||
path.moveTo(9 * scale, 8 * scale)
|
||||
path.lineTo(15 * scale, 8 * scale)
|
||||
path.moveTo(9 * scale, 13 * scale)
|
||||
path.lineTo(15 * scale, 13 * scale)
|
||||
}
|
||||
NativePage.MORE -> {
|
||||
listOf(5f, 12f, 19f).forEach { drawCircle(color, 1.5f * scale, Offset(it * scale, 12 * scale)) }
|
||||
}
|
||||
}
|
||||
drawPath(path, color, style = Stroke(width = 1.8f * scale))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import java.util.concurrent.Executors
|
||||
import org.json.JSONObject
|
||||
|
||||
enum class NativePage(val title: String) {
|
||||
HOME("Übersicht"),
|
||||
TASKS("Aufgaben"),
|
||||
SHOPPING("Einkauf"),
|
||||
NOTES("Notizen"),
|
||||
MORE("Mehr"),
|
||||
}
|
||||
|
||||
data class NativeState(
|
||||
val server: String = "",
|
||||
val appName: String = "Yuvomi",
|
||||
val user: JSONObject? = null,
|
||||
val permissions: JSONObject = JSONObject(),
|
||||
val setup: Boolean = false,
|
||||
val passwordAllowed: Boolean = true,
|
||||
val oidc: Boolean = false,
|
||||
val twoFactor: Boolean = false,
|
||||
val resetAllowed: Boolean = false,
|
||||
val page: NativePage = NativePage.HOME,
|
||||
val dashboard: JSONObject = JSONObject(),
|
||||
val rows: List<JSONObject> = emptyList(),
|
||||
val listId: Long? = null,
|
||||
val listName: String = "",
|
||||
val busy: Boolean = false,
|
||||
val error: String? = null,
|
||||
) {
|
||||
fun access(module: String): String = if (permissions.optBoolean("admin")) {
|
||||
"write"
|
||||
} else {
|
||||
permissions.optJSONObject("modules")?.optString(module, "write")
|
||||
?: "write"
|
||||
}
|
||||
fun widget(id: String): Boolean = permissions.optBoolean("admin") || permissions.optJSONObject("widgets")?.optString(id) != "none"
|
||||
}
|
||||
|
||||
class NativeController(application: Application) : AndroidViewModel(application) {
|
||||
var state by mutableStateOf(NativeState())
|
||||
private set
|
||||
private val preferences = application.getSharedPreferences("native-server", Context.MODE_PRIVATE)
|
||||
private val worker = Executors.newSingleThreadExecutor()
|
||||
private val main = Handler(Looper.getMainLooper())
|
||||
private var generation = 0
|
||||
private var client: NativeApi? = null
|
||||
private var vault: NativeSession? = null
|
||||
|
||||
init {
|
||||
preferences.getString("origin", null)?.let { connect(it) }
|
||||
}
|
||||
|
||||
private fun perform(clearOnFailure: Boolean = false, block: (NativeState) -> NativeState) {
|
||||
if (state.busy) return
|
||||
val previous = state
|
||||
val selectedGeneration = generation
|
||||
state = previous.copy(busy = true, error = null)
|
||||
worker.execute {
|
||||
val result = runCatching { block(previous) }
|
||||
main.post {
|
||||
if (generation != selectedGeneration) return@post
|
||||
state = result.fold(
|
||||
{ it.copy(busy = false) },
|
||||
{ error ->
|
||||
if (clearOnFailure || error is NativeApiError && error.status == 401 && previous.user != null) {
|
||||
previous.copy(
|
||||
user = null,
|
||||
permissions = JSONObject(),
|
||||
dashboard = JSONObject(),
|
||||
rows = emptyList(),
|
||||
page = NativePage.HOME,
|
||||
listId = null,
|
||||
twoFactor = false,
|
||||
busy = false,
|
||||
error = if (clearOnFailure) {
|
||||
"Der lokale Sitzungsspeicher konnte nicht vollständig gelöscht werden. " +
|
||||
"Bitte die App-Daten über Android entfernen."
|
||||
} else {
|
||||
"Deine Sitzung ist abgelaufen. Bitte erneut anmelden."
|
||||
},
|
||||
)
|
||||
} else {
|
||||
previous.copy(
|
||||
busy = false,
|
||||
error = if (error is NativeApiError) {
|
||||
error.userMessage()
|
||||
} else {
|
||||
"Verbindung fehlgeschlagen. Bitte Server, Zertifikat und Netzwerk prüfen."
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun dismissError() {
|
||||
state = state.copy(error = null)
|
||||
}
|
||||
|
||||
fun connect(input: String) = perform {
|
||||
val server = ServerAddress.parse(input)
|
||||
val storage = NativeSession(getApplication(), server.origin)
|
||||
val api = NativeApi(server, NativeCookies(server, storage.load()), storage::save)
|
||||
val metadata = api.request("/version")
|
||||
require(
|
||||
metadata.opt("app_name") is String && metadata.opt("setup_required") is Boolean &&
|
||||
metadata.opt("password_reset_enabled") is Boolean,
|
||||
)
|
||||
val oidc = api.request("/auth/oidc/config")
|
||||
require(oidc.opt("enabled") is Boolean && oidc.opt("password_login_enabled") is Boolean)
|
||||
client = api
|
||||
vault = storage
|
||||
preferences.checkedEdit { putString("origin", server.origin) }
|
||||
val base = NativeState(
|
||||
server = server.origin,
|
||||
appName = metadata.getString("app_name"),
|
||||
setup = metadata.getBoolean("setup_required"),
|
||||
passwordAllowed = oidc.getBoolean("password_login_enabled") || oidc.optBoolean("guest_password_login_enabled"),
|
||||
oidc = oidc.getBoolean("enabled"),
|
||||
resetAllowed = metadata.getBoolean("password_reset_enabled"),
|
||||
)
|
||||
try {
|
||||
authenticated(base, api.request("/auth/me"))
|
||||
} catch (error: NativeApiError) {
|
||||
if (error.status == 401) base else throw error
|
||||
}
|
||||
}
|
||||
|
||||
fun login(username: String, password: String, displayName: String = "") = perform { previous ->
|
||||
val api = requireNotNull(client)
|
||||
if (previous.setup) {
|
||||
api.request(
|
||||
"/auth/setup",
|
||||
"POST",
|
||||
JSONObject().put("username", username.trim()).put("password", password).put(
|
||||
"display_name",
|
||||
displayName.trim().ifEmpty {
|
||||
username.trim()
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
val result = api.request("/auth/login", "POST", JSONObject().put("username", username.trim()).put("password", password))
|
||||
if (result.optBoolean("twoFactorRequired")) previous.copy(setup = false, twoFactor = true) else authenticated(previous, result)
|
||||
}
|
||||
|
||||
fun verify(code: String) = perform { previous ->
|
||||
authenticated(previous, requireNotNull(client).request("/auth/2fa/verify", "POST", JSONObject().put("code", code.trim())))
|
||||
}
|
||||
|
||||
fun cancelTwoFactor() {
|
||||
if (!state.busy) state = state.copy(twoFactor = false, error = null)
|
||||
}
|
||||
|
||||
private fun authenticated(previous: NativeState, response: JSONObject): NativeState {
|
||||
val user = response.getJSONObject("user")
|
||||
val permissions = response.getJSONObject("permissions")
|
||||
val signedIn = previous.copy(
|
||||
user = user,
|
||||
permissions = permissions,
|
||||
setup = false,
|
||||
twoFactor = false,
|
||||
page = NativePage.HOME,
|
||||
dashboard = JSONObject(),
|
||||
rows = emptyList(),
|
||||
)
|
||||
return try {
|
||||
signedIn.copy(dashboard = requireNotNull(client).request("/dashboard"))
|
||||
} catch (error: Exception) {
|
||||
if (error is NativeApiError && error.status == 401) throw error
|
||||
signedIn.copy(error = "Die Anmeldung war erfolgreich. Die Übersicht konnte noch nicht geladen werden.")
|
||||
}
|
||||
}
|
||||
|
||||
fun navigate(page: NativePage) = perform { previous -> load(previous.copy(page = page, listId = null, rows = emptyList())) }
|
||||
fun refresh() = perform { previous -> load(previous) }
|
||||
fun openList(id: Long, name: String) =
|
||||
perform { previous -> load(previous.copy(page = NativePage.SHOPPING, listId = id, listName = name)) }
|
||||
|
||||
private fun load(previous: NativeState): NativeState {
|
||||
val api = requireNotNull(client)
|
||||
return when (previous.page) {
|
||||
NativePage.HOME -> previous.copy(dashboard = api.request("/dashboard"))
|
||||
NativePage.TASKS -> previous.copy(rows = api.request("/tasks").rows())
|
||||
NativePage.NOTES -> previous.copy(rows = api.request("/notes").rows())
|
||||
NativePage.SHOPPING -> previous.copy(rows = api.request(previous.listId?.let { "/shopping/$it/items" } ?: "/shopping").rows())
|
||||
NativePage.MORE -> previous
|
||||
}
|
||||
}
|
||||
|
||||
fun saveTask(id: Long?, title: String, description: String, priority: String, date: String) = perform { previous ->
|
||||
val payload = JSONObject().put("title", title.trim()).put("description", description).put("priority", priority).put(
|
||||
"due_date",
|
||||
date.ifBlank { null } ?: JSONObject.NULL,
|
||||
)
|
||||
requireNotNull(client).request(id?.let { "/tasks/$it" } ?: "/tasks", if (id == null) "POST" else "PUT", payload)
|
||||
load(previous)
|
||||
}
|
||||
|
||||
fun completeTask(task: JSONObject) = perform { previous ->
|
||||
requireNotNull(client).request(
|
||||
"/tasks/${task.getLong("id")}/status",
|
||||
"PATCH",
|
||||
JSONObject().put(
|
||||
"status",
|
||||
if (task.text("status") ==
|
||||
"done"
|
||||
) {
|
||||
"open"
|
||||
} else {
|
||||
"done"
|
||||
},
|
||||
),
|
||||
)
|
||||
load(previous)
|
||||
}
|
||||
|
||||
fun saveNote(id: Long?, title: String, content: String) = perform { previous ->
|
||||
requireNotNull(client).request(
|
||||
id?.let { "/notes/$it" } ?: "/notes",
|
||||
if (id ==
|
||||
null
|
||||
) {
|
||||
"POST"
|
||||
} else {
|
||||
"PUT"
|
||||
},
|
||||
JSONObject().put("title", title.trim()).put("content", content),
|
||||
)
|
||||
load(previous)
|
||||
}
|
||||
|
||||
fun pinNote(note: JSONObject) = perform { previous ->
|
||||
requireNotNull(client).request("/notes/${note.getLong("id")}/pin", "PATCH", JSONObject())
|
||||
load(previous)
|
||||
}
|
||||
|
||||
fun saveShopping(id: Long?, name: String, quantity: String) = perform { previous ->
|
||||
val path = id?.let { "/shopping/items/$it" } ?: previous.listId?.let { "/shopping/$it/items" } ?: "/shopping"
|
||||
requireNotNull(client).request(
|
||||
path,
|
||||
if (id ==
|
||||
null
|
||||
) {
|
||||
"POST"
|
||||
} else {
|
||||
"PATCH"
|
||||
},
|
||||
JSONObject().put("name", name.trim()).apply {
|
||||
if (previous.listId !=
|
||||
null
|
||||
) {
|
||||
put("quantity", quantity)
|
||||
}
|
||||
},
|
||||
)
|
||||
load(previous)
|
||||
}
|
||||
|
||||
fun checkItem(item: JSONObject) = perform { previous ->
|
||||
requireNotNull(client).request(
|
||||
"/shopping/items/${item.getLong("id")}",
|
||||
"PATCH",
|
||||
JSONObject().put(
|
||||
"is_checked",
|
||||
if (item.optInt("is_checked") ==
|
||||
1
|
||||
) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
},
|
||||
),
|
||||
)
|
||||
load(previous)
|
||||
}
|
||||
|
||||
fun remove(path: String) = perform { previous ->
|
||||
requireNotNull(client).request(path, "DELETE")
|
||||
load(previous)
|
||||
}
|
||||
|
||||
fun logout(forgetServer: Boolean = false) = perform(clearOnFailure = true) { previous ->
|
||||
val revoked = runCatching {
|
||||
requireNotNull(client).request("/auth/logout", "POST", JSONObject())
|
||||
}.isSuccess
|
||||
client?.clear()
|
||||
vault?.clear()
|
||||
if (forgetServer) {
|
||||
preferences.checkedEdit { clear() }
|
||||
client = null
|
||||
vault = null
|
||||
NativeState()
|
||||
} else {
|
||||
previous.copy(
|
||||
user = null,
|
||||
permissions = JSONObject(),
|
||||
dashboard = JSONObject(),
|
||||
rows = emptyList(),
|
||||
listId = null,
|
||||
page = NativePage.HOME,
|
||||
twoFactor = false,
|
||||
error = if (revoked) null else "Lokal abgemeldet. Die Abmeldung auf dem Server konnte nicht bestätigt werden.",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun forgetLocalServer() = perform(clearOnFailure = true) {
|
||||
client?.clear()
|
||||
vault?.clear()
|
||||
preferences.checkedEdit { clear() }
|
||||
client = null
|
||||
vault = null
|
||||
NativeState()
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
generation++
|
||||
worker.shutdownNow()
|
||||
super.onCleared()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.security.keystore.KeyGenParameterSpec
|
||||
import android.security.keystore.KeyProperties
|
||||
import android.util.Base64
|
||||
import java.security.KeyStore
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.KeyGenerator
|
||||
import javax.crypto.SecretKey
|
||||
import javax.crypto.spec.GCMParameterSpec
|
||||
|
||||
/** Native cookies are encrypted with an OS-keystore key and bound to one origin. */
|
||||
class NativeSession(context: Context, private val origin: String) {
|
||||
private val preferences = context.getSharedPreferences("native-session", Context.MODE_PRIVATE)
|
||||
private val alias = "yuvomi-native-session-v1"
|
||||
|
||||
private fun key(): SecretKey {
|
||||
val store = KeyStore.getInstance("AndroidKeyStore").apply { load(null) }
|
||||
(store.getKey(alias, null) as? SecretKey)?.let { return it }
|
||||
return KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore").apply {
|
||||
init(
|
||||
KeyGenParameterSpec.Builder(alias, KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT)
|
||||
.setBlockModes(KeyProperties.BLOCK_MODE_GCM)
|
||||
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
|
||||
.build(),
|
||||
)
|
||||
}.generateKey()
|
||||
}
|
||||
|
||||
fun load(): String? = runCatching {
|
||||
val encoded = preferences.getString(origin, null) ?: return null
|
||||
val bytes = Base64.decode(encoded, Base64.NO_WRAP)
|
||||
require(bytes.size > 28)
|
||||
Cipher.getInstance("AES/GCM/NoPadding").run {
|
||||
init(Cipher.DECRYPT_MODE, key(), GCMParameterSpec(128, bytes.copyOfRange(0, 12)))
|
||||
updateAAD(origin.toByteArray())
|
||||
String(doFinal(bytes.copyOfRange(12, bytes.size)), Charsets.UTF_8)
|
||||
}
|
||||
}.getOrNull()
|
||||
|
||||
fun save(value: String) {
|
||||
val cipher = Cipher.getInstance("AES/GCM/NoPadding")
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key())
|
||||
cipher.updateAAD(origin.toByteArray())
|
||||
val encoded = Base64.encodeToString(cipher.iv + cipher.doFinal(value.toByteArray()), Base64.NO_WRAP)
|
||||
preferences.checkedEdit { putString(origin, encoded) }
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
preferences.checkedEdit { remove(origin) }
|
||||
}
|
||||
}
|
||||
|
||||
/** Unlike KTX edit(commit=true), this does not discard a failed persistence result. */
|
||||
@SuppressLint("UseKtx")
|
||||
fun SharedPreferences.checkedEdit(change: SharedPreferences.Editor.() -> Unit) {
|
||||
val editor = edit()
|
||||
editor.change()
|
||||
check(editor.commit())
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Yuvomi Mobile</string>
|
||||
<string name="checking_server">Checking your server…</string>
|
||||
<string name="probe_failed">Cannot verify a compatible Yuvomi server. Check the URL, TLS certificate, VPN, and reverse-proxy access.</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,74 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class NativeCookiesTest {
|
||||
private val server = ServerAddress.parse("https://home.example:8443")
|
||||
|
||||
@Test fun acceptsOnlySecureSameHostSessionCookies() {
|
||||
val jar = NativeCookies(server)
|
||||
jar.accept(listOf("yuvomi.sid=valid; Secure; HttpOnly; Path=/; Max-Age=60"))
|
||||
assertEquals("yuvomi.sid=valid", jar.header())
|
||||
jar.accept(listOf("yuvomi.sid=insecure; Path=/", "other=unwanted; Secure", "yuvomi.sid=other-host; Domain=evil.example; Secure"))
|
||||
assertEquals("yuvomi.sid=valid", jar.header())
|
||||
}
|
||||
|
||||
@Test fun absoluteExpiryDoesNotExtendWhenRestoring() {
|
||||
val now = System.currentTimeMillis()
|
||||
val jar = NativeCookies(server)
|
||||
jar.accept(listOf("yuvomi.sid=short; Secure; Path=/; Max-Age=60"), now)
|
||||
val restored = NativeCookies(server, jar.serialized(now))
|
||||
assertEquals("yuvomi.sid=short", restored.header(now + 59_000))
|
||||
assertEquals("", restored.header(now + 61_000))
|
||||
}
|
||||
|
||||
@Test fun sessionOnlyCookieIsNotPersisted() {
|
||||
val jar = NativeCookies(server)
|
||||
jar.accept(listOf("yuvomi.sid=temporary; Secure; Path=/"))
|
||||
assertEquals("yuvomi.sid=temporary", jar.header())
|
||||
assertEquals("[]", jar.serialized())
|
||||
}
|
||||
|
||||
@Test fun deletionAndClearRemoveSession() {
|
||||
val jar = NativeCookies(server)
|
||||
jar.accept(listOf("yuvomi.sid=valid; Secure; Max-Age=60"))
|
||||
jar.accept(listOf("yuvomi.sid=deleted; Secure; Max-Age=0"))
|
||||
assertEquals("", jar.header())
|
||||
jar.accept(listOf("csrf-token=token; Secure; Max-Age=60"))
|
||||
jar.clear()
|
||||
assertEquals("", jar.header())
|
||||
}
|
||||
|
||||
@Test fun rejectsMalformedAndHeaderInjectionPersistence() {
|
||||
assertEquals("", NativeCookies(server, "not-json").header())
|
||||
val rows = JSONArray().put(
|
||||
JSONObject().put("name", "yuvomi.sid").put("value", "bad\r\nInjected: value").put(
|
||||
"expires",
|
||||
Long.MAX_VALUE - 1,
|
||||
),
|
||||
)
|
||||
assertEquals("", NativeCookies(server, rows.toString()).header())
|
||||
}
|
||||
|
||||
@Test fun permissionPayloadKeepsReadOnlyAndHiddenModulesDistinct() {
|
||||
val state =
|
||||
NativeState(
|
||||
permissions = JSONObject("""{"admin":false,"modules":{"tasks":"read","notes":"none"},"widgets":{"shopping":"none"}}"""),
|
||||
)
|
||||
assertEquals("read", state.access("tasks"))
|
||||
assertEquals("none", state.access("notes"))
|
||||
assertEquals("write", state.access("shopping"))
|
||||
assertFalse(state.widget("shopping"))
|
||||
assertTrue(state.widget("notes"))
|
||||
}
|
||||
|
||||
@Test fun unavailableCounterIsNotShownAsZero() {
|
||||
assertEquals("—", JSONObject("""{"openTaskCount":null}""").countText("openTaskCount"))
|
||||
assertEquals("0", JSONObject("""{"openTaskCount":0}""").countText("openTaskCount"))
|
||||
}
|
||||
}
|
||||
@@ -46,17 +46,4 @@ class ServerAddressTest {
|
||||
assertFalse(it, server.owns(it))
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun blobDownloadsCannotCrossOriginsOrDowngradeTls() {
|
||||
val server = ServerAddress.parse("https://family.example")
|
||||
assertTrue(BlobTransfer.owns(server, "blob:https://family.example/unique-id"))
|
||||
listOf(
|
||||
"blob:https://evil.example/id",
|
||||
"blob:http://family.example/id",
|
||||
"blob:https://family.example.evil.test/id",
|
||||
"data:text/plain,hi",
|
||||
).forEach {
|
||||
assertFalse(it, BlobTransfer.owns(server, it))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ buildscript {
|
||||
when (requested.group) {
|
||||
"io.netty" -> useVersion("4.1.139.Final")
|
||||
"com.google.protobuf" -> useVersion("3.25.9")
|
||||
"com.google.crypto.tink" -> useVersion("1.15.0")
|
||||
"org.bouncycastle" -> useVersion("1.86")
|
||||
"org.apache.commons" -> if (requested.name == "commons-lang3") useVersion("3.21.0")
|
||||
"org.apache.httpcomponents" -> if (requested.name == "httpclient") useVersion("4.5.14")
|
||||
@@ -21,7 +22,10 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
plugins { id("com.android.application") version "9.4.1" apply false }
|
||||
plugins {
|
||||
id("com.android.application") version "9.4.1" apply false
|
||||
id("org.jetbrains.kotlin.plugin.compose") version "2.4.21" apply false
|
||||
}
|
||||
|
||||
// WSL mounted Windows volumes may reject Gradle's POSIX file metadata operations.
|
||||
// Opt-in external output root; ordinary developer/CI builds retain standard paths.
|
||||
|
||||
@@ -41,7 +41,7 @@ com.android:zipflinger:9.4.1=classpath
|
||||
com.google.auto.value:auto-value-annotations:1.6.2=classpath
|
||||
com.google.code.findbugs:jsr305:3.0.2=classpath
|
||||
com.google.code.gson:gson:2.11.0=classpath
|
||||
com.google.crypto.tink:tink:1.7.0=classpath
|
||||
com.google.crypto.tink:tink:1.15.0=classpath
|
||||
com.google.dagger:dagger:2.28.3=classpath
|
||||
com.google.errorprone:error_prone_annotations:2.36.0=classpath
|
||||
com.google.flatbuffers:flatbuffers-java:1.12.0=classpath
|
||||
@@ -80,6 +80,8 @@ org.checkerframework:checker-qual:3.43.0=classpath
|
||||
org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath
|
||||
org.glassfish.jaxb:txw2:2.3.2=classpath
|
||||
org.jdom:jdom2:2.0.6.1=classpath
|
||||
org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin:2.4.21=classpath
|
||||
org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.4.21=classpath
|
||||
org.jetbrains.kotlin:fus-statistics-gradle-plugin:2.4.21=classpath
|
||||
org.jetbrains.kotlin:kotlin-build-statistics:2.4.21=classpath
|
||||
org.jetbrains.kotlin:kotlin-build-tools-api:2.4.21=classpath
|
||||
|
||||
+43
-32
@@ -1,41 +1,52 @@
|
||||
# Architecture
|
||||
# Native client architecture
|
||||
|
||||
Two independent native applications share a policy, not a cross-platform runtime:
|
||||
The requested product is a native reconstruction of Yuvomi's PWA, not a native
|
||||
window around that website. Both shipping entry points now render native views:
|
||||
|
||||
| Responsibility | Android | iOS |
|
||||
| --- | --- | --- |
|
||||
| Native entry/configuration | ComponentActivity and platform widgets | SwiftUI |
|
||||
| Web application | Android WebView | WKWebView |
|
||||
| Server URL policy | ServerAddress | ServerAddress |
|
||||
| Reachability/metadata | HttpsURLConnection, no redirects/cookies | Ephemeral URLSession, no redirects/cookies |
|
||||
| Authentication | Upstream web UI and OS cookie jar | Upstream web UI and WKWebsiteDataStore |
|
||||
| OIDC | Separate restricted web view after consent | Separate restricted web view after consent |
|
||||
| Downloads | Origin-bound streaming / bounded blob capture and pull | WKDownload to temporary protected file, system export |
|
||||
| Screens and navigation | Jetpack Compose / Material 3 primitives, Yuvomi tokens | SwiftUI, Yuvomi tokens |
|
||||
| Application state | AndroidViewModel + Compose state | MainActor ObservableObject |
|
||||
| JSON API | HttpsURLConnection, serialized worker | URLSession actor, bounded streaming delegate |
|
||||
| Session ownership | Explicit origin-bound secure-cookie jar | Private ephemeral URLSession cookie storage |
|
||||
| Persistent cookies | AES-GCM, AndroidKeyStore key, origin as authenticated data | Keychain, WhenUnlockedThisDeviceOnly, origin-scoped account |
|
||||
| Server logic | Existing unmodified Yuvomi API | Existing unmodified Yuvomi API |
|
||||
|
||||
The client never reimplements a Yuvomi module or introduces a backend. The user
|
||||
selects the origin. Bootstrap calls check the actual upstream unauthenticated
|
||||
metadata contract before loading the server application. Configuration stores only
|
||||
the origin and a query/fragment-free last path; auth/reset/invite routes are not
|
||||
restored. No native password or API-token storage exists.
|
||||
There is no WebView/WKWebView in either shipped source tree and no browser
|
||||
fallback for missing modules. The old implementation and browser tests are
|
||||
archived in `legacy/`; their results are historical, not evidence for this client.
|
||||
|
||||
The current web view remains alive across background/resume and ordinary rotation.
|
||||
Android handles orientation changes in the existing activity; process recreation
|
||||
loads the remembered path and retains OS cookies, not unsaved web form memory.
|
||||
iOS retains a StateObject-owned view; cold launch restores path and persistent
|
||||
cookies. No resume reload is imposed. Native recovery offers Retry, Keep viewing,
|
||||
and server management without hiding the route back to configuration.
|
||||
The first native slice contains HTTPS onboarding, setup/password/TOTP login,
|
||||
session restoration, a basic dashboard, task/note/shopping interactions, read-only
|
||||
permission handling and local sign-out/server removal. Exact feature and visual
|
||||
parity is tracked in [native parity](native-parity.md), not inferred from a list of
|
||||
navigation destinations. The other modules remain unfinished.
|
||||
|
||||
Server erasure destroys the browsing context and clears all website storage before
|
||||
another server is loaded. The local wipe does not invalidate the remote session;
|
||||
logout is still a server-side operation. Web application history remains native
|
||||
web history. External schemes, universal links and app links are not registered
|
||||
because arbitrary self-hosted domains cannot be verified by this app in advance.
|
||||
## Transport and state boundaries
|
||||
|
||||
The optional integration build has a different Android package ID and adds trust
|
||||
for a fresh test CA generated outside the repository. It uses the same production
|
||||
code and the unmodified pinned upstream server. Neither normal debug nor release
|
||||
resources include that CA. Never distribute an integration APK.
|
||||
- One configured root HTTPS origin/port; system certificate validation only.
|
||||
- API calls never follow redirects. No cookie or Authorization state is replayed
|
||||
to another host. Authentication proxies returning HTML are not treated as APIs.
|
||||
- JSON reads have byte limits and timeouts. Writes are not queued for offline
|
||||
replay. Only a server-declared `csrf_invalid` rejection permits one token refresh
|
||||
and retry; ordinary authorization failures and transport failures do not.
|
||||
- Server session cookies are persisted, not passwords or TOTP/recovery codes.
|
||||
Session-only cookies are not converted to long-lived cookies.
|
||||
- Native UI mutations wait for the server result. Permissions remain enforced
|
||||
server-side; sparse module/widget permissions also control native affordances.
|
||||
- Local removal clears the native cookie vault and in-memory records. It is not
|
||||
remote revocation. Logout attempts server revocation and still erases the local
|
||||
session if the server cannot be reached.
|
||||
- A prior WebView prototype installation may retain its old OS website data.
|
||||
This data is never imported by the native client. Clear app data/reinstall the
|
||||
prototype before reviewing this native preview if complete legacy erasure is
|
||||
required; no migration of private household records is performed.
|
||||
|
||||
Read-only offline functionality belongs to upstream's service worker. The app
|
||||
preserves it where the platform engine supports it, but does not promise offline
|
||||
editing, synchronization, or the same PWA cache behavior on all OS versions.
|
||||
## Explicit gaps
|
||||
|
||||
No native OIDC handoff has been implemented. A browser sign-in is not represented
|
||||
as a successful native API session. Password reset/invitation flows, the remaining
|
||||
modules, configurable dashboard, uploads/downloads, notification integrations,
|
||||
offline cache, localization parity and visual baseline comparison remain open.
|
||||
The signing setup was paused by the maintainer's native-rebuild correction; it
|
||||
must not be used to label this incomplete client as a finished release.
|
||||
+21
-3
@@ -2,8 +2,8 @@
|
||||
|
||||
Requirements: JDK 17, Android SDK platform 37.0, build-tools 36.0.0, current
|
||||
platform-tools, and accepted Android SDK licenses. Minimum Android 8 (API 26).
|
||||
Use a maintained Android System WebView. Target API 37. On Android 17, choose
|
||||
"Allow private-network servers" when using a LAN instance; public HTTPS servers
|
||||
The application surface is Jetpack Compose, not Android System WebView. Target
|
||||
API 37. On Android 17, choose "Zugriff auf private Netzwerke erlauben" for a LAN instance; public HTTPS servers
|
||||
do not need this optional runtime permission. No discovery/scanning is performed.
|
||||
|
||||
```sh
|
||||
@@ -13,7 +13,7 @@ bash android/gradlew -p android connectedDebugAndroidTest
|
||||
```
|
||||
|
||||
Gradle 9.6.0 is checksum-verified by the wrapper. AGP 9.4.1 uses built-in Kotlin
|
||||
with the build-cache fix in KGP 2.4.21. Maven versions are locked. No dynamic
|
||||
with KGP and Compose compiler plugin 2.4.21. Maven versions are locked. No dynamic
|
||||
application dependencies or private Maven repository is required.
|
||||
|
||||
Ordinary outputs:
|
||||
@@ -23,6 +23,14 @@ Ordinary outputs:
|
||||
- `android/app/build/outputs/bundle/release/app-release.aab` (unsigned unless signed later)
|
||||
- `android/app/build/reports/` (lint, JVM and emulator results)
|
||||
|
||||
The Gitea build job uploads `android-native-debug-apk`, containing an installable
|
||||
development-signed `app-debug.apk`. It is a native preview, not a signed stable
|
||||
release or a claim of full PWA parity. See `native-parity.md` before testing it.
|
||||
|
||||
Native UI tests live in `src/androidTestNative/java` and the real-server native
|
||||
scenario in `src/androidTestNativeIntegration/java`. The old browser tests and
|
||||
renderer are archived under `legacy/` and are not compiled into the app/suites.
|
||||
|
||||
Immediately after building, collect and inspect the outputs:
|
||||
|
||||
```sh
|
||||
@@ -60,6 +68,16 @@ Requires Node 22.14+ and a running emulator. The harness creates and removes its
|
||||
own CA/key/database, uses `adb reverse`, and builds `.integration` with explicit
|
||||
test trust. It does not weaken production TLS. Test credentials are ephemeral.
|
||||
Keep test reports private if you customize the harness with real data (not advised).
|
||||
The native test calls the real API through native controls and saves a synthetic
|
||||
dashboard screenshot under `app/build/outputs/native-screenshots/`. It does not
|
||||
demonstrate native SSO merely because the protocol fixture also tests OIDC.
|
||||
The test writes through `PlatformTestStorageRegistry`; AGP collects the file in
|
||||
`outputs/connected_android_test_additional_output/integrationAndroidTest/` before
|
||||
uninstalling the fixture. The harness rejects missing/ambiguous output and removes
|
||||
only its known screenshot from previous runs. Do not extract app-private files
|
||||
after Gradle returns: UTP has already uninstalled the `.integration` package.
|
||||
Capture uses the native window and asserts nonuniform pixels; a valid PNG header
|
||||
alone is not sufficient screenshot evidence.
|
||||
|
||||
For dependency updates run `:app:dependencies --write-locks`, the full pipeline,
|
||||
and `python3 scripts/check-dependencies.py`. Review lockfile changes. The version
|
||||
|
||||
+8
-4
@@ -1,8 +1,8 @@
|
||||
# iOS development
|
||||
|
||||
Requires macOS, Xcode 16.4 or newer with an iOS simulator, and XcodeGen 2.44.1.
|
||||
Minimum iOS/iPadOS 18.4: the auth window must be able to deny native file-panel
|
||||
requests, which earlier WKWebView delegates cannot do. No CocoaPods or external
|
||||
Minimum iOS/iPadOS 18.4 is retained for this rebuild. The application surface is
|
||||
SwiftUI; the old WKWebView renderer is archived, not shipped. No CocoaPods or external
|
||||
runtime package is required. For App Store submission use Apple's currently
|
||||
required Xcode/iOS SDK, not merely the oldest compiler that can build the source.
|
||||
|
||||
@@ -29,11 +29,15 @@ swift test --package-path ios
|
||||
swiftc -frontend -parse ios/Sources/*.swift ios/Tests/*.swift ios/UITests/*.swift
|
||||
```
|
||||
|
||||
These portable tests compile the **production URL/metadata policies only**.
|
||||
Parsing does not typecheck UIKit, SwiftUI or WebKit APIs. Neither command is
|
||||
These portable tests compile the **production Foundation API transport, contracts
|
||||
and URL/metadata policies**. Parsing does not typecheck SwiftUI or Security APIs. Neither command is
|
||||
evidence that the iOS application builds. Actual Xcode testing is mandatory.
|
||||
|
||||
For a device build select your authorized development team in Xcode, use your own
|
||||
registered bundle identifier, and let Xcode manage development provisioning.
|
||||
Never commit generated profiles or certificates. See `release-process.md` for
|
||||
distribution. A Linux environment cannot produce a validated iOS archive.
|
||||
|
||||
The Mac runner now bootstraps checksum-pinned native Node 22 before checkout,
|
||||
because its JavaScript actions cannot start without Node in the service PATH.
|
||||
This does not install/choose Xcode, accept its license or create a simulator.
|
||||
@@ -42,6 +42,12 @@ Xcode 16.4+ (or a current release supporting this project), accept its license a
|
||||
complete first-launch setup. Install an iOS 18.4+ simulator runtime and create an
|
||||
available iPhone simulator; `select-simulator.py` chooses the newest eligible one.
|
||||
|
||||
Before the first JavaScript action, an inline shell bootstrap installs verified
|
||||
native Node 22.22.1 into a versioned runner tool cache and exports its bin directory
|
||||
through `GITHUB_PATH`. It needs no Homebrew/root access and remains available to
|
||||
action post-cleanup. This addresses run #4's `Cannot find: node in PATH` failure;
|
||||
the modified workflow itself still needs a real Mac run.
|
||||
|
||||
XcodeGen's pinned, checksum-verified binary includes native arm64 and x86_64
|
||||
slices; Rosetta/Homebrew installation is not required by the workflow. Build,
|
||||
archive and Swift package scratch outputs use `RUNNER_TEMP`. Scratch directories
|
||||
|
||||
+52
-1
@@ -1,4 +1,55 @@
|
||||
# Maintainer continuation
|
||||
# Native rebuild continuation
|
||||
|
||||
## Current objective — do not restore the wrapper
|
||||
|
||||
The maintainer rejected the browser-wrapper architecture and requested the PWA's
|
||||
appearance/functions implemented as genuine native screens. Shipping Android now
|
||||
uses Compose and iOS SwiftUI, calling the existing API directly. `legacy/` holds
|
||||
the superseded renderers/tests for reference only. No WebView fallback, raw-JSON
|
||||
module placeholder or old browser-test pass may be represented as native parity.
|
||||
|
||||
Read [native parity](native-parity.md), [architecture](architecture.md), and
|
||||
[current validation](validation.md) first. Initial auth/dashboard/tasks/notes/
|
||||
shopping slices exist, but **no module has accepted full visual/functional parity**.
|
||||
The remaining pages/settings/auth/file/offline/notification work is explicit.
|
||||
|
||||
The owner-authorized signing key and four Gitea secrets were created before this
|
||||
correction. Their private backup is `/home/neste/yuvomi-signing/initial-20261021`.
|
||||
Do not print its contents. Uncommitted signing changes are preserved in Git stash
|
||||
`wip: owner-authorized signing setup paused for true native rewrite`; do not apply
|
||||
them blindly or resume signing/publishing the old wrapper.
|
||||
|
||||
Current local native outputs/logs:
|
||||
|
||||
- `/home/neste/yuvomi-native-build` (use `YUVOMI_BUILD_DIR` on WSL).
|
||||
- `/home/neste/yuvomi-native-validation.log` and native integration logs.
|
||||
- `/home/neste/yuvomi-native-swift` and `/home/neste/yuvomi-native-swift.log`.
|
||||
- The existing persistent SDK, Swift, ktlint, actionlint and unmodified upstream
|
||||
paths listed below remain usable. Set `ANDROID_SERIAL=emulator-5554`; do not
|
||||
authorize or deploy to unrelated devices visible in `adb devices`.
|
||||
|
||||
Run native JVM/Compose UI tests, the real upstream fixture, portable Swift API/
|
||||
contract tests, formatting, lint and OSV after changes. Apple UI/Security.framework
|
||||
is not typechecked by Linux. Gitea's Mac job now bootstraps pinned Node before
|
||||
checkout, but actual Xcode results still need inspection. Ubuntu emulator jobs
|
||||
continue requiring accessible KVM; do not weaken or fake that evidence.
|
||||
|
||||
Latest local native evidence: 10 JVM tests, 6 API-35 Compose tests, 7 real-server
|
||||
instrumentation tests (including those same 6), both lint variants and native
|
||||
debug/unsigned release APK/AAB builds pass. Sixteen portable Swift tests and strict
|
||||
format/parsing pass. Screenshot export now uses AndroidX test storage/AGP output
|
||||
collection before uninstall; the PNG was opened and confirmed nonblank. Five new
|
||||
output-regression tests guard missing, invalid, ambiguous and stale screenshots.
|
||||
See `validation.md` for logs and limitations. No Apple SDK result is implied.
|
||||
|
||||
The next Mac/Ubuntu workflow execution still needs inspection after pushing.
|
||||
Rebuild/collect from a clean checkout; do not present cached wrapper artifacts as
|
||||
the native preview. Keep the signing stash parked.
|
||||
|
||||
Next work: stabilize/visually compare this slice, close auth/advanced CRUD gaps,
|
||||
then implement the remaining real native modules against the parity inventory.
|
||||
|
||||
## Historical environment and original delivery context
|
||||
|
||||
This is a development delivery, not authorization to publish. Preserve the Git
|
||||
history on `feat/yuvomi-mobile`; use Conventional Commits and normal pushes only.
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Historical architecture — superseded WebView prototype
|
||||
|
||||
Two independent native applications share a policy, not a cross-platform runtime:
|
||||
|
||||
| Responsibility | Android | iOS |
|
||||
| --- | --- | --- |
|
||||
| Native entry/configuration | ComponentActivity and platform widgets | SwiftUI |
|
||||
| Web application | Android WebView | WKWebView |
|
||||
| Server URL policy | ServerAddress | ServerAddress |
|
||||
| Reachability/metadata | HttpsURLConnection, no redirects/cookies | Ephemeral URLSession, no redirects/cookies |
|
||||
| Authentication | Upstream web UI and OS cookie jar | Upstream web UI and WKWebsiteDataStore |
|
||||
| OIDC | Separate restricted web view after consent | Separate restricted web view after consent |
|
||||
| Downloads | Origin-bound streaming / bounded blob capture and pull | WKDownload to temporary protected file, system export |
|
||||
|
||||
The client never reimplements a Yuvomi module or introduces a backend. The user
|
||||
selects the origin. Bootstrap calls check the actual upstream unauthenticated
|
||||
metadata contract before loading the server application. Configuration stores only
|
||||
the origin and a query/fragment-free last path; auth/reset/invite routes are not
|
||||
restored. No native password or API-token storage exists.
|
||||
|
||||
The current web view remains alive across background/resume and ordinary rotation.
|
||||
Android handles orientation changes in the existing activity; process recreation
|
||||
loads the remembered path and retains OS cookies, not unsaved web form memory.
|
||||
iOS retains a StateObject-owned view; cold launch restores path and persistent
|
||||
cookies. No resume reload is imposed. Native recovery offers Retry, Keep viewing,
|
||||
and server management without hiding the route back to configuration.
|
||||
|
||||
Server erasure destroys the browsing context and clears all website storage before
|
||||
another server is loaded. The local wipe does not invalidate the remote session;
|
||||
logout is still a server-side operation. Web application history remains native
|
||||
web history. External schemes, universal links and app links are not registered
|
||||
because arbitrary self-hosted domains cannot be verified by this app in advance.
|
||||
|
||||
The optional integration build has a different Android package ID and adds trust
|
||||
for a fresh test CA generated outside the repository. It uses the same production
|
||||
code and the unmodified pinned upstream server. Neither normal debug nor release
|
||||
resources include that CA. Never distribute an integration APK.
|
||||
|
||||
Read-only offline functionality belongs to upstream's service worker. The app
|
||||
preserves it where the platform engine supports it, but does not promise offline
|
||||
editing, synchronization, or the same PWA cache behavior on all OS versions.
|
||||
@@ -0,0 +1,70 @@
|
||||
# Historical server compatibility — superseded WebView prototype
|
||||
|
||||
Source reference: upstream 2.78.0 revision
|
||||
`10bfef7686ed7303b4c74c7fcc55a5eb16356c9d`. No general version range has been
|
||||
certified. Anonymous bootstrap metadata deliberately omits the exact version;
|
||||
native probing verifies shape, not an invented minimum-version comparison.
|
||||
|
||||
Use `https://family.example.com` or `https://family.example.com:8443`, backed by a
|
||||
root-hosted Yuvomi installation and a valid system-trusted certificate. Operators
|
||||
should set `SESSION_SECURE=true`, correct `BASE_URL`, and correct proxy trust.
|
||||
Private servers are supported through reachable HTTPS/VPN, not TLS bypasses.
|
||||
International hostnames should be entered in ASCII/punycode for both platforms.
|
||||
|
||||
Root-relative assets, API endpoints, cookie paths, callback redirects and worker
|
||||
registration mean `/yuvomi/` subpaths are not supported by the inspected source.
|
||||
Use a dedicated hostname. Reverse proxies must pass `/api/v1/*`, cookies, HTML,
|
||||
JavaScript and the service worker consistently. An external authentication proxy
|
||||
that intercepts bootstrap calls is rejected with a connection error; it is not
|
||||
silently identified as a Yuvomi server.
|
||||
|
||||
## Authentication
|
||||
|
||||
Password login, TOTP/recovery codes, password reset, invitations, server-side
|
||||
session expiry/revocation and logout remain upstream web flows. No native code
|
||||
stores the password, supplies a CSRF bypass, or extends an expired session.
|
||||
Backgrounding does not clear cookies. Native server erasure does not revoke a
|
||||
remote session; use Yuvomi logout first or revoke sessions server-side.
|
||||
|
||||
### OIDC: local fixture verified; real-provider validation pending
|
||||
|
||||
The initiating Yuvomi session contains OIDC state, nonce and PKCE verifier. When
|
||||
the server redirects to an identity provider, native consent offers an isolated
|
||||
web sign-in window sharing the OS website cookie store. HTTPS-only redirects
|
||||
can return to the server callback; the final same-origin page returns to the main
|
||||
view. No app-capability handlers or JS bridge are installed in that auth window.
|
||||
|
||||
Some providers (including configurations that prohibit embedded user agents)
|
||||
require a system browser. **Those cannot sign the native view in with upstream's
|
||||
current protocol.** Use Server settings -> Open server in browser, and sign in
|
||||
there for an independent browser session. Opening only the external authorization
|
||||
link in a browser does not transfer the initiating cookie. Browser cookies are
|
||||
never copied into the app, and custom-scheme callbacks are not fabricated.
|
||||
|
||||
The API 35 integration suite completes a native isolated-window round trip with
|
||||
a local test IdP, real RS256 ID tokens, nonce and S256 PKCE. No external
|
||||
IdP/developer account was supplied. Validate the actual provider, including
|
||||
cross-site cookies, cancellation, errors, TOTP and account linking, before relying
|
||||
on that deployment. iOS authentication has not run against Apple SDKs. A native
|
||||
browser handoff would require an independently reviewed upstream protocol; no
|
||||
such upstream change is included or published.
|
||||
|
||||
Android generated exports require a current WebView supporting document-start
|
||||
scripts and are capped at 25 MB. A bounded Blob registry preserves a generated
|
||||
file even when upstream immediately revokes its object URL; it does not fetch
|
||||
blob URLs or alter the server's CSP. HTTPS file downloads are capped at 100 MB.
|
||||
Update the system WebView if generated exports are unavailable on an old engine.
|
||||
|
||||
## Notifications and offline
|
||||
|
||||
Upstream implements Web Push and optional ntfy/Gotify/webhook/email channels.
|
||||
Embedded web views do not supply a portable native push subscription. This app
|
||||
has **no native remote-push claim**, no Firebase/APNs secrets, no background
|
||||
polling service, and no fake notification-registration UI. Configure an existing
|
||||
optional upstream ntfy/Gotify channel and its client if desired. No centralized
|
||||
service is required by this application.
|
||||
|
||||
Upstream service-worker caching is read-only, allow-listed, and versioned.
|
||||
Mutations/authentication remain online. Platform-specific cache/resume behavior
|
||||
and offline account switching still need device validation. Do not rely on offline
|
||||
editing, synchronization, or closed-app push in this native development build.
|
||||
@@ -0,0 +1,47 @@
|
||||
# Historical security review — superseded WebView prototype
|
||||
|
||||
This is an engineering review, not an independent penetration test or certification.
|
||||
|
||||
Addressed during implementation:
|
||||
|
||||
- Canonical, HTTPS-only origin/port comparison; credential, fragment, query,
|
||||
subpath, scheme, lookalike-host and TLS-downgrade regression cases.
|
||||
- A main-frame POST can bypass Android's usual navigation callback. The request
|
||||
interception gate now rejects **all** cross-origin requests, not only subresources.
|
||||
The emulator regression was observed failing when the main-frame guard was
|
||||
deliberately removed, then rerun with the fix restored.
|
||||
- TLS failures cancel by default. Native download redirects are refused before
|
||||
cookies can be replayed to another origin. Bootstrap requests use neither
|
||||
cookies nor automatic redirects and have bounded metadata reads/timeouts.
|
||||
- Files use explicit system selection/content URIs; no filesystem or storage
|
||||
permission is granted to web content. Blob exports have no native JS bridge.
|
||||
- Complete Android browsing-data deletion uses WebStorageCompat, with OS app
|
||||
reset for engines without that capability. WebStorage.deleteAllData alone was
|
||||
insufficient for service-worker CacheStorage/IndexedDB and is not relied upon.
|
||||
- iOS server erase replaces the WKWebView, not only its URL, eliminating old
|
||||
history/back-forward contexts as well as persistent website data.
|
||||
- iOS metadata uses typed decoding, rejecting numeric values masquerading as booleans.
|
||||
- Native picker results are bound to the browsing generation/request. Android
|
||||
rejects stale upload/download selections, revokes camera URI grants, and clears
|
||||
capture cache on erasure. iOS ignores export-cancellation callbacks from an old
|
||||
download. Apple-specific callback regressions have not run without Xcode.
|
||||
- KGP was upgraded after OSV identified CVE-2026-53914 in the original build tool.
|
||||
The final OSV scan found no listed advisories across 213 locked/direct Maven
|
||||
coordinates and build plugins. Rescan after resolution/lock updates.
|
||||
- The inspected release APK is not debuggable, rejects cleartext, disables backup
|
||||
and trusts system CAs only. AndroidX's exported profile installer receiver is
|
||||
protected by the system DUMP permission; app providers are not exported.
|
||||
|
||||
Release gates still requiring evidence:
|
||||
|
||||
- Actual Xcode typecheck, simulator, archive, physical-device and accessibility review.
|
||||
- End-to-end IdP flows, especially providers that prohibit embedded agents; no
|
||||
browser-to-native session transfer is supported by the current upstream protocol.
|
||||
- iOS unknown-length download disk-pressure behavior; a post-download size check
|
||||
is not a streaming quota. Verify file picker/camera cancellation on real devices.
|
||||
- Android file-picker/camera/rotation while a picker is outstanding; cancellation
|
||||
on process death intentionally loses the selection, never silently retries it.
|
||||
- Offline sign-out/account switching, stale-worker updates and server erasure on
|
||||
current WebView/WKWebView versions. Upstream tests are not native device proof.
|
||||
- Reverify final signed release manifests, signing, store ownership, private vulnerability contact
|
||||
and applicable privacy disclosures. No claim that all vulnerabilities are absent.
|
||||
@@ -0,0 +1,146 @@
|
||||
# Historical validation — superseded WebView prototype
|
||||
|
||||
These results describe the old wrapper, not the current native implementation.
|
||||
See [current native validation](validation.md).
|
||||
|
||||
**Partially verified development software, not production-ready.**
|
||||
Local validation date: 2026-10-21. No unexecuted iOS application test, hosted CI
|
||||
run, production signing, or store publication is represented as completed.
|
||||
|
||||
## Executed evidence
|
||||
|
||||
- Android debug APK and unsigned release APK/AAB built successfully; both
|
||||
`lintDebug` and `lintRelease` passed. JVM security/picker-policy tests: **7 passed,
|
||||
zero failures/skips**.
|
||||
- Android API 35 regular emulator suite: **6 passed, zero failures/skips**.
|
||||
This covers onboarding, invalid URLs, background/resume, hardened settings,
|
||||
cross-origin POST/subresource isolation, opaque-page Blob rejection and activity
|
||||
recreation. Its permission test checks that the API 37 permission UI is absent;
|
||||
it is **not** evidence of API 37 permission grant/denial behavior.
|
||||
- Unmodified pinned upstream ran behind a temporary HTTPS reverse proxy.
|
||||
Bootstrap metadata, password login, Secure/HttpOnly/SameSite cookies, persistent
|
||||
session, CSRF rejection, logout/revocation passed in the harness.
|
||||
- Android's extended real-server scenario exercises login, HttpOnly cookies,
|
||||
document upload via upstream fetch, native FileTransfer output, bounded Blob
|
||||
export, background/resume, recreation, CSRF-protected logout, revocation,
|
||||
recovery, isolated OIDC return and back navigation. It does not automate the OS
|
||||
camera/document destination picker or prove every upstream module works.
|
||||
Two consecutive API 35 runs have **7 passed, zero failures/skips each**, including the
|
||||
six regular security/onboarding cases and this real-server scenario.
|
||||
- The cross-origin POST regression was deliberately observed failing without its
|
||||
guard. The production guard was restored and the API 35 regression passes.
|
||||
- Portable Swift production-policy tests: 7 passed (URL and typed metadata).
|
||||
All Swift sources passed format lint and parsing with Swift 6.2.1 on Linux.
|
||||
The portable package excludes BrowserModelTests. This does not build iOS.
|
||||
- Selected upstream suites ran successfully: cookie-secure-flag (4),
|
||||
session-sliding (8), two-factor (22), password-reset (24), sw-api-cache (42).
|
||||
Upstream's plain OIDC script also exited successfully. These are upstream tests,
|
||||
not evidence of a provider round-trip or native push support.
|
||||
- The HTTPS harness independently passed upstream OIDC discovery, RS256 ID-token
|
||||
signature/nonce validation, S256 PKCE exchange and session creation with a local
|
||||
test IdP. The fixture checks single-use codes, exact redirect URIs and OAuth
|
||||
Basic client authentication. Loopback hosts/ports and automatic fixture consent
|
||||
are not representative of every provider's cross-site/embedded-agent policies.
|
||||
- OSV: no listed advisories for **213** locked/direct Maven coordinates and build
|
||||
plugins at scan time. This is not a guarantee that no vulnerabilities exist.
|
||||
- ktlint 1.7.1, actionlint 1.7.7, repository invariants, Python compilation,
|
||||
Node syntax and shell syntax checks passed. JUnit-verifier regression suite:
|
||||
**8 passed**, including rejection of absent, empty, malformed, insufficient,
|
||||
failed, errored and skipped evidence.
|
||||
- Release APK inspection confirms API 26 minimum / API 37 target, no debuggable
|
||||
flag, backups and cleartext disabled, system-only certificate trust. Exported
|
||||
entry points are the launcher and AndroidX ProfileInstallReceiver protected by
|
||||
the system DUMP permission; file/startup providers are not exported. Debug APK
|
||||
signature verifies; release APK/AAB are unsigned. Collected archives contain no
|
||||
fixture CA/key or signing-key files.
|
||||
|
||||
## Emulator limitations and retry evidence
|
||||
|
||||
Earlier extended-suite attempts crashed the host emulator with SIGSEGV under
|
||||
software/off GPU modes. Host-GPU mode remained running and produced actionable
|
||||
JUnit failures: an OIDC-return synchronization timeout, followed by an outage
|
||||
assertion that incorrectly assumed the upstream worker could not serve its cached
|
||||
app shell, then a document-readiness race after recreation. Tests now verify the
|
||||
loaded JavaScript origin, wait for the sign-in window to close, retry only a probe
|
||||
lost to document replacement and exercise recovery through uncached metadata.
|
||||
The completed retry passes all seven tests without disabling the worker or
|
||||
weakening production TLS/CSP/origin policies.
|
||||
|
||||
API 37 attempts encountered broken package/activity services and locked
|
||||
credential-encrypted storage. **No API 37 runtime pass is claimed.**
|
||||
|
||||
Local logs and reports live in `/home/neste/yuvomi-build/`; test XML is under
|
||||
`app/outputs/androidTest-results/connected/`. Earlier failing JUnit snapshots are
|
||||
preserved as `integration-host-gpu-oidc-race.xml` and
|
||||
`integration-host-gpu-sw-cache.xml`, plus
|
||||
`integration-host-gpu-document-ready.xml`. Passing evidence is preserved in
|
||||
`integration-api35-first-pass.xml` and `integration-api35-repeat-pass.xml`; logs are
|
||||
`upstream-integration-final-retry.log` and `upstream-integration-repeat.log`.
|
||||
These files are local evidence, not published
|
||||
artifacts or a hosted CI result.
|
||||
|
||||
Test environment: JDK 17.0.20.1, Node 22.22.1, Python 3.14.4, Android Emulator
|
||||
37.2.12, API 35 x86_64 Google APIs image, WebView 124.0.6367.219. The old bundled
|
||||
WebView is useful compatibility evidence, not a recommendation to use an unpatched
|
||||
engine; a current engine/device run remains mandatory.
|
||||
|
||||
## Artifacts
|
||||
|
||||
Ignored `artifacts/android/` contains the development-signed debug APK and unsigned
|
||||
release APK/AAB, `SHA256SUMS`, `build-info.json` and manifest/policy/signature
|
||||
inspection evidence. No integration APK is collected. No IPA or Apple archive
|
||||
exists. See [Android build](build-android.md) for repeatable collection commands.
|
||||
|
||||
## Commands
|
||||
|
||||
```sh
|
||||
bash android/gradlew -p android testDebugUnitTest lintDebug lintRelease assembleDebug assembleRelease bundleRelease connectedDebugAndroidTest
|
||||
python3 scripts/test-integration.py /path/to/pinned-upstream --android
|
||||
swift test --package-path ios
|
||||
swiftc -frontend -parse ios/Sources/*.swift ios/Tests/*.swift ios/UITests/*.swift
|
||||
python3 scripts/check-repository.py
|
||||
python3 scripts/check-dependencies.py
|
||||
python3 scripts/test-verifier.py
|
||||
python3 scripts/collect-android-artifacts.py
|
||||
git diff --check
|
||||
```
|
||||
|
||||
This environment is Linux/WSL. Android SDK and a KVM emulator were installed for
|
||||
real execution. Build output relocation was needed because the Windows mount
|
||||
rejects some Gradle POSIX metadata operations. Swift's Linux toolchain was
|
||||
installed for portable tests. No macOS, Xcode, Apple simulator or physical device
|
||||
is available; no iOS build/archive/UI result is claimed.
|
||||
|
||||
## Mandatory remaining evidence
|
||||
|
||||
- Run Xcode build, XCTest/UI tests and unsigned archive on macOS; fix any compiler
|
||||
or runtime issues. The app has **not** yet been typechecked against Apple SDKs.
|
||||
- Validate real IdPs: cancellation, account linking, TOTP after OIDC, and embedded
|
||||
provider policy. Browser-only providers have no native-session handoff upstream.
|
||||
- Real-device camera/document picker cancellation, file MIME cases, rotation with
|
||||
an outstanding picker, network loss/reconnect, process kill/memory pressure,
|
||||
session expiry/revocation, OS backup, and offline account isolation.
|
||||
- Android 17 private-network permission grant/denial/revocation on a matching OS.
|
||||
Also run minimum-supported API 26 and a current OS/WebView device matrix.
|
||||
- VoiceOver/TalkBack, large text, contrast, keyboard/safe areas, reduced motion,
|
||||
light/dark appearance and responsive web modules on actual supported devices.
|
||||
- Successful CI runs on the configured Gitea runners, private security
|
||||
reporting contact, human security review, store ownership and production signing.
|
||||
|
||||
No Firebase/APNs registration, closed-app push, offline editing, App Store approval,
|
||||
signing, publication or physical-device validation is claimed. See `SECURITY.md`
|
||||
and `docs/security-review.md` for residual limitations.
|
||||
Resume work using [maintainer continuation](continuation.md).
|
||||
|
||||
## Gitea runner adaptation
|
||||
|
||||
Workflows now live in `.gitea/workflows/` and target the supplied `ubuntu-latest`
|
||||
pool and native `macos-arm64` M4 Pro runner. Local workflow grammar lint (Gitea URL
|
||||
syntax normalized), repository invariants, shell/Python syntax, ten mocked runner
|
||||
preflight regressions and eight evidence-verifier regressions pass. SHA-256 Git
|
||||
initialization/fetch was exercised locally; the pinned XcodeGen archive's checksum
|
||||
and native arm64 slice were verified. These are not remote runner execution or
|
||||
Apple SDK results. See [runner requirements](ci-runners.md); the local emulator
|
||||
preflight currently rejects unavailable/inaccessible KVM as designed. Original
|
||||
application build evidence above remains historical and is not a rebuild of the
|
||||
workflow-only changes.
|
||||
@@ -0,0 +1,81 @@
|
||||
# YUVOMI MOBILE – FINAL DELIVERY REPORT
|
||||
|
||||
**Delivery status: incomplete native preview, not final product acceptance.**
|
||||
This report closes the initial native rebuild slice, not the requested complete
|
||||
1:1 replacement. No module has accepted functional and visual parity.
|
||||
|
||||
## 1. Outcome
|
||||
|
||||
The rejected embedded-browser application has been replaced by genuine native
|
||||
shipping entry points. Missing modules do not fall back to a WebView.
|
||||
|
||||
## 2. Upstream reference
|
||||
|
||||
Unmodified Yuvomi 2.78.0, commit
|
||||
`10bfef7686ed7303b4c74c7fcc55a5eb16356c9d`. No upstream change or push.
|
||||
|
||||
## 3. Android
|
||||
|
||||
Kotlin/Compose onboarding, setup/password/TOTP interfaces, basic dashboard,
|
||||
tasks/notes/shopping and session management. Version `0.2.0-native-preview`,
|
||||
code 2. This is a tested initial slice, not full module coverage.
|
||||
|
||||
## 4. iOS
|
||||
|
||||
SwiftUI equivalents, native API models/transport and Keychain storage implemented.
|
||||
Sixteen portable tests pass; Apple SDK application/UI/Keychain validation remains
|
||||
unverified locally. No installable IPA or App Store-ready archive is claimed.
|
||||
|
||||
## 5. Design parity
|
||||
|
||||
Upstream colors, spacing/radii and brand geometry guide native controls. One real
|
||||
synthetic Android dashboard screenshot was inspected. No side-by-side full PWA
|
||||
visual acceptance, complete adaptive-layout or accessibility approval yet.
|
||||
|
||||
## 6. API and architecture
|
||||
|
||||
Direct same-origin HTTPS/JSON, native controls and state; server-owned business
|
||||
logic and authorization. Superseded browser code/tests are preserved in `legacy/`
|
||||
but excluded from shipping builds and native test counts.
|
||||
|
||||
## 7. Security
|
||||
|
||||
System TLS, redirect refusal, bounded reads, upstream CSRF and protected native
|
||||
cookies. AndroidKeyStore/AES-GCM and iOS Keychain/private URLSession storage; no
|
||||
stored passwords, test CA in ordinary builds or hidden browser session import.
|
||||
Human security review and additional device/role/error-path coverage remain open.
|
||||
|
||||
## 8. Executed validation
|
||||
|
||||
10 JVM tests, 6 native API-35 UI tests, the 7-test real-server suite (including
|
||||
those same 6), both Android lint variants and package builds pass. Swift has 16
|
||||
portable passes plus strict formatting/parsing. 23 script regressions, repository
|
||||
checks, workflow lint and the 266-coordinate OSV scan pass. See
|
||||
[validation](validation.md) for evidence, failures corrected and exact limitations.
|
||||
|
||||
## 9. Artifacts
|
||||
|
||||
The local collector replaces old wrapper outputs in ignored `artifacts/android/`
|
||||
with native debug APK and unsigned release APK/AAB, checksums and manifest/network/
|
||||
signature inspection. `build-info.json` records exact source identity and dirty
|
||||
state. Only the development-signed debug APK is installable as provided.
|
||||
|
||||
## 10. Gitea CI
|
||||
|
||||
The Android workflow offers `android-native-debug-apk`; the Mac workflow bootstraps
|
||||
verified ARM64 Node before checkout. Actual artifact publication and Apple build
|
||||
results require remote-run inspection. Remote Ubuntu emulator jobs need KVM access;
|
||||
local emulator success is not a substitute for a passing remote matrix.
|
||||
|
||||
## 11. Signing and publication
|
||||
|
||||
Initial owner-authorized signing material/secrets are preserved privately; signing
|
||||
workflow changes remain parked in the named stash. No production-signed native
|
||||
release, store submission or claim of completed product delivery.
|
||||
|
||||
## 12. Remaining work
|
||||
|
||||
Native SSO/recovery/invitations, advanced first-slice controls, the remaining
|
||||
modules/settings, files, offline, notifications, Apple/device validation and 1:1
|
||||
visual/behavior acceptance remain substantial work. The complete page inventory
|
||||
and acceptance criteria are in [native parity](native-parity.md).
|
||||
@@ -0,0 +1,91 @@
|
||||
# Native parity tracker
|
||||
|
||||
## Acceptance contract
|
||||
|
||||
**Native means native screens, forms, lists, navigation and interaction.** Android
|
||||
uses Kotlin/Compose; iOS uses SwiftUI. PWA HTML/JavaScript is not embedded as the
|
||||
application surface. The PWA is the design/behavior reference, not the renderer.
|
||||
|
||||
Reference: unmodified upstream 2.78.0,
|
||||
`10bfef7686ed7303b4c74c7fcc55a5eb16356c9d`. The scope includes its thirty page
|
||||
modules, settings leaves, permissions, dashboard customization and cross-module
|
||||
workflows. Third-party web extensions need an explicit native integration design;
|
||||
arbitrary server-installed HTML cannot silently become a native module.
|
||||
|
||||
Use these states honestly:
|
||||
|
||||
- **Slice**: real native UI/API interaction exists, with the listed limitations.
|
||||
- **Pending**: not implemented. No fake screen, raw-JSON editor or WebView fallback.
|
||||
- **Parity accepted**: requires functional and visual evidence on both platforms.
|
||||
**No module currently has this status.**
|
||||
|
||||
## Page inventory
|
||||
|
||||
| Upstream page | Native status | Work still required before parity |
|
||||
| --- | --- | --- |
|
||||
| login | Slice: password + TOTP/recovery step | OIDC/provider policy, recovery/error UX, localization, visual comparison |
|
||||
| setup | Slice: initial household creation | Full onboarding and configuration workflow |
|
||||
| forgot-password | Pending | Native recovery request and server-capability UX |
|
||||
| reset-password | Pending | Native reset token/confirmation flow |
|
||||
| join | Pending | Invitations, account setup, validation |
|
||||
| dashboard | Slice: task/calendar/shopping/note previews | All remaining widgets, user layout/options, timezone-aware presentation, quick add, wall mode |
|
||||
| tasks | Slice: list/search/status filter/create/edit/complete/delete | Category/assignee/tag/visibility controls, recurrence, subtasks, attachments, comments, archive/history, lock UX, bulk/sync controls |
|
||||
| shopping | Slice: lists/items/create/edit/check/delete | List rename/duplicate, categories, ordering, suggestions, live versions, prices/stores, imports/send/undo |
|
||||
| notes | Slice: list/search/create/edit/pin/delete | Markdown/checklists, categories, note colors, ordering and concurrent edit UX |
|
||||
| calendar | Dashboard preview only; module pending | Agenda/week/month, editing, recurrence/scopes, source calendars, timezone behavior, attachments/sync |
|
||||
| schedule | Pending | Shift grid, roster, creation and settings |
|
||||
| birthdays | Pending | Date/age privacy, contacts, reminders/import |
|
||||
| contacts | Pending | Address book, editing, links/import/export |
|
||||
| documents | Pending | Browse/search, metadata, native upload/camera/export and lifecycle tests |
|
||||
| inventory | Pending | Items, locations, guarantees, attachments and reminders |
|
||||
| meals | Pending | Meal plan, ingredients, household options and shopping transfer |
|
||||
| recipes | Pending | Search/detail/editor, source import, images, pantry/shopping cross-links |
|
||||
| pantry | Pending | Stock, batches/expiry, locations, quantity controls and shopping transfer |
|
||||
| budget | Pending | Accounts, entries, categories, currency/amount handling and attachments |
|
||||
| budget-plans | Pending | Plan editor, period/category matching and forecasts |
|
||||
| budget-stats | Pending | Native charts and filters matching upstream calculations |
|
||||
| subscriptions | Pending | Lifecycle, billing, recurrence and linked budget behavior |
|
||||
| split-expenses | Pending | Groups, guests, balances, settlement and permission distinctions |
|
||||
| housekeeping | Pending | Visits, tasks, time and role-gated payment data |
|
||||
| waste | Pending | Schedules, pickup display/import and reminders |
|
||||
| rewards | Pending | Catalog, ledger, goals, approvals and pocket-money precision |
|
||||
| health | Pending | Medication, cycle, nutrition and capability-gated private views |
|
||||
| health-fasting | Pending | Clock, history, capabilities and lifecycle behavior |
|
||||
| settings | Slice: native logout/server removal only | Every relevant personal/admin settings leaf and native permissions |
|
||||
| pair-display | Pending | Pairing protocol, display role and shared-surface privacy |
|
||||
|
||||
## Design reference
|
||||
|
||||
Native primitives reuse the upstream warm palette (`#F5F3ED` / `#191816`), opaque
|
||||
surfaces (`#FFFFFF` / `#2B2825`), violet accent, 16-point cards, 26-point auth panel,
|
||||
pill navigation/buttons and the exact three-circle brand geometry. These are
|
||||
initial design-token mappings, **not proof of 1:1 visuals**. Material/SF symbols,
|
||||
typography, sheets, adaptive layouts and module details still need comparison.
|
||||
|
||||
Every accepted module needs side-by-side screenshots from matching server data,
|
||||
light/dark and small/large text coverage, keyboard/safe-area/back behavior,
|
||||
read-only/denied permission cases and real API success/error tests. Android's
|
||||
integration test exports a synthetic-fixture native dashboard screenshot; it is
|
||||
not a production screenshot or a visual-parity approval.
|
||||
|
||||
## Implementation order
|
||||
|
||||
1. Stabilize the current native authentication/dashboard/tasks/notes/shopping
|
||||
slice, including Apple SDK compilation and actual native tests.
|
||||
2. Close auth/recovery/SSO and first-slice feature gaps, then accept those screens
|
||||
against PWA visual/behavior baselines rather than adding empty menu entries.
|
||||
3. Implement calendar/family/contacts, kitchen/pantry, documents/inventory, then
|
||||
finance, household, rewards and health as separately tested native slices.
|
||||
4. Complete settings, extensions/cross-module flows, accessibility, offline and
|
||||
notifications. Audit every upstream route/settings leaf before claiming parity.
|
||||
|
||||
## Signing work retained, not released
|
||||
|
||||
The owner-authorized initial signing key and four Gitea repository secrets were
|
||||
created before the native correction. The private backup remains outside Git at
|
||||
`/home/neste/yuvomi-signing/initial-20261021`. Never print/commit its contents.
|
||||
The uncommitted signing-workflow changes were preserved in Git stash
|
||||
`wip: owner-authorized signing setup paused for true native rewrite`; do not apply
|
||||
it blindly to the new workflows. No signing-secret values belong in screenshots,
|
||||
test fixtures, documentation, commits or artifacts. Native signing/release work
|
||||
remains paused until this preview's scope is explicitly accepted.
|
||||
@@ -10,14 +10,14 @@ to either store. A debug APK or unsigned archive is not a production release.
|
||||
a provisional community identifier, not proof of registry/store ownership.
|
||||
Confirm use of the Yuvomi name, required attribution and independent status.
|
||||
3. Bump version/name/code in Android and the iOS project spec; update CHANGELOG.
|
||||
4. Run JVM/emulator/real-upstream HTTPS tests, portable Swift and Xcode simulator
|
||||
4. Run native JVM/Compose/emulator/real-upstream HTTPS tests, portable Swift and Xcode simulator
|
||||
tests, static checks, OSV scan, release builds and artifact inspection. Record
|
||||
upstream revision, app SHA, OS/WebView/Xcode versions, results and checksums.
|
||||
upstream revision, app SHA, OS/SDK/Xcode versions, results and checksums.
|
||||
5. Produce signed artifacts only using an authorized maintainer's credentials.
|
||||
6. Review store privacy/Data Safety answers for the app AND selected-server model,
|
||||
permission rationale, encryption/export compliance, screenshots, support URL,
|
||||
vulnerability contact, and device demonstrations. A functional web companion
|
||||
is not guaranteed to pass Apple's minimum-functionality review.
|
||||
vulnerability contact, and device demonstrations. An incomplete native preview
|
||||
is not a finished PWA replacement or App Store approval.
|
||||
7. Create a release/tag and publish artifacts/store submissions manually only
|
||||
after explicit maintainer authorization. Never force-push or rewrite history.
|
||||
|
||||
@@ -31,7 +31,10 @@ An authorized maintainer must separately sign the verified APK/AAB using their
|
||||
own keystore, alias and passwords with `zipalign`, `apksigner`, and `jarsigner`.
|
||||
Keep private material in a protected signing environment, never on the general
|
||||
validation runners. Securely back up the real upload key and use Play App Signing
|
||||
according to the owner's policy. No production key is generated here.
|
||||
according to the owner's policy. An initial owner-authorized key and repository
|
||||
secrets already exist outside Git; signing workflow changes are parked during
|
||||
the native rebuild. Preserve the key, do not generate a replacement or apply the
|
||||
old signing stash without review. See `native-parity.md`.
|
||||
Manually verify APK/AAB signatures and inspect
|
||||
the final manifest: no debuggable flag, HTTP/test CA or unintended exported component.
|
||||
Never distribute an `.integration` package or include its generated test resources.
|
||||
|
||||
+31
-42
@@ -1,47 +1,36 @@
|
||||
# Security review record
|
||||
# Native security review record
|
||||
|
||||
This is an engineering review, not an independent penetration test or certification.
|
||||
This is an engineering checklist, not an independent audit or release approval.
|
||||
The wrapper review is retained separately as
|
||||
[historical evidence](legacy-wrapper-security-review.md).
|
||||
|
||||
Addressed during implementation:
|
||||
## Implemented controls to exercise
|
||||
|
||||
- Canonical, HTTPS-only origin/port comparison; credential, fragment, query,
|
||||
subpath, scheme, lookalike-host and TLS-downgrade regression cases.
|
||||
- A main-frame POST can bypass Android's usual navigation callback. The request
|
||||
interception gate now rejects **all** cross-origin requests, not only subresources.
|
||||
The emulator regression was observed failing when the main-frame guard was
|
||||
deliberately removed, then rerun with the fix restored.
|
||||
- TLS failures cancel by default. Native download redirects are refused before
|
||||
cookies can be replayed to another origin. Bootstrap requests use neither
|
||||
cookies nor automatic redirects and have bounded metadata reads/timeouts.
|
||||
- Files use explicit system selection/content URIs; no filesystem or storage
|
||||
permission is granted to web content. Blob exports have no native JS bridge.
|
||||
- Complete Android browsing-data deletion uses WebStorageCompat, with OS app
|
||||
reset for engines without that capability. WebStorage.deleteAllData alone was
|
||||
insufficient for service-worker CacheStorage/IndexedDB and is not relied upon.
|
||||
- iOS server erase replaces the WKWebView, not only its URL, eliminating old
|
||||
history/back-forward contexts as well as persistent website data.
|
||||
- iOS metadata uses typed decoding, rejecting numeric values masquerading as booleans.
|
||||
- Native picker results are bound to the browsing generation/request. Android
|
||||
rejects stale upload/download selections, revokes camera URI grants, and clears
|
||||
capture cache on erasure. iOS ignores export-cancellation callbacks from an old
|
||||
download. Apple-specific callback regressions have not run without Xcode.
|
||||
- KGP was upgraded after OSV identified CVE-2026-53914 in the original build tool.
|
||||
The final OSV scan found no listed advisories across 213 locked/direct Maven
|
||||
coordinates and build plugins. Rescan after resolution/lock updates.
|
||||
- The inspected release APK is not debuggable, rejects cleartext, disables backup
|
||||
and trusts system CAs only. AndroidX's exported profile installer receiver is
|
||||
protected by the system DUMP permission; app providers are not exported.
|
||||
- Origin-bound HTTPS API transports, no redirects, no production test-CA bypass.
|
||||
- Server-owned session and CSRF semantics, no persistent password storage.
|
||||
- Origin-bound AES-GCM/AndroidKeyStore cookies; iOS Keychain protected
|
||||
WhenUnlockedThisDeviceOnly with a private ephemeral URLSession jar.
|
||||
- Bounded JSON reads, deadlines and no offline/ambiguous-write retry queue.
|
||||
- Native permission-aware controls, destructive-action confirmation and server
|
||||
validation; partial update payloads preserve fields the native editor cannot edit.
|
||||
- No WebView/WKWebView in either shipping source tree. Legacy tests do not prove
|
||||
this client's behavior; explicit native tests and source invariants are required.
|
||||
|
||||
Release gates still requiring evidence:
|
||||
## Remaining gates
|
||||
|
||||
- Actual Xcode typecheck, simulator, archive, physical-device and accessibility review.
|
||||
- End-to-end IdP flows, especially providers that prohibit embedded agents; no
|
||||
browser-to-native session transfer is supported by the current upstream protocol.
|
||||
- iOS unknown-length download disk-pressure behavior; a post-download size check
|
||||
is not a streaming quota. Verify file picker/camera cancellation on real devices.
|
||||
- Android file-picker/camera/rotation while a picker is outstanding; cancellation
|
||||
on process death intentionally loses the selection, never silently retries it.
|
||||
- Offline sign-out/account switching, stale-worker updates and server erasure on
|
||||
current WebView/WKWebView versions. Upstream tests are not native device proof.
|
||||
- Reverify final signed release manifests, signing, store ownership, private vulnerability contact
|
||||
and applicable privacy disclosures. No claim that all vulnerabilities are absent.
|
||||
1. Run Apple SDK typechecking, simulator/XCTest/UI and device checks; portable
|
||||
Foundation transport compilation is not SwiftUI/Security.framework validation.
|
||||
2. Review persistent-cookie expiry/removal, TLS failures, redirects, CSRF refresh,
|
||||
expired sessions, background/recreation and stale-response isolation on devices.
|
||||
3. Review migrations from the prototype: browser sessions are never imported and
|
||||
OS website data may remain until app-data reset/reinstall.
|
||||
4. Complete missing auth/provider protocols and permission/role scenarios before
|
||||
claiming native authentication parity, particularly SSO-only deployments.
|
||||
5. Implement/review files, notifications, offline storage and additional modules
|
||||
as actual native capabilities; do not restore the wrapper as a shortcut.
|
||||
6. Independently review the new UI/state/transport code, actual signed artifacts,
|
||||
accessibility, supported OS matrix and runner trust before distribution.
|
||||
|
||||
The owner-authorized signing configuration exists privately but its workflow
|
||||
changes are intentionally parked. A signed incomplete client is not a completed
|
||||
native product. Refer to [native parity](native-parity.md) before release work.
|
||||
@@ -1,70 +1,41 @@
|
||||
# Server compatibility and authentication
|
||||
# Native server compatibility
|
||||
|
||||
Source reference: upstream 2.78.0 revision
|
||||
`10bfef7686ed7303b4c74c7fcc55a5eb16356c9d`. No general version range has been
|
||||
certified. Anonymous bootstrap metadata deliberately omits the exact version;
|
||||
native probing verifies shape, not an invented minimum-version comparison.
|
||||
Reference: Yuvomi 2.78.0 at
|
||||
`10bfef7686ed7303b4c74c7fcc55a5eb16356c9d`. No general server-version range or
|
||||
complete native feature compatibility is certified.
|
||||
|
||||
Use `https://family.example.com` or `https://family.example.com:8443`, backed by a
|
||||
root-hosted Yuvomi installation and a valid system-trusted certificate. Operators
|
||||
should set `SESSION_SECURE=true`, correct `BASE_URL`, and correct proxy trust.
|
||||
Private servers are supported through reachable HTTPS/VPN, not TLS bypasses.
|
||||
International hostnames should be entered in ASCII/punycode for both platforms.
|
||||
Enter a root HTTPS hostname, optionally with a custom port. HTTP, embedded
|
||||
credentials, query/fragment configuration and subpath deployments are rejected.
|
||||
Use a valid system-trusted TLS certificate and reachable VPN/LAN connectivity.
|
||||
No certificate bypass or proprietary mobile service is introduced.
|
||||
|
||||
Root-relative assets, API endpoints, cookie paths, callback redirects and worker
|
||||
registration mean `/yuvomi/` subpaths are not supported by the inspected source.
|
||||
Use a dedicated hostname. Reverse proxies must pass `/api/v1/*`, cookies, HTML,
|
||||
JavaScript and the service worker consistently. An external authentication proxy
|
||||
that intercepts bootstrap calls is rejected with a connection error; it is not
|
||||
silently identified as a Yuvomi server.
|
||||
The native client probes the real public `/api/v1/version` and
|
||||
`/api/v1/auth/oidc/config` shapes. Anonymous metadata does not disclose the server
|
||||
version. An authentication proxy returning redirects/HTML instead of those JSON
|
||||
contracts is unsupported, not silently treated as a valid Yuvomi API.
|
||||
|
||||
## Authentication
|
||||
|
||||
Password login, TOTP/recovery codes, password reset, invitations, server-side
|
||||
session expiry/revocation and logout remain upstream web flows. No native code
|
||||
stores the password, supplies a CSRF bypass, or extends an expired session.
|
||||
Backgrounding does not clear cookies. Native server erasure does not revoke a
|
||||
remote session; use Yuvomi logout first or revoke sessions server-side.
|
||||
The implemented native slice uses setup/password login, the existing two-factor
|
||||
verification endpoint, `/auth/me`, session cookies, CSRF headers and logout.
|
||||
Passwords are not stored. Native session persistence is separate from browser
|
||||
storage and protected by the platform keystore/keychain.
|
||||
|
||||
### OIDC: local fixture verified; real-provider validation pending
|
||||
**Native SSO is not implemented yet.** The old wrapper's local-IdP WebView result
|
||||
does not apply to this client. The existing server protocol does not provide a
|
||||
generic browser-to-native session exchange for arbitrary self-hosted hosts; a
|
||||
reviewed solution is required. SSO-only deployments cannot currently use this
|
||||
native preview. Reset and invitation workflows also remain pending.
|
||||
|
||||
The initiating Yuvomi session contains OIDC state, nonce and PKCE verifier. When
|
||||
the server redirects to an identity provider, native consent offers an isolated
|
||||
web sign-in window sharing the OS website cookie store. HTTPS-only redirects
|
||||
can return to the server callback; the final same-origin page returns to the main
|
||||
view. No app-capability handlers or JS bridge are installed in that auth window.
|
||||
Only initial dashboard/tasks/notes/shopping capabilities are implemented; see the
|
||||
[parity tracker](native-parity.md) for precise gaps. The complete server UI is not
|
||||
embedded to fill those gaps. Read-only and denied module permissions affect
|
||||
native controls; the server remains the enforcement point.
|
||||
|
||||
Some providers (including configurations that prohibit embedded user agents)
|
||||
require a system browser. **Those cannot sign the native view in with upstream's
|
||||
current protocol.** Use Server settings -> Open server in browser, and sign in
|
||||
there for an independent browser session. Opening only the external authorization
|
||||
link in a browser does not transfer the initiating cookie. Browser cookies are
|
||||
never copied into the app, and custom-scheme callbacks are not fabricated.
|
||||
## Notifications, files and offline
|
||||
|
||||
The API 35 integration suite completes a native isolated-window round trip with
|
||||
a local test IdP, real RS256 ID tokens, nonce and S256 PKCE. No external
|
||||
IdP/developer account was supplied. Validate the actual provider, including
|
||||
cross-site cookies, cancellation, errors, TOTP and account linking, before relying
|
||||
on that deployment. iOS authentication has not run against Apple SDKs. A native
|
||||
browser handoff would require an independently reviewed upstream protocol; no
|
||||
such upstream change is included or published.
|
||||
|
||||
Android generated exports require a current WebView supporting document-start
|
||||
scripts and are capped at 25 MB. A bounded Blob registry preserves a generated
|
||||
file even when upstream immediately revokes its object URL; it does not fetch
|
||||
blob URLs or alter the server's CSP. HTTPS file downloads are capped at 100 MB.
|
||||
Update the system WebView if generated exports are unavailable on an old engine.
|
||||
|
||||
## Notifications and offline
|
||||
|
||||
Upstream implements Web Push and optional ntfy/Gotify/webhook/email channels.
|
||||
Embedded web views do not supply a portable native push subscription. This app
|
||||
has **no native remote-push claim**, no Firebase/APNs secrets, no background
|
||||
polling service, and no fake notification-registration UI. Configure an existing
|
||||
optional upstream ntfy/Gotify channel and its client if desired. No centralized
|
||||
service is required by this application.
|
||||
|
||||
Upstream service-worker caching is read-only, allow-listed, and versioned.
|
||||
Mutations/authentication remain online. Platform-specific cache/resume behavior
|
||||
and offline account switching still need device validation. Do not rely on offline
|
||||
editing, synchronization, or closed-app push in this native development build.
|
||||
Native remote push, uploads/camera/download/export and offline caching/editing
|
||||
are not current native capabilities. The old wrapper's file handlers and the
|
||||
PWA service worker are not part of the native renderer. No fake registration or
|
||||
automatic offline mutation replay is supplied. Optional existing server-side
|
||||
ntfy/Gotify/email integrations remain independently operated upstream features.
|
||||
+58
-119
@@ -1,92 +1,60 @@
|
||||
# Validation status
|
||||
# Native validation
|
||||
|
||||
**Partially verified development software, not production-ready.**
|
||||
Local validation date: 2026-10-21. No unexecuted iOS application test, hosted CI
|
||||
run, production signing, or store publication is represented as completed.
|
||||
**Incomplete native rebuild; not full PWA parity and not production-ready.**
|
||||
The old browser results are [historical only](legacy-wrapper-validation.md).
|
||||
|
||||
## Executed evidence
|
||||
The new shipping surfaces are Android Compose and iOS SwiftUI. Current native
|
||||
tests are in `androidTestNative` / `androidTestNativeIntegration`, JVM native policy
|
||||
tests, and Swift production contracts/transport tests. Archived WebView tests are
|
||||
not included in the native suites or counted toward native completion.
|
||||
|
||||
- Android debug APK and unsigned release APK/AAB built successfully; both
|
||||
`lintDebug` and `lintRelease` passed. JVM security/picker-policy tests: **7 passed,
|
||||
zero failures/skips**.
|
||||
- Android API 35 regular emulator suite: **6 passed, zero failures/skips**.
|
||||
This covers onboarding, invalid URLs, background/resume, hardened settings,
|
||||
cross-origin POST/subresource isolation, opaque-page Blob rejection and activity
|
||||
recreation. Its permission test checks that the API 37 permission UI is absent;
|
||||
it is **not** evidence of API 37 permission grant/denial behavior.
|
||||
- Unmodified pinned upstream ran behind a temporary HTTPS reverse proxy.
|
||||
Bootstrap metadata, password login, Secure/HttpOnly/SameSite cookies, persistent
|
||||
session, CSRF rejection, logout/revocation passed in the harness.
|
||||
- Android's extended real-server scenario exercises login, HttpOnly cookies,
|
||||
document upload via upstream fetch, native FileTransfer output, bounded Blob
|
||||
export, background/resume, recreation, CSRF-protected logout, revocation,
|
||||
recovery, isolated OIDC return and back navigation. It does not automate the OS
|
||||
camera/document destination picker or prove every upstream module works.
|
||||
Two consecutive API 35 runs have **7 passed, zero failures/skips each**, including the
|
||||
six regular security/onboarding cases and this real-server scenario.
|
||||
- The cross-origin POST regression was deliberately observed failing without its
|
||||
guard. The production guard was restored and the API 35 regression passes.
|
||||
- Portable Swift production-policy tests: 7 passed (URL and typed metadata).
|
||||
All Swift sources passed format lint and parsing with Swift 6.2.1 on Linux.
|
||||
The portable package excludes BrowserModelTests. This does not build iOS.
|
||||
- Selected upstream suites ran successfully: cookie-secure-flag (4),
|
||||
session-sliding (8), two-factor (22), password-reset (24), sw-api-cache (42).
|
||||
Upstream's plain OIDC script also exited successfully. These are upstream tests,
|
||||
not evidence of a provider round-trip or native push support.
|
||||
- The HTTPS harness independently passed upstream OIDC discovery, RS256 ID-token
|
||||
signature/nonce validation, S256 PKCE exchange and session creation with a local
|
||||
test IdP. The fixture checks single-use codes, exact redirect URIs and OAuth
|
||||
Basic client authentication. Loopback hosts/ports and automatic fixture consent
|
||||
are not representative of every provider's cross-site/embedded-agent policies.
|
||||
- OSV: no listed advisories for **213** locked/direct Maven coordinates and build
|
||||
plugins at scan time. This is not a guarantee that no vulnerabilities exist.
|
||||
- ktlint 1.7.1, actionlint 1.7.7, repository invariants, Python compilation,
|
||||
Node syntax and shell syntax checks passed. JUnit-verifier regression suite:
|
||||
**8 passed**, including rejection of absent, empty, malformed, insufficient,
|
||||
failed, errored and skipped evidence.
|
||||
- Release APK inspection confirms API 26 minimum / API 37 target, no debuggable
|
||||
flag, backups and cleartext disabled, system-only certificate trust. Exported
|
||||
entry points are the launcher and AndroidX ProfileInstallReceiver protected by
|
||||
the system DUMP permission; file/startup providers are not exported. Debug APK
|
||||
signature verifies; release APK/AAB are unsigned. Collected archives contain no
|
||||
fixture CA/key or signing-key files.
|
||||
## Executed locally — 2026-10-21
|
||||
|
||||
## Emulator limitations and retry evidence
|
||||
| Check | Observed result |
|
||||
| --- | --- |
|
||||
| Android JVM tests | 10 passed; zero failed/skipped |
|
||||
| Native Compose UI/security suite, API 35 emulator | 6 passed; zero failed/skipped |
|
||||
| Real-upstream native integration suite | 7 passed; zero failed/skipped (the same 6 onboarding tests plus 1 multi-step real-server scenario) |
|
||||
| Native scenario | Login/dashboard, activity recreation, task/note/list/item creation and API readback, redirect refusal, logout and vault erasure |
|
||||
| Integration screenshot export | Successful AGP test-output collection; native dashboard PNG opened and visually confirmed nonblank, synthetic data only |
|
||||
| Android lint | Debug and release passed; newer-version recommendations remain informational |
|
||||
| Android packages | Debug APK and unsigned release APK/AAB built successfully |
|
||||
| Swift portable suite | 16 passed; actual Foundation transport/contracts and URL/metadata policy, not Apple UI/Keychain execution |
|
||||
| Swift formatting/parsing | Strict format lint and parsing passed, including Apple-only sources |
|
||||
| Script regressions | 10 runner-preflight, 8 JUnit-evidence and 5 screenshot-output tests passed |
|
||||
| Repository/workflows | Source invariants, Python compilation, diff whitespace and actionlint for all 3 Gitea workflows passed |
|
||||
| OSV | No listed advisories for 266 locked/direct Maven coordinates and plugins; not a security audit |
|
||||
|
||||
Earlier extended-suite attempts crashed the host emulator with SIGSEGV under
|
||||
software/off GPU modes. Host-GPU mode remained running and produced actionable
|
||||
JUnit failures: an OIDC-return synchronization timeout, followed by an outage
|
||||
assertion that incorrectly assumed the upstream worker could not serve its cached
|
||||
app shell, then a document-readiness race after recreation. Tests now verify the
|
||||
loaded JavaScript origin, wait for the sign-in window to close, retry only a probe
|
||||
lost to document replacement and exercise recovery through uncached metadata.
|
||||
The completed retry passes all seven tests without disabling the worker or
|
||||
weakening production TLS/CSP/origin policies.
|
||||
Environment: Linux/WSL, OpenJDK 17.0.20.1, Gradle 9.6.0, AGP 9.4.1,
|
||||
Kotlin/Compose compiler 2.4.21, API 35 `sdk_gphone64_x86_64` emulator, Swift 6.2.1.
|
||||
The host-only Tink upgrade to 1.15.0 removes the observed obsolete generated
|
||||
protobuf warning; the final Android validation log has no such warning.
|
||||
|
||||
API 37 attempts encountered broken package/activity services and locked
|
||||
credential-encrypted storage. **No API 37 runtime pass is claimed.**
|
||||
The first integration attempt missed the scrolled-off login button. Later,
|
||||
post-uninstall screenshot retrieval failed, and the first compositor capture was
|
||||
black. The final test scrolls the real button, uses native-window capture with a
|
||||
nonblank-pixel assertion and writes through `PlatformTestStorageRegistry` for AGP
|
||||
collection. The latest complete harness exits successfully, not just its JUnit
|
||||
subprocess. Ordinary builds retain screenshot protection.
|
||||
|
||||
Local logs and reports live in `/home/neste/yuvomi-build/`; test XML is under
|
||||
`app/outputs/androidTest-results/connected/`. Earlier failing JUnit snapshots are
|
||||
preserved as `integration-host-gpu-oidc-race.xml` and
|
||||
`integration-host-gpu-sw-cache.xml`, plus
|
||||
`integration-host-gpu-document-ready.xml`. Passing evidence is preserved in
|
||||
`integration-api35-first-pass.xml` and `integration-api35-repeat-pass.xml`; logs are
|
||||
`upstream-integration-final-retry.log` and `upstream-integration-repeat.log`.
|
||||
These files are local evidence, not published
|
||||
artifacts or a hosted CI result.
|
||||
The unmodified pinned upstream HTTPS/OIDC protocol fixture also passed TLS trust,
|
||||
metadata, cookies, CSRF and remote revocation checks. Its IdP exchange is **not
|
||||
native SSO**: the native client refuses the redirect and SSO remains pending.
|
||||
|
||||
Test environment: JDK 17.0.20.1, Node 22.22.1, Python 3.14.4, Android Emulator
|
||||
37.2.12, API 35 x86_64 Google APIs image, WebView 124.0.6367.219. The old bundled
|
||||
WebView is useful compatibility evidence, not a recommendation to use an unpatched
|
||||
engine; a current engine/device run remains mandatory.
|
||||
Evidence paths in the local external build directory:
|
||||
|
||||
## Artifacts
|
||||
- `app/test-results/testDebugUnitTest/`
|
||||
- `app/outputs/androidTest-results/connected/{debug,integration}/`
|
||||
- `app/outputs/native-screenshots/native-dashboard.png`
|
||||
- `app/reports/lint-results-{debug,release}.html`
|
||||
- Logs: `/home/neste/yuvomi-native-validation.log`,
|
||||
`/home/neste/yuvomi-native-integration-final.log`,
|
||||
`/home/neste/yuvomi-native-swift.log`.
|
||||
|
||||
Ignored `artifacts/android/` contains the development-signed debug APK and unsigned
|
||||
release APK/AAB, `SHA256SUMS`, `build-info.json` and manifest/policy/signature
|
||||
inspection evidence. No integration APK is collected. No IPA or Apple archive
|
||||
exists. See [Android build](build-android.md) for repeatable collection commands.
|
||||
No Apple SDK application build, simulator UI test or physical-device result is
|
||||
claimed from these Linux runs. The modified Mac bootstrap and remote APK upload
|
||||
still require inspection of the next actual Gitea run. Prior remote emulator jobs
|
||||
failed KVM preflight; the prerequisite was not weakened or counted as passing.
|
||||
|
||||
## Commands
|
||||
|
||||
@@ -97,47 +65,18 @@ swift test --package-path ios
|
||||
swiftc -frontend -parse ios/Sources/*.swift ios/Tests/*.swift ios/UITests/*.swift
|
||||
python3 scripts/check-repository.py
|
||||
python3 scripts/check-dependencies.py
|
||||
python3 scripts/test-verifier.py
|
||||
python3 scripts/collect-android-artifacts.py
|
||||
git diff --check
|
||||
python3 scripts/lint-workflows.py /path/to/actionlint
|
||||
```
|
||||
|
||||
This environment is Linux/WSL. Android SDK and a KVM emulator were installed for
|
||||
real execution. Build output relocation was needed because the Windows mount
|
||||
rejects some Gradle POSIX metadata operations. Swift's Linux toolchain was
|
||||
installed for portable tests. No macOS, Xcode, Apple simulator or physical device
|
||||
is available; no iOS build/archive/UI result is claimed.
|
||||
On the local WSL checkout use `YUVOMI_BUILD_DIR=/home/neste/yuvomi-native-build`
|
||||
and the SDK paths from [continuation](continuation.md). Select only the authorized
|
||||
test emulator with `ANDROID_SERIAL=emulator-5554`; unrelated/unauthorized attached
|
||||
devices are not test targets.
|
||||
|
||||
## Mandatory remaining evidence
|
||||
## External gates
|
||||
|
||||
- Run Xcode build, XCTest/UI tests and unsigned archive on macOS; fix any compiler
|
||||
or runtime issues. The app has **not** yet been typechecked against Apple SDKs.
|
||||
- Validate real IdPs: cancellation, account linking, TOTP after OIDC, and embedded
|
||||
provider policy. Browser-only providers have no native-session handoff upstream.
|
||||
- Real-device camera/document picker cancellation, file MIME cases, rotation with
|
||||
an outstanding picker, network loss/reconnect, process kill/memory pressure,
|
||||
session expiry/revocation, OS backup, and offline account isolation.
|
||||
- Android 17 private-network permission grant/denial/revocation on a matching OS.
|
||||
Also run minimum-supported API 26 and a current OS/WebView device matrix.
|
||||
- VoiceOver/TalkBack, large text, contrast, keyboard/safe areas, reduced motion,
|
||||
light/dark appearance and responsive web modules on actual supported devices.
|
||||
- Successful CI runs on the configured Gitea runners, private security
|
||||
reporting contact, human security review, store ownership and production signing.
|
||||
|
||||
No Firebase/APNs registration, closed-app push, offline editing, App Store approval,
|
||||
signing, publication or physical-device validation is claimed. See `SECURITY.md`
|
||||
and `docs/security-review.md` for residual limitations.
|
||||
Resume work using [maintainer continuation](continuation.md).
|
||||
|
||||
## Gitea runner adaptation
|
||||
|
||||
Workflows now live in `.gitea/workflows/` and target the supplied `ubuntu-latest`
|
||||
pool and native `macos-arm64` M4 Pro runner. Local workflow grammar lint (Gitea URL
|
||||
syntax normalized), repository invariants, shell/Python syntax, ten mocked runner
|
||||
preflight regressions and eight evidence-verifier regressions pass. SHA-256 Git
|
||||
initialization/fetch was exercised locally; the pinned XcodeGen archive's checksum
|
||||
and native arm64 slice were verified. These are not remote runner execution or
|
||||
Apple SDK results. See [runner requirements](ci-runners.md); the local emulator
|
||||
preflight currently rejects unavailable/inaccessible KVM as designed. Original
|
||||
application build evidence above remains historical and is not a rebuild of the
|
||||
workflow-only changes.
|
||||
Apple SDK builds, real supported devices/current engines, Android API 37, native
|
||||
SSO/reset/invite protocols, permission/role cases, files/offline/notifications,
|
||||
complete module and settings parity, visual baselines, accessibility and human
|
||||
security review remain open. Missing modules are listed in
|
||||
[native parity](native-parity.md), not silently represented as working.
|
||||
+3
-3
@@ -9,10 +9,10 @@ let package = Package(
|
||||
.target(
|
||||
name: "Yuvomi", path: "Sources",
|
||||
exclude: [
|
||||
"AuthenticationView.swift", "BrowserModel.swift", "ContentView.swift",
|
||||
"NativeStore.swift", "NativeRootView.swift", "NativeSessionVault.swift",
|
||||
"ServerProbe.swift", "YuvomiApp.swift", "PrivacyInfo.xcprivacy", "Assets.xcassets",
|
||||
], sources: ["ServerAddress.swift", "ServerMetadata.swift"]),
|
||||
], sources: ["ServerAddress.swift", "ServerMetadata.swift", "NativeContracts.swift", "NativeAPI.swift"]),
|
||||
.testTarget(
|
||||
name: "YuvomiPolicyTests", dependencies: ["Yuvomi"], path: "Tests", exclude: ["BrowserModelTests.swift"]),
|
||||
name: "YuvomiPolicyTests", dependencies: ["Yuvomi"], path: "Tests"),
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,151 @@
|
||||
import Foundation
|
||||
|
||||
#if canImport(FoundationNetworking)
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
|
||||
private struct NativeSavedCookie: Codable {
|
||||
let name: String
|
||||
let value: String
|
||||
let expires: Date
|
||||
}
|
||||
|
||||
/// Bounded streaming requests. Redirects never replay native session cookies.
|
||||
private final class NativeTransport: NSObject, URLSessionDataDelegate, @unchecked Sendable {
|
||||
private struct Pending {
|
||||
let continuation: CheckedContinuation<(Data, HTTPURLResponse), Error>
|
||||
var data = Data()
|
||||
var response: HTTPURLResponse?
|
||||
}
|
||||
private let lock = NSLock()
|
||||
private var requests: [Int: Pending] = [:]
|
||||
func register(_ task: URLSessionDataTask, continuation: CheckedContinuation<(Data, HTTPURLResponse), Error>) {
|
||||
lock.lock()
|
||||
requests[task.taskIdentifier] = Pending(continuation: continuation)
|
||||
lock.unlock()
|
||||
}
|
||||
func urlSession(
|
||||
_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse,
|
||||
newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void
|
||||
) {
|
||||
completionHandler(nil)
|
||||
}
|
||||
func urlSession(
|
||||
_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse,
|
||||
completionHandler: @escaping (URLSession.ResponseDisposition) -> Void
|
||||
) {
|
||||
guard let http = response as? HTTPURLResponse, response.expectedContentLength <= 4 * 1024 * 1024 else {
|
||||
completionHandler(.cancel)
|
||||
return
|
||||
}
|
||||
lock.lock()
|
||||
requests[dataTask.taskIdentifier]?.response = http
|
||||
lock.unlock()
|
||||
completionHandler(.allow)
|
||||
}
|
||||
func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
|
||||
lock.lock()
|
||||
let allowed = (requests[dataTask.taskIdentifier]?.data.count ?? 0) + data.count <= 4 * 1024 * 1024
|
||||
if allowed { requests[dataTask.taskIdentifier]?.data.append(data) }
|
||||
lock.unlock()
|
||||
if !allowed { dataTask.cancel() }
|
||||
}
|
||||
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
|
||||
lock.lock()
|
||||
let pending = requests.removeValue(forKey: task.taskIdentifier)
|
||||
lock.unlock()
|
||||
guard let pending else { return }
|
||||
if error != nil {
|
||||
pending.continuation.resume(throwing: NativeAPIError.unavailable)
|
||||
} else if let response = pending.response {
|
||||
pending.continuation.resume(returning: (pending.data, response))
|
||||
} else {
|
||||
pending.continuation.resume(throwing: NativeAPIError.invalidResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actor NativeAPI {
|
||||
let server: ServerAddress
|
||||
private let transport: NativeTransport
|
||||
private let storage: HTTPCookieStorage
|
||||
private let persist: @Sendable (Data) throws -> Void
|
||||
private let session: URLSession
|
||||
private var csrf = ""
|
||||
private var closed = false
|
||||
|
||||
init(server: ServerAddress, saved: Data?, persist: @escaping @Sendable (Data) throws -> Void) throws {
|
||||
self.server = server
|
||||
self.persist = persist
|
||||
let transport = NativeTransport()
|
||||
self.transport = transport
|
||||
let configuration = URLSessionConfiguration.ephemeral
|
||||
guard let storage = configuration.httpCookieStorage else { throw NativeAPIError.unavailable }
|
||||
self.storage = storage
|
||||
configuration.timeoutIntervalForRequest = 15
|
||||
configuration.timeoutIntervalForResource = 30
|
||||
configuration.urlCache = nil
|
||||
if let saved, let cookies = try? JSONDecoder().decode([NativeSavedCookie].self, from: saved) {
|
||||
for cookie in cookies where cookie.expires > Date() && ["yuvomi.sid", "csrf-token"].contains(cookie.name) {
|
||||
if let restored = HTTPCookie(properties: [
|
||||
.domain: server.url.host ?? "", .path: "/", .secure: "TRUE", .name: cookie.name,
|
||||
.value: cookie.value, .expires: cookie.expires,
|
||||
]) {
|
||||
storage.setCookie(restored)
|
||||
}
|
||||
}
|
||||
}
|
||||
session = URLSession(configuration: configuration, delegate: transport, delegateQueue: nil)
|
||||
}
|
||||
|
||||
func close() {
|
||||
closed = true
|
||||
csrf = ""
|
||||
session.invalidateAndCancel()
|
||||
for cookie in storage.cookies ?? [] { storage.deleteCookie(cookie) }
|
||||
}
|
||||
|
||||
func request<Value: Decodable & Sendable>(
|
||||
_ path: String, method: String = "GET", body: [String: NativeValue]? = nil,
|
||||
as type: Value.Type, retry: Bool = true
|
||||
) async throws -> Value {
|
||||
guard !closed else { throw NativeAPIError.closed }
|
||||
guard path.hasPrefix("/"), !path.hasPrefix("//"), !path.contains("#"), !path.contains("\\"),
|
||||
let url = URL(string: server.url.absoluteString + "/api/v1" + path), server.owns(url)
|
||||
else { throw NativeAPIError.invalidPath }
|
||||
var request = URLRequest(url: url, cachePolicy: .reloadIgnoringLocalCacheData)
|
||||
request.httpMethod = method
|
||||
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||
let mutation = ["POST", "PUT", "PATCH", "DELETE"].contains(method)
|
||||
if mutation {
|
||||
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
||||
request.setValue(csrf, forHTTPHeaderField: "X-CSRF-Token")
|
||||
request.httpBody = try JSONEncoder().encode(body ?? [:])
|
||||
}
|
||||
let (data, response) = try await withCheckedThrowingContinuation { continuation in
|
||||
let task = session.dataTask(with: request)
|
||||
transport.register(task, continuation: continuation)
|
||||
task.resume()
|
||||
}
|
||||
guard !closed else { throw NativeAPIError.closed }
|
||||
guard !(300...399).contains(response.statusCode) else { throw NativeAPIError.response(response.statusCode) }
|
||||
let root = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
|
||||
if let token = response.value(forHTTPHeaderField: "X-CSRF-Token") ?? root?["csrfToken"] as? String {
|
||||
csrf = token
|
||||
}
|
||||
let cookies = (storage.cookies(for: server.url) ?? []).filter {
|
||||
$0.isSecure && ["yuvomi.sid", "csrf-token"].contains($0.name) && $0.path == "/" && $0.expiresDate != nil
|
||||
}.map { NativeSavedCookie(name: $0.name, value: $0.value, expires: $0.expiresDate!) }
|
||||
try persist(JSONEncoder().encode(cookies))
|
||||
if response.statusCode == 403 && mutation && retry && root?["reason"] as? String == "csrf_invalid" {
|
||||
let _: NativeIdentity = try await self.request("/auth/me", as: NativeIdentity.self, retry: false)
|
||||
return try await self.request(path, method: method, body: body, as: type, retry: false)
|
||||
}
|
||||
guard (200...299).contains(response.statusCode) else { throw NativeAPIError.response(response.statusCode) }
|
||||
let decoder = JSONDecoder()
|
||||
decoder.keyDecodingStrategy = .convertFromSnakeCase
|
||||
do { return try decoder.decode(type, from: data.isEmpty ? Data("{}".utf8) : data) } catch {
|
||||
throw NativeAPIError.invalidResponse
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
import Foundation
|
||||
|
||||
enum NativePage: String, CaseIterable, Identifiable, Sendable {
|
||||
case home, tasks, shopping, notes, more
|
||||
var id: String { rawValue }
|
||||
var title: String {
|
||||
switch self {
|
||||
case .home: "Übersicht"
|
||||
case .tasks: "Aufgaben"
|
||||
case .shopping: "Einkauf"
|
||||
case .notes: "Notizen"
|
||||
case .more: "Mehr"
|
||||
}
|
||||
}
|
||||
var symbol: String {
|
||||
switch self {
|
||||
case .home: "house"
|
||||
case .tasks: "checkmark.square"
|
||||
case .shopping: "cart"
|
||||
case .notes: "note.text"
|
||||
case .more: "ellipsis"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct NativeBootstrap: Decodable, Sendable {
|
||||
let appName: String
|
||||
let setupRequired: Bool
|
||||
let passwordResetEnabled: Bool
|
||||
}
|
||||
|
||||
struct NativeAuthentication: Decodable, Sendable {
|
||||
let enabled: Bool
|
||||
let passwordLoginEnabled: Bool
|
||||
let guestPasswordLoginEnabled: Bool?
|
||||
}
|
||||
|
||||
struct NativeUser: Decodable, Sendable {
|
||||
let id: Int
|
||||
let username: String
|
||||
let displayName: String
|
||||
}
|
||||
|
||||
struct NativePermissions: Decodable, Sendable {
|
||||
let admin: Bool
|
||||
let modules: [String: String]
|
||||
let widgets: [String: String]
|
||||
func access(_ module: String) -> String { admin ? "write" : modules[module] ?? "write" }
|
||||
func showsWidget(_ widget: String) -> Bool { admin || widgets[widget] != "none" }
|
||||
}
|
||||
|
||||
struct NativeIdentity: Decodable, Sendable {
|
||||
let user: NativeUser?
|
||||
let permissions: NativePermissions?
|
||||
let csrfToken: String?
|
||||
let twoFactorRequired: Bool?
|
||||
}
|
||||
|
||||
struct NativeEnvelope<Value: Decodable & Sendable>: Decodable, Sendable { let data: Value }
|
||||
struct NativeEmpty: Decodable, Sendable {}
|
||||
|
||||
struct NativeTask: Decodable, Identifiable, Sendable {
|
||||
let id: Int
|
||||
let title: String
|
||||
let description: String?
|
||||
let status: String
|
||||
let priority: String
|
||||
let dueDate: String?
|
||||
let category: String?
|
||||
}
|
||||
|
||||
struct NativeNote: Decodable, Identifiable, Sendable {
|
||||
let id: Int
|
||||
let title: String?
|
||||
let content: String
|
||||
let pinned: Int
|
||||
}
|
||||
|
||||
struct NativeShoppingList: Decodable, Identifiable, Sendable {
|
||||
let id: Int
|
||||
let name: String
|
||||
let itemTotal: Int?
|
||||
let itemChecked: Int?
|
||||
let openCount: Int?
|
||||
}
|
||||
|
||||
struct NativeShoppingItem: Decodable, Identifiable, Sendable {
|
||||
let id: Int
|
||||
let name: String
|
||||
let quantity: String?
|
||||
let category: String?
|
||||
let isChecked: Int
|
||||
}
|
||||
|
||||
struct NativeEventPreview: Decodable, Identifiable, Sendable {
|
||||
let id: Int
|
||||
let title: String
|
||||
let startDatetime: String
|
||||
}
|
||||
|
||||
struct NativeTaskPreview: Decodable, Identifiable, Sendable {
|
||||
let id: Int
|
||||
let title: String
|
||||
let dueDate: String?
|
||||
}
|
||||
|
||||
struct NativeDashboard: Decodable, Sendable {
|
||||
let openTaskCount: Int?
|
||||
let shoppingOpenCount: Int?
|
||||
let urgentTasks: [NativeTaskPreview]
|
||||
let upcomingEvents: [NativeEventPreview]
|
||||
let shoppingLists: [NativeShoppingList]
|
||||
let pinnedNotes: [NativeNote]
|
||||
}
|
||||
|
||||
enum NativeValue: Encodable, Sendable {
|
||||
case string(String)
|
||||
case number(Int)
|
||||
case bool(Bool)
|
||||
case null
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var value = encoder.singleValueContainer()
|
||||
switch self {
|
||||
case .string(let text): try value.encode(text)
|
||||
case .number(let number): try value.encode(number)
|
||||
case .bool(let flag): try value.encode(flag)
|
||||
case .null: try value.encodeNil()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum NativeAPIError: LocalizedError {
|
||||
case response(Int)
|
||||
case invalidResponse, invalidPath, unavailable, closed
|
||||
var errorDescription: String? {
|
||||
switch self {
|
||||
case .response(401): "Anmeldung oder Sitzung ist nicht mehr gültig."
|
||||
case .response(403): "Diese Aktion ist nicht erlaubt. Bitte prüfe deine Berechtigungen."
|
||||
case .response(409): "Der Eintrag wurde inzwischen geändert. Bitte neu laden."
|
||||
case .response(429): "Zu viele Versuche. Bitte warte einen Moment."
|
||||
case .response(let status): "Die Anfrage konnte nicht abgeschlossen werden (HTTP \(status))."
|
||||
case .invalidPath, .invalidResponse: "Der Server hat keine gültige API-Antwort geliefert."
|
||||
case .unavailable: "Verbindung fehlgeschlagen. Bitte Server, Zertifikat und Netzwerk prüfen."
|
||||
case .closed: "Diese Sitzung wurde geschlossen."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,555 @@
|
||||
import SwiftUI
|
||||
|
||||
private enum NativeDesign {
|
||||
static let accent = Color(red: 108 / 255, green: 58 / 255, blue: 237 / 255)
|
||||
static func tint(_ dark: Bool) -> Color {
|
||||
dark ? Color(red: 167 / 255, green: 139 / 255, blue: 250 / 255) : accent
|
||||
}
|
||||
static func button(_ dark: Bool) -> Color {
|
||||
dark ? Color(red: 124 / 255, green: 58 / 255, blue: 237 / 255) : accent
|
||||
}
|
||||
static func background(_ dark: Bool) -> Color {
|
||||
dark
|
||||
? Color(red: 25 / 255, green: 24 / 255, blue: 22 / 255)
|
||||
: Color(red: 245 / 255, green: 243 / 255, blue: 237 / 255)
|
||||
}
|
||||
static func surface(_ dark: Bool) -> Color {
|
||||
dark ? Color(red: 43 / 255, green: 40 / 255, blue: 37 / 255) : .white
|
||||
}
|
||||
}
|
||||
|
||||
private struct NativeDraft: Identifiable {
|
||||
let id = UUID()
|
||||
let recordID: Int?
|
||||
let page: NativePage
|
||||
var title: String
|
||||
var detail: String
|
||||
var priority = "none"
|
||||
var date = ""
|
||||
}
|
||||
|
||||
struct NativeRootView: View {
|
||||
@StateObject private var store = NativeStore()
|
||||
@Environment(\.colorScheme) private var scheme
|
||||
@Environment(\.scenePhase) private var phase
|
||||
@State private var draft: NativeDraft?
|
||||
@State private var forget = false
|
||||
@State private var deletePath: String?
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
NativeDesign.background(scheme == .dark).ignoresSafeArea()
|
||||
if store.user == nil { authentication } else { application }
|
||||
if phase != .active {
|
||||
NativeDesign.background(scheme == .dark).ignoresSafeArea()
|
||||
NativeBrandMark().frame(width: 64, height: 64)
|
||||
}
|
||||
}
|
||||
.tint(NativeDesign.tint(scheme == .dark))
|
||||
.task { await store.restore() }
|
||||
.onChange(of: store.user?.id) {
|
||||
draft = nil
|
||||
deletePath = nil
|
||||
search = ""
|
||||
}
|
||||
.onChange(of: store.server) {
|
||||
draft = nil
|
||||
deletePath = nil
|
||||
search = ""
|
||||
}
|
||||
.sheet(item: $draft) { entry in
|
||||
NativeEditor(draft: entry, busy: store.busy, error: store.error) { body in
|
||||
let path: String
|
||||
let method: String
|
||||
switch entry.page {
|
||||
case .tasks:
|
||||
path = entry.recordID.map { "/tasks/\($0)" } ?? "/tasks"
|
||||
method = entry.recordID == nil ? "POST" : "PUT"
|
||||
case .notes:
|
||||
path = entry.recordID.map { "/notes/\($0)" } ?? "/notes"
|
||||
method = entry.recordID == nil ? "POST" : "PUT"
|
||||
case .shopping:
|
||||
path =
|
||||
entry.recordID.map { "/shopping/items/\($0)" } ?? store.selectedList.map {
|
||||
"/shopping/\($0.id)/items"
|
||||
} ?? "/shopping"
|
||||
method = entry.recordID == nil ? "POST" : "PATCH"
|
||||
default: return false
|
||||
}
|
||||
return await store.mutate(path, method: method, body: body)
|
||||
}
|
||||
}
|
||||
.alert("Server entfernen?", isPresented: $forget) {
|
||||
Button("Lokal entfernen", role: .destructive) { Task { await store.forget() } }
|
||||
Button("Abbrechen", role: .cancel) {}
|
||||
} message: {
|
||||
Text(
|
||||
"Die native Sitzung und geladene Inhalte werden lokal gelöscht. Melde dich möglichst zuerst ab, um die Sitzung auch auf dem Server zu widerrufen."
|
||||
)
|
||||
}
|
||||
.alert(
|
||||
"Eintrag löschen?", isPresented: Binding(get: { deletePath != nil }, set: { if !$0 { deletePath = nil } })
|
||||
) {
|
||||
Button("Löschen", role: .destructive) {
|
||||
if let path = deletePath { Task { _ = await store.mutate(path, method: "DELETE") } }
|
||||
deletePath = nil
|
||||
}
|
||||
Button("Abbrechen", role: .cancel) { deletePath = nil }
|
||||
} message: {
|
||||
Text("Der Eintrag wird auf deinem Server gelöscht.")
|
||||
}
|
||||
}
|
||||
|
||||
private var authentication: some View {
|
||||
NativeAuthenticationScreen(store: store, forget: { forget = true })
|
||||
}
|
||||
|
||||
private var application: some View {
|
||||
NavigationStack {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
if store.busy { ProgressView().frame(maxWidth: .infinity) }
|
||||
if let error = store.error {
|
||||
Text(error).foregroundStyle(.red).accessibilityIdentifier("native-error")
|
||||
}
|
||||
switch store.page {
|
||||
case .home: dashboard
|
||||
case .tasks: taskList
|
||||
case .notes: noteList
|
||||
case .shopping: shopping
|
||||
case .more: more
|
||||
}
|
||||
}
|
||||
.padding(16)
|
||||
.frame(maxWidth: 760)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.background(NativeDesign.background(scheme == .dark))
|
||||
.navigationTitle(store.selectedList?.name ?? store.page.title)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button("Aktualisieren", systemImage: "arrow.clockwise") { Task { await store.refresh() } }.disabled(
|
||||
store.busy)
|
||||
}
|
||||
if [.tasks, .notes, .shopping].contains(store.page),
|
||||
store.permissions?.access(store.page.rawValue) == "write"
|
||||
{
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button("Hinzufügen", systemImage: "plus") {
|
||||
draft = NativeDraft(recordID: nil, page: store.page, title: "", detail: "")
|
||||
}.disabled(store.busy)
|
||||
}
|
||||
}
|
||||
}
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
HStack(spacing: 0) {
|
||||
ForEach(
|
||||
NativePage.allCases.filter {
|
||||
[.home, .more].contains($0) || store.permissions?.access($0.rawValue) != "none"
|
||||
}
|
||||
) { page in
|
||||
Button {
|
||||
Task { await store.navigate(page) }
|
||||
} label: {
|
||||
VStack(spacing: 4) {
|
||||
Image(systemName: page.symbol).font(.system(size: 21))
|
||||
Text(page.title).font(.system(size: 11))
|
||||
}
|
||||
.foregroundStyle(store.page == page ? NativeDesign.tint(scheme == .dark) : .secondary)
|
||||
.frame(maxWidth: .infinity).padding(.vertical, 10)
|
||||
}
|
||||
.disabled(store.busy).accessibilityIdentifier("nav-\(page.rawValue)")
|
||||
}
|
||||
}
|
||||
.padding(6).background(.regularMaterial, in: Capsule()).shadow(
|
||||
color: .black.opacity(0.08), radius: 12, y: 4
|
||||
).padding(.horizontal, 12).padding(.bottom, 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private var dashboard: some View {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
Text("Hallo, \(store.user?.displayName ?? "")").font(.title2.bold())
|
||||
Text(Date.now, format: .dateTime.weekday(.wide).day().month(.wide)).foregroundStyle(.secondary)
|
||||
}
|
||||
if let data = store.dashboard {
|
||||
if store.permissions?.access("tasks") != "none", store.permissions?.showsWidget("tasks") == true {
|
||||
NativeCard("Aufgaben", subtitle: "\(data.openTaskCount.map(String.init) ?? "—") offen") {
|
||||
if data.urgentTasks.isEmpty { empty("Keine dringenden Aufgaben") }
|
||||
ForEach(data.urgentTasks) { item in row(item.title, detail: item.dueDate ?? "") }
|
||||
Button("Alle Aufgaben") { Task { await store.navigate(.tasks) } }
|
||||
}
|
||||
}
|
||||
if store.permissions?.access("calendar") != "none", store.permissions?.showsWidget("calendar") == true {
|
||||
NativeCard("Kalender", subtitle: "Nächste Termine") {
|
||||
if data.upcomingEvents.isEmpty { empty("Keine anstehenden Termine") }
|
||||
ForEach(data.upcomingEvents) { item in
|
||||
row(
|
||||
item.title,
|
||||
detail: String(item.startDatetime.replacingOccurrences(of: "T", with: " ").prefix(16)))
|
||||
}
|
||||
}
|
||||
}
|
||||
if store.permissions?.access("shopping") != "none", store.permissions?.showsWidget("shopping") == true {
|
||||
NativeCard("Einkauf", subtitle: "\(data.shoppingOpenCount.map(String.init) ?? "—") offene Artikel") {
|
||||
if data.shoppingLists.isEmpty { empty("Alles eingekauft") }
|
||||
ForEach(data.shoppingLists) { item in row(item.name, detail: "\(item.openCount ?? 0) offen") }
|
||||
Button("Alle Listen") { Task { await store.navigate(.shopping) } }
|
||||
}
|
||||
}
|
||||
if store.permissions?.access("notes") != "none", store.permissions?.showsWidget("notes") == true {
|
||||
NativeCard("Notizen", subtitle: "Angeheftet") {
|
||||
if data.pinnedNotes.isEmpty { empty("Noch keine Notizen") }
|
||||
ForEach(data.pinnedNotes) { item in
|
||||
row(item.title ?? "Notiz", detail: String(item.content.prefix(140)))
|
||||
}
|
||||
Button("Alle Notizen") { Task { await store.navigate(.notes) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@State private var search = ""
|
||||
@State private var taskStatus = "open"
|
||||
private var canWrite: Bool { !store.busy && store.permissions?.access(store.page.rawValue) == "write" }
|
||||
|
||||
@ViewBuilder private var taskList: some View {
|
||||
TextField("Suchen", text: $search).textFieldStyle(.roundedBorder)
|
||||
Picker("Status", selection: $taskStatus) {
|
||||
Text("Offen").tag("open")
|
||||
Text("Erledigt").tag("done")
|
||||
Text("Alle").tag("all")
|
||||
}.pickerStyle(.segmented)
|
||||
let filtered = store.tasks.filter {
|
||||
(search.isEmpty || ($0.title + ($0.description ?? "")).localizedCaseInsensitiveContains(search))
|
||||
&& (taskStatus == "all" || (taskStatus == "done" ? $0.status == "done" : $0.status != "done"))
|
||||
}
|
||||
if filtered.isEmpty && !store.busy { empty("Hier gibt es noch keine passenden Aufgaben.") }
|
||||
ForEach(filtered) { item in
|
||||
NativeCard {
|
||||
HStack {
|
||||
Button {
|
||||
Task {
|
||||
_ = await store.mutate(
|
||||
"/tasks/\(item.id)/status", method: "PATCH",
|
||||
body: ["status": .string(item.status == "done" ? "open" : "done")])
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: item.status == "done" ? "checkmark.circle.fill" : "circle").font(.title2)
|
||||
}.disabled(!canWrite).accessibilityLabel(item.status == "done" ? "Wieder öffnen" : "Erledigen")
|
||||
Button {
|
||||
draft = NativeDraft(
|
||||
recordID: item.id, page: .tasks, title: item.title, detail: item.description ?? "",
|
||||
priority: item.priority, date: item.dueDate ?? "")
|
||||
} label: {
|
||||
row(
|
||||
item.title,
|
||||
detail: [item.category, item.dueDate].compactMap { $0 }.joined(separator: " · "))
|
||||
}.buttonStyle(.plain).disabled(!canWrite)
|
||||
Spacer()
|
||||
deleteButton("/tasks/\(item.id)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private var noteList: some View {
|
||||
TextField("Suchen", text: $search).textFieldStyle(.roundedBorder)
|
||||
let filtered = store.notes.filter {
|
||||
search.isEmpty || (($0.title ?? "") + $0.content).localizedCaseInsensitiveContains(search)
|
||||
}
|
||||
if filtered.isEmpty && !store.busy { empty("Hier gibt es noch keine passenden Notizen.") }
|
||||
ForEach(filtered) { item in
|
||||
NativeCard {
|
||||
Button {
|
||||
draft = NativeDraft(recordID: item.id, page: .notes, title: item.title ?? "", detail: item.content)
|
||||
} label: {
|
||||
row(item.title ?? "Notiz", detail: item.content)
|
||||
}.buttonStyle(.plain).disabled(!canWrite)
|
||||
HStack {
|
||||
Button(item.pinned == 1 ? "Lösen" : "Anheften") {
|
||||
Task { _ = await store.mutate("/notes/\(item.id)/pin", method: "PATCH") }
|
||||
}.disabled(!canWrite)
|
||||
Spacer()
|
||||
deleteButton("/notes/\(item.id)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private var shopping: some View {
|
||||
if store.selectedList != nil {
|
||||
Button("Alle Listen") { Task { await store.navigate(.shopping) } }.disabled(store.busy)
|
||||
if store.items.isEmpty && !store.busy { empty("Diese Liste ist noch leer.") }
|
||||
ForEach(store.items) { item in
|
||||
NativeCard {
|
||||
HStack {
|
||||
Button {
|
||||
Task {
|
||||
_ = await store.mutate(
|
||||
"/shopping/items/\(item.id)", method: "PATCH",
|
||||
body: ["is_checked": .number(item.isChecked == 1 ? 0 : 1)])
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: item.isChecked == 1 ? "checkmark.circle.fill" : "circle").font(.title2)
|
||||
}.disabled(!canWrite).accessibilityLabel(item.isChecked == 1 ? "Wieder öffnen" : "Abhaken")
|
||||
Button {
|
||||
draft = NativeDraft(
|
||||
recordID: item.id, page: .shopping, title: item.name, detail: item.quantity ?? "")
|
||||
} label: {
|
||||
row(item.name, detail: item.quantity ?? "")
|
||||
}.buttonStyle(.plain).disabled(!canWrite)
|
||||
Spacer()
|
||||
deleteButton("/shopping/items/\(item.id)")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if store.lists.isEmpty && !store.busy { empty("Hier gibt es noch keine Einkaufslisten.") }
|
||||
ForEach(store.lists) { list in
|
||||
NativeCard {
|
||||
HStack {
|
||||
Button {
|
||||
Task { await store.open(list) }
|
||||
} label: {
|
||||
row(list.name, detail: "\(list.itemTotal ?? 0) Artikel")
|
||||
}.buttonStyle(.plain).disabled(store.busy)
|
||||
Spacer()
|
||||
deleteButton("/shopping/\(list.id)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var more: some View {
|
||||
VStack(spacing: 16) {
|
||||
NativeCard("Dein Haushalt", subtitle: store.appName) {
|
||||
Text(store.user?.displayName ?? "")
|
||||
Text(store.server).foregroundStyle(.secondary)
|
||||
}
|
||||
NativeCard("Konto") {
|
||||
Button("Abmelden") { Task { await store.logout() } }.disabled(store.busy)
|
||||
Button("Server und lokale Sitzung entfernen", role: .destructive) { forget = true }.disabled(store.busy)
|
||||
}
|
||||
NativeCard("Nativer Neubau", subtitle: "Noch keine vollständige PWA-Parität") {
|
||||
Text(
|
||||
"Die weiteren Module und Einstellungen werden separat nativ nachgebaut. Es gibt keinen Browser-Fallback."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func deleteButton(_ path: String) -> some View {
|
||||
Button("Löschen", systemImage: "trash", role: .destructive) { deletePath = path }.labelStyle(.iconOnly)
|
||||
.disabled(!canWrite)
|
||||
}
|
||||
private func row(_ title: String, detail: String) -> some View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(title).fontWeight(.semibold)
|
||||
if !detail.isEmpty { Text(detail).font(.subheadline).foregroundStyle(.secondary) }
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
private func empty(_ text: String) -> some View {
|
||||
Text(text).foregroundStyle(.secondary).padding(.vertical, 16).frame(maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
|
||||
private struct NativeAuthenticationScreen: View {
|
||||
@Environment(\.colorScheme) private var scheme
|
||||
@ObservedObject var store: NativeStore
|
||||
let forget: () -> Void
|
||||
@State private var address = ""
|
||||
@State private var username = ""
|
||||
@State private var password = ""
|
||||
@State private var name = ""
|
||||
@State private var code = ""
|
||||
@State private var invalidAddress = false
|
||||
@State private var sso = false
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 16) {
|
||||
NativeCard {
|
||||
VStack(spacing: 16) {
|
||||
NativeBrandMark().frame(width: 64, height: 64).accessibilityHidden(true)
|
||||
Text(store.appName).font(.system(size: 34, weight: .bold))
|
||||
Text(
|
||||
store.server.isEmpty ? "Dein Zuhause. Dein Server." : "Alles für euren Alltag an einem Ort."
|
||||
).foregroundStyle(.secondary).multilineTextAlignment(.center)
|
||||
if store.server.isEmpty {
|
||||
TextField("Server-Adresse", text: $address).keyboardType(.URL).textContentType(.URL)
|
||||
.textInputAutocapitalization(.never).autocorrectionDisabled().textFieldStyle(
|
||||
.roundedBorder
|
||||
).accessibilityIdentifier("server-url")
|
||||
if invalidAddress {
|
||||
Text("Bitte eine gültige HTTPS-Adresse ohne Unterpfad eingeben.").foregroundStyle(.red)
|
||||
.accessibilityIdentifier("invalid-server")
|
||||
}
|
||||
Text("HTTPS · eigener Server · keine zentrale Cloud").font(.caption).foregroundStyle(
|
||||
.secondary)
|
||||
Button("Verbinden") {
|
||||
guard (try? ServerAddress(address)) != nil else {
|
||||
invalidAddress = true
|
||||
return
|
||||
}
|
||||
invalidAddress = false
|
||||
Task { await store.connect(address) }
|
||||
}.buttonStyle(.borderedProminent).tint(NativeDesign.button(scheme == .dark)).disabled(
|
||||
store.busy || address.isEmpty
|
||||
)
|
||||
.accessibilityIdentifier("connect")
|
||||
} else if store.twoFactor {
|
||||
TextField("Code oder Wiederherstellungscode", text: $code).textContentType(.oneTimeCode)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
Button("Bestätigen") {
|
||||
let value = code
|
||||
code = ""
|
||||
Task { await store.verify(value) }
|
||||
}.buttonStyle(.borderedProminent).tint(NativeDesign.button(scheme == .dark)).disabled(
|
||||
store.busy || code.isEmpty)
|
||||
Button("Zurück zur Anmeldung") { store.cancelTwoFactor() }.disabled(store.busy)
|
||||
} else {
|
||||
if store.setup { TextField("Anzeigename", text: $name).textFieldStyle(.roundedBorder) }
|
||||
if store.passwordAllowed || store.setup {
|
||||
TextField("Benutzername", text: $username).textContentType(.username)
|
||||
.textInputAutocapitalization(.never).autocorrectionDisabled().textFieldStyle(
|
||||
.roundedBorder
|
||||
).accessibilityIdentifier("username")
|
||||
SecureField("Passwort", text: $password).textContentType(.password).textFieldStyle(
|
||||
.roundedBorder
|
||||
).accessibilityIdentifier("password")
|
||||
Button(store.setup ? "Haushalt einrichten" : "Anmelden") {
|
||||
let submitted = password
|
||||
password = ""
|
||||
Task {
|
||||
await store.login(username: username, password: submitted, displayName: name)
|
||||
}
|
||||
}.buttonStyle(.borderedProminent).tint(NativeDesign.button(scheme == .dark)).disabled(
|
||||
store.busy || username.isEmpty || password.isEmpty
|
||||
).accessibilityIdentifier("login")
|
||||
}
|
||||
if store.oidc { Button("SSO – noch in Umsetzung") { sso = true } }
|
||||
Button("Anderen Server verwenden", action: forget).disabled(store.busy)
|
||||
}
|
||||
if store.busy { ProgressView() }
|
||||
if let error = store.error {
|
||||
Text(error).foregroundStyle(.red).accessibilityIdentifier("auth-error")
|
||||
}
|
||||
}
|
||||
.padding(8)
|
||||
}
|
||||
.frame(maxWidth: 412)
|
||||
}
|
||||
.padding(16).frame(maxWidth: .infinity)
|
||||
.containerRelativeFrame(.vertical) { height, _ in max(height, 500) }
|
||||
}
|
||||
.alert("Native Anmeldung", isPresented: $sso) {
|
||||
Button("Verstanden", role: .cancel) {}
|
||||
} message: {
|
||||
Text(
|
||||
"SSO wird für den nativen API-Client noch nicht unterstützt. Es wird keine Browser-Sitzung als native Anmeldung vorgetäuscht."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct NativeEditor: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Environment(\.scenePhase) private var phase
|
||||
@Environment(\.colorScheme) private var scheme
|
||||
@State var draft: NativeDraft
|
||||
let busy: Bool
|
||||
let error: String?
|
||||
let save: ([String: NativeValue]) async -> Bool
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
TextField(draft.page == .shopping ? "Name" : "Titel", text: $draft.title)
|
||||
TextField(draft.page == .shopping ? "Menge" : "Inhalt", text: $draft.detail, axis: .vertical).lineLimit(
|
||||
3...10)
|
||||
if draft.page == .tasks {
|
||||
Picker("Priorität", selection: $draft.priority) {
|
||||
Text("Keine").tag("none")
|
||||
Text("Niedrig").tag("low")
|
||||
Text("Mittel").tag("medium")
|
||||
Text("Hoch").tag("high")
|
||||
Text("Dringend").tag("urgent")
|
||||
}
|
||||
TextField("Fällig am (JJJJ-MM-TT)", text: $draft.date)
|
||||
}
|
||||
if let error { Text(error).foregroundStyle(.red) }
|
||||
}
|
||||
.navigationTitle(draft.recordID == nil ? "Hinzufügen" : "Bearbeiten").navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) { Button("Abbrechen") { dismiss() }.disabled(busy) }
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button("Speichern") {
|
||||
var body: [String: NativeValue] = [
|
||||
draft.page == .shopping ? "name" : "title": .string(draft.title)
|
||||
]
|
||||
if draft.page == .notes { body["content"] = .string(draft.detail) }
|
||||
if draft.page == .tasks {
|
||||
body["description"] = .string(draft.detail)
|
||||
body["priority"] = .string(draft.priority)
|
||||
body["due_date"] = draft.date.isEmpty ? .null : .string(draft.date)
|
||||
}
|
||||
if draft.page == .shopping { body["quantity"] = .string(draft.detail) }
|
||||
Task { if await save(body) { dismiss() } }
|
||||
}.disabled(
|
||||
busy || (draft.title.isEmpty && draft.page != .notes)
|
||||
|| (draft.page == .notes && draft.detail.isEmpty))
|
||||
}
|
||||
}
|
||||
}.interactiveDismissDisabled(busy)
|
||||
.overlay {
|
||||
if phase != .active {
|
||||
ZStack {
|
||||
NativeDesign.background(scheme == .dark).ignoresSafeArea()
|
||||
NativeBrandMark().frame(width: 64, height: 64)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct NativeCard<Content: View>: View {
|
||||
@Environment(\.colorScheme) private var scheme
|
||||
let title: String?
|
||||
let subtitle: String?
|
||||
let content: Content
|
||||
init(_ title: String? = nil, subtitle: String? = nil, @ViewBuilder content: () -> Content) {
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.content = content()
|
||||
}
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
if let title { Text(title).font(.title3.weight(.semibold)) }
|
||||
if let subtitle { Text(subtitle).font(.subheadline).foregroundStyle(.secondary) }
|
||||
content
|
||||
}.frame(maxWidth: .infinity, alignment: .leading).padding(16).background(
|
||||
NativeDesign.surface(scheme == .dark), in: RoundedRectangle(cornerRadius: 16))
|
||||
}
|
||||
}
|
||||
|
||||
private struct NativeBrandMark: View {
|
||||
var body: some View {
|
||||
Canvas { context, size in
|
||||
let shape = Path(roundedRect: CGRect(origin: .zero, size: size), cornerRadius: size.width * 0.225)
|
||||
context.fill(
|
||||
shape,
|
||||
with: .linearGradient(
|
||||
Gradient(colors: [Color(red: 139 / 255, green: 92 / 255, blue: 246 / 255), NativeDesign.accent]),
|
||||
startPoint: .zero, endPoint: CGPoint(x: size.width, y: size.height)))
|
||||
for (x, y, radius) in [(64.0, 72.0, 27.0), (100.0, 78.0, 25.0), (80.0, 106.0, 24.0)] {
|
||||
let rect = CGRect(
|
||||
x: (x - radius) * size.width / 160, y: (y - radius) * size.height / 160,
|
||||
width: radius * 2 * size.width / 160, height: radius * 2 * size.height / 160)
|
||||
context.fill(Path(ellipseIn: rect), with: .color(.white.opacity(0.82)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import Foundation
|
||||
import Security
|
||||
|
||||
/// Native cookies, separate from WebKit and scoped to one configured origin.
|
||||
struct NativeSessionVault: Sendable {
|
||||
let origin: String
|
||||
private var query: [String: Any] {
|
||||
[
|
||||
kSecClass as String: kSecClassGenericPassword,
|
||||
kSecAttrService as String: "community.yuvomi.mobile.native-session",
|
||||
kSecAttrAccount as String: origin,
|
||||
]
|
||||
}
|
||||
func load() -> Data? {
|
||||
var request = query
|
||||
request[kSecReturnData as String] = true
|
||||
request[kSecMatchLimit as String] = kSecMatchLimitOne
|
||||
var result: CFTypeRef?
|
||||
guard SecItemCopyMatching(request as CFDictionary, &result) == errSecSuccess else { return nil }
|
||||
return result as? Data
|
||||
}
|
||||
func save(_ data: Data) throws {
|
||||
let attributes: [String: Any] = [
|
||||
kSecValueData as String: data,
|
||||
kSecAttrAccessible as String: kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
|
||||
]
|
||||
let status = SecItemUpdate(query as CFDictionary, attributes as CFDictionary)
|
||||
if status == errSecItemNotFound {
|
||||
var request = query
|
||||
for (key, value) in attributes { request[key] = value }
|
||||
guard SecItemAdd(request as CFDictionary, nil) == errSecSuccess else { throw NativeAPIError.unavailable }
|
||||
} else if status != errSecSuccess {
|
||||
throw NativeAPIError.unavailable
|
||||
}
|
||||
}
|
||||
func clear() throws {
|
||||
let status = SecItemDelete(query as CFDictionary)
|
||||
guard status == errSecSuccess || status == errSecItemNotFound else { throw NativeAPIError.unavailable }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
final class NativeStore: ObservableObject {
|
||||
@Published private(set) var server = ""
|
||||
@Published private(set) var appName = "Yuvomi"
|
||||
@Published private(set) var user: NativeUser?
|
||||
@Published private(set) var permissions: NativePermissions?
|
||||
@Published private(set) var setup = false
|
||||
@Published private(set) var passwordAllowed = true
|
||||
@Published private(set) var oidc = false
|
||||
@Published private(set) var twoFactor = false
|
||||
@Published private(set) var busy = false
|
||||
@Published var error: String?
|
||||
@Published private(set) var page = NativePage.home
|
||||
@Published private(set) var dashboard: NativeDashboard?
|
||||
@Published private(set) var tasks: [NativeTask] = []
|
||||
@Published private(set) var notes: [NativeNote] = []
|
||||
@Published private(set) var lists: [NativeShoppingList] = []
|
||||
@Published private(set) var items: [NativeShoppingItem] = []
|
||||
@Published private(set) var selectedList: NativeShoppingList?
|
||||
private var api: NativeAPI?
|
||||
private var vault: NativeSessionVault?
|
||||
private var generation = 0
|
||||
|
||||
func restore() async {
|
||||
guard server.isEmpty, let saved = UserDefaults.standard.string(forKey: "native-origin") else { return }
|
||||
await connect(saved)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
private func run(_ operation: () async throws -> Void) async -> Bool {
|
||||
guard !busy else { return false }
|
||||
let current = generation
|
||||
busy = true
|
||||
error = nil
|
||||
defer { if generation == current { busy = false } }
|
||||
do {
|
||||
try await operation()
|
||||
return true
|
||||
} catch {
|
||||
guard current == generation else { return false }
|
||||
if case NativeAPIError.response(401) = error, user != nil {
|
||||
clearLoadedData()
|
||||
self.error = "Deine Sitzung ist abgelaufen. Bitte erneut anmelden."
|
||||
} else {
|
||||
self.error = (error as? NativeAPIError)?.errorDescription ?? NativeAPIError.unavailable.errorDescription
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func connect(_ input: String) async {
|
||||
await run {
|
||||
let address = try ServerAddress(input)
|
||||
let storage = NativeSessionVault(origin: address.url.absoluteString)
|
||||
let client = try NativeAPI(server: address, saved: storage.load(), persist: storage.save)
|
||||
let metadata = try await client.request("/version", as: NativeBootstrap.self)
|
||||
let authentication = try await client.request("/auth/oidc/config", as: NativeAuthentication.self)
|
||||
api = client
|
||||
vault = storage
|
||||
server = address.url.absoluteString
|
||||
appName = metadata.appName
|
||||
setup = metadata.setupRequired
|
||||
oidc = authentication.enabled
|
||||
passwordAllowed = authentication.passwordLoginEnabled || authentication.guestPasswordLoginEnabled == true
|
||||
UserDefaults.standard.set(server, forKey: "native-origin")
|
||||
do { try await accept(client.request("/auth/me", as: NativeIdentity.self)) } catch NativeAPIError.response(
|
||||
401)
|
||||
{ return }
|
||||
}
|
||||
}
|
||||
|
||||
func login(username: String, password: String, displayName: String) async {
|
||||
await run {
|
||||
guard let api else { throw NativeAPIError.closed }
|
||||
if setup {
|
||||
let _: NativeEmpty = try await api.request(
|
||||
"/auth/setup", method: "POST",
|
||||
body: [
|
||||
"username": .string(username.trimmingCharacters(in: .whitespaces)),
|
||||
"password": .string(password),
|
||||
"display_name": .string(displayName.isEmpty ? username : displayName),
|
||||
], as: NativeEmpty.self)
|
||||
}
|
||||
let response = try await api.request(
|
||||
"/auth/login", method: "POST",
|
||||
body: [
|
||||
"username": .string(username.trimmingCharacters(in: .whitespaces)), "password": .string(password),
|
||||
], as: NativeIdentity.self)
|
||||
if response.twoFactorRequired == true {
|
||||
twoFactor = true
|
||||
setup = false
|
||||
} else {
|
||||
try await accept(response)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func verify(_ code: String) async {
|
||||
await run {
|
||||
guard let api else { throw NativeAPIError.closed }
|
||||
try await accept(
|
||||
api.request("/auth/2fa/verify", method: "POST", body: ["code": .string(code)], as: NativeIdentity.self))
|
||||
}
|
||||
}
|
||||
func cancelTwoFactor() {
|
||||
if !busy {
|
||||
twoFactor = false
|
||||
error = nil
|
||||
}
|
||||
}
|
||||
|
||||
private func accept(_ identity: NativeIdentity) async throws {
|
||||
guard let user = identity.user, let permissions = identity.permissions else {
|
||||
throw NativeAPIError.invalidResponse
|
||||
}
|
||||
self.user = user
|
||||
self.permissions = permissions
|
||||
setup = false
|
||||
twoFactor = false
|
||||
page = .home
|
||||
try await reload()
|
||||
}
|
||||
|
||||
func navigate(_ selected: NativePage) async {
|
||||
await run {
|
||||
page = selected
|
||||
selectedList = nil
|
||||
try await reload()
|
||||
}
|
||||
}
|
||||
func open(_ list: NativeShoppingList) async {
|
||||
await run {
|
||||
page = .shopping
|
||||
selectedList = list
|
||||
try await reload()
|
||||
}
|
||||
}
|
||||
func refresh() async { await run { try await reload() } }
|
||||
|
||||
private func reload() async throws {
|
||||
guard let api else { throw NativeAPIError.closed }
|
||||
switch page {
|
||||
case .home: dashboard = try await api.request("/dashboard", as: NativeDashboard.self)
|
||||
case .tasks: tasks = try await api.request("/tasks", as: NativeEnvelope<[NativeTask]>.self).data
|
||||
case .notes: notes = try await api.request("/notes", as: NativeEnvelope<[NativeNote]>.self).data
|
||||
case .shopping:
|
||||
if let selectedList {
|
||||
items = try await api.request(
|
||||
"/shopping/\(selectedList.id)/items", as: NativeEnvelope<[NativeShoppingItem]>.self
|
||||
).data
|
||||
} else {
|
||||
lists = try await api.request("/shopping", as: NativeEnvelope<[NativeShoppingList]>.self).data
|
||||
}
|
||||
case .more: break
|
||||
}
|
||||
}
|
||||
|
||||
func mutate(_ path: String, method: String, body: [String: NativeValue] = [:]) async -> Bool {
|
||||
await run {
|
||||
guard let api else { throw NativeAPIError.closed }
|
||||
let _: NativeEmpty = try await api.request(path, method: method, body: body, as: NativeEmpty.self)
|
||||
try await reload()
|
||||
}
|
||||
}
|
||||
|
||||
func logout() async {
|
||||
await run {
|
||||
let revoked: Bool
|
||||
do {
|
||||
if let api {
|
||||
let _: NativeEmpty = try await api.request("/auth/logout", method: "POST", as: NativeEmpty.self)
|
||||
}
|
||||
revoked = true
|
||||
} catch { revoked = false }
|
||||
await api?.close()
|
||||
clearLoadedData()
|
||||
try vault?.clear()
|
||||
if let address = try? ServerAddress(server), let storage = vault {
|
||||
api = try NativeAPI(server: address, saved: nil, persist: storage.save)
|
||||
}
|
||||
if !revoked { error = "Lokal abgemeldet. Die Abmeldung auf dem Server konnte nicht bestätigt werden." }
|
||||
}
|
||||
}
|
||||
|
||||
func forget() async {
|
||||
guard !busy else { return }
|
||||
busy = true
|
||||
defer { busy = false }
|
||||
generation += 1
|
||||
await api?.close()
|
||||
clearLoadedData()
|
||||
do { try vault?.clear() } catch {
|
||||
self.error = NativeAPIError.unavailable.errorDescription
|
||||
return
|
||||
}
|
||||
api = nil
|
||||
vault = nil
|
||||
server = ""
|
||||
appName = "Yuvomi"
|
||||
setup = false
|
||||
passwordAllowed = true
|
||||
oidc = false
|
||||
error = nil
|
||||
UserDefaults.standard.removeObject(forKey: "native-origin")
|
||||
}
|
||||
|
||||
private func clearLoadedData() {
|
||||
user = nil
|
||||
permissions = nil
|
||||
dashboard = nil
|
||||
tasks = []
|
||||
notes = []
|
||||
lists = []
|
||||
items = []
|
||||
selectedList = nil
|
||||
page = .home
|
||||
twoFactor = false
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
|
||||
struct ServerAddress: Equatable {
|
||||
struct ServerAddress: Equatable, Sendable {
|
||||
let url: URL
|
||||
|
||||
init(_ input: String) throws {
|
||||
|
||||
@@ -3,6 +3,6 @@ import SwiftUI
|
||||
@main
|
||||
struct YuvomiApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup { ContentView() }
|
||||
WindowGroup { NativeRootView() }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import XCTest
|
||||
|
||||
@testable import Yuvomi
|
||||
|
||||
final class NativeContractsTests: XCTestCase {
|
||||
private func decode<T: Decodable>(_ type: T.Type, _ json: String) throws -> T {
|
||||
let decoder = JSONDecoder()
|
||||
decoder.keyDecodingStrategy = .convertFromSnakeCase
|
||||
return try decoder.decode(type, from: Data(json.utf8))
|
||||
}
|
||||
|
||||
func testSparsePermissionsPreserveReadAndHiddenStates() throws {
|
||||
let permissions = try decode(
|
||||
NativePermissions.self,
|
||||
#"{"admin":false,"modules":{"tasks":"read","notes":"none"},"widgets":{"shopping":"none"}}"#)
|
||||
XCTAssertEqual(permissions.access("tasks"), "read")
|
||||
XCTAssertEqual(permissions.access("notes"), "none")
|
||||
XCTAssertEqual(permissions.access("shopping"), "write")
|
||||
XCTAssertFalse(permissions.showsWidget("shopping"))
|
||||
}
|
||||
|
||||
func testTwoFactorResponseDoesNotInventSignedInUser() throws {
|
||||
let identity = try decode(NativeIdentity.self, #"{"twoFactorRequired":true,"recoveryAvailable":true}"#)
|
||||
XCTAssertEqual(identity.twoFactorRequired, true)
|
||||
XCTAssertNil(identity.user)
|
||||
XCTAssertNil(identity.permissions)
|
||||
}
|
||||
|
||||
func testTaskFieldsMatchActualServerContract() throws {
|
||||
let task = try decode(
|
||||
NativeTask.self,
|
||||
#"{"id":17,"title":"Native task","description":null,"status":"open","priority":"high","due_date":"2026-10-21","category":"general","recurrence_rule":"FREQ=DAILY"}"#
|
||||
)
|
||||
XCTAssertEqual(task.id, 17)
|
||||
XCTAssertEqual(task.dueDate, "2026-10-21")
|
||||
XCTAssertNil(task.description)
|
||||
}
|
||||
|
||||
func testShoppingUsesServerCounterNames() throws {
|
||||
let list = try decode(NativeShoppingList.self, #"{"id":3,"name":"Einkauf","item_total":8,"item_checked":2}"#)
|
||||
XCTAssertEqual(list.itemTotal, 8)
|
||||
XCTAssertEqual(list.itemChecked, 2)
|
||||
XCTAssertNil(list.openCount)
|
||||
}
|
||||
|
||||
func testDashboardUnavailableCountsStayUnknown() throws {
|
||||
let dashboard = try decode(
|
||||
NativeDashboard.self,
|
||||
#"{"openTaskCount":null,"shoppingOpenCount":0,"urgentTasks":[],"upcomingEvents":[],"shoppingLists":[],"pinnedNotes":[]}"#
|
||||
)
|
||||
XCTAssertNil(dashboard.openTaskCount)
|
||||
XCTAssertEqual(dashboard.shoppingOpenCount, 0)
|
||||
}
|
||||
|
||||
func testMutationEncodingPreservesNullAndNumericFlags() throws {
|
||||
let body: [String: NativeValue] = ["due_date": .null, "is_checked": .number(1), "title": .string("Native")]
|
||||
let json = try XCTUnwrap(JSONSerialization.jsonObject(with: JSONEncoder().encode(body)) as? [String: Any])
|
||||
XCTAssertTrue(json["due_date"] is NSNull)
|
||||
XCTAssertEqual(json["is_checked"] as? Int, 1)
|
||||
XCTAssertEqual(json["title"] as? String, "Native")
|
||||
}
|
||||
|
||||
func testRejectsBooleanWhereServerUsesIntegerState() {
|
||||
XCTAssertThrowsError(try decode(NativeShoppingItem.self, #"{"id":1,"name":"Apfel","is_checked":true}"#))
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testNativeTransportRejectsNonAPIPathsBeforeNetwork() async throws {
|
||||
let api = try NativeAPI(server: ServerAddress("https://example.invalid"), saved: nil, persist: { _ in })
|
||||
for path in ["https://evil.invalid", "//evil.invalid", "/path#fragment", "/path\\escape"] {
|
||||
do {
|
||||
let _: NativeEmpty = try await api.request(path, as: NativeEmpty.self)
|
||||
XCTFail("Invalid path accepted")
|
||||
} catch NativeAPIError.invalidPath {}
|
||||
}
|
||||
await api.close()
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testClosedTransportCannotReuseAnOldSession() async throws {
|
||||
let api = try NativeAPI(server: ServerAddress("https://example.invalid"), saved: nil, persist: { _ in })
|
||||
await api.close()
|
||||
do {
|
||||
let _: NativeEmpty = try await api.request("/auth/me", as: NativeEmpty.self)
|
||||
XCTFail("Closed session accepted a request")
|
||||
} catch NativeAPIError.closed {}
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,13 @@ final class OnboardingTests: XCTestCase {
|
||||
func testRejectsCleartextWithoutNetwork() {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
let field = app.textFields["Yuvomi server URL"]
|
||||
let field = app.textFields["server-url"]
|
||||
XCTAssertTrue(field.waitForExistence(timeout: 5))
|
||||
field.tap()
|
||||
field.typeText("http://family.example")
|
||||
app.buttons["Connect securely"].tap()
|
||||
XCTAssertTrue(app.staticTexts["connectionError"].waitForExistence(timeout: 3))
|
||||
app.buttons["connect"].tap()
|
||||
XCTAssertTrue(app.staticTexts["invalid-server"].waitForExistence(timeout: 3))
|
||||
XCTAssertTrue(field.exists)
|
||||
XCTAssertEqual(app.webViews.count, 0)
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -6,8 +6,8 @@ options:
|
||||
settings:
|
||||
base:
|
||||
SWIFT_VERSION: "5.0"
|
||||
MARKETING_VERSION: "0.1.0"
|
||||
CURRENT_PROJECT_VERSION: 1
|
||||
MARKETING_VERSION: "0.2.0"
|
||||
CURRENT_PROJECT_VERSION: 2
|
||||
CODE_SIGN_STYLE: Automatic
|
||||
DEVELOPMENT_TEAM: ""
|
||||
ENABLE_USER_SCRIPT_SANDBOXING: YES
|
||||
@@ -42,7 +42,7 @@ targets:
|
||||
TARGETED_DEVICE_FAMILY: "1,2"
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
|
||||
dependencies:
|
||||
- sdk: WebKit.framework
|
||||
- sdk: Security.framework
|
||||
YuvomiTests:
|
||||
type: bundle.unit-test
|
||||
platform: iOS
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Superseded WebView prototype
|
||||
|
||||
These files are retained as historical reference, not shipped application code.
|
||||
The Android browser tests in `legacy/android/tests` and Apple BrowserModel tests
|
||||
describe this prototype, not native feature parity.
|
||||
Android now selects the explicitly named native test source directories instead.
|
||||
Do not restore a WebView as the application surface or count old browser tests as
|
||||
native-client validation.
|
||||
@@ -0,0 +1,16 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class BlobOriginsTest {
|
||||
@Test fun blobDownloadsCannotCrossOriginsOrDowngradeTls() {
|
||||
val server = ServerAddress.parse("https://family.example")
|
||||
assertTrue(BlobTransfer.owns(server, "blob:https://family.example/unique-id"))
|
||||
listOf(
|
||||
"blob:https://evil.example/id", "blob:http://family.example/id",
|
||||
"blob:https://family.example.evil.test/id", "data:text/plain,hi",
|
||||
).forEach { assertFalse(it, BlobTransfer.owns(server, it)) }
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,689 @@
|
||||
package community.yuvomi.mobile
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.net.http.SslError
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.MediaStore
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.GeolocationPermissions
|
||||
import android.webkit.PermissionRequest
|
||||
import android.webkit.RenderProcessGoneDetail
|
||||
import android.webkit.SslErrorHandler
|
||||
import android.webkit.URLUtil
|
||||
import android.webkit.ValueCallback
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebResourceError
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebResourceResponse
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebStorage
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.ScrollView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.webkit.WebStorageCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private var worker = Executors.newSingleThreadExecutor()
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val preferences by lazy { getSharedPreferences("server", MODE_PRIVATE) }
|
||||
private var server: ServerAddress? = null
|
||||
private var web: WebView? = null
|
||||
private var authDialog: AlertDialog? = null
|
||||
private lateinit var root: LinearLayout
|
||||
private lateinit var content: FrameLayout
|
||||
private lateinit var progress: ProgressBar
|
||||
private var fileCallback: ValueCallback<Array<Uri>>? = null
|
||||
private var capture: Uri? = null
|
||||
private var pendingDownload: String? = null
|
||||
private var generation = 0
|
||||
private val uploadSelection = SelectionGate()
|
||||
private val downloadSelection = SelectionGate()
|
||||
private val loadTimeout =
|
||||
Runnable { showError("The server is taking too long. Check your connection or try again.") }
|
||||
private val localNetworkPermission =
|
||||
registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
|
||||
if (granted) {
|
||||
toast("Private-network access allowed. Retry your server connection.")
|
||||
} else {
|
||||
toast("Private-network access was not granted. Public HTTPS servers can still be used.")
|
||||
}
|
||||
}
|
||||
|
||||
private val picker =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||
val accepted = uploadSelection.consume(generation)
|
||||
val callback = fileCallback
|
||||
fileCallback = null
|
||||
val uris = if (!accepted || result.resultCode != RESULT_OK) {
|
||||
null
|
||||
} else {
|
||||
val data = result.data
|
||||
data?.clipData?.let { clip ->
|
||||
Array(clip.itemCount.coerceAtMost(50)) { clip.getItemAt(it).uri }
|
||||
}
|
||||
?: data?.data?.let { arrayOf(it) } ?: capture?.let { arrayOf(it) }
|
||||
}
|
||||
callback?.onReceiveValue(uris?.filter { it.scheme == "content" }?.toTypedArray())
|
||||
revokeCapture()
|
||||
capture = null
|
||||
}
|
||||
private val saveDocument =
|
||||
registerForActivityResult(
|
||||
ActivityResultContracts.CreateDocument("application/octet-stream"),
|
||||
) { destination ->
|
||||
val accepted = downloadSelection.consume(generation)
|
||||
val url = pendingDownload
|
||||
pendingDownload = null
|
||||
if (!accepted) return@registerForActivityResult
|
||||
val current = server
|
||||
if (destination != null && url != null && current != null &&
|
||||
BlobTransfer.owns(current, url)
|
||||
) {
|
||||
val view = web ?: return@registerForActivityResult
|
||||
val epoch = generation
|
||||
BlobTransfer.save(
|
||||
current,
|
||||
view,
|
||||
url,
|
||||
contentResolver,
|
||||
destination,
|
||||
worker,
|
||||
{ !isDestroyed && epoch == generation },
|
||||
) { success ->
|
||||
if (!success) runCatching { contentResolver.delete(destination, null, null) }
|
||||
if (!isDestroyed &&
|
||||
epoch == generation
|
||||
) {
|
||||
toast(
|
||||
if (success) "Export saved" else "Export failed or exceeded the 25 MB limit.",
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if (destination != null && url != null && current != null && current.owns(url)) {
|
||||
val cookies = CookieManager.getInstance().getCookie(url)
|
||||
val epoch = generation
|
||||
worker.execute {
|
||||
val success = runCatching {
|
||||
FileTransfer.save(current, url, cookies, contentResolver, destination)
|
||||
}.isSuccess
|
||||
if (!success) runCatching { contentResolver.delete(destination, null, null) }
|
||||
runOnUiThread {
|
||||
if (!isDestroyed && epoch == generation) {
|
||||
if (success) {
|
||||
toast("Download saved")
|
||||
} else {
|
||||
toast(
|
||||
"Download failed. Check your connection and sign-in, then retry.",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (savedInstanceState?.getBoolean("uploadOutstanding") == true) uploadSelection.restoreOutstanding()
|
||||
if (savedInstanceState?.getBoolean("downloadOutstanding") == true) downloadSelection.restoreOutstanding()
|
||||
// Household data is hidden from screenshots and the recent-apps preview.
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
WebView.setWebContentsDebuggingEnabled(false)
|
||||
root = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL }
|
||||
ViewCompat.setOnApplyWindowInsetsListener(root) { view, insets ->
|
||||
val bars = insets.getInsets(
|
||||
WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime(),
|
||||
)
|
||||
view.setPadding(bars.left, bars.top, bars.right, bars.bottom)
|
||||
insets
|
||||
}
|
||||
setContentView(root)
|
||||
onBackPressedDispatcher.addCallback(
|
||||
this,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (web?.canGoBack() == true) {
|
||||
web?.goBack()
|
||||
} else if (web != null) {
|
||||
moveTaskToBack(true)
|
||||
} else {
|
||||
isEnabled = false
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
File(cacheDir, "captures").listFiles()?.filter {
|
||||
it.lastModified() <
|
||||
System.currentTimeMillis() - 86_400_000
|
||||
}
|
||||
?.forEach { it.delete() }
|
||||
server =
|
||||
preferences.getString("origin", null)?.let {
|
||||
runCatching { ServerAddress.parse(it) }.getOrNull()
|
||||
}
|
||||
if (server == null) onboarding() else browser()
|
||||
}
|
||||
|
||||
private fun column(): LinearLayout = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setPadding(dp(24), dp(20), dp(24), dp(20))
|
||||
}
|
||||
private fun text(value: String, size: Float = 17f) = TextView(this).apply {
|
||||
text = value
|
||||
textSize = size
|
||||
setPadding(0, dp(8), 0, dp(8))
|
||||
}
|
||||
private fun button(label: String, action: () -> Unit) = Button(this).apply {
|
||||
text = label
|
||||
isAllCaps = false
|
||||
minHeight = dp(48)
|
||||
setOnClickListener { action() }
|
||||
}
|
||||
private fun dp(value: Int) = (value * resources.displayMetrics.density).toInt()
|
||||
|
||||
private fun onboarding() {
|
||||
root.removeAllViews()
|
||||
val form = column()
|
||||
form.addView(text("Your home, connected", 30f))
|
||||
form.addView(
|
||||
text("Connect to your own Yuvomi server. Your data stays with your household."),
|
||||
)
|
||||
val address = EditText(this).apply {
|
||||
hint = "https://family.example.com"
|
||||
inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_URI
|
||||
setSingleLine(true)
|
||||
contentDescription = "Yuvomi server URL"
|
||||
setText(server?.origin.orEmpty())
|
||||
id = View.generateViewId()
|
||||
}
|
||||
val label =
|
||||
text("HTTPS required. Custom ports supported. Use a dedicated hostname, not a subpath.")
|
||||
label.accessibilityLiveRegion = View.ACCESSIBILITY_LIVE_REGION_POLITE
|
||||
lateinit var connect: Button
|
||||
connect = button("Connect securely") {
|
||||
val candidate = runCatching { ServerAddress.parse(address.text.toString()) }.getOrElse {
|
||||
address.error = it.message
|
||||
return@button
|
||||
}
|
||||
connect.isEnabled = false
|
||||
address.isEnabled = false
|
||||
label.setText(R.string.checking_server)
|
||||
val epoch = generation
|
||||
worker.execute {
|
||||
val result = runCatching { ServerProbe.check(candidate) }
|
||||
runOnUiThread {
|
||||
if (isDestroyed || epoch != generation) return@runOnUiThread
|
||||
connect.isEnabled = true
|
||||
address.isEnabled = true
|
||||
if (result.isSuccess) {
|
||||
server = candidate
|
||||
preferences.edit {
|
||||
putString("origin", candidate.origin)
|
||||
remove("path")
|
||||
}
|
||||
browser()
|
||||
} else {
|
||||
// Exception details may contain URL parameters; never expose them.
|
||||
label.setText(R.string.probe_failed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
form.addView(address)
|
||||
form.addView(label)
|
||||
localNetworkButton()?.let { form.addView(it) }
|
||||
form.addView(connect)
|
||||
form.addView(
|
||||
text("Independent community app. No telemetry or mandatory cloud service.", 14f),
|
||||
)
|
||||
root.addView(ScrollView(this).apply { addView(form) })
|
||||
}
|
||||
|
||||
private fun browser() {
|
||||
val current = server ?: return onboarding()
|
||||
root.removeAllViews()
|
||||
val toolbar = LinearLayout(this)
|
||||
toolbar.addView(button("Server settings") { settings() })
|
||||
toolbar.addView(
|
||||
button("Share server") {
|
||||
startActivity(
|
||||
Intent.createChooser(
|
||||
Intent(Intent.ACTION_SEND).apply {
|
||||
type = "text/plain"
|
||||
putExtra(Intent.EXTRA_TEXT, current.origin)
|
||||
},
|
||||
"Share server address",
|
||||
),
|
||||
)
|
||||
},
|
||||
)
|
||||
root.addView(toolbar)
|
||||
progress = ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal).apply {
|
||||
contentDescription = "Loading Yuvomi"
|
||||
max = 100
|
||||
}
|
||||
root.addView(progress, LinearLayout.LayoutParams(-1, dp(4)))
|
||||
content = FrameLayout(this)
|
||||
root.addView(content, LinearLayout.LayoutParams(-1, 0, 1f))
|
||||
val view = WebView(this)
|
||||
web = view
|
||||
secure(view)
|
||||
BlobTransfer.install(view, current)
|
||||
CookieManager.getInstance().setAcceptCookie(true)
|
||||
CookieManager.getInstance().setAcceptThirdPartyCookies(view, false)
|
||||
view.webViewClient = object : WebViewClient() {
|
||||
override fun shouldInterceptRequest(v: WebView, request: WebResourceRequest): WebResourceResponse? {
|
||||
if (!current.owns(request.url.toString())) {
|
||||
return WebResourceResponse(
|
||||
"text/plain",
|
||||
"UTF-8",
|
||||
403,
|
||||
"Blocked",
|
||||
emptyMap(),
|
||||
ByteArrayInputStream(ByteArray(0)),
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
override fun shouldOverrideUrlLoading(v: WebView, request: WebResourceRequest): Boolean {
|
||||
val url = request.url.toString()
|
||||
if (current.owns(url)) return false
|
||||
if (request.isForMainFrame) external(url)
|
||||
return true
|
||||
}
|
||||
override fun onPageStarted(v: WebView, url: String, icon: Bitmap?) {
|
||||
if (!current.owns(url)) {
|
||||
v.stopLoading()
|
||||
external(url)
|
||||
return
|
||||
}
|
||||
progress.visibility = View.VISIBLE
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
handler.postDelayed(loadTimeout, 30_000)
|
||||
}
|
||||
override fun onPageFinished(v: WebView, url: String) {
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
progress.visibility = View.GONE
|
||||
CookieManager.getInstance().flush()
|
||||
if (current.owns(url)) {
|
||||
val path = URI(url).rawPath.orEmpty()
|
||||
if (!listOf("auth", "reset", "invite", "login").any {
|
||||
path.contains(it, true)
|
||||
}
|
||||
) {
|
||||
preferences.edit { putString("path", path) }
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onReceivedError(v: WebView, r: WebResourceRequest, e: WebResourceError) {
|
||||
if (r.isForMainFrame) {
|
||||
showError(
|
||||
"Unable to connect. Cached content may still be available. Check your network or VPN.",
|
||||
)
|
||||
}
|
||||
}
|
||||
override fun onReceivedHttpError(v: WebView, r: WebResourceRequest, e: WebResourceResponse) {
|
||||
if (r.isForMainFrame &&
|
||||
e.statusCode >= 400
|
||||
) {
|
||||
showError("The server is unavailable (HTTP ${e.statusCode}).")
|
||||
}
|
||||
}
|
||||
override fun onReceivedSslError(v: WebView, h: SslErrorHandler, e: SslError) {
|
||||
h.cancel()
|
||||
showError(
|
||||
"The server certificate could not be verified. Contact your server administrator.",
|
||||
)
|
||||
}
|
||||
override fun onRenderProcessGone(v: WebView, detail: RenderProcessGoneDetail): Boolean {
|
||||
releaseWeb()
|
||||
browser()
|
||||
toast("Yuvomi recovered after a browser interruption.")
|
||||
return true
|
||||
}
|
||||
}
|
||||
view.webChromeClient = object : WebChromeClient() {
|
||||
override fun onProgressChanged(v: WebView, value: Int) {
|
||||
progress.progress = value
|
||||
}
|
||||
override fun onPermissionRequest(request: PermissionRequest) {
|
||||
request.deny()
|
||||
}
|
||||
override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) {
|
||||
callback.invoke(origin, false, false)
|
||||
}
|
||||
override fun onShowFileChooser(v: WebView, callback: ValueCallback<Array<Uri>>, params: FileChooserParams): Boolean {
|
||||
if (!current.owns(v.url.orEmpty())) return false
|
||||
if (!uploadSelection.begin(generation)) {
|
||||
callback.onReceiveValue(null)
|
||||
toast("Finish or cancel the existing system file picker first.")
|
||||
return true
|
||||
}
|
||||
fileCallback?.onReceiveValue(null)
|
||||
fileCallback = callback
|
||||
runCatching {
|
||||
val types = params.acceptTypes.filter {
|
||||
it.matches(Regex("[a-zA-Z0-9.+*-]+/[a-zA-Z0-9.+*-]+"))
|
||||
}
|
||||
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
type = types.singleOrNull() ?: "*/*"
|
||||
if (types.size > 1) putExtra(Intent.EXTRA_MIME_TYPES, types.toTypedArray())
|
||||
putExtra(
|
||||
Intent.EXTRA_ALLOW_MULTIPLE,
|
||||
params.mode == FileChooserParams.MODE_OPEN_MULTIPLE,
|
||||
)
|
||||
}
|
||||
val chooser = Intent.createChooser(intent, "Select a file")
|
||||
if (types.any { it.startsWith("image/") }) {
|
||||
val directory = File(cacheDir, "captures").apply { mkdirs() }
|
||||
capture =
|
||||
FileProvider.getUriForFile(
|
||||
this@MainActivity,
|
||||
"$packageName.files",
|
||||
File.createTempFile("capture-", ".jpg", directory),
|
||||
)
|
||||
chooser.putExtra(
|
||||
Intent.EXTRA_INITIAL_INTENTS,
|
||||
arrayOf(
|
||||
Intent(MediaStore.ACTION_IMAGE_CAPTURE).apply {
|
||||
putExtra(MediaStore.EXTRA_OUTPUT, capture)
|
||||
clipData =
|
||||
android.content.ClipData.newRawUri("Yuvomi photo", capture)
|
||||
addFlags(
|
||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION,
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
picker.launch(chooser)
|
||||
}.onFailure {
|
||||
uploadSelection.consume(generation)
|
||||
fileCallback?.onReceiveValue(null)
|
||||
fileCallback = null
|
||||
toast("No compatible file picker is available.")
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
view.setDownloadListener { url, _, disposition, mime, _ ->
|
||||
if (!current.owns(url) &&
|
||||
!BlobTransfer.owns(current, url)
|
||||
) {
|
||||
toast("Only downloads from your server are supported.")
|
||||
} else if (pendingDownload == null && downloadSelection.begin(generation)) {
|
||||
pendingDownload = url
|
||||
val name = URLUtil.guessFileName(
|
||||
url,
|
||||
disposition,
|
||||
mime,
|
||||
).replace(Regex("[^a-zA-Z0-9._ -]"), "_").take(120)
|
||||
runCatching { saveDocument.launch(name.ifBlank { "download" }) }.onFailure {
|
||||
downloadSelection.consume(generation)
|
||||
pendingDownload = null
|
||||
toast("No compatible document provider is available.")
|
||||
}
|
||||
}
|
||||
}
|
||||
content.addView(view, FrameLayout.LayoutParams(-1, -1))
|
||||
val path = preferences.getString("path", "/").orEmpty()
|
||||
view.loadUrl(
|
||||
current.origin + if (path.startsWith("/") && !path.startsWith("//")) path else "/",
|
||||
)
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private fun secure(view: WebView) {
|
||||
view.settings.apply {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
allowFileAccess = false
|
||||
allowContentAccess = false
|
||||
mixedContentMode = WebSettings.MIXED_CONTENT_NEVER_ALLOW
|
||||
javaScriptCanOpenWindowsAutomatically = false
|
||||
setSupportMultipleWindows(false)
|
||||
mediaPlaybackRequiresUserGesture = true
|
||||
safeBrowsingEnabled = true
|
||||
setGeolocationEnabled(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun external(value: String) {
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
progress.visibility = View.GONE
|
||||
val uri = runCatching { URI(value) }.getOrNull() ?: return
|
||||
if (uri.scheme != "https" || uri.host.isNullOrBlank() || uri.rawUserInfo != null) {
|
||||
toast("This link type is blocked for your security.")
|
||||
return
|
||||
}
|
||||
AlertDialog.Builder(this).setTitle("Leave your Yuvomi server?")
|
||||
.setMessage(
|
||||
"Destination: ${uri.host}\n\nOpen normal links in your browser. For SSO, use the isolated sign-in window only if you trust this provider. Providers that require a system browser cannot transfer a session back to this app.",
|
||||
)
|
||||
.setPositiveButton("Browser") { _, _ -> openBrowser(value) }
|
||||
.setNeutralButton("Sign-in window") { _, _ -> authentication(value) }
|
||||
.setNegativeButton("Cancel", null).show()
|
||||
}
|
||||
|
||||
private fun authentication(value: String) {
|
||||
if (authDialog != null) return
|
||||
val auth = WebView(this)
|
||||
secure(auth)
|
||||
CookieManager.getInstance().setAcceptThirdPartyCookies(auth, false)
|
||||
auth.webChromeClient = object : WebChromeClient() {
|
||||
override fun onPermissionRequest(request: PermissionRequest) {
|
||||
request.deny()
|
||||
}
|
||||
}
|
||||
auth.webViewClient = object : WebViewClient() {
|
||||
override fun onPageStarted(v: WebView, url: String, favicon: Bitmap?) {
|
||||
authDialog?.setTitle(
|
||||
"Sign in: ${runCatching {
|
||||
URI(url).host
|
||||
}.getOrNull().orEmpty()}",
|
||||
)
|
||||
}
|
||||
override fun shouldOverrideUrlLoading(v: WebView, request: WebResourceRequest): Boolean {
|
||||
val uri = request.url
|
||||
return uri.scheme != "https" || !uri.userInfo.isNullOrEmpty()
|
||||
}
|
||||
override fun onReceivedSslError(v: WebView, h: SslErrorHandler, e: SslError) {
|
||||
h.cancel()
|
||||
}
|
||||
override fun onPageFinished(v: WebView, url: String) {
|
||||
if (server?.owns(url) == true && !URI(url).path.startsWith("/api/")) {
|
||||
CookieManager.getInstance().flush()
|
||||
authDialog?.dismiss()
|
||||
web?.loadUrl(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
authDialog = AlertDialog.Builder(this).setTitle("Isolated web sign-in")
|
||||
.setView(auth).setNegativeButton("Close", null).create().also { dialog ->
|
||||
dialog.setOnDismissListener {
|
||||
auth.stopLoading()
|
||||
auth.removeAllViews()
|
||||
auth.destroy()
|
||||
authDialog = null
|
||||
}
|
||||
dialog.show()
|
||||
dialog.window?.setLayout(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
}
|
||||
auth.loadUrl(value)
|
||||
}
|
||||
|
||||
private fun openBrowser(value: String) {
|
||||
runCatching {
|
||||
startActivity(
|
||||
Intent(Intent.ACTION_VIEW, value.toUri()).addCategory(Intent.CATEGORY_BROWSABLE),
|
||||
)
|
||||
}
|
||||
.onFailure { toast("No browser is available.") }
|
||||
}
|
||||
|
||||
private fun showError(message: String) {
|
||||
if (isDestroyed || web == null) return
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
progress.visibility = View.GONE
|
||||
if (content.childCount > 1) return
|
||||
val panel = column().apply {
|
||||
addView(text("Connection interrupted", 25f))
|
||||
addView(text(message))
|
||||
addView(
|
||||
button("Retry") {
|
||||
content.removeView(this)
|
||||
web?.reload()
|
||||
},
|
||||
)
|
||||
addView(button("Keep viewing") { content.removeView(this) })
|
||||
addView(button("Server settings") { settings() })
|
||||
localNetworkButton()?.let { addView(it) }
|
||||
}
|
||||
val dark =
|
||||
resources.configuration.uiMode and android.content.res.Configuration.UI_MODE_NIGHT_MASK ==
|
||||
android.content.res.Configuration.UI_MODE_NIGHT_YES
|
||||
panel.setBackgroundColor(if (dark) 0xff191816.toInt() else 0xfff5f3ed.toInt())
|
||||
content.addView(panel, FrameLayout.LayoutParams(-1, -1))
|
||||
panel.accessibilityLiveRegion = View.ACCESSIBILITY_LIVE_REGION_POLITE
|
||||
ViewCompat.setAccessibilityPaneTitle(panel, "Connection interrupted")
|
||||
}
|
||||
|
||||
private fun settings() {
|
||||
AlertDialog.Builder(this).setTitle("Server settings")
|
||||
.setMessage(
|
||||
"${server?.origin.orEmpty()}\n\nSwitching servers erases all app cookies, storage and cached household data. Downloads saved outside the app remain. This does not revoke the server session; sign out in Yuvomi first where possible.",
|
||||
)
|
||||
.setPositiveButton("Erase and change server") { _, _ ->
|
||||
generation++
|
||||
worker.shutdownNow()
|
||||
worker = Executors.newSingleThreadExecutor()
|
||||
authDialog?.dismiss()
|
||||
releaseWeb()
|
||||
val captures = File(cacheDir, "captures")
|
||||
val capturesErased = !captures.exists() || captures.listFiles()?.all { !it.exists() || it.delete() } == true
|
||||
if (capturesErased && WebViewFeature.isFeatureSupported(WebViewFeature.DELETE_BROWSING_DATA)) {
|
||||
WebStorageCompat.deleteBrowsingData(WebStorage.getInstance()) {
|
||||
CookieManager.getInstance().removeAllCookies {
|
||||
CookieManager.getInstance().flush()
|
||||
preferences.edit { clear() }
|
||||
server = null
|
||||
onboarding()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Older engines cannot reliably erase CacheStorage/IndexedDB.
|
||||
// OS reset is complete and scoped to this application, but closes it.
|
||||
val reset = getSystemService(
|
||||
android.app.ActivityManager::class.java,
|
||||
).clearApplicationUserData()
|
||||
if (!reset) {
|
||||
toast("Local data could not be erased. Clear this app's storage in Android settings before switching servers.")
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
.setNeutralButton("Open server in browser") { _, _ ->
|
||||
server?.let { openBrowser(it.origin) }
|
||||
}
|
||||
.setNegativeButton("Continue", null).show()
|
||||
}
|
||||
|
||||
private fun localNetworkButton(): Button? {
|
||||
if (android.os.Build.VERSION.SDK_INT < 37 ||
|
||||
checkSelfPermission(android.Manifest.permission.ACCESS_LOCAL_NETWORK) ==
|
||||
android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
return null
|
||||
}
|
||||
return button("Allow private-network servers") {
|
||||
AlertDialog.Builder(this).setTitle("Private server access")
|
||||
.setMessage(
|
||||
"Android requires permission to connect to a Yuvomi server on your local network. The app connects only to your configured server; it does not scan for devices. Public internet servers do not need this permission.",
|
||||
)
|
||||
.setPositiveButton("Continue") { _, _ ->
|
||||
localNetworkPermission.launch(android.Manifest.permission.ACCESS_LOCAL_NETWORK)
|
||||
}
|
||||
.setNegativeButton("Cancel", null).show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun releaseWeb() {
|
||||
handler.removeCallbacks(loadTimeout)
|
||||
fileCallback?.onReceiveValue(null)
|
||||
fileCallback = null
|
||||
pendingDownload = null
|
||||
revokeCapture()
|
||||
capture = null
|
||||
web?.let { view ->
|
||||
BlobTransfer.forget(view)
|
||||
view.stopLoading()
|
||||
(view.parent as? ViewGroup)?.removeView(view)
|
||||
view.removeAllViews()
|
||||
view.destroy()
|
||||
}
|
||||
web = null
|
||||
}
|
||||
private fun revokeCapture() {
|
||||
capture?.let {
|
||||
revokeUriPermission(it, Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||
}
|
||||
}
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
outState.putBoolean("uploadOutstanding", uploadSelection.outstanding)
|
||||
outState.putBoolean("downloadOutstanding", downloadSelection.outstanding)
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
private fun toast(message: String) = Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
||||
override fun onPause() {
|
||||
web?.onPause()
|
||||
CookieManager.getInstance().flush()
|
||||
super.onPause()
|
||||
}
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
web?.onResume()
|
||||
}
|
||||
override fun onDestroy() {
|
||||
generation++
|
||||
authDialog?.dismiss()
|
||||
releaseWeb()
|
||||
worker.shutdownNow()
|
||||
super.onDestroy()
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">Yuvomi Mobile</string>
|
||||
<string name="checking_server">Checking your server…</string>
|
||||
<string name="probe_failed">Cannot verify a compatible Yuvomi server. Check the URL, TLS certificate, VPN, and reverse-proxy access.</string>
|
||||
</resources>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -62,4 +62,8 @@ for workflow in workflows:
|
||||
release = (ROOT / ".gitea/workflows/release.yml").read_text()
|
||||
assert "secrets." not in release and "environment:" not in release, "Gitea signing needs a separately reviewed approval mechanism"
|
||||
assert "NSAllowsArbitraryLoads" not in (ROOT / "ios/project.yml").read_text()
|
||||
for path in list((ROOT / "android/app/src/main/java").rglob("*.kt")) + list((ROOT / "ios/Sources").rglob("*.swift")):
|
||||
assert not re.search(r"android\.webkit\.|import WebKit|\b(?:WKWebView|WebView)\s*\(", path.read_text()), f"Web wrapper in native shipping source: {path}"
|
||||
assert "NativeRootView()" in (ROOT / "ios/Sources/YuvomiApp.swift").read_text()
|
||||
assert "setContent" in (ROOT / "android/app/src/main/java/community/yuvomi/mobile/MainActivity.kt").read_text()
|
||||
print(f"Repository invariants: {len(paths)} source/documentation paths checked.")
|
||||
@@ -23,6 +23,10 @@ def tool(name, *arguments):
|
||||
|
||||
|
||||
release = APP / "outputs/apk/release/app-release-unsigned.apk"
|
||||
configuration = (ROOT / "android/app/build.gradle.kts").read_text()
|
||||
version_name = re.search(r'versionName = "([^"]+)"', configuration).group(1)
|
||||
version_code = re.search(r'versionCode = (\d+)', configuration).group(1)
|
||||
assert "native" in version_name, "Collector expects the native preview, not the archived wrapper"
|
||||
manifest = tool("aapt2", "dump", "xmltree", release, "--file", "AndroidManifest.xml")
|
||||
assert 'package="community.yuvomi.mobile"' in manifest
|
||||
assert re.search(r":allowBackup\([^\n]*=false", manifest)
|
||||
@@ -38,6 +42,9 @@ assert policy.count("E: certificates") == 1 and 'src="system"' in policy
|
||||
(DESTINATION / "release-network-policy.txt").write_text(policy)
|
||||
|
||||
debug = APP / "outputs/apk/debug/app-debug.apk"
|
||||
for apk in [debug, release]:
|
||||
identity = tool("aapt2", "dump", "badging", apk).splitlines()[0]
|
||||
assert f"versionCode='{version_code}'" in identity and f"versionName='{version_name}'" in identity, identity
|
||||
(DESTINATION / "debug-signature.txt").write_text(tool("apksigner", "verify", "--verbose", debug))
|
||||
unsigned = subprocess.run([str(TOOLS / "apksigner"), "verify", str(release)], capture_output=True, text=True)
|
||||
assert unsigned.returncode != 0 and "Missing META-INF/MANIFEST.MF" in unsigned.stderr, unsigned.stderr
|
||||
@@ -61,7 +68,9 @@ dirty = bool(subprocess.check_output(["git", "status", "--porcelain"], cwd=ROOT,
|
||||
(DESTINATION / "build-info.json").write_text(json.dumps({
|
||||
"source_revision": revision, "worktree_dirty_at_collection": dirty,
|
||||
"upstream_revision": "10bfef7686ed7303b4c74c7fcc55a5eb16356c9d",
|
||||
"status": "Development debug APK; unsigned release APK/AAB. Not production-ready.",
|
||||
"version_name": version_name, "version_code": int(version_code),
|
||||
"renderer": "native Jetpack Compose",
|
||||
"status": "Incomplete native preview: development debug APK; unsigned release APK/AAB. No full PWA parity or production approval.",
|
||||
"artifacts": entries,
|
||||
}, indent=2) + "\n")
|
||||
print(f"Inspected and collected {len(entries)} artifacts in {DESTINATION}")
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regressions for AGP screenshot output collection, not visual parity tests."""
|
||||
import base64
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
SPEC = importlib.util.spec_from_file_location("integration", Path(__file__).with_name("test-integration.py"))
|
||||
HARNESS = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(HARNESS)
|
||||
PNG = base64.b64decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jJ1sAAAAASUVORK5CYII=")
|
||||
|
||||
|
||||
class ScreenshotEvidenceTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
base = "/tmp/opencode" if Path("/tmp/opencode").exists() else None
|
||||
self.temporary = tempfile.TemporaryDirectory(prefix="yuvomi-evidence-", dir=base)
|
||||
self.addCleanup(self.temporary.cleanup)
|
||||
self.output = Path(self.temporary.name)
|
||||
self.additional, self.screenshots = HARNESS.prepare_android_screenshots(self.output)
|
||||
|
||||
def fixture(self, device="fixture(AVD) - 15", contents=PNG):
|
||||
image = self.additional / "connected" / device / "native-dashboard.png"
|
||||
image.parent.mkdir(parents=True, exist_ok=True)
|
||||
image.write_bytes(contents)
|
||||
return image
|
||||
|
||||
def test_collects_actual_agp_variant_path_without_adb_or_installed_app(self):
|
||||
image = self.fixture()
|
||||
HARNESS.collect_native_screenshot(self.additional, self.screenshots)
|
||||
self.assertEqual((self.screenshots / image.name).read_bytes(), PNG)
|
||||
self.assertEqual(self.additional.name, "integrationAndroidTest")
|
||||
|
||||
def test_missing_screenshot_is_not_success(self):
|
||||
with self.assertRaisesRegex(AssertionError, "Missing or ambiguous"):
|
||||
HARNESS.collect_native_screenshot(self.additional, self.screenshots)
|
||||
|
||||
def test_rejects_run_as_error_even_when_command_reported_zero_exit(self):
|
||||
self.fixture(contents=b"run-as: unknown package: community.yuvomi.mobile.integration\n")
|
||||
with self.assertRaisesRegex(AssertionError, "Invalid native"):
|
||||
HARNESS.collect_native_screenshot(self.additional, self.screenshots)
|
||||
|
||||
def test_rejects_ambiguous_device_evidence(self):
|
||||
self.fixture("first")
|
||||
self.fixture("second")
|
||||
with self.assertRaisesRegex(AssertionError, "ambiguous"):
|
||||
HARNESS.collect_native_screenshot(self.additional, self.screenshots)
|
||||
|
||||
def test_preparation_removes_only_known_stale_capture(self):
|
||||
image = self.fixture()
|
||||
HARNESS.collect_native_screenshot(self.additional, self.screenshots)
|
||||
unrelated = image.with_name("other-output.txt")
|
||||
unrelated.write_text("preserve")
|
||||
HARNESS.prepare_android_screenshots(self.output)
|
||||
self.assertFalse(image.exists())
|
||||
self.assertFalse((self.screenshots / image.name).exists())
|
||||
self.assertEqual(unrelated.read_text(), "preserve")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -22,6 +22,25 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
REVISION = "10bfef7686ed7303b4c74c7fcc55a5eb16356c9d"
|
||||
|
||||
|
||||
def prepare_android_screenshots(app_output):
|
||||
additional = app_output / "connected_android_test_additional_output/integrationAndroidTest"
|
||||
screenshots = app_output / "native-screenshots"
|
||||
# Never accept a previous run's screenshot as current evidence.
|
||||
for stale in additional.rglob("native-dashboard.png"):
|
||||
stale.unlink()
|
||||
(screenshots / "native-dashboard.png").unlink(missing_ok=True)
|
||||
return additional, screenshots
|
||||
|
||||
|
||||
def collect_native_screenshot(additional, screenshots):
|
||||
captures = list(additional.rglob("native-dashboard.png"))
|
||||
assert len(captures) == 1, "Missing or ambiguous native fixture screenshot"
|
||||
capture = captures[0].read_bytes()
|
||||
assert capture.startswith(b"\x89PNG\r\n\x1a\n"), "Invalid native fixture screenshot"
|
||||
screenshots.mkdir(parents=True, exist_ok=True)
|
||||
(screenshots / "native-dashboard.png").write_bytes(capture)
|
||||
|
||||
|
||||
def run(upstream, android):
|
||||
revision = subprocess.check_output(["git", "-C", str(upstream), "rev-parse", "HEAD"], text=True).strip()
|
||||
assert revision == REVISION, f"Expected pinned upstream {REVISION}, got {revision}"
|
||||
@@ -120,18 +139,19 @@ def run(upstream, android):
|
||||
subprocess.run([str(adb), "reverse", f"tcp:{port}", f"tcp:{port}"], check=True)
|
||||
subprocess.run([str(adb), "reverse", f"tcp:{ready['idpPort']}", f"tcp:{ready['idpPort']}"], check=True)
|
||||
try:
|
||||
app_output = (Path(env["YUVOMI_BUILD_DIR"]) / "app" if "YUVOMI_BUILD_DIR" in env
|
||||
else ROOT / "android/app/build") / "outputs"
|
||||
additional, screenshots = prepare_android_screenshots(app_output)
|
||||
# The ephemeral password is passed through the local test runner only,
|
||||
# never written into a source file or printed by this harness.
|
||||
result = subprocess.run(["bash", str(ROOT / "android/gradlew"), "-p", str(ROOT / "android"),
|
||||
"-Pintegration", "connectedIntegrationAndroidTest"], env=env, check=False)
|
||||
if result.returncode:
|
||||
raise RuntimeError("Android integration tests failed. Inspect the Gradle test report.")
|
||||
output = Path(env.get("YUVOMI_BUILD_DIR", ROOT / "android"))
|
||||
reports = output / "app/outputs/androidTest-results/connected/integration"
|
||||
if "YUVOMI_BUILD_DIR" not in env:
|
||||
reports = ROOT / "android/app/build/outputs/androidTest-results/connected/integration"
|
||||
reports = app_output / "androidTest-results/connected/integration"
|
||||
subprocess.run(["python3", str(ROOT / "scripts/verify-test-results.py"),
|
||||
str(reports), "--minimum", "7"], check=True)
|
||||
collect_native_screenshot(additional, screenshots)
|
||||
finally:
|
||||
subprocess.run([str(adb), "reverse", "--remove", f"tcp:{port}"], check=False)
|
||||
subprocess.run([str(adb), "reverse", "--remove", f"tcp:{ready['idpPort']}"], check=False)
|
||||
|
||||
Reference in new issue
Block a user