diff --git a/.agents/skills/android-ui-visual-review/SKILL.md b/.agents/skills/android-ui-visual-review/SKILL.md new file mode 100644 index 00000000..5468f120 --- /dev/null +++ b/.agents/skills/android-ui-visual-review/SKILL.md @@ -0,0 +1,255 @@ +--- +name: android-ui-visual-review +description: Analyze an Android pull request, branch, commit, or patch for user-visible changes and produce reproducible before/after screenshots from isolated builds. Use this skill whenever a user asks for PR screenshots, branch UI comparisons, visual regression evidence, Compose before/after captures, populated message-state screenshots, responsive/theme/locale comparisons, or GitHub comments containing Android UI evidence—even if they only say “show me what changed.” Also use it to determine and document that a suspected UI PR has no visual delta. Do not use it for implementing a new UI, ordinary code review without visual evidence, or physical mesh validation. +compatibility: Requires git, the Android SDK and emulator, adb, Java/Gradle, Python 3, and gh for pull-request resolution or publishing. +--- + +# Android UI Visual Review + +Turn a PR or branch into trustworthy visual evidence. The comparison is useful +only when the before and after builds use the correct commits, Android runtime, +viewport, app state, and navigation path. + +## Collect the two user choices + +Before starting, resolve: + +1. **Target** — a PR URL/number or a branch/commit. If it is missing, ask for it. + For a branch, also ask for the intended base when it cannot be inferred + safely; otherwise default to the repository's `main`. +2. **Publishing** — for a PR target, ask whether the final screenshots and + findings should stay local or be posted as a PR comment. Do not perform any + GitHub write unless the user explicitly chooses publishing. A prior explicit + request such as “post these to the PR” already answers this question. + +Do not block on publishing preference while doing read-only analysis if the user +has not answered yet. Keep the local workflow useful on its own. + +## Read the routed guidance + +- Read [references/analysis-playbook.md](references/analysis-playbook.md) for + every run. It explains how to map a diff to screens, states, and a capture + matrix. +- Read [references/fixture-recipes.md](references/fixture-recipes.md) whenever + the affected screen needs messages, peers, channels, nicknames, settings, + permissions, locale, theme, onboarding state, or another non-empty fixture. +- Read [references/github-publishing.md](references/github-publishing.md) only + when the user has opted into a PR comment. + +## Create an isolated review session + +Never switch the user's active checkout between before and after revisions. +Run from the repository root: + +```sh +.agents/skills/android-ui-visual-review/scripts/create_review_worktree.sh \ + --target "" +``` + +For a branch with a non-default base: + +```sh +.agents/skills/android-ui-visual-review/scripts/create_review_worktree.sh \ + --target "" \ + --base "" +``` + +The script fetches a PR head when needed, computes the **actual merge-base**, +creates a detached temporary worktree at the before SHA, and prints: + +- session directory +- worktree path +- artifact directory +- before and after SHAs +- PR number/base metadata when applicable + +Keep artifacts outside the worktree so checkouts cannot remove them. The script +may symlink the ignored `local.properties` into the temporary worktree; never +publish it or quote its contents. + +If a review session already exists and its SHAs are verified, reuse it. Do not +create a second worktree for the same run. + +## Establish the visual contract + +Use the actual diff, not the PR title, to determine what should be visible. + +1. Record `git diff --stat`, `--name-status`, and the focused diff between the + before and after SHAs. +2. Trace changed UI symbols to their composable/activity, state source, entry + point, and prerequisites. +3. Separate direct visual changes from indirect ones such as dynamic color, + locale recreation, launcher resources, default data, or backend state shown + by an otherwise unchanged screen. +4. Produce a local capture matrix before building. Each row should define: + screen, navigation path, fixture, logical width, theme, locale, permissions, + and what difference is expected. +5. Include a control state where the UI should remain unchanged when that helps + distinguish intentional degradation from a regression. + +When the diff contains no UI/resource/state-to-UI change, say so. If the user +asked for a screenshot for every target, capture the nearest affected surface +before and after and label the expected result **no visual delta**. Do not invent +a UI claim for a behavioral fix. + +## Use the newest stable Android runtime + +Prefer an emulator for repeatable UI evidence. At run time: + +1. Inspect installed SDK/system images and current official Android release + information. Choose the newest **stable** API; do not silently use a preview. +2. Create a dedicated AVD and isolated data directory when possible. If current + command-line tools cannot create a newly versioned image (for example an + extension image), a verified `-sysdir` override with an isolated data + directory is acceptable. +3. After boot, record guest properties rather than trusting the AVD name: + +```sh +adb -s "$ANDROID_REVIEW_SERIAL" shell getprop ro.build.version.release +adb -s "$ANDROID_REVIEW_SERIAL" shell getprop ro.build.version.sdk +adb -s "$ANDROID_REVIEW_SERIAL" shell getprop ro.build.version.security_patch +adb -s "$ANDROID_REVIEW_SERIAL" shell wm size +adb -s "$ANDROID_REVIEW_SERIAL" shell wm density +``` + +Use an explicit emulator serial for every ADB command when any physical device +is also connected. Never put serials, device names, local paths, IP addresses, +or other machine identifiers into reports or GitHub comments. + +Use a physical device only when the affected UI depends on hardware that the +emulator cannot reproduce. Ask before changing or clearing a physical device. +This skill does not replace Mesh Lab: if the diff changes mesh, transport, +crypto, service, or physical peer behavior, use the `mesh-lab` skill separately +before claiming the behavior works. + +## Build and capture the before state + +The worktree starts at the before SHA. + +1. Build the debug APK with `./gradlew assembleDebug`. +2. Install the ABI-matching APK with `adb install -r`. +3. Complete stable prerequisites such as onboarding and permissions. +4. Apply the fixture from the capture matrix. +5. Navigate using semantic/UI-automator evidence where possible. Use coordinate + taps only after inspecting the current screen, and keep coordinates local. +6. Capture every matrix row with a descriptive name: + +```text +before----.png +``` + +Use `adb exec-out screencap -p` so the PNG is written directly to the artifact +directory. Inspect every screenshot immediately; a successful command is not +proof that the intended screen was visible. + +## Build and capture the after state + +Before switching commits: + +- Preserve the artifact directory outside the worktree. +- Preserve only intentional app state. +- Record any temporary debug fixture patch. + +Checkout the recorded after SHA in the detached worktree, reapply the same +debug-only fixture if needed, build, and install with `-r` when state +preservation is part of the comparison. + +Replay the same navigation and capture matrix. Name files with the matching +`after-` prefix. If reinstalling cannot preserve the state, replay the fixture +from its recorded inputs rather than comparing different states. + +For responsive captures, record logical width in dp. On a fixed-pixel emulator, +changing density is acceptable when the calculation is documented: + +```text +density = physical_width_px × 160 / desired_width_dp +``` + +Restore the original density/theme/locale after the matrix is complete. + +## Use deterministic artificial data + +Prefer existing debug hooks. When they cannot express the visual state, add the +smallest temporary command to +`app/src/debug/java/com/bitchat/android/testhook/TestHookDriver.kt`. + +The fixture must: + +- stay under `src/debug` +- use synthetic names/content and deterministic IDs +- use the current mesh peer ID for self-authored messages so alignment logic is + exercised correctly +- use a fixed fixture epoch passed to both builds +- return structured success data through the existing test-hook result file +- be logically identical in before and after builds + +After the final capture, remove the temporary fixture with a focused patch and +verify that the review worktree has no tracked modifications. Never commit or +publish the fixture unless the user separately asks to productize it. + +## Validate and report + +Create `capture-manifest.json` in the artifact directory using +[assets/capture-manifest.example.json](assets/capture-manifest.example.json) as +the shape. Use paths relative to the manifest and omit device selectors and +local absolute paths. + +Validate it: + +```sh +python3 \ + .agents/skills/android-ui-visual-review/scripts/validate_capture_manifest.py \ + "/capture-manifest.json" +``` + +Write a Markdown report next to the manifest with: + +- target and exact before/after SHAs +- verified Android release/API/security patch and viewport +- concise code analysis +- visual findings, including intentional non-changes +- side-by-side before/after tables +- fixture disclosure +- limitations and any hardware behavior not exercised + +End the local run only after: + +- every manifest image exists and is a valid PNG +- each before/after pair has matching pixel dimensions +- every screenshot has been visually inspected +- the worktree has no tracked fixture changes +- the user's original checkout remains untouched + +Leave the review session and artifacts available for later inspection unless +the user asks for cleanup. + +## Optionally publish to the PR + +Only after explicit user approval, follow +[references/github-publishing.md](references/github-publishing.md). + +The PR comment should contain: + +- Android capture environment +- detected visual changes +- clear before/after labels +- all requested screenshots +- limitations such as “no visual delta” or “hardware race not reproduced” + +Use `gh` for all GitHub reads and writes. Verify the posted comment by reading it +back and counting the expected image embeds. Do not expose local paths or +machine identifiers, do not override Git author/committer identity, and do not +push screenshot files to a source branch unless the user separately authorizes +that repository change. + +## Final handoff + +Give the user: + +- report and artifact links +- screenshot count +- one-line result per surface +- PR comment URL when published +- explicit statement that the original checkout was not modified +- any remaining coverage limitation + diff --git a/.agents/skills/android-ui-visual-review/assets/capture-manifest.example.json b/.agents/skills/android-ui-visual-review/assets/capture-manifest.example.json new file mode 100644 index 00000000..3d8c48d3 --- /dev/null +++ b/.agents/skills/android-ui-visual-review/assets/capture-manifest.example.json @@ -0,0 +1,32 @@ +{ + "target": "PR #000 or branch-name", + "before_sha": "40-character merge-base SHA", + "after_sha": "40-character target SHA", + "environment": { + "android_release": "stable release number", + "android_sdk": "API number", + "security_patch": "YYYY-MM-DD", + "resolution_px": "1080x1920", + "default_density_dpi": 420 + }, + "captures": [ + { + "id": "surface-state-411dp-light", + "surface": "Human-readable surface", + "state": "Synthetic fixture and navigation state", + "expected_change": "Specific visual hypothesis", + "before": "before-surface-state-411dp-light.png", + "after": "after-surface-state-411dp-light.png" + } + ], + "extras": [ + { + "id": "after-expanded-menu", + "role": "after-detail", + "file": "after-expanded-menu.png" + } + ], + "limitations": [ + "Static screenshots do not prove hardware behavior." + ] +} diff --git a/.agents/skills/android-ui-visual-review/assets/pr-comment-template.md b/.agents/skills/android-ui-visual-review/assets/pr-comment-template.md new file mode 100644 index 00000000..5aa9219d --- /dev/null +++ b/.agents/skills/android-ui-visual-review/assets/pr-comment-template.md @@ -0,0 +1,20 @@ + +## Android UI verification + +Captured from clean before/after debug builds on **Android ANDROID_RELEASE +(API ANDROID_SDK)**. The before build is this target's actual merge-base. + +### Visual changes detected + +- FINDING_ONE +- FINDING_TWO +- LIMITATION_OR_INTENTIONAL_NON_CHANGE + +### SURFACE_OR_STATE + +| Before | After | +|---|---| +| ![Before: ACCESSIBLE_DESCRIPTION](BEFORE_IMAGE_URL) | ![After: ACCESSIBLE_DESCRIPTION](AFTER_IMAGE_URL) | + +Fixture disclosure: FIXTURE_DESCRIPTION_OR_NONE. + diff --git a/.agents/skills/android-ui-visual-review/evals/evals.json b/.agents/skills/android-ui-visual-review/evals/evals.json new file mode 100644 index 00000000..d617b71b --- /dev/null +++ b/.agents/skills/android-ui-visual-review/evals/evals.json @@ -0,0 +1,41 @@ +{ + "skill_name": "android-ui-visual-review", + "evals": [ + { + "id": 1, + "prompt": "Review PR #813 and make before/after screenshots of its Android UI changes. Keep everything local; do not comment on GitHub.", + "expected_output": "The agent creates an isolated worktree, compares the PR head with its actual merge-base, discovers the header width thresholds, captures a wide control plus the changed compact widths on the newest stable Android emulator, and produces a validated local report without any GitHub write.", + "files": [], + "expectations": [ + "Uses the actual PR merge-base rather than current main or head~1.", + "Creates a capture matrix that includes a wide control and every changed width threshold.", + "Populates joined-channel state so the conditional count is visible before testing degradation.", + "Keeps artifacts local and performs no GitHub write." + ] + }, + { + "id": 2, + "prompt": "Compare branch feature/message-redesign against main. The empty chat will not show the change, so give me populated light and dark screenshots and also show any fresh-install nickname change.", + "expected_output": "The agent traces message rendering and nickname generation, adds a temporary deterministic debug-only fixture with received/self short/wrapped messages, applies equivalent state to both builds, captures light/dark and fresh nickname states, removes the fixture, and validates paired PNGs.", + "files": [], + "expectations": [ + "Uses synthetic deterministic messages with the real local peer ID for self classification.", + "Uses one fixed fixture epoch and identical logical data in both builds.", + "Captures both light and dark populated message states plus the fresh nickname state.", + "Removes temporary debug fixture changes before handoff." + ] + }, + { + "id": 3, + "prompt": "This hotspot PR looks UI-related, but inspect it rather than assuming. Capture before/after and, after you show the evidence, post the screenshots and findings to the PR.", + "expected_output": "The agent determines whether the diff actually changes UI, captures the nearest affected hotspot surface even if equality is expected, labels behavioral limitations, asks or recognizes explicit publishing authorization, uploads safe screenshots without a source branch, posts through gh, and verifies the comment.", + "files": [], + "expectations": [ + "Does not invent a visual delta when the diff is backend-only.", + "Labels the screenshots as an expected no-visual-change comparison.", + "Does not claim that a static screenshot proves the hotspot ownership race.", + "Posts only after explicit authorization and verifies image count and comment URL." + ] + } + ] +} diff --git a/.agents/skills/android-ui-visual-review/references/analysis-playbook.md b/.agents/skills/android-ui-visual-review/references/analysis-playbook.md new file mode 100644 index 00000000..c70c6b59 --- /dev/null +++ b/.agents/skills/android-ui-visual-review/references/analysis-playbook.md @@ -0,0 +1,152 @@ +# Diff-to-screen analysis playbook + +Use this reference to turn a code diff into a minimal but complete screenshot +matrix. + +## Resolve the correct comparison + +For a PR, “before” is the merge-base of the fetched PR head and its configured +base branch. It is not necessarily the PR's current `baseRefOid`, the local +`main`, or the commit immediately preceding the head. + +For a branch or commit, confirm the intended base. Compute the merge-base after +fetching both sides. + +Record both SHAs before any checkout. Build each SHA rather than attempting to +reverse selected files on a single build. + +## Triage the diff in layers + +Start broad: + +```sh +git diff --stat "$BEFORE_SHA" "$AFTER_SHA" +git diff --name-status "$BEFORE_SHA" "$AFTER_SHA" +git diff "$BEFORE_SHA" "$AFTER_SHA" -- app/src/main app/src/debug +``` + +Then classify changed files. + +| Diff area | Likely visual impact | +|---|---| +| `ui/*.kt`, composables, modifiers, layouts | Direct screen/layout change | +| `ui/theme/*`, colors, shapes, typography | Cross-screen theme change | +| `res/values*`, drawables, mipmaps | Text, locale, icon, launcher, or palette | +| Manifest locale/theme/activity metadata | System or activity presentation | +| `DataManager`, preferences, defaults | Fresh-install/default-state change | +| `AppStateStore`, ViewModel/state flows | UI changes only after specific state | +| Service/transport/backend only | Usually no static UI delta; trace exposed state | +| `src/debug` or Android tests | Fixture/test mechanism, not production UI | + +Do not stop at filenames. Search every changed public symbol and resource: + +```sh +rg -n "" app/src +``` + +Trace in both directions: + +- Who calls or renders this code? +- Which state branch selects it? +- What user action reaches it? +- What permissions, onboarding, peers, channels, messages, theme, locale, or + width are required? +- Does the change affect an empty screen, only populated state, or both? + +## Repository UI surface map + +These are orientation points, not a substitute for inspecting the current +revision: + +| Surface | Starting points | +|---|---| +| App launch/navigation/permissions | `MainActivity.kt`, `ui/ChatScreen.kt` | +| Top bar, nickname, peer/channel/location controls | `ui/ChatHeader.kt` | +| Message rows, bubbles, timestamps, media | `ui/MessageComponents.kt` | +| App state consumed by Compose | `services/AppStateStore.kt`, ViewModels | +| Default nickname/preferences | `ui/DataManager.kt` | +| About and Settings | `ui/AboutSheet.kt` | +| Location/geohash/channel controls | `ui/LocationChannelsSheet.kt` | +| Hotspot UI | `hotspot/HotspotActivity.kt` | +| Dynamic/fallback colors and shapes | `ui/theme/Theme.kt`, `ThemePreference.kt` | +| Debug ADB hooks | `src/debug/.../testhook/TestHookReceiver.kt`, `TestHookDriver.kt` | + +Files and packages can move. Use `rg --files` and symbol search to re-establish +the current map at the target commits. + +## Identify indirect UI changes + +Some visual changes appear far away from the edited function: + +- A nickname generator change is visible only after deleting or bypassing a + saved nickname. +- A Material You change appears only on Android 12+ and depends on the emulator + wallpaper/system palette. +- Locale selection may recreate the Activity and return to a different tab. +- A launcher background is not visible inside the running Activity. +- Message delivery status may appear only for self-authored private messages. +- A width policy may be invisible at the default device width. +- A backend ownership fix may produce no screenshot difference at all. + +Write these as explicit hypotheses before capture. Each hypothesis needs either +a matrix row or a documented reason it cannot be shown statically. + +## Build the capture matrix + +Keep the matrix small enough to review but large enough to hit every changed +branch. + +| Field | What to record | +|---|---| +| Surface | Human-readable screen/component | +| Entry path | Actions from launch to the target | +| Fixture | Messages, peer, channel, setting, or empty state | +| Platform | Android API feature needed, such as dynamic color | +| Width | Logical dp breakpoint | +| Theme | System/light/dark | +| Locale | System/default or selected locale | +| Expected before | Specific visual contract | +| Expected after | Specific visual contract | +| Control | State expected not to change, when useful | + +Examples: + +- Header crowding: 411 dp control, 380 dp middle breakpoint, 320 dp compact + breakpoint, with a joined channel so the count is actually present. +- Message bubbles: identical short/long received and self messages in light and + dark modes. +- Nickname prefix: fresh generated nickname in each build; explain that random + digits differ. +- Language picker: Settings before, Settings after, expanded menu, and one live + selection. +- Backend-only hotspot fix: the nearest hotspot surface before/after, explicitly + expecting equality. + +## Distinguish visual proof from behavioral proof + +A static screenshot can prove rendering, layout, labels, selected state, and +visible recreation. It cannot prove: + +- foreign Wi-Fi group ownership +- BLE/Wi-Fi discovery or delivery +- Noise/identity correctness +- race avoidance +- background lifecycle behavior +- accessibility announcement content without an accessibility inspection + +Name those limitations. Use relevant unit/instrumented tests or the repository's +Mesh Lab workflow separately. + +## Compare carefully + +Treat these as expected noise unless the PR changes them: + +- status-bar clock +- battery/network indicator +- random nickname suffix +- dynamic palette when system wallpaper differs +- asynchronous peer counts +- animation frame + +Stabilize or disclose the noise. Never describe it as a PR effect. + diff --git a/.agents/skills/android-ui-visual-review/references/fixture-recipes.md b/.agents/skills/android-ui-visual-review/references/fixture-recipes.md new file mode 100644 index 00000000..bfe82cbc --- /dev/null +++ b/.agents/skills/android-ui-visual-review/references/fixture-recipes.md @@ -0,0 +1,209 @@ +# Deterministic UI fixture recipes + +Read current code before applying any recipe. These patterns intentionally use +the debug-only test-hook path and should be adapted to the APIs present at both +comparison SHAs. + +## Fixture principles + +1. Exercise the UI's real state classification. A self message must carry the + peer identity that production code uses to decide `isSelf`; changing only the + displayed sender nickname can produce a false layout. +2. Use the same logical records in both builds: stable IDs, sender IDs, content, + ordering, and one fixed epoch. +3. Keep content synthetic and review-safe. Do not use real messages, contacts, + peer IDs, channel memberships, device information, or locations. +4. Return structured success data and verify it before capturing. +5. Keep additions under `app/src/debug`; remove them after capture. + +## Prefer the existing test hook + +Inspect: + +- `app/src/debug/java/com/bitchat/android/testhook/TestHookReceiver.kt` +- `app/src/debug/java/com/bitchat/android/testhook/TestHookDriver.kt` +- `app/src/debug/AndroidManifest.xml` + +The receiver accepts: + +```sh +adb -s "$ANDROID_REVIEW_SERIAL" shell am broadcast \ + -n com.bitchat.droid/com.bitchat.android.testhook.TestHookReceiver \ + -a com.bitchat.droid.TEST_HOOK \ + --es cmd "" \ + --es id "" +``` + +Read the result rather than trusting broadcast delivery: + +```sh +adb -s "$ANDROID_REVIEW_SERIAL" shell run-as com.bitchat.droid \ + cat "cache/testhook/results/.json" +``` + +Existing commands such as `set_nickname`, `broadcast_msg`, and state inspection +may already be sufficient. + +## Public message fixture + +When existing commands cannot create both received and self messages without a +second device, add a temporary `ui_fixture` command to `TestHookDriver`. + +Adapt imports and constructor fields to the checked-out revision. The core shape +is: + +```kotlin +private fun uiFixture(context: Context, intent: Intent): JSONObject { + val mesh = mesh(context) + val nickname = AppStateStore.nickname.value + .ifBlank { DataManager(context).loadNickname() } + val epochMs = intent.getLongExtra("fixture_epoch_ms", 1_800_000_000_000L) + + listOf( + BitchatMessage( + id = "ui-fixture-received-short", + sender = "mara", + content = "Are you seeing this?", + timestamp = Date(epochMs), + senderPeerID = "ui-fixture-peer", + ), + BitchatMessage( + id = "ui-fixture-received-wrap", + sender = "mara", + content = "The mesh stays readable even when a message wraps onto a second line.", + timestamp = Date(epochMs + 60_000), + senderPeerID = "ui-fixture-peer", + ), + BitchatMessage( + id = "ui-fixture-self-short", + sender = nickname, + content = "Yep — testing the message layout.", + timestamp = Date(epochMs + 120_000), + senderPeerID = mesh.myPeerID, + ), + BitchatMessage( + id = "ui-fixture-self-wrap", + sender = nickname, + content = "Short and long bubbles should align consistently.", + timestamp = Date(epochMs + 180_000), + senderPeerID = mesh.myPeerID, + ), + ).forEach(AppStateStore::addPublicMessage) + + return ok("ui_fixture") + .put("messages", 4) + .put("fixture_epoch_ms", epochMs) +} +``` + +Why these details matter: + +- received/self exercises both alignment branches +- short/wrapped content exercises intrinsic and capped width +- fixed IDs defeat accidental duplication +- a fixed epoch makes before/after timestamps comparable +- `mesh.myPeerID` exercises the real self-classification path + +If `AppStateStore` moved packages or the message constructor changed, adapt only +the debug fixture. Do not modify production state logic to accommodate it. + +App state is process-local. Launch the Activity before injection, inject after +the process is ready, and capture without force-stopping it. + +## Private-message and delivery-status fixture + +To inspect private-message bubbles or status placement: + +- set the selected private peer in `AppStateStore` +- add messages using `addPrivateMessage` +- use the current local peer ID for self messages +- populate the delivery status explicitly when the changed component reads it +- mark read state consistently + +Use a synthetic conversation ID such as `ui-fixture-private-peer`. Avoid writing +to persistent conversation storage unless persistence itself is being reviewed. +If persistence cannot be bypassed safely, use a unique deterministic fixture +conversation and disclose it in the report. + +## Fresh default nickname + +A saved preference hides generator changes. Add a temporary command that removes +only the nickname preference, invokes the revision's real generator, and updates +the in-memory store: + +```kotlin +private fun resetNicknameFixture(context: Context): JSONObject { + context.getSharedPreferences("bitchat_prefs", Context.MODE_PRIVATE) + .edit() + .remove("nickname") + .commit() + val nickname = DataManager(context).loadNickname() + AppStateStore.setNickname(nickname) + return ok("reset_nickname_fixture").put("nickname", nickname) +} +``` + +First inspect `DataManager` to confirm the preference file/key. Do not use this +recipe blindly after storage migrations. + +Random suffixes are expected to differ. Compare the changed prefix/pattern, not +the digits. Do not seed or replace the production generator merely to make the +screenshot deterministic. + +## Channel/header state + +Responsive header screenshots need every conditional item present. + +- Join a synthetic channel such as `#review` through the normal UI or existing + debug state API. +- Confirm the joined count is visible at the control width before changing + density. +- Keep the same nickname, channel, peer count, and location state in both builds. +- Capture a wide control and every threshold changed by the diff. + +Do not use a real geohash/location. Synthetic channel state is enough for header +crowding unless the actual geohash label is the feature under review. + +## Theme and dynamic color + +- Force light and dark through `adb shell cmd uimode night no|yes`. +- Record the system wallpaper/palette only as anonymous environment context. +- Keep the same emulator data directory between builds so Material You input is + identical. +- Capture both themes when theme code, containers, surfaces, or contrast changes. +- Restore the original mode after capture. + +## Locale + +Use the new in-app picker when that is the feature. Capture: + +1. Settings before +2. Settings with the new row +3. expanded picker +4. one live language selection + +Locale application may recreate the Activity and reset the selected tab. This is +expected; navigate again rather than assuming the selection failed. Restore +System default after capture. + +## Onboarding and permissions + +Complete onboarding/permissions once in the before build, then use `adb install +-r` for after when signatures and data schemas are compatible. + +If state cannot be preserved, record and replay each action. Do not clear all app +data merely to change one preference. Never run `pm clear` on a physical device +without explicit authorization. + +## Remove the fixture + +Use a focused patch to remove only additions made for capture. Then check: + +```sh +git diff -- app/src/debug +git status --short +``` + +The finished worktree may contain untracked artifacts only when artifacts were +intentionally stored there. It must not contain tracked fixture changes. + diff --git a/.agents/skills/android-ui-visual-review/references/github-publishing.md b/.agents/skills/android-ui-visual-review/references/github-publishing.md new file mode 100644 index 00000000..5eacd2e0 --- /dev/null +++ b/.agents/skills/android-ui-visual-review/references/github-publishing.md @@ -0,0 +1,97 @@ +# Publishing screenshots to a pull request + +Follow this only after the user explicitly opts into a GitHub comment. + +## Prepare a safe comment + +The comment should contain: + +- a unique hidden marker for idempotent verification +- verified Android release/API +- statement that before is the target's actual merge-base +- concise visual findings +- paired before/after image tables +- fixture disclosure when artificial state was used +- limitations and intentional non-changes + +Do not include: + +- local paths or usernames +- ADB serials, device names, peer IDs, addresses, or IPs +- real messages, contacts, locations, or account information +- build logs +- claims about physical behavior that screenshots do not prove + +Scan the body locally for machine paths and selectors before posting. +Use [../assets/pr-comment-template.md](../assets/pr-comment-template.md) as the +starting structure, replacing every uppercase placeholder and adding one table +per comparison state. + +## Upload image bytes without changing a source branch + +Native `gh pr comment` accepts Markdown but not binary files. This skill bundles +an uploader that uses `gh api` to place images on a PR-scoped custom Git ref: + +```sh +python3 \ + .agents/skills/android-ui-visual-review/scripts/upload_pr_images.py \ + --repo OWNER/REPO \ + --pr NUMBER \ + +``` + +The helper: + +- uploads only image bytes and basenames +- writes to `refs/uploads/issues/`, outside `refs/heads/*` +- does not pass an author or committer override +- prints JSON containing stable GitHub blob URLs +- does not post a comment + +This is a GitHub repository write even though it does not create a visible +branch. The user's approval to publish the screenshots authorizes this +PR-scoped storage. If repository policy rejects custom refs, use an authenticated +GitHub web attachment composer or ask the user for an approved image host. Do +not fall back to a source branch without separate authorization. + +Use `--dry-run` first when validating new inputs: + +```sh +python3 \ + .agents/skills/android-ui-visual-review/scripts/upload_pr_images.py \ + --dry-run \ + --repo OWNER/REPO \ + --pr NUMBER \ + +``` + +## Post through gh + +Build the final Markdown body with the returned URLs. Keep before and after in +the same table row. Put extra after-state details, such as an expanded menu, in +a separate labeled table. + +Post once: + +```sh +gh pr comment NUMBER \ + --repo OWNER/REPO \ + --body-file "" +``` + +Record the returned comment URL. + +## Verify the side effect + +Read the comment back using `gh api` or `gh pr view`. Verify: + +- the unique marker is present +- image embed count equals the requested screenshot count +- no local paths or identifiers were included +- the returned URL belongs to the intended PR + +If the posting command's outcome is ambiguous, query for the marker before +retrying. Do not create duplicate comments. + +Report the comment URL to the user. Leave the PR-scoped image ref in place while +the comment depends on it; deleting the ref can eventually break the images. diff --git a/.agents/skills/android-ui-visual-review/scripts/create_review_worktree.sh b/.agents/skills/android-ui-visual-review/scripts/create_review_worktree.sh new file mode 100755 index 00000000..e0cdb4d8 --- /dev/null +++ b/.agents/skills/android-ui-visual-review/scripts/create_review_worktree.sh @@ -0,0 +1,201 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'EOF' +Create an isolated Android UI review worktree. + +Usage: + create_review_worktree.sh --target [options] + +Options: + --base Base for a branch/commit target (default: main) + --repo-root Repository root (default: current repository) + -h, --help Show this help + +The script never removes an existing worktree. It prints and writes session.env +with the before/after SHAs and artifact paths. +EOF +} + +target="" +base_ref="" +repo_root="." + +while [[ $# -gt 0 ]]; do + case "$1" in + --target) + target="${2:-}" + shift 2 + ;; + --base) + base_ref="${2:-}" + shift 2 + ;; + --repo-root) + repo_root="${2:-}" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "error: unknown argument: $1" >&2 + usage >&2 + exit 2 + ;; + esac +done + +if [[ -z "$target" ]]; then + echo "error: --target is required" >&2 + exit 2 +fi +if [[ "$target" == -* || "$base_ref" == -* ]]; then + echo "error: target and base refs cannot begin with '-'" >&2 + exit 2 +fi + +repo_root="$(git -C "$repo_root" rev-parse --show-toplevel)" +cd "$repo_root" + +target_kind="ref" +pr_number="" +base_name="" +head_ref="" + +if [[ "$target" =~ ^[0-9]+$ ]]; then + target_kind="pr" + pr_number="${BASH_REMATCH[0]}" +elif [[ "$target" =~ ^https://github\.com/([^/]+)/([^/]+)/pull/([0-9]+)/?$ ]]; then + target_kind="pr" + pr_number="${BASH_REMATCH[3]}" + url_repo="${BASH_REMATCH[1]}/${BASH_REMATCH[2]}" + current_repo="$(gh repo view --json nameWithOwner --jq .nameWithOwner)" + if [[ "${url_repo,,}" != "${current_repo,,}" ]]; then + echo "error: PR URL targets $url_repo but this checkout is $current_repo" >&2 + exit 2 + fi +fi + +resolve_target_ref() { + local ref="$1" + local resolved="" + + if git show-ref --verify --quiet "refs/heads/${ref}"; then + git rev-parse --verify "refs/heads/${ref}^{commit}" + return + fi + + if [[ "$ref" == refs/* || "$ref" == *"~"* || "$ref" == *"^"* ]] && + resolved="$(git rev-parse --verify "${ref}^{commit}" 2>/dev/null)"; then + printf '%s\n' "$resolved" + return + fi + + if git check-ref-format --branch "$ref" >/dev/null 2>&1; then + if git fetch origin "$ref" >/dev/null 2>&1; then + git rev-parse --verify 'FETCH_HEAD^{commit}' + return + fi + fi + + if resolved="$(git rev-parse --verify "${ref}^{commit}" 2>/dev/null)"; then + printf '%s\n' "$resolved" + return + fi + + echo "error: cannot resolve ref: $ref" >&2 + return 1 +} + +resolve_base_ref() { + local ref="$1" + local resolved="" + + if git check-ref-format --branch "$ref" >/dev/null 2>&1; then + if git fetch origin "$ref" >/dev/null 2>&1; then + git rev-parse --verify 'FETCH_HEAD^{commit}' + return + fi + fi + + if resolved="$(git rev-parse --verify "${ref}^{commit}" 2>/dev/null)"; then + printf '%s\n' "$resolved" + return + fi + + echo "error: cannot resolve base ref: $ref" >&2 + return 1 +} + +if [[ "$target_kind" == "pr" ]]; then + repo_slug="$(gh repo view --json nameWithOwner --jq .nameWithOwner)" + pr_data="$(gh pr view "$pr_number" --repo "$repo_slug" \ + --json baseRefName,headRefOid \ + --jq '"\(.baseRefName) \(.headRefOid)"')" + read -r base_name reported_head_sha <<<"$pr_data" + + head_ref="refs/pr-visual-review/pull/${pr_number}/head" + git fetch origin "+pull/${pr_number}/head:${head_ref}" + git fetch origin "+refs/heads/${base_name}:refs/remotes/origin/${base_name}" + + after_sha="$(git rev-parse --verify "${head_ref}^{commit}")" + if [[ "$after_sha" != "$reported_head_sha" ]]; then + latest_reported_head="$(gh pr view "$pr_number" --repo "$repo_slug" \ + --json headRefOid --jq .headRefOid)" + if [[ "$after_sha" != "$latest_reported_head" ]]; then + echo "error: PR head changed while resolving; rerun for a consistent target" >&2 + exit 1 + fi + fi + + base_sha="$(git rev-parse --verify "refs/remotes/origin/${base_name}^{commit}")" +else + after_sha="$(resolve_target_ref "$target")" + base_name="${base_ref:-main}" + base_sha="$(resolve_base_ref "$base_name")" +fi + +before_sha="$(git merge-base "$base_sha" "$after_sha")" +if [[ -z "$before_sha" ]]; then + echo "error: no merge-base found between $base_name and $target" >&2 + exit 1 +fi + +session_dir="$(mktemp -d /tmp/bitchat-ui-review.XXXXXX)" +worktree_path="${session_dir}/worktree" +artifact_dir="${session_dir}/artifacts" +mkdir -p "$artifact_dir" + +git worktree add --detach "$worktree_path" "$before_sha" + +if [[ -f "${repo_root}/local.properties" && ! -e "${worktree_path}/local.properties" ]]; then + ln -s "${repo_root}/local.properties" "${worktree_path}/local.properties" +fi + +session_env="${session_dir}/session.env" +{ + printf 'SESSION_DIR=%q\n' "$session_dir" + printf 'WORKTREE_PATH=%q\n' "$worktree_path" + printf 'ARTIFACT_DIR=%q\n' "$artifact_dir" + printf 'SOURCE_REPO_ROOT=%q\n' "$repo_root" + printf 'TARGET_KIND=%q\n' "$target_kind" + printf 'TARGET_INPUT=%q\n' "$target" + printf 'BASE_NAME=%q\n' "$base_name" + printf 'BEFORE_SHA=%q\n' "$before_sha" + printf 'AFTER_SHA=%q\n' "$after_sha" + printf 'PR_NUMBER=%q\n' "$pr_number" +} > "$session_env" + +printf 'SESSION_DIR=%s\n' "$session_dir" +printf 'WORKTREE_PATH=%s\n' "$worktree_path" +printf 'ARTIFACT_DIR=%s\n' "$artifact_dir" +printf 'BEFORE_SHA=%s\n' "$before_sha" +printf 'AFTER_SHA=%s\n' "$after_sha" +printf 'TARGET_KIND=%s\n' "$target_kind" +if [[ -n "$pr_number" ]]; then + printf 'PR_NUMBER=%s\n' "$pr_number" +fi +printf 'SESSION_ENV=%s\n' "$session_env" diff --git a/.agents/skills/android-ui-visual-review/scripts/upload_pr_images.py b/.agents/skills/android-ui-visual-review/scripts/upload_pr_images.py new file mode 100755 index 00000000..3289e7bc --- /dev/null +++ b/.agents/skills/android-ui-visual-review/scripts/upload_pr_images.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python3 +"""Upload PR screenshots through gh api without modifying a source branch.""" + +from __future__ import annotations + +import argparse +import base64 +import json +import re +import subprocess +import sys +from pathlib import Path +from urllib.parse import quote + +REPO_RE = re.compile(r"^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$") + + +def gh_api( + endpoint: str, + *, + method: str = "GET", + payload: dict[str, object] | None = None, + allow_not_found: bool = False, +) -> dict[str, object] | None: + command = ["gh", "api"] + if method != "GET": + command.extend(["-X", method]) + command.append(endpoint) + input_text = None + if payload is not None: + command.extend(["--input", "-"]) + input_text = json.dumps(payload) + + result = subprocess.run( + command, + input=input_text, + text=True, + capture_output=True, + check=False, + ) + if result.returncode != 0: + if allow_not_found and "HTTP 404" in result.stderr: + return None + raise RuntimeError(result.stderr.strip() or f"gh api failed for {endpoint}") + if not result.stdout.strip(): + return {} + parsed = json.loads(result.stdout) + if not isinstance(parsed, dict): + raise RuntimeError(f"unexpected gh api response for {endpoint}") + return parsed + + +def validate_files(paths: list[Path]) -> list[tuple[Path, str, int]]: + if not paths: + raise ValueError("at least one image file is required") + files: list[tuple[Path, str, int]] = [] + seen: set[str] = set() + for path in paths: + resolved = path.resolve() + if not resolved.is_file(): + raise ValueError(f"file not found: {path}") + name = resolved.name + if name in seen: + raise ValueError(f"duplicate basename would collide in upload: {name}") + seen.add(name) + if resolved.suffix.lower() not in {".png", ".jpg", ".jpeg", ".webp", ".gif"}: + raise ValueError(f"unsupported image type: {name}") + files.append((resolved, name, resolved.stat().st_size)) + return files + + +def image_markdown(files: list[dict[str, str]]) -> str: + sections: list[str] = [] + for index in range(0, len(files), 2): + pair = files[index : index + 2] + labels = " | ".join(item["name"] for item in pair) + separators = " | ".join("---" for _ in pair) + images = " | ".join( + f'![{item["name"]}]({item["url"]})' for item in pair + ) + sections.append(f"| {labels} |\n| {separators} |\n| {images} |") + return "\n\n".join(sections) + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--repo", required=True, help="OWNER/REPO") + parser.add_argument("--pr", required=True, type=int) + parser.add_argument("--dry-run", action="store_true") + parser.add_argument("files", nargs="+", type=Path) + args = parser.parse_args() + + if not REPO_RE.fullmatch(args.repo): + raise ValueError("--repo must use OWNER/REPO") + if args.pr <= 0: + raise ValueError("--pr must be a positive integer") + files = validate_files(args.files) + + if args.dry_run: + print( + json.dumps( + { + "status": "dry-run", + "repo": args.repo, + "pr": args.pr, + "ref": f"refs/uploads/issues/{args.pr}", + "files": [ + {"name": name, "size": size} for _, name, size in files + ], + }, + indent=2, + ) + ) + return 0 + + api_prefix = f"repos/{args.repo}" + ref_path = f"uploads/issues/{args.pr}" + ref_response = gh_api( + f"{api_prefix}/git/ref/{ref_path}", + allow_not_found=True, + ) + + parent_sha = "" + base_tree_sha = "" + if ref_response is not None: + ref_object = ref_response.get("object") + if not isinstance(ref_object, dict) or not isinstance(ref_object.get("sha"), str): + raise RuntimeError("existing upload ref response did not contain a commit SHA") + parent_sha = str(ref_object["sha"]) + parent_commit = gh_api(f"{api_prefix}/git/commits/{parent_sha}") + tree = parent_commit.get("tree") if parent_commit else None + if not isinstance(tree, dict) or not isinstance(tree.get("sha"), str): + raise RuntimeError("existing upload commit did not contain a tree SHA") + base_tree_sha = str(tree["sha"]) + + entries: list[dict[str, str]] = [] + for path, name, _ in files: + content = base64.b64encode(path.read_bytes()).decode("ascii") + blob = gh_api( + f"{api_prefix}/git/blobs", + method="POST", + payload={"content": content, "encoding": "base64"}, + ) + blob_sha = blob.get("sha") if blob else None + if not isinstance(blob_sha, str): + raise RuntimeError(f"blob upload did not return a SHA for {name}") + entries.append( + {"path": name, "mode": "100644", "type": "blob", "sha": blob_sha} + ) + + tree_payload: dict[str, object] = {"tree": entries} + if base_tree_sha: + tree_payload["base_tree"] = base_tree_sha + tree_response = gh_api( + f"{api_prefix}/git/trees", + method="POST", + payload=tree_payload, + ) + tree_sha = tree_response.get("sha") if tree_response else None + if not isinstance(tree_sha, str): + raise RuntimeError("tree creation did not return a SHA") + + commit_response = gh_api( + f"{api_prefix}/git/commits", + method="POST", + payload={ + "message": f"Add visual comparison screenshots for PR #{args.pr}", + "tree": tree_sha, + "parents": [parent_sha] if parent_sha else [], + }, + ) + commit_sha = commit_response.get("sha") if commit_response else None + if not isinstance(commit_sha, str): + raise RuntimeError("commit creation did not return a SHA") + + if parent_sha: + gh_api( + f"{api_prefix}/git/refs/{ref_path}", + method="PATCH", + payload={"sha": commit_sha, "force": False}, + ) + else: + gh_api( + f"{api_prefix}/git/refs", + method="POST", + payload={"ref": f"refs/{ref_path}", "sha": commit_sha}, + ) + + uploaded: list[dict[str, str]] = [] + for _, name, _ in files: + url = f"https://github.com/{args.repo}/blob/{commit_sha}/{quote(name)}?raw=true" + uploaded.append({"name": name, "url": url}) + + print( + json.dumps( + { + "status": "ok", + "repo": args.repo, + "pr": args.pr, + "ref": f"refs/{ref_path}", + "sha": commit_sha, + "files": uploaded, + "markdown": image_markdown(uploaded), + }, + indent=2, + ) + ) + return 0 + + +if __name__ == "__main__": + try: + raise SystemExit(main()) + except (OSError, ValueError, RuntimeError, json.JSONDecodeError) as exc: + print(f"error: {exc}", file=sys.stderr) + raise SystemExit(1) + diff --git a/.agents/skills/android-ui-visual-review/scripts/validate_capture_manifest.py b/.agents/skills/android-ui-visual-review/scripts/validate_capture_manifest.py new file mode 100755 index 00000000..6badd0c6 --- /dev/null +++ b/.agents/skills/android-ui-visual-review/scripts/validate_capture_manifest.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python3 +"""Validate a visual-review capture manifest and its PNG evidence.""" + +from __future__ import annotations + +import argparse +import json +import re +import struct +import sys +from pathlib import Path + +PNG_SIGNATURE = b"\x89PNG\r\n\x1a\n" +SHA_RE = re.compile(r"^[0-9a-f]{40}$") + + +def fail(message: str) -> None: + raise ValueError(message) + + +def relative_file(root: Path, value: object, field: str) -> Path: + if not isinstance(value, str) or not value: + fail(f"{field} must be a non-empty relative path") + candidate = Path(value) + if candidate.is_absolute() or ".." in candidate.parts: + fail(f"{field} must stay relative to the artifact directory: {value!r}") + resolved = (root / candidate).resolve() + try: + resolved.relative_to(root.resolve()) + except ValueError as exc: + raise ValueError(f"{field} escapes the artifact directory: {value!r}") from exc + if not resolved.is_file(): + fail(f"{field} does not exist: {value}") + return resolved + + +def png_dimensions(path: Path) -> tuple[int, int]: + with path.open("rb") as handle: + header = handle.read(24) + if len(header) < 24 or header[:8] != PNG_SIGNATURE or header[12:16] != b"IHDR": + fail(f"not a valid PNG with an IHDR header: {path.name}") + width, height = struct.unpack(">II", header[16:24]) + if width <= 0 or height <= 0: + fail(f"invalid PNG dimensions in {path.name}: {width}x{height}") + return width, height + + +def require_string(data: dict[str, object], key: str) -> str: + value = data.get(key) + if not isinstance(value, str) or not value.strip(): + fail(f"{key} must be a non-empty string") + return value + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("manifest", type=Path) + args = parser.parse_args() + + manifest_path = args.manifest.resolve() + if not manifest_path.is_file(): + fail(f"manifest not found: {manifest_path}") + root = manifest_path.parent + + with manifest_path.open(encoding="utf-8") as handle: + data = json.load(handle) + if not isinstance(data, dict): + fail("manifest root must be an object") + + require_string(data, "target") + before_sha = require_string(data, "before_sha") + after_sha = require_string(data, "after_sha") + if not SHA_RE.fullmatch(before_sha) or not SHA_RE.fullmatch(after_sha): + fail("before_sha and after_sha must be lowercase 40-character Git SHAs") + if before_sha == after_sha: + fail("before_sha and after_sha must differ") + + environment = data.get("environment") + if not isinstance(environment, dict): + fail("environment must be an object") + for key in ("android_release", "android_sdk", "security_patch", "resolution_px"): + require_string(environment, key) + density = environment.get("default_density_dpi") + if not isinstance(density, int) or density <= 0: + fail("environment.default_density_dpi must be a positive integer") + + captures = data.get("captures") + if not isinstance(captures, list) or not captures: + fail("captures must contain at least one before/after pair") + + used_paths: set[Path] = set() + pair_summaries: list[dict[str, object]] = [] + seen_ids: set[str] = set() + + for index, item in enumerate(captures): + if not isinstance(item, dict): + fail(f"captures[{index}] must be an object") + capture_id = require_string(item, "id") + if capture_id in seen_ids: + fail(f"duplicate capture id: {capture_id}") + seen_ids.add(capture_id) + require_string(item, "surface") + require_string(item, "state") + require_string(item, "expected_change") + + before_path = relative_file(root, item.get("before"), f"captures[{index}].before") + after_path = relative_file(root, item.get("after"), f"captures[{index}].after") + for path in (before_path, after_path): + if path in used_paths: + fail(f"screenshot reused by multiple manifest entries: {path.name}") + used_paths.add(path) + + before_size = png_dimensions(before_path) + after_size = png_dimensions(after_path) + if before_size != after_size: + fail( + f"{capture_id} dimensions differ: before={before_size[0]}x{before_size[1]}, " + f"after={after_size[0]}x{after_size[1]}" + ) + pair_summaries.append( + { + "id": capture_id, + "width": before_size[0], + "height": before_size[1], + } + ) + + extras = data.get("extras", []) + if not isinstance(extras, list): + fail("extras must be an array") + for index, item in enumerate(extras): + if not isinstance(item, dict): + fail(f"extras[{index}] must be an object") + extra_id = require_string(item, "id") + if extra_id in seen_ids: + fail(f"duplicate capture/extra id: {extra_id}") + seen_ids.add(extra_id) + require_string(item, "role") + path = relative_file(root, item.get("file"), f"extras[{index}].file") + if path in used_paths: + fail(f"screenshot reused by multiple manifest entries: {path.name}") + used_paths.add(path) + png_dimensions(path) + + limitations = data.get("limitations", []) + if not isinstance(limitations, list) or not all( + isinstance(item, str) and item.strip() for item in limitations + ): + fail("limitations must be an array of non-empty strings") + + result = { + "status": "ok", + "pairs": len(captures), + "extras": len(extras), + "png_files": len(used_paths), + "dimensions": pair_summaries, + } + print(json.dumps(result, indent=2)) + return 0 + + +if __name__ == "__main__": + try: + raise SystemExit(main()) + except (OSError, json.JSONDecodeError, ValueError) as exc: + print(f"error: {exc}", file=sys.stderr) + raise SystemExit(1) + diff --git a/.agents/skills/mesh-lab/SKILL.md b/.agents/skills/mesh-lab/SKILL.md new file mode 100644 index 00000000..40e14de3 --- /dev/null +++ b/.agents/skills/mesh-lab/SKILL.md @@ -0,0 +1,224 @@ +--- +name: mesh-lab +description: Run, diagnose, and extend bitchat Android Mesh Lab physical-device tests. Use this skill whenever work capable of changing physical peer behavior touches mesh discovery or routing, BLE or Wi-Fi transport, Noise/crypto/identity, foreground-service or power behavior, public or private messaging, file/media transfer, protocol packets, or fragmentation; whenever a user asks for physical-device validation, ADB test hooks, hardware regression reproduction, or a new Mesh Lab scenario; and before claiming that such changes work on real devices, even if the user does not name Mesh Lab explicitly. Do not use it for docs-only, unit-test-only, or pure UI changes that cannot affect mesh or service behavior. +--- + +# Mesh Lab + +Use the repository's debug-only ADB harness to validate mesh behavior on physical +devices. Treat it as a development integration test, not as the privacy-checked +release gate and not as proof about a release APK. + +## Establish current ground truth + +Run from the repository root. + +Before choosing commands or changing a scenario: + +1. Read the Mesh Lab section of `AGENTS.md`. +2. Read the "mesh lab" appendix in `docs/release-gate-runbook.md`. +3. Use `python3 tools/release_gate/mesh_lab.py --help` and the relevant + subcommand help. +4. Inspect the selected scenario function in `tools/release_gate/mesh_lab.py`; + its current CLI and assertions are authoritative if documentation has drifted. +5. Inspect + `app/src/debug/java/com/bitchat/android/testhook/TestHookDriver.kt` before + using an ad-hoc command, diagnosing hook behavior, or extending coverage. + +Do not infer a physical pass from unit tests, compilation, old evidence, or a +successful local send call. + +## Decide the physical coverage + +Inspect the change or requested behavior first. Select the smallest scenario set +that exercises the affected physical contract, expanding to `all` for broad, +cross-cutting, or release-sensitive changes. + +| Affected behavior | Start with | +|---|---| +| Discovery, connection management, routing, foreground-service lifecycle | `broadcast`, `dm`, `session_recovery` | +| Background, doze, or power-duty-cycle behavior | Existing setup keeps devices awake and foregrounded; add a focused workflow or use the full release gate | +| Wi-Fi Aware or transport-selection behavior | Existing setup enables BLE and does not pin Wi-Fi; add a transport-specific control/assertion or use the full release gate | +| Noise, crypto, authenticated peer state, identity persistence | `dm`, `file_private`, `session_recovery`, `identity_reset` | +| Public messaging or message delivery | `broadcast`, then `dm` if shared routing changed | +| File/media encoding, transfer, fragmentation, admission limits | `file`, `file_private`, `file_oversize` | +| Packet parsing, bridge/routing, TTL, or protocol changes | `raw`, plus a receiving scenario such as `broadcast` or `dm` | +| Broad mesh or transport refactor | `all` | +| UI-only work with no service, state, or delivery effect | Usually no Mesh Lab run; explain why | + +When the selected scenarios do not exercise the new contract, add a focused +scenario instead of treating unrelated green tests as coverage. + +## Protect devices and evidence + +Mesh Lab setup is destructive to the app's local data. It force-stops the app, +clears package data, regenerates identity, cycles Bluetooth, grants permissions, +and changes wake/lock-screen timeout settings without restoring them. + +- Use only designated disposable lab app data and deterministic test content. +- Use two authorized physical Android BLE devices on API 26 or newer. Emulators + do not exercise the required BLE mesh behavior. +- Before `setup`, `identity_reset`, or `all`, confirm that the selected devices + may have bitchat app data cleared. `identity_reset` clears device B even when + setup was skipped. If the user has not already established authorization, ask. +- Never attempt to defeat a secure lock screen. Ask the operator to unlock it. +- Keep every device unlocked, awake, foregrounded, and preferably charging. +- Treat ADB selectors as ephemeral secrets. Do not put serials, device names, + peer IDs, addresses, fingerprints, local home paths, or raw logcat in commits, + pull requests, issues, or published artifacts. +- Write raw evidence under `/tmp`, keep it local, and never commit it. Failure + evidence can include unsanitized logcat and lab identifiers. +- Use debug APKs only. The exported test-hook receiver intentionally has no + production security boundary and must never be moved into `src/main`. +- Use an authorized, controlled lab area. After setup, inspect peer state + locally and stop if an unexpected peer is present before sending broadcasts, + files, or raw packets. +- On a non-dedicated device, record the prior Bluetooth, stay-awake, screen + timeout, and lock-screen-disabled settings locally. Restore only those + recorded values after the run, or tell the operator exactly what remains + changed. + +If the hardware, operator confirmation, or prerequisites are unavailable, +report the physical result as `blocked (not run)` and provide the exact handoff +command. Never soften this to "pass" or "probably works." + +## Run a two-phone batch + +Preflight the environment without copying device selectors into durable output: + +```sh +python3 --version +adb devices +./gradlew assembleDebug +``` + +Set up the disposable pair: + +```sh +python3 tools/release_gate/mesh_lab.py setup \ + --serial-a "$MESH_SERIAL_A" \ + --serial-b "$MESH_SERIAL_B" \ + --apk app/build/outputs/apk/debug/app-arm64-v8a-debug.apk +``` + +Build and pass the current-tree debug APK during normal use. If setup +intentionally omits `--apk`, first verify on both devices that the installed +package is debuggable via `run-as` and that its package dump contains +`TestHookReceiver`; do this before any command that clears data. + +Inspect `peers` on both devices after setup. Continue only when every discovered +participant belongs to the controlled lab. + +Run either the selected scenario or the full suite. Run this entire block in one +shell invocation so the temporary-directory variable cannot disappear between +agent shell calls. Abort the block if the directory is empty or missing before +passing it to `--out`; otherwise an empty path can put private evidence in the +repository. Replace `dm` with +`all` only when full-suite data clearing has been authorized. + +```sh +MESH_EVIDENCE_DIR="$(mktemp -d /tmp/meshlab-evidence.XXXXXX)" +if [ -z "$MESH_EVIDENCE_DIR" ] || [ ! -d "$MESH_EVIDENCE_DIR" ]; then + echo "mktemp failed; aborting so evidence cannot land in the repository" >&2 + exit 1 +fi +chmod 700 "$MESH_EVIDENCE_DIR" + +python3 tools/release_gate/mesh_lab.py scenario dm \ + --serial-a "$MESH_SERIAL_A" \ + --serial-b "$MESH_SERIAL_B" \ + --out "$MESH_EVIDENCE_DIR" +``` + +Rerun `setup` before a fresh scenario batch when prior churn, stale identities, +or zombie GATT links could contaminate the result. + +Keep the private evidence only as long as the active investigation needs it. +Do not delete failure evidence that the user still needs; when it is no longer +needed, remove it or move it to an explicitly approved protected location. + +## Interpret results precisely + +- `dm`, `broadcast`, `file`, and `file_private` include receiver-side assertions. +- `file` and `file_private` currently validate a 1 KB deterministic fixture and + SHA-256 integrity, not sustained or boundary-sized transfer performance. +- `file_oversize` validates sender rejection and receiver absence for a 512 KB + broadcast, not the exact 256/257-fragment boundary. +- `raw` proves that the local transport bridge accepted the injected packet. It + does not prove that another device received or accepted it. +- `session_recovery` proves recoverability after process death, but may fall + back to an explicit handshake; it does not prove a fully automatic recovery. +- `identity_reset` proves new-identity recovery after `pm clear`; stale state for + the old identity is diagnostic evidence rather than a purge assertion. +- The current CLI drives exactly two phones. It does not validate a three-hop + topology, transport-specific Wi-Fi Aware behavior, permission denial, doze, + endurance, resource bounds, transfer cancellation, release builds, or + cross-client compatibility. +- For ad-hoc commands, `status: ok` can mean the command completed without + satisfying the requested state. Inspect fields such as `reached_min_peers`, + `direct`, `established`, or `cancelled`. +- `all` runs scenarios sequentially on evolving device state. In the current + runner it writes combined evidence only, and a failed sub-scenario can abort + aggregation without clean structured evidence. Run selected scenarios + individually first when durable per-scenario evidence matters, then use + `all` as broader regression coverage. + +A scenario exits zero on pass and non-zero on failure. On failure, preserve the +local evidence, inspect its error first, then use state dumps and filtered logcat: + +```sh +python3 tools/release_gate/mesh_lab.py cmd \ + --serial "$MESH_SERIAL_A" state + +adb -s "$MESH_SERIAL_A" logcat -d -t 200 -s \ + TestHook MessageHandler FragmentManager BitchatFilePacket +``` + +Common first checks are screen/foreground state, mutual discovery, direct-peer +state, Noise session state, and stale Bluetooth connections. Rerun `setup` only +after preserving useful diagnostics. + +The generic `cmd --extra` wrapper does not encode every Android extra type +correctly: Boolean `enabled` and integer `min_peers`/`ttl` are notable cases. +Use a direct `adb shell am broadcast` with `--ez` or `--ei`, after reading the +driver, when exact types matter. Use the top-level `--timeout-ms 30000` option +for command timeouts; never pass `--extra timeout_ms=...`, because it duplicates +the runner's `timeout_ms` keyword and fails before dispatch. + +## Add a physical-device scenario + +Prefer extending `tools/release_gate/mesh_lab.py` with existing hook commands. +Add or change an Android hook only when the public mesh API cannot express the +required action or observation. + +Design the scenario around an observable remote contract: + +1. Generate a unique token or deterministic fixture so stale state cannot pass. +2. Start the receiver wait before sending. +3. Assert remote sender identity, content, session state, digest, or expected + absence—not merely that the sender accepted a call. +4. Use bounded timeouts and return structured JSON evidence. +5. For negative tests, assert both the expected sender error and that the + receiver did not observe the artifact. +6. Keep hook code and manifest registration under `src/debug`. +7. Update the runbook scenario table and troubleshooting guidance. +8. Run the new scenario individually, then run relevant neighboring scenarios + or `all` to detect state contamination. + +Do not add test-only branches to production mesh code merely to make a scenario +easy to drive. + +## Report the outcome + +End with a compact physical-test report: + +- Change or contract tested +- Device topology: logical roles only, such as phone A to phone B +- Build and scenario names +- Result: `pass`, `fail`, or `blocked (not run)` +- Local evidence directory, clearly marked private and uncommitted +- On failure: the exact violated invariant and the next diagnostic +- Coverage limits and any scenario fallback that weakens the claim + +Keep device selectors and raw evidence out of the report, commit, and pull +request. diff --git a/.agents/skills/mesh-lab/evals/evals.json b/.agents/skills/mesh-lab/evals/evals.json new file mode 100644 index 00000000..eb44aeed --- /dev/null +++ b/.agents/skills/mesh-lab/evals/evals.json @@ -0,0 +1,41 @@ +{ + "skill_name": "mesh-lab", + "evals": [ + { + "id": 1, + "prompt": "I changed Noise session recovery and authenticated peer-state handling. Validate it on real Android devices before we merge. I have not told you whether any disposable phones are connected.", + "expected_output": "The agent inspects the current Mesh Lab implementation, selects the Noise and churn scenarios, checks hardware and destructive-setup authorization, and reports blocked rather than inventing a pass when devices are unavailable.", + "files": [], + "expectations": [ + "Selects dm, file_private, session_recovery, and identity_reset, with any omission explicitly tied to the inspected change.", + "Recognizes that setup clears app data and requires disposable lab devices.", + "Does not run setup, identity_reset, or all without destructive authorization and reports blocked (not run) when hardware is unavailable.", + "Keeps device selectors and raw evidence out of durable artifacts." + ] + }, + { + "id": 2, + "prompt": "The broadcast fragment cap changed. Two unlocked disposable phones are attached over ADB. Run the relevant Mesh Lab coverage and give me a PR-safe summary.", + "expected_output": "The agent recognizes that the stock fixtures do not prove the exact fragment boundary, adds focused below/at/above-cap receiver-side coverage when the changed contract requires it, runs relevant existing file scenarios, saves private evidence in a protected temporary directory, and produces a sanitized summary.", + "files": [], + "expectations": [ + "Uses the debug APK and the repository Mesh Lab runner.", + "Runs file and file_oversize, and runs file_private only if the inspected cap is shared with private transfers.", + "Adds or requires below/at/above-cap receiver-side assertions instead of treating the stock 1 KB and 512 KB fixtures as exact-boundary proof.", + "Stores unsanitized evidence in a unique mode-0700 temporary directory and does not expose ADB selectors." + ] + }, + { + "id": 3, + "prompt": "I added a new routed acknowledgement packet. Existing mesh_lab scenarios do not prove that the second phone receives and processes it. Add appropriate physical-device coverage.", + "expected_output": "The agent extends the host scenario and only the minimum necessary debug hook, asserting a unique remote observation with bounded timeouts and structured evidence while keeping test code out of production sources.", + "files": [], + "expectations": [ + "Uses a unique receiver-side acknowledgement observation rather than treating raw_send success as end-to-end proof.", + "Starts the receiver wait before send and uses bounded timeouts with structured JSON evidence.", + "Keeps any hook and manifest changes under app/src/debug and updates scenario registration and documentation.", + "Handles unsupported device types or topologies explicitly rather than assuming parity." + ] + } + ] +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..192d1390 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.gradle +.reproducible-build +**/build +local.properties +tools/arti-build/.arti-source diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 9911c273..211e851b 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -3,102 +3,140 @@ name: Android CI on: workflow_dispatch: push: - branches: [ "main", "develop" ] + branches: [main, develop] pull_request: - branches: [ "main", "develop" ] + branches: [main, develop] + +permissions: + contents: read + +env: + SETUP_JAVA_VERSION: 21.0.11+10.0.LTS jobs: verify: - name: Test & Lint - runs-on: ubuntu-latest + name: Test and lint + runs-on: ubuntu-24.04 steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' + - name: Set up pinned JDK + uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5 + with: + distribution: temurin + java-version: ${{ env.SETUP_JAVA_VERSION }} - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 + - name: Set up and validate Gradle + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Verify native library inputs + run: tools/arti-build/verify-checksums.sh - - name: Cache Gradle packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Run unit tests + run: ./gradlew testDebugUnitTest - - name: Run unit tests - run: ./gradlew testDebugUnitTest + - name: Run lint + run: ./gradlew lintDebug - - name: Run lint - run: ./gradlew lintDebug + - name: Upload test reports + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: test-reports + path: | + **/build/test-results/ + **/build/reports/tests/ - - name: Upload test reports - if: always() - uses: actions/upload-artifact@v4 - with: - name: test-reports - path: | - **/build/test-results/ - **/build/reports/tests/ + - name: Upload lint results + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: lint-results + path: "**/build/reports/lint-results-*.html" - - name: Upload lint results - uses: actions/upload-artifact@v4 - if: always() - with: - name: lint-results - path: '**/build/reports/lint-results-*.html' + build-debug: + name: Build debug APK + runs-on: ubuntu-24.04 + needs: verify - build: - name: Build ${{ matrix.variant }} - runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Set up pinned JDK + uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5 + with: + distribution: temurin + java-version: ${{ env.SETUP_JAVA_VERSION }} + + - name: Set up and validate Gradle + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 + + - name: Build debug APK + run: ./gradlew assembleDebug + + - name: Upload debug APK + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: Debug-apk + path: app/build/outputs/apk/debug/*.apk + + reproducible-build: + name: Reproducible release build ${{ matrix.replica }} + runs-on: ubuntu-24.04 needs: verify strategy: + fail-fast: false matrix: - variant: [Debug, Release] + replica: [a, b] steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' + - name: Set up pinned JDK + uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5 + with: + distribution: temurin + java-version: ${{ env.SETUP_JAVA_VERSION }} - - name: Setup Gradle - uses: gradle/gradle-build-action@v3 + - name: Set up and validate Gradle + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 + with: + cache-disabled: true - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Build canonical unsigned release + run: tools/reproducible-builds/build-in-container.sh "$RUNNER_TEMP/release-${{ matrix.replica }}" - - name: Cache Gradle packages - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Upload build replica + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: reproducible-release-${{ matrix.replica }} + path: ${{ runner.temp }}/release-${{ matrix.replica }}/* + if-no-files-found: error - - name: Build ${{ matrix.variant }} APK - run: ./gradlew assemble${{ matrix.variant }} + compare-reproducible-builds: + name: Compare release bytes + runs-on: ubuntu-24.04 + needs: reproducible-build - - name: Upload ${{ matrix.variant }} APK - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.variant }}-apk - path: app/build/outputs/apk/**/*.apk + steps: + - name: Checkout verification script + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Download replica A + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 + with: + name: reproducible-release-a + path: ${{ runner.temp }}/release-a + + - name: Download replica B + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 + with: + name: reproducible-release-b + path: ${{ runner.temp }}/release-b + + - name: Compare every canonical byte + run: tools/reproducible-builds/compare-release.sh "$RUNNER_TEMP/release-a" "$RUNNER_TEMP/release-b" diff --git a/.github/workflows/fetch-georelays.yml b/.github/workflows/fetch-georelays.yml index f7d629bc..8f91c53d 100644 --- a/.github/workflows/fetch-georelays.yml +++ b/.github/workflows/fetch-georelays.yml @@ -10,11 +10,11 @@ permissions: jobs: update-relay-data: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -37,4 +37,4 @@ jobs: git commit -m "Automated update of relay data - $(date -u)" git push env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1e1841a..ccf20b33 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,106 +2,118 @@ name: Release on: workflow_dispatch: + inputs: + tag: + description: Existing vX.Y.Z tag to build and attest + required: true + type: string push: tags: - - 'v*.*.*' # Triggers for tags like v1.0.0 + - "v*.*.*" + +permissions: + contents: read + +env: + RELEASE_TAG: ${{ inputs.tag || github.ref_name }} jobs: build: - runs-on: ubuntu-latest + name: Build unsigned release ${{ matrix.replica }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + replica: [a, b] steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - - - name: Setup Gradle - uses: gradle/gradle-build-action@v2 - with: - gradle-version: wrapper - - - name: Cache Gradle files - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - gradle-${{ runner.os }}- - - - name: Grant execute permission for Gradlew - run: chmod +x ./gradlew - - - name: Build Release APKs (with architecture splits) - run: ./gradlew assembleRelease --no-daemon --stacktrace - - - name: List APK files + - name: Validate release tag run: | - echo "APK files built:" - find app/build/outputs/apk/release -name "*.apk" -type f -exec ls -lh {} \; + if [[ ! "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then + echo "error: release tag must look like vX.Y.Z" >&2 + exit 1 + fi - - name: Rename APKs for GitHub Release - run: | - cd app/build/outputs/apk/release - [ -f "app-arm64-v8a-release-unsigned.apk" ] && mv app-arm64-v8a-release-unsigned.apk bitchat-android-arm64.apk - [ -f "app-x86_64-release-unsigned.apk" ] && mv app-x86_64-release-unsigned.apk bitchat-android-x86_64.apk - [ -f "app-universal-release-unsigned.apk" ] && mv app-universal-release-unsigned.apk bitchat-android-universal.apk - - - name: DEBUG - run: | - set -x - pwd - ls -all - cd app/build/outputs/ - ls -all - tree || ls -R - - # Optional: Sign APKs (uncomment and configure secrets when ready) - # - name: Sign APKs - # uses: r0adkll/sign-android-release@v1 - # with: - # releaseDirectory: app/build/outputs/apk/release - # signingKeyBase64: ${{ secrets.SIGNING_KEY }} - # alias: ${{ secrets.ALIAS }} - # keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - # keyPassword: ${{ secrets.KEY_PASSWORD }} - - - name: Upload APKs as artifacts - uses: actions/upload-artifact@v4 + - name: Checkout tagged source + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 with: - name: bitchat-android-release-${{ github.ref_name }} - path: app/build/outputs/apk/release/*.apk + ref: ${{ env.RELEASE_TAG }} + + - name: Verify workflow provenance ref + run: | + checked_out_commit="$(git rev-parse HEAD)" + if [ "$checked_out_commit" != "$GITHUB_SHA" ]; then + echo "error: run the workflow from the $RELEASE_TAG tag ref so provenance identifies the built commit" >&2 + exit 1 + fi + + - name: Validate the Gradle wrapper + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 + with: + cache-disabled: true + + - name: Build canonical unsigned APKs and AAB + run: tools/reproducible-builds/build-in-container.sh "$RUNNER_TEMP/release-${{ matrix.replica }}" + + - name: Upload unsigned replica + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: unsigned-release-${{ matrix.replica }} + path: ${{ runner.temp }}/release-${{ matrix.replica }}/* retention-days: 30 if-no-files-found: error - release: + compare: + name: Verify reproducibility + runs-on: ubuntu-24.04 needs: build - runs-on: ubuntu-latest + permissions: + attestations: write + contents: read + id-token: write steps: - - name: Download release artifacts - uses: actions/download-artifact@v4 + - name: Checkout verification script + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 with: - name: bitchat-android-release-${{ github.ref_name }} - path: release + ref: ${{ env.RELEASE_TAG }} - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 + - name: Download replica A + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: - files: | - release/bitchat-android-arm64.apk - release/bitchat-android-x86_64.apk - release/bitchat-android-universal.apk - name: Release ${{ github.ref_name }} - body: | - **bitchat-android-arm64.apk** - ARM64 (most phones) - **bitchat-android-x86_64.apk** - x86_64 (Chromebooks, tablets) - **bitchat-android-universal.apk** - All architectures (fallback) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + name: unsigned-release-a + path: ${{ runner.temp }}/release-a + + - name: Download replica B + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 + with: + name: unsigned-release-b + path: ${{ runner.temp }}/release-b + + - name: Compare every canonical byte + run: tools/reproducible-builds/compare-release.sh "$RUNNER_TEMP/release-a" "$RUNNER_TEMP/release-b" + + - name: Prepare public attestation subjects + run: | + mkdir "$RUNNER_TEMP/attestation-subjects" + cp "$RUNNER_TEMP/release-a/BUILDINFO.json" \ + "$RUNNER_TEMP/attestation-subjects/BITCHAT_BUILDINFO.json" + cp "$RUNNER_TEMP/release-a/SHA256SUMS.unsigned" \ + "$RUNNER_TEMP/attestation-subjects/BITCHAT_SHA256SUMS.unsigned" + cp "$RUNNER_TEMP"/release-a/bitchat-android-*-unsigned.apk \ + "$RUNNER_TEMP/attestation-subjects/" + cp "$RUNNER_TEMP/release-a/bitchat-android-release-unsigned.aab" \ + "$RUNNER_TEMP/attestation-subjects/" + + - name: Attest verified unsigned release + uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3 + with: + subject-path: ${{ runner.temp }}/attestation-subjects/* + + - name: Upload verified unsigned release + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: verified-unsigned-release + path: ${{ runner.temp }}/release-a/* + retention-days: 30 + if-no-files-found: error diff --git a/.gitignore b/.gitignore index 0986ac74..71a4f9f7 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ gen/ *~ *.swp *.lock +!tools/arti-build/Cargo.lock .goosehints # Google services @@ -69,6 +70,7 @@ google-services.json # Arti build artifacts (cloned repo and Rust build cache) tools/arti-build/.arti-source/ tools/arti-build/target/ +.reproducible-build/ # JVM heap dumps (a Gradle daemon OOM drops these in the repo root) *.hprof diff --git a/.java-version b/.java-version new file mode 100644 index 00000000..5e5d5c43 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +21.0.11 diff --git a/README.md b/README.md index 93d740c4..fe1bab8e 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,12 @@ adb install -r app/build/outputs/apk/debug/app-debug.apk The app requests Bluetooth, location (required for BLE scanning), and notification permissions at runtime. +Release APKs and the Android App Bundle can be rebuilt byte-for-byte in the +pinned Linux container. Maintainers should follow the +[Android release guide](docs/maintainer-release-guide.md). See +[Reproducible builds](docs/reproducible-builds.md) for the build trust model +and public GitHub/Google Play verification procedures. + ## Testing ```bash diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 84ea0cd9..32fe53db 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -24,6 +24,7 @@ require( android { namespace = "com.bitchat.android" compileSdk = libs.versions.compileSdk.get().toInt() + buildToolsVersion = libs.versions.buildTools.get() defaultConfig { applicationId = "com.bitchat.droid" @@ -64,6 +65,11 @@ android { getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) + vcsInfo { + // BUILDINFO.json and attestations carry the verified commit + // without depending on host-specific Git/worktree paths. + include = false + } } } @@ -106,6 +112,7 @@ android { } kotlin { + jvmToolchain(21) compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } diff --git a/app/gradle.lockfile b/app/gradle.lockfile new file mode 100644 index 00000000..bd31d677 --- /dev/null +++ b/app/gradle.lockfile @@ -0,0 +1,463 @@ +# This is a Gradle generated file for dependency locking. +# 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-compose:1.13.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.activity:activity-ktx:1.13.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.activity:activity:1.13.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.annotation:annotation-experimental:1.4.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.annotation:annotation-jvm:1.10.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.annotation:annotation:1.10.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.appcompat:appcompat-resources:1.7.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.appcompat:appcompat:1.7.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.arch.core:core-common:2.2.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.arch.core:core-runtime:2.2.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.autofill:autofill:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera.featurecombinationquery:featurecombinationquery:1.6.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera.viewfinder:viewfinder-compose:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera.viewfinder:viewfinder-core:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera:camera-camera2-pipe:1.6.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera:camera-camera2:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera:camera-compose:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera:camera-core:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.camera:camera-lifecycle:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.collection:collection-jvm:1.5.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.collection:collection-ktx:1.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.collection:collection:1.5.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-core-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-core:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation-layout-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation-layout:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material3:material3-android:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material3:material3:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material:material-icons-core-android:1.7.8=debugAndroidTestCompileClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath +androidx.compose.material:material-icons-core-desktop:1.7.8=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugUnitTestLintChecksClasspath,releaseLintChecksClasspath +androidx.compose.material:material-icons-core:1.7.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material:material-icons-extended-android:1.7.8=debugAndroidTestCompileClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath +androidx.compose.material:material-icons-extended-desktop:1.7.8=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugUnitTestLintChecksClasspath,releaseLintChecksClasspath +androidx.compose.material:material-icons-extended:1.7.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material:material-ripple-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material:material-ripple:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-annotation-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-annotation:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-retain-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-retain:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-saveable-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-saveable:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-geometry-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-geometry:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-graphics-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-graphics:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-test-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.compose.ui:ui-test-junit4-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.compose.ui:ui-test-junit4:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.compose.ui:ui-test-manifest:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.compose.ui:ui-test:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.compose.ui:ui-text-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-text:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-tooling-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-data-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-data:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-preview-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-tooling-preview:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-tooling:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-unit-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-unit:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-util-android:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-util:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui:1.11.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose:compose-bom:2026.06.01=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.concurrent:concurrent-futures-ktx:1.1.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.concurrent:concurrent-futures-ktx:1.2.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.concurrent:concurrent-futures:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.concurrent:concurrent-futures:1.2.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.core:core-backported-fixes:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.core:core-ktx:1.19.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.core:core-viewtree:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.core:core:1.19.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.cursoradapter:cursoradapter:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.customview:customview-poolingcontainer:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.customview:customview:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.documentfile:documentfile:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.drawerlayout:drawerlayout:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.dynamicanimation:dynamicanimation:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.emoji2:emoji2-views-helper:1.4.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.emoji2:emoji2:1.4.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.exifinterface:exifinterface:1.4.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.fragment:fragment:1.5.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.graphics:graphics-path:1.0.1=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.interpolator:interpolator:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.legacy:legacy-support-core-utils:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-common-java8:2.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-common-jvm:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-common:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-livedata-core-ktx:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-livedata-core:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-livedata:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-process:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-compose-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-compose:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-ktx-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-ktx:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-service:2.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-compose-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-compose:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-ktx:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-savedstate:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.loader:loader:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.localbroadcastmanager:localbroadcastmanager:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigation:navigation-common-android:2.9.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigation:navigation-common:2.9.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigation:navigation-compose-android:2.9.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigation:navigation-compose:2.9.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigation:navigation-runtime-android:2.9.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigation:navigation-runtime:2.9.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent-android:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent-compose-android:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent-compose:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.print:print:1.0.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.profileinstaller:profileinstaller:1.4.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.resourceinspection:resourceinspection-annotation:1.0.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.room:room-common:2.6.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.room:room-ktx:2.6.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.room:room-runtime:2.6.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-android:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-compose-android:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-compose:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-ktx:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.security:security-crypto:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.sqlite:sqlite-framework:2.4.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.sqlite:sqlite:2.4.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.startup:startup-runtime:1.1.1=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.startup:startup-runtime:1.2.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.test.espresso:espresso-core:3.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test.espresso:espresso-core:3.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test.espresso:espresso-idling-resource:3.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test.espresso:espresso-idling-resource:3.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test.ext:junit:1.1.5=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test.ext:junit:1.3.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test.services:storage:1.4.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test.services:storage:1.6.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test:annotation:1.0.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test:core:1.5.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test:core:1.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test:monitor:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test:monitor:1.8.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test:runner:1.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +androidx.test:runner:1.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.tracing:tracing-android:1.3.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.tracing:tracing-ktx:1.3.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.tracing:tracing:1.0.0=debugAndroidTestCompileClasspath +androidx.tracing:tracing:1.1.0=debugUnitTestCompileClasspath +androidx.tracing:tracing:1.3.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.transition:transition:1.6.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.vectordrawable:vectordrawable-animated:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.vectordrawable:vectordrawable:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.versionedparcelable:versionedparcelable:1.1.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.viewpager:viewpager:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.window:window-core-android:1.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.window:window-core:1.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.window:window:1.5.0=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.work:work-runtime-ktx:2.10.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.work:work-runtime:2.10.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.almworks.sqlite4java:sqlite4java:1.0.392=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.android.tools.analytics-library:protos:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.analytics-library:shared:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.analytics-library:tracker:32.3.1=androidLintTool +com.android.tools.build:aapt2-proto:9.3.1-15703166=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.build:builder-model:9.3.1=androidLintTool +com.android.tools.build:manifest-merger:32.3.1=androidLintTool +com.android.tools.ddms:ddmlib:32.3.1=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools.emulator:proto:32.3.1=unified-test-platform-android-test-plugin-host-emulator-control +com.android.tools.external.com-intellij:intellij-core:32.3.1=androidLintTool +com.android.tools.external.com-intellij:kotlin-compiler:32.3.1=androidLintTool +com.android.tools.external.org-jetbrains:uast:32.3.1=androidLintTool +com.android.tools.layoutlib:layoutlib-api:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.lint:lint-api:32.3.1=androidLintTool +com.android.tools.lint:lint-checks:32.3.1=androidLintTool +com.android.tools.lint:lint-gradle:32.3.1=androidLintTool +com.android.tools.lint:lint-model:32.3.1=androidLintTool +com.android.tools.lint:lint-typedef-remover:32.3.1=androidLintTool +com.android.tools.lint:lint:32.3.1=androidLintTool +com.android.tools.utp:android-device-provider-ddmlib-proto:32.3.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-gradle-work-action +com.android.tools.utp:android-device-provider-ddmlib:32.3.1=unified-test-platform-android-device-provider-ddmlib +com.android.tools.utp:android-test-plugin-host-additional-test-output-proto:32.3.1=unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-additional-test-output:32.3.1=unified-test-platform-android-test-plugin-host-additional-test-output +com.android.tools.utp:android-test-plugin-host-apk-installer-proto:32.3.1=unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-apk-installer:32.3.1=unified-test-platform-android-test-plugin-host-apk-installer +com.android.tools.utp:android-test-plugin-host-coverage-proto:32.3.1=unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-coverage:32.3.1=unified-test-platform-android-test-plugin-host-coverage +com.android.tools.utp:android-test-plugin-host-device-info-proto:32.3.1=unified-test-platform-android-test-plugin-host-device-info +com.android.tools.utp:android-test-plugin-host-device-info:32.3.1=unified-test-platform-android-test-plugin-host-device-info +com.android.tools.utp:android-test-plugin-host-emulator-control-proto:32.3.1=unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-emulator-control:32.3.1=unified-test-platform-android-test-plugin-host-emulator-control +com.android.tools.utp:android-test-plugin-host-logcat-proto:32.3.1=unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-logcat:32.3.1=unified-test-platform-android-test-plugin-host-logcat +com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:32.3.1=unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-result-listener-gradle:32.3.1=unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.utp:gradle-work-action:32.3.1=unified-test-platform-gradle-work-action +com.android.tools.utp:utp-common:32.3.1=unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-logcat +com.android.tools:annotations:32.3.1=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools:common:32.3.1=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools:dvlib:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools:play-sdk-proto:32.3.1=androidLintTool +com.android.tools:repository:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools:sdk-common:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools:sdklib:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.accompanist:accompanist-permissions:0.37.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.datatransport:transport-api:2.2.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.datatransport:transport-backend-cct:2.3.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.datatransport:transport-runtime:2.2.6=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.gms:play-services-base:18.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.gms:play-services-basement:18.9.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.gms:play-services-location:21.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.gms:play-services-tasks:18.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android.odml:image:1.0.0-beta1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.android:annotations:4.1.1.4=unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-core +com.google.api.grpc:proto-google-common-protos:2.17.0=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core +com.google.api.grpc:proto-google-common-protos:2.48.0=unified-test-platform-android-test-plugin-host-emulator-control +com.google.auto.service:auto-service-annotations:1.1.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.auto.service:auto-service:1.1.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.auto.value:auto-value-annotations:1.11.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.auto.value:auto-value-annotations:1.6.3=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.auto:auto-common:1.2.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.code.findbugs:jsr305:3.0.2=androidLintTool,debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.code.gson:gson:2.10.1=unified-test-platform-core,unified-test-platform-gradle-work-action +com.google.code.gson:gson:2.11.0=androidLintTool,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.code.gson:gson:2.14.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.code.gson:gson:2.8.9=unified-test-platform-android-driver-instrumentation,unified-test-platform-launcher +com.google.crypto.tink:tink-android:1.23.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.crypto.tink:tink:1.18.0=unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action +com.google.dagger:dagger:2.48=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action +com.google.dagger:dagger:2.59=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.errorprone:error_prone_annotation:2.38.0=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.23.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.errorprone:error_prone_annotations:2.36.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.errorprone:error_prone_annotations:2.48.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.firebase:firebase-annotations:16.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.firebase:firebase-components:16.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.firebase:firebase-encoders-json:17.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.firebase:firebase-encoders:16.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.guava:failureaccess:1.0.1=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.guava:failureaccess:1.0.2=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.guava:failureaccess:1.0.3=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.guava:guava:32.0.1-jre=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.guava:guava:33.4.0-jre=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.guava:guava:33.4.8-jre=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.guava:listenablefuture:1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=androidLintTool,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.j2objc:j2objc-annotations:2.8=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.j2objc:j2objc-annotations:3.0.0=androidLintTool,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.jimfs:jimfs:1.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.mlkit:barcode-scanning-common:17.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.mlkit:barcode-scanning:17.3.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.mlkit:common:18.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.mlkit:vision-common:17.3.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.mlkit:vision-interfaces:16.3.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.protobuf:protobuf-java-util:3.22.3=unified-test-platform-core +com.google.protobuf:protobuf-java-util:4.28.3=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.protobuf:protobuf-java:3.25.5=androidLintTool +com.google.protobuf:protobuf-java:4.28.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.protobuf:protobuf-kotlin:4.28.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.testing.platform:android-device-provider-local:0.0.9-alpha04=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.testing.platform:android-driver-instrumentation:0.0.9-alpha04=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control +com.google.testing.platform:android-test-plugin:0.0.9-alpha04=unified-test-platform-android-test-plugin +com.google.testing.platform:core-proto:0.0.9-alpha04=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.testing.platform:core:0.0.9-alpha04=unified-test-platform-core +com.google.testing.platform:launcher:0.0.9-alpha04=unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.testparameterinjector:test-parameter-injector:1.18=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.zxing:core:3.5.4=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.ibm.icu:icu4j:77.1=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.squareup.okhttp3:okhttp-android:5.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.squareup.okhttp3:okhttp:5.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.squareup.okio:okio-jvm:3.17.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.squareup.okio:okio:3.17.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.squareup:javawriter:2.1.1=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +com.sun.istack:istack-commons-runtime:3.0.8=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.sun.xml.fastinfoset:FastInfoset:1.2.16=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +commons-codec:commons-codec:1.17.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +commons-io:commons-io:2.16.1=androidLintTool,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +commons-logging:commons-logging:1.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +io.grpc:grpc-api:1.57.2=unified-test-platform-core +io.grpc:grpc-api:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-context:1.57.2=unified-test-platform-core +io.grpc:grpc-context:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-core:1.57.2=unified-test-platform-core +io.grpc:grpc-core:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-netty:1.57.2=unified-test-platform-core +io.grpc:grpc-netty:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-protobuf-lite:1.57.2=unified-test-platform-core +io.grpc:grpc-protobuf-lite:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-protobuf:1.57.2=unified-test-platform-core +io.grpc:grpc-protobuf:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-services:1.57.2=unified-test-platform-core +io.grpc:grpc-stub:1.57.2=unified-test-platform-core +io.grpc:grpc-stub:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-util:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-buffer:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-buffer:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec-http2:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec-http2:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec-http:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec-http:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec-socks:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec-socks:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec:4.1.93.Final=unified-test-platform-core +io.netty:netty-common:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-common:4.1.93.Final=unified-test-platform-core +io.netty:netty-handler-proxy:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-handler-proxy:4.1.93.Final=unified-test-platform-core +io.netty:netty-handler:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-handler:4.1.93.Final=unified-test-platform-core +io.netty:netty-resolver:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-resolver:4.1.93.Final=unified-test-platform-core +io.netty:netty-transport-native-unix-common:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-transport-native-unix-common:4.1.93.Final=unified-test-platform-core +io.netty:netty-transport:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-transport:4.1.93.Final=unified-test-platform-core +io.opencensus:opencensus-api:0.31.0=unified-test-platform-core +io.opencensus:opencensus-proto:0.2.0=unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +io.perfmark:perfmark-api:0.26.0=unified-test-platform-core +io.perfmark:perfmark-api:0.27.0=unified-test-platform-android-test-plugin-host-emulator-control +jakarta.activation:jakarta.activation-api:1.2.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +jakarta.inject:jakarta.inject-api:2.0.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +jakarta.xml.bind:jakarta.xml.bind-api:2.3.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +javax.annotation:javax.annotation-api:1.3.2=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-test-plugin-host-emulator-control +javax.inject:javax.inject:1=androidLintTool,debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action +junit:junit:4.13.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.17.7=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +net.bytebuddy:byte-buddy:1.17.7=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +net.java.dev.jna:jna-platform:5.6.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +net.java.dev.jna:jna:5.6.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +net.sf.kxml:kxml2:2.3.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +no.nordicsemi.android:ble:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.apache.commons:commons-compress:1.27.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.commons:commons-lang3:3.16.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.httpcomponents:httpclient:4.5.6=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.httpcomponents:httpcore:4.4.16=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.httpcomponents:httpmime:4.5.6=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.bouncycastle:bcpkix-jdk18on:1.79=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.bouncycastle:bcprov-jdk18on:1.79=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.bouncycastle:bcprov-jdk18on:1.85=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.bouncycastle:bcutil-jdk18on:1.79=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.checkerframework:checker-qual:3.33.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +org.checkerframework:checker-qual:3.43.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +org.codehaus.groovy:groovy:3.0.22=androidLintTool +org.codehaus.mojo:animal-sniffer-annotations:1.23=unified-test-platform-core +org.codehaus.mojo:animal-sniffer-annotations:1.24=unified-test-platform-android-test-plugin-host-emulator-control +org.conscrypt:conscrypt-openjdk-uber:2.5.2=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.glassfish.jaxb:jaxb-runtime:2.3.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.glassfish.jaxb:txw2:2.3.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.hamcrest:hamcrest-core:1.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.hamcrest:hamcrest-integration:1.3=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath +org.hamcrest:hamcrest-library:1.3=debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlin:compose-group-mapping:2.4.10=composeMappingProducerClasspath +org.jetbrains.kotlin:kotlin-build-tools-api:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-build-tools-api:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-build-tools-compat:2.4.10=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-build-tools-cri-impl:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-build-tools-cri-impl:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-build-tools-impl:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-build-tools-impl:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-compiler-embeddable:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-compiler-embeddable:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-compiler-runner:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-compiler-runner:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.4.10=kotlin-extension,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-daemon-client:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-daemon-client:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-daemon-embeddable:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-daemon-embeddable:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-parcelize-compiler:2.4.10=kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-parcelize-runtime:2.4.10=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugRuntimeClasspathCopy,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,releaseRuntimeClasspathCopy +org.jetbrains.kotlin:kotlin-reflect:1.6.10=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-reflect:1.8.21=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-reflect:2.1.20=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.2.10=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlin:kotlin-script-runtime:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-script-runtime:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-stdlib-common:1.8.21=unified-test-platform-android-test-plugin,unified-test-platform-core +org.jetbrains.kotlin:kotlin-stdlib-common:1.9.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib-common:2.2.10=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-gradle-work-action +org.jetbrains.kotlin:kotlin-stdlib-common:2.4.10=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.2.10=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.2.10=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +org.jetbrains.kotlin:kotlin-stdlib:1.8.21=unified-test-platform-android-test-plugin,unified-test-platform-core +org.jetbrains.kotlin:kotlin-stdlib:1.9.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib:2.2.10=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,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.10=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugRuntimeClasspathCopy,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,releaseRuntimeClasspathCopy +org.jetbrains.kotlin:kotlin-tooling-core:2.4.10=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlinx:atomicfu-jvm:0.22.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:atomicfu-jvm:0.28.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:atomicfu:0.22.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:atomicfu:0.28.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains:annotations:13.0=composeMappingProducerClasspath,debugRuntimeClasspathCopy,kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease,releaseRuntimeClasspathCopy +org.jetbrains:annotations:23.0.0=androidLintTool,debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jspecify:jspecify:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jvnet.staxex:stax-ex:1.8.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.mockito.kotlin:mockito-kotlin:6.3.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.mockito:mockito-core:5.23.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.nanohttpd:nanohttpd:2.3.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.objenesis:objenesis:3.3=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm-analysis:9.9=androidLintTool +org.ow2.asm:asm-commons:9.8=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm-commons:9.9=androidLintTool +org.ow2.asm:asm-tree:9.8=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm-tree:9.9=androidLintTool +org.ow2.asm:asm-tree:9.9.1=composeMappingProducerClasspath +org.ow2.asm:asm:9.8=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm:9.9=androidLintTool +org.ow2.asm:asm:9.9.1=composeMappingProducerClasspath +org.robolectric:annotations:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:junit:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:nativeruntime-dist-compat:1.0.17=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:nativeruntime:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:pluginapi:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:plugins-maven-dependency-resolver:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:resources:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:robolectric:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:sandbox:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:shadowapi:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:shadows-framework:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:utils-reflector:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:utils:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.yaml:snakeyaml:2.4=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +empty=androidApis,androidJdkImage,androidTestUtil,coreLibraryDesugaring,debugAndroidTestAnnotationProcessorClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAnnotationProcessorClasspath,debugImplementationDependenciesMetadata,debugReverseMetadataValues,debugUnitTestAnnotationProcessorClasspath,debugUnitTestImplementationDependenciesMetadata,kotlinCompilerPluginClasspath,lintChecks,lintPublish,releaseAnnotationProcessorClasspath,releaseImplementationDependenciesMetadata,releaseReverseMetadataValues diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index df941012..4363120a 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -17,6 +17,13 @@ -keep class com.bitchat.android.nostr.** { *; } -keep class com.bitchat.android.identity.** { *; } +# Room loads generated database implementations by name and invokes their no-argument +# constructors reflectively. R8 full-mode can otherwise optimize away WorkDatabase_Impl's +# constructor, causing AndroidX Startup to crash before Application.onCreate. +-keepclassmembers class * extends androidx.room.RoomDatabase { + (); +} + # Keep Tor implementation (always included) -keep class com.bitchat.android.net.RealTorProvider { *; } diff --git a/app/src/debug/java/com/bitchat/android/testhook/TestHookDriver.kt b/app/src/debug/java/com/bitchat/android/testhook/TestHookDriver.kt index a2e17b9b..8aa8a303 100644 --- a/app/src/debug/java/com/bitchat/android/testhook/TestHookDriver.kt +++ b/app/src/debug/java/com/bitchat/android/testhook/TestHookDriver.kt @@ -3,7 +3,9 @@ package com.bitchat.android.testhook import android.content.Context import android.content.Intent import android.util.Log +import com.bitchat.android.favorites.FavoritesPersistenceService import com.bitchat.android.features.file.FileUtils +import com.bitchat.android.identity.SecureIdentityStateManager import com.bitchat.android.mesh.MeshService import com.bitchat.android.mesh.PrivateMediaPreparation import com.bitchat.android.mesh.TransferProgressManager @@ -63,11 +65,24 @@ object TestHookDriver { "dm_send" -> dmSend(context, intent.requiredString("peer"), intent.requiredString("content"), intent.getStringExtra("msg_id")) "dm_recv" -> dmRecv(context, intent) "msg_recv" -> msgRecv(context, intent) + "favorite_set" -> favoriteSet( + context, + intent.requiredString("peer"), + intent.getBooleanExtra("enabled", true) + ) + "favorite_status" -> favoriteStatus(context, intent.requiredString("peer")) + "verification_set" -> verificationSet( + context, + intent.requiredString("peer"), + intent.getBooleanExtra("enabled", true) + ) + "verification_status" -> verificationStatus(context, intent.requiredString("peer")) "file_send" -> fileSend(context, intent) "file_recv" -> fileRecv(context, intent) "file_cancel" -> fileCancel(context, intent.requiredString("transfer_id")) "raw_send" -> rawSend(context, intent) "ble" -> setBle(intent.getBooleanExtra("enabled", true)) + "inject_peers" -> injectPeers(intent.getStringExtra("peers")) "state" -> state(context) "clear_results" -> clearResults(context) else -> err(cmd, "unknown command: $cmd") @@ -132,6 +147,21 @@ object TestHookDriver { return ok("peers").put("peers", peerInfosJson(mesh, AppStateStore.peers.value)) } + /** + * Debug-only state injection for testing peer-list consumers such as notifications. + * A blank or missing comma-separated value restores the empty state. + */ + private fun injectPeers(commaSeparatedPeers: String?): JSONObject { + val peers = commaSeparatedPeers + .orEmpty() + .split(',') + .map(String::trim) + .filter(String::isNotEmpty) + .distinct() + AppStateStore.setPeers(peers) + return ok("inject_peers").put("peers", JSONArray(peers)) + } + private suspend fun connect(peerID: String, intent: Intent): JSONObject { val timeoutMs = intent.getLongExtra("timeout_ms", DEFAULT_CONNECT_TIMEOUT_MS) val ble = MeshServiceHolder.meshService ?: return err("connect", "BLE service not running") @@ -262,6 +292,68 @@ object TestHookDriver { .put("msg_id", found.id) } + // MARK: - Favorite and verification state + + private fun favoriteSet(context: Context, peerID: String, enabled: Boolean): JSONObject { + val mesh = mesh(context) + val peerInfo = mesh.getPeerInfo(peerID) + ?: return err("favorite_set", "peer is not known") + val noisePublicKey = peerInfo.noisePublicKey + ?: return err("favorite_set", "peer Noise key is unavailable") + FavoritesPersistenceService.initialize(context) + FavoritesPersistenceService.shared.updateFavoriteStatus( + noisePublicKey = noisePublicKey, + nickname = peerInfo.nickname, + isFavorite = enabled + ) + mesh.sendFavoriteNotification(peerID, enabled) + return favoriteStatus(context, peerID) + } + + private fun favoriteStatus(context: Context, peerID: String): JSONObject { + val mesh = mesh(context) + FavoritesPersistenceService.initialize(context) + val relationship = FavoritesPersistenceService.shared.getFavoriteStatus(peerID) + ?: mesh.getPeerInfo(peerID)?.noisePublicKey?.let { + FavoritesPersistenceService.shared.getFavoriteStatus(it) + } + val isFavorite = relationship?.isFavorite == true + val theyFavoritedUs = relationship?.theyFavoritedUs == true + return ok("favorite_status") + .put("peer", peerID) + .put("is_favorite", isFavorite) + .put("they_favorited_us", theyFavoritedUs) + .put("is_mutual", isFavorite && theyFavoritedUs) + .put( + "star_state", + when { + isFavorite -> "filled" + theyFavoritedUs -> "outlined_orange" + else -> "outlined" + } + ) + } + + private fun verificationSet(context: Context, peerID: String, enabled: Boolean): JSONObject { + val mesh = mesh(context) + val fingerprint = mesh.getPeerFingerprint(peerID) + ?: return err("verification_set", "peer fingerprint is unavailable") + SecureIdentityStateManager(context).setVerifiedFingerprint(fingerprint, enabled) + return verificationStatus(context, peerID) + } + + private fun verificationStatus(context: Context, peerID: String): JSONObject { + val fingerprint = mesh(context).getPeerFingerprint(peerID) + val verified = fingerprint != null && + SecureIdentityStateManager(context).getVerifiedFingerprints().any { + it.equals(fingerprint, ignoreCase = true) + } + return ok("verification_status") + .put("peer", peerID) + .put("fingerprint", fingerprint ?: JSONObject.NULL) + .put("verified", verified) + } + // MARK: - File transfer private suspend fun fileSend(context: Context, intent: Intent): JSONObject { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0c71b94c..1f9a8c49 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -80,11 +80,21 @@ android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" + android:localeConfig="@xml/locales_config" android:roundIcon="@mipmap/ic_launcher_round" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.BitchatAndroid" - tools:targetApi="31"> + tools:targetApi="33"> + + + + - - - - - + android:exported="false" /> = favorites.values.filter { it.isMutual } diff --git a/app/src/main/java/com/bitchat/android/features/file/FileUtils.kt b/app/src/main/java/com/bitchat/android/features/file/FileUtils.kt index 10765416..da6898e8 100644 --- a/app/src/main/java/com/bitchat/android/features/file/FileUtils.kt +++ b/app/src/main/java/com/bitchat/android/features/file/FileUtils.kt @@ -5,6 +5,8 @@ import android.net.Uri import android.os.Environment import android.util.Log import androidx.core.content.FileProvider +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.BitchatMessageType import java.io.File import java.io.FileOutputStream import java.io.InputStream @@ -323,4 +325,80 @@ object FileUtils { Log.e(TAG, "Failed to clear media files", e) } } + + /** + * Delete app-owned media referenced only by the conversation being removed. + * + * Canonical-path checks prevent message content from turning this into an arbitrary-file + * deletion primitive. Shared paths remain intact while any retained message still references + * them. + */ + fun deleteConversationMedia( + context: Context, + deletedMessages: Collection, + retainedMessages: Collection + ) { + val mediaTypes = setOf( + BitchatMessageType.Audio, + BitchatMessageType.Image, + BitchatMessageType.File + ) + val roots = listOf(context.filesDir, context.cacheDir) + .mapNotNull { runCatching { it.canonicalFile }.getOrNull() } + val retainedPaths = retainedMessages + .asSequence() + .filter { it.type in mediaTypes } + .mapNotNull { message -> + runCatching { File(message.content.trim()).canonicalPath }.getOrNull() + } + .toSet() + + deletedMessages + .asSequence() + .filter { it.type in mediaTypes } + .mapNotNull { message -> + runCatching { File(message.content.trim()).canonicalFile }.getOrNull() + } + .distinctBy(File::getPath) + .filter { file -> + file.path !in retainedPaths && + roots.any { root -> + file.path == root.path || + file.path.startsWith(root.path + File.separator) + } + } + .forEach { file -> + runCatching { + if (file.isFile && !file.delete()) { + Log.w(TAG, "Unable to delete conversation media") + } + } + } + } + + /** + * Deletes paths proven by the conversation database to have no remaining message reference. + * The same canonical-root boundary as explicit conversation deletion prevents arbitrary paths + * from being removed even if persisted metadata is malformed. + */ + fun deleteStoredMediaPaths(context: Context, paths: Collection) { + val roots = listOf(context.filesDir, context.cacheDir) + .mapNotNull { runCatching { it.canonicalFile }.getOrNull() } + paths.asSequence() + .mapNotNull { runCatching { File(it).canonicalFile }.getOrNull() } + .distinctBy(File::getPath) + .filter { file -> + roots.any { root -> + file.path == root.path || + file.path.startsWith(root.path + File.separator) + } + } + .forEach { file -> + runCatching { + if (file.isFile && !file.delete()) { + Log.w(TAG, "Unable to delete unreferenced conversation media") + } + } + } + } } diff --git a/app/src/main/java/com/bitchat/android/hotspot/HotspotManager.kt b/app/src/main/java/com/bitchat/android/hotspot/HotspotManager.kt index 3a22b6b1..8f503fb5 100644 --- a/app/src/main/java/com/bitchat/android/hotspot/HotspotManager.kt +++ b/app/src/main/java/com/bitchat/android/hotspot/HotspotManager.kt @@ -28,10 +28,6 @@ class HotspotManager(private val context: Context) { companion object { private const val TAG = "HotspotMgr" - // Retry configuration - private const val MAX_FRAMEWORK_ATTEMPTS = 5 - private const val RETRY_DELAY_MILLIS = 1000L - // Group info polling interval private const val GROUP_INFO_POLL_INTERVAL_MILLIS = 1000L @@ -39,10 +35,14 @@ class HotspotManager(private val context: Context) { private const val GROUP_FORMATION_TIMEOUT_MILLIS = 15_000L // SSID and password configuration - private const val SSID_PREFIX = "DIRECT-BC-" // BC for BitChat private const val SSID_SUFFIX_LENGTH = 8 private const val PASSWORD_LENGTH = 16 + // Records the group we created so a later run can tell our own orphan apart + // from a group belonging to Cast, Android Auto or Quick Share. + private const val PREFS_NAME = "hotspot" + private const val KEY_OWNED_GROUP = "owned_group_name" + // Characters to use for random generation (excluding confusing ones) private const val RANDOM_CHARS = "ABCDEFGHJKLMNPQRTUVWXY34679" // No 0,O,5,S,1,l,I } @@ -67,13 +67,31 @@ class HotspotManager(private val context: Context) { private var savedSsid: String? = null private var savedPassword: String? = null + // Last Wi-Fi P2P state seen on the broadcast, or null before the first one arrives + private var lastP2pState: Int? = null + + private val prefs by lazy { context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) } + + /** Network name of the last group this app created, surviving process death. */ + private var ownedGroupName: String? + get() = prefs.getString(KEY_OWNED_GROUP, null) + set(value) = prefs.edit().putString(KEY_OWNED_GROUP, value).apply() + // Broadcast receiver for Wi-Fi P2P events private val broadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { when (intent.action) { WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION -> { val state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1) + lastP2pState = state Log.d(TAG, "Wi-Fi P2P state changed: $state") + + // Wi-Fi Direct going away is terminal for this session: without it + // the group cannot form, and any group already up is now dead. + if (state == WIFI_P2P_STATE_DISABLED && (isStarting || hasNotifiedStarted)) { + Log.w(TAG, "Wi-Fi P2P was disabled; aborting hotspot") + failStartup(HotspotStartupPolicy.P2P_DISABLED_MESSAGE) + } } WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION -> { Log.d(TAG, "Wi-Fi P2P connection changed") @@ -138,8 +156,8 @@ class HotspotManager(private val context: Context) { Log.d(TAG, "Using saved credentials: SSID=$savedSsid") } - // Start P2P framework with retries - startWifiP2pFramework(1) + // Start P2P framework (retries reuse this one channel) + startWifiP2pFramework() } /** @@ -154,14 +172,22 @@ class HotspotManager(private val context: Context) { // Stop group info polling handler.removeCallbacksAndMessages(null) - // Remove group - channel?.let { ch -> - wifiP2pManager?.removeGroup(ch, object : ActionListener { + // Detach the channel first so any in-flight listener sees the hotspot as stopped, + // then remove the group and close the channel once the framework has replied. + val staleChannel = channel + channel = null + + if (staleChannel != null) { + wifiP2pManager?.removeGroup(staleChannel, object : ActionListener { override fun onSuccess() { Log.d(TAG, "Group removed successfully") + // Nothing of ours is left for a later run to clean up. + ownedGroupName = null + closeChannel(staleChannel) } override fun onFailure(reason: Int) { Log.w(TAG, "Failed to remove group: $reason") + closeChannel(staleChannel) } }) } @@ -182,10 +208,25 @@ class HotspotManager(private val context: Context) { } currentGroup = null - channel = null callback = null } + /** + * Release the channel's binder registration with WifiP2pService. Without this the + * registration survives until the process dies, and every start/stop cycle adds + * another stale client to the framework's list. + */ + private fun closeChannel(channelToClose: Channel) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1) return + + try { + channelToClose.close() + Log.d(TAG, "P2P channel closed") + } catch (e: Exception) { + Log.w(TAG, "Error closing P2P channel", e) + } + } + /** * Get current connection information. */ @@ -202,28 +243,103 @@ class HotspotManager(private val context: Context) { } /** - * Start Wi-Fi P2P framework with retry logic. + * Initialise the P2P framework once. Every retry reuses this channel — calling + * initialize() per attempt registers a fresh binder with WifiP2pService that is + * never reclaimed until the process dies. */ - private fun startWifiP2pFramework(attempt: Int) { - if (attempt > MAX_FRAMEWORK_ATTEMPTS) { - Log.e(TAG, "Failed to start P2P framework after $MAX_FRAMEWORK_ATTEMPTS attempts") - failStartup("Failed to start hotspot. Please try again.") - return - } + private fun startWifiP2pFramework() { + Log.d(TAG, "Initialising P2P channel") - Log.d(TAG, "Starting P2P framework (attempt $attempt/$MAX_FRAMEWORK_ATTEMPTS)") + val newChannel = wifiP2pManager?.initialize(context, Looper.getMainLooper(), null) - channel = wifiP2pManager?.initialize(context, Looper.getMainLooper(), null) - - if (channel == null) { + if (newChannel == null) { + // The service is unobtainable; retrying will not change that. Log.e(TAG, "Failed to initialize P2P channel") - handler.postDelayed({ - startWifiP2pFramework(attempt + 1) - }, RETRY_DELAY_MILLIS) + failStartup(HotspotStartupPolicy.P2P_UNSUPPORTED_MESSAGE) return } - createGroup(attempt) + channel = newChannel + createGroupWhenP2pAvailable() + } + + /** + * Ask the framework for the current P2P state before the first attempt. + * + * When P2P is disabled the state machine answers every createGroup with BUSY — + * the same code a genuinely transient collision returns — so without this check + * a permanent failure is indistinguishable from a retryable one. + */ + @SuppressLint("MissingPermission") + private fun createGroupWhenP2pAvailable() { + val ch = channel ?: return + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + clearStaleGroupThenCreate(ch, attempt = 1) + return + } + + try { + wifiP2pManager?.requestP2pState(ch) { state -> + if (channel !== ch) return@requestP2pState + lastP2pState = state + clearStaleGroupThenCreate(ch, attempt = 1) + } + } catch (e: SecurityException) { + Log.e(TAG, "Wi-Fi permission was revoked while reading P2P state", e) + failStartup("A required Wi-Fi or local network permission was revoked. Grant it and try again.") + } + } + + /** + * A P2P group survives the process that created it, so a previous session killed + * while hosting leaves an orphan behind. The framework then rejects createGroup + * with BUSY for as long as that group exists, which no retry can clear. + */ + @SuppressLint("MissingPermission") + private fun clearStaleGroupThenCreate(ch: Channel, attempt: Int) { + try { + wifiP2pManager?.requestGroupInfo(ch) { existingGroup -> + if (channel !== ch) return@requestGroupInfo + + val action = HotspotStartupPolicy.startAction( + p2pState = lastP2pState, + existingGroupName = existingGroup?.networkName, + ownedGroupName = ownedGroupName + ) + + when (action) { + is HotspotStartupPolicy.StartAction.Fail -> { + Log.w(TAG, "Not attempting group creation: ${action.message}") + failStartup(action.message) + } + HotspotStartupPolicy.StartAction.Create -> createGroup(attempt) + HotspotStartupPolicy.StartAction.RemoveStaleGroupThenCreate -> { + Log.w(TAG, "Removing stale group '${existingGroup?.networkName}' before creating") + removeStaleGroup(ch, attempt) + } + } + } + } catch (e: SecurityException) { + Log.e(TAG, "Wi-Fi permission was revoked while reading group info", e) + failStartup("A required Wi-Fi or local network permission was revoked. Grant it and try again.") + } + } + + private fun removeStaleGroup(ch: Channel, attempt: Int) { + wifiP2pManager?.removeGroup(ch, object : ActionListener { + override fun onSuccess() { + if (channel !== ch) return + Log.d(TAG, "Stale group removed") + createGroup(attempt) + } + override fun onFailure(reason: Int) { + if (channel !== ch) return + // Creation may still succeed, and a BUSY reply here backs off as usual. + Log.w(TAG, "Failed to remove stale group: $reason; attempting creation anyway") + createGroup(attempt) + } + }) } /** @@ -235,6 +351,10 @@ class HotspotManager(private val context: Context) { try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + // Record before the call: if the process dies between creation and the + // first group info, the next run still knows this orphan is ours. + ownedGroupName = savedSsid + // Android 10+: Custom SSID and password val config = WifiP2pConfig.Builder() .setNetworkName(savedSsid!!) @@ -274,7 +394,7 @@ class HotspotManager(private val context: Context) { } /** - * Handle group creation failure with retry logic. + * Handle group creation failure, backing off only for genuinely transient causes. */ private fun handleGroupCreationFailure(reason: Int, attempt: Int) { val reasonStr = when (reason) { @@ -284,16 +404,22 @@ class HotspotManager(private val context: Context) { else -> "UNKNOWN($reason)" } - Log.w(TAG, "Failed to create group: $reasonStr") + Log.w( + TAG, + "Failed to create group: $reasonStr " + + "(attempt $attempt/${HotspotStartupPolicy.MAX_ATTEMPTS}, p2pState=$lastP2pState)" + ) - if (reason == BUSY && attempt < MAX_FRAMEWORK_ATTEMPTS) { - // Framework is busy, retry - Log.d(TAG, "P2P framework busy, retrying...") - handler.postDelayed({ - startWifiP2pFramework(attempt + 1) - }, RETRY_DELAY_MILLIS) - } else { - failStartup("Failed to create hotspot: $reasonStr") + when (val decision = HotspotStartupPolicy.decide(reason, attempt, lastP2pState)) { + is HotspotStartupPolicy.Decision.Retry -> { + Log.d(TAG, "Retrying group creation in ${decision.delayMillis}ms") + handler.postDelayed({ + // Re-check for a stale group each round: BUSY is also how the + // framework reports "a group already exists". + channel?.let { clearStaleGroupThenCreate(it, attempt + 1) } + }, decision.delayMillis) + } + is HotspotStartupPolicy.Decision.Fail -> failStartup(decision.message) } } @@ -355,6 +481,9 @@ class HotspotManager(private val context: Context) { savedPassword = group.passphrase } + // Authoritative name straight from the framework + group.networkName?.let { ownedGroupName = it } + // Notify callback on FIRST successful group info retrieval if (!hasNotifiedStarted) { hasNotifiedStarted = true @@ -460,7 +589,7 @@ class HotspotManager(private val context: Context) { val suffix = (1..SSID_SUFFIX_LENGTH) .map { RANDOM_CHARS[random.nextInt(RANDOM_CHARS.length)] } .joinToString("") - return "$SSID_PREFIX$suffix" + return "${HotspotStartupPolicy.SSID_PREFIX}$suffix" } /** diff --git a/app/src/main/java/com/bitchat/android/hotspot/HotspotStartupPolicy.kt b/app/src/main/java/com/bitchat/android/hotspot/HotspotStartupPolicy.kt new file mode 100644 index 00000000..48284d0a --- /dev/null +++ b/app/src/main/java/com/bitchat/android/hotspot/HotspotStartupPolicy.kt @@ -0,0 +1,91 @@ +package com.bitchat.android.hotspot + +import android.net.wifi.p2p.WifiP2pManager + +/** + * Decides how to react to a Wi-Fi P2P group-creation failure. + * + * Kept free of Android dependencies so the retry strategy is unit testable. + */ +internal object HotspotStartupPolicy { + + const val MAX_ATTEMPTS = 5 + const val INITIAL_RETRY_DELAY_MILLIS = 1_000L + const val MAX_RETRY_DELAY_MILLIS = 8_000L + + const val P2P_DISABLED_MESSAGE = + "Wi-Fi Direct is unavailable. Turn Wi-Fi off and back on, then try again." + /** Marks groups this app creates. Shared with [HotspotManager] so the two cannot drift. */ + const val SSID_PREFIX = "DIRECT-BC-" // BC for BitChat + + const val P2P_UNSUPPORTED_MESSAGE = "Wi-Fi Direct is not supported on this device." + const val FOREIGN_GROUP_MESSAGE = + "Another app is using Wi-Fi Direct. Close it and try again." + const val P2P_BUSY_MESSAGE = "Wi-Fi Direct is busy. Please try again in a moment." + const val GENERIC_FAILURE_MESSAGE = "Failed to start the hotspot. Please try again." + + sealed interface Decision { + data class Retry(val delayMillis: Long) : Decision + data class Fail(val message: String) : Decision + } + + sealed interface StartAction { + data object Create : StartAction + data object RemoveStaleGroupThenCreate : StartAction + data class Fail(val message: String) : StartAction + } + + /** + * Decides what to do before the first group-creation attempt. + * + * A P2P group outlives the process that created it, so an app killed while + * hosting leaves an orphan behind. The framework rejects createGroup with BUSY + * while any group exists, and no amount of retrying clears it. + * + * Wi-Fi Direct is shared with Cast, Android Auto and Quick Share, so only groups + * we can show are ours get torn down. + * + * @param existingGroupName network name of the group already present, or null + * @param ownedGroupName last group name this app recorded creating, or null + */ + fun startAction( + p2pState: Int?, + existingGroupName: String?, + ownedGroupName: String? + ): StartAction = when { + p2pState == WifiP2pManager.WIFI_P2P_STATE_DISABLED -> StartAction.Fail(P2P_DISABLED_MESSAGE) + existingGroupName == null -> StartAction.Create + isOurs(existingGroupName, ownedGroupName) -> StartAction.RemoveStaleGroupThenCreate + else -> StartAction.Fail(FOREIGN_GROUP_MESSAGE) + } + + /** + * Primary signal is the name we recorded creating. The SSID prefix is only a + * fallback, covering orphans left by builds that predate that record. + */ + private fun isOurs(existingGroupName: String, ownedGroupName: String?): Boolean = + existingGroupName == ownedGroupName || existingGroupName.startsWith(SSID_PREFIX) + + /** + * @param reason a [WifiP2pManager] failure reason from `ActionListener.onFailure` + * @param attempt 1-based attempt that just failed + * @param p2pState last known [WifiP2pManager.EXTRA_WIFI_STATE], or null if no + * state broadcast has arrived yet + */ + fun decide(reason: Int, attempt: Int, p2pState: Int?): Decision = when { + reason == WifiP2pManager.P2P_UNSUPPORTED -> Decision.Fail(P2P_UNSUPPORTED_MESSAGE) + + reason != WifiP2pManager.BUSY -> Decision.Fail(GENERIC_FAILURE_MESSAGE) + + // BUSY is the framework's catch-all reply when the P2P state machine is + // disabled, so retrying cannot help — surface something actionable instead. + p2pState == WifiP2pManager.WIFI_P2P_STATE_DISABLED -> Decision.Fail(P2P_DISABLED_MESSAGE) + + attempt >= MAX_ATTEMPTS -> Decision.Fail(P2P_BUSY_MESSAGE) + + else -> Decision.Retry(retryDelayMillis(attempt)) + } + + private fun retryDelayMillis(attempt: Int): Long = + (INITIAL_RETRY_DELAY_MILLIS shl (attempt - 1)).coerceAtMost(MAX_RETRY_DELAY_MILLIS) +} diff --git a/app/src/main/java/com/bitchat/android/hotspot/HotspotViewModel.kt b/app/src/main/java/com/bitchat/android/hotspot/HotspotViewModel.kt index 50b04855..581b1d99 100644 --- a/app/src/main/java/com/bitchat/android/hotspot/HotspotViewModel.kt +++ b/app/src/main/java/com/bitchat/android/hotspot/HotspotViewModel.kt @@ -4,6 +4,7 @@ import android.app.Application import android.util.Log import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope +import com.bitchat.android.wifiaware.WifiAwareController import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow @@ -40,6 +41,10 @@ class HotspotViewModel(application: Application) : AndroidViewModel(application) viewModelScope.launch { try { + // Wi-Fi Aware holds a NAN interface that blocks the P2P one; release it + // first or every createGroup comes back BUSY. Restored when we stop. + WifiAwareController.holdForHotspot() + // Start hotspot val manager = HotspotManager(context) hotspotManager = manager @@ -52,8 +57,7 @@ class HotspotViewModel(application: Application) : AndroidViewModel(application) // Get connection info val info = manager.getConnectionInfo() if (info == null) { - manager.stopHotspot() - _state.value = HotspotState.Error("Failed to get hotspot connection info") + failWith("Failed to get hotspot connection info") return@launch } @@ -75,8 +79,7 @@ class HotspotViewModel(application: Application) : AndroidViewModel(application) ) } catch (e: Exception) { Log.e(TAG, "Failed to start web server", e) - manager.stopHotspot() - _state.value = HotspotState.Error("Failed to start web server: ${e.message}") + failWith("Failed to start web server: ${e.message}") } } } @@ -92,17 +95,13 @@ class HotspotViewModel(application: Application) : AndroidViewModel(application) } override fun onError(message: String) { - viewModelScope.launch { - Log.e(TAG, "Hotspot error: $message") - _state.value = HotspotState.Error(message) - } + viewModelScope.launch { failWith(message) } } }) } catch (e: Exception) { Log.e(TAG, "Error starting hotspot", e) - hotspotManager?.stopHotspot() - _state.value = HotspotState.Error(e.message ?: "Unknown error") + failWith(e.message ?: "Unknown error") } } } @@ -112,14 +111,33 @@ class HotspotViewModel(application: Application) : AndroidViewModel(application) */ fun stopHotspot() { Log.d(TAG, "Stopping hotspot") + teardown() + _state.value = HotspotState.Intro + } + /** + * Every failure after the hotspot has been requested must land here. + * + * Skipping any part of this leaves something running that shouldn't be: the web + * server keeps serving the APK on whatever network the device joins next, and the + * Wi-Fi Aware hold blocks the mesh until the user happens to retry or close the + * screen. + */ + private fun failWith(message: String) { + Log.e(TAG, "Hotspot failed: $message") + teardown() + _state.value = HotspotState.Error(message) + } + + /** Releases every resource startHotspot may have acquired. Safe to call twice. */ + private fun teardown() { webServer?.stopServer() webServer = null hotspotManager?.stopHotspot() hotspotManager = null - _state.value = HotspotState.Intro + WifiAwareController.releaseHotspotHold() } /** diff --git a/app/src/main/java/com/bitchat/android/identity/SecureIdentityStateManager.kt b/app/src/main/java/com/bitchat/android/identity/SecureIdentityStateManager.kt index ab00b137..1efa87a2 100644 --- a/app/src/main/java/com/bitchat/android/identity/SecureIdentityStateManager.kt +++ b/app/src/main/java/com/bitchat/android/identity/SecureIdentityStateManager.kt @@ -528,4 +528,11 @@ class SecureIdentityStateManager { } editor.apply() } + + /** Use for panic paths that must finish the disk mutation before identity reset continues. */ + fun clearSecureValuesSynchronously(vararg keys: String): Boolean { + val editor = prefs.edit() + keys.forEach(editor::remove) + return editor.commit() + } } diff --git a/app/src/main/java/com/bitchat/android/mesh/BluetoothMeshService.kt b/app/src/main/java/com/bitchat/android/mesh/BluetoothMeshService.kt index f828af9e..9c8f8eef 100644 --- a/app/src/main/java/com/bitchat/android/mesh/BluetoothMeshService.kt +++ b/app/src/main/java/com/bitchat/android/mesh/BluetoothMeshService.kt @@ -115,8 +115,7 @@ class BluetoothMeshService(private val context: Context) : TransportBridgeServic // Service-level notification manager for background (no-UI) DMs private val serviceNotificationManager = com.bitchat.android.ui.NotificationManager( context.applicationContext, - androidx.core.app.NotificationManagerCompat.from(context.applicationContext), - com.bitchat.android.util.NotificationIntervalManager() + androidx.core.app.NotificationManagerCompat.from(context.applicationContext) ) // Service state management @@ -480,21 +479,13 @@ class BluetoothMeshService(private val context: Context) : TransportBridgeServic // Callbacks override fun onMessageReceived(message: BitchatMessage) { - // Always reflect into process-wide store so UI can hydrate after recreation - try { - when { - message.isPrivate -> { - val peer = message.senderPeerID ?: "" - if (peer.isNotEmpty()) com.bitchat.android.services.AppStateStore.addPrivateMessage(peer, message) - } - message.channel != null -> { - com.bitchat.android.services.AppStateStore.addChannelMessage(message.channel!!, message) - } - else -> { - com.bitchat.android.services.AppStateStore.addPublicMessage(message) - } - } - } catch (_: Exception) { } + // Private-message admission is authoritative. In particular, do not forward a + // callback or notify after panic mode rejected the message while wiping state. + if ( + !com.bitchat.android.services.IncomingMessageAdmission + .admitToAppState(message) + ) return + // And forward to UI delegate if attached delegate?.didReceiveMessage(message) diff --git a/app/src/main/java/com/bitchat/android/mesh/MeshCore.kt b/app/src/main/java/com/bitchat/android/mesh/MeshCore.kt index ae1f535a..093e3766 100644 --- a/app/src/main/java/com/bitchat/android/mesh/MeshCore.kt +++ b/app/src/main/java/com/bitchat/android/mesh/MeshCore.kt @@ -41,7 +41,11 @@ class MeshCore( private val hooks: Hooks = Hooks() ) { data class Hooks( - val onMessageReceived: ((BitchatMessage) -> Unit)? = null, + /** + * Reflects a decoded message into transport-owned state before delegate dispatch. + * Return false to suppress all downstream effects for a rejected message. + */ + val onMessageReceived: ((BitchatMessage) -> Boolean)? = null, val onAnnounceProcessed: ((RoutedPacket, Boolean) -> Unit)? = null, val readReceiptInterceptor: ((String, String) -> Boolean)? = null, val onReadReceiptSent: ((String) -> Unit)? = null, @@ -392,7 +396,7 @@ class MeshCore( } override fun onMessageReceived(message: BitchatMessage) { - hooks.onMessageReceived?.invoke(message) + if (hooks.onMessageReceived?.invoke(message) == false) return delegate?.didReceiveMessage(message) } diff --git a/app/src/main/java/com/bitchat/android/nostr/NostrDirectMessageHandler.kt b/app/src/main/java/com/bitchat/android/nostr/NostrDirectMessageHandler.kt index 2fdc3180..fffcdab7 100644 --- a/app/src/main/java/com/bitchat/android/nostr/NostrDirectMessageHandler.kt +++ b/app/src/main/java/com/bitchat/android/nostr/NostrDirectMessageHandler.kt @@ -132,7 +132,14 @@ class NostrDirectMessageHandler( val favoriteControl = FavoriteControlMessage.parse(pm.content) if (favoriteControl != null) { - handleFavoriteControl(favoriteControl, conversationID, senderNickname, timestamp, senderPubkey) + val admitted = handleFavoriteControl( + favoriteControl, + conversationID, + senderNickname, + timestamp, + senderPubkey + ) + if (!admitted) return if (!seenStore.hasDelivered(pm.messageID)) { val nostrTransport = NostrTransport.getInstance(application) nostrTransport.sendDeliveryAckGeohash(pm.messageID, senderPubkey, recipientIdentity) @@ -157,13 +164,14 @@ class NostrDirectMessageHandler( val isViewing = state.getSelectedPrivateChatPeerValue() == conversationID val suppressUnread = seenStore.hasBeenReadLocally(pm.messageID) - withContext(Dispatchers.Main) { - privateChatManager.handleIncomingPrivateMessage( + val admitted = withContext(Dispatchers.Main) { + privateChatManager.handleIncomingPrivateMessageDurably( message = message, suppressUnread = suppressUnread, origin = PrivateMessageOrigin.NOSTR ) } + if (!admitted) return if (!seenStore.hasDelivered(pm.messageID)) { val nostrTransport = NostrTransport.getInstance(application) @@ -215,13 +223,19 @@ class NostrDirectMessageHandler( senderNostrPubkey = senderPubkey ) Log.d(TAG, "📄 Saved Nostr encrypted incoming file to $savedPath (msgId=$uniqueMsgId)") - withContext(Dispatchers.Main) { - privateChatManager.handleIncomingPrivateMessage( + val admitted = withContext(Dispatchers.Main) { + privateChatManager.handleIncomingPrivateMessageDurably( message = message, suppressUnread = false, origin = PrivateMessageOrigin.NOSTR ) } + if (!admitted) { + com.bitchat.android.features.file.FileUtils.deleteStoredMediaPaths( + application, + listOf(savedPath) + ) + } } else { Log.w(TAG, "Failed to decode Nostr file transfer from $conversationID") } @@ -238,15 +252,15 @@ class NostrDirectMessageHandler( senderNickname: String, timestamp: Date, senderPubkey: String - ) { - try { + ): Boolean { + return try { val senderNpub = control.npub ?: ContactIdentityResolver.npubFromHex(senderPubkey) val noiseKey = senderNpub?.let { FavoritesPersistenceService.shared.findNoiseKey(it) } ?: FavoritesPersistenceService.shared.findNoiseKey(senderPubkey) if (noiseKey == null) { Log.w(TAG, "Favorite notification from Nostr sender without known Noise key: ${senderPubkey.take(16)}...") - return + return false } FavoritesPersistenceService.shared.updatePeerFavoritedUs(noiseKey, control.isFavorite) @@ -278,7 +292,7 @@ class NostrDirectMessageHandler( ) withContext(Dispatchers.Main) { - privateChatManager.handleIncomingPrivateMessage( + privateChatManager.handleIncomingPrivateMessageDurably( message = systemMessage, suppressUnread = true, origin = PrivateMessageOrigin.NOSTR @@ -286,6 +300,7 @@ class NostrDirectMessageHandler( } } catch (e: Exception) { Log.w(TAG, "Failed to handle Nostr favorite notification: ${e.message}") + false } } diff --git a/app/src/main/java/com/bitchat/android/onboarding/OnboardingCoordinator.kt b/app/src/main/java/com/bitchat/android/onboarding/OnboardingCoordinator.kt index 674deb7d..641b3a5a 100644 --- a/app/src/main/java/com/bitchat/android/onboarding/OnboardingCoordinator.kt +++ b/app/src/main/java/com/bitchat/android/onboarding/OnboardingCoordinator.kt @@ -85,9 +85,7 @@ class OnboardingCoordinator( val missingRequired = permissionManager.getMissingPermissions() // Optional permissions (ask, but do not block if denied) - val optionalToRequest = permissionManager - .getOptionalPermissions() - .filter { !permissionManager.isPermissionGranted(it) } + val optionalToRequest = permissionManager.getUnrequestedOptionalPermissions() val missingPermissions = (missingRequired + optionalToRequest).distinct() @@ -101,6 +99,7 @@ class OnboardingCoordinator( } Log.d(TAG, "Requesting ${missingPermissions.size} permissions") + permissionManager.markOptionalPermissionsRequested(optionalToRequest) permissionLauncher?.launch(missingPermissions.toTypedArray()) } @@ -115,7 +114,10 @@ class OnboardingCoordinator( val allGranted = permissions.values.all { it } val criticalPermissions = getCriticalPermissions() - val criticalGranted = criticalPermissions.all { permissions[it] == true } + // The launcher result only contains permissions requested in this round. Returning + // users may be asked for POST_NOTIFICATIONS alone, so re-check required permissions + // against package state instead of treating absent result-map entries as denials. + val criticalGranted = criticalPermissions.all(permissionManager::isPermissionGranted) when { criticalGranted -> { diff --git a/app/src/main/java/com/bitchat/android/onboarding/PermissionManager.kt b/app/src/main/java/com/bitchat/android/onboarding/PermissionManager.kt index 23235068..8d61d10e 100644 --- a/app/src/main/java/com/bitchat/android/onboarding/PermissionManager.kt +++ b/app/src/main/java/com/bitchat/android/onboarding/PermissionManager.kt @@ -19,6 +19,8 @@ class PermissionManager(private val context: Context) { private const val TAG = "PermissionManager" private const val PREFS_NAME = "bitchat_permissions" private const val KEY_FIRST_TIME_COMPLETE = "first_time_onboarding_complete" + private const val KEY_OPTIONAL_PERMISSION_REQUESTED_PREFIX = + "optional_permission_requested_" } private val sharedPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) @@ -149,6 +151,32 @@ class PermissionManager(private val context: Context) { return optional } + /** + * Optional permissions are prompted once. A denial must not trap returning users in + * onboarding, while users upgrading to a notification-permission Android version + * should still receive one contextual request. + */ + fun getUnrequestedOptionalPermissions(): List { + return getOptionalPermissions().filter { permission -> + !isPermissionGranted(permission) && + !sharedPrefs.getBoolean(optionalPermissionRequestKey(permission), false) + } + } + + fun markOptionalPermissionsRequested(permissions: Collection) { + if (permissions.isEmpty()) return + + sharedPrefs.edit().apply { + permissions.forEach { permission -> + putBoolean(optionalPermissionRequestKey(permission), true) + } + }.apply() + } + + private fun optionalPermissionRequestKey(permission: String): String { + return KEY_OPTIONAL_PERMISSION_REQUESTED_PREFIX + permission + } + /** * Check if a specific permission is granted */ diff --git a/app/src/main/java/com/bitchat/android/service/AppShutdownCoordinator.kt b/app/src/main/java/com/bitchat/android/service/AppShutdownCoordinator.kt index 30a641d0..cdef409f 100644 --- a/app/src/main/java/com/bitchat/android/service/AppShutdownCoordinator.kt +++ b/app/src/main/java/com/bitchat/android/service/AppShutdownCoordinator.kt @@ -64,6 +64,12 @@ object AppShutdownCoordinator { val torStop = async { try { torProvider.applyMode(app, TorMode.OFF) } catch (_: Exception) { } } + val conversationFlush = async { + try { + com.bitchat.android.services.AppStateStore + .awaitConversationPersistence() + } catch (_: Exception) { } + } // Clear AppState in-memory store try { com.bitchat.android.services.AppStateStore.clear() } catch (_: Exception) { } @@ -75,6 +81,7 @@ object AppShutdownCoordinator { // Wait up to 5 seconds for shutdown tasks withTimeoutOrNull(5000) { try { torStop.await() } catch (_: Exception) { } + try { conversationFlush.await() } catch (_: Exception) { } delay(100) } diff --git a/app/src/main/java/com/bitchat/android/service/ConversationNotificationReceiver.kt b/app/src/main/java/com/bitchat/android/service/ConversationNotificationReceiver.kt new file mode 100644 index 00000000..6feca2a7 --- /dev/null +++ b/app/src/main/java/com/bitchat/android/service/ConversationNotificationReceiver.kt @@ -0,0 +1,88 @@ +package com.bitchat.android.service + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import androidx.core.app.RemoteInput +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.DeliveryStatus +import com.bitchat.android.services.AppStateStore +import com.bitchat.android.services.ContactDirectory +import com.bitchat.android.services.MessageRouter +import com.bitchat.android.ui.NotificationManager +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.launch +import java.util.Date +import java.util.UUID + +/** Handles privacy-scoped direct reply and mark-read actions from DM notifications. */ +class ConversationNotificationReceiver : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + val conversationID = intent.getStringExtra(NotificationManager.EXTRA_PEER_ID) + ?.let(ContactDirectory::canonicalConversationId) + ?: return + val pendingResult = goAsync() + CoroutineScope(SupervisorJob() + Dispatchers.IO).launch { + try { + var acknowledged = false + when (intent.action) { + NotificationManager.ACTION_MARK_CONVERSATION_READ -> { + acknowledged = + AppStateStore.setPrivateConversationRead(conversationID, true) + } + + NotificationManager.ACTION_REPLY_TO_CONVERSATION -> { + val reply = RemoteInput.getResultsFromIntent(intent) + ?.getCharSequence(NotificationManager.KEY_TEXT_REPLY) + ?.toString() + ?.trim() + ?.takeIf(String::isNotEmpty) + ?: return@launch + // A notification can outlive the process/service that posted it. Promote + // the mesh runtime before dispatch so Android keeps the transport alive + // after this short-lived receiver finishes. + MeshForegroundService.start(context.applicationContext) + val mesh = MeshServiceHolder.getUnifiedOrCreate( + context.applicationContext + ) + val message = BitchatMessage( + id = UUID.randomUUID().toString().uppercase(), + sender = mesh.myPeerID, + content = reply, + timestamp = Date(), + isPrivate = true, + recipientNickname = intent.getStringExtra( + NotificationManager.EXTRA_SENDER_NICKNAME + ), + senderPeerID = mesh.myPeerID, + deliveryStatus = DeliveryStatus.Sending + ) + val persisted = AppStateStore.addPrivateMessageDurably( + peerID = conversationID, + msg = message, + forceRead = true + ) + if (persisted) { + MessageRouter.getInstance(context.applicationContext, mesh) + .sendPrivate( + content = reply, + toPeerID = conversationID, + recipientNickname = message.recipientNickname.orEmpty(), + messageID = message.id + ) + acknowledged = + AppStateStore.setPrivateConversationRead(conversationID, true) + } + } + } + if (acknowledged) { + NotificationManager.acknowledgeConversation(context, conversationID) + } + } finally { + pendingResult.finish() + } + } + } +} diff --git a/app/src/main/java/com/bitchat/android/service/MeshForegroundService.kt b/app/src/main/java/com/bitchat/android/service/MeshForegroundService.kt index 2f70bf84..3af70da3 100644 --- a/app/src/main/java/com/bitchat/android/service/MeshForegroundService.kt +++ b/app/src/main/java/com/bitchat/android/service/MeshForegroundService.kt @@ -13,6 +13,8 @@ import android.os.IBinder import android.util.Log import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.ProcessLifecycleOwner import com.bitchat.android.MainActivity import com.bitchat.android.R import com.bitchat.android.mesh.BluetoothMeshService @@ -33,7 +35,6 @@ class MeshForegroundService : Service() { const val ACTION_STOP = "com.bitchat.android.service.STOP" const val ACTION_QUIT = "com.bitchat.android.service.QUIT" const val ACTION_UPDATE_NOTIFICATION = "com.bitchat.android.service.UPDATE_NOTIFICATION" - const val ACTION_NOTIFICATION_PERMISSION_GRANTED = "com.bitchat.android.action.NOTIFICATION_PERMISSION_GRANTED" fun start(context: Context) { val intent = Intent(context, MeshForegroundService::class.java).apply { action = ACTION_START } @@ -59,22 +60,6 @@ class MeshForegroundService : Service() { } } - /** - * Helper to be invoked right after POST_NOTIFICATIONS is granted to try - * promoting/starting the foreground service immediately without polling. - */ - fun onNotificationPermissionGranted(context: Context) { - // If background is enabled and permission now granted, start/promo service - if (!shouldStartAsForeground(context)) return - - val intent = Intent(context, MeshForegroundService::class.java).apply { action = ACTION_UPDATE_NOTIFICATION } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(intent) - } else { - context.startService(intent) - } - } - fun stop(context: Context) { val intent = Intent(context, MeshForegroundService::class.java).apply { action = ACTION_STOP } context.startService(intent) @@ -82,8 +67,7 @@ class MeshForegroundService : Service() { private fun shouldStartAsForeground(context: Context): Boolean { return MeshServicePreferences.isBackgroundEnabled(true) && - hasBluetoothPermissionsStatic(context) && - hasNotificationPermissionStatic(context) + hasBluetoothPermissionsStatic(context) } private fun hasBluetoothPermissionsStatic(ctx: Context): Boolean { @@ -98,14 +82,10 @@ class MeshForegroundService : Service() { } } - private fun hasNotificationPermissionStatic(ctx: Context): Boolean { - return if (Build.VERSION.SDK_INT >= 33) { - androidx.core.content.ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.POST_NOTIFICATIONS) == android.content.pm.PackageManager.PERMISSION_GRANTED - } else true - } } private lateinit var notificationManager: NotificationManagerCompat + private lateinit var peerAvailabilityNotifier: PeerAvailabilityNotifier private var updateJob: Job? = null private val meshService: BluetoothMeshService? get() = MeshServiceHolder.meshService @@ -121,6 +101,7 @@ class MeshForegroundService : Service() { override fun onCreate() { super.onCreate() notificationManager = NotificationManagerCompat.from(this) + peerAvailabilityNotifier = PeerAvailabilityNotifier(applicationContext) createChannel() // Ensure mesh service exists in holder (create if needed) @@ -139,7 +120,14 @@ class MeshForegroundService : Service() { com.bitchat.android.services.AppStateStore.peers .map { peers -> peers.distinct().size } .distinctUntilChanged() - .collect { + .collect { peerCount -> + peerAvailabilityNotifier.onPeerCountChanged( + peerCount = peerCount, + isAppInBackground = !ProcessLifecycleOwner.get() + .lifecycle + .currentState + .isAtLeast(Lifecycle.State.STARTED) + ) if (isInForeground) updateNotification(force = false) } } @@ -156,11 +144,13 @@ class MeshForegroundService : Service() { when (intent?.action) { ACTION_STOP -> { // Stop FGS and mesh cleanly + updateJob?.cancel() + updateJob = null try { com.bitchat.android.services.MessageRouter.tryGetInstance()?.stopOutboxScheduler() } catch (_: Exception) { } try { unifiedMeshService?.stopServices() ?: meshService?.stopServices() } catch (_: Exception) { } try { MeshServiceHolder.clear() } catch (_: Exception) { } try { stopForeground(true) } catch (_: Exception) { } - notificationManager.cancel(NOTIFICATION_ID) + clearMeshNotifications() isInForeground = false stopSelf() return START_NOT_STICKY @@ -170,7 +160,7 @@ class MeshForegroundService : Service() { updateJob?.cancel() updateJob = null try { stopForeground(true) } catch (_: Exception) { } - notificationManager.cancel(NOTIFICATION_ID) + clearMeshNotifications() isInForeground = false // Fully stop all background activity, stop Tor (without changing setting), then kill the app AppShutdownCoordinator.requestFullShutdownAndKill( @@ -203,7 +193,9 @@ class MeshForegroundService : Service() { // Ensure mesh is running (only after permissions are granted) ensureMeshStarted() - // Promote exactly once when eligible, otherwise stay background (or stop) + // Promote exactly once when eligible, otherwise stay background (or stop). + // POST_NOTIFICATIONS is intentionally not an eligibility requirement: Android 13+ + // still allows foreground services and exposes them in the system task manager. if (MeshServicePreferences.isBackgroundEnabled(true) && hasAllRequiredPermissions() && !isInForeground) { val count = getUnifiedActivePeerCount() val notification = buildNotification(count) @@ -234,30 +226,35 @@ class MeshForegroundService : Service() { private fun updateNotification(force: Boolean) { if (isShuttingDown) { - notificationManager.cancel(NOTIFICATION_ID) + clearMeshNotifications() return } val count = getUnifiedActivePeerCount() if (MeshServicePreferences.isBackgroundEnabled(true) && hasAllRequiredPermissions()) { if (lastNotifiedPeerCount != count) { - notificationManager.notify(NOTIFICATION_ID, buildNotification(count)) + startForegroundCompat(buildNotification(count)) lastNotifiedPeerCount = count } } else if (force) { // If disabled and forced, make sure to remove any prior foreground state try { stopForeground(false) } catch (_: Exception) { } - notificationManager.cancel(NOTIFICATION_ID) + clearMeshNotifications() isInForeground = false lastNotifiedPeerCount = null } } + private fun clearMeshNotifications() { + notificationManager.cancel(NOTIFICATION_ID) + peerAvailabilityNotifier.clear() + } + private fun hasAllRequiredPermissions(): Boolean { // For starting FGS with connectedDevice|dataSync, we need: // - Foreground service permissions (declared in manifest) // - One of the device-related permissions (we request BL perms at runtime) - // - On Android 13+, POST_NOTIFICATIONS to actually show notification - return hasBluetoothPermissions() && hasNotificationPermission() + // POST_NOTIFICATIONS controls notification-drawer visibility, not FGS eligibility. + return hasBluetoothPermissions() } private fun getUnifiedActivePeerCount(): Int { @@ -281,12 +278,6 @@ class MeshForegroundService : Service() { } } - private fun hasNotificationPermission(): Boolean { - return if (Build.VERSION.SDK_INT >= 33) { - androidx.core.content.ContextCompat.checkSelfPermission(this, android.Manifest.permission.POST_NOTIFICATIONS) == android.content.pm.PackageManager.PERMISSION_GRANTED - } else true - } - private fun buildNotification(activePeers: Int): Notification { val openIntent = Intent(this, MainActivity::class.java) val pendingIntent = PendingIntent.getActivity( diff --git a/app/src/main/java/com/bitchat/android/service/PeerAvailabilityNotifier.kt b/app/src/main/java/com/bitchat/android/service/PeerAvailabilityNotifier.kt new file mode 100644 index 00000000..8639ad22 --- /dev/null +++ b/app/src/main/java/com/bitchat/android/service/PeerAvailabilityNotifier.kt @@ -0,0 +1,249 @@ +package com.bitchat.android.service + +import android.Manifest +import android.annotation.SuppressLint +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import android.util.Log +import androidx.core.app.NotificationCompat +import androidx.core.app.NotificationManagerCompat +import androidx.core.content.ContextCompat +import androidx.core.content.edit +import com.bitchat.android.MainActivity +import com.bitchat.android.R + +internal enum class PeerAvailabilityAction { + NONE, + SHOW, + CLEAR +} + +internal interface PeerAvailabilityAlertHistory { + var lastAlertAtMillis: Long? +} + +internal class SharedPreferencesPeerAvailabilityAlertHistory( + context: Context +) : PeerAvailabilityAlertHistory { + companion object { + internal const val PREFERENCES_NAME = "peer_availability_notifications" + private const val KEY_LAST_ALERT_AT_MILLIS = "last_alert_at_millis" + } + + private val preferences = + context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE) + + override var lastAlertAtMillis: Long? + get() = if (preferences.contains(KEY_LAST_ALERT_AT_MILLIS)) { + preferences.getLong(KEY_LAST_ALERT_AT_MILLIS, 0L) + } else { + null + } + set(value) { + preferences.edit { + if (value == null) { + remove(KEY_LAST_ALERT_AT_MILLIS) + } else { + putLong(KEY_LAST_ALERT_AT_MILLIS, value) + } + } + } +} + +/** + * Tracks mesh availability epochs with two anti-flapping gates: + * - no more than one alert per persisted cooldown window; + * - after an alert, the mesh must remain empty before another epoch can re-arm. + */ +internal class PeerAvailabilityTracker( + private val alertHistory: PeerAvailabilityAlertHistory, + private val nowMillis: () -> Long = System::currentTimeMillis, + private val alertCooldownMs: Long = ALERT_COOLDOWN_MS, + private val emptyRearmDelayMs: Long = EMPTY_REARM_DELAY_MS +) { + companion object { + internal const val ALERT_COOLDOWN_MS = 5 * 60_000L + internal const val EMPTY_REARM_DELAY_MS = 30_000L + } + + private var previousPeerCount = 0 + private var isArmed = true + private var emptySinceMillis: Long? = null + + init { + require(alertCooldownMs >= 0) { "alertCooldownMs must not be negative" } + require(emptyRearmDelayMs >= 0) { "emptyRearmDelayMs must not be negative" } + } + + fun update(peerCount: Int, isAppInBackground: Boolean): PeerAvailabilityAction { + require(peerCount >= 0) { "peerCount must not be negative" } + + val now = nowMillis() + if (peerCount == 0) { + if (previousPeerCount > 0 || emptySinceMillis == null) { + emptySinceMillis = now + } + previousPeerCount = 0 + return PeerAvailabilityAction.CLEAR + } + + val transitionedFromEmpty = previousPeerCount == 0 + previousPeerCount = peerCount + if (!transitionedFromEmpty) return PeerAvailabilityAction.NONE + + if (!isArmed) { + val emptySince = emptySinceMillis + val remainedEmptyLongEnough = + emptySince != null && now - emptySince >= emptyRearmDelayMs + if (!remainedEmptyLongEnough) { + emptySinceMillis = null + return PeerAvailabilityAction.NONE + } + isArmed = true + } + emptySinceMillis = null + + val lastAlertAt = alertHistory.lastAlertAtMillis + val cooldownElapsed = + lastAlertAt == null || now - lastAlertAt >= alertCooldownMs + return if (isAppInBackground && cooldownElapsed) { + PeerAvailabilityAction.SHOW + } else { + PeerAvailabilityAction.NONE + } + } + + /** + * Called only after NotificationManager accepts the post. Failed or disabled posts + * do not consume the cooldown or require the mesh to re-arm. + */ + fun markAlertShown() { + alertHistory.lastAlertAtMillis = nowMillis() + isArmed = false + } +} + +internal interface PeerAvailabilityTextProvider { + fun title(): String + fun body(peerCount: Int): String +} + +private class AndroidPeerAvailabilityTextProvider( + private val context: Context +) : PeerAvailabilityTextProvider { + override fun title(): String { + return context.getString(R.string.notification_active_peers_title) + } + + override fun body(peerCount: Int): String { + return if (peerCount == 1) { + context.getString(R.string.notification_active_peers_one) + } else { + context.getString(R.string.notification_active_peers_many, peerCount) + } + } +} + +/** + * Owns the user-visible "bitchatters nearby" notification independently of the UI delegate. + */ +internal class PeerAvailabilityNotifier( + private val context: Context, + private val notificationManager: NotificationManagerCompat = + NotificationManagerCompat.from(context), + private val tracker: PeerAvailabilityTracker = PeerAvailabilityTracker( + SharedPreferencesPeerAvailabilityAlertHistory(context) + ), + private val textProvider: PeerAvailabilityTextProvider = + AndroidPeerAvailabilityTextProvider(context), + private val canPostNotifications: () -> Boolean = { + notificationManager.areNotificationsEnabled() && + ( + Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || + ContextCompat.checkSelfPermission( + context, + Manifest.permission.POST_NOTIFICATIONS + ) == PackageManager.PERMISSION_GRANTED + ) + } +) { + companion object { + internal const val CHANNEL_ID = "bitchat_peer_availability_notifications" + internal const val NOTIFICATION_ID = 997 + private const val TAG = "PeerAvailability" + } + + init { + createNotificationChannel() + } + + fun onPeerCountChanged(peerCount: Int, isAppInBackground: Boolean) { + when (tracker.update(peerCount, isAppInBackground)) { + PeerAvailabilityAction.NONE -> Unit + PeerAvailabilityAction.CLEAR -> clear() + PeerAvailabilityAction.SHOW -> showNotification(peerCount) + } + } + + fun clear() { + notificationManager.cancel(NOTIFICATION_ID) + } + + private fun createNotificationChannel() { + val channel = NotificationChannel( + CHANNEL_ID, + textProvider.title(), + NotificationManager.IMPORTANCE_HIGH + ).apply { + enableVibration(true) + setShowBadge(false) + } + val systemManager = + context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + systemManager.createNotificationChannel(channel) + } + + @SuppressLint("MissingPermission") + private fun showNotification(peerCount: Int) { + if (!canPostNotifications()) { + Log.i(TAG, "Skipping peer availability notification because notifications are disabled") + return + } + + val openAppIntent = Intent(context, MainActivity::class.java).apply { + flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP + } + val pendingIntent = PendingIntent.getActivity( + context, + NOTIFICATION_ID, + openAppIntent, + PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT + ) + + val notification = NotificationCompat.Builder(context, CHANNEL_ID) + .setSmallIcon(R.drawable.ic_notification) + .setContentTitle(textProvider.title()) + .setContentText(textProvider.body(peerCount)) + .setContentIntent(pendingIntent) + .setAutoCancel(true) + .setOnlyAlertOnce(true) + .setPriority(NotificationCompat.PRIORITY_HIGH) + .setCategory(NotificationCompat.CATEGORY_SOCIAL) + .setShowWhen(true) + .setWhen(System.currentTimeMillis()) + .build() + + try { + notificationManager.notify(NOTIFICATION_ID, notification) + tracker.markAlertShown() + Log.i(TAG, "Posted peer availability notification for $peerCount peer(s)") + } catch (error: SecurityException) { + Log.w(TAG, "Notification permission changed before peer alert was posted", error) + } + } +} diff --git a/app/src/main/java/com/bitchat/android/services/AppStateStore.kt b/app/src/main/java/com/bitchat/android/services/AppStateStore.kt index e484d21a..66633fee 100644 --- a/app/src/main/java/com/bitchat/android/services/AppStateStore.kt +++ b/app/src/main/java/com/bitchat/android/services/AppStateStore.kt @@ -1,5 +1,6 @@ package com.bitchat.android.services +import android.content.Context import com.bitchat.android.model.BitchatMessage import com.bitchat.android.model.DeliveryStatus import kotlinx.coroutines.flow.MutableStateFlow @@ -13,8 +14,10 @@ import kotlinx.coroutines.flow.asStateFlow object AppStateStore { // Global de-dup set by message id to avoid duplicate keys in Compose lists private val seenMessageIds = mutableSetOf() + private val reservedPrivateMessageIds = mutableSetOf() private val seenPublicMessageKeys = mutableSetOf() private val peerIdsByTransport = mutableMapOf>() + private var privateWritesSinceGlobalPrune = 0 // Direct (single-hop) peer IDs per transport, used to gossip a unified neighbor set. private val directPeerIdsByTransport = mutableMapOf>() private val _directPeers = MutableStateFlow>(emptySet()) @@ -30,6 +33,20 @@ object AppStateStore { // Private messages by peerID private val _privateMessages = MutableStateFlow>>(emptyMap()) val privateMessages: StateFlow>> = _privateMessages.asStateFlow() + private val _readPrivateMessageIDs = MutableStateFlow>(emptySet()) + val readPrivateMessageIDs: StateFlow> = _readPrivateMessageIDs.asStateFlow() + private val _unreadPrivateMessageCounts = MutableStateFlow>(emptyMap()) + val unreadPrivateMessageCounts: StateFlow> = + _unreadPrivateMessageCounts.asStateFlow() + private val _privateConversationDisplayNames = + MutableStateFlow>(emptyMap()) + val privateConversationDisplayNames: StateFlow> = + _privateConversationDisplayNames.asStateFlow() + + @Volatile + private var conversationRepository: ConversationRepository? = null + private var privateConversationWritesSuspended = false + private var privateConversationGeneration = 0L private val _nickname = MutableStateFlow("") val nickname: StateFlow = _nickname.asStateFlow() @@ -55,6 +72,69 @@ object AppStateStore { _selectedPrivateChatPeer.value = peerID } + fun initializeConversationPersistence(context: Context) { + val repository = ConversationRepository.getInstance(context.applicationContext) + conversationRepository = repository + repository.initialize(::restorePrivateConversations) + } + + /** + * Restores database state again for a newly created UI, even if Android reused this process + * after a controlled shutdown cleared the process-wide state. + */ + fun reloadConversationPersistence(context: Context) { + val repository = ConversationRepository.getInstance(context.applicationContext) + conversationRepository = repository + repository.reload(::restorePrivateConversations) + } + + internal fun setConversationRepositoryForTest(repository: ConversationRepository?) { + conversationRepository = repository + } + + suspend fun awaitConversationPersistence() { + conversationRepository?.awaitPendingWrites() + } + + suspend fun loadPrivateConversationHistory(conversationID: String): Boolean { + val repository = conversationRepository ?: return false + val snapshot = repository.loadConversationAndWait( + ContactDirectory.canonicalConversationId(conversationID) + ) ?: return false + restorePrivateConversations(snapshot) + return true + } + + /** + * Drops an opened conversation's full payloads from memory while retaining its summary row. + * The complete bounded history remains encrypted in SQLite and is loaded again on demand. + */ + fun releasePrivateConversationHistory(conversationID: String) { + synchronized(this) { + val canonicalID = ContactDirectory.canonicalConversationId(conversationID) + val matching = _privateMessages.value.entries.filter { (id, _) -> + ContactDirectory.canonicalConversationId(id) + .equals(canonicalID, ignoreCase = true) + } + val latest = matching + .flatMap { it.value } + .distinctBy { it.id } + .maxWithOrNull( + compareBy { + PrivateMessageArrivalOrder.sequenceOf(it.id) ?: Long.MIN_VALUE + }.thenBy { it.timestamp.time } + ) + ?: return + val compacted = _privateMessages.value.toMutableMap() + matching.forEach { compacted.remove(it.key) } + compacted[canonicalID] = listOf(latest) + _privateMessages.value = compacted + } + } + + val conversationStoreState: StateFlow + get() = conversationRepository?.storeState ?: EMPTY_CONVERSATION_STORE_STATE + fun setTransportPeers(transportId: String, ids: List) { synchronized(this) { peerIdsByTransport[transportId] = ids.toSet() @@ -116,17 +196,155 @@ object AppStateStore { } } - fun addPrivateMessage(peerID: String, msg: BitchatMessage) { - synchronized(this) { - if (seenMessageIds.contains(msg.id)) return - seenMessageIds.add(msg.id) - PrivateMessageArrivalOrder.record(msg.id) - val conversationID = ContactDirectory.canonicalConversationId(peerID) - val map = _privateMessages.value.toMutableMap() - val list = (map[conversationID] ?: emptyList()) + msg - map[conversationID] = list - _privateMessages.value = ContactDirectory.canonicalizePrivateChats(map) + fun addPrivateMessage( + peerID: String, + msg: BitchatMessage, + forceRead: Boolean = false + ): Boolean = synchronized(this) { + addPrivateMessageLocked(peerID, msg, forceRead, persistAsynchronously = true) + } + + /** + * Persists an incoming private message before it is admitted to UI, unread, haptic, or + * notification state. Transport callbacks invoke this from their background worker. + */ + suspend fun addPrivateMessageDurably( + peerID: String, + msg: BitchatMessage, + forceRead: Boolean = false + ): Boolean { + val persistence = synchronized(this) { + if (privateConversationWritesSuspended) return false + if (seenMessageIds.contains(msg.id) || !reservedPrivateMessageIds.add(msg.id)) { + return false + } + privateMessagePersistence(peerID, msg, forceRead) } + val repository = persistence.repository + if (repository == null) { + synchronized(this) { reservedPrivateMessageIds.remove(msg.id) } + return false + } + val persisted = repository.upsertMessageAndWait( + conversationID = persistence.conversationID, + aliases = persistence.aliases, + displayName = persistence.displayName, + message = msg, + isRead = persistence.isRead + ) + return synchronized(this) { + reservedPrivateMessageIds.remove(msg.id) + if ( + !persisted || + privateConversationWritesSuspended || + persistence.generation != privateConversationGeneration || + seenMessageIds.contains(msg.id) + ) { + return@synchronized false + } + addPrivateMessageLocked( + peerID = peerID, + msg = msg, + forceRead = forceRead, + persistAsynchronously = false + ) + } + } + + private fun addPrivateMessageLocked( + peerID: String, + msg: BitchatMessage, + forceRead: Boolean, + persistAsynchronously: Boolean + ): Boolean { + if (privateConversationWritesSuspended) return false + if (seenMessageIds.contains(msg.id)) return false + seenMessageIds.add(msg.id) + PrivateMessageArrivalOrder.record(msg.id) + val conversationID = ContactDirectory.canonicalConversationId(peerID) + val map = _privateMessages.value.toMutableMap() + val list = (map[conversationID] ?: emptyList()) + msg + map[conversationID] = list + _privateMessages.value = ContactDirectory.canonicalizePrivateChats(map) + + val isRead = forceRead || + msg.sender == "system" || + msg.sender == _nickname.value || + _selectedPrivateChatPeer.value + ?.let(ContactDirectory::canonicalConversationId) + ?.equals(conversationID, ignoreCase = true) == true + if (isRead) { + _readPrivateMessageIDs.value = _readPrivateMessageIDs.value + msg.id + } else { + val counts = _unreadPrivateMessageCounts.value.toMutableMap() + counts[conversationID] = (counts[conversationID] ?: 0) + 1 + _unreadPrivateMessageCounts.value = counts + } + val aliases = runCatching { + ContactDirectory.aliasesForConversation(peerID) + + ContactDirectory.aliasesForConversation(conversationID) + + listOfNotNull(msg.senderPeerID) + }.getOrDefault(setOf(peerID, conversationID)) + val displayName = ContactDirectory.resolve(conversationID).displayName + ?: msg.sender.takeUnless { + it.isBlank() || it == "system" || it == _nickname.value + } + displayName + ?.takeUnless { + it.isBlank() || it.equals("Unknown", ignoreCase = true) + } + ?.let { updateConversationDisplayNameLocked(conversationID, it) } + if (persistAsynchronously) { + conversationRepository?.upsertMessage( + conversationID = conversationID, + aliases = aliases, + displayName = displayName, + message = msg, + isRead = isRead + ) + } + prunePrivateMessagesLocked(conversationID) + return true + } + + private fun privateMessagePersistence( + peerID: String, + msg: BitchatMessage, + forceRead: Boolean + ): PendingPrivateMessagePersistence { + val conversationID = ContactDirectory.canonicalConversationId(peerID) + val existingMessages = _privateMessages.value[conversationID].orEmpty() + val isRead = forceRead || + msg.sender == "system" || + msg.sender == _nickname.value || + _selectedPrivateChatPeer.value + ?.let(ContactDirectory::canonicalConversationId) + ?.equals(conversationID, ignoreCase = true) == true + val aliases = runCatching { + ContactDirectory.aliasesForConversation(peerID) + + ContactDirectory.aliasesForConversation(conversationID) + + listOfNotNull(msg.senderPeerID) + }.getOrDefault(setOf(peerID, conversationID)) + val displayName = ContactDirectory.resolve(conversationID).displayName + ?: (existingMessages + msg) + .lastOrNull { candidate -> + candidate.sender.isNotBlank() && + candidate.sender != "system" && + candidate.sender != _nickname.value + } + ?.sender + return PendingPrivateMessagePersistence( + repository = conversationRepository, + conversationID = conversationID, + aliases = aliases, + displayName = displayName, + isRead = isRead, + generation = privateConversationGeneration + ) + } + + fun hasSeenMessage(messageID: String): Boolean = synchronized(this) { + messageID in seenMessageIds } private fun statusPriority(status: DeliveryStatus?): Int = when (status) { @@ -141,6 +359,7 @@ object AppStateStore { fun updatePrivateMessageStatus(messageID: String, status: DeliveryStatus) { synchronized(this) { + if (privateConversationWritesSuspended) return val map = _privateMessages.value.toMutableMap() var changed = false map.keys.toList().forEach { peer -> @@ -149,7 +368,14 @@ object AppStateStore { if (idx >= 0) { val current = list[idx].deliveryStatus // Do not downgrade (e.g., Read -> Delivered) - if (statusPriority(status) >= statusPriority(current)) { + val mayReplace = when { + status is DeliveryStatus.Failed -> + current !is DeliveryStatus.Delivered && + current !is DeliveryStatus.Read + current is DeliveryStatus.Failed -> true + else -> statusPriority(status) >= statusPriority(current) + } + if (mayReplace) { list[idx] = list[idx].copy(deliveryStatus = status) map[peer] = list changed = true @@ -159,13 +385,26 @@ object AppStateStore { if (changed) { _privateMessages.value = map } + // Full histories are unloaded after a chat closes, so the message may only exist in + // SQLite. Always offer the update to the repository; it safely ignores unknown IDs + // and enforces the same monotonic status rules as the in-memory path. + conversationRepository?.updateDeliveryStatus(messageID, status) } } fun unifyPrivateChatsIntoPeer(targetPeerID: String, keysToMerge: List) { if (keysToMerge.isEmpty()) return synchronized(this) { + if (privateConversationWritesSuspended) return val targetConversationID = ContactDirectory.canonicalConversationId(targetPeerID) + val persistenceAliases = (keysToMerge + targetPeerID + targetConversationID) + .flatMap { key -> + runCatching { + ContactDirectory.aliasesForConversation(key).toList() + }.getOrDefault(listOf(key)) + } + .toSet() + conversationRepository?.mergeAliases(targetConversationID, persistenceAliases) val map = _privateMessages.value.toMutableMap() val targetList = (map[targetConversationID] ?: emptyList()).toMutableList() val targetIds = targetList.map { it.id }.toMutableSet() @@ -199,20 +438,330 @@ object AppStateStore { } else { map[targetConversationID] = targetList } - _privateMessages.value = ContactDirectory.canonicalizePrivateChats(map) + _privateMessages.value = map } + canonicalizePrivateConversationStateLocked() } } fun canonicalizePrivateChats() { synchronized(this) { - val canonical = ContactDirectory.canonicalizePrivateChats(_privateMessages.value) - if (canonical != _privateMessages.value) { - _privateMessages.value = canonical + canonicalizePrivateConversationStateLocked() + } + } + + /** + * Applies current peer announcements to retained conversations and persists the latest name + * independently of message history. A nickname change must not require another message to + * survive process death. + */ + fun updatePrivateConversationDisplayNames(peerNicknames: Map) { + if (peerNicknames.isEmpty()) return + synchronized(this) { + if (privateConversationWritesSuspended || _privateMessages.value.isEmpty()) return + canonicalizePrivateConversationStateLocked() + val conversationIDs = _privateMessages.value.keys + .mapTo(mutableSetOf()) { it.lowercase() } + peerNicknames.forEach { (peerID, nickname) -> + val usableName = nickname.takeUnless { + it.isBlank() || it.equals("Unknown", ignoreCase = true) + } ?: return@forEach + val canonicalID = ContactDirectory.canonicalConversationId(peerID) + if (canonicalID.lowercase() !in conversationIDs) { + return@forEach + } + updateConversationDisplayNameLocked(canonicalID, usableName) + val aliases = runCatching { + ContactDirectory.aliasesForConversation(peerID) + + ContactDirectory.aliasesForConversation(canonicalID) + }.getOrDefault(setOf(peerID, canonicalID)) + conversationRepository?.updateConversationIdentity( + conversationID = canonicalID, + aliases = aliases, + displayName = usableName + ) } } } + fun markPrivateMessageRead(messageID: String) { + synchronized(this) { + if (privateConversationWritesSuspended) return + if (messageID in _readPrivateMessageIDs.value) return + canonicalizePrivateConversationStateLocked() + _readPrivateMessageIDs.value = _readPrivateMessageIDs.value + messageID + val conversationID = _privateMessages.value.entries + .firstOrNull { (_, messages) -> messages.any { it.id == messageID } } + ?.key + if (conversationID != null) { + val counts = _unreadPrivateMessageCounts.value.toMutableMap() + val remaining = ((counts[conversationID] ?: 0) - 1).coerceAtLeast(0) + if (remaining == 0) counts.remove(conversationID) else { + counts[conversationID] = remaining + } + _unreadPrivateMessageCounts.value = counts + } + conversationRepository?.markRead(messageID) + } + } + + fun isPrivateMessageRead(messageID: String): Boolean = + messageID in _readPrivateMessageIDs.value + + suspend fun setPrivateConversationRead( + conversationID: String, + isRead: Boolean + ): Boolean { + val canonicalID = ContactDirectory.canonicalConversationId(conversationID) + val repository = conversationRepository ?: return false + val result = repository.setConversationReadAndWait(canonicalID, isRead) + if (!result.success) return false + synchronized(this) { + val messageIDs = _privateMessages.value + .filterKeys { key -> + ContactDirectory.canonicalConversationId(key) + .equals(canonicalID, ignoreCase = true) + } + .values + .flatten() + .mapTo(linkedSetOf(), BitchatMessage::id) + if (isRead) { + _readPrivateMessageIDs.value = _readPrivateMessageIDs.value + messageIDs + _unreadPrivateMessageCounts.value = + _unreadPrivateMessageCounts.value.filterKeys { key -> + !ContactDirectory.canonicalConversationId(key) + .equals(canonicalID, ignoreCase = true) + } + } else { + result.affectedMessageID?.let { latestMessageID -> + _readPrivateMessageIDs.value = + _readPrivateMessageIDs.value - latestMessageID + _unreadPrivateMessageCounts.value = + _unreadPrivateMessageCounts.value + (canonicalID to 1) + } + } + } + return true + } + + fun deletePrivateConversation(peerOrConversationID: String): Set { + synchronized(this) { + val canonicalID = ContactDirectory.canonicalConversationId(peerOrConversationID) + val matchingKeys = _privateMessages.value.keys.filterTo(linkedSetOf()) { key -> + ContactDirectory.canonicalConversationId(key) + .equals(canonicalID, ignoreCase = true) + } + val aliases = (matchingKeys + peerOrConversationID + canonicalID) + .flatMap { key -> + runCatching { + ContactDirectory.aliasesForConversation(key).toList() + }.getOrDefault(listOf(key)) + } + .toSet() + val messageIDs = matchingKeys + .flatMapTo(linkedSetOf()) { _privateMessages.value[it].orEmpty().map { it.id } } + + // Queue the database deletion while holding the same lock used by addPrivateMessage. + // A genuinely new arrival is therefore queued after the delete and starts a fresh chat. + conversationRepository?.deleteConversation(canonicalID, aliases) + + val updated = _privateMessages.value.toMutableMap() + matchingKeys.forEach(updated::remove) + _privateMessages.value = updated + removeConversationDisplayNamesLocked(canonicalID) + _readPrivateMessageIDs.value = _readPrivateMessageIDs.value - messageIDs + _unreadPrivateMessageCounts.value = + _unreadPrivateMessageCounts.value - matchingKeys - canonicalID + if ( + _selectedPrivateChatPeer.value + ?.let(ContactDirectory::canonicalConversationId) + ?.equals(canonicalID, ignoreCase = true) == true + ) { + _selectedPrivateChatPeer.value = null + } + return messageIDs + } + } + + internal suspend fun deletePrivateConversationAndWait( + peerOrConversationID: String + ): DeletedPrivateConversation? { + loadPrivateConversationHistory(peerOrConversationID) + val deletion = synchronized(this) { + if (privateConversationWritesSuspended) return null + buildDeletedConversationLocked(peerOrConversationID) + } + val repository = conversationRepository ?: return null + if (!repository.deleteConversationAndWait(deletion.conversationID, deletion.aliases)) { + return null + } + synchronized(this) { + val updated = _privateMessages.value.toMutableMap() + updated.keys.toList().forEach { key -> + if ( + ContactDirectory.canonicalConversationId(key) + .equals(deletion.conversationID, ignoreCase = true) + ) { + val remaining = updated[key].orEmpty().filterNot { + it.id in deletion.messageIDs + } + if (remaining.isEmpty()) updated.remove(key) else updated[key] = remaining + } + } + _privateMessages.value = updated + removeConversationDisplayNamesLocked(deletion.conversationID) + _readPrivateMessageIDs.value = + _readPrivateMessageIDs.value - deletion.messageIDs + canonicalizePrivateConversationStateLocked() + val counts = _unreadPrivateMessageCounts.value.toMutableMap() + val currentCount = counts[deletion.conversationID] ?: 0 + val remainingUnread = (currentCount - deletion.unreadMessageCount).coerceAtLeast(0) + if (remainingUnread == 0) counts.remove(deletion.conversationID) else { + counts[deletion.conversationID] = remainingUnread + } + _unreadPrivateMessageCounts.value = counts + if ( + _selectedPrivateChatPeer.value + ?.let(ContactDirectory::canonicalConversationId) + ?.equals(deletion.conversationID, ignoreCase = true) == true + ) { + _selectedPrivateChatPeer.value = null + } + } + return deletion + } + + internal suspend fun restoreDeletedConversation( + deletion: DeletedPrivateConversation + ): Boolean { + val repository = conversationRepository ?: return false + val restoredDisplayName = + ContactDirectory.resolve(deletion.conversationID).displayName + ?: deletion.displayName + if ( + !repository.restoreConversationAndWait( + conversationID = deletion.conversationID, + aliases = deletion.aliases, + displayName = restoredDisplayName, + messages = deletion.messages, + readMessageIDs = deletion.readMessageIDs + ) + ) { + return false + } + synchronized(this) { + seenMessageIds.removeAll(deletion.messageIDs) + deletion.messages.forEach { message -> + addPrivateMessageLocked( + peerID = deletion.conversationID, + msg = message, + forceRead = message.id in deletion.readMessageIDs, + persistAsynchronously = false + ) + } + restoredDisplayName?.let { + updateConversationDisplayNameLocked(deletion.conversationID, it) + } + } + return true + } + + private fun buildDeletedConversationLocked( + peerOrConversationID: String + ): DeletedPrivateConversation { + val canonicalID = ContactDirectory.canonicalConversationId(peerOrConversationID) + val matchingKeys = _privateMessages.value.keys.filterTo(linkedSetOf()) { key -> + ContactDirectory.canonicalConversationId(key) + .equals(canonicalID, ignoreCase = true) + } + val aliases = (matchingKeys + peerOrConversationID + canonicalID) + .flatMap { key -> + runCatching { + ContactDirectory.aliasesForConversation(key).toList() + }.getOrDefault(listOf(key)) + } + .toSet() + val messages = matchingKeys + .flatMap { _privateMessages.value[it].orEmpty() } + .distinctBy(BitchatMessage::id) + val messageIDs = messages.mapTo(linkedSetOf(), BitchatMessage::id) + val readIDs = _readPrivateMessageIDs.value.intersect(messageIDs) + return DeletedPrivateConversation( + conversationID = canonicalID, + aliases = aliases, + displayName = _privateConversationDisplayNames.value.entries + .firstOrNull { (key, _) -> + ContactDirectory.canonicalConversationId(key) + .equals(canonicalID, ignoreCase = true) + } + ?.value + ?: ContactDirectory.resolve(canonicalID).displayName, + messages = messages, + readMessageIDs = readIDs, + unreadMessageCount = messages.count { message -> + message.id !in readIDs && + message.sender != "system" && + message.sender != _nickname.value + } + ) + } + + fun removePrivateMessage(messageID: String) { + synchronized(this) { + val updated = _privateMessages.value.toMutableMap() + var changed = false + updated.keys.toList().forEach { conversationID -> + val messages = updated[conversationID].orEmpty() + if (messages.any { it.id == messageID }) { + val remaining = messages.filterNot { it.id == messageID } + if (remaining.isEmpty()) { + updated.remove(conversationID) + } else { + updated[conversationID] = remaining + } + changed = true + } + } + if (!changed) return + conversationRepository?.deleteMessage(messageID) + _privateMessages.value = updated + val retainedConversationIDs = updated.keys + .mapTo(mutableSetOf()) { + ContactDirectory.canonicalConversationId(it).lowercase() + } + _privateConversationDisplayNames.value = + _privateConversationDisplayNames.value.filterKeys { + ContactDirectory.canonicalConversationId(it).lowercase() in + retainedConversationIDs + } + _readPrivateMessageIDs.value = _readPrivateMessageIDs.value - messageID + } + } + + /** + * Atomically hides all conversations, rejects in-flight transport deliveries, then waits for + * every earlier database write and the panic wipe itself to finish. + */ + suspend fun panicClearPrivateConversations(): Boolean { + val repository = synchronized(this) { + privateConversationWritesSuspended = true + privateConversationGeneration += 1 + _privateMessages.value = emptyMap() + _readPrivateMessageIDs.value = emptySet() + _unreadPrivateMessageCounts.value = emptyMap() + _privateConversationDisplayNames.value = emptyMap() + _selectedPrivateChatPeer.value = null + conversationRepository + } + return repository?.clearAllAndWait() ?: true + } + + fun resumePrivateConversationsAfterPanic() { + synchronized(this) { + privateConversationWritesSuspended = false + } + } + fun addChannelMessage(channel: String, msg: BitchatMessage) { synchronized(this) { if (seenMessageIds.contains(msg.id)) return @@ -228,14 +777,20 @@ object AppStateStore { fun clear() { synchronized(this) { seenMessageIds.clear() + reservedPrivateMessageIds.clear() + privateConversationGeneration += 1 seenPublicMessageKeys.clear() PrivateMessageArrivalOrder.clear() + privateWritesSinceGlobalPrune = 0 peerIdsByTransport.clear() directPeerIdsByTransport.clear() _peers.value = emptyList() _directPeers.value = emptySet() _publicMessages.value = emptyList() _privateMessages.value = emptyMap() + _readPrivateMessageIDs.value = emptySet() + _unreadPrivateMessageCounts.value = emptyMap() + _privateConversationDisplayNames.value = emptyMap() _channelMessages.value = emptyMap() _nickname.value = "" _selectedPrivateChatPeer.value = null @@ -252,4 +807,253 @@ object AppStateStore { msg.content ).joinToString("\u001F") } + + internal fun restorePrivateConversations(snapshot: PersistedConversationSnapshot) { + synchronized(this) { + if (privateConversationWritesSuspended) return + val liveChats = _privateMessages.value + val liveMessageIDs = liveChats.values.flatten().map { it.id } + PrivateMessageArrivalOrder.restore( + snapshot.arrivalOrder, + liveMessageIDs, + snapshot.receivedAtByMessageID, + snapshot.arrivalSequenceByMessageID + ) + + val merged = linkedMapOf>() + snapshot.chats.forEach { (conversationID, messages) -> + merged.getOrPut(conversationID) { mutableListOf() }.addAll(messages) + } + liveChats.forEach { (conversationID, messages) -> + val target = merged.getOrPut(conversationID) { mutableListOf() } + messages + .filterNot { it.id in snapshot.deletedMessageIDs } + .forEach { live -> + val existingIndex = target.indexOfFirst { it.id == live.id } + if (existingIndex >= 0) { + target[existingIndex] = live + } else { + target.add(live) + } + } + } + + merged.values.flatten().forEach { seenMessageIds.add(it.id) } + seenMessageIds.addAll(snapshot.deletedMessageIDs) + _readPrivateMessageIDs.value = + (snapshot.readMessageIDs + _readPrivateMessageIDs.value) - + snapshot.deletedMessageIDs + val unreadCounts = _unreadPrivateMessageCounts.value.toMutableMap() + snapshot.unreadCounts.forEach { (conversationID, count) -> + if (count > 0) unreadCounts[conversationID] = count + else unreadCounts.remove(conversationID) + } + _unreadPrivateMessageCounts.value = unreadCounts + _privateConversationDisplayNames.value = + snapshot.displayNames + _privateConversationDisplayNames.value + _privateMessages.value = ContactDirectory.canonicalizePrivateChats( + merged.mapValues { (_, messages) -> + PrivateMessageArrivalOrder.order(messages.distinctBy { it.id }) + } + ) + canonicalizePrivateConversationStateLocked() + } + } + + private fun updateConversationDisplayNameLocked( + conversationID: String, + displayName: String + ) { + val canonicalID = ContactDirectory.canonicalConversationId(conversationID) + val updated = _privateConversationDisplayNames.value + .filterKeys { key -> + !ContactDirectory.canonicalConversationId(key) + .equals(canonicalID, ignoreCase = true) + } + .toMutableMap() + updated[canonicalID] = displayName + _privateConversationDisplayNames.value = updated + } + + private fun removeConversationDisplayNamesLocked(conversationID: String) { + val canonicalID = ContactDirectory.canonicalConversationId(conversationID) + _privateConversationDisplayNames.value = + _privateConversationDisplayNames.value.filterKeys { key -> + !ContactDirectory.canonicalConversationId(key) + .equals(canonicalID, ignoreCase = true) + } + } + + /** + * Identity mappings can become richer after a Noise handshake or favorite/Nostr update. + * Keep every process-wide projection on the same canonical key so unread/read/delete updates + * cannot leave a stale alias behind. + */ + private fun canonicalizePrivateConversationStateLocked() { + val canonicalChats = ContactDirectory.canonicalizePrivateChats(_privateMessages.value) + if (canonicalChats != _privateMessages.value) { + _privateMessages.value = canonicalChats + } + + val canonicalUnreadCounts = linkedMapOf() + _unreadPrivateMessageCounts.value.forEach { (conversationID, count) -> + if (count <= 0) return@forEach + val canonicalID = ContactDirectory.canonicalConversationId(conversationID) + canonicalUnreadCounts[canonicalID] = + (canonicalUnreadCounts[canonicalID] ?: 0) + count + } + if (canonicalUnreadCounts != _unreadPrivateMessageCounts.value) { + _unreadPrivateMessageCounts.value = canonicalUnreadCounts + } + + val canonicalDisplayNames = linkedMapOf() + _privateConversationDisplayNames.value.forEach { (conversationID, displayName) -> + if (displayName.isBlank()) return@forEach + canonicalDisplayNames[ + ContactDirectory.canonicalConversationId(conversationID) + ] = displayName + } + if (canonicalDisplayNames != _privateConversationDisplayNames.value) { + _privateConversationDisplayNames.value = canonicalDisplayNames + } + + _selectedPrivateChatPeer.value?.let { selected -> + val canonicalSelected = ContactDirectory.canonicalConversationId(selected) + if (canonicalSelected != selected) { + _selectedPrivateChatPeer.value = canonicalSelected + } + } + } + + private fun prunePrivateMessagesLocked(recentConversationID: String) { + val chats = _privateMessages.value.toMutableMap() + val removedIDs = linkedSetOf() + val recentKey = chats.keys.firstOrNull { key -> + ContactDirectory.canonicalConversationId(key) + .equals(recentConversationID, ignoreCase = true) + } + if (recentKey != null) { + val messages = chats[recentKey].orEmpty() + val excess = + messages.size - ConversationDatabase.MAX_MESSAGES_PER_CONVERSATION + if (excess > 0) { + val removable = messages + .dropLast(1) + .sortedWith(privateMessagePruneComparator()) + .take(excess) + .mapTo(linkedSetOf()) { it.id } + removedIDs.addAll(removable) + chats[recentKey] = messages.filterNot { it.id in removable } + } + } + + privateWritesSinceGlobalPrune += 1 + if (privateWritesSinceGlobalPrune >= 64) { + privateWritesSinceGlobalPrune = 0 + var totalMessages = chats.values.sumOf { it.size } + var totalPayloadBytes = chats.values + .asSequence() + .flatten() + .sumOf(::privateMessagePayloadBytes) + if ( + totalMessages > ConversationDatabase.MAX_MESSAGES_TOTAL || + totalPayloadBytes > ConversationDatabase.MAX_PAYLOAD_BYTES + ) { + val candidates = chats.values + .asSequence() + .flatMap { messages -> messages.dropLast(1).asSequence() } + .sortedWith(privateMessagePruneComparator()) + .iterator() + while ( + candidates.hasNext() && + ( + totalMessages > ConversationDatabase.MAX_MESSAGES_TOTAL || + totalPayloadBytes > ConversationDatabase.MAX_PAYLOAD_BYTES + ) + ) { + val candidate = candidates.next() + if (!removedIDs.add(candidate.id)) continue + totalMessages -= 1 + totalPayloadBytes -= privateMessagePayloadBytes(candidate) + } + if ( + totalMessages > ConversationDatabase.MAX_MESSAGES_TOTAL || + totalPayloadBytes > ConversationDatabase.MAX_PAYLOAD_BYTES + ) { + // Enforce the hard bound even when every conversation contains only its + // newest message. Read conversations still sort ahead of unread ones. + val latestCandidates = chats.values + .asSequence() + .flatten() + .filterNot { it.id in removedIDs } + .sortedWith(privateMessagePruneComparator()) + .iterator() + while ( + latestCandidates.hasNext() && + ( + totalMessages > ConversationDatabase.MAX_MESSAGES_TOTAL || + totalPayloadBytes > ConversationDatabase.MAX_PAYLOAD_BYTES + ) + ) { + val candidate = latestCandidates.next() + if (!removedIDs.add(candidate.id)) continue + totalMessages -= 1 + totalPayloadBytes -= privateMessagePayloadBytes(candidate) + } + } + if (removedIDs.isNotEmpty()) { + chats.keys.toList().forEach { key -> + chats[key] = chats[key].orEmpty().filterNot { + it.id in removedIDs + } + } + } + } + } + + if (removedIDs.isNotEmpty()) { + _privateMessages.value = chats.filterValues { it.isNotEmpty() } + _readPrivateMessageIDs.value = _readPrivateMessageIDs.value - removedIDs + } + } + + private fun privateMessagePruneComparator(): Comparator = + compareByDescending { + it.id in _readPrivateMessageIDs.value + }.thenBy { + PrivateMessageArrivalOrder.sequenceOf(it.id) ?: Long.MAX_VALUE + } + + private fun privateMessagePayloadBytes(message: BitchatMessage): Long = + message.content.toByteArray(Charsets.UTF_8).size.toLong() + + (message.encryptedContent?.size ?: 0) + + message.mentions.orEmpty().sumOf { + it.toByteArray(Charsets.UTF_8).size + } } + +private data class PendingPrivateMessagePersistence( + val repository: ConversationRepository?, + val conversationID: String, + val aliases: Set, + val displayName: String?, + val isRead: Boolean, + val generation: Long +) + +internal data class DeletedPrivateConversation( + val conversationID: String, + val aliases: Set, + val displayName: String?, + val messages: List, + val readMessageIDs: Set, + val unreadMessageCount: Int, + val wasPinned: Boolean = false, + val wasMuted: Boolean = false, + val draft: String? = null +) { + val messageIDs: Set = messages.mapTo(linkedSetOf(), BitchatMessage::id) +} + +private val EMPTY_CONVERSATION_STORE_STATE = + MutableStateFlow(ConversationStoreState.Ready).asStateFlow() diff --git a/app/src/main/java/com/bitchat/android/services/ContactDirectory.kt b/app/src/main/java/com/bitchat/android/services/ContactDirectory.kt index 28cb695c..7c733958 100644 --- a/app/src/main/java/com/bitchat/android/services/ContactDirectory.kt +++ b/app/src/main/java/com/bitchat/android/services/ContactDirectory.kt @@ -81,9 +81,19 @@ object ContactDirectory { conversationID = conversationID, meshPeerID = liveMeshPeerID, noisePublicKey = noiseKey ?: liveMeshPeerID?.let { meshProvider?.invoke()?.getPeerInfo(it)?.noisePublicKey }, - nostrPubkey = favorite?.peerNostrPublicKey, - displayName = favorite?.peerNickname?.takeIf { it.isNotBlank() && !it.equals("Unknown", ignoreCase = true) } - ?: liveMeshPeerID?.let { meshProvider?.invoke()?.getPeerInfo(it)?.nickname } + nostrPubkey = favorite?.peerNostrPublicKey + ?: liveMeshPeerID?.let { + runCatching { + FavoritesPersistenceService.shared.findNostrPubkeyForPeerID(it) + }.getOrNull() + }, + // A connected peer's current announcement is authoritative. Favorite and fingerprint + // records are offline fallbacks and can legitimately contain an older nickname. + displayName = liveMeshPeerID?.let { meshProvider?.invoke()?.getPeerInfo(it)?.nickname } + ?.takeIf { it.isNotBlank() && !it.equals("Unknown", ignoreCase = true) } + ?: favorite?.peerNickname?.takeIf { + it.isNotBlank() && !it.equals("Unknown", ignoreCase = true) + } ?: contactFingerprint?.let { cachedFingerprintNickname(it) }, isMutualFavorite = favorite?.isMutual == true ) diff --git a/app/src/main/java/com/bitchat/android/services/ConversationListPreferences.kt b/app/src/main/java/com/bitchat/android/services/ConversationListPreferences.kt new file mode 100644 index 00000000..658fa9fc --- /dev/null +++ b/app/src/main/java/com/bitchat/android/services/ConversationListPreferences.kt @@ -0,0 +1,194 @@ +package com.bitchat.android.services + +import android.content.Context +import com.bitchat.android.identity.SecureIdentityStateManager +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import org.json.JSONArray +import org.json.JSONObject + +/** + * Small encrypted, immediately observable preferences for conversation-list organization. + * + * Message history remains in SQLite; these compact sets and drafts belong in the app's existing + * Keystore-backed preference store. Panic clearing the identity store also removes these values. + */ +internal class ConversationListPreferences private constructor( + private val stateManager: SecureIdentityStateManager, + private val canonicalize: (String) -> String +) { + private constructor(context: Context) : this( + SecureIdentityStateManager(context.applicationContext), + ContactDirectory::canonicalConversationId + ) + + internal constructor( + stateManager: SecureIdentityStateManager, + testOnly: Boolean, + canonicalize: (String) -> String = ContactDirectory::canonicalConversationId + ) : this(stateManager, canonicalize) { + require(testOnly) { "Injected conversation preferences are test-only" } + } + + companion object { + private const val PINNED_KEY = "conversation_pinned_v1" + private const val MUTED_KEY = "conversation_muted_v1" + private const val DRAFTS_KEY = "conversation_drafts_v1" + private const val MAX_DRAFT_CHARS = 8_000 + private const val MAX_DRAFTS = 50 + private const val MAX_DRAFT_CHARS_TOTAL = 128_000 + + @Volatile + private var instance: ConversationListPreferences? = null + + fun getInstance(context: Context): ConversationListPreferences = + instance ?: synchronized(this) { + instance ?: ConversationListPreferences(context.applicationContext).also { + instance = it + } + } + } + + private val _pinned = MutableStateFlow(loadSet(PINNED_KEY)) + val pinned: StateFlow> = _pinned.asStateFlow() + private val _muted = MutableStateFlow(loadSet(MUTED_KEY)) + val muted: StateFlow> = _muted.asStateFlow() + private val _drafts = MutableStateFlow(loadDrafts()) + val drafts: StateFlow> = _drafts.asStateFlow() + + fun togglePinned(conversationID: String) { + _pinned.value = _pinned.value.toggle(normalize(conversationID)) + saveSet(PINNED_KEY, _pinned.value) + } + + fun toggleMuted(conversationID: String) { + _muted.value = _muted.value.toggle(normalize(conversationID)) + saveSet(MUTED_KEY, _muted.value) + } + + fun isMuted(conversationID: String): Boolean = + normalize(conversationID) in _muted.value + + fun isPinned(conversationID: String): Boolean = + normalize(conversationID) in _pinned.value + + fun draftFor(conversationID: String): String? = + _drafts.value[normalize(conversationID)] + + fun setDraft(conversationID: String, text: String) { + val key = normalize(conversationID) + val updated = _drafts.value.toMutableMap() + // Reinsert edited drafts at the end so bounded eviction approximates least-recently-used. + updated.remove(key) + val bounded = text.take(MAX_DRAFT_CHARS) + if (bounded.isNotBlank()) updated[key] = bounded + val retained = boundDrafts(updated) + _drafts.value = retained + saveDrafts(retained) + } + + fun removeConversation(conversationID: String) { + val key = normalize(conversationID) + _pinned.value = _pinned.value - key + _muted.value = _muted.value - key + _drafts.value = _drafts.value - key + saveSet(PINNED_KEY, _pinned.value) + saveSet(MUTED_KEY, _muted.value) + saveDrafts(_drafts.value) + } + + /** + * Re-key list preferences when a transient mesh ID becomes a stable contact identity. + * Without this, pin, mute, and draft state appears to disappear after a Noise/favorite update. + */ + fun canonicalizeAliases() { + val canonicalPinned = _pinned.value.mapTo(linkedSetOf(), ::normalize) + val canonicalMuted = _muted.value.mapTo(linkedSetOf(), ::normalize) + val canonicalDrafts = linkedMapOf() + _drafts.value.forEach { (conversationID, draft) -> + canonicalDrafts[normalize(conversationID)] = draft + } + + if (canonicalPinned != _pinned.value) { + _pinned.value = canonicalPinned + saveSet(PINNED_KEY, canonicalPinned) + } + if (canonicalMuted != _muted.value) { + _muted.value = canonicalMuted + saveSet(MUTED_KEY, canonicalMuted) + } + if (canonicalDrafts != _drafts.value) { + val bounded = boundDrafts(canonicalDrafts) + _drafts.value = bounded + saveDrafts(bounded) + } + } + + fun clearInMemory() { + _pinned.value = emptySet() + _muted.value = emptySet() + _drafts.value = emptyMap() + } + + fun clearAll(): Boolean { + val cleared = stateManager.clearSecureValuesSynchronously( + PINNED_KEY, + MUTED_KEY, + DRAFTS_KEY + ) + clearInMemory() + return cleared + } + + private fun loadSet(key: String): Set = runCatching { + val array = JSONArray(stateManager.getSecureValue(key) ?: return emptySet()) + buildSet { + for (index in 0 until array.length()) add(normalize(array.getString(index))) + } + }.getOrDefault(emptySet()) + + private fun saveSet(key: String, values: Set) { + stateManager.storeSecureValue(key, JSONArray(values.sorted()).toString()) + } + + private fun loadDrafts(): Map = runCatching { + val json = JSONObject(stateManager.getSecureValue(DRAFTS_KEY) ?: return emptyMap()) + val loaded = buildMap { + json.keys().forEach { key -> + json.optString(key).takeIf(String::isNotBlank)?.let { + put(normalize(key), it.take(MAX_DRAFT_CHARS)) + } + } + } + boundDrafts(loaded) + }.getOrDefault(emptyMap()) + + private fun saveDrafts(values: Map) { + stateManager.storeSecureValue( + DRAFTS_KEY, + JSONObject().apply { + values.forEach { (key, value) -> put(key, value) } + }.toString() + ) + } + + private fun Set.toggle(value: String): Set = + if (value in this) this - value else this + value + + private fun normalize(value: String): String = + canonicalize(value).lowercase() + + private fun boundDrafts(values: Map): Map { + val retained = LinkedHashMap(values) + while ( + retained.size > MAX_DRAFTS || + retained.values.sumOf(String::length) > MAX_DRAFT_CHARS_TOTAL + ) { + val oldest = retained.keys.firstOrNull() ?: break + retained.remove(oldest) + } + return retained + } + +} diff --git a/app/src/main/java/com/bitchat/android/services/ConversationRepository.kt b/app/src/main/java/com/bitchat/android/services/ConversationRepository.kt new file mode 100644 index 00000000..84420ec0 --- /dev/null +++ b/app/src/main/java/com/bitchat/android/services/ConversationRepository.kt @@ -0,0 +1,1928 @@ +package com.bitchat.android.services + +import android.content.ContentValues +import android.content.Context +import android.database.Cursor +import android.database.sqlite.SQLiteDatabase +import android.database.sqlite.SQLiteOpenHelper +import android.util.Base64 +import android.util.Log +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.BitchatMessageType +import com.bitchat.android.model.DeliveryStatus +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.asCoroutineDispatcher +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import org.json.JSONArray +import org.json.JSONObject +import java.io.File +import java.security.MessageDigest +import java.util.Date +import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicBoolean + +/** + * Process-wide, serialized persistence for private conversations. + * + * Android's SQLite database is deliberately kept behind this small repository instead of leaking + * cursors or database threading into the mesh and UI layers. Every mutation is queued on one + * writer so a delete/merge followed by a newly arriving message is applied in the same order that + * [AppStateStore] publishes it. + */ +class ConversationRepository internal constructor( + context: Context, + private val dispatcher: CoroutineDispatcher = Executors + .newSingleThreadExecutor { runnable -> + Thread(runnable, "conversation-store").apply { isDaemon = true } + } + .asCoroutineDispatcher(), + databaseName: String = ConversationDatabase.DEFAULT_DATABASE_NAME, + storageCipher: ConversationStorageCipher = AndroidConversationStorageCipher() +) { + companion object { + private const val TAG = "ConversationRepository" + + @Volatile + private var instance: ConversationRepository? = null + + fun getInstance(context: Context): ConversationRepository = + instance ?: synchronized(this) { + instance ?: ConversationRepository(context.applicationContext).also { + instance = it + } + } + + fun tryGetInstance(): ConversationRepository? = instance + } + + private val applicationContext = context.applicationContext + private val database = ConversationDatabase( + context = applicationContext, + databaseName = databaseName, + storageCipher = storageCipher + ) + private val scope = CoroutineScope(SupervisorJob() + dispatcher) + private val initialized = AtomicBoolean(false) + private val _storeState = + MutableStateFlow(ConversationStoreState.Loading) + val storeState: StateFlow = _storeState.asStateFlow() + + internal fun initialize(onLoaded: (PersistedConversationSnapshot) -> Unit) { + if (!initialized.compareAndSet(false, true)) return + enqueueSnapshotLoad(pruneFirst = true, onLoaded = onLoaded) + } + + /** + * Re-reads persisted history even when this process already initialized the repository. + * + * This is required when the app's controlled shutdown cleared [AppStateStore], but Android + * reused the still-running process when the user immediately reopened the UI. + */ + internal fun reload(onLoaded: (PersistedConversationSnapshot) -> Unit) { + enqueueSnapshotLoad(pruneFirst = false, onLoaded = onLoaded) + } + + private fun enqueueSnapshotLoad( + pruneFirst: Boolean, + onLoaded: (PersistedConversationSnapshot) -> Unit + ) { + scope.launch { + try { + if (pruneFirst) { + deleteStoredMedia(database.pruneToRetentionLimits()) + } + onLoaded(database.loadInitialSnapshot()) + _storeState.value = ConversationStoreState.Ready + } catch (error: Exception) { + Log.e(TAG, "Unable to restore private conversations", error) + _storeState.value = ConversationStoreState.Error( + error.message ?: "Unable to restore conversations" + ) + } + } + } + + /** + * Suspends until all persistence work queued before this call has finished. + */ + suspend fun awaitPendingWrites() { + withContext(dispatcher) { Unit } + } + + internal suspend fun loadConversationAndWait( + conversationID: String + ): PersistedConversationSnapshot? = withContext(dispatcher) { + try { + database.loadConversation(conversationID) + } catch (error: Exception) { + Log.e(TAG, "Unable to load private conversation", error) + _storeState.value = ConversationStoreState.Error( + error.message ?: "Unable to load conversation" + ) + null + } + } + + fun upsertMessage( + conversationID: String, + aliases: Set, + displayName: String?, + message: BitchatMessage, + isRead: Boolean + ) { + scope.launch { + upsertMessageLocked(conversationID, aliases, displayName, message, isRead) + } + } + + suspend fun upsertMessageAndWait( + conversationID: String, + aliases: Set, + displayName: String?, + message: BitchatMessage, + isRead: Boolean + ): Boolean = withContext(dispatcher) { + upsertMessageLocked(conversationID, aliases, displayName, message, isRead) + } + + private fun upsertMessageLocked( + conversationID: String, + aliases: Set, + displayName: String?, + message: BitchatMessage, + isRead: Boolean + ): Boolean = try { + val result = database.upsertMessage( + conversationID = conversationID, + aliases = aliases, + displayName = displayName, + message = message, + isRead = isRead + ) + deleteStoredMedia(result.orphanedMediaPaths) + _storeState.value = ConversationStoreState.Ready + result.inserted + } catch (error: Exception) { + Log.e(TAG, "Unable to persist private message", error) + _storeState.value = ConversationStoreState.Error( + error.message ?: "Unable to save conversation" + ) + false + } + + fun updateDeliveryStatus(messageID: String, status: DeliveryStatus) { + scope.launch { + try { + database.updateDeliveryStatus(messageID, status) + } catch (error: Exception) { + Log.e(TAG, "Unable to persist delivery status: ${error.message}") + } + } + } + + fun markRead(messageID: String) { + scope.launch { + try { + database.markRead(messageID) + } catch (error: Exception) { + Log.e(TAG, "Unable to persist local read state: ${error.message}") + } + } + } + + internal suspend fun setConversationReadAndWait( + conversationID: String, + isRead: Boolean + ): ConversationReadResult = withContext(dispatcher) { + try { + ConversationReadResult( + success = true, + affectedMessageID = database.setConversationRead(conversationID, isRead) + ) + } catch (error: Exception) { + Log.e(TAG, "Unable to update conversation read state", error) + _storeState.value = ConversationStoreState.Error( + error.message ?: "Unable to update conversation" + ) + ConversationReadResult(success = false) + } + } + + fun mergeAliases(targetConversationID: String, aliases: Set) { + scope.launch { + try { + database.mergeAliases(targetConversationID, aliases) + } catch (error: Exception) { + Log.e(TAG, "Unable to merge conversation aliases: ${error.message}") + } + } + } + + fun updateConversationIdentity( + conversationID: String, + aliases: Set, + displayName: String + ) { + scope.launch { + try { + database.updateConversationIdentity(conversationID, aliases, displayName) + } catch (error: Exception) { + Log.e(TAG, "Unable to persist conversation identity: ${error.message}") + } + } + } + + fun deleteConversation(conversationID: String, aliases: Set) { + scope.launch { + deleteConversationLocked(conversationID, aliases) + } + } + + suspend fun deleteConversationAndWait( + conversationID: String, + aliases: Set + ): Boolean = withContext(dispatcher) { + deleteConversationLocked(conversationID, aliases) + } + + suspend fun restoreConversationAndWait( + conversationID: String, + aliases: Set, + displayName: String?, + messages: List, + readMessageIDs: Set + ): Boolean = withContext(dispatcher) { + try { + deleteStoredMedia( + database.restoreConversation( + conversationID, + aliases, + displayName, + messages, + readMessageIDs + ) + ) + _storeState.value = ConversationStoreState.Ready + true + } catch (error: Exception) { + Log.e(TAG, "Unable to restore deleted conversation", error) + _storeState.value = ConversationStoreState.Error( + error.message ?: "Unable to restore conversation" + ) + false + } + } + + private fun deleteConversationLocked( + conversationID: String, + aliases: Set + ): Boolean = try { + deleteStoredMedia(database.deleteConversation(conversationID, aliases)) + _storeState.value = ConversationStoreState.Ready + true + } catch (error: Exception) { + Log.e(TAG, "Unable to delete private conversation", error) + _storeState.value = ConversationStoreState.Error( + error.message ?: "Unable to delete conversation" + ) + false + } + + fun deleteMessage(messageID: String) { + scope.launch { + try { + deleteStoredMedia(database.deleteMessage(messageID)) + } catch (error: Exception) { + Log.e(TAG, "Unable to delete private message: ${error.message}") + } + } + } + + /** + * Drains earlier writes and completes the database wipe before returning. + * + * Panic mode uses this stronger variant so identity regeneration and transport restart cannot + * race an outstanding message insert or an unfinished conversation deletion. + */ + suspend fun clearAllAndWait(): Boolean = withContext(dispatcher) { + try { + database.clearAll() + _storeState.value = ConversationStoreState.Ready + true + } catch (error: Exception) { + Log.e(TAG, "Unable to synchronously clear private conversations", error) + _storeState.value = ConversationStoreState.Error( + error.message ?: "Unable to erase conversations" + ) + false + } + } + + private fun deleteStoredMedia(paths: Collection) { + if (paths.isEmpty()) return + com.bitchat.android.features.file.FileUtils.deleteStoredMediaPaths( + applicationContext, + paths + ) + } + + internal fun closeForTest() { + database.close() + } +} + +sealed interface ConversationStoreState { + data object Loading : ConversationStoreState + data object Ready : ConversationStoreState + data class Error(val message: String) : ConversationStoreState +} + +internal data class ConversationReadResult( + val success: Boolean, + val affectedMessageID: String? = null +) + +internal data class ConversationUpsertResult( + val inserted: Boolean, + val orphanedMediaPaths: Set +) + +internal data class PersistedConversationSnapshot( + val chats: Map>, + val readMessageIDs: Set, + val arrivalOrder: List, + val deletedMessageIDs: Set, + val displayNames: Map = emptyMap(), + val unreadCounts: Map = emptyMap(), + val receivedAtByMessageID: Map = emptyMap(), + val arrivalSequenceByMessageID: Map = emptyMap() +) + +/** + * Versioned SQLite schema for bounded private-message history. + * + * Conversation rows are intentionally tiny and remain until explicit deletion. Message rows are + * bounded by per-conversation, global-row, and payload-byte limits. Media bytes stay in the app's + * existing media storage; SQLite only stores the message metadata/path already present in content. + */ +internal class ConversationDatabase( + context: Context, + databaseName: String = DEFAULT_DATABASE_NAME, + private val maxMessagesPerConversation: Int = MAX_MESSAGES_PER_CONVERSATION, + private val maxMessagesTotal: Int = MAX_MESSAGES_TOTAL, + private val maxPayloadBytes: Long = MAX_PAYLOAD_BYTES, + private val maxMediaBytes: Long = MAX_MEDIA_BYTES, + private val storageCipher: ConversationStorageCipher = + AndroidConversationStorageCipher() +) : SQLiteOpenHelper(context, databaseName, null, DATABASE_VERSION) { + + companion object { + private const val TAG = "ConversationDatabase" + const val MAX_MESSAGES_PER_CONVERSATION = 1_000 + const val MAX_MESSAGES_TOTAL = 20_000 + const val MAX_PAYLOAD_BYTES = 32L * 1024L * 1024L + const val MAX_MEDIA_BYTES = 256L * 1024L * 1024L + + internal const val DEFAULT_DATABASE_NAME = "private_conversations.db" + internal const val DATABASE_VERSION = 4 + private const val PRUNE_INTERVAL = 64 + private const val PRUNE_BATCH_SIZE = 256 + } + + private val applicationContext = context.applicationContext + private var writesSinceGlobalPrune = 0 + + init { + setWriteAheadLoggingEnabled(true) + } + + override fun onConfigure(db: SQLiteDatabase) { + super.onConfigure(db) + db.setForeignKeyConstraintsEnabled(true) + db.execSQL("PRAGMA auto_vacuum = INCREMENTAL") + // Overwrite cells removed while migrating legacy plaintext payload columns. + db.rawQuery("PRAGMA secure_delete = ON", null).use { cursor -> + if (cursor.moveToFirst()) Unit + } + } + + override fun onOpen(db: SQLiteDatabase) { + super.onOpen(db) + // A v1 database may have written plaintext pages to its WAL before the encrypted migration. + // Truncating it after SQLite's upgrade transaction prevents those historical frames from + // lingering after the scrubbed rows are committed. + runCatching { + db.rawQuery("PRAGMA wal_checkpoint(TRUNCATE)", null).use { cursor -> + if (cursor.moveToFirst()) Unit + } + }.onFailure { error -> + Log.w(TAG, "Unable to truncate conversation WAL: ${error.message}") + } + } + + override fun onCreate(db: SQLiteDatabase) { + db.execSQL( + """ + CREATE TABLE conversations ( + conversation_id TEXT COLLATE NOCASE PRIMARY KEY NOT NULL, + display_name TEXT, + display_name_ciphertext BLOB, + created_at INTEGER NOT NULL, + updated_at INTEGER NOT NULL + ) + """.trimIndent() + ) + db.execSQL( + """ + CREATE TABLE conversation_aliases ( + alias TEXT COLLATE NOCASE PRIMARY KEY NOT NULL, + conversation_id TEXT COLLATE NOCASE NOT NULL, + FOREIGN KEY(conversation_id) REFERENCES conversations(conversation_id) + ON DELETE CASCADE ON UPDATE CASCADE + ) + """.trimIndent() + ) + db.execSQL( + """ + CREATE TABLE private_messages ( + arrival_sequence INTEGER PRIMARY KEY AUTOINCREMENT, + message_id TEXT UNIQUE NOT NULL, + conversation_id TEXT COLLATE NOCASE NOT NULL, + sender TEXT NOT NULL, + content TEXT NOT NULL, + message_type INTEGER NOT NULL, + sent_at INTEGER NOT NULL, + received_at INTEGER NOT NULL, + is_relay INTEGER NOT NULL, + original_sender TEXT, + is_private INTEGER NOT NULL, + recipient_nickname TEXT, + sender_peer_id TEXT, + mentions_json TEXT, + channel_name TEXT, + encrypted_content BLOB, + is_encrypted INTEGER NOT NULL, + delivery_type INTEGER NOT NULL, + delivery_text TEXT, + delivery_at INTEGER, + delivery_reached INTEGER, + delivery_total INTEGER, + sender_nostr_pubkey TEXT, + payload_ciphertext BLOB NOT NULL, + is_read INTEGER NOT NULL DEFAULT 0, + FOREIGN KEY(conversation_id) REFERENCES conversations(conversation_id) + ON DELETE CASCADE ON UPDATE CASCADE + ) + """.trimIndent() + ) + db.execSQL( + "CREATE INDEX idx_private_messages_conversation_arrival " + + "ON private_messages(conversation_id, arrival_sequence)" + ) + db.execSQL( + "CREATE INDEX idx_private_messages_read_arrival " + + "ON private_messages(is_read, arrival_sequence)" + ) + createAttachmentsTable(db) + db.execSQL( + "CREATE INDEX idx_conversation_aliases_conversation " + + "ON conversation_aliases(conversation_id)" + ) + db.execSQL( + """ + CREATE TABLE deleted_private_messages ( + message_id TEXT PRIMARY KEY NOT NULL, + deleted_at INTEGER NOT NULL + ) + """.trimIndent() + ) + db.execSQL( + "CREATE INDEX idx_deleted_private_messages_time " + + "ON deleted_private_messages(deleted_at)" + ) + } + + override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) { + var version = oldVersion + if (version == 1) { + migrateVersion1To2(db) + version = 2 + } + if (version == 2) { + db.execSQL( + "ALTER TABLE private_messages " + + "ADD COLUMN received_at INTEGER NOT NULL DEFAULT 0" + ) + db.execSQL( + "UPDATE private_messages SET received_at = sent_at WHERE received_at = 0" + ) + version = 3 + } + if (version == 3) { + createAttachmentsTable(db) + db.query( + "private_messages", + MESSAGE_COLUMNS, + null, + null, + null, + null, + null + ).use { cursor -> + while (cursor.moveToNext()) { + registerAttachmentLocked(db, cursor.toMessage()) + } + } + version = 4 + } + check(version == newVersion) { + "Missing conversation database migration from $version to $newVersion" + } + } + + private fun migrateVersion1To2(db: SQLiteDatabase) { + db.execSQL("ALTER TABLE conversations ADD COLUMN display_name_ciphertext BLOB") + db.execSQL("ALTER TABLE private_messages ADD COLUMN payload_ciphertext BLOB") + + db.query( + "conversations", + arrayOf("conversation_id", "display_name"), + "display_name IS NOT NULL AND display_name != ''", + null, + null, + null, + null + ).use { cursor -> + while (cursor.moveToNext()) { + val conversationID = cursor.getString(0) + val displayName = cursor.getString(1) + db.update( + "conversations", + ContentValues().apply { + put( + "display_name_ciphertext", + encryptText(displayName, conversationDisplayNameAad(conversationID)) + ) + putNull("display_name") + }, + "conversation_id = ? COLLATE NOCASE", + arrayOf(conversationID) + ) + } + } + + db.query( + "private_messages", + LEGACY_MESSAGE_COLUMNS, + null, + null, + null, + null, + "arrival_sequence ASC" + ).use { cursor -> + while (cursor.moveToNext()) { + val message = cursor.toLegacyMessage() + db.update( + "private_messages", + ContentValues().apply { + put( + "payload_ciphertext", + encryptMessagePayload(message) + ) + scrubLegacyPayloadColumns(this) + }, + "message_id = ?", + arrayOf(message.id) + ) + } + } + } + + private fun createAttachmentsTable(db: SQLiteDatabase) { + db.execSQL( + """ + CREATE TABLE IF NOT EXISTS message_attachments ( + message_id TEXT PRIMARY KEY NOT NULL, + path_hash BLOB NOT NULL, + path_ciphertext BLOB NOT NULL, + byte_size INTEGER NOT NULL, + FOREIGN KEY(message_id) REFERENCES private_messages(message_id) + ON DELETE CASCADE ON UPDATE CASCADE + ) + """.trimIndent() + ) + db.execSQL( + "CREATE INDEX IF NOT EXISTS idx_message_attachments_path_hash " + + "ON message_attachments(path_hash)" + ) + } + + fun loadSnapshot(): PersistedConversationSnapshot { + return loadMessages( + selection = null, + selectionArgs = null, + orderBy = "arrival_sequence ASC", + displayNameConversationID = null + ) + } + + /** + * Loads one decrypted row per conversation for startup. Full histories are fetched only when + * the user opens a chat, keeping cold-start work proportional to conversation count rather + * than retained-message count. + */ + fun loadInitialSnapshot(): PersistedConversationSnapshot { + return loadMessages( + selection = """ + arrival_sequence IN ( + SELECT MAX(arrival_sequence) + FROM private_messages + GROUP BY conversation_id + ) + """.trimIndent(), + selectionArgs = null, + orderBy = "arrival_sequence ASC", + displayNameConversationID = null + ) + } + + fun loadConversation(conversationID: String): PersistedConversationSnapshot { + val resolved = resolveStoredConversationLocked(readableDatabase, conversationID) + return loadMessages( + selection = "conversation_id = ? COLLATE NOCASE", + selectionArgs = arrayOf(resolved), + orderBy = "arrival_sequence ASC", + displayNameConversationID = resolved + ) + } + + private fun loadMessages( + selection: String?, + selectionArgs: Array?, + orderBy: String, + displayNameConversationID: String? + ): PersistedConversationSnapshot { + val chats = linkedMapOf>() + val readIDs = linkedSetOf() + val arrivalOrder = mutableListOf() + val receivedAtByMessageID = linkedMapOf() + val arrivalSequenceByMessageID = linkedMapOf() + readableDatabase.query( + "private_messages", + MESSAGE_COLUMNS, + selection, + selectionArgs, + null, + null, + orderBy + ).use { cursor -> + while (cursor.moveToNext()) { + val conversationID = cursor.string("conversation_id") + val message = cursor.toMessage() + chats.getOrPut(conversationID) { mutableListOf() }.add(message) + arrivalOrder.add(message.id) + receivedAtByMessageID[message.id] = cursor.long("received_at") + arrivalSequenceByMessageID[message.id] = cursor.long("arrival_sequence") + if (cursor.boolean("is_read")) readIDs.add(message.id) + } + } + return PersistedConversationSnapshot( + chats = chats.mapValues { it.value.toList() }, + readMessageIDs = readIDs, + arrivalOrder = arrivalOrder, + deletedMessageIDs = loadDeletedMessageIDs(), + displayNames = loadConversationDisplayNames(displayNameConversationID), + unreadCounts = loadUnreadCounts(), + receivedAtByMessageID = receivedAtByMessageID, + arrivalSequenceByMessageID = arrivalSequenceByMessageID + ) + } + + private fun loadConversationDisplayNames( + conversationID: String? + ): Map { + val selection = conversationID?.let { "conversation_id = ? COLLATE NOCASE" } + val selectionArgs = conversationID?.let { arrayOf(it) } + return readableDatabase.query( + "conversations", + arrayOf("conversation_id", "display_name", "display_name_ciphertext"), + selection, + selectionArgs, + null, + null, + null + ).use { cursor -> + buildMap { + while (cursor.moveToNext()) { + val storedConversationID = cursor.string("conversation_id") + val encryptedColumn = + cursor.getColumnIndexOrThrow("display_name_ciphertext") + val encryptedName = if (cursor.isNull(encryptedColumn)) { + null + } else { + cursor.getBlob(encryptedColumn) + } + val displayName = encryptedName?.let { + storageCipher.decrypt( + it, + conversationDisplayNameAad(storedConversationID) + ).toString(Charsets.UTF_8) + } ?: cursor.nullableString("display_name") + displayName + ?.takeIf(String::isNotBlank) + ?.let { put(storedConversationID, it) } + } + } + } + } + + private fun loadDeletedMessageIDs(): Set { + readableDatabase.query( + "deleted_private_messages", + arrayOf("message_id"), + null, + null, + null, + null, + "deleted_at ASC" + ).use { cursor -> + return buildSet { + while (cursor.moveToNext()) add(cursor.getString(0)) + } + } + } + + private fun loadUnreadCounts(): Map = + readableDatabase.rawQuery( + """ + SELECT conversation_id, COUNT(*) + FROM private_messages + WHERE is_read = 0 + GROUP BY conversation_id + """.trimIndent(), + null + ).use { cursor -> + buildMap { + while (cursor.moveToNext()) put(cursor.getString(0), cursor.getInt(1)) + } + } + + fun upsertMessage( + conversationID: String, + aliases: Set, + displayName: String?, + message: BitchatMessage, + isRead: Boolean + ): ConversationUpsertResult { + val normalizedID = conversationID.trim() + if (normalizedID.isBlank()) { + return ConversationUpsertResult(inserted = false, orphanedMediaPaths = emptySet()) + } + val now = System.currentTimeMillis() + val orphanedMediaPaths = linkedSetOf() + var messageInserted = false + writableDatabase.inTransaction { + if (isDeletedMessageLocked(this, message.id)) return@inTransaction + mergeAliasesLocked( + db = this, + targetConversationID = normalizedID, + aliases = aliases + normalizedID, + displayName = displayName, + now = now + ) + val values = message.toContentValues(normalizedID, isRead) + val inserted = insertWithOnConflict( + "private_messages", + null, + values, + SQLiteDatabase.CONFLICT_IGNORE + ) + messageInserted = inserted != -1L + if (inserted != -1L) { + registerAttachmentLocked(this, message) + } + if (inserted == -1L) { + val existingConversation = rawQuery( + "SELECT conversation_id, is_read FROM private_messages WHERE message_id = ?", + arrayOf(message.id) + ).use { cursor -> + if (cursor.moveToFirst()) { + cursor.string("conversation_id") to cursor.boolean("is_read") + } else { + null + } + } + if (existingConversation != null) { + val canonicalExisting = resolveStoredConversationLocked( + this, + existingConversation.first + ) + if (!canonicalExisting.equals(normalizedID, ignoreCase = true)) { + mergeAliasesLocked( + db = this, + targetConversationID = normalizedID, + aliases = aliases + canonicalExisting, + displayName = displayName, + now = now + ) + } + if (isRead && !existingConversation.second) { + update( + "private_messages", + ContentValues().apply { put("is_read", 1) }, + "message_id = ?", + arrayOf(message.id) + ) + } + } + } + updateConversationMetadataLocked(this, normalizedID, displayName, now) + orphanedMediaPaths += pruneConversationLocked(this, normalizedID) + } + + writesSinceGlobalPrune += 1 + if (writesSinceGlobalPrune >= PRUNE_INTERVAL) { + writesSinceGlobalPrune = 0 + orphanedMediaPaths += pruneToRetentionLimits() + } + return ConversationUpsertResult( + inserted = messageInserted, + orphanedMediaPaths = orphanedMediaPaths + ) + } + + fun updateDeliveryStatus(messageID: String, status: DeliveryStatus) { + val db = writableDatabase + var found = false + val existing = db.rawQuery( + """ + SELECT ${MESSAGE_COLUMNS.joinToString(",")} + FROM private_messages WHERE message_id = ? + """.trimIndent(), + arrayOf(messageID) + ).use { cursor -> + if (cursor.moveToFirst()) { + found = true + cursor.toMessage().deliveryStatus + } else { + null + } + } + + if (!found) return + val mayReplace = when { + status is DeliveryStatus.Failed -> + existing !is DeliveryStatus.Delivered && existing !is DeliveryStatus.Read + existing is DeliveryStatus.Failed -> true + else -> statusPriority(status) >= statusPriority(existing) + } + if (!mayReplace) return + db.inTransaction { + val current = rawQuery( + "SELECT ${MESSAGE_COLUMNS.joinToString(",")} " + + "FROM private_messages WHERE message_id = ?", + arrayOf(messageID) + ).use { cursor -> + if (cursor.moveToFirst()) cursor.toMessage() else null + } ?: return@inTransaction + update( + "private_messages", + ContentValues().apply { + putAll(deliveryValues(status, includeSensitiveText = false)) + put( + "payload_ciphertext", + encryptMessagePayload(current.copy(deliveryStatus = status)) + ) + }, + "message_id = ?", + arrayOf(messageID) + ) + } + } + + fun markRead(messageID: String) { + writableDatabase.update( + "private_messages", + ContentValues().apply { put("is_read", 1) }, + "message_id = ?", + arrayOf(messageID) + ) + } + + fun setConversationRead(conversationID: String, isRead: Boolean): String? { + val resolved = resolveStoredConversationLocked(writableDatabase, conversationID) + return writableDatabase.inTransaction { + if (isRead) { + update( + "private_messages", + ContentValues().apply { put("is_read", 1) }, + "conversation_id = ? COLLATE NOCASE", + arrayOf(resolved) + ) + null + } else { + val latestMessageID = rawQuery( + """ + SELECT message_id + FROM private_messages + WHERE conversation_id = ? COLLATE NOCASE + ORDER BY arrival_sequence DESC + LIMIT 1 + """.trimIndent(), + arrayOf(resolved) + ).use { cursor -> + if (cursor.moveToFirst()) cursor.getString(0) else null + } + if (latestMessageID != null) { + update( + "private_messages", + ContentValues().apply { put("is_read", 0) }, + "message_id = ?", + arrayOf(latestMessageID) + ) + } + latestMessageID + } + } + } + + fun mergeAliases(targetConversationID: String, aliases: Set) { + if (targetConversationID.isBlank()) return + writableDatabase.inTransaction { + mergeAliasesLocked( + db = this, + targetConversationID = targetConversationID, + aliases = aliases + targetConversationID, + displayName = null, + now = System.currentTimeMillis() + ) + } + } + + fun updateConversationIdentity( + conversationID: String, + aliases: Set, + displayName: String + ) { + if (conversationID.isBlank() || displayName.isBlank()) return + writableDatabase.inTransaction { + mergeAliasesLocked( + db = this, + targetConversationID = conversationID, + aliases = aliases + conversationID, + displayName = displayName, + now = System.currentTimeMillis() + ) + } + } + + fun deleteConversation(conversationID: String, aliases: Set): Set = + writableDatabase.inTransaction { + val ids = linkedSetOf() + (aliases + conversationID).forEach { value -> + ids.add(resolveStoredConversationLocked(this, value)) + ids.add(value) + } + ids.filter { it.isNotBlank() }.forEach { id -> + execSQL( + """ + INSERT OR REPLACE INTO deleted_private_messages(message_id, deleted_at) + SELECT message_id, ? FROM private_messages + WHERE conversation_id = ? COLLATE NOCASE + """.trimIndent(), + arrayOf(System.currentTimeMillis(), id) + ) + } + val messageIDs = ids + .filter(String::isNotBlank) + .flatMapTo(linkedSetOf()) { id -> + queryMessageIDsLocked(this, id) + } + val attachmentCandidates = attachmentCandidatesLocked(this, messageIDs) + ids.filter { it.isNotBlank() }.forEach { id -> + delete( + "conversations", + "conversation_id = ? COLLATE NOCASE", + arrayOf(id) + ) + } + pruneDeletedMessageIDsLocked(this) + unreferencedAttachmentPathsLocked(this, attachmentCandidates) + } + + fun deleteMessage(messageID: String): Set = + writableDatabase.inTransaction { + val attachmentCandidates = attachmentCandidatesLocked(this, listOf(messageID)) + insertWithOnConflict( + "deleted_private_messages", + null, + ContentValues().apply { + put("message_id", messageID) + put("deleted_at", System.currentTimeMillis()) + }, + SQLiteDatabase.CONFLICT_REPLACE + ) + delete("private_messages", "message_id = ?", arrayOf(messageID)) + delete( + "conversations", + """ + NOT EXISTS ( + SELECT 1 FROM private_messages + WHERE private_messages.conversation_id = conversations.conversation_id + ) + """.trimIndent(), + null + ) + pruneDeletedMessageIDsLocked(this) + unreferencedAttachmentPathsLocked(this, attachmentCandidates) + } + + fun restoreConversation( + conversationID: String, + aliases: Set, + displayName: String?, + messages: List, + readMessageIDs: Set + ): Set { + if (messages.isEmpty()) return emptySet() + val now = System.currentTimeMillis() + writableDatabase.inTransaction { + mergeAliasesLocked( + db = this, + targetConversationID = conversationID, + aliases = aliases + conversationID, + displayName = displayName, + now = now + ) + messages.forEach { message -> + delete( + "deleted_private_messages", + "message_id = ?", + arrayOf(message.id) + ) + val inserted = insertWithOnConflict( + "private_messages", + null, + message.toContentValues( + conversationID = conversationID, + isRead = message.id in readMessageIDs + ), + SQLiteDatabase.CONFLICT_IGNORE + ) + if (inserted != -1L) registerAttachmentLocked(this, message) + } + updateConversationMetadataLocked(this, conversationID, displayName, now) + } + return pruneToRetentionLimits() + } + + fun clearAll() { + // Destroy the only usable copy of the history key before attempting filesystem cleanup. + storageCipher.destroyKey() + writableDatabase.inTransaction { + delete("conversation_aliases", null, null) + delete("message_attachments", null, null) + delete("private_messages", null, null) + delete("conversations", null, null) + delete("deleted_private_messages", null, null) + execSQL("DELETE FROM sqlite_sequence WHERE name = 'private_messages'") + } + writableDatabase.rawQuery("PRAGMA wal_checkpoint(TRUNCATE)", null).use { } + writableDatabase.rawQuery("PRAGMA incremental_vacuum", null).use { } + } + + fun pruneToRetentionLimits(): Set { + val db = writableDatabase + val orphanedMediaPaths = linkedSetOf() + db.inTransaction { + rawQuery( + "SELECT conversation_id FROM conversations", + null + ).use { cursor -> + while (cursor.moveToNext()) { + orphanedMediaPaths += pruneConversationLocked(this, cursor.getString(0)) + } + } + + var stats = storageStatsLocked(this) + while ( + stats.messageCount > maxMessagesTotal || + stats.payloadBytes > maxPayloadBytes || + stats.mediaBytes > maxMediaBytes + ) { + val candidateLimit = if (stats.messageCount > maxMessagesTotal) { + (stats.messageCount - maxMessagesTotal) + .coerceAtMost(PRUNE_BATCH_SIZE.toLong()) + .toInt() + } else { + // Payload sizes vary, so recalculate after each removal instead of + // discarding an entire batch unnecessarily. + 1 + } + val candidates = pruneCandidatesLocked( + db = this, + readOnly = true, + preserveLatest = true, + limit = candidateLimit + ).ifEmpty { + pruneCandidatesLocked( + db = this, + readOnly = false, + preserveLatest = true, + limit = candidateLimit + ) + }.ifEmpty { + // A store with one message in every conversation still needs a hard bound. + // Prefer retiring read conversations before unread ones. + pruneCandidatesLocked( + db = this, + readOnly = true, + preserveLatest = false, + limit = candidateLimit + ) + }.ifEmpty { + pruneCandidatesLocked( + db = this, + readOnly = false, + preserveLatest = false, + limit = candidateLimit + ) + } + if (candidates.isEmpty()) break + tombstoneMessagesLocked(this, candidates) + val attachmentCandidates = attachmentCandidatesLocked(this, candidates) + candidates.forEach { messageID -> + delete("private_messages", "message_id = ?", arrayOf(messageID)) + } + orphanedMediaPaths += + unreferencedAttachmentPathsLocked(this, attachmentCandidates) + deleteEmptyConversationsLocked(this) + pruneDeletedMessageIDsLocked(this) + stats = storageStatsLocked(this) + } + } + db.rawQuery("PRAGMA incremental_vacuum(128)", null).use { } + return orphanedMediaPaths + } + + private fun mergeAliasesLocked( + db: SQLiteDatabase, + targetConversationID: String, + aliases: Set, + displayName: String?, + now: Long + ) { + val normalizedAliases = aliases + .map(String::trim) + .filter(String::isNotBlank) + .toSet() + val sourceIDs = normalizedAliases + .mapTo(linkedSetOf()) { resolveStoredConversationLocked(db, it) } + .plus( + db.queryValues( + table = "conversation_aliases", + resultColumn = "conversation_id", + selectionValues = normalizedAliases + ) + ) + val effectiveDisplayName = displayName + ?: (listOf(targetConversationID) + sourceIDs + normalizedAliases) + .asSequence() + .mapNotNull { storedConversationDisplayNameLocked(db, it) } + .firstOrNull() + ensureConversationLocked(db, targetConversationID, effectiveDisplayName, now) + + sourceIDs + .filterNot { it.equals(targetConversationID, ignoreCase = true) } + .forEach { sourceID -> + db.update( + "private_messages", + ContentValues().apply { put("conversation_id", targetConversationID) }, + "conversation_id = ? COLLATE NOCASE", + arrayOf(sourceID) + ) + db.update( + "conversation_aliases", + ContentValues().apply { put("conversation_id", targetConversationID) }, + "conversation_id = ? COLLATE NOCASE", + arrayOf(sourceID) + ) + db.delete( + "conversations", + "conversation_id = ? COLLATE NOCASE", + arrayOf(sourceID) + ) + } + + (normalizedAliases + sourceIDs + targetConversationID).forEach { alias -> + db.insertWithOnConflict( + "conversation_aliases", + null, + ContentValues().apply { + put("alias", alias) + put("conversation_id", targetConversationID) + }, + SQLiteDatabase.CONFLICT_REPLACE + ) + } + updateConversationMetadataLocked( + db, + targetConversationID, + effectiveDisplayName, + now + ) + } + + private fun storedConversationDisplayNameLocked( + db: SQLiteDatabase, + conversationID: String + ): String? = db.query( + "conversations", + arrayOf("conversation_id", "display_name", "display_name_ciphertext"), + "conversation_id = ? COLLATE NOCASE", + arrayOf(conversationID), + null, + null, + null, + "1" + ).use { cursor -> + if (!cursor.moveToFirst()) return@use null + val storedConversationID = cursor.string("conversation_id") + cursor.blobOrNull("display_name_ciphertext")?.let { + storageCipher.decrypt( + it, + conversationDisplayNameAad(storedConversationID) + ).toString(Charsets.UTF_8) + } ?: cursor.nullableString("display_name") + } + + private fun ensureConversationLocked( + db: SQLiteDatabase, + conversationID: String, + displayName: String?, + now: Long + ) { + db.insertWithOnConflict( + "conversations", + null, + ContentValues().apply { + put("conversation_id", conversationID) + putNull("display_name") + if (!displayName.isNullOrBlank()) { + put( + "display_name_ciphertext", + encryptText(displayName, conversationDisplayNameAad(conversationID)) + ) + } + put("created_at", now) + put("updated_at", now) + }, + SQLiteDatabase.CONFLICT_IGNORE + ) + } + + private fun updateConversationMetadataLocked( + db: SQLiteDatabase, + conversationID: String, + displayName: String?, + now: Long + ) { + db.update( + "conversations", + ContentValues().apply { + if (!displayName.isNullOrBlank()) { + putNull("display_name") + put( + "display_name_ciphertext", + encryptText(displayName, conversationDisplayNameAad(conversationID)) + ) + } + put("updated_at", now) + }, + "conversation_id = ? COLLATE NOCASE", + arrayOf(conversationID) + ) + } + + private fun resolveStoredConversationLocked(db: SQLiteDatabase, value: String): String { + if (value.isBlank()) return value + return db.rawQuery( + "SELECT conversation_id FROM conversation_aliases WHERE alias = ? COLLATE NOCASE", + arrayOf(value) + ).use { cursor -> + if (cursor.moveToFirst()) cursor.getString(0) else value + } + } + + private fun isDeletedMessageLocked(db: SQLiteDatabase, messageID: String): Boolean = + db.longForQuery( + "SELECT COUNT(*) FROM deleted_private_messages WHERE message_id = ?", + arrayOf(messageID) + ) > 0L + + private fun pruneDeletedMessageIDsLocked(db: SQLiteDatabase) { + val excess = ( + db.longForQuery( + "SELECT COUNT(*) FROM deleted_private_messages", + emptyArray() + ) - maxMessagesTotal + ).coerceAtLeast(0L) + if (excess == 0L) return + db.execSQL( + """ + DELETE FROM deleted_private_messages + WHERE message_id IN ( + SELECT message_id FROM deleted_private_messages + ORDER BY deleted_at ASC + LIMIT ? + ) + """.trimIndent(), + arrayOf(excess) + ) + } + + private fun pruneConversationLocked( + db: SQLiteDatabase, + conversationID: String + ): Set { + val count = db.longForQuery( + "SELECT COUNT(*) FROM private_messages WHERE conversation_id = ? COLLATE NOCASE", + arrayOf(conversationID) + ) + val excess = (count - maxMessagesPerConversation).coerceAtLeast(0L) + if (excess == 0L) return emptySet() + return db.rawQuery( + """ + SELECT message_id + FROM private_messages + WHERE conversation_id = ? COLLATE NOCASE + AND arrival_sequence < ( + SELECT MAX(arrival_sequence) + FROM private_messages + WHERE conversation_id = ? COLLATE NOCASE + ) + ORDER BY is_read DESC, arrival_sequence ASC + LIMIT ? + """.trimIndent(), + arrayOf(conversationID, conversationID, excess.toString()) + ).use { cursor -> + val ids = mutableListOf() + while (cursor.moveToNext()) ids.add(cursor.getString(0)) + val attachmentCandidates = attachmentCandidatesLocked(db, ids) + tombstoneMessagesLocked(db, ids) + ids.forEach { db.delete("private_messages", "message_id = ?", arrayOf(it)) } + pruneDeletedMessageIDsLocked(db) + unreferencedAttachmentPathsLocked(db, attachmentCandidates) + } + } + + private fun storageStatsLocked(db: SQLiteDatabase): ConversationStorageStats = + db.rawQuery( + """ + SELECT COUNT(*), + COALESCE(SUM( + COALESCE(length(payload_ciphertext), 0) + ), 0), + COALESCE(( + SELECT SUM(unique_attachment.byte_size) + FROM ( + SELECT MAX(byte_size) AS byte_size + FROM message_attachments + GROUP BY path_hash + ) AS unique_attachment + ), 0) + FROM private_messages + """.trimIndent(), + null + ).use { cursor -> + cursor.moveToFirst() + ConversationStorageStats( + messageCount = cursor.getLong(0), + payloadBytes = cursor.getLong(1), + mediaBytes = cursor.getLong(2) + ) + } + + private fun registerAttachmentLocked(db: SQLiteDatabase, message: BitchatMessage) { + if (message.type !in MEDIA_MESSAGE_TYPES) return + val path = appOwnedCanonicalPath(message.content) ?: return + val pathBytes = path.toByteArray(Charsets.UTF_8) + db.insertWithOnConflict( + "message_attachments", + null, + ContentValues().apply { + put("message_id", message.id) + put("path_hash", MessageDigest.getInstance("SHA-256").digest(pathBytes)) + put( + "path_ciphertext", + storageCipher.encrypt(pathBytes, attachmentPathAad(message.id)) + ) + put("byte_size", File(path).takeIf(File::isFile)?.length() ?: 0L) + }, + SQLiteDatabase.CONFLICT_REPLACE + ) + } + + private fun queryMessageIDsLocked( + db: SQLiteDatabase, + conversationID: String + ): List = + db.query( + "private_messages", + arrayOf("message_id"), + "conversation_id = ? COLLATE NOCASE", + arrayOf(conversationID), + null, + null, + null + ).use { cursor -> + buildList { + while (cursor.moveToNext()) add(cursor.getString(0)) + } + } + + private fun attachmentCandidatesLocked( + db: SQLiteDatabase, + messageIDs: Collection + ): List { + if (messageIDs.isEmpty()) return emptyList() + return buildList { + messageIDs.toList().chunked(400).forEach { chunk -> + val placeholders = chunk.joinToString(",") { "?" } + db.rawQuery( + """ + SELECT message_id, path_hash, path_ciphertext + FROM message_attachments + WHERE message_id IN ($placeholders) + """.trimIndent(), + chunk.toTypedArray() + ).use { cursor -> + while (cursor.moveToNext()) { + val messageID = cursor.getString(0) + val path = storageCipher.decrypt( + cursor.getBlob(2), + attachmentPathAad(messageID) + ).toString(Charsets.UTF_8) + add( + AttachmentCandidate( + pathHash = cursor.getBlob(1), + canonicalPath = path + ) + ) + } + } + } + } + } + + private fun unreferencedAttachmentPathsLocked( + db: SQLiteDatabase, + candidates: Collection + ): Set = candidates + .filter { candidate -> + db.rawQuery( + "SELECT COUNT(*) FROM message_attachments WHERE hex(path_hash) = ?", + arrayOf(candidate.pathHash.toHex().uppercase()) + ).use { cursor -> + cursor.moveToFirst() + cursor.getLong(0) == 0L + } + } + .mapTo(linkedSetOf(), AttachmentCandidate::canonicalPath) + + private fun appOwnedCanonicalPath(value: String): String? { + val file = runCatching { File(value.trim()).canonicalFile }.getOrNull() ?: return null + val roots = listOf(applicationContext.filesDir, applicationContext.cacheDir) + .mapNotNull { runCatching { it.canonicalFile }.getOrNull() } + return file.path.takeIf { path -> + roots.any { root -> + path == root.path || path.startsWith(root.path + File.separator) + } + } + } + + private fun attachmentPathAad(messageID: String): ByteArray = + "attachment:$messageID:path".toByteArray(Charsets.UTF_8) + + private fun ByteArray.toHex(): String = joinToString("") { "%02x".format(it) } + + private data class ConversationStorageStats( + val messageCount: Long, + val payloadBytes: Long, + val mediaBytes: Long + ) + + private data class AttachmentCandidate( + val pathHash: ByteArray, + val canonicalPath: String + ) + + private val MEDIA_MESSAGE_TYPES = setOf( + BitchatMessageType.Audio, + BitchatMessageType.Image, + BitchatMessageType.File + ) + + private fun pruneCandidatesLocked( + db: SQLiteDatabase, + readOnly: Boolean, + preserveLatest: Boolean, + limit: Int + ): List { + val readClause = if (readOnly) "AND candidate.is_read = 1" else "" + val newerMessageClause = if (preserveLatest) { + """ + AND EXISTS ( + SELECT 1 + FROM private_messages AS newer + WHERE newer.conversation_id = candidate.conversation_id + AND newer.arrival_sequence > candidate.arrival_sequence + ) + """.trimIndent() + } else { + "" + } + return db.rawQuery( + """ + SELECT candidate.message_id + FROM private_messages AS candidate + WHERE 1 = 1 + $newerMessageClause + $readClause + ORDER BY candidate.arrival_sequence ASC + LIMIT $limit + """.trimIndent(), + null + ).use { cursor -> + buildList { + while (cursor.moveToNext()) add(cursor.getString(0)) + } + } + } + + private fun deleteEmptyConversationsLocked(db: SQLiteDatabase) { + db.delete( + "conversations", + """ + NOT EXISTS ( + SELECT 1 FROM private_messages + WHERE private_messages.conversation_id = conversations.conversation_id + ) + """.trimIndent(), + null + ) + } + + private fun tombstoneMessagesLocked( + db: SQLiteDatabase, + messageIDs: Collection + ) { + val deletedAt = System.currentTimeMillis() + messageIDs.forEach { messageID -> + db.insertWithOnConflict( + "deleted_private_messages", + null, + ContentValues().apply { + put("message_id", messageID) + put("deleted_at", deletedAt) + }, + SQLiteDatabase.CONFLICT_REPLACE + ) + } + } + + private fun SQLiteDatabase.queryValues( + table: String, + resultColumn: String, + selectionValues: Set + ): Set { + if (selectionValues.isEmpty()) return emptySet() + val placeholders = selectionValues.joinToString(",") { "?" } + return rawQuery( + "SELECT $resultColumn FROM $table WHERE alias IN ($placeholders)", + selectionValues.toTypedArray() + ).use { cursor -> + buildSet { + while (cursor.moveToNext()) add(cursor.getString(0)) + } + } + } + + private fun SQLiteDatabase.longForQuery(sql: String, args: Array): Long = + rawQuery(sql, args).use { cursor -> + cursor.moveToFirst() + cursor.getLong(0) + } + + private inline fun SQLiteDatabase.inTransaction(block: SQLiteDatabase.() -> T): T { + beginTransaction() + return try { + val result = block() + setTransactionSuccessful() + result + } finally { + endTransaction() + } + } + + private fun BitchatMessage.toContentValues( + conversationID: String, + isRead: Boolean + ): ContentValues = ContentValues().apply { + put("message_id", id) + put("conversation_id", conversationID) + // Version 1 columns remain for lossless migration compatibility, but sensitive values are + // scrubbed and only the authenticated encrypted payload is populated for new writes. + put("sender", "") + put("content", "") + put("message_type", type.ordinal) + put("sent_at", timestamp.time) + put("received_at", System.currentTimeMillis()) + put("is_relay", isRelay.asInt()) + putNull("original_sender") + put("is_private", isPrivate.asInt()) + putNull("recipient_nickname") + putNull("sender_peer_id") + putNull("mentions_json") + putNull("channel_name") + putNull("encrypted_content") + put("is_encrypted", isEncrypted.asInt()) + putAll(deliveryValues(deliveryStatus, includeSensitiveText = false)) + putNull("sender_nostr_pubkey") + put("payload_ciphertext", encryptMessagePayload(this@toContentValues)) + put("is_read", isRead.asInt()) + } + + private fun deliveryValues( + status: DeliveryStatus?, + includeSensitiveText: Boolean = true + ): ContentValues = ContentValues().apply { + when (status) { + null -> put("delivery_type", 0) + DeliveryStatus.Sending -> put("delivery_type", 1) + DeliveryStatus.Sent -> put("delivery_type", 2) + is DeliveryStatus.Delivered -> { + put("delivery_type", 3) + if (includeSensitiveText) put("delivery_text", status.to) else putNull("delivery_text") + put("delivery_at", status.at.time) + } + is DeliveryStatus.Read -> { + put("delivery_type", 4) + if (includeSensitiveText) put("delivery_text", status.by) else putNull("delivery_text") + put("delivery_at", status.at.time) + } + is DeliveryStatus.Failed -> { + put("delivery_type", 5) + if (includeSensitiveText) put("delivery_text", status.reason) else putNull("delivery_text") + } + is DeliveryStatus.PartiallyDelivered -> { + put("delivery_type", 6) + put("delivery_reached", status.reached) + put("delivery_total", status.total) + } + } + } + + private fun statusPriority(status: DeliveryStatus?): Int = when (status) { + null -> 0 + is DeliveryStatus.Failed -> 0 + DeliveryStatus.Sending -> 1 + DeliveryStatus.Sent -> 2 + is DeliveryStatus.PartiallyDelivered -> 3 + is DeliveryStatus.Delivered -> 4 + is DeliveryStatus.Read -> 5 + } + + private fun Cursor.toMessage(): BitchatMessage { + val messageID = string("message_id") + val encryptedPayload = blobOrNull("payload_ciphertext") + ?: error("Conversation message $messageID has no encrypted payload") + val payload = decryptMessagePayload(messageID, encryptedPayload) + return BitchatMessage( + id = messageID, + sender = payload.sender, + content = payload.content, + type = BitchatMessageType.entries.getOrElse(int("message_type")) { + BitchatMessageType.Message + }, + timestamp = Date(long("sent_at")), + isRelay = boolean("is_relay"), + originalSender = payload.originalSender, + isPrivate = boolean("is_private"), + recipientNickname = payload.recipientNickname, + senderPeerID = payload.senderPeerID, + mentions = payload.mentions, + channel = payload.channel, + encryptedContent = payload.encryptedContent, + isEncrypted = boolean("is_encrypted"), + deliveryStatus = toDeliveryStatus(payload.deliveryText), + senderNostrPubkey = payload.senderNostrPubkey + ) + } + + private fun Cursor.toLegacyMessage(): BitchatMessage = BitchatMessage( + id = string("message_id"), + sender = string("sender"), + content = string("content"), + type = BitchatMessageType.entries.getOrElse(int("message_type")) { + BitchatMessageType.Message + }, + timestamp = Date(long("sent_at")), + isRelay = boolean("is_relay"), + originalSender = nullableString("original_sender"), + isPrivate = boolean("is_private"), + recipientNickname = nullableString("recipient_nickname"), + senderPeerID = nullableString("sender_peer_id"), + mentions = nullableString("mentions_json")?.let(::jsonStringList), + channel = nullableString("channel_name"), + encryptedContent = blobOrNull("encrypted_content"), + isEncrypted = boolean("is_encrypted"), + deliveryStatus = toDeliveryStatus(), + senderNostrPubkey = nullableString("sender_nostr_pubkey") + ) + + private fun Cursor.toDeliveryStatus(deliveryText: String? = nullableString("delivery_text")): + DeliveryStatus? = when (int("delivery_type")) { + 1 -> DeliveryStatus.Sending + 2 -> DeliveryStatus.Sent + 3 -> DeliveryStatus.Delivered( + to = deliveryText.orEmpty(), + at = Date(nullableLong("delivery_at") ?: 0L) + ) + 4 -> DeliveryStatus.Read( + by = deliveryText.orEmpty(), + at = Date(nullableLong("delivery_at") ?: 0L) + ) + 5 -> DeliveryStatus.Failed(deliveryText.orEmpty()) + 6 -> DeliveryStatus.PartiallyDelivered( + reached = nullableInt("delivery_reached") ?: 0, + total = nullableInt("delivery_total") ?: 0 + ) + else -> null + } + + private fun jsonStringList(json: String): List { + val array = JSONArray(json) + return buildList(array.length()) { + for (index in 0 until array.length()) add(array.getString(index)) + } + } + + private fun Cursor.index(column: String): Int = getColumnIndexOrThrow(column) + private fun Cursor.string(column: String): String = getString(index(column)) + private fun Cursor.nullableString(column: String): String? = + index(column).let { if (isNull(it)) null else getString(it) } + private fun Cursor.int(column: String): Int = getInt(index(column)) + private fun Cursor.nullableInt(column: String): Int? = + index(column).let { if (isNull(it)) null else getInt(it) } + private fun Cursor.long(column: String): Long = getLong(index(column)) + private fun Cursor.nullableLong(column: String): Long? = + index(column).let { if (isNull(it)) null else getLong(it) } + private fun Cursor.boolean(column: String): Boolean = int(column) != 0 + private fun Cursor.blobOrNull(column: String): ByteArray? = + index(column).let { if (isNull(it)) null else getBlob(it) } + private fun Boolean.asInt(): Int = if (this) 1 else 0 + + private fun encryptMessagePayload(message: BitchatMessage): ByteArray { + val json = JSONObject().apply { + put("sender", message.sender) + put("content", message.content) + putNullable("original_sender", message.originalSender) + putNullable("recipient_nickname", message.recipientNickname) + putNullable("sender_peer_id", message.senderPeerID) + putNullable("mentions_json", message.mentions?.let(::JSONArray)) + putNullable("channel_name", message.channel) + putNullable( + "encrypted_content", + message.encryptedContent?.let { + Base64.encodeToString(it, Base64.NO_WRAP) + } + ) + putNullable("delivery_text", message.deliveryStatus.sensitiveText()) + putNullable("sender_nostr_pubkey", message.senderNostrPubkey) + } + return storageCipher.encrypt( + json.toString().toByteArray(Charsets.UTF_8), + messagePayloadAad(message.id) + ) + } + + private fun decryptMessagePayload( + messageID: String, + encryptedPayload: ByteArray + ): StoredMessagePayload { + val json = JSONObject( + storageCipher.decrypt(encryptedPayload, messagePayloadAad(messageID)) + .toString(Charsets.UTF_8) + ) + return StoredMessagePayload( + sender = json.getString("sender"), + content = json.getString("content"), + originalSender = json.optionalString("original_sender"), + recipientNickname = json.optionalString("recipient_nickname"), + senderPeerID = json.optionalString("sender_peer_id"), + mentions = json.optionalArray("mentions_json")?.let(::jsonStringList), + channel = json.optionalString("channel_name"), + encryptedContent = json.optionalString("encrypted_content")?.let { + Base64.decode(it, Base64.NO_WRAP) + }, + deliveryText = json.optionalString("delivery_text"), + senderNostrPubkey = json.optionalString("sender_nostr_pubkey") + ) + } + + private fun encryptText(value: String, associatedData: ByteArray): ByteArray = + storageCipher.encrypt(value.toByteArray(Charsets.UTF_8), associatedData) + + private fun messagePayloadAad(messageID: String): ByteArray = + "message:$messageID".toByteArray(Charsets.UTF_8) + + private fun conversationDisplayNameAad(conversationID: String): ByteArray = + "conversation:$conversationID:display-name".toByteArray(Charsets.UTF_8) + + private fun scrubLegacyPayloadColumns(values: ContentValues) { + values.put("sender", "") + values.put("content", "") + values.putNull("original_sender") + values.putNull("recipient_nickname") + values.putNull("sender_peer_id") + values.putNull("mentions_json") + values.putNull("channel_name") + values.putNull("encrypted_content") + values.putNull("delivery_text") + values.putNull("sender_nostr_pubkey") + } + + private fun JSONObject.putNullable(key: String, value: Any?) { + put(key, value ?: JSONObject.NULL) + } + + private fun JSONObject.optionalString(key: String): String? = + if (!has(key) || isNull(key)) null else getString(key) + + private fun JSONObject.optionalArray(key: String): JSONArray? = + if (!has(key) || isNull(key)) null else getJSONArray(key) + + private fun jsonStringList(array: JSONArray): List = + buildList(array.length()) { + for (index in 0 until array.length()) add(array.getString(index)) + } + + private fun DeliveryStatus?.sensitiveText(): String? = when (this) { + is DeliveryStatus.Delivered -> to + is DeliveryStatus.Read -> by + is DeliveryStatus.Failed -> reason + else -> null + } + + private data class StoredMessagePayload( + val sender: String, + val content: String, + val originalSender: String?, + val recipientNickname: String?, + val senderPeerID: String?, + val mentions: List?, + val channel: String?, + val encryptedContent: ByteArray?, + val deliveryText: String?, + val senderNostrPubkey: String? + ) + + private val MESSAGE_COLUMNS = arrayOf( + "arrival_sequence", + "message_id", + "conversation_id", + "sender", + "content", + "message_type", + "sent_at", + "received_at", + "is_relay", + "original_sender", + "is_private", + "recipient_nickname", + "sender_peer_id", + "mentions_json", + "channel_name", + "encrypted_content", + "is_encrypted", + "delivery_type", + "delivery_text", + "delivery_at", + "delivery_reached", + "delivery_total", + "sender_nostr_pubkey", + "payload_ciphertext", + "is_read" + ) + + private val LEGACY_MESSAGE_COLUMNS = MESSAGE_COLUMNS.filterNot { + it == "payload_ciphertext" || it == "received_at" + }.toTypedArray() +} diff --git a/app/src/main/java/com/bitchat/android/services/ConversationStorageCipher.kt b/app/src/main/java/com/bitchat/android/services/ConversationStorageCipher.kt new file mode 100644 index 00000000..12acb417 --- /dev/null +++ b/app/src/main/java/com/bitchat/android/services/ConversationStorageCipher.kt @@ -0,0 +1,98 @@ +package com.bitchat.android.services + +import android.security.keystore.KeyGenParameterSpec +import android.security.keystore.KeyProperties +import java.security.KeyStore +import javax.crypto.Cipher +import javax.crypto.KeyGenerator +import javax.crypto.SecretKey +import javax.crypto.spec.GCMParameterSpec + +/** + * Encrypts private-conversation payloads with a key that never leaves Android Keystore. + * + * Every value is bound to its database identity through AES-GCM associated data. This prevents an + * encrypted payload copied from one message or conversation row from being accepted in another. + * Deleting the dedicated alias provides practical cryptographic erasure before SQLite pages, WAL + * records, and filesystem blocks are reclaimed. + */ +internal interface ConversationStorageCipher { + fun encrypt(plaintext: ByteArray, associatedData: ByteArray): ByteArray + fun decrypt(envelope: ByteArray, associatedData: ByteArray): ByteArray + fun destroyKey() +} +internal class AndroidConversationStorageCipher( + private val keyAlias: String = DEFAULT_KEY_ALIAS +) : ConversationStorageCipher { + companion object { + internal const val DEFAULT_KEY_ALIAS = "bitchat_conversation_storage_v1" + private const val KEYSTORE_PROVIDER = "AndroidKeyStore" + private const val TRANSFORMATION = "AES/GCM/NoPadding" + private const val ENVELOPE_VERSION: Byte = 1 + private const val GCM_TAG_BITS = 128 + private const val IV_BYTES = 12 + } + + private val keyLock = Any() + @Volatile + private var cachedKey: SecretKey? = null + + override fun encrypt(plaintext: ByteArray, associatedData: ByteArray): ByteArray { + val cipher = Cipher.getInstance(TRANSFORMATION) + cipher.init(Cipher.ENCRYPT_MODE, getOrCreateKey()) + cipher.updateAAD(associatedData) + val ciphertext = cipher.doFinal(plaintext) + check(cipher.iv.size == IV_BYTES) { "Unexpected AES-GCM IV length" } + return byteArrayOf(ENVELOPE_VERSION) + cipher.iv + ciphertext + } + + override fun decrypt(envelope: ByteArray, associatedData: ByteArray): ByteArray { + require(envelope.size > 1 + IV_BYTES) { "Conversation payload envelope is truncated" } + require(envelope[0] == ENVELOPE_VERSION) { + "Unsupported conversation payload envelope version" + } + val iv = envelope.copyOfRange(1, 1 + IV_BYTES) + val ciphertext = envelope.copyOfRange(1 + IV_BYTES, envelope.size) + val cipher = Cipher.getInstance(TRANSFORMATION) + cipher.init(Cipher.DECRYPT_MODE, getOrCreateKey(), GCMParameterSpec(GCM_TAG_BITS, iv)) + cipher.updateAAD(associatedData) + return cipher.doFinal(ciphertext) + } + + override fun destroyKey() { + synchronized(keyLock) { + cachedKey = null + val keyStore = KeyStore.getInstance(KEYSTORE_PROVIDER).apply { load(null) } + if (keyStore.containsAlias(keyAlias)) { + keyStore.deleteEntry(keyAlias) + } + } + } + + private fun getOrCreateKey(): SecretKey = + cachedKey ?: synchronized(keyLock) { + cachedKey ?: run { + val keyStore = KeyStore.getInstance(KEYSTORE_PROVIDER).apply { load(null) } + (keyStore.getKey(keyAlias, null) as? SecretKey) ?: generateKey() + }.also { cachedKey = it } + } + + private fun generateKey(): SecretKey { + val generator = KeyGenerator.getInstance( + KeyProperties.KEY_ALGORITHM_AES, + KEYSTORE_PROVIDER + ) + generator.init( + KeyGenParameterSpec.Builder( + keyAlias, + KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT + ) + .setBlockModes(KeyProperties.BLOCK_MODE_GCM) + .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE) + .setKeySize(256) + .setRandomizedEncryptionRequired(true) + .build() + ) + return generator.generateKey() + } +} diff --git a/app/src/main/java/com/bitchat/android/services/IncomingMessageAdmission.kt b/app/src/main/java/com/bitchat/android/services/IncomingMessageAdmission.kt new file mode 100644 index 00000000..dc76a57d --- /dev/null +++ b/app/src/main/java/com/bitchat/android/services/IncomingMessageAdmission.kt @@ -0,0 +1,42 @@ +package com.bitchat.android.services + +import com.bitchat.android.model.BitchatMessage +import kotlinx.coroutines.runBlocking + +/** + * Reflects an incoming transport message into process-wide state before any downstream effects. + * + * Private-message admission is authoritative: a duplicate or a message rejected while panic mode + * is wiping state must not continue to UI delegates, unread tracking, haptics, or notifications. + * Public and channel messages retain their existing best-effort behavior if state reflection fails. + */ +internal object IncomingMessageAdmission { + fun admitToAppState(message: BitchatMessage): Boolean = try { + when { + message.isPrivate -> { + val peerID = message.senderPeerID?.takeIf(String::isNotBlank) + ?: return false + // Mesh transport callbacks run on their background service workers. Wait for the + // serialized SQLite transaction so a notification can never advertise a message + // that an immediate process death would lose. + runBlocking { + AppStateStore.addPrivateMessageDurably(peerID, message) + } + } + + message.channel != null -> { + AppStateStore.addChannelMessage(message.channel, message) + true + } + + else -> { + AppStateStore.addPublicMessage(message) + true + } + } + } catch (_: Exception) { + // Preserve the pre-existing best-effort dispatch for public/channel messages, but never + // bypass private-message admission when persistence or canonicalization fails. + !message.isPrivate + } +} diff --git a/app/src/main/java/com/bitchat/android/services/PrivateMessageArrivalOrder.kt b/app/src/main/java/com/bitchat/android/services/PrivateMessageArrivalOrder.kt index a5c92453..f42a8dff 100644 --- a/app/src/main/java/com/bitchat/android/services/PrivateMessageArrivalOrder.kt +++ b/app/src/main/java/com/bitchat/android/services/PrivateMessageArrivalOrder.kt @@ -11,16 +11,56 @@ import com.bitchat.android.model.BitchatMessage */ internal object PrivateMessageArrivalOrder { private val sequenceByMessageID = mutableMapOf() + private val receivedAtByMessageID = mutableMapOf() private var nextSequence = 0L - fun record(messageID: String) { + fun record(messageID: String, receivedAt: Long = System.currentTimeMillis()) { synchronized(this) { if (messageID !in sequenceByMessageID) { sequenceByMessageID[messageID] = nextSequence++ + receivedAtByMessageID[messageID] = receivedAt } } } + fun restore( + persistedOrder: List, + liveMessageIDs: List, + persistedReceivedAt: Map = emptyMap(), + persistedSequences: Map = emptyMap() + ) { + synchronized(this) { + val previousSequences = sequenceByMessageID.toMap() + val previousReceivedAt = receivedAtByMessageID.toMap() + sequenceByMessageID.clear() + receivedAtByMessageID.clear() + nextSequence = (persistedSequences.values.maxOrNull() ?: -1L) + 1L + (persistedOrder + liveMessageIDs).forEach { messageID -> + if (messageID !in sequenceByMessageID) { + val sequence = persistedSequences[messageID] + ?: previousSequences[messageID] + ?: nextSequence++ + sequenceByMessageID[messageID] = sequence + (persistedReceivedAt[messageID] ?: previousReceivedAt[messageID])?.let { + receivedAtByMessageID[messageID] = it + } + } + } + nextSequence = maxOf( + nextSequence, + (sequenceByMessageID.values.maxOrNull() ?: -1L) + 1L + ) + } + } + + fun sequenceOf(messageID: String): Long? = synchronized(this) { + sequenceByMessageID[messageID] + } + + fun receivedAtOf(messageID: String): Long? = synchronized(this) { + receivedAtByMessageID[messageID] + } + fun order(messages: List): List { synchronized(this) { if (messages.size < 2 || messages.any { it.id !in sequenceByMessageID }) { @@ -33,6 +73,7 @@ internal object PrivateMessageArrivalOrder { fun clear() { synchronized(this) { sequenceByMessageID.clear() + receivedAtByMessageID.clear() nextSequence = 0L } } diff --git a/app/src/main/java/com/bitchat/android/services/SeenMessageStore.kt b/app/src/main/java/com/bitchat/android/services/SeenMessageStore.kt index 3b531846..0701645a 100644 --- a/app/src/main/java/com/bitchat/android/services/SeenMessageStore.kt +++ b/app/src/main/java/com/bitchat/android/services/SeenMessageStore.kt @@ -1,5 +1,6 @@ package com.bitchat.android.services +import android.annotation.SuppressLint import android.content.Context import android.util.Log import com.bitchat.android.identity.SecureIdentityStateManager @@ -20,6 +21,8 @@ class SeenMessageStore private constructor(private val context: Context) { private const val STORAGE_KEY = "seen_message_store_v1" private const val MAX_IDS = com.bitchat.android.util.AppConstants.Services.SEEN_MESSAGE_MAX_IDS + // The constructor always receives applicationContext, so process lifetime is intentional. + @SuppressLint("StaticFieldLeak") @Volatile private var INSTANCE: SeenMessageStore? = null fun getInstance(appContext: Context): SeenMessageStore { return INSTANCE ?: synchronized(this) { @@ -54,6 +57,7 @@ class SeenMessageStore private constructor(private val context: Context) { locallyRead.add(id) trim(locallyRead) } + AppStateStore.markPrivateMessageRead(id) persist() } @@ -65,6 +69,14 @@ class SeenMessageStore private constructor(private val context: Context) { persist() } + @Synchronized fun remove(ids: Set) { + if (ids.isEmpty()) return + delivered.removeAll(ids) + locallyRead.removeAll(ids) + readReceiptsSent.removeAll(ids) + persist() + } + @Synchronized fun clear() { delivered.clear() locallyRead.clear() diff --git a/app/src/main/java/com/bitchat/android/ui/AboutSheet.kt b/app/src/main/java/com/bitchat/android/ui/AboutSheet.kt index 4e42e141..f58e2cc4 100644 --- a/app/src/main/java/com/bitchat/android/ui/AboutSheet.kt +++ b/app/src/main/java/com/bitchat/android/ui/AboutSheet.kt @@ -20,6 +20,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row @@ -35,11 +36,13 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.filled.ChevronRight +import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.CloudDownload import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Lock import androidx.compose.material.icons.filled.Public import androidx.compose.material.icons.filled.Share +import androidx.compose.material.icons.filled.UnfoldMore import androidx.compose.material.icons.filled.Warning import androidx.compose.material.icons.filled.Wifi import androidx.compose.material.icons.outlined.Info @@ -52,6 +55,8 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -121,6 +126,69 @@ private fun ThemeChip( } } +@Composable +private fun LanguageSettingsRow( + selectedLanguageName: String, + onClick: () -> Unit, +) { + Row( + modifier = Modifier + .fillMaxWidth() + .clickable(onClick = onClick) + .padding(horizontal = 16.dp, vertical = 15.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + Text( + text = stringResource(R.string.about_app_language), + style = MaterialTheme.typography.labelLarge, + fontWeight = FontWeight.SemiBold, + modifier = Modifier.weight(1f), + ) + Text( + text = selectedLanguageName, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.primary, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + textAlign = TextAlign.End, + modifier = Modifier.weight(1f), + ) + Spacer(modifier = Modifier.width(8.dp)) + Icon( + imageVector = Icons.Filled.UnfoldMore, + contentDescription = null, + tint = MaterialTheme.colorScheme.onSurfaceVariant, + modifier = Modifier.size(18.dp), + ) + } +} + +@Composable +private fun LanguageMenuItem( + label: String, + selected: Boolean, + onClick: () -> Unit, +) { + DropdownMenuItem( + text = { + Text( + text = label, + style = MaterialTheme.typography.bodyMedium, + ) + }, + onClick = onClick, + trailingIcon = { + if (selected) { + Icon( + imageVector = Icons.Filled.Check, + contentDescription = null, + tint = MaterialTheme.colorScheme.primary, + ) + } + }, + ) +} + /** * Unified settings toggle row with icon, title, subtitle, and switch * Apple-like design with proper spacing @@ -260,6 +328,13 @@ fun AboutSheet( val colorScheme = MaterialTheme.colorScheme val palette = LocalBitchatPalette.current var selectedTab by remember { mutableStateOf(AboutTab.Info) } + val supportedLanguages = remember(context) { + LanguagePreferenceManager.supportedLanguages(context) + } + var selectedLanguageTag by remember { + mutableStateOf(LanguagePreferenceManager.currentLanguageTag()) + } + var showLanguagePicker by remember { mutableStateOf(false) } if (isPresented) { BitchatBottomSheet( @@ -343,6 +418,64 @@ fun AboutSheet( } } + item(key = "language") { + val selectedLanguageName = supportedLanguages + .firstOrNull { it.languageTag == selectedLanguageTag } + ?.endonym + ?: stringResource(R.string.about_system_default) + + Column { + AboutSectionLabel(text = stringResource(R.string.about_language)) + BoxWithConstraints( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = AboutHorizontalPadding), + ) { + Surface( + modifier = Modifier.fillMaxWidth(), + color = colorScheme.surface, + shape = AboutCardShape, + ) { + LanguageSettingsRow( + selectedLanguageName = selectedLanguageName, + onClick = { showLanguagePicker = true }, + ) + } + DropdownMenu( + expanded = showLanguagePicker, + onDismissRequest = { showLanguagePicker = false }, + modifier = Modifier.width(maxWidth), + ) { + LanguageMenuItem( + label = stringResource(R.string.about_system_default), + selected = selectedLanguageTag.isEmpty(), + onClick = { + showLanguagePicker = false + if (selectedLanguageTag.isNotEmpty()) { + selectedLanguageTag = "" + LanguagePreferenceManager.setLanguage("") + } + }, + ) + HorizontalDivider() + supportedLanguages.forEach { language -> + LanguageMenuItem( + label = language.endonym, + selected = selectedLanguageTag == language.languageTag, + onClick = { + showLanguagePicker = false + if (language.languageTag != selectedLanguageTag) { + selectedLanguageTag = language.languageTag + LanguagePreferenceManager.setLanguage(language.languageTag) + } + }, + ) + } + } + } + } + } + // Settings Section - Unified Card with Toggles item(key = "settings") { LaunchedEffect(Unit) { PoWPreferenceManager.init(context) } diff --git a/app/src/main/java/com/bitchat/android/ui/CashuTokenDecoder.kt b/app/src/main/java/com/bitchat/android/ui/CashuTokenDecoder.kt new file mode 100644 index 00000000..0daf401c --- /dev/null +++ b/app/src/main/java/com/bitchat/android/ui/CashuTokenDecoder.kt @@ -0,0 +1,287 @@ +package com.bitchat.android.ui + +import com.google.gson.JsonParser +import java.net.URI +import java.net.URLEncoder +import java.nio.charset.StandardCharsets +import java.math.BigDecimal +import java.util.Base64 +import java.util.Currency +import java.util.Locale + +/** + * Bounded, display-only Cashu token decoder. Tokens are bearer instruments, so + * this class never contacts a mint or attempts to hold/redeem funds. + */ +object CashuTokenDecoder { + const val MAX_TOKEN_LENGTH = 60_000 + private const val MAX_AMOUNT = 2_100_000_000_000_000L + + data class TokenInfo( + val version: Char, + val amount: Long?, + val unit: String?, + val mintHost: String?, + val memo: String? + ) { + val displayAmount: String? + get() = amount?.let { value -> + val displayUnit = unit ?: "sat" + val minorDigits = minorUnitDigits(displayUnit) + val formatted = if (minorDigits == null || minorDigits == 0) { + value.toString() + } else { + BigDecimal.valueOf(value, minorDigits).setScale(minorDigits).toPlainString() + } + "$formatted $displayUnit" + } + } + + fun bareToken(raw: String): String? { + var token = raw.trim() + if ('%' in token) token = percentDecode(token) ?: return null + token = when { + token.startsWith("cashu://", ignoreCase = true) -> token.substring(8) + token.startsWith("cashu:", ignoreCase = true) -> token.substring(6) + else -> token + } + if (token.length !in 12..MAX_TOKEN_LENGTH) return null + if (!token.startsWith("cashuA") && !token.startsWith("cashuB")) return null + if (token.any { !it.isLetterOrDigit() && it !in "-_+/=" }) return null + return token + } + + /** + * Permissive decoding is suitable for display: unsupported but plausible + * v4 CBOR still gets a generic chip. Strict decoding is required before + * sending and accepts only a fully parsed token with a positive amount. + */ + fun decode(raw: String, strict: Boolean = false): TokenInfo? { + val token = bareToken(raw) ?: return null + val payload = decodeBase64Url(token.substring(6)) ?: return null + if (payload.isEmpty()) return null + val info = when (token[5]) { + 'A' -> decodeV3(payload) + 'B' -> decodeV4(payload) ?: if (strict) null else TokenInfo('B', null, null, null, null) + else -> null + } ?: return null + return if (!strict || (info.amount != null && info.amount > 0)) info else null + } + + fun extractTokens(text: String, max: Int = 3): List { + if (text.isEmpty() || max <= 0) return emptyList() + val matches = TOKEN_REGEX.findAll(text) + val result = LinkedHashSet() + for (match in matches) { + bareToken(match.value)?.let(result::add) + if (result.size == max) break + } + return result.toList() + } + + fun walletUri(token: String): String? = bareToken(token)?.let { "cashu:${encodeUriComponent(it)}" } + + fun webRedeemUri(token: String): String? = + bareToken(token)?.let { "https://redeem.cashu.me/?token=${encodeUriComponent(it)}" } + + private fun encodeUriComponent(value: String): String = + URLEncoder.encode(value, StandardCharsets.UTF_8.name()).replace("+", "%20") + + /** Percent-decodes URI input without URLDecoder's form-specific '+' → space conversion. */ + private fun percentDecode(value: String): String? { + val output = StringBuilder(value.length) + var index = 0 + while (index < value.length) { + if (value[index] != '%') { + output.append(value[index++]) + continue + } + val bytes = ArrayList() + while (index < value.length && value[index] == '%') { + if (index + 2 >= value.length) return null + val byte = value.substring(index + 1, index + 3).toIntOrNull(16) ?: return null + bytes += byte.toByte() + index += 3 + } + output.append(String(bytes.toByteArray(), StandardCharsets.UTF_8)) + } + return output.toString() + } + + private fun decodeBase64Url(input: String): ByteArray? { + val normalized = input.replace('-', '+').replace('_', '/').trimEnd('=') + if (normalized.length % 4 == 1) return null + val padded = normalized + "=".repeat((4 - normalized.length % 4) % 4) + return runCatching { Base64.getDecoder().decode(padded) }.getOrNull() + } + + private fun decodeV3(payload: ByteArray): TokenInfo? = runCatching { + val root = JsonParser.parseString(String(payload, StandardCharsets.UTF_8)).asJsonObject + val entries = root.getAsJsonArray("token")?.takeIf { it.size() > 0 } ?: return null + var total = 0L + var sawAmount = false + var mintHost: String? = null + for (entryElement in entries) { + val entry = entryElement.takeIf { it.isJsonObject }?.asJsonObject ?: continue + if (mintHost == null) mintHost = sanitizeHost(entry.get("mint")?.takeIf { it.isJsonPrimitive }?.asString) + val proofs = entry.getAsJsonArray("proofs") ?: continue + for (proofElement in proofs) { + val amountElement = proofElement.takeIf { it.isJsonObject }?.asJsonObject?.get("amount") ?: continue + if (!amountElement.isJsonPrimitive || !amountElement.asJsonPrimitive.isNumber) continue + val value = runCatching { amountElement.asBigDecimal.longValueExact() }.getOrNull() ?: continue + if (value <= 0 || value > MAX_AMOUNT) continue + if (total > MAX_AMOUNT - value) return null + total += value + sawAmount = true + } + } + TokenInfo( + version = 'A', + amount = total.takeIf { sawAmount }, + unit = sanitizeUnit(root.get("unit")?.takeIf { it.isJsonPrimitive }?.asString), + mintHost = mintHost, + memo = sanitizeMemo(root.get("memo")?.takeIf { it.isJsonPrimitive }?.asString) + ) + }.getOrNull() + + private fun decodeV4(payload: ByteArray): TokenInfo? { + val root = CborReader(payload).parseComplete() as? CborValue.MapValue ?: return null + var total = 0L + var sawAmount = false + var mintHost: String? = null + var unit: String? = null + var memo: String? = null + for ((key, value) in root.pairs) { + when ((key as? CborValue.Text)?.value) { + "m" -> mintHost = sanitizeHost((value as? CborValue.Text)?.value) + "u" -> unit = sanitizeUnit((value as? CborValue.Text)?.value) + "d" -> memo = sanitizeMemo((value as? CborValue.Text)?.value) + "t" -> for (group in (value as? CborValue.ArrayValue)?.values.orEmpty()) { + for ((groupKey, groupValue) in (group as? CborValue.MapValue)?.pairs.orEmpty()) { + if ((groupKey as? CborValue.Text)?.value != "p") continue + for (proof in (groupValue as? CborValue.ArrayValue)?.values.orEmpty()) { + for ((proofKey, proofValue) in (proof as? CborValue.MapValue)?.pairs.orEmpty()) { + if ((proofKey as? CborValue.Text)?.value != "a") continue + val amount = (proofValue as? CborValue.Unsigned)?.value ?: continue + if (amount == 0L || amount > MAX_AMOUNT) continue + if (total > MAX_AMOUNT - amount) return null + total += amount + sawAmount = true + } + } + } + } + } + } + return TokenInfo('B', total.takeIf { sawAmount }, unit, mintHost, memo) + } + + private fun sanitizeHost(value: String?): String? = value + ?.takeIf { it.length <= 512 } + ?.let { runCatching { URI(it).host }.getOrNull() } + ?.takeIf { it.isNotEmpty() } + ?.lowercase() + ?.take(48) + + private fun sanitizeUnit(value: String?): String? = + value?.takeIf { it.isNotEmpty() && it.length <= 12 && it.all(Char::isLetterOrDigit) } + + private fun sanitizeMemo(value: String?): String? { + if (value == null || value.length > 512) return null + return value.filterNot(Char::isISOControl).trim().take(80).takeIf(String::isNotEmpty) + } + + /** ISO-4217 values use their currency's minor unit; custom units stay integer-denominated. */ + private fun minorUnitDigits(unit: String): Int? { + return runCatching { + Currency.getInstance(unit.uppercase(Locale.ROOT)).defaultFractionDigits + }.getOrNull()?.takeIf { it >= 0 } + } + + private val TOKEN_REGEX = Regex("""(?i:cashu:(?://)?)?cashu[AB][A-Za-z0-9_+/%=-]{6,}""") +} + +private sealed interface CborValue { + data class Unsigned(val value: Long) : CborValue + data class Text(val value: String) : CborValue + data class ArrayValue(val values: List) : CborValue + data class MapValue(val pairs: List>) : CborValue + data object Opaque : CborValue +} + +private class CborReader(private val bytes: ByteArray) { + private var index = 0 + private var itemBudget = 50_000 + + fun parseComplete(): CborValue? { + val value = parseValue(0) ?: return null + return value.takeIf { index == bytes.size } + } + + private fun parseValue(depth: Int): CborValue? { + if (depth >= 16 || itemBudget-- <= 0) return null + val (major, argument) = readHead() ?: return null + return when (major) { + 0 -> CborValue.Unsigned(argument.takeIf { it <= Long.MAX_VALUE }?.toLong() ?: return null) + 1 -> CborValue.Opaque + 2 -> if (readBytes(argument) != null) CborValue.Opaque else null + 3 -> readBytes(argument)?.toString(StandardCharsets.UTF_8)?.let(CborValue::Text) + 4 -> parseContainer(argument, depth) { CborValue.ArrayValue(it) } + 5 -> { + if (argument > 10_000 || argument > itemBudget / 2) return null + val pairs = ArrayList>(argument.coerceAtMost(64).toInt()) + repeat(argument.toInt()) { + pairs += (parseValue(depth + 1) ?: return null) to (parseValue(depth + 1) ?: return null) + } + CborValue.MapValue(pairs) + } + 6 -> parseValue(depth + 1) + 7 -> CborValue.Opaque + else -> null + } + } + + private fun parseContainer( + count: Long, + depth: Int, + wrap: (List) -> CborValue + ): CborValue? { + if (count > 10_000 || count > itemBudget) return null + val values = ArrayList(count.coerceAtMost(64).toInt()) + repeat(count.toInt()) { values += parseValue(depth + 1) ?: return null } + return wrap(values) + } + + private fun readHead(): Pair? { + if (index >= bytes.size) return null + val head = bytes[index++].toInt() and 0xff + val major = head ushr 5 + val info = head and 0x1f + val argument = when (info) { + in 0..23 -> info.toLong() + 24 -> readUInt(1) + 25 -> readUInt(2) + 26 -> readUInt(4) + 27 -> readUInt(8) + else -> null + } ?: return null + return major to argument + } + + private fun readUInt(width: Int): Long? { + if (bytes.size - index < width) return null + var value = 0L + repeat(width) { + val next = bytes[index++].toLong() and 0xff + if (value > (Long.MAX_VALUE - next) ushr 8) return null + value = (value shl 8) or next + } + return value + } + + private fun readBytes(count: Long): ByteArray? { + if (count < 0 || count > bytes.size - index) return null + val end = index + count.toInt() + return bytes.copyOfRange(index, end).also { index = end } + } +} diff --git a/app/src/main/java/com/bitchat/android/ui/ChatHeader.kt b/app/src/main/java/com/bitchat/android/ui/ChatHeader.kt index a3bff9e0..d0258296 100644 --- a/app/src/main/java/com/bitchat/android/ui/ChatHeader.kt +++ b/app/src/main/java/com/bitchat/android/ui/ChatHeader.kt @@ -488,6 +488,19 @@ fun ConversationHeaderAction( content = content ) +/** A read-only status slot matching the footprint of [ConversationHeaderAction]. */ +@Composable +fun ConversationHeaderStatus( + modifier: Modifier = Modifier, + content: @Composable () -> Unit +) { + Box( + modifier = modifier.size(HeaderTapTarget), + contentAlignment = Alignment.Center, + content = { content() } + ) +} + @Composable fun NicknameEditor( value: String, diff --git a/app/src/main/java/com/bitchat/android/ui/ChatScreen.kt b/app/src/main/java/com/bitchat/android/ui/ChatScreen.kt index e9c8e343..59a126a6 100644 --- a/app/src/main/java/com/bitchat/android/ui/ChatScreen.kt +++ b/app/src/main/java/com/bitchat/android/ui/ChatScreen.kt @@ -98,6 +98,14 @@ fun ChatScreen(viewModel: ChatViewModel) { var forceScrollToBottom by remember { mutableStateOf(false) } var isScrolledUp by remember { mutableStateOf(false) } + LaunchedEffect(selectedPrivatePeer) { + messageText = TextFieldValue( + selectedPrivatePeer + ?.let(viewModel::conversationDraft) + .orEmpty() + ) + } + // Show password dialog when needed LaunchedEffect(showPasswordPrompt) { showPasswordDialog = showPasswordPrompt @@ -356,14 +364,19 @@ fun ChatScreen(viewModel: ChatViewModel) { messageText = messageText, onMessageTextChange = { newText: TextFieldValue -> messageText = newText + viewModel.setConversationDraft(selectedPrivatePeer, newText.text) viewModel.updateCommandSuggestions(newText.text) viewModel.updateMentionSuggestions(newText.text) }, onSend = { if (messageText.text.trim().isNotEmpty()) { - viewModel.sendMessage(messageText.text.trim()) - messageText = TextFieldValue("") - forceScrollToBottom = !forceScrollToBottom // Toggle to trigger scroll + viewModel.sendMessage(messageText.text.trim()) { accepted -> + if (accepted) { + messageText = TextFieldValue("") + viewModel.setConversationDraft(selectedPrivatePeer, "") + forceScrollToBottom = !forceScrollToBottom + } + } } }, onSendVoiceNote = { peer, onionOrChannel, path -> diff --git a/app/src/main/java/com/bitchat/android/ui/ChatViewModel.kt b/app/src/main/java/com/bitchat/android/ui/ChatViewModel.kt index ba5775a0..61c88523 100644 --- a/app/src/main/java/com/bitchat/android/ui/ChatViewModel.kt +++ b/app/src/main/java/com/bitchat/android/ui/ChatViewModel.kt @@ -5,6 +5,7 @@ import android.util.Log import androidx.core.app.NotificationManagerCompat import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope +import com.bitchat.android.favorites.FavoritesChangeListener import com.bitchat.android.favorites.FavoritesPersistenceService import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.StateFlow @@ -14,6 +15,8 @@ import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.Job import com.bitchat.android.mesh.BluetoothMeshDelegate import com.bitchat.android.mesh.BluetoothMeshService import com.bitchat.android.mesh.MeshService @@ -27,7 +30,6 @@ import com.bitchat.android.protocol.BitchatPacket import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import com.bitchat.android.util.NotificationIntervalManager import kotlinx.coroutines.delay import java.util.Date import kotlin.random.Random @@ -38,6 +40,12 @@ import com.bitchat.android.services.ContactDirectory import com.bitchat.android.services.ContactIdentityResolver import com.bitchat.android.util.hexEncodedString +private data class ConversationLiveIdentityState( + val connectedPeerIDs: List, + val peerNicknames: Map, + val persistedDisplayNames: Map +) + /** * Refactored ChatViewModel - Main coordinator for bitchat functionality * Delegates specific responsibilities to specialized managers while maintaining 100% iOS compatibility @@ -58,6 +66,7 @@ class ChatViewModel( companion object { private const val TAG = "ChatViewModel" + private const val CONVERSATION_DISCONNECT_GRACE_MS = 3_000L } fun sendVoiceNote(toPeerIDOrNull: String?, channelOrNull: String?, filePath: String) { @@ -109,6 +118,8 @@ class ChatViewModel( private val seenMessageStore by lazy { com.bitchat.android.services.SeenMessageStore.getInstance(getApplication()) } + private val conversationListPreferences = + com.bitchat.android.services.ConversationListPreferences.getInstance(getApplication()) private val messageManager = MessageManager(state) private val channelManager = ChannelManager(state, messageManager, dataManager, viewModelScope) @@ -131,11 +142,16 @@ class ChatViewModel( seenMessageStore.markReadLocally(messageID) } ) - private val commandProcessor = CommandProcessor(state, messageManager, channelManager, privateChatManager) + private val commandProcessor = CommandProcessor( + state, + messageManager, + channelManager, + privateChatManager, + viewModelScope + ) private val notificationManager = NotificationManager( application.applicationContext, - NotificationManagerCompat.from(application.applicationContext), - NotificationIntervalManager() + NotificationManagerCompat.from(application.applicationContext) ) private val verificationHandler = VerificationHandler( @@ -193,20 +209,73 @@ class ChatViewModel( val privateChats: StateFlow>> = state.privateChats val selectedPrivateChatPeer: StateFlow = state.selectedPrivateChatPeer val unreadPrivateMessages: StateFlow> = state.unreadPrivateMessages - internal val unreadConversations: StateFlow> = combine( + internal val conversationStoreState = + com.bitchat.android.services.AppStateStore.conversationStoreState + private val conversationPresencePeers = MutableStateFlow>(emptyList()) + private val conversationPresenceRemovalJobs = mutableMapOf() + private val conversationDirectoryRevision = MutableStateFlow(0L) + private var favoriteRelationshipListenerRegistered = false + private val favoriteRelationshipChangeListener = object : FavoritesChangeListener { + override fun onFavoriteChanged(noiseKeyHex: String) { + refreshConversationDirectoryState() + } + + override fun onAllCleared() { + refreshConversationDirectoryState() + } + } + + private fun refreshConversationDirectoryState() { + viewModelScope.launch { + refreshPeerFavoritedUs() + conversationListPreferences.canonicalizeAliases() + conversationDirectoryRevision.update { it + 1L } + } + } + + private val conversationLiveIdentityState = combine( + conversationPresencePeers, + state.peerNicknames, + state.peerFingerprints, + conversationDirectoryRevision, + com.bitchat.android.services.AppStateStore.privateConversationDisplayNames + ) { connectedPeerIDs, peerNicknames, _, _, persistedDisplayNames -> + ConversationLiveIdentityState( + connectedPeerIDs = connectedPeerIDs, + peerNicknames = peerNicknames, + persistedDisplayNames = persistedDisplayNames + .mapKeys { (conversationID, _) -> conversationID.lowercase() } + ) + } + private val baseConversations = combine( state.unreadPrivateMessages, state.privateChats, state.nickname, - state.connectedPeers - ) { unreadConversationIDs, chats, currentNickname, connectedPeerIDs -> + conversationLiveIdentityState, + com.bitchat.android.services.AppStateStore.unreadPrivateMessageCounts + ) { unreadConversationIDs, chats, currentNickname, liveIdentity, unreadCounts -> val seenStore = seenMessageStore - val connectedPeerIDSet = connectedPeerIDs.mapTo(mutableSetOf()) { it.lowercase() } - buildUnreadConversationSummaries( + val connectedPeerByIdentity = buildMap { + liveIdentity.connectedPeerIDs.forEach { peerID -> + val identities = runCatching { + ContactDirectory.aliasesForConversation(peerID) + + ContactDirectory.canonicalConversationId(peerID) + }.getOrDefault(setOf(peerID)) + identities.forEach { identity -> + putIfAbsent(identity.lowercase(), peerID) + } + } + } + buildConversationSummaries( unreadConversationIDs = unreadConversationIDs, privateChats = chats, currentUserIdentifiers = setOf(currentNickname, mesh.myPeerID), canonicalize = ContactDirectory::canonicalConversationId, - isMessageRead = { message -> seenStore.hasBeenReadLocally(message.id) } + isMessageRead = { message -> + com.bitchat.android.services.AppStateStore.isPrivateMessageRead(message.id) || + seenStore.hasBeenReadLocally(message.id) + }, + persistedUnreadCounts = unreadCounts ).map { summary -> val resolution = ContactDirectory.resolve(summary.conversationID) val resolvedNostrPubkey = summary.nostrPubkey @@ -221,16 +290,34 @@ class ChatViewModel( ?.let(ContactIdentityResolver::nostrAliasForPubkey) ?.let(::add) }.mapTo(mutableSetOf()) { it.lowercase() } + val connectedPeerID = aliases + .asSequence() + .mapNotNull(connectedPeerByIdentity::get) + .firstOrNull() + val persistedDisplayName = liveIdentity.persistedDisplayNames[ + summary.conversationID.lowercase() + ] ?: aliases + .asSequence() + .mapNotNull(liveIdentity.persistedDisplayNames::get) + .firstOrNull() summary.copy( - displayName = resolution.displayName - ?.takeUnless { - it.isBlank() || it.equals("Unknown", ignoreCase = true) - } - ?: summary.displayName, + displayName = resolveConversationDisplayName( + fallbackName = summary.displayName, + connectedPeerID = connectedPeerID, + peerNicknames = liveIdentity.peerNicknames, + resolvedContactName = resolution.displayName, + persistedDisplayName = persistedDisplayName + ), nostrPubkey = resolvedNostrPubkey, + transport = if (resolvedNostrPubkey != null) { + DirectMessageTransport.NOSTR + } else { + summary.transport + }, identityAliases = aliases, - isConnected = aliases.any(connectedPeerIDSet::contains), + isConnected = connectedPeerID != null, + connectedPeerID = connectedPeerID, sourceGeohash = aliases .asSequence() .mapNotNull(GeohashConversationRegistry::get) @@ -238,6 +325,24 @@ class ChatViewModel( ) } } + + internal val conversations: StateFlow> = combine( + baseConversations, + conversationListPreferences.pinned, + conversationListPreferences.muted, + conversationListPreferences.drafts + ) { summaries, pinned, muted, drafts -> + sortConversationSummaries( + summaries.map { summary -> + val key = summary.conversationID.lowercase() + summary.copy( + isPinned = key in pinned, + isMuted = key in muted, + draft = drafts[key] + ) + } + ) + } .flowOn(Dispatchers.IO) .stateIn( scope = viewModelScope, @@ -290,10 +395,18 @@ class ChatViewModel( } init { + observeConversationPresenceWithDisconnectGrace() // Note: Mesh service delegate is now set by MainActivity loadAndInitialize() ContactDirectory.initialize(getApplication()) { mesh } com.bitchat.android.services.AppStateStore.canonicalizePrivateChats() + observeConversationDisplayNames() + // Application startup performs the initial restore. Repeat it for every new UI owner + // because a quick reopen can reuse a process whose in-memory state was cleared during + // controlled shutdown. + com.bitchat.android.services.AppStateStore.reloadConversationPersistence( + getApplication() + ) // Mark queued private messages as failed when the router gives up on them try { com.bitchat.android.services.MessageRouter.getInstance(getApplication(), mesh).onMessageExpired = { messageID -> @@ -317,7 +430,12 @@ class ChatViewModel( } } catch (_: Exception) { } } viewModelScope.launch { - try { com.bitchat.android.services.AppStateStore.privateMessages.collect { byPeer -> + try { + combine( + com.bitchat.android.services.AppStateStore.privateMessages, + com.bitchat.android.services.AppStateStore.unreadPrivateMessageCounts + ) { byPeer, unreadCounts -> byPeer to unreadCounts } + .collect { (byPeer, unreadCounts) -> val (canonicalChats, unreadConversationIDs) = withContext(Dispatchers.IO) { val canonical = ContactDirectory.canonicalizePrivateChats(byPeer) val unread = try { @@ -327,10 +445,14 @@ class ChatViewModel( messages.any { message -> message.sender != myNick && message.sender != "system" && + !com.bitchat.android.services.AppStateStore + .isPrivateMessageRead(message.id) && !seenMessageStore.hasBeenReadLocally(message.id) } } - .keys + .keys + unreadCounts + .filterValues { it > 0 } + .keys } catch (_: Exception) { state.getUnreadPrivateMessagesValue() } @@ -357,6 +479,60 @@ class ChatViewModel( // Removed background location notes subscription. Notes now load only when sheet opens. } + /** + * Mesh discovery can briefly drop a peer while transports hand over. Preserve its online + * treatment for a short grace window to keep conversation rows from jumping between sections. + * New connections still appear immediately. + */ + private fun observeConversationPresenceWithDisconnectGrace() { + viewModelScope.launch { + state.connectedPeers.collect { connected -> + val current = connected.toSet() + current.forEach { peerID -> + conversationPresenceRemovalJobs.remove(peerID)?.cancel() + } + + val displayed = conversationPresencePeers.value.toMutableList() + connected.forEach { peerID -> + if (peerID !in displayed) displayed.add(peerID) + } + if (displayed != conversationPresencePeers.value) { + conversationPresencePeers.value = displayed + } + + (displayed.toSet() - current).forEach { peerID -> + if (peerID in conversationPresenceRemovalJobs) return@forEach + conversationPresenceRemovalJobs[peerID] = launch { + delay(CONVERSATION_DISCONNECT_GRACE_MS) + if (peerID !in state.connectedPeers.value) { + conversationPresencePeers.value = + conversationPresencePeers.value - peerID + } + conversationPresenceRemovalJobs.remove(peerID) + } + } + } + } + } + + private fun observeConversationDisplayNames() { + viewModelScope.launch { + combine( + state.peerNicknames, + state.connectedPeers, + state.peerFingerprints + ) { peerNicknames, connectedPeers, _ -> + connectedPeers.mapNotNull { peerID -> + peerNicknames[peerID]?.let { peerID to it } + }.toMap() + }.collect { connectedNames -> + conversationListPreferences.canonicalizeAliases() + com.bitchat.android.services.AppStateStore + .updatePrivateConversationDisplayNames(connectedNames) + } + } + } + fun cancelMediaSend(messageId: String) { // Delegate to MediaSendingManager which tracks transfer IDs and cleans up UI state mediaSendingManager.cancelMediaSend(messageId) @@ -420,11 +596,9 @@ class ChatViewModel( refreshPeerFavoritedUs() try { com.bitchat.android.favorites.FavoritesPersistenceService.shared.addListener( - object : com.bitchat.android.favorites.FavoritesChangeListener { - override fun onFavoriteChanged(noiseKeyHex: String) = refreshPeerFavoritedUs() - override fun onAllCleared() = refreshPeerFavoritedUs() - } + favoriteRelationshipChangeListener ) + favoriteRelationshipListenerRegistered = true } catch (_: Exception) { } // Load verified fingerprints from secure storage @@ -443,9 +617,16 @@ class ChatViewModel( } override fun onCleared() { + if (favoriteRelationshipListenerRegistered) { + runCatching { + FavoritesPersistenceService.shared.removeListener( + favoriteRelationshipChangeListener + ) + } + favoriteRelationshipListenerRegistered = false + } geohashViewModel.shutdownUiSubscriptions() com.bitchat.android.services.AppStateStore.setSelectedPrivateChatPeer(null) - super.onCleared() // Note: Mesh service lifecycle is now managed by MainActivity } @@ -489,6 +670,13 @@ class ChatViewModel( val (conversationID, success) = withContext(Dispatchers.IO) { val canonicalID = ContactDirectory.canonicalConversationId(peerID) + com.bitchat.android.services.AppStateStore + .loadPrivateConversationHistory(canonicalID) + state.setPrivateChats( + ContactDirectory.canonicalizePrivateChats( + com.bitchat.android.services.AppStateStore.privateMessages.value + ) + ) val unreadAliases = matchingUnreadAliases( unreadConversationIDs = state.getUnreadPrivateMessagesValue(), canonicalConversationID = canonicalID, @@ -509,7 +697,17 @@ class ChatViewModel( } fun endPrivateChat() { + val conversationID = state.getSelectedPrivateChatPeerValue() privateChatManager.endPrivateChat() + if (conversationID != null) { + com.bitchat.android.services.AppStateStore + .releasePrivateConversationHistory(conversationID) + state.setPrivateChats( + ContactDirectory.canonicalizePrivateChats( + com.bitchat.android.services.AppStateStore.privateMessages.value + ) + ) + } // Notify notification manager that no private chat is active setCurrentPrivateChatPeer(null) // Clear mesh mention notifications since user is now back in mesh chat @@ -518,6 +716,133 @@ class ChatViewModel( hidePrivateChatSheet() } + internal suspend fun deletePrivateConversation( + peerOrConversationID: String + ): com.bitchat.android.services.DeletedPrivateConversation? { + val canonicalID = ContactDirectory.canonicalConversationId(peerOrConversationID) + val wasPinned = conversationListPreferences.isPinned(canonicalID) + val wasMuted = conversationListPreferences.isMuted(canonicalID) + val draft = conversationListPreferences.draftFor(canonicalID) + val unreadAliases = matchingUnreadAliases( + unreadConversationIDs = state.getUnreadPrivateMessagesValue(), + canonicalConversationID = canonicalID, + canonicalize = ContactDirectory::canonicalConversationId + ) + val deletion = withContext(Dispatchers.IO) { + com.bitchat.android.services.AppStateStore + .deletePrivateConversationAndWait(canonicalID) + }?.copy( + wasPinned = wasPinned, + wasMuted = wasMuted, + draft = draft + ) ?: return null + conversationListPreferences.removeConversation(canonicalID) + + state.setPrivateChats( + ContactDirectory.canonicalizePrivateChats( + com.bitchat.android.services.AppStateStore.privateMessages.value + ) + ) + state.setUnreadPrivateMessages( + state.getUnreadPrivateMessagesValue() - unreadAliases + ) + seenMessageStore.remove(deletion.messageIDs) + + val selected = state.getSelectedPrivateChatPeerValue() + if ( + selected != null && + ContactDirectory.canonicalConversationId(selected) + .equals(canonicalID, ignoreCase = true) + ) { + privateChatManager.endPrivateChat() + setCurrentPrivateChatPeer(null) + } + val sheetPeer = state.getPrivateChatSheetPeerValue() + if ( + sheetPeer != null && + ContactDirectory.canonicalConversationId(sheetPeer) + .equals(canonicalID, ignoreCase = true) + ) { + hidePrivateChatSheet() + } + clearNotificationsForSender(canonicalID) + notificationManager.removeConversationShortcut(canonicalID) + return deletion + } + + internal suspend fun restoreDeletedConversation( + deletion: com.bitchat.android.services.DeletedPrivateConversation + ): Boolean { + val restored = withContext(Dispatchers.IO) { + com.bitchat.android.services.AppStateStore + .restoreDeletedConversation(deletion) + } + if (!restored) return false + if (deletion.wasPinned != conversationListPreferences.isPinned(deletion.conversationID)) { + conversationListPreferences.togglePinned(deletion.conversationID) + } + if (deletion.wasMuted != conversationListPreferences.isMuted(deletion.conversationID)) { + conversationListPreferences.toggleMuted(deletion.conversationID) + } + deletion.draft?.let { + conversationListPreferences.setDraft(deletion.conversationID, it) + } + state.setPrivateChats( + ContactDirectory.canonicalizePrivateChats( + com.bitchat.android.services.AppStateStore.privateMessages.value + ) + ) + if (deletion.unreadMessageCount > 0) { + state.setUnreadPrivateMessages( + state.getUnreadPrivateMessagesValue() + deletion.conversationID + ) + } + return true + } + + internal suspend fun setConversationRead( + conversationID: String, + isRead: Boolean + ): Boolean { + val canonicalID = ContactDirectory.canonicalConversationId(conversationID) + val updated = withContext(Dispatchers.IO) { + com.bitchat.android.services.AppStateStore + .setPrivateConversationRead(canonicalID, isRead) + } + if (!updated) return false + state.setUnreadPrivateMessages( + if (isRead) { + state.getUnreadPrivateMessagesValue().filterNotTo(mutableSetOf()) { + ContactDirectory.canonicalConversationId(it) + .equals(canonicalID, ignoreCase = true) + } + } else { + state.getUnreadPrivateMessagesValue() + canonicalID + } + ) + return true + } + + internal fun toggleConversationPinned(conversationID: String) { + conversationListPreferences.togglePinned(conversationID) + } + + internal fun toggleConversationMuted(conversationID: String) { + conversationListPreferences.toggleMuted(conversationID) + } + + internal fun conversationDraft(conversationID: String?): String = + conversationID + ?.let(ContactDirectory::canonicalConversationId) + ?.lowercase() + ?.let(conversationListPreferences.drafts.value::get) + .orEmpty() + + internal fun setConversationDraft(conversationID: String?, text: String) { + if (conversationID.isNullOrBlank()) return + conversationListPreferences.setDraft(conversationID, text) + } + // MARK: - Open Latest Unread Private Chat fun openLatestUnreadPrivateChat() { @@ -574,8 +899,14 @@ class ChatViewModel( // MARK: - Message Sending - fun sendMessage(content: String) { - if (content.isEmpty()) return + fun sendMessage( + content: String, + onAccepted: (Boolean) -> Unit = {} + ) { + if (content.isEmpty()) { + onAccepted(false) + return + } // Check for commands if (content.startsWith("/")) { @@ -589,10 +920,25 @@ class ChatViewModel( mesh.myPeerID, state.getNicknameValue() ) + } else if (channel != null && channelManager.hasChannelKey(channel)) { + channelManager.sendEncryptedChannelMessage( + messageContent, + mentions, + channel, + state.getNicknameValue(), + mesh.myPeerID, + onEncryptedPayload = { + mesh.sendMessage(messageContent, mentions, channel) + }, + onFallback = { + mesh.sendMessage(messageContent, mentions, channel) + } + ) } else { mesh.sendMessage(messageContent, mentions, channel) } }, this) + onAccepted(true) return } @@ -621,18 +967,33 @@ class ChatViewModel( } // Send private message val recipientNickname = nicknameForPeer(selectedPeer) - privateChatManager.sendPrivateMessage( - content, - selectedPeer, - recipientNickname, - state.getNicknameValue(), - mesh.myPeerID - ) { messageContent, peerID, recipientNicknameParam, messageId -> - val router = com.bitchat.android.services.MessageRouter.getInstance(getApplication(), mesh) - val route = router.sendPrivate(messageContent, peerID, recipientNicknameParam, messageId) - if (route == com.bitchat.android.services.MessageRouter.RouteResult.NOSTR) { - messageManager.updateMessageDeliveryStatus(messageId, com.bitchat.android.model.DeliveryStatus.Sent) + val destination = selectedPeer + viewModelScope.launch { + val accepted = privateChatManager.sendPrivateMessageDurably( + content, + destination, + recipientNickname, + state.getNicknameValue(), + mesh.myPeerID + ) { messageContent, peerID, recipientNicknameParam, messageId -> + val router = com.bitchat.android.services.MessageRouter.getInstance( + getApplication(), + mesh + ) + val route = router.sendPrivate( + messageContent, + peerID, + recipientNicknameParam, + messageId + ) + if (route == com.bitchat.android.services.MessageRouter.RouteResult.NOSTR) { + messageManager.updateMessageDeliveryStatus( + messageId, + com.bitchat.android.model.DeliveryStatus.Sent + ) + } } + onAccepted(accepted) } } else { // Check if we're in a location channel @@ -678,6 +1039,7 @@ class ChatViewModel( mesh.sendMessage(content, mentions, null) } } + onAccepted(true) } } @@ -1041,8 +1403,22 @@ class ChatViewModel( } // MARK: - Emergency Clear - + + private var panicClearInProgress = false + fun panicClearAllData() { + if (panicClearInProgress) return + panicClearInProgress = true + viewModelScope.launch { + try { + performPanicClearAllData() + } finally { + panicClearInProgress = false + } + } + } + + private suspend fun performPanicClearAllData() { Log.w(TAG, "🚨 PANIC MODE ACTIVATED - Clearing all sensitive data") try { com.bitchat.android.geohash.LocationChannelManager @@ -1053,26 +1429,32 @@ class ChatViewModel( // A pending one-shot downgrade confirmation must not survive panic or // become actionable against the fresh post-wipe identity. mediaSendingManager.clearPendingPrivateMediaConsent() - + + // Stop all message admission before wiping storage. The AppStateStore gate also rejects + // any transport callback already in flight until the fresh identity is ready. + clearAllMeshServiceData() + val conversationsCleared = + com.bitchat.android.services.AppStateStore + .panicClearPrivateConversations() + // Clear all UI managers + com.bitchat.android.services.AppStateStore.clear() messageManager.clearAllMessages() channelManager.clearAllChannels() privateChatManager.clearAllPrivateChats() dataManager.clearAllData() + conversationListPreferences.clearAll() // Clear seen message store try { com.bitchat.android.services.SeenMessageStore.getInstance(getApplication()).clear() } catch (_: Exception) { } - // Clear all mesh service data - clearAllMeshServiceData() - // Clear all cryptographic data clearAllCryptographicData() // Clear all notifications - notificationManager.clearAllNotifications() + notificationManager.clearAllNotifications(removeConversationShortcuts = true) // Clear all media files com.bitchat.android.features.file.FileUtils.clearAllMedia(getApplication()) @@ -1099,8 +1481,17 @@ class ChatViewModel( val newNickname = "anon${Random.nextInt(1000, 9999)}" state.setNickname(newNickname) dataManager.saveNickname(newNickname) - + + if (!conversationsCleared) { + // Privacy wins over availability: keep private-message admission and transports + // stopped if SQLite could not prove that the conversation history was erased. + Log.e(TAG, "🚨 PANIC MODE INCOMPLETE - conversation database wipe failed") + return + } + // Recreate mesh service with fresh identity + com.bitchat.android.services.AppStateStore + .resumePrivateConversationsAfterPanic() recreateMeshServiceAfterPanic() Log.w(TAG, "🚨 PANIC MODE COMPLETED - New identity: ${mesh.myPeerID}") diff --git a/app/src/main/java/com/bitchat/android/ui/CommandProcessor.kt b/app/src/main/java/com/bitchat/android/ui/CommandProcessor.kt index 34b205af..b10ac9e1 100644 --- a/app/src/main/java/com/bitchat/android/ui/CommandProcessor.kt +++ b/app/src/main/java/com/bitchat/android/ui/CommandProcessor.kt @@ -4,6 +4,8 @@ import com.bitchat.android.mesh.MeshService import com.bitchat.android.model.BitchatMessage import java.util.Date import java.util.Locale +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch /** * Handles processing of IRC-style commands @@ -12,7 +14,8 @@ class CommandProcessor( private val state: ChatState, private val messageManager: MessageManager, private val channelManager: ChannelManager, - private val privateChatManager: PrivateChatManager + private val privateChatManager: PrivateChatManager, + private val coroutineScope: CoroutineScope? = null ) { // Available commands list @@ -23,6 +26,7 @@ class CommandProcessor( CommandSuggestion("/hug", emptyList(), "", "send someone a warm hug"), CommandSuggestion("/j", listOf("/join"), "", "join or create a channel"), CommandSuggestion("/m", listOf("/msg"), " [message]", "send private message"), + CommandSuggestion("/pay", emptyList(), " [public]", "send a Cashu ecash token"), CommandSuggestion("/slap", emptyList(), "", "slap someone with a trout"), CommandSuggestion("/unblock", emptyList(), "", "unblock a peer"), CommandSuggestion("/w", emptyList(), null, "see who's online") @@ -38,6 +42,7 @@ class CommandProcessor( when (cmd) { "/j", "/join" -> handleJoinCommand(parts, myPeerID) "/m", "/msg" -> handleMessageCommand(parts, meshService, viewModel) + "/pay" -> handlePayCommand(command, meshService, myPeerID, onSendMessage, viewModel) "/w" -> handleWhoCommand(meshService, viewModel) "/clear" -> handleClearCommand() "/pass" -> handlePassCommand(parts, myPeerID) @@ -90,15 +95,15 @@ class CommandProcessor( if (parts.size > 2) { val messageContent = parts.drop(2).joinToString(" ") val recipientNickname = getPeerNickname(peerID, meshService) - privateChatManager.sendPrivateMessage( + sendPrivateMessage( messageContent, peerID, recipientNickname, state.getNicknameValue(), - getMyPeerID(meshService) - ) { content, peerIdParam, recipientNicknameParam, messageId -> - sendPrivateMessageVia(meshService, content, peerIdParam, recipientNicknameParam, messageId, viewModel) - } + getMyPeerID(meshService), + meshService, + viewModel + ) } else { val systemMessage = BitchatMessage( sender = "system", @@ -189,6 +194,9 @@ class CommandProcessor( // Clear private chat val peerID = state.getSelectedPrivateChatPeerValue()!! messageManager.clearPrivateMessages(peerID) + // `/clear` removes history but should not navigate away from the chat the + // command was issued in. A later message will repopulate this conversation. + state.setSelectedPrivateChatPeer(peerID) } state.getCurrentChannelValue() != null -> { // Clear channel messages @@ -300,15 +308,15 @@ class CommandProcessor( // Send as regular message if (state.getSelectedPrivateChatPeerValue() != null) { val peerID = state.getSelectedPrivateChatPeerValue()!! - privateChatManager.sendPrivateMessage( + sendPrivateMessage( actionMessage, peerID, getPeerNickname(peerID, meshService), state.getNicknameValue(), - myPeerID - ) { content, peerIdParam, recipientNicknameParam, messageId -> - sendPrivateMessageVia(meshService, content, peerIdParam, recipientNicknameParam, messageId, viewModel) - } + myPeerID, + meshService, + viewModel + ) } else if (isInLocationChannel) { // Let the transport layer add the echo; just send it out onSendMessage(actionMessage, emptyList(), null) @@ -357,6 +365,95 @@ class CommandProcessor( ) messageManager.addMessage(systemMessage) } + + private fun handlePayCommand( + command: String, + meshService: MeshService, + myPeerID: String, + onSendMessage: (String, List, String?) -> Unit, + viewModel: ChatViewModel? + ) { + val args = command.trim().split(Regex("\\s+")).drop(1) + if (args.isEmpty()) { + addSystemMessage("usage: /pay [public] — Cashu tokens are bearer instruments") + return + } + + val publicConfirmed = args.lastOrNull()?.equals("public", ignoreCase = true) == true + val rawToken = if (publicConfirmed) args.dropLast(1).joinToString(" ") else args.joinToString(" ") + val token = CashuTokenDecoder.bareToken(rawToken) + val info = token?.let { CashuTokenDecoder.decode(it, strict = true) } + if (token == null || info == null) { + addSystemMessage("invalid cashu token — not sending it") + return + } + + val selectedPeer = state.getSelectedPrivateChatPeerValue() + if (selectedPeer != null) { + privateChatManager.sendPrivateMessage( + token, + selectedPeer, + getPeerNickname(selectedPeer, meshService), + state.getNicknameValue(), + myPeerID + ) { content, peerID, recipientNickname, messageId -> + sendPrivateMessageVia(meshService, content, peerID, recipientNickname, messageId, viewModel) + } + } else { + if (!publicConfirmed) { + addSystemMessage( + "Cashu tokens are bearer instruments. Anyone here can redeem this token. " + + "Confirm with: /pay public" + ) + return + } + val isLocationChannel = + state.selectedLocationChannel.value is com.bitchat.android.geohash.ChannelID.Location + if (!isLocationChannel) { + val message = BitchatMessage( + sender = state.getNicknameValue() ?: myPeerID, + content = token, + timestamp = Date(), + isRelay = false, + senderPeerID = myPeerID, + channel = state.getCurrentChannelValue() + ) + val channel = state.getCurrentChannelValue() + if (channel != null) channelManager.addChannelMessage(channel, message, myPeerID) + else messageManager.addMessage(message) + } + onSendMessage(token, emptyList(), state.getCurrentChannelValue()) + } + + addSystemMessage( + "sent ${info.displayAmount ?: "Cashu token"} — bearer token; first redeemer wins" + ) + } + + private fun addSystemMessage(content: String) { + val message = BitchatMessage( + sender = "system", + content = content, + timestamp = Date(), + isRelay = false + ) + val selectedPeer = state.getSelectedPrivateChatPeerValue() + val selectedLocationChannel = state.selectedLocationChannel.value + val channel = state.getCurrentChannelValue() + when { + selectedPeer != null -> { + messageManager.addPrivateMessageNoUnread(selectedPeer, message.copy(isPrivate = true)) + } + selectedLocationChannel is com.bitchat.android.geohash.ChannelID.Location -> { + messageManager.addChannelMessage( + "geo:${selectedLocationChannel.channel.geohash}", + message + ) + } + channel != null -> channelManager.addChannelMessage(channel, message, null) + else -> messageManager.addMessage(message) + } + } private fun handleUnknownCommand(cmd: String) { val systemMessage = BitchatMessage( @@ -404,7 +501,12 @@ class CommandProcessor( emptyList() } - return baseCommands + channelCommands + val isPublicGeohash = + state.getSelectedPrivateChatPeerValue() == null && + state.selectedLocationChannel.value is com.bitchat.android.geohash.ChannelID.Location + return (baseCommands + channelCommands).filterNot { + isPublicGeohash && it.command == "/pay" + } } private fun filterCommands(commands: List, input: String): List { @@ -524,7 +626,51 @@ class CommandProcessor( private fun getMyPeerID(meshService: MeshService): String { return meshService.myPeerID } - + + private fun sendPrivateMessage( + content: String, + peerID: String, + recipientNickname: String?, + senderNickname: String?, + myPeerID: String, + meshService: MeshService, + viewModel: ChatViewModel? + ) { + val send: (String, String, String, String) -> Unit = + { messageContent, peerIdParam, recipientNicknameParam, messageId -> + sendPrivateMessageVia( + meshService, + messageContent, + peerIdParam, + recipientNicknameParam, + messageId, + viewModel + ) + } + val scope = coroutineScope + if (scope == null) { + privateChatManager.sendPrivateMessage( + content, + peerID, + recipientNickname, + senderNickname, + myPeerID, + send + ) + } else { + scope.launch { + privateChatManager.sendPrivateMessageDurably( + content, + peerID, + recipientNickname, + senderNickname, + myPeerID, + send + ) + } + } + } + private fun sendPrivateMessageVia( meshService: MeshService, content: String, diff --git a/app/src/main/java/com/bitchat/android/ui/ConversationSecurityState.kt b/app/src/main/java/com/bitchat/android/ui/ConversationSecurityState.kt new file mode 100644 index 00000000..5bbdbfe3 --- /dev/null +++ b/app/src/main/java/com/bitchat/android/ui/ConversationSecurityState.kt @@ -0,0 +1,17 @@ +package com.bitchat.android.ui + +/** + * Resolves the Noise session shown for a private conversation. + * + * Persistent conversations use a canonical contact ID, while live Noise sessions are keyed by + * the currently connected mesh peer ID. Prefer that live identity and retain the conversation ID + * as a fallback for peers whose IDs are already identical. + */ +internal fun resolveConversationSessionState( + conversationID: String, + activeMeshPeerID: String?, + peerSessionStates: Map +): String? { + return activeMeshPeerID?.let(peerSessionStates::get) + ?: peerSessionStates[conversationID] +} diff --git a/app/src/main/java/com/bitchat/android/ui/ConversationSummary.kt b/app/src/main/java/com/bitchat/android/ui/ConversationSummary.kt new file mode 100644 index 00000000..2178d793 --- /dev/null +++ b/app/src/main/java/com/bitchat/android/ui/ConversationSummary.kt @@ -0,0 +1,189 @@ +package com.bitchat.android.ui + +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.BitchatMessageType +import com.bitchat.android.model.DeliveryStatus +import com.bitchat.android.services.PrivateMessageArrivalOrder + +/** + * Presence-independent presentation state for every retained private conversation. + */ +internal data class ConversationSummary( + val conversationID: String, + val displayName: String, + val unreadCount: Int, + val latestMessageAt: Long, + val latestActivityOrder: Long, + val latestMessageType: BitchatMessageType, + val latestMessagePreview: String, + val latestMessageIsOutgoing: Boolean = false, + val latestDeliveryStatus: DeliveryStatus? = null, + val transport: DirectMessageTransport, + val nostrPubkey: String?, + val identityAliases: Set, + val isConnected: Boolean = false, + val connectedPeerID: String? = null, + val sourceGeohash: String? = null, + val isPinned: Boolean = false, + val isMuted: Boolean = false, + val draft: String? = null +) + +internal fun buildConversationSummaries( + unreadConversationIDs: Set, + privateChats: Map>, + currentUserIdentifiers: Set, + canonicalize: (String) -> String, + isMessageRead: (BitchatMessage) -> Boolean, + persistedUnreadCounts: Map = emptyMap() +): List { + if (privateChats.isEmpty()) return emptyList() + + val currentUsers = currentUserIdentifiers + .filter(String::isNotBlank) + .mapTo(mutableSetOf()) { it.lowercase() } + val unreadCanonicalIDs = unreadConversationIDs + .mapTo(mutableSetOf()) { canonicalize(it).lowercase() } + val unreadCountsByCanonicalID = persistedUnreadCounts.entries + .groupingBy { canonicalize(it.key).lowercase() } + .fold(0) { total, entry -> total + entry.value } + val aliasesByCanonicalID = linkedMapOf>() + val messagesByCanonicalID = linkedMapOf>() + val displayCanonicalIDByNormalized = linkedMapOf() + + privateChats.forEach { (sourceID, messages) -> + val canonicalID = canonicalize(sourceID) + val normalizedID = canonicalID.lowercase() + displayCanonicalIDByNormalized.putIfAbsent(normalizedID, canonicalID) + aliasesByCanonicalID + .getOrPut(normalizedID) { linkedSetOf() } + .add(sourceID) + messagesByCanonicalID + .getOrPut(normalizedID) { mutableListOf() } + .addAll(messages) + } + + return messagesByCanonicalID.mapNotNull { (normalizedConversationID, sourceMessages) -> + val conversationID = + displayCanonicalIDByNormalized.getValue(normalizedConversationID) + val messages = sourceMessages.distinctBy { it.id } + if (messages.isEmpty()) return@mapNotNull null + + fun activityOrder(message: BitchatMessage): Long = + PrivateMessageArrivalOrder.sequenceOf(message.id) ?: message.timestamp.time + + val latest = messages.maxWithOrNull( + compareBy(::activityOrder).thenBy { it.id } + ) ?: return@mapNotNull null + fun isOutgoing(message: BitchatMessage): Boolean = + message.sender.lowercase() in currentUsers || + message.senderPeerID?.lowercase() in currentUsers + + val incoming = messages.filterNot { + isOutgoing(it) || it.sender == "system" + } + val latestIncoming = incoming.maxWithOrNull( + compareBy(::activityOrder).thenBy { it.id } + ) + val canonicalUnread = conversationID.lowercase() in unreadCanonicalIDs + val persistedUnreadCount = unreadCountsByCanonicalID[conversationID.lowercase()] ?: 0 + val unreadCount = maxOf( + persistedUnreadCount, + if (canonicalUnread && incoming.isNotEmpty()) { + incoming.count { !isMessageRead(it) }.coerceAtLeast(1) + } else { + 0 + } + ) + val aliases = aliasesByCanonicalID[normalizedConversationID].orEmpty() + val nostrPubkey = latestIncoming?.senderNostrPubkey ?: latest.senderNostrPubkey + val isNostrConversation = nostrPubkey != null || + aliases.any(::isNostrConversationKey) || + isNostrConversationKey(conversationID) + val displayName = latestIncoming + ?.sender + ?.takeIf { it.isNotBlank() } + ?: latest.recipientNickname + ?.takeIf { it.isNotBlank() } + ?: latest.sender.takeIf { + it.isNotBlank() && it !in currentUsers && it != "system" + } + ?: conversationID.take(12) + + ConversationSummary( + conversationID = conversationID, + displayName = displayName, + unreadCount = unreadCount, + latestMessageAt = + PrivateMessageArrivalOrder.receivedAtOf(latest.id) ?: latest.timestamp.time, + latestActivityOrder = activityOrder(latest), + latestMessageType = latest.type, + latestMessagePreview = latest.conversationPreview(), + latestMessageIsOutgoing = isOutgoing(latest), + latestDeliveryStatus = latest.deliveryStatus, + transport = if (isNostrConversation) { + DirectMessageTransport.NOSTR + } else { + DirectMessageTransport.MESH + }, + nostrPubkey = nostrPubkey, + identityAliases = (aliases + conversationID) + .mapTo(mutableSetOf()) { it.lowercase() } + ) + } +} + +internal fun resolveConversationDisplayName( + fallbackName: String, + connectedPeerID: String?, + peerNicknames: Map, + resolvedContactName: String?, + persistedDisplayName: String? +): String { + fun String?.usableName(): String? = this?.takeUnless { + it.isBlank() || it.equals("Unknown", ignoreCase = true) + } + + val liveName = connectedPeerID?.let { peerID -> + peerNicknames[peerID] + ?: peerNicknames.entries + .firstOrNull { (candidateID, _) -> + candidateID.equals(peerID, ignoreCase = true) + } + ?.value + } + return liveName.usableName() + ?: resolvedContactName.usableName() + ?: persistedDisplayName.usableName() + ?: fallbackName +} + +internal fun sortConversationSummaries( + conversations: List +): List = conversations.sortedWith( + compareByDescending { it.isConnected } + .thenByDescending { it.isPinned } + .thenByDescending { it.unreadCount > 0 } + .thenByDescending { it.latestActivityOrder } + .thenBy { it.displayName.lowercase() } + .thenBy { it.conversationID } +) + +private fun isNostrConversationKey(value: String): Boolean = + value.startsWith("nostr_") || value.startsWith("nostr:") + +private fun BitchatMessage.conversationPreview(): String { + val preview = when (type) { + BitchatMessageType.File -> content + .substringAfterLast('/') + .substringAfterLast('\\') + else -> content + } + return preview + .replace(CONVERSATION_PREVIEW_WHITESPACE, " ") + .trim() + .take(MAX_CONVERSATION_PREVIEW_LENGTH) +} + +private val CONVERSATION_PREVIEW_WHITESPACE = Regex("\\s+") +private const val MAX_CONVERSATION_PREVIEW_LENGTH = 240 diff --git a/app/src/main/java/com/bitchat/android/ui/GeohashPeopleList.kt b/app/src/main/java/com/bitchat/android/ui/GeohashPeopleList.kt index d784610a..0c0e583f 100644 --- a/app/src/main/java/com/bitchat/android/ui/GeohashPeopleList.kt +++ b/app/src/main/java/com/bitchat/android/ui/GeohashPeopleList.kt @@ -281,6 +281,7 @@ private fun GeohashPersonItem( onTap: () -> Unit ) { val palette = LocalBitchatPalette.current + val colorScheme = MaterialTheme.colorScheme val statusIconRes = if (isTeleported) R.drawable.ic_spec_teleport @@ -298,25 +299,14 @@ private fun GeohashPersonItem( Row( modifier = Modifier .fillMaxWidth() - // Exact height, not padding: a row that sizes to its content makes the card change - // height whenever the list reorders. - .height(SheetRowHeight) .clickable(onClick = onTap) - .padding(horizontal = SheetRowHorizontal), + .padding(horizontal = SheetRowHorizontal, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically ) { - Box( - modifier = Modifier.size(SheetRowLeadingSlot), - contentAlignment = Alignment.Center - ) { - if (hasUnreadDM) { - Icon( - imageVector = Icons.Filled.Email, - contentDescription = stringResource(R.string.cd_unread_message), - modifier = Modifier.size(22.dp), - tint = palette.accentOrange - ) - } else { + PeerAvatar( + name = baseNameRaw, + color = baseColor, + badge = { Icon( painter = painterResource(statusIconRes), contentDescription = if (isTeleported) { @@ -324,13 +314,13 @@ private fun GeohashPersonItem( } else { stringResource(R.string.section_on_location) }, - modifier = Modifier.size(22.dp), - tint = baseColor + modifier = Modifier.size(13.dp), + tint = if (isTeleported) palette.accentPurple else colorScheme.primary ) } - } + ) - Spacer(modifier = Modifier.width(SheetRowLeadingGutter)) + Spacer(modifier = Modifier.width(12.dp)) Row( modifier = Modifier.weight(1f), @@ -365,5 +355,16 @@ private fun GeohashPersonItem( ) } } + + if (hasUnreadDM) { + Icon( + imageVector = Icons.Filled.Email, + contentDescription = stringResource(R.string.cd_unread_message), + modifier = Modifier + .padding(start = 8.dp) + .size(18.dp), + tint = palette.accentOrange + ) + } } } diff --git a/app/src/main/java/com/bitchat/android/ui/InputComponents.kt b/app/src/main/java/com/bitchat/android/ui/InputComponents.kt index 7302379b..cc429dc8 100644 --- a/app/src/main/java/com/bitchat/android/ui/InputComponents.kt +++ b/app/src/main/java/com/bitchat/android/ui/InputComponents.kt @@ -1,5 +1,6 @@ package com.bitchat.android.ui +import android.view.HapticFeedbackConstants import com.bitchat.android.ui.theme.BitchatFontFamily // [Goose] TODO: Replace inline file attachment stub with FilePickerButton abstraction that dispatches via FileShareDispatcher @@ -13,7 +14,9 @@ import androidx.compose.animation.animateColorAsState import androidx.compose.animation.animateContentSize import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.animateOffsetAsState import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween import androidx.compose.animation.expandHorizontally @@ -43,6 +46,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.scale +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Rect +import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.platform.LocalView import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.graphics.Color @@ -57,7 +65,10 @@ import androidx.compose.ui.text.input.OffsetMapping import androidx.compose.ui.text.input.TransformedText import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.toSize +import kotlin.math.roundToInt import androidx.compose.ui.unit.sp import com.bitchat.android.R import androidx.compose.ui.focus.onFocusChanged @@ -316,22 +327,72 @@ fun MessageInput( var isRecording by remember { mutableStateOf(false) } var elapsedMs by remember { mutableStateOf(0L) } var amplitude by remember { mutableStateOf(0) } + val cashuToken = remember(value.text) { + CashuTokenDecoder.bareToken(value.text) + } - // Recording is the one state worth shouting about, so it overrides focus. + // Slide-to-cancel: while recording, the mic button streams the finger position (root + // coords) up here; the cancel disc beside it reports its bounds. Approaching the disc + // makes it lean toward the finger and blush red; only entering it activates cancel. + var cancelBounds by remember { mutableStateOf(null) } + var cancelFinger by remember { mutableStateOf(null) } + val density = LocalDensity.current + val cancelSlackPx = with(density) { 8.dp.toPx() } + val cancelHover = cancelFinger != null && + cancelBounds?.inflate(cancelSlackPx)?.contains(cancelFinger!!) == true + val cancelCenter = cancelBounds?.center + val cancelProximity: Float + val cancelPull: Offset + val trackedFinger = cancelFinger + if (trackedFinger != null && cancelCenter != null) { + val toFinger = trackedFinger - cancelCenter + val dist = toFinger.getDistance() + val outer = with(density) { 36.dp.toPx() } + val inner = with(density) { 18.dp.toPx() } + cancelProximity = ((outer - dist) / (outer - inner)).coerceIn(0f, 1f) + cancelPull = if (dist > 1f) { + toFinger * (cancelProximity * with(density) { 12.dp.toPx() } / dist) + } else Offset.Zero + } else { + cancelProximity = 0f + cancelPull = Offset.Zero + } + // A firm, physical click each time the finger enters or leaves the cancel target. + val view = LocalView.current + var cancelHoverHapticState by remember { mutableStateOf(false) } + LaunchedEffect(cancelHover, isRecording) { + if (!isRecording) { + cancelHoverHapticState = false + } else if (cancelHover != cancelHoverHapticState) { + view.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK) + cancelHoverHapticState = cancelHover + } + } + + // Recording is the one state worth shouting about, so it overrides focus. While recording + // the outline also firms up slightly in the same fast sweep — present, but muted. val borderColor by animateColorAsState( targetValue = when { - isRecording -> colorScheme.error.copy(alpha = 0.7f) + isRecording -> colorScheme.error.copy(alpha = 0.65f) isFocused.value -> palette.inputOutlineFocused else -> palette.inputOutline }, animationSpec = tween(BitchatMotion.STANDARD_MS, easing = FastOutSlowInEasing), label = "composerBorder" ) - // A barely-there lift on focus. Enough to register, not enough to look like a different - // component. Slightly translucent so the messages scrolling underneath stay faintly visible. + val borderWidth by animateDpAsState( + targetValue = if (isRecording) 1.5.dp else 1.dp, + animationSpec = tween(BitchatMotion.STANDARD_MS, easing = FastOutSlowInEasing), + label = "composerBorderWidth" + ) + // A barely-there lift on focus. While recording the pill turns into a neutral grey slab + // (NOT the brand-tinted elevation color) so it protrudes from the flat black chat. val containerColor by animateColorAsState( - targetValue = (if (isFocused.value) palette.inputSurfaceFocused else palette.inputSurface) - .copy(alpha = ComposerFillAlpha), + targetValue = when { + isRecording -> colorScheme.surfaceVariant.copy(alpha = 0.97f) + else -> (if (isFocused.value) palette.inputSurfaceFocused else palette.inputSurface) + .copy(alpha = ComposerFillAlpha) + }, animationSpec = tween(BitchatMotion.STANDARD_MS, easing = FastOutSlowInEasing), label = "composerContainer" ) @@ -351,7 +412,7 @@ fun MessageInput( animationSpec = tween(BitchatMotion.STANDARD_MS, easing = FastOutSlowInEasing) ) .background(containerColor, ComposerShape) - .border(1.dp, borderColor, ComposerShape), + .border(borderWidth, borderColor, ComposerShape), verticalAlignment = Alignment.Bottom ) { Box( @@ -367,16 +428,17 @@ fun MessageInput( // user is composing rather than reading, and green-on-black is tiring to // type into. textStyle = MaterialTheme.typography.bodyMedium.copy( - color = colorScheme.onSurface, + color = if (cashuToken == null) colorScheme.onSurface else Color.Transparent, fontFamily = BitchatFontFamily ), cursorBrush = SolidColor( - if (isRecording) Color.Transparent else colorScheme.onSurface + if (isRecording || cashuToken != null) Color.Transparent else colorScheme.onSurface ), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Send), keyboardActions = KeyboardActions(onSend = { if (hasText) onSend() }), + singleLine = cashuToken != null, // Cap the growth so a pasted wall of text cannot swallow the message list. maxLines = 6, visualTransformation = remember( @@ -405,6 +467,14 @@ fun MessageInput( } ) + cashuToken?.let { token -> + CashuPaymentChip( + token = token, + onClick = { focusRequester.requestFocus() }, + showActions = false, + ) + } + // Placeholder fades rather than blinking, which matters because it reappears // every time a message is sent. val placeholderAlpha by animateFloatAsState( @@ -436,25 +506,28 @@ fun MessageInput( Row( modifier = Modifier .fillMaxWidth() + // Same content height as the single-line text field, so the pill + // (and the separator above it) does not change size when the + // recording visualizer replaces the field. + .height(22.dp) .alpha(waveformAlpha), verticalAlignment = Alignment.CenterVertically ) { - RealtimeScrollingWaveform( - modifier = Modifier.weight(1f).height(22.dp), - amplitudeNorm = normalizeAmplitudeSample(amplitude) - ) - Spacer(Modifier.width(12.dp)) + // Timestamp on the left, clear of the thumb resting on the record + // button; the waveform keeps the remaining width and its history + // scrolls off the left edge while live data streams in from the right. val secs = (elapsedMs / 1000).toInt() - val maxSecs = 10 // 10 second max recording time Text( - text = String.format( - "%02d:%02d / %02d:%02d", - secs / 60, secs % 60, maxSecs / 60, maxSecs % 60 - ), + text = String.format("%02d:%02d", secs / 60, secs % 60), fontFamily = BitchatFontFamily, color = colorScheme.error, fontSize = (BASE_FONT_SIZE - 4).sp ) + Spacer(Modifier.width(12.dp)) + RealtimeScrollingWaveform( + modifier = Modifier.weight(1f).height(22.dp), + amplitudeNorm = normalizeAmplitudeSample(amplitude) + ) } } } @@ -528,8 +601,37 @@ fun MessageInput( ) } + // The slide-to-cancel target sits well clear of the record + // button (camera's slot plus a gap), rests as a cancel disc, + // leans toward an approaching finger and snaps red on hover. + AnimatedVisibility( + visible = isRecording, + enter = fadeIn(tween(BitchatMotion.STANDARD_MS)) + + expandHorizontally( + tween(BitchatMotion.STANDARD_MS, easing = FastOutSlowInEasing) + ), + exit = fadeOut(tween(BitchatMotion.QUICK_MS)) + + shrinkHorizontally( + tween(BitchatMotion.QUICK_MS, easing = FastOutSlowInEasing) + ) + ) { + Row(verticalAlignment = Alignment.CenterVertically) { + RecordingCancelButton( + hover = cancelHover, + proximity = cancelProximity, + pull = cancelPull, + onBounds = { cancelBounds = it } + ) + Spacer(Modifier.width(24.dp)) + } + } + VoiceRecordButton( isRecording = isRecording, + shouldCancel = { pos -> + cancelBounds?.inflate(cancelSlackPx)?.contains(pos) == true + }, + onTrackFinger = { cancelFinger = it }, onStart = { isRecording = true elapsedMs = 0L @@ -583,6 +685,76 @@ fun MessageInput( // Auto-stop handled inside VoiceRecordButton } +/** + * Slide-to-cancel target shown beside the record button while capturing. It always shows the + * cancel glyph so the destination is unambiguous; as the finger approaches it leans toward + * it (magnetic pull) and blushes red, and on contact it blooms. Release there cancels; + * sliding back out returns to send mode. All motion is spring-driven so it stays fluid. + */ +@Composable +private fun RecordingCancelButton( + hover: Boolean, + proximity: Float, + pull: Offset, + onBounds: (Rect) -> Unit, + modifier: Modifier = Modifier +) { + val palette = LocalBitchatPalette.current + val colorScheme = MaterialTheme.colorScheme + + val pullAnim by animateOffsetAsState( + targetValue = pull, + animationSpec = spring( + dampingRatio = Spring.DampingRatioMediumBouncy, + stiffness = Spring.StiffnessMedium + ), + label = "cancelPull" + ) + val scale by animateFloatAsState( + targetValue = if (hover) 1.28f else 1f + 0.1f * proximity, + animationSpec = spring( + dampingRatio = Spring.DampingRatioMediumBouncy, + stiffness = Spring.StiffnessMedium + ), + label = "cancelScale" + ) + val container = androidx.compose.ui.graphics.lerp( + palette.inputButton, + colorScheme.error, + if (hover) 1f else proximity * 0.85f + ) + val tint = androidx.compose.ui.graphics.lerp( + colorScheme.onSurfaceVariant, + colorScheme.onError, + if (hover) 1f else proximity * 0.6f + ) + + Box( + modifier = modifier + .onGloballyPositioned { coords -> + onBounds(Rect(coords.localToRoot(Offset.Zero), coords.size.toSize())) + } + .size(ComposerButtonSize), + contentAlignment = Alignment.Center + ) { + Box( + modifier = Modifier + .size(ComposerButtonDisc) + .scale(scale) + .offset { IntOffset(pullAnim.x.roundToInt(), pullAnim.y.roundToInt()) } + .background(container, CircleShape), + contentAlignment = Alignment.Center + ) { + Icon( + imageVector = Icons.Filled.Close, + contentDescription = "Cancel recording", + tint = tint, + modifier = Modifier.size(ComposerIconSize) + ) + } + } +} + /** * Send affordance. Only rendered when there is something to send, so its mere presence is the * signal; it does not need to shout in the terminal's full-brightness green as well. diff --git a/app/src/main/java/com/bitchat/android/ui/LanguagePreferenceManager.kt b/app/src/main/java/com/bitchat/android/ui/LanguagePreferenceManager.kt new file mode 100644 index 00000000..91d2719e --- /dev/null +++ b/app/src/main/java/com/bitchat/android/ui/LanguagePreferenceManager.kt @@ -0,0 +1,61 @@ +package com.bitchat.android.ui + +import android.content.Context +import androidx.annotation.XmlRes +import androidx.appcompat.app.AppCompatDelegate +import androidx.core.os.LocaleListCompat +import com.bitchat.android.R +import org.xmlpull.v1.XmlPullParser +import java.util.Locale + +data class AppLanguage( + val languageTag: String, + val endonym: String, +) + +object LanguagePreferenceManager { + fun currentLanguageTag(): String = + AppCompatDelegate.getApplicationLocales().toLanguageTags() + + fun setLanguage(languageTag: String) { + AppCompatDelegate.setApplicationLocales( + LocaleListCompat.forLanguageTags(languageTag) + ) + } + + fun supportedLanguages( + context: Context, + @XmlRes localeConfig: Int = R.xml.locales_config, + ): List = readLanguageTags(context, localeConfig) + .map { languageTag -> + val locale = Locale.forLanguageTag(languageTag) + AppLanguage( + languageTag = languageTag, + endonym = locale.getDisplayName(locale) + .replaceFirstChar { first -> + if (first.isLowerCase()) first.titlecase(locale) else first.toString() + }, + ) + } + .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.endonym }) + + internal fun readLanguageTags( + context: Context, + @XmlRes localeConfig: Int, + ): List { + val parser = context.resources.getXml(localeConfig) + return buildList { + var event = parser.eventType + while (event != XmlPullParser.END_DOCUMENT) { + if (event == XmlPullParser.START_TAG && parser.name == "locale") { + parser.getAttributeValue(ANDROID_NAMESPACE, "name") + ?.takeIf(String::isNotBlank) + ?.let(::add) + } + event = parser.next() + } + } + } + + private const val ANDROID_NAMESPACE = "http://schemas.android.com/apk/res/android" +} diff --git a/app/src/main/java/com/bitchat/android/ui/MediaSendingManager.kt b/app/src/main/java/com/bitchat/android/ui/MediaSendingManager.kt index f9297afa..d5db98bb 100644 --- a/app/src/main/java/com/bitchat/android/ui/MediaSendingManager.kt +++ b/app/src/main/java/com/bitchat/android/ui/MediaSendingManager.kt @@ -441,7 +441,7 @@ class MediaSendingManager( } } - private fun handlePrivatePreparation( + private suspend fun handlePrivatePreparation( preparation: PrivateMediaPreparation, pending: PendingAutomaticPrivateMedia ) { @@ -599,7 +599,7 @@ class MediaSendingManager( } } - private fun commitPreparedPrivateFile( + private suspend fun commitPreparedPrivateFile( preparation: PrivateMediaPreparation.Ready, conversationID: String, recipientMeshPeerID: String, @@ -630,7 +630,14 @@ class MediaSendingManager( // Preparation already built and admitted the exact final packet. Map // progress before commit so the first asynchronous event cannot race us. - messageManager.addPrivateMessage(conversationID, msg) + if (!messageManager.addPrivateMessageDurably(conversationID, msg, forceRead = true)) { + Log.e(TAG, "Prepared private-media message could not be persisted; send aborted") + addPrivateMediaSystemMessage( + conversationID, + "Private media was not sent because the conversation could not be saved." + ) + return + } synchronized(transferMessageMap) { transferMessageMap[transferId] = msg.id messageTransferMap[msg.id] = transferId @@ -641,12 +648,17 @@ class MediaSendingManager( ) if (!preparation.transfer.commit()) { - messageManager.removeMessageById(msg.id) synchronized(transferMessageMap) { transferMessageMap.remove(transferId) messageTransferMap.remove(msg.id) } - Log.w(TAG, "Prepared private-media commit failed; local echo rolled back") + messageManager.updateMessageDeliveryStatus( + msg.id, + com.bitchat.android.model.DeliveryStatus.Failed( + "Prepared transfer could not be committed" + ) + ) + Log.w(TAG, "Prepared private-media commit failed; local echo marked failed") addPrivateMediaSystemMessage( conversationID, "Private media was not sent because the prepared transfer could not be committed." diff --git a/app/src/main/java/com/bitchat/android/ui/MeshDelegateHandler.kt b/app/src/main/java/com/bitchat/android/ui/MeshDelegateHandler.kt index de2f12c5..c6f7eb49 100644 --- a/app/src/main/java/com/bitchat/android/ui/MeshDelegateHandler.kt +++ b/app/src/main/java/com/bitchat/android/ui/MeshDelegateHandler.kt @@ -109,7 +109,6 @@ class MeshDelegateHandler( private suspend fun processPeerUpdate(mergedPeers: List) { state.setConnectedPeers(mergedPeers) state.setIsConnected(mergedPeers.isNotEmpty()) - notificationManager.showActiveUserNotification(mergedPeers) // Flush router outbox for any peers that just connected (and their noiseHex aliases) runCatching { com.bitchat.android.services.MessageRouter.tryGetInstance()?.onPeersUpdated(mergedPeers) } diff --git a/app/src/main/java/com/bitchat/android/ui/MeshPeerListSheet.kt b/app/src/main/java/com/bitchat/android/ui/MeshPeerListSheet.kt index 27bb7448..88ec6b6f 100644 --- a/app/src/main/java/com/bitchat/android/ui/MeshPeerListSheet.kt +++ b/app/src/main/java/com/bitchat/android/ui/MeshPeerListSheet.kt @@ -6,6 +6,7 @@ import androidx.compose.material.icons.filled.* import androidx.compose.material.icons.outlined.* import com.bitchat.android.ui.theme.BitchatFontFamily import com.bitchat.android.R +import android.text.format.DateUtils import android.util.Log import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.animateColorAsState @@ -23,18 +24,28 @@ import androidx.compose.foundation.* import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.* import androidx.compose.runtime.* +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.CustomAccessibilityAction +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.customActions +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.semantics.stateDescription import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -50,6 +61,8 @@ import com.bitchat.android.favorites.FavoriteRelationship import com.bitchat.android.favorites.FavoritesPersistenceService import com.bitchat.android.geohash.ChannelID import com.bitchat.android.identity.SecureIdentityStateManager +import com.bitchat.android.model.BitchatMessageType +import com.bitchat.android.model.DeliveryStatus import com.bitchat.android.ui.theme.BASE_FONT_SIZE import com.bitchat.android.ui.theme.BitchatMotion import com.bitchat.android.ui.theme.LocalBitchatPalette @@ -60,6 +73,7 @@ import com.bitchat.android.services.ContactDirectory import com.bitchat.android.services.ContactIdentityResolver import com.bitchat.android.util.hexEncodedString import kotlinx.coroutines.launch +import kotlinx.coroutines.delay /** @@ -77,7 +91,6 @@ fun MeshPeerListSheet( modifier: Modifier = Modifier ) { val colorScheme = MaterialTheme.colorScheme - val connectedPeers by viewModel.connectedPeers.collectAsStateWithLifecycle() val joinedChannels by viewModel.joinedChannels.collectAsStateWithLifecycle() val currentChannel by viewModel.currentChannel.collectAsStateWithLifecycle() @@ -88,17 +101,51 @@ fun MeshPeerListSheet( val peerRSSI by viewModel.peerRSSI.collectAsStateWithLifecycle() val selectedLocationChannel by viewModel.selectedLocationChannel.collectAsStateWithLifecycle() val geohashPeople by viewModel.geohashPeople.collectAsStateWithLifecycle() - val unreadConversations by viewModel.unreadConversations.collectAsStateWithLifecycle() + val conversations by viewModel.conversations.collectAsStateWithLifecycle() + val conversationStoreState by viewModel.conversationStoreState.collectAsStateWithLifecycle() + val peerDirect by viewModel.peerDirect.collectAsStateWithLifecycle() val geohashPeopleCount = geohashPeople.size val wifiAwareConnected by com.bitchat.android.wifiaware.WifiAwareController.connectedPeers.collectAsStateWithLifecycle() val wifiAwarePeerIDs = remember(wifiAwareConnected) { wifiAwareConnected.keys.toSet() } - val unreadIdentityAliases = remember(unreadConversations) { - unreadConversations + val directPeerIdentityIDs = remember(peerDirect) { + peerDirect + .asSequence() + .filter { (_, isDirect) -> isDirect } + .mapTo(mutableSetOf()) { (peerID, _) -> peerID.lowercase() } + } + val wifiAwareIdentityIDs = remember(wifiAwarePeerIDs) { + wifiAwarePeerIDs.mapTo(mutableSetOf()) { it.lowercase() } + } + val conversationIdentityAliases = remember(conversations) { + conversations .flatMapTo(mutableSetOf()) { it.identityAliases } } val visibleConnectedPeers = connectedPeers.filterNot { peerID -> - peerID.lowercase() in unreadIdentityAliases + val aliases = runCatching { + ContactDirectory.aliasesForConversation(peerID) + }.getOrDefault(setOf(peerID)) + aliases.any { it.lowercase() in conversationIdentityAliases } } + var pendingConversationDelete by remember { + mutableStateOf(null) + } + var conversationQuery by rememberSaveable { mutableStateOf("") } + val filteredConversations = remember(conversations, conversationQuery) { + val query = conversationQuery.trim() + if (query.isEmpty()) conversations else conversations.filter { conversation -> + conversation.displayName.contains(query, ignoreCase = true) || + conversation.latestMessagePreview.contains(query, ignoreCase = true) || + conversation.draft?.contains(query, ignoreCase = true) == true + } + } + val onlineConversations = remember(filteredConversations) { + filteredConversations.filter(ConversationSummary::isConnected) + } + val offlineConversations = remember(filteredConversations) { + filteredConversations.filterNot(ConversationSummary::isConnected) + } + val sheetScope = rememberCoroutineScope() + val snackbarHostState = remember { SnackbarHostState() } // Bottom sheet state val sheetState = rememberModalBottomSheetState( @@ -134,16 +181,172 @@ fun MeshPeerListSheet( else -> visibleConnectedPeers.count { it != viewModel.myPeerID } } - if (unreadConversations.isNotEmpty()) { - item(key = "unread_private_messages_section") { - UnreadDirectMessagesSection( - conversations = unreadConversations, + item(key = "private_conversations_header") { + SheetIconSectionHeader( + iconRes = R.drawable.ic_spec_envelope, + title = stringResource(R.string.conversations), + modifier = Modifier.padding(top = 8.dp) + ) + } + + if (conversations.size >= CONVERSATION_SEARCH_THRESHOLD) { + item(key = "private_conversations_search") { + OutlinedTextField( + value = conversationQuery, + onValueChange = { conversationQuery = it }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = AboutHorizontalPadding) + .padding(top = 10.dp), + singleLine = true, + textStyle = MaterialTheme.typography.bodyMedium.copy( + fontFamily = BitchatFontFamily + ), + placeholder = { + Text( + stringResource(R.string.search_conversations), + fontFamily = BitchatFontFamily + ) + }, + leadingIcon = { + Icon(Icons.Outlined.Search, contentDescription = null) + }, + trailingIcon = if (conversationQuery.isNotEmpty()) { + { + IconButton(onClick = { conversationQuery = "" }) { + Icon( + Icons.Outlined.Close, + contentDescription = stringResource(R.string.clear) + ) + } + } + } else { + null + }, + shape = RoundedCornerShape(14.dp) + ) + } + } + + when { + conversationStoreState is + com.bitchat.android.services.ConversationStoreState.Loading && + conversations.isEmpty() -> { + item(key = "private_conversations_loading") { + ConversationSectionStatus( + icon = { CircularProgressIndicator(Modifier.size(20.dp)) }, + text = stringResource(R.string.loading_conversations) + ) + } + } + + conversationStoreState is + com.bitchat.android.services.ConversationStoreState.Error && + conversations.isEmpty() -> { + item(key = "private_conversations_error") { + ConversationSectionStatus( + icon = { + Icon( + Icons.Outlined.Warning, + contentDescription = null, + tint = MaterialTheme.colorScheme.error + ) + }, + text = stringResource(R.string.conversation_storage_error) + ) + } + } + + conversations.isEmpty() -> { + item(key = "private_conversations_empty") { + ConversationSectionStatus( + icon = { + Icon( + painterResource(R.drawable.ic_spec_envelope), + contentDescription = null + ) + }, + text = stringResource(R.string.no_conversations_yet) + ) + } + } + + filteredConversations.isEmpty() -> { + item(key = "private_conversations_no_results") { + ConversationSectionStatus( + icon = { + Icon(Icons.Outlined.SearchOff, contentDescription = null) + }, + text = stringResource(R.string.no_conversation_results) + ) + } + } + } + + if (onlineConversations.isNotEmpty()) { + item(key = "private_conversations_online_label") { + ConversationGroupLabel( + text = stringResource(R.string.online_conversations) + ) + } + itemsIndexed( + items = onlineConversations, + key = { _, conversation -> + "conversation:${conversation.conversationID}" + } + ) { index, conversation -> + ConversationSwipeItem( + conversation = conversation, + directPeerIdentityIDs = directPeerIdentityIDs, + wifiAwareIdentityIDs = wifiAwareIdentityIDs, viewModel = viewModel, + isFirst = index == 0, + isLast = index == onlineConversations.lastIndex, onPrivateChatStart = { conversationID -> viewModel.showPrivateChatSheet(conversationID) onDismiss() }, - modifier = Modifier.padding(top = 8.dp) + onDeleteRequested = { pendingConversationDelete = it }, + onReadStateRequested = { item, isRead -> + sheetScope.launch { + viewModel.setConversationRead(item.conversationID, isRead) + } + }, + modifier = Modifier.animateItem() + ) + } + } + + if (offlineConversations.isNotEmpty()) { + item(key = "private_conversations_offline_label") { + ConversationGroupLabel( + text = stringResource(R.string.offline_conversations) + ) + } + itemsIndexed( + items = offlineConversations, + key = { _, conversation -> + "conversation:${conversation.conversationID}" + } + ) { index, conversation -> + ConversationSwipeItem( + conversation = conversation, + directPeerIdentityIDs = directPeerIdentityIDs, + wifiAwareIdentityIDs = wifiAwareIdentityIDs, + viewModel = viewModel, + isFirst = index == 0, + isLast = index == offlineConversations.lastIndex, + onPrivateChatStart = { conversationID -> + viewModel.showPrivateChatSheet(conversationID) + onDismiss() + }, + onDeleteRequested = { pendingConversationDelete = it }, + onReadStateRequested = { item, isRead -> + sheetScope.launch { + viewModel.setConversationRead(item.conversationID, isRead) + } + }, + modifier = Modifier.animateItem() ) } } @@ -156,7 +359,7 @@ fun MeshPeerListSheet( iconRes = R.drawable.ic_spec_chat_bubbles, title = stringResource(R.string.channels), modifier = Modifier.padding( - top = if (unreadConversations.isNotEmpty()) 20.dp else 8.dp + top = if (conversations.isNotEmpty()) 20.dp else 8.dp ) ) Surface( @@ -209,11 +412,11 @@ fun MeshPeerListSheet( GeohashPeopleList( viewModel = viewModel, onTapPerson = onDismiss, - excludedIdentityAliases = unreadIdentityAliases, + excludedIdentityAliases = conversationIdentityAliases, modifier = Modifier.padding( top = if ( joinedChannels.isNotEmpty() || - unreadConversations.isNotEmpty() + conversations.isNotEmpty() ) 20.dp else 8.dp ) ) @@ -224,7 +427,7 @@ fun MeshPeerListSheet( modifier = Modifier.padding( top = if ( joinedChannels.isNotEmpty() || - unreadConversations.isNotEmpty() + conversations.isNotEmpty() ) 20.dp else 8.dp ), connectedPeers = visibleConnectedPeers, @@ -235,7 +438,7 @@ fun MeshPeerListSheet( selectedPrivatePeer = selectedPrivatePeer, wifiAwarePeerIDs = wifiAwarePeerIDs, peopleCount = peopleCount, - excludedIdentityAliases = unreadIdentityAliases, + excludedIdentityAliases = conversationIdentityAliases, viewModel = viewModel, onPrivateChatStart = { peerID -> viewModel.showPrivateChatSheet(peerID) @@ -270,14 +473,101 @@ fun MeshPeerListSheet( }, onClose = onDismiss, ) + + SnackbarHost( + hostState = snackbarHostState, + modifier = Modifier + .align(Alignment.BottomCenter) + .padding(16.dp) + ) } } + pendingConversationDelete?.let { conversation -> + val deleteFailedMessage = stringResource(R.string.conversation_delete_failed) + val deletedMessage = stringResource( + R.string.conversation_deleted, + conversation.displayName + ) + val undoLabel = stringResource(R.string.undo) + val restoreFailedMessage = + stringResource(R.string.conversation_restore_failed) + AlertDialog( + onDismissRequest = { pendingConversationDelete = null }, + icon = { + Icon( + imageVector = Icons.Outlined.Delete, + contentDescription = null + ) + }, + title = { + Text( + text = stringResource(R.string.delete_conversation_title), + fontFamily = BitchatFontFamily + ) + }, + text = { + Text( + text = stringResource( + R.string.delete_conversation_message, + conversation.displayName + ), + fontFamily = BitchatFontFamily + ) + }, + confirmButton = { + TextButton( + onClick = { + pendingConversationDelete = null + sheetScope.launch { + val deletion = viewModel.deletePrivateConversation( + conversation.conversationID + ) + if (deletion == null) { + snackbarHostState.showSnackbar( + message = deleteFailedMessage + ) + return@launch + } + val result = snackbarHostState.showSnackbar( + message = deletedMessage, + actionLabel = undoLabel, + withDismissAction = true, + duration = SnackbarDuration.Long + ) + if (result == SnackbarResult.ActionPerformed) { + if (!viewModel.restoreDeletedConversation(deletion)) { + snackbarHostState.showSnackbar( + restoreFailedMessage + ) + } + } + } + } + ) { + Text( + text = stringResource(R.string.delete), + color = MaterialTheme.colorScheme.error, + fontFamily = BitchatFontFamily + ) + } + }, + dismissButton = { + TextButton(onClick = { pendingConversationDelete = null }) { + Text( + text = stringResource(android.R.string.cancel), + fontFamily = BitchatFontFamily + ) + } + } + ) + } } } /** Icon size for trailing actions on peer rows (matches settings glyph scale). */ private val PeerRowIconSize = 22.dp +private const val CONVERSATION_SEARCH_THRESHOLD = 8 @Composable private fun ChannelRow( @@ -541,18 +831,14 @@ fun PeopleSection( displayName = displayName, isDirect = isDirectLive, isWifiAware = peerID in wifiAwarePeerIDs, + isConnected = true, isSelected = conversationID == selectedPrivatePeer || peerID == selectedPrivatePeer, isFavorite = isFavorite, theyFavoritedUs = theyFavoritedUs, isVerified = isVerified, - hasUnreadDM = combinedHasUnread, colorScheme = colorScheme, viewModel = viewModel, onItemClick = { onPrivateChatStart(peerID) }, - onToggleFavorite = { - Log.d("SidebarComponents", "Sidebar toggle favorite: peerID=$peerID, currentFavorite=$isFavorite") - viewModel.toggleFavorite(peerID) - }, unreadCount = if (combinedUnreadCount > 0) combinedUnreadCount else if (combinedHasUnread) 1 else 0, showNostrGlobe = false, showHashSuffix = showHash @@ -591,18 +877,14 @@ fun PeopleSection( peerID = favPeerID, displayName = dn, isDirect = false, + isConnected = false, isSelected = conversationID == selectedPrivatePeer || (mappedConnectedPeerID ?: favPeerID) == selectedPrivatePeer, isFavorite = true, theyFavoritedUs = fav.theyFavoritedUs, isVerified = isVerified, - hasUnreadDM = hasUnread, colorScheme = colorScheme, viewModel = viewModel, onItemClick = { onPrivateChatStart(mappedConnectedPeerID ?: favPeerID) }, - onToggleFavorite = { - Log.d("SidebarComponents", "Sidebar toggle favorite (offline): peerID=$favPeerID") - viewModel.toggleFavorite(favPeerID) - }, unreadCount = if (unreadCount > 0) unreadCount else if (hasUnread) 1 else 0, showNostrGlobe = (fav.isMutual && fav.peerNostrPublicKey != null), showHashSuffix = showHash @@ -612,149 +894,650 @@ fun PeopleSection( } } } + } } @Composable -private fun UnreadDirectMessagesSection( - conversations: List, +private fun ConversationSectionStatus( + icon: @Composable () -> Unit, + text: String +) { + Surface( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = AboutHorizontalPadding) + .padding(top = 10.dp), + color = MaterialTheme.colorScheme.surface, + shape = AboutCardShape + ) { + Row( + modifier = Modifier.padding(horizontal = 16.dp, vertical = 18.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(12.dp) + ) { + icon() + Text( + text = text, + style = MaterialTheme.typography.bodyMedium.copy( + fontFamily = BitchatFontFamily + ), + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + } + } +} + +@Composable +private fun ConversationGroupLabel(text: String) { + Text( + text = text, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = AboutHorizontalPadding + 4.dp) + .padding(top = 12.dp, bottom = 6.dp), + style = MaterialTheme.typography.labelMedium.copy( + fontFamily = BitchatFontFamily, + fontWeight = FontWeight.SemiBold + ), + color = MaterialTheme.colorScheme.onSurfaceVariant + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun ConversationSwipeItem( + conversation: ConversationSummary, + directPeerIdentityIDs: Set, + wifiAwareIdentityIDs: Set, viewModel: ChatViewModel, + isFirst: Boolean, + isLast: Boolean, onPrivateChatStart: (String) -> Unit, + onDeleteRequested: (ConversationSummary) -> Unit, + onReadStateRequested: (ConversationSummary, Boolean) -> Unit, modifier: Modifier = Modifier ) { - val palette = LocalBitchatPalette.current val colorScheme = MaterialTheme.colorScheme - - Column(modifier = modifier) { - SheetIconSectionHeader( - iconRes = R.drawable.ic_spec_envelope, - title = stringResource(R.string.cd_unread_private_messages) + val hapticFeedback = LocalHapticFeedback.current + val deleteDescription = stringResource(R.string.delete_conversation_action) + val favoritePeers by viewModel.favoritePeers.collectAsStateWithLifecycle() + val peerFavoritedUs by viewModel.peerFavoritedUs.collectAsStateWithLifecycle() + val peerFingerprints by viewModel.peerFingerprints.collectAsStateWithLifecycle() + val verifiedFingerprints by viewModel.verifiedFingerprints.collectAsStateWithLifecycle() + val favoriteTargetID = conversation.connectedPeerID ?: conversation.conversationID + val favoriteRelationship = remember( + conversation.identityAliases, + favoritePeers, + peerFavoritedUs + ) { + conversation.identityAliases + .asSequence() + .mapNotNull { alias -> + runCatching { + FavoritesPersistenceService.shared.getFavoriteStatus(alias) + }.getOrNull() + } + .firstOrNull() + } + val fingerprint = conversation.connectedPeerID + ?.let(peerFingerprints::get) + ?: conversation.identityAliases + .asSequence() + .mapNotNull(peerFingerprints::get) + .firstOrNull() + ?: ContactIdentityResolver.fingerprintFromContactConversationId( + conversation.conversationID ) + ?: favoriteRelationship?.peerNoisePublicKey?.let { + ContactIdentityResolver.fingerprintHex(it) + } + val isFavorite = if (fingerprint != null) { + fingerprint in favoritePeers + } else { + viewModel.isFavorite(favoriteTargetID) + } + val theyFavoritedUs = + (fingerprint != null && fingerprint in peerFavoritedUs) || + favoriteRelationship?.theyFavoritedUs == true + val isVerified = fingerprint != null && fingerprint in verifiedFingerprints + val dismissState = rememberSwipeToDismissBoxState() + val shape = RoundedCornerShape( + topStart = if (isFirst) 14.dp else 0.dp, + topEnd = if (isFirst) 14.dp else 0.dp, + bottomStart = if (isLast) 14.dp else 0.dp, + bottomEnd = if (isLast) 14.dp else 0.dp + ) - Surface( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = AboutHorizontalPadding) - .padding(top = 10.dp), - color = colorScheme.surface, - shape = AboutCardShape - ) { - AnimatedRowColumn( - items = conversations, - key = { it.conversationID } - ) { index, conversation -> - Column { - if (index > 0) SheetCardDivider() + LaunchedEffect(dismissState.currentValue, conversation.conversationID) { + when (dismissState.currentValue) { + SwipeToDismissBoxValue.StartToEnd -> { + hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress) + onReadStateRequested(conversation, conversation.unreadCount > 0) + dismissState.reset() + } - val subtitle = when { - conversation.sourceGeohash != null -> "#${conversation.sourceGeohash}" - conversation.transport == DirectMessageTransport.NOSTR -> - stringResource(R.string.cd_reachable_via_nostr) - !conversation.isConnected -> - stringResource(R.string.cd_offline_mesh_chat) - else -> null - } - val peerIdentity = conversation.nostrPubkey - ?.let(viewModel::peerIdentityForNostrPubkey) - ?: viewModel.peerIdentityForMeshPeer(conversation.conversationID) - val assignedColor = colorForPeer(peerIdentity, palette) - val (baseNameRaw, suffix) = splitSuffix(conversation.displayName) + SwipeToDismissBoxValue.EndToStart -> { + hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress) + onDeleteRequested(conversation) + dismissState.reset() + } + SwipeToDismissBoxValue.Settled -> Unit + } + } + + Surface( + modifier = modifier + .fillMaxWidth() + .padding(horizontal = AboutHorizontalPadding) + .clip(shape), + color = colorScheme.surface, + shape = shape + ) { + Column { + if (!isFirst) SheetCardDivider() + SwipeToDismissBox( + state = dismissState, + enableDismissFromStartToEnd = true, + enableDismissFromEndToStart = true, + backgroundContent = { + val markRead = conversation.unreadCount > 0 + val startToEnd = + dismissState.dismissDirection == SwipeToDismissBoxValue.StartToEnd Row( modifier = Modifier - .fillMaxWidth() - .clickable { - onPrivateChatStart(conversation.conversationID) - } - .padding( - horizontal = SheetRowHorizontal, - vertical = SheetRowVertical - ), - verticalAlignment = Alignment.CenterVertically - ) { - Box( - modifier = Modifier.size(SheetRowLeadingSlot), - contentAlignment = Alignment.Center - ) { - Icon( - painter = painterResource(R.drawable.ic_spec_envelope), - contentDescription = stringResource(R.string.cd_unread_message), - modifier = Modifier.size(PeerRowIconSize), - tint = palette.accentOrange - ) - } - - Spacer(modifier = Modifier.width(SheetRowLeadingGutter)) - - Column(modifier = Modifier.weight(1f)) { - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(4.dp) - ) { - Text( - text = truncateNickname(baseNameRaw), - fontFamily = BitchatFontFamily, - fontSize = 14.sp, - fontWeight = FontWeight.Medium, - color = assignedColor, - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - - if (suffix.isNotEmpty()) { - Text( - text = suffix, - fontFamily = BitchatFontFamily, - fontSize = 14.sp, - fontWeight = FontWeight.Medium, - color = assignedColor.copy(alpha = SUFFIX_ALPHA) - ) + .fillMaxSize() + .background( + if (startToEnd) { + colorScheme.secondaryContainer + } else { + colorScheme.errorContainer } - } - - if (subtitle != null) { - Text( - text = subtitle, - fontFamily = BitchatFontFamily, - fontSize = 11.sp, - color = palette.textTertiary, - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - } + ) + .padding(horizontal = SheetRowHorizontal), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = if (startToEnd) { + Arrangement.Start + } else { + Arrangement.End } - - UnreadBadge( - count = conversation.unreadCount, - colorScheme = colorScheme + ) { + Icon( + imageVector = if (startToEnd) { + if (markRead) Icons.Outlined.MarkEmailRead + else Icons.Outlined.MarkEmailUnread + } else { + Icons.Outlined.Delete + }, + contentDescription = null + ) + Spacer(modifier = Modifier.width(8.dp)) + Text( + text = if (startToEnd) { + stringResource( + if (markRead) R.string.mark_read else R.string.mark_unread + ) + } else { + stringResource(R.string.delete) + }, + style = MaterialTheme.typography.labelMedium.copy( + fontFamily = BitchatFontFamily, + fontWeight = FontWeight.SemiBold + ) ) } } + ) { + ConversationRow( + conversation = conversation, + directPeerIdentityIDs = directPeerIdentityIDs, + wifiAwareIdentityIDs = wifiAwareIdentityIDs, + viewModel = viewModel, + isFavorite = isFavorite, + theyFavoritedUs = theyFavoritedUs, + isVerified = isVerified, + deleteDescription = deleteDescription, + onClick = { onPrivateChatStart(conversation.conversationID) }, + onToggleFavorite = { viewModel.toggleFavorite(favoriteTargetID) }, + onTogglePinned = { + viewModel.toggleConversationPinned(conversation.conversationID) + }, + onToggleMuted = { + viewModel.toggleConversationMuted(conversation.conversationID) + }, + onReadStateRequested = { + onReadStateRequested(conversation, conversation.unreadCount > 0) + }, + onDeleteRequested = { onDeleteRequested(conversation) } + ) } } } } +@Composable +private fun ConversationRow( + conversation: ConversationSummary, + directPeerIdentityIDs: Set, + wifiAwareIdentityIDs: Set, + viewModel: ChatViewModel, + isFavorite: Boolean, + theyFavoritedUs: Boolean, + isVerified: Boolean, + deleteDescription: String, + onClick: () -> Unit, + onToggleFavorite: () -> Unit, + onTogglePinned: () -> Unit, + onToggleMuted: () -> Unit, + onReadStateRequested: () -> Unit, + onDeleteRequested: () -> Unit +) { + val palette = LocalBitchatPalette.current + val colorScheme = MaterialTheme.colorScheme + var showActions by remember { mutableStateOf(false) } + val liveIdentityIDs = conversation.identityAliases + + listOfNotNull(conversation.connectedPeerID?.lowercase()) + val isWifiAware = liveIdentityIDs.any(wifiAwareIdentityIDs::contains) + val isDirect = liveIdentityIDs.any(directPeerIdentityIDs::contains) || + conversation.connectedPeerID?.let { peerID -> + runCatching { + viewModel.getMeshPeerInfo(peerID)?.isDirectConnection == true + }.getOrDefault(false) + } == true + val connectionDescription = meshConnectionDescription( + isWifiAware = isWifiAware, + isDirect = isDirect + ) + val basePreview = when { + !conversation.draft.isNullOrBlank() -> stringResource( + R.string.conversation_draft_preview, + conversation.draft + ) + conversation.latestMessageType == BitchatMessageType.Image -> + stringResource(R.string.notification_sent_image) + conversation.latestMessageType == BitchatMessageType.Audio -> + stringResource(R.string.notification_sent_voice) + conversation.latestMessageType == BitchatMessageType.File -> + conversation.latestMessagePreview + .takeIf(String::isNotBlank) + ?.let { "📎 $it" } + ?: stringResource(R.string.notification_sent_file) + else -> conversation.latestMessagePreview.ifBlank { "…" } + } + val messagePreview = if ( + conversation.latestMessageIsOutgoing && conversation.draft.isNullOrBlank() + ) { + stringResource(R.string.conversation_you_preview, basePreview) + } else { + basePreview + } + val deliveryIndicator = when (conversation.latestDeliveryStatus) { + DeliveryStatus.Sending -> stringResource(R.string.status_sending) + DeliveryStatus.Sent -> stringResource(R.string.status_sent) + is DeliveryStatus.Delivered -> stringResource(R.string.status_delivered) + is DeliveryStatus.Read -> stringResource(R.string.status_read) + is DeliveryStatus.Failed -> stringResource(R.string.status_failed) + is DeliveryStatus.PartiallyDelivered -> stringResource(R.string.status_pending) + null -> "" + }.takeIf { conversation.latestMessageIsOutgoing } + val presenceDescription = when { + conversation.isConnected -> connectionDescription + conversation.transport == DirectMessageTransport.NOSTR -> + stringResource(R.string.offline_reachable_via_nostr) + else -> stringResource(R.string.offline_not_in_mesh) + } + val peerIdentity = conversation.nostrPubkey + ?.let(viewModel::peerIdentityForNostrPubkey) + ?: viewModel.peerIdentityForMeshPeer(conversation.conversationID) + val assignedColor = colorForPeer(peerIdentity, palette) + val (baseNameRaw, suffix) = splitSuffix(conversation.displayName) + val relativeTime by produceState( + initialValue = conversationRelativeTime(conversation.latestMessageAt), + conversation.latestMessageAt + ) { + while (true) { + value = conversationRelativeTime(conversation.latestMessageAt) + delay(DateUtils.MINUTE_IN_MILLIS) + } + } + val unreadDescription = if (conversation.unreadCount > 0) { + stringResource(R.string.conversation_unread_count, conversation.unreadCount) + } else { + stringResource(R.string.conversation_read) + } + val pinDescription = stringResource( + if (conversation.isPinned) R.string.unpin_conversation else R.string.pin_conversation + ) + val muteDescription = stringResource( + if (conversation.isMuted) R.string.unmute_conversation else R.string.mute_conversation + ) + val readActionDescription = stringResource( + if (conversation.unreadCount > 0) R.string.mark_read else R.string.mark_unread + ) + + Row( + modifier = Modifier + .fillMaxWidth() + .background(colorScheme.surface) + .semantics(mergeDescendants = true) { + contentDescription = listOf( + conversation.displayName, + unreadDescription, + messagePreview, + relativeTime, + presenceDescription + ).joinToString(", ") + stateDescription = presenceDescription + customActions = listOf( + CustomAccessibilityAction(readActionDescription) { + onReadStateRequested() + true + }, + CustomAccessibilityAction(pinDescription) { + onTogglePinned() + true + }, + CustomAccessibilityAction(muteDescription) { + onToggleMuted() + true + }, + CustomAccessibilityAction(deleteDescription) { + onDeleteRequested() + true + } + ) + } + .clickable(onClick = onClick) + .padding( + horizontal = SheetRowHorizontal, + vertical = 10.dp + ), + verticalAlignment = Alignment.CenterVertically + ) { + PeerAvatar( + name = baseNameRaw, + color = assignedColor, + badge = { + when { + conversation.isConnected -> Icon( + painter = painterResource( + conversationTransportIcon( + isReachedOverInternet = false, + isWifiAware = isWifiAware, + isDirect = isDirect + ) + ), + contentDescription = connectionDescription, + modifier = Modifier.size(13.dp), + tint = colorScheme.primary + ) + + conversation.transport == DirectMessageTransport.NOSTR -> Icon( + painter = painterResource(R.drawable.ic_spec_globe), + contentDescription = stringResource( + R.string.offline_reachable_via_nostr + ), + modifier = Modifier.size(13.dp), + tint = palette.accentPurple + ) + + else -> Icon( + imageVector = Icons.Outlined.Circle, + contentDescription = stringResource(R.string.offline_not_in_mesh), + modifier = Modifier.size(11.dp), + tint = palette.textTertiary + ) + } + } + ) + + Spacer(modifier = Modifier.width(12.dp)) + + Column(modifier = Modifier.weight(1f)) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(4.dp) + ) { + Text( + text = truncateNickname(baseNameRaw), + style = MaterialTheme.typography.bodyLarge.copy( + fontFamily = BitchatFontFamily, + fontWeight = if (conversation.unreadCount > 0) { + FontWeight.Bold + } else { + FontWeight.Medium + } + ), + color = assignedColor, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + if (suffix.isNotEmpty()) { + Text( + text = suffix, + style = MaterialTheme.typography.bodyMedium.copy( + fontFamily = BitchatFontFamily, + fontWeight = FontWeight.Medium + ), + color = assignedColor.copy(alpha = SUFFIX_ALPHA) + ) + } + if (isVerified) { + Icon( + painter = painterResource(R.drawable.ic_spec_check), + contentDescription = stringResource(R.string.verify_title), + modifier = Modifier.size(15.dp), + tint = colorScheme.primary + ) + } + if (conversation.isPinned) { + Icon( + Icons.Filled.PushPin, + contentDescription = pinDescription, + modifier = Modifier.size(14.dp), + tint = palette.textTertiary + ) + } + if (conversation.isMuted) { + Icon( + Icons.Outlined.NotificationsOff, + contentDescription = muteDescription, + modifier = Modifier.size(14.dp), + tint = palette.textTertiary + ) + } + } + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(4.dp) + ) { + Text( + text = messagePreview, + style = MaterialTheme.typography.bodySmall.copy( + fontFamily = BitchatFontFamily, + fontWeight = if (!conversation.draft.isNullOrBlank()) { + FontWeight.Medium + } else { + FontWeight.Normal + } + ), + color = if (!conversation.draft.isNullOrBlank()) { + palette.accentOrange + } else { + palette.textTertiary + }, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + modifier = Modifier.weight(1f) + ) + deliveryIndicator?.let { + Text( + text = it, + style = MaterialTheme.typography.labelSmall.copy( + fontFamily = BitchatFontFamily + ), + color = if (conversation.latestDeliveryStatus is DeliveryStatus.Failed) { + colorScheme.error + } else { + palette.textTertiary + }, + maxLines = 1 + ) + } + Text( + text = stringResource( + R.string.conversation_preview_timestamp, + relativeTime + ), + style = MaterialTheme.typography.labelSmall.copy( + fontFamily = BitchatFontFamily + ), + color = palette.textTertiary, + maxLines = 1 + ) + } + } + + UnreadBadge( + count = conversation.unreadCount, + colorScheme = colorScheme, + modifier = Modifier.padding(start = 4.dp) + ) + + IconButton( + onClick = onToggleFavorite, + modifier = Modifier.size(48.dp) + ) { + Icon( + painter = painterResource( + if (isFavorite) { + R.drawable.ic_spec_star_filled + } else { + R.drawable.ic_spec_star + } + ), + contentDescription = stringResource( + if (isFavorite) { + R.string.cd_remove_favorite + } else { + R.string.cd_add_favorite + } + ), + modifier = Modifier.size(PeerRowIconSize), + tint = if (isFavorite || theyFavoritedUs) { + palette.accentOrange + } else { + palette.textTertiary + } + ) + } + + Box { + IconButton( + onClick = { showActions = true }, + modifier = Modifier.size(48.dp) + ) { + Icon( + Icons.Default.MoreVert, + contentDescription = stringResource(R.string.conversation_actions), + tint = palette.textTertiary + ) + } + DropdownMenu( + expanded = showActions, + onDismissRequest = { showActions = false } + ) { + DropdownMenuItem( + text = { Text(pinDescription) }, + leadingIcon = { Icon(Icons.Filled.PushPin, contentDescription = null) }, + onClick = { + showActions = false + onTogglePinned() + } + ) + DropdownMenuItem( + text = { Text(muteDescription) }, + leadingIcon = { + Icon(Icons.Outlined.NotificationsOff, contentDescription = null) + }, + onClick = { + showActions = false + onToggleMuted() + } + ) + DropdownMenuItem( + text = { Text(readActionDescription) }, + leadingIcon = { + Icon( + if (conversation.unreadCount > 0) { + Icons.Outlined.MarkEmailRead + } else { + Icons.Outlined.MarkEmailUnread + }, + contentDescription = null + ) + }, + onClick = { + showActions = false + onReadStateRequested() + } + ) + DropdownMenuItem( + text = { + Text( + stringResource(R.string.delete), + color = colorScheme.error + ) + }, + leadingIcon = { + Icon( + Icons.Outlined.Delete, + contentDescription = null, + tint = colorScheme.error + ) + }, + onClick = { + showActions = false + onDeleteRequested() + } + ) + } + } + } +} + +private fun conversationRelativeTime(timestamp: Long): String = + DateUtils.getRelativeTimeSpanString( + timestamp, + System.currentTimeMillis(), + DateUtils.MINUTE_IN_MILLIS, + DateUtils.FORMAT_ABBREV_RELATIVE + ).toString() + @Composable private fun PeerItem( peerID: String, displayName: String, isDirect: Boolean, isWifiAware: Boolean = false, + isConnected: Boolean = true, isSelected: Boolean, isFavorite: Boolean, theyFavoritedUs: Boolean = false, isVerified: Boolean, - hasUnreadDM: Boolean, colorScheme: ColorScheme, viewModel: ChatViewModel, onItemClick: () -> Unit, - onToggleFavorite: () -> Unit, unreadCount: Int = 0, showNostrGlobe: Boolean = false, showHashSuffix: Boolean = true ) { val currentNickname by viewModel.nickname.collectAsStateWithLifecycle() + val connectionDescription = meshConnectionDescription( + isWifiAware = isWifiAware, + isDirect = isDirect + ) // Split display name for hashtag suffix support (iOS-compatible) val (baseNameRaw, suffixRaw) = splitSuffix(displayName) val baseName = truncateNickname(baseNameRaw) @@ -773,61 +1556,47 @@ private fun PeerItem( modifier = Modifier .fillMaxWidth() .clickable(onClick = onItemClick) - .padding(horizontal = SheetRowHorizontal, vertical = SheetRowVertical), + .padding(horizontal = SheetRowHorizontal, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically ) { - Box( - modifier = Modifier.size(SheetRowLeadingSlot), - contentAlignment = Alignment.Center - ) { - if (isSelected) { - Box( - modifier = Modifier - .size(SheetRowSelectedDot) - .background(colorScheme.primary, CircleShape) - ) - } else if (hasUnreadDM) { - Icon( - painter = painterResource(R.drawable.ic_spec_envelope), - contentDescription = stringResource(R.string.cd_unread_message), - modifier = Modifier.size(PeerRowIconSize), - tint = palette.accentOrange - ) - } else if (showNostrGlobe) { - Icon( - painter = painterResource(R.drawable.ic_spec_globe), - contentDescription = stringResource(R.string.cd_reachable_via_nostr), - modifier = Modifier.size(PeerRowIconSize), - tint = palette.accentPurple - ) - } else if (!isDirect && isFavorite) { - Icon( - imageVector = Icons.Outlined.Circle, - contentDescription = stringResource(R.string.cd_offline_favorite), - modifier = Modifier.size(PeerRowIconSize), - tint = palette.textTertiary - ) - } else { - Icon( - painter = painterResource( - conversationTransportIcon( - isReachedOverInternet = false, - isWifiAware = isWifiAware, - isDirect = isDirect - ) - ), - contentDescription = when { - isWifiAware -> "Direct Wi-Fi Aware" - isDirect -> "Direct Bluetooth" - else -> "Routed" - }, - modifier = Modifier.size(PeerRowIconSize), - tint = colorScheme.onSurfaceVariant - ) - } - } + PeerAvatar( + name = baseNameRaw, + color = baseColor, + isFavorite = isFavorite, + theyFavoritedUs = theyFavoritedUs, + badge = { + when { + isConnected -> Icon( + painter = painterResource( + conversationTransportIcon( + isReachedOverInternet = false, + isWifiAware = isWifiAware, + isDirect = isDirect + ) + ), + contentDescription = connectionDescription, + modifier = Modifier.size(13.dp), + tint = colorScheme.primary + ) - Spacer(modifier = Modifier.width(SheetRowLeadingGutter)) + showNostrGlobe -> Icon( + painter = painterResource(R.drawable.ic_spec_globe), + contentDescription = stringResource(R.string.cd_reachable_via_nostr), + modifier = Modifier.size(13.dp), + tint = palette.accentPurple + ) + + else -> Icon( + imageVector = Icons.Outlined.Circle, + contentDescription = stringResource(R.string.cd_offline_favorite), + modifier = Modifier.size(11.dp), + tint = palette.textTertiary + ) + } + } + ) + + Spacer(modifier = Modifier.width(12.dp)) Row( modifier = Modifier.weight(1f), @@ -864,26 +1633,35 @@ private fun PeerItem( } } - Box( - modifier = Modifier - .size(36.dp) - .clickable(onClick = onToggleFavorite), - contentAlignment = Alignment.Center - ) { - // Three-state star (matches private-chat header): grey outline (no relation), - // orange outline (they favorited us), filled orange (we favorited them). - Icon( - painter = painterResource( - if (isFavorite) R.drawable.ic_spec_star_filled else R.drawable.ic_spec_star - ), - contentDescription = if (isFavorite) "Remove from favorites" else "Add to favorites", - modifier = Modifier.size(PeerRowIconSize), - tint = if (isFavorite || theyFavoritedUs) palette.accentOrange else palette.textTertiary + UnreadBadge( + count = unreadCount, + colorScheme = colorScheme, + modifier = Modifier.padding(start = 4.dp) + ) + + if (isSelected) { + Box( + modifier = Modifier + .padding(start = 8.dp) + .size(SheetRowSelectedDot) + .background(colorScheme.primary, CircleShape) ) } } } +@Composable +private fun meshConnectionDescription( + isWifiAware: Boolean, + isDirect: Boolean +): String = stringResource( + when { + isWifiAware -> R.string.cd_direct_wifi_aware + isDirect -> R.string.cd_direct_bluetooth + else -> R.string.cd_routed_mesh + } +) + /** * Reusable unread badge component for both channels and private messages */ @@ -1028,7 +1806,11 @@ fun PrivateChatSheet( val conversationID = contactResolution.conversationID val messages = privateChats[conversationID] ?: privateChats[peerID] ?: emptyList() - val sessionState = activeMeshPeerID?.let { peerSessionStates[it] } ?: peerSessionStates[peerID] + val sessionState = resolveConversationSessionState( + conversationID = peerID, + activeMeshPeerID = activeMeshPeerID, + peerSessionStates = peerSessionStates + ) val fingerprint = activeMeshPeerID?.let { peerFingerprints[it] } ?: peerFingerprints[peerID] ?: ContactIdentityResolver.fingerprintFromContactConversationId(peerID) @@ -1121,10 +1903,10 @@ fun PrivateChatSheet( // Input section. No divider here: ChatInputSection draws its own fade and // hairline. - var messageText by remember { + var messageText by remember(peerID) { mutableStateOf( androidx.compose.ui.text.input.TextFieldValue( - "" + viewModel.conversationDraft(peerID) ) ) } @@ -1133,13 +1915,19 @@ fun PrivateChatSheet( messageText = messageText, onMessageTextChange = { newText -> messageText = newText + viewModel.setConversationDraft(peerID, newText.text) viewModel.updateMentionSuggestions(newText.text) }, onSend = { if (messageText.text.trim().isNotEmpty()) { - viewModel.sendMessage(messageText.text.trim()) - messageText = androidx.compose.ui.text.input.TextFieldValue("") - forceScrollToBottom = !forceScrollToBottom + viewModel.sendMessage(messageText.text.trim()) { accepted -> + if (accepted) { + messageText = + androidx.compose.ui.text.input.TextFieldValue("") + viewModel.setConversationDraft(peerID, "") + forceScrollToBottom = !forceScrollToBottom + } + } } }, onSendVoiceNote = { peer, channel, path -> @@ -1214,8 +2002,21 @@ fun PrivateChatSheet( ) } - // Encryption state, and the verification badge that qualifies it. Both are - // read-only for Nostr peers, which have no Noise session at all. + if (isVerified) { + ConversationHeaderStatus { + Icon( + imageVector = Icons.Filled.Verified, + contentDescription = stringResource( + R.string.fingerprint_verified_label + ), + modifier = Modifier.size(HeaderIconSize), + tint = colorScheme.primary + ) + } + } + + // Keep the lock nearest the close action: from right to left the security + // cluster reads close, encryption, verification, then favorite. if (!isNostrPeer && !isNostrReachableFavorite) { ConversationHeaderAction( onClick = { viewModel.showSecurityVerificationSheet() }, @@ -1230,20 +2031,6 @@ fun PrivateChatSheet( } } - if (isVerified) { - Box( - modifier = Modifier.size(HeaderIconSize), - contentAlignment = Alignment.Center - ) { - Icon( - painter = painterResource(R.drawable.ic_spec_check), - contentDescription = stringResource(R.string.verify_title), - modifier = Modifier.size(HeaderIconSize), - tint = colorScheme.primary - ) - } - } - val dismiss = LocalSheetDismiss.current CloseButton(onClick = { dismiss?.invoke() ?: onDismiss() }) } diff --git a/app/src/main/java/com/bitchat/android/ui/MessageComponents.kt b/app/src/main/java/com/bitchat/android/ui/MessageComponents.kt index 16c7f63d..5ab113db 100644 --- a/app/src/main/java/com/bitchat/android/ui/MessageComponents.kt +++ b/app/src/main/java/com/bitchat/android/ui/MessageComponents.kt @@ -1,5 +1,11 @@ package com.bitchat.android.ui +import android.content.ActivityNotFoundException +import android.content.ClipData +import android.content.ClipboardManager +import android.content.Context +import android.content.Intent +import android.net.Uri import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Close import androidx.compose.animation.AnimatedContent @@ -15,7 +21,9 @@ import androidx.compose.animation.fadeOut import androidx.compose.animation.togetherWith import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.clickable +import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -25,13 +33,17 @@ import androidx.compose.foundation.layout.calculateEndPadding import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.ColorScheme +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -53,6 +65,8 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp @@ -599,6 +613,24 @@ fun MessageItem( return } + val cashuTokens = remember(message.content) { + CashuTokenDecoder.extractTokens(message.content) + } + if (cashuTokens.isNotEmpty() && message.sender != "system") { + CashuMessageContent( + message = message, + tokens = cashuTokens, + currentUserNickname = currentUserNickname, + meshService = meshService, + colorScheme = colorScheme, + timeFormatter = timeFormatter, + onNicknameClick = onNicknameClick, + onMessageLongPress = onMessageLongPress, + modifier = modifier + ) + return + } + if (message.sender == "system") { // Background narration: `// Tor started. Routing all chats…` val annotatedText = remember(message, colorScheme.onSurface) { @@ -756,6 +788,149 @@ internal fun TextMessageLayout( } } +@OptIn(ExperimentalFoundationApi::class) +@Composable +private fun CashuMessageContent( + message: BitchatMessage, + tokens: List, + currentUserNickname: String, + meshService: MeshService, + colorScheme: ColorScheme, + timeFormatter: SimpleDateFormat, + onNicknameClick: ((String) -> Unit)?, + onMessageLongPress: ((BitchatMessage) -> Unit)?, + modifier: Modifier = Modifier +) { + val remainingText = tokens.fold(message.content) { text, token -> + text.replace("cashu://$token", "", ignoreCase = true) + .replace("cashu:$token", "", ignoreCase = true) + .replace(token, "") + }.trim() + Column( + modifier = modifier.fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(4.dp) + ) { + TextMessageLayout( + message = message, + currentUserNickname = currentUserNickname, + meshService = meshService, + colorScheme = colorScheme, + timeFormatter = timeFormatter, + onNicknameClick = onNicknameClick, + onMessageLongPress = onMessageLongPress, + bodyContent = remainingText, + ) + tokens.forEach { token -> CashuPaymentChip(token) } + } +} + +@OptIn(ExperimentalFoundationApi::class) +@Composable +internal fun CashuPaymentChip( + token: String, + modifier: Modifier = Modifier, + onClick: (() -> Unit)? = null, + showActions: Boolean = true, +) { + val context = LocalContext.current + val info = remember(token) { CashuTokenDecoder.decode(token) } + val primaryLabel = listOfNotNull(info?.displayAmount, info?.mintHost) + .joinToString(" · ") + .ifEmpty { stringResource(R.string.cashu_pay_via) } + var showMenu by remember { mutableStateOf(false) } + + Box { + Row( + modifier = modifier + .border(1.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.25f), RoundedCornerShape(12.dp)) + .background( + MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.45f), + RoundedCornerShape(12.dp) + ) + .combinedClickable( + onClick = onClick ?: { redeemCashu(context, token, preferWallet = true) }, + onLongClick = if (showActions) { + { showMenu = true } + } else { + null + } + ) + .semantics { + contentDescription = buildString { + append(context.getString(R.string.cashu_payment_description)) + append(": ") + append(primaryLabel) + info?.memo?.let { append(", $it") } + } + } + .heightIn(min = 48.dp) + .padding(horizontal = 12.dp, vertical = 6.dp), + horizontalArrangement = Arrangement.spacedBy(6.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Text("🥜") + Column { + Text( + primaryLabel, + style = MaterialTheme.typography.labelLarge, + color = MaterialTheme.colorScheme.onSecondaryContainer + ) + info?.memo?.let { + Text( + it, + style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.colorScheme.onSecondaryContainer.copy(alpha = 0.7f), + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + } + } + } + DropdownMenu( + expanded = showActions && showMenu, + onDismissRequest = { showMenu = false } + ) { + DropdownMenuItem( + text = { Text(stringResource(R.string.cashu_copy_token)) }, + onClick = { + val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager + clipboard.setPrimaryClip(ClipData.newPlainText("Cashu token", token)) + showMenu = false + } + ) + DropdownMenuItem( + text = { Text(stringResource(R.string.cashu_redeem_wallet)) }, + onClick = { + showMenu = false + redeemCashu(context, token, preferWallet = true) + } + ) + DropdownMenuItem( + text = { Text(stringResource(R.string.cashu_redeem_web)) }, + onClick = { + showMenu = false + redeemCashu(context, token, preferWallet = false) + } + ) + } + } +} + +private fun redeemCashu(context: Context, token: String, preferWallet: Boolean) { + val wallet = CashuTokenDecoder.walletUri(token) + val web = CashuTokenDecoder.webRedeemUri(token) ?: return + if (preferWallet && wallet != null) { + val walletIntent = Intent(Intent.ACTION_VIEW, Uri.parse(wallet)) + try { + context.startActivity(walletIntent) + return + } catch (_: ActivityNotFoundException) { + // No wallet registered for cashu:, so use the explicit web fallback. + } + } + runCatching { context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(web))) } +} + @Composable fun DeliveryStatusIcon(status: DeliveryStatus) { val colorScheme = MaterialTheme.colorScheme diff --git a/app/src/main/java/com/bitchat/android/ui/MessageManager.kt b/app/src/main/java/com/bitchat/android/ui/MessageManager.kt index 41a610f4..31e7d1af 100644 --- a/app/src/main/java/com/bitchat/android/ui/MessageManager.kt +++ b/app/src/main/java/com/bitchat/android/ui/MessageManager.kt @@ -3,7 +3,6 @@ package com.bitchat.android.ui import com.bitchat.android.model.BitchatMessage import com.bitchat.android.model.DeliveryStatus import com.bitchat.android.services.ContactDirectory -import com.bitchat.android.services.PrivateMessageArrivalOrder import java.util.* import java.util.Collections @@ -103,6 +102,49 @@ class MessageManager(private val state: ChatState) { fun addPrivateMessage(peerID: String, message: BitchatMessage) { val conversationID = ContactDirectory.canonicalConversationId(peerID) + val accepted = try { + com.bitchat.android.services.AppStateStore.addPrivateMessage( + conversationID, + message + ) + } catch (_: Exception) { + false + } + if (!accepted) return + publishAcceptedPrivateMessage(conversationID, message, forceRead = false) + } + + /** + * Adds a private message only after its database transaction has completed. + * + * Outgoing sends and non-mesh transports use this path so the local echo is never shown or + * transmitted unless it can survive an immediate process death. + */ + suspend fun addPrivateMessageDurably( + peerID: String, + message: BitchatMessage, + forceRead: Boolean = false + ): Boolean { + val conversationID = ContactDirectory.canonicalConversationId(peerID) + val accepted = try { + com.bitchat.android.services.AppStateStore.addPrivateMessageDurably( + peerID = conversationID, + msg = message, + forceRead = forceRead + ) + } catch (_: Exception) { + false + } + if (!accepted) return false + publishAcceptedPrivateMessage(conversationID, message, forceRead) + return true + } + + private fun publishAcceptedPrivateMessage( + conversationID: String, + message: BitchatMessage, + forceRead: Boolean + ) { val currentPrivateChats = state.getPrivateChatsValue().toMutableMap() if (!currentPrivateChats.containsKey(conversationID)) { currentPrivateChats[conversationID] = mutableListOf() @@ -111,14 +153,16 @@ class MessageManager(private val state: ChatState) { val chatMessages = currentPrivateChats[conversationID]?.toMutableList() ?: mutableListOf() chatMessages.add(message) currentPrivateChats[conversationID] = chatMessages - // Record the local arrival sequence before canonicalizing UI aliases. - PrivateMessageArrivalOrder.record(message.id) state.setPrivateChats(ContactDirectory.canonicalizePrivateChats(currentPrivateChats)) - // Reflect into process-wide store - try { com.bitchat.android.services.AppStateStore.addPrivateMessage(conversationID, message) } catch (_: Exception) { } // Mark as unread if not currently viewing this chat - if (state.getSelectedPrivateChatPeerValue() != conversationID && message.sender != state.getNicknameValue()) { + val selectedConversationID = state.getSelectedPrivateChatPeerValue() + ?.let(ContactDirectory::canonicalConversationId) + if ( + !forceRead && + selectedConversationID != conversationID && + message.sender != state.getNicknameValue() + ) { val currentUnread = state.getUnreadPrivateMessagesValue().toMutableSet() currentUnread.add(conversationID) state.setUnreadPrivateMessages(currentUnread) @@ -128,25 +172,29 @@ class MessageManager(private val state: ChatState) { // Variant that does not mark unread (used when we know the message has been read already, e.g., persisted Nostr read store) fun addPrivateMessageNoUnread(peerID: String, message: BitchatMessage) { val conversationID = ContactDirectory.canonicalConversationId(peerID) - val currentPrivateChats = state.getPrivateChatsValue().toMutableMap() - if (!currentPrivateChats.containsKey(conversationID)) { - currentPrivateChats[conversationID] = mutableListOf() + val accepted = try { + com.bitchat.android.services.AppStateStore.addPrivateMessage( + peerID = conversationID, + msg = message, + forceRead = true + ) + } catch (_: Exception) { + false } - val chatMessages = currentPrivateChats[conversationID]?.toMutableList() ?: mutableListOf() - chatMessages.add(message) - currentPrivateChats[conversationID] = chatMessages - // Record the local arrival sequence before canonicalizing UI aliases. - PrivateMessageArrivalOrder.record(message.id) - state.setPrivateChats(ContactDirectory.canonicalizePrivateChats(currentPrivateChats)) - // Reflect into process-wide store - try { com.bitchat.android.services.AppStateStore.addPrivateMessage(conversationID, message) } catch (_: Exception) { } + if (!accepted) return + publishAcceptedPrivateMessage(conversationID, message, forceRead = true) } fun clearPrivateMessages(peerID: String) { val conversationID = ContactDirectory.canonicalConversationId(peerID) + com.bitchat.android.services.AppStateStore.deletePrivateConversation(conversationID) val updatedChats = state.getPrivateChatsValue().toMutableMap() - updatedChats[conversationID] = emptyList() + updatedChats.keys.removeAll { key -> + ContactDirectory.canonicalConversationId(key) + .equals(conversationID, ignoreCase = true) + } state.setPrivateChats(updatedChats) + clearPrivateUnreadMessages(conversationID) } fun initializePrivateChat(peerID: String) { @@ -239,12 +287,19 @@ class MessageManager(private val state: ChatState) { is DeliveryStatus.PartiallyDelivered -> 3 is DeliveryStatus.Delivered -> 4 is DeliveryStatus.Read -> 5 - is DeliveryStatus.Failed -> 0 // treat as lowest for UI check marks ordering + is DeliveryStatus.Failed -> 0 } private fun chooseStatus(old: DeliveryStatus?, new: DeliveryStatus): DeliveryStatus? { - // Never downgrade (e.g., Read -> Delivered). Keep the higher priority. - return if (statusPriority(new) >= statusPriority(old)) new else old + // A send failure may replace an in-flight state, but never a confirmed delivery/read. + return when { + new is DeliveryStatus.Failed && + old !is DeliveryStatus.Delivered && + old !is DeliveryStatus.Read -> new + old is DeliveryStatus.Failed -> new + statusPriority(new) >= statusPriority(old) -> new + else -> old + } } fun updateMessageDeliveryStatus(messageID: String, status: DeliveryStatus) { @@ -325,7 +380,10 @@ class MessageManager(private val state: ChatState) { changed = true } } - if (changed) state.setPrivateChats(chats) + if (changed) { + state.setPrivateChats(chats.filterValues { it.isNotEmpty() }) + com.bitchat.android.services.AppStateStore.removePrivateMessage(messageID) + } } // Channels run { diff --git a/app/src/main/java/com/bitchat/android/ui/NotificationManager.kt b/app/src/main/java/com/bitchat/android/ui/NotificationManager.kt index f15ada44..2b77075d 100644 --- a/app/src/main/java/com/bitchat/android/ui/NotificationManager.kt +++ b/app/src/main/java/com/bitchat/android/ui/NotificationManager.kt @@ -1,19 +1,30 @@ package com.bitchat.android.ui +import android.Manifest import android.app.NotificationChannel -import android.app.NotificationManager +import android.app.NotificationManager as AndroidNotificationManager import android.app.PendingIntent import android.content.Context import android.content.Intent +import android.content.pm.PackageManager import android.os.Build import android.util.Log import androidx.core.app.NotificationCompat import androidx.core.app.Person import androidx.core.app.NotificationManagerCompat +import androidx.core.app.RemoteInput +import androidx.core.content.ContextCompat +import androidx.core.content.pm.ShortcutInfoCompat +import androidx.core.content.pm.ShortcutManagerCompat +import androidx.core.content.LocusIdCompat +import androidx.core.graphics.drawable.IconCompat import com.bitchat.android.MainActivity import com.bitchat.android.R +import com.bitchat.android.service.ConversationNotificationReceiver import com.bitchat.android.services.ContactDirectory -import com.bitchat.android.util.NotificationIntervalManager +import com.bitchat.android.services.ConversationListPreferences +import java.util.Collections +import java.util.WeakHashMap import java.util.concurrent.ConcurrentHashMap /** @@ -24,12 +35,10 @@ import java.util.concurrent.ConcurrentHashMap * - Support for mention notifications in geohash chats * - Support for first message notifications in geohash chats * - Proper notification management and cleanup - * - Active peers notification */ class NotificationManager( private val context: Context, - private val notificationManager: NotificationManagerCompat, - private val notificationIntervalManager: NotificationIntervalManager + private val notificationManager: NotificationManagerCompat ) { companion object { @@ -42,8 +51,7 @@ class NotificationManager( private const val GEOHASH_NOTIFICATION_REQUEST_CODE = 2000 private const val SUMMARY_NOTIFICATION_ID = 999 private const val GEOHASH_SUMMARY_NOTIFICATION_ID = 998 - private const val ACTIVE_PEERS_NOTIFICATION_ID = 997 - private const val ACTIVE_PEERS_NOTIFICATION_TIME_INTERVAL = com.bitchat.android.util.AppConstants.UI.ACTIVE_PEERS_NOTIFICATION_INTERVAL_MS + private const val MAX_MESSAGES_IN_NOTIFICATION = 25 // Intent extras for notification handling const val EXTRA_OPEN_PRIVATE_CHAT = "open_private_chat" @@ -51,9 +59,33 @@ class NotificationManager( const val EXTRA_PEER_ID = "peer_id" const val EXTRA_SENDER_NICKNAME = "sender_nickname" const val EXTRA_GEOHASH = "geohash" + const val ACTION_REPLY_TO_CONVERSATION = + "com.bitchat.android.action.REPLY_TO_CONVERSATION" + const val ACTION_MARK_CONVERSATION_READ = + "com.bitchat.android.action.MARK_CONVERSATION_READ" + const val KEY_TEXT_REPLY = "conversation_reply_text" + + private val liveManagers: MutableSet = + Collections.newSetFromMap(WeakHashMap()) + + /** + * Synchronizes notification action receivers with every manager instance in this process. + * Without this, an old in-memory MessagingStyle history could reappear on the next DM. + */ + fun acknowledgeConversation(context: Context, conversationID: String) { + val canonicalID = ContactDirectory.canonicalConversationId(conversationID) + val managers = synchronized(liveManagers) { liveManagers.toList() } + managers.forEach { it.clearNotificationsForSender(canonicalID) } + if (managers.isEmpty()) { + NotificationManagerCompat.from(context).cancel(canonicalID.hashCode()) + } + } } - private val systemNotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + private val systemNotificationManager = + context.getSystemService(Context.NOTIFICATION_SERVICE) as AndroidNotificationManager + private val conversationPreferences = + ConversationListPreferences.getInstance(context.applicationContext) // Track pending notifications per sender to enable grouping private val pendingNotifications = ConcurrentHashMap>() @@ -88,15 +120,17 @@ class NotificationManager( ) init { + synchronized(liveManagers) { liveManagers.add(this) } createNotificationChannel() } private fun createNotificationChannel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // DM notifications channel - val dmName = "Direct Messages" - val dmDescriptionText = "Notifications for private messages from other users" - val dmImportance = NotificationManager.IMPORTANCE_HIGH + val dmName = context.getString(R.string.notification_channel_direct_messages) + val dmDescriptionText = + context.getString(R.string.notification_channel_direct_messages_description) + val dmImportance = AndroidNotificationManager.IMPORTANCE_HIGH val dmChannel = NotificationChannel(CHANNEL_ID, dmName, dmImportance).apply { description = dmDescriptionText enableVibration(true) @@ -105,9 +139,10 @@ class NotificationManager( systemNotificationManager.createNotificationChannel(dmChannel) // Geohash notifications channel - val geohashName = "Geohash Chats" - val geohashDescriptionText = "Notifications for mentions and messages in geohash location channels" - val geohashImportance = NotificationManager.IMPORTANCE_HIGH + val geohashName = context.getString(R.string.notification_channel_geohash) + val geohashDescriptionText = + context.getString(R.string.notification_channel_geohash_description) + val geohashImportance = AndroidNotificationManager.IMPORTANCE_HIGH val geohashChannel = NotificationChannel(GEOHASH_CHANNEL_ID, geohashName, geohashImportance).apply { description = geohashDescriptionText enableVibration(true) @@ -146,6 +181,10 @@ class NotificationManager( */ fun showPrivateMessageNotification(senderPeerID: String, senderNickname: String, messageContent: String) { val conversationID = ContactDirectory.canonicalConversationId(senderPeerID) + if (conversationPreferences.isMuted(conversationID)) { + Log.d(TAG, "Skipping muted conversation notification") + return + } // Only show notifications if app is in background OR user is not viewing this specific chat val shouldNotify = isAppInBackground || (!isAppInBackground && currentPrivateChatPeer != conversationID) @@ -176,22 +215,6 @@ class NotificationManager( } } - fun showActiveUserNotification(peers: List) { - val currentTime = System.currentTimeMillis() - val activePeerNotificationIntervalExceeded = - (currentTime - notificationIntervalManager.lastNetworkNotificationTime) > ACTIVE_PEERS_NOTIFICATION_TIME_INTERVAL - val newPeers = peers - notificationIntervalManager.recentlySeenPeers - if (isAppInBackground && activePeerNotificationIntervalExceeded && newPeers.isNotEmpty()) { - Log.d(TAG, "Showing notification for active peers") - showNotificationForActivePeers(peers.size) - notificationIntervalManager.setLastNetworkNotificationTime(currentTime) - notificationIntervalManager.recentlySeenPeers.addAll(newPeers) - } else { - Log.d(TAG, "Skipping notification - app in foreground or it has been less than 5 minutes since last active peer notification") - return - } - } - private fun showNotificationForSender(senderPeerID: String) { val notifications = pendingNotifications[senderPeerID] ?: return if (notifications.isEmpty()) return @@ -219,6 +242,12 @@ class NotificationManager( .setName(latestNotification.senderNickname) .setKey(senderPeerID) .build() + val shortcutID = conversationShortcutID(senderPeerID) + publishConversationShortcut( + shortcutID = shortcutID, + person = person, + contentIntent = intent + ) // Build notification content val contentText = if (messageCount == 1) { @@ -242,47 +271,110 @@ class NotificationManager( .setPriority(NotificationCompat.PRIORITY_HIGH) .setCategory(NotificationCompat.CATEGORY_MESSAGE) .addPerson(person) + .setShortcutId(shortcutID) + .setLocusId(LocusIdCompat(shortcutID)) + .setVisibility(NotificationCompat.VISIBILITY_PRIVATE) .setShowWhen(true) .setWhen(latestNotification.timestamp) + val markReadIntent = Intent(context, ConversationNotificationReceiver::class.java).apply { + action = ACTION_MARK_CONVERSATION_READ + putExtra(EXTRA_PEER_ID, senderPeerID) + } + val markReadPendingIntent = PendingIntent.getBroadcast( + context, + NOTIFICATION_REQUEST_CODE + senderPeerID.hashCode() + 1, + markReadIntent, + PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT + ) + val replyIntent = Intent(context, ConversationNotificationReceiver::class.java).apply { + action = ACTION_REPLY_TO_CONVERSATION + putExtra(EXTRA_PEER_ID, senderPeerID) + putExtra(EXTRA_SENDER_NICKNAME, latestNotification.senderNickname) + } + val replyPendingIntent = PendingIntent.getBroadcast( + context, + NOTIFICATION_REQUEST_CODE + senderPeerID.hashCode() + 2, + replyIntent, + PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT + ) + val remoteInput = RemoteInput.Builder(KEY_TEXT_REPLY) + .setLabel(context.getString(R.string.notification_reply)) + .build() + builder + .addAction( + NotificationCompat.Action.Builder( + R.drawable.ic_notification, + context.getString(R.string.notification_mark_read), + markReadPendingIntent + ).build() + ) + .addAction( + NotificationCompat.Action.Builder( + R.drawable.ic_notification, + context.getString(R.string.notification_reply), + replyPendingIntent + ) + .addRemoteInput(remoteInput) + .setAllowGeneratedReplies(true) + .build() + ) + .setPublicVersion( + NotificationCompat.Builder(context, CHANNEL_ID) + .setSmallIcon(R.drawable.ic_notification) + .setContentTitle(context.getString(R.string.notification_private_message)) + .setContentText(context.getString(R.string.notification_content_hidden)) + .build() + ) + // Add to notification group if we have multiple senders if (pendingNotifications.size > 1) { builder.setGroup(GROUP_KEY_DM) } - // Add style for multiple messages - if (messageCount > 1) { - val style = NotificationCompat.InboxStyle() - .setBigContentTitle(contentTitle) - - // Show last few messages in expanded view - notifications.takeLast(5).forEach { notif -> - style.addLine(notif.messageContent) - } - - if (messageCount > 5) { - val extra = messageCount - 5 - style.setSummaryText(context.resources.getQuantityString( - R.plurals.notification_and_more, extra, extra - )) - } - - builder.setStyle(style) - } else { - // Single message - use BigTextStyle for long messages - builder.setStyle( - NotificationCompat.BigTextStyle() - .bigText(latestNotification.messageContent) + val self = Person.Builder() + .setName(context.getString(R.string.you)) + .setKey("bitchat-self") + .build() + val messagingStyle = NotificationCompat.MessagingStyle(self) + .setGroupConversation(false) + notifications.takeLast(MAX_MESSAGES_IN_NOTIFICATION).forEach { notification -> + messagingStyle.addMessage( + notification.messageContent, + notification.timestamp, + person ) } + builder.setStyle(messagingStyle) // Use sender peer ID hash as notification ID to group messages from same sender val notificationId = senderPeerID.hashCode() - notificationManager.notify(notificationId, builder.build()) + notifySafely(notificationId, builder.build()) Log.d(TAG, "Displayed notification for $contentTitle with ID $notificationId") } + private fun conversationShortcutID(conversationID: String): String = + "dm_" + java.util.UUID.nameUUIDFromBytes( + conversationID.lowercase().toByteArray(Charsets.UTF_8) + ).toString() + + private fun publishConversationShortcut( + shortcutID: String, + person: Person, + contentIntent: Intent + ) { + val shortcut = ShortcutInfoCompat.Builder(context, shortcutID) + .setShortLabel(person.name?.toString()?.take(40).orEmpty()) + .setLongLived(true) + .setPerson(person) + .setLocusId(LocusIdCompat(shortcutID)) + .setIcon(IconCompat.createWithResource(context, R.drawable.ic_notification)) + .setIntent(Intent(contentIntent).apply { action = Intent.ACTION_VIEW }) + .build() + ShortcutManagerCompat.pushDynamicShortcut(context, shortcut) + } + fun showVerificationNotification(title: String, body: String, peerID: String? = null) { val intent = Intent(context, MainActivity::class.java).apply { flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP @@ -311,44 +403,12 @@ class NotificationManager( .setShowWhen(true) .setWhen(System.currentTimeMillis()) - notificationManager.notify((System.currentTimeMillis() and 0x7FFFFFFF).toInt(), builder.build()) - } - - private fun showNotificationForActivePeers(peersSize: Int) { - // Create intent to open the app - val intent = Intent(context, MainActivity::class.java).apply { - flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP - } - - val pendingIntent = PendingIntent.getActivity( - context, - ACTIVE_PEERS_NOTIFICATION_ID, - intent, - PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT + notifySafely( + (System.currentTimeMillis() and 0x7FFFFFFF).toInt(), + builder.build() ) - - // Build notification content - val contentTitle = context.getString(R.string.notification_active_peers_title) - val contentText = if (peersSize == 1) { - context.getString(R.string.notification_active_peers_one) - } else { - context.getString(R.string.notification_active_peers_many, peersSize) - } - - val builder = NotificationCompat.Builder(context, CHANNEL_ID) - .setSmallIcon(R.drawable.ic_notification) - .setContentTitle(contentTitle) - .setContentText(contentText) - .setContentIntent(pendingIntent) - .setAutoCancel(true) - .setPriority(NotificationCompat.PRIORITY_MIN) - .setCategory(NotificationCompat.CATEGORY_MESSAGE) - .setShowWhen(true) - .setWhen(System.currentTimeMillis()) - - notificationManager.notify(ACTIVE_PEERS_NOTIFICATION_ID, builder.build()) - Log.d(TAG, "Displayed notification for $contentTitle with ID $ACTIVE_PEERS_NOTIFICATION_ID") } + private fun showSummaryNotification() { if (pendingNotifications.isEmpty()) return @@ -398,7 +458,7 @@ class NotificationManager( builder.setStyle(style) - notificationManager.notify(SUMMARY_NOTIFICATION_ID, builder.build()) + notifySafely(SUMMARY_NOTIFICATION_ID, builder.build()) Log.d(TAG, "Displayed summary notification for $senderCount senders") } @@ -431,6 +491,15 @@ class NotificationManager( Log.d(TAG, "Cleared notifications for conversation: $conversationID") } + fun removeConversationShortcut(conversationID: String) { + val shortcutIDs = listOf(conversationShortcutID(conversationID)) + ShortcutManagerCompat.removeDynamicShortcuts(context, shortcutIDs) + ShortcutManagerCompat.removeLongLivedShortcuts( + context, + shortcutIDs + ) + } + /** * Show a notification for a geohash message with mention or first message */ @@ -559,7 +628,7 @@ class NotificationManager( // Use geohash hash as notification ID to group messages from same geohash val notificationId = 3000 + geohash.hashCode() - notificationManager.notify(notificationId, builder.build()) + notifySafely(notificationId, builder.build()) Log.d(TAG, "Displayed geohash notification for $contentTitle with ID $notificationId") } @@ -626,7 +695,7 @@ class NotificationManager( builder.setStyle(style) - notificationManager.notify(GEOHASH_SUMMARY_NOTIFICATION_ID, builder.build()) + notifySafely(GEOHASH_SUMMARY_NOTIFICATION_ID, builder.build()) Log.d(TAG, "Displayed geohash summary notification for $geohashCount locations") } @@ -767,7 +836,7 @@ class NotificationManager( // Use a special notification ID for mesh mentions val notificationId = 4000 // Different from DM and geohash IDs - notificationManager.notify(notificationId, builder.build()) + notifySafely(notificationId, builder.build()) Log.d(TAG, "Displayed mesh mention notification: $contentTitle") } @@ -799,13 +868,37 @@ class NotificationManager( /** * Clear all pending notifications */ - fun clearAllNotifications() { + fun clearAllNotifications(removeConversationShortcuts: Boolean = false) { pendingNotifications.clear() notificationManager.cancelAll() pendingGeohashNotifications.clear() + if (removeConversationShortcuts) { + val shortcutIDs = ShortcutManagerCompat.getDynamicShortcuts(context).map { it.id } + ShortcutManagerCompat.removeAllDynamicShortcuts(context) + if (shortcutIDs.isNotEmpty()) { + ShortcutManagerCompat.removeLongLivedShortcuts(context, shortcutIDs) + } + } Log.d(TAG, "Cleared all notifications") } + private fun notifySafely(notificationID: Int, notification: android.app.Notification) { + if ( + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && + ContextCompat.checkSelfPermission( + context, + Manifest.permission.POST_NOTIFICATIONS + ) != PackageManager.PERMISSION_GRANTED + ) { + return + } + try { + notificationManager.notify(notificationID, notification) + } catch (error: SecurityException) { + Log.w(TAG, "Notification permission was revoked: ${error.message}") + } + } + /** * Get pending notification count for UI badging */ diff --git a/app/src/main/java/com/bitchat/android/ui/OrientationAwareActivity.kt b/app/src/main/java/com/bitchat/android/ui/OrientationAwareActivity.kt index 82d8feaa..a3914c90 100644 --- a/app/src/main/java/com/bitchat/android/ui/OrientationAwareActivity.kt +++ b/app/src/main/java/com/bitchat/android/ui/OrientationAwareActivity.kt @@ -2,14 +2,14 @@ package com.bitchat.android.ui import android.content.pm.ActivityInfo import android.os.Bundle -import androidx.activity.ComponentActivity +import androidx.appcompat.app.AppCompatActivity import com.bitchat.android.utils.DeviceUtils /** * Base activity that automatically sets orientation based on device type. * Tablets can rotate to landscape, phones are locked to portrait. */ -abstract class OrientationAwareActivity : ComponentActivity() { +abstract class OrientationAwareActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/app/src/main/java/com/bitchat/android/ui/PeerAvatar.kt b/app/src/main/java/com/bitchat/android/ui/PeerAvatar.kt new file mode 100644 index 00000000..fcdf4146 --- /dev/null +++ b/app/src/main/java/com/bitchat/android/ui/PeerAvatar.kt @@ -0,0 +1,105 @@ +package com.bitchat.android.ui + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import com.bitchat.android.R +import com.bitchat.android.ui.theme.BitchatFontFamily +import com.bitchat.android.ui.theme.LocalBitchatPalette + +internal val PeerAvatarBadgeSize = 18.dp +private val PeerAvatarStarSize = 16.dp + +@Composable +internal fun PeerAvatar( + name: String, + color: Color, + modifier: Modifier = Modifier, + isFavorite: Boolean = false, + theyFavoritedUs: Boolean = false, + badge: (@Composable () -> Unit)? = null +) { + val palette = LocalBitchatPalette.current + val colorScheme = MaterialTheme.colorScheme + + Box( + modifier = modifier.size(42.dp), + contentAlignment = Alignment.Center + ) { + Box( + modifier = Modifier + .size(38.dp) + .background(color.copy(alpha = 0.16f), CircleShape), + contentAlignment = Alignment.Center + ) { + Text( + text = name.trim().firstOrNull()?.uppercase() ?: "#", + style = MaterialTheme.typography.titleMedium.copy( + fontFamily = BitchatFontFamily, + fontWeight = FontWeight.SemiBold + ), + color = color + ) + } + + if (badge != null) { + Surface( + modifier = Modifier + .size(PeerAvatarBadgeSize) + .align(Alignment.BottomEnd), + shape = CircleShape, + color = colorScheme.surface, + tonalElevation = 1.dp + ) { + Box(contentAlignment = Alignment.Center) { + badge() + } + } + } + + if (isFavorite || theyFavoritedUs) { + Surface( + modifier = Modifier + .size(PeerAvatarStarSize) + .align(Alignment.TopEnd), + shape = CircleShape, + color = colorScheme.surface, + tonalElevation = 1.dp + ) { + Box(contentAlignment = Alignment.Center) { + Icon( + painter = painterResource( + if (isFavorite) { + R.drawable.ic_spec_star_filled + } else { + R.drawable.ic_spec_star + } + ), + contentDescription = stringResource( + if (isFavorite) { + R.string.cd_favorite + } else { + R.string.cd_favorited_you + } + ), + modifier = Modifier.size(10.dp), + tint = palette.accentOrange + ) + } + } + } + } +} diff --git a/app/src/main/java/com/bitchat/android/ui/PrivateChatManager.kt b/app/src/main/java/com/bitchat/android/ui/PrivateChatManager.kt index ee28a534..12678625 100644 --- a/app/src/main/java/com/bitchat/android/ui/PrivateChatManager.kt +++ b/app/src/main/java/com/bitchat/android/ui/PrivateChatManager.kt @@ -134,6 +134,50 @@ class PrivateChatManager( return true } + /** + * Persists the local echo before handing the payload to a transport. + * + * A failed database write deliberately aborts the send: otherwise the remote peer could + * receive a message that disappears from the sender's conversation after process death. + */ + suspend fun sendPrivateMessageDurably( + content: String, + peerID: String, + recipientNickname: String?, + senderNickname: String?, + myPeerID: String, + onSendMessage: (String, String, String, String) -> Unit + ): Boolean { + val conversationID = ContactDirectory.canonicalConversationId(peerID) + if (isPeerBlocked(peerID)) { + val systemMessage = BitchatMessage( + sender = "system", + content = "cannot send message to $recipientNickname: user is blocked.", + timestamp = Date(), + isRelay = false + ) + messageManager.addMessage(systemMessage) + return false + } + + val message = BitchatMessage( + sender = senderNickname ?: myPeerID, + content = content, + timestamp = Date(), + isRelay = false, + isPrivate = true, + recipientNickname = recipientNickname, + senderPeerID = myPeerID, + deliveryStatus = DeliveryStatus.Sending + ) + + if (!messageManager.addPrivateMessageDurably(conversationID, message, forceRead = true)) { + return false + } + onSendMessage(content, conversationID, recipientNickname ?: "", message.id) + return true + } + // MARK: - Peer Management fun isPeerBlocked(peerID: String): Boolean { @@ -375,6 +419,51 @@ class PrivateChatManager( } } + /** + * Durable admission for transports that do not pass through the mesh admission pipeline. + * + * Nostr acknowledgements are emitted by the caller only after this returns true, which lets a + * failed write be retried rather than silently acknowledging a message that was never saved. + */ + suspend fun handleIncomingPrivateMessageDurably( + message: BitchatMessage, + suppressUnread: Boolean, + origin: PrivateMessageOrigin + ): Boolean { + val senderPeerID = message.senderPeerID + val conversationID = senderPeerID + ?.let(ContactDirectory::canonicalConversationId) + ?: state.getSelectedPrivateChatPeerValue() + ?: return false + + if (senderPeerID != null && isPeerBlocked(senderPeerID)) return false + messageManager.initializePrivateChat(conversationID) + + val shouldPersistHere = origin == PrivateMessageOrigin.NOSTR || senderPeerID == null + if (shouldPersistHere) { + val accepted = messageManager.addPrivateMessageDurably( + peerID = conversationID, + message = message, + forceRead = suppressUnread || !trackUnreadMessages + ) + if (!accepted) return false + } + + if ( + senderPeerID != null && + trackUnreadMessages && + !suppressUnread && + state.getSelectedPrivateChatPeerValue() != conversationID + ) { + val unreadList = unreadReceivedMessages.getOrPut(conversationID) { mutableListOf() } + unreadList.add(message) + val currentUnread = state.getUnreadPrivateMessagesValue().toMutableSet() + currentUnread.add(conversationID) + state.setUnreadPrivateMessages(currentUnread) + } + return true + } + /** * Send read receipts for all unread messages from a specific peer * Called when the user focuses on a private chat diff --git a/app/src/main/java/com/bitchat/android/ui/SecurityVerificationSheet.kt b/app/src/main/java/com/bitchat/android/ui/SecurityVerificationSheet.kt index 40da30be..71e59f0d 100644 --- a/app/src/main/java/com/bitchat/android/ui/SecurityVerificationSheet.kt +++ b/app/src/main/java/com/bitchat/android/ui/SecurityVerificationSheet.kt @@ -48,6 +48,7 @@ import com.bitchat.android.R import com.bitchat.android.core.ui.component.button.CloseButton import com.bitchat.android.core.ui.component.sheet.LocalSheetDismiss import com.bitchat.android.core.ui.component.sheet.BitchatBottomSheet +import com.bitchat.android.services.ContactDirectory private data class SecurityStatusInfo( val text: String, @@ -100,7 +101,12 @@ fun SecurityVerificationSheet( val displayName = viewModel.resolvePeerDisplayNameForFingerprint(selectedPeerID) val fingerprint = viewModel.getPeerFingerprintForDisplay(selectedPeerID) val isVerified = fingerprint != null && verifiedFingerprints.contains(fingerprint) - val sessionState = peerSessionStates[selectedPeerID] + val activeMeshPeerID = ContactDirectory.resolve(selectedPeerID).meshPeerID + val sessionState = resolveConversationSessionState( + conversationID = selectedPeerID, + activeMeshPeerID = activeMeshPeerID, + peerSessionStates = peerSessionStates + ) val statusInfo = buildStatusInfo( isVerified = isVerified, sessionState = sessionState, diff --git a/app/src/main/java/com/bitchat/android/ui/VoiceInputComponents.kt b/app/src/main/java/com/bitchat/android/ui/VoiceInputComponents.kt index c9922bf1..563f1f02 100644 --- a/app/src/main/java/com/bitchat/android/ui/VoiceInputComponents.kt +++ b/app/src/main/java/com/bitchat/android/ui/VoiceInputComponents.kt @@ -1,18 +1,25 @@ package com.bitchat.android.ui +import android.Manifest +import android.view.HapticFeedbackConstants +import androidx.compose.foundation.gestures.awaitEachGesture +import androidx.compose.foundation.gestures.awaitFirstDown +import androidx.compose.foundation.gestures.waitForUpOrCancellation import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Mic -import android.Manifest -import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.size import androidx.compose.material3.Icon import androidx.compose.runtime.* import androidx.compose.ui.Modifier +import androidx.compose.ui.geometry.Offset import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.layout.LayoutCoordinates +import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.stringResource import androidx.compose.ui.platform.LocalHapticFeedback +import androidx.compose.ui.platform.LocalView import androidx.compose.ui.hapticfeedback.HapticFeedbackType +import androidx.compose.ui.res.stringResource import com.bitchat.android.features.voice.VoiceRecorder import com.google.accompanist.permissions.ExperimentalPermissionsApi import com.google.accompanist.permissions.PermissionStatus @@ -22,6 +29,7 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import kotlinx.coroutines.withTimeoutOrNull +import java.io.File /** * How long the button must be held before a recording starts. @@ -59,24 +67,37 @@ fun VoiceRecordButton( * pill's border change together instead of one lagging the other. */ isRecording: Boolean = false, + /** + * Consulted the instant the finger lifts, with the final pointer position in root + * coordinates: when it lands inside the slide-to-cancel target, the recording is + * discarded instead of sent. Receiving the position here (instead of reading composed + * state) keeps the verdict exact even for a slide-and-lift within a single frame. + */ + shouldCancel: (Offset) -> Boolean = { false }, + /** + * Finger position in root coordinates while a capture is live (drives the magnetic + * cancel target); null once the gesture ends. + */ + onTrackFinger: (Offset?) -> Unit = {}, onStart: () -> Unit, onAmplitude: (amplitude: Int, elapsedMs: Long) -> Unit, onFinish: (filePath: String) -> Unit, /** * Invoked whenever a recording ends without producing a file — permission denied, recorder - * failure, or the button being torn down mid-capture. The caller needs this to clear its own - * recording state; without it a failed capture left the composer stuck in recording mode. + * failure, the button being torn down mid-capture, or a deliberate slide-to-cancel. */ onCancel: () -> Unit = {} ) { val context = LocalContext.current val haptic = LocalHapticFeedback.current + val view = LocalView.current val micPermission = rememberPermissionState(Manifest.permission.RECORD_AUDIO) var isCapturing by remember { mutableStateOf(false) } var recorder by remember { mutableStateOf(null) } var recordedFilePath by remember { mutableStateOf(null) } var recordingStart by remember { mutableStateOf(0L) } + var buttonCoords by remember { mutableStateOf(null) } val scope = rememberCoroutineScope() var ampJob by remember { mutableStateOf(null) } @@ -86,6 +107,8 @@ fun VoiceRecordButton( val latestOnAmplitude = rememberUpdatedState(onAmplitude) val latestOnFinish = rememberUpdatedState(onFinish) val latestOnCancel = rememberUpdatedState(onCancel) + val latestShouldCancel = rememberUpdatedState(shouldCancel) + val latestOnTrackFinger = rememberUpdatedState(onTrackFinger) // Set when this instance was composed, so presses inherited from whatever occupied this spot // beforehand can be rejected. @@ -110,6 +133,7 @@ fun VoiceRecordButton( runCatching { recorder?.stop() } recorder = null recordedFilePath = null + latestOnTrackFinger.value(null) latestOnCancel.value() } } @@ -120,99 +144,123 @@ fun VoiceRecordButton( isActive = isRecording || isCapturing, isPressed = isCapturing, modifier = modifier + .onGloballyPositioned { buttonCoords = it } .pointerInput(Unit) { - detectTapGestures( - onPress = { - // Guard 1: ignore anything arriving before the swap animation settled. - if (System.currentTimeMillis() - composedAt < ArmDelayMs) { - return@detectTapGestures - } - // Guard 2: never start a second capture on top of a live one. - if (isCapturing) return@detectTapGestures + awaitEachGesture { + val down = awaitFirstDown(requireUnconsumed = false) + // Guard 1: ignore anything arriving before the swap animation settled. + if (System.currentTimeMillis() - composedAt < ArmDelayMs) { + return@awaitEachGesture + } + // Guard 2: never start a second capture on top of a live one. + if (isCapturing) return@awaitEachGesture - if (micPermission.status !is PermissionStatus.Granted) { - micPermission.launchPermissionRequest() - return@detectTapGestures - } + if (micPermission.status !is PermissionStatus.Granted) { + micPermission.launchPermissionRequest() + return@awaitEachGesture + } - // Guard 3: require a deliberate hold. `tryAwaitRelease` returns true on - // release and false on cancellation; either way the press was not a hold, - // so nothing should happen. Only a timeout means the finger is still down. - val stillHeld = withTimeoutOrNull(HoldToRecordMs) { - tryAwaitRelease() - } == null - if (!stillHeld) return@detectTapGestures + // Guard 3: require a deliberate hold. An up (or a stolen pointer) inside the + // arm window means the press was never a hold; only the timeout means the + // finger is still down. + var stolenDuringArm = false + val releasedEarly = withTimeoutOrNull(HoldToRecordMs) { + waitForUpOrCancellation().also { if (it == null) stolenDuringArm = true } + } + if (releasedEarly != null || stolenDuringArm) return@awaitEachGesture - val rec = VoiceRecorder(context) - val startedFile = rec.start() - if (startedFile == null) { - // Recorder refused to start; make sure the caller does not sit in a - // recording state that never began. - runCatching { rec.stop() } - latestOnCancel.value() - return@detectTapGestures - } + val rec = VoiceRecorder(context) + val startedFile = rec.start() + if (startedFile == null) { + // Recorder refused to start; make sure the caller does not sit in a + // recording state that never began. + runCatching { rec.stop() } + latestOnCancel.value() + return@awaitEachGesture + } - recorder = rec - recordedFilePath = startedFile.absolutePath - recordingStart = System.currentTimeMillis() - isCapturing = true - latestOnStart.value() - buzz() + recorder = rec + recordedFilePath = startedFile.absolutePath + recordingStart = System.currentTimeMillis() + isCapturing = true + latestOnStart.value() + buzz() - ampJob?.cancel() - ampJob = scope.launch { - while (isActive && isCapturing) { - val amp = recorder?.pollAmplitude() ?: 0 - val elapsed = - (System.currentTimeMillis() - recordingStart).coerceAtLeast(0L) - latestOnAmplitude.value(amp, elapsed) + ampJob?.cancel() + ampJob = scope.launch { + while (isActive && isCapturing) { + val amp = recorder?.pollAmplitude() ?: 0 + val elapsed = + (System.currentTimeMillis() - recordingStart).coerceAtLeast(0L) + latestOnAmplitude.value(amp, elapsed) - if (elapsed >= MaxRecordingMs && isCapturing) { - val file = recorder?.stop() - isCapturing = false - recorder = null - val path = file?.absolutePath ?: recordedFilePath - recordedFilePath = null - buzz() - // Always report the outcome, even when the file is unusable, - // or the caller stays stuck showing the waveform. - if (!path.isNullOrBlank()) { - latestOnFinish.value(path) - } else { - latestOnCancel.value() - } - break - } - delay(80) - } - } - - try { - tryAwaitRelease() - } finally { - if (isCapturing) { - // Keep going briefly past the release so the tail is not clipped. - delay(ReleaseTailMs) - } - if (isCapturing) { + if (elapsed >= MaxRecordingMs && isCapturing) { val file = recorder?.stop() isCapturing = false recorder = null val path = file?.absolutePath ?: recordedFilePath recordedFilePath = null + latestOnTrackFinger.value(null) buzz() + // Always report the outcome, even when the file is unusable, + // or the caller stays stuck showing the waveform. if (!path.isNullOrBlank()) { latestOnFinish.value(path) } else { latestOnCancel.value() } + break } - ampJob?.cancel() - ampJob = null + delay(80) } } - ) + + // Track the finger in root coordinates until it lifts, so the composer can + // run the magnetic slide-to-cancel target. A cancelled pointer (stolen by a + // scroller) ends the capture the same way a lift does. + var finalPos: Offset? = null + while (true) { + val event = awaitPointerEvent() + val change = event.changes.firstOrNull { it.id == down.id } ?: continue + finalPos = buttonCoords?.localToRoot(change.position) + finalPos?.let { latestOnTrackFinger.value(it) } + if (!change.pressed) break + } + + // Cancelling discards immediately; sending keeps a short tail so the last + // syllable is not clipped (an early pointer event simply ends the tail). + // The verdict is computed from the final pointer coordinate directly — + // reading recomposed state here could be one frame stale. + val cancel = finalPos?.let { latestShouldCancel.value(it) } == true + latestOnTrackFinger.value(null) + if (isCapturing && !cancel) { + withTimeoutOrNull(ReleaseTailMs) { awaitPointerEvent() } + } + if (isCapturing) { + val file = recorder?.stop() + isCapturing = false + recorder = null + val path = file?.absolutePath ?: recordedFilePath + recordedFilePath = null + if (cancel) { + path?.let { runCatching { File(it).delete() } } + try { + view.performHapticFeedback(HapticFeedbackConstants.REJECT) + } catch (_: Exception) { + } + latestOnCancel.value() + } else { + buzz() + if (!path.isNullOrBlank()) { + latestOnFinish.value(path) + } else { + latestOnCancel.value() + } + } + } + ampJob?.cancel() + ampJob = null + } } ) { tint -> Icon( diff --git a/app/src/main/java/com/bitchat/android/util/AppConstants.kt b/app/src/main/java/com/bitchat/android/util/AppConstants.kt index 0210f58c..b0f22596 100644 --- a/app/src/main/java/com/bitchat/android/util/AppConstants.kt +++ b/app/src/main/java/com/bitchat/android/util/AppConstants.kt @@ -125,7 +125,6 @@ object AppConstants { const val BASE_FONT_SIZE_SP: Int = 14 const val MESSAGE_DEDUP_TIMEOUT_MS: Long = 30_000L const val SYSTEM_EVENT_DEDUP_TIMEOUT_MS: Long = 5_000L - const val ACTIVE_PEERS_NOTIFICATION_INTERVAL_MS: Long = 300_000L const val ACTION_FORCE_FINISH: String = "com.bitchat.android.ACTION_FORCE_FINISH" const val PERMISSION_FORCE_FINISH: String = "com.bitchat.android.permission.FORCE_FINISH" } diff --git a/app/src/main/java/com/bitchat/android/util/NotificationIntervalManager.kt b/app/src/main/java/com/bitchat/android/util/NotificationIntervalManager.kt deleted file mode 100644 index ead07448..00000000 --- a/app/src/main/java/com/bitchat/android/util/NotificationIntervalManager.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.bitchat.android.util - -class NotificationIntervalManager { - private var _lastNetworkNotificationTime = 0L - val lastNetworkNotificationTime: Long - get() = _lastNetworkNotificationTime - - val recentlySeenPeers: MutableSet = mutableSetOf() - - fun setLastNetworkNotificationTime(notificationTime: Long) { - _lastNetworkNotificationTime = notificationTime - } -} \ No newline at end of file diff --git a/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareController.kt b/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareController.kt index 1c2b7e5f..ccb8b55f 100644 --- a/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareController.kt +++ b/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareController.kt @@ -30,6 +30,15 @@ object WifiAwareController { private var awareReceiverRegistered = false private var lastBlockedReason: String? = null + /** + * Set while a Wi-Fi Direct hotspot is hosting. Wi-Fi Aware (NAN) and Wi-Fi Direct + * (P2P) cannot hold interfaces at the same time on common chipsets — the HAL fails + * to create the P2P iface and every createGroup is answered with BUSY. The hold + * also blocks [startIfPossible], so a resume or mesh-service restart cannot bring + * Aware back while the hotspot is up. + */ + private val hotspotHold = AtomicBoolean(false) + private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob()) private val _enabled = MutableStateFlow(false) @@ -87,9 +96,30 @@ object WifiAwareController { if (value) startIfPossible() else stop() } + /** + * Releases the Wi-Fi radio so a Wi-Fi Direct hotspot can create its P2P interface, + * and prevents Aware restarting until [releaseHotspotHold] is called. + */ + fun holdForHotspot() { + if (!hotspotHold.compareAndSet(false, true)) return + Log.i(TAG, "Holding Wi-Fi Aware down so the hotspot can use the radio") + stop() + } + + /** Drops the hold and restores Aware if the user still has it enabled. */ + fun releaseHotspotHold() { + if (!hotspotHold.compareAndSet(true, false)) return + Log.i(TAG, "Hotspot finished; restoring Wi-Fi Aware if enabled") + restartIfStillEnabled() + } + fun startIfPossible() { val reusableService = synchronized(lifecycleLock) { if (!_enabled.value) return + if (hotspotHold.get()) { + Log.d(TAG, "Not starting Wi-Fi Aware: held down for the hotspot") + return + } val existing = service if (existing?.isRunning() == true) { _running.value = true @@ -149,7 +179,7 @@ object WifiAwareController { return } } - if (!_enabled.value) { + if (!_enabled.value || hotspotHold.get()) { synchronized(lifecycleLock) { starting = false } return } @@ -159,23 +189,40 @@ object WifiAwareController { WifiAwareMeshService(ctx) } startedService.startServices() - if (startedService.isRunning()) { - synchronized(lifecycleLock) { + + // Test the hold inside the same lock that publishes the service, and that + // stop() takes. Testing it outside leaves a window where holdForHotspot() + // sets the flag and stop() finds nothing published yet, and this block then + // publishes anyway — resurrecting NAN while the hotspot owns the radio. + // Ordering holds because holdForHotspot() sets the flag before calling + // stop(): either we see the flag here, or stop() sees our published service. + val published = synchronized(lifecycleLock) { + val canPublish = !hotspotHold.get() && startedService.isRunning() + if (canPublish) { service = startedService _running.value = true + } else { + if (service === startedService) service = null + _running.value = false } + canPublish + } + + if (published) { try { com.bitchat.android.service.MeshServiceHolder.unifiedMeshService?.refreshDelegates() } catch (_: Exception) { } clearBlockedDebugMessage() try { com.bitchat.android.ui.debug.DebugSettingsManager.getInstance().addDebugMessage(com.bitchat.android.ui.debug.DebugMessage.SystemMessage("Wi‑Fi Aware started")) } catch (_: Exception) {} } else { - if (reusableService == null) { + // stopServices() can block, so keep it out of the lock. + val heldForHotspot = hotspotHold.get() + if (heldForHotspot || reusableService == null) { try { startedService.stopServices() } catch (_: Exception) { } } - synchronized(lifecycleLock) { - if (service === startedService) service = null - _running.value = false + if (heldForHotspot) { + Log.i(TAG, "Abandoned Wi-Fi Aware start: hotspot claimed the radio") } - try { com.bitchat.android.ui.debug.DebugSettingsManager.getInstance().addDebugMessage(com.bitchat.android.ui.debug.DebugMessage.SystemMessage("Wi‑Fi Aware did not start")) } catch (_: Exception) {} + val detail = if (heldForHotspot) "held down for the hotspot" else "did not start" + try { com.bitchat.android.ui.debug.DebugSettingsManager.getInstance().addDebugMessage(com.bitchat.android.ui.debug.DebugMessage.SystemMessage("Wi‑Fi Aware $detail")) } catch (_: Exception) {} } } catch (e: Throwable) { Log.e(TAG, "Failed to start WifiAwareMeshService", e) diff --git a/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareMeshService.kt b/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareMeshService.kt index 85669aba..f6f27a7f 100644 --- a/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareMeshService.kt +++ b/app/src/main/java/com/bitchat/android/wifi-aware/WifiAwareMeshService.kt @@ -93,8 +93,7 @@ class WifiAwareMeshService(private val context: Context) : MeshService, Transpor // Service-level notification manager for background (no-UI) DMs private val serviceNotificationManager = com.bitchat.android.ui.NotificationManager( context.applicationContext, - androidx.core.app.NotificationManagerCompat.from(context.applicationContext), - com.bitchat.android.util.NotificationIntervalManager() + androidx.core.app.NotificationManagerCompat.from(context.applicationContext) ) // Wi-Fi Aware transport @@ -188,21 +187,13 @@ class WifiAwareMeshService(private val context: Context) : MeshService, Transpor fragmentingSender = FragmentingPacketSender(serviceScope, meshCore.fragmentManager, TAG) } - private fun handleMessageReceived(message: BitchatMessage) { - try { - when { - message.isPrivate -> { - val peer = message.senderPeerID ?: "" - if (peer.isNotEmpty()) com.bitchat.android.services.AppStateStore.addPrivateMessage(peer, message) - } - message.channel != null -> { - com.bitchat.android.services.AppStateStore.addChannelMessage(message.channel!!, message) - } - else -> { - com.bitchat.android.services.AppStateStore.addPublicMessage(message) - } - } - } catch (_: Exception) { } + private fun handleMessageReceived(message: BitchatMessage): Boolean { + // Match BLE admission semantics: a private message rejected during panic or as a + // duplicate must not create a notification after the conversation state was cleared. + if ( + !com.bitchat.android.services.IncomingMessageAdmission + .admitToAppState(message) + ) return false if (delegate == null && message.isPrivate) { try { @@ -215,6 +206,7 @@ class WifiAwareMeshService(private val context: Context) : MeshService, Transpor } } catch (_: Exception) { } } + return true } /** diff --git a/app/src/main/jniLibs/arm64-v8a/libarti_android.so b/app/src/main/jniLibs/arm64-v8a/libarti_android.so index f4776ae5..77e066cd 100755 Binary files a/app/src/main/jniLibs/arm64-v8a/libarti_android.so and b/app/src/main/jniLibs/arm64-v8a/libarti_android.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libarti_android.so b/app/src/main/jniLibs/armeabi-v7a/libarti_android.so index 846f0842..c15c82fc 100755 Binary files a/app/src/main/jniLibs/armeabi-v7a/libarti_android.so and b/app/src/main/jniLibs/armeabi-v7a/libarti_android.so differ diff --git a/app/src/main/jniLibs/x86/libarti_android.so b/app/src/main/jniLibs/x86/libarti_android.so index c3b7b5c6..d88a13cd 100755 Binary files a/app/src/main/jniLibs/x86/libarti_android.so and b/app/src/main/jniLibs/x86/libarti_android.so differ diff --git a/app/src/main/jniLibs/x86_64/libarti_android.so b/app/src/main/jniLibs/x86_64/libarti_android.so index 7b632704..b092b073 100755 Binary files a/app/src/main/jniLibs/x86_64/libarti_android.so and b/app/src/main/jniLibs/x86_64/libarti_android.so differ diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 5cf444be..a313162e 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -46,7 +46,7 @@ و%1$d إضافية %1$d رسالة من %2$d أشخاص و%1$d محادثات أخرى - 👥 مستخدمون قريبون! + مستخدمون قريبون! شخص واحد قريب %1$d أشخاص قريبون رسائل جديدة @@ -390,4 +390,8 @@ تحقّق من الملاحظات المتروكة هنا تُركت ملاحظة واحدة هنا — انقر للقراءة تُركت %d ملاحظات هنا — انقر للقراءة + اللغة + لغة التطبيق + إعداد النظام الافتراضي + اختر اللغة diff --git a/app/src/main/res/values-bn/strings.xml b/app/src/main/res/values-bn/strings.xml index 53c69ae6..d9ae8361 100644 --- a/app/src/main/res/values-bn/strings.xml +++ b/app/src/main/res/values-bn/strings.xml @@ -46,7 +46,7 @@ এবং %1$d আরো %2$d জন থেকে %1$d বার্তা এবং %1$d আরো কথোপকথন - 👥 কাছাকাছি bitchatter! + কাছাকাছি bitchatter! কাছাকাছি ১ জন কাছাকাছি %1$d জন নতুন বার্তা @@ -377,4 +377,8 @@ এখানে রাখা নোট আছে কি না দেখুন এখানে 1টি নোট রাখা আছে — পড়তে ট্যাপ করুন এখানে %dটি নোট রাখা আছে — পড়তে ট্যাপ করুন + ভাষা + অ্যাপের ভাষা + সিস্টেম ডিফল্ট + ভাষা নির্বাচন করুন diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index abea2e2f..76d2af75 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -46,7 +46,7 @@ und %1$d weitere %1$d Nachrichten von %2$d Personen und %1$d weitere Unterhaltungen - 👥 bitchatter in der Nähe! + bitchatter in der Nähe! 1 Person in der Nähe %1$d Personen in der Nähe Neue Nachrichten @@ -391,4 +391,8 @@ nachsehen, ob hier notizen hinterlassen wurden 1 notiz hier hinterlassen — tippen zum lesen %d notizen hier hinterlassen — tippen zum lesen + Sprache + App-Sprache + Systemstandard + Sprache auswählen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 1de44f88..7bd541f2 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -46,7 +46,7 @@ y %1$d más %1$d mensajes de %2$d personas y %1$d conversaciones más - 👥 ¡bitchatters cerca! + ¡bitchatters cerca! 1 persona cerca %1$d personas cerca Nuevos mensajes @@ -390,4 +390,8 @@ buscar notas dejadas aquí 1 nota dejada aquí — toca para leer %d notas dejadas aquí — toca para leer + Idioma + Idioma de la app + Predeterminado del sistema + Seleccionar idioma diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index 23967cf5..57cd9e5b 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -46,7 +46,7 @@ و %1$d مورد دیگر %1$d پیام از %2$d نفر و %1$d گفت‌وگوی دیگر - 👥 کاربران bitchat در نزدیکی! + کاربران bitchat در نزدیکی! ۱ نفر در نزدیکی %1$d نفر در نزدیکی پیام‌های جدید @@ -377,4 +377,8 @@ یادداشت‌های باقی‌مانده در اینجا را بررسی کنید ۱ یادداشت اینجا باقی مانده — برای خواندن ضربه بزنید %d یادداشت اینجا باقی مانده — برای خواندن ضربه بزنید + زبان + زبان برنامه + پیش‌فرض سیستم + انتخاب زبان diff --git a/app/src/main/res/values-fil/strings.xml b/app/src/main/res/values-fil/strings.xml index e98d06b3..8ac69fd3 100644 --- a/app/src/main/res/values-fil/strings.xml +++ b/app/src/main/res/values-fil/strings.xml @@ -46,7 +46,7 @@ at %1$d pa %1$d mensahe mula sa %2$d tao at %1$d pang usapan - 👥 mga bitchatter na malapit! + mga bitchatter na malapit! 1 tao sa paligid %1$d tao sa paligid Mga bagong mensahe @@ -394,4 +394,8 @@ tingnan kung may mga note na naiwan dito 1 note ang naiwan dito — i-tap para basahin %d note ang naiwan dito — i-tap para basahin + Wika + Wika ng app + Default ng system + Pumili ng wika diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 706aa67a..a9ac7bde 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -46,7 +46,7 @@ et %1$d de plus %1$d messages de %2$d personnes et %1$d conversations de plus - 👥 bitchatters à proximité ! + bitchatters à proximité ! 1 personne à proximité %1$d personnes à proximité Nouveaux messages @@ -408,4 +408,8 @@ vérifier s\'il y a des notes laissées ici 1 note laissée ici — appuyez pour lire %d notes laissées ici — appuyez pour lire + Langue + Langue de l’appli + Langue du système + Choisir la langue diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index d8d26842..657cc100 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -1,6 +1,7 @@ + #%1$s ± 1 • %2$d הערה #%1$s ± 1 • %2$d הערות @@ -14,48 +15,388 @@ היה הראשון להוסיף הערה למקום זה. סגור הוסף הערה למקום זה - Skip - Bluetooth Recommended + דלג + מומלץ Bluetooth רשת Mesh פועלת — %1$d עמיתים - verify - scan to verify me - scan someone elses qr - scan someone elses qr - show my qr - remove verification - qr unavailable - camera permission is needed to scan qr codes - enable camera - paste verification url - validate - verification requested - security verification - their fingerprint - your fingerprint - handshake pending - open a private chat to view fingerprints - encrypted & verified - encrypted - handshaking - handshake failed - not encrypted - verified - you have verified this persons identity. - not verified - compare these fingerprints with %1$s using a secure channel. - mark as verified - start handshake - copy - Mutual verification - You and %1$s verified each other - mutual verification with %1$s - Verified - You verified %1$s - verified %1$s - פתיחת אודות + אימות + סרוק כדי לאמת אותי + סרוק קוד QR של מישהו אחר + סרוק קוד QR של מישהו אחר + הצג את קוד ה-QR שלי + הסר אימות + קוד QR אינו זמין + נדרשת הרשאת מצלמה כדי לסרוק קודי QR + אפשר מצלמה + הדבק כתובת אימות + אמת + בקשת אימות נשלחה + אימות אבטחה + טביעת האצבע שלהם + טביעת האצבע שלך + לחיצת יד ממתינה + פתח שיחה פרטית כדי לצפות בטביעות אצבע + מוצפן ומאומת + מוצפן + מבצע לחיצת יד + לחיצת היד נכשלה + לא מוצפן + מאומת + אימתת את זהותו של אדם זה. + לא מאומת + השווה טביעות אצבע אלה עם %1$s באמצעות ערוץ מאובטח. + סמן כמאומת + התחל לחיצת יד + העתק + אימות הדדי + אתה ו-%1$s אימתתם זה את זה + אימות הדדי עם %1$s + מאומת + אימתת את %1$s + אימת את %1$s + + bitchat + נדרשת הרשאת Bluetooth להעברת הודעות בין עמיתים ללא אינטרנט. + נדרשת הרשאת מיקום כדי לגלות מכשירים קרובים באמצעות Bluetooth. + נדרשת הרשאת התראות כדי להתריע לך על הודעות חדשות. + כינוי + הקלד הודעה… + סיסמה + הצטרף לערוץ + עזוב + שלח + הצג פקודות + חזרה + אנשים + ערוצים + משתמשים מחוברים + אף אחד לא מחובר + הקש שלוש פעמים כדי למחוק את כל הנתונים + רשת + זוהה ייעול צריכת סוללה + ייעול צריכת סוללה מבוטל + ייעול צריכת סוללה אינו נדרש + בודק ייעול צריכת סוללה + מדוע לבטל ייעול צריכת סוללה? + bitchat פועל ברקע כדי לשמור על חיבורי רשת Mesh עם מכשירים קרובים. ייעול צריכת סוללה עלול לשבש חיבורים אלה, ולגרום לעיכוב או לאובדן הודעות.\n\nביטול ייעול צריכת הסוללה מבטיח העברת הודעות אמינה בין עמיתים. + בטל ייעול צריכת סוללה + הערה: תוכל לשנות הגדרה זו מאוחר יותר בהגדרות אנדרואיד > אפליקציות > bitchat > סוללה + המכשיר שלך אינו דורש הגדרות ייעול צריכת סוללה. bitchat יפעל כרגיל. + המכשיר שלך אינו דורש הגדרות ייעול צריכת סוללה. bitchat יפעל כרגיל. + bitchat יכול לפעול באופן אמין ברקע + • מבטיח מסירת הודעות אמינה\n• שומר על קישוריות רשת Mesh\n• מאפשר העברת הודעות ברקע\n• מונע ניתוקי חיבור + בדוק שוב + דלג לעת עתה + המשך + נסה שוב + ועוד %1$d + %1$d הודעות מ-%2$d אנשים + ועוד %1$d שיחות + 👥 יש בצ׳אטרים בקרבת מקום! + אדם אחד בסביבה + %1$d אנשים בסביבה + הודעות חדשות + הודעות מיקום חדשות + אוזכרת ב-%1$s + אוזכרת ב-%1$s (+%2$d נוספים) + %1$d אזכורים ב-%2$s + פעילות חדשה ב-%1$s + הודעות ב-%1$s + %1$s הצטרף/ה לשיחה + bitchat - %1$d אזכורים + bitchat - צ׳אטים לפי מיקום + %1$d הודעות מ-%2$d מיקומים + אוזכרת בצ׳אט Mesh + %1$d אזכורים בצ׳אט Mesh + ועוד %1$d מיקומים + + ועוד %1$d + ועוד %1$d + + שירות רקע של רשת Mesh + שומר על פעילות רשת ה-Mesh ברקע + הוסף למועדפים + הסר מהמועדפים + הוסף סימנייה + נגיש דרך Nostr + הודעות פרטיות שלא נקראו + הערות מיקום + טלפורט + סטטוס Tor פתיחת הגדרות מיקום וערוצים - בדיקה אם הושארו כאן פתקים - פתק אחד הושאר כאן — הקש לקריאה - %d פתקים הושארו כאן — הקש לקריאה + עמיתים מחוברים + משתתפי geohash + מוכן ללחיצת יד + לחיצת יד בתהליך + מוצפן מקצה לקצה + לחיצת היד נכשלה + 📎 התקבל קובץ + 📄 %1$s + 📏 גודל: %1$s + 🏷️ סוג: %1$s + 📂 פתח / שמור + ❌ סגור + בחר תמונה + שמור את התמונה הנוכחית + סגור + התמונה נשמרה בהורדות + שמירת התמונה נכשלה + תמונה %1$d מתוך %2$d + בחר קובץ + העברת הודעות מבוזרת ברשת Mesh עם הצפנה מקצה לקצה + צ׳אט Mesh לא מקוון + תקשר ישירות באמצעות Bluetooth LE ללא אינטרנט או שרתים. הודעות מועברות דרך מכשירים קרובים כדי להאריך את הטווח. + ערוצי geohash מקוונים + התחבר לאנשים באזורך באמצעות ערוצים מבוססי geohash. הרחב את רשת ה-Mesh באמצעות ממסרי אינטרנט ציבוריים. + הצפנה מקצה לקצה + הודעות פרטיות מוצפנות. הודעות בערוצים הן ציבוריות. + מערכת + בהיר + כהה + הוכחת עבודה + הוכחת עבודה כבויה + הוכחת עבודה דלוקה + הוסף הוכחת עבודה להודעות geohash כדי להרתיע ספאם. + קושי: %1$d ביטים (~%2$s) + קושי %1$d דורש כ-%2$s ניסיונות גיבוב + לא נדרשת הוכחת עבודה + נמוך מאוד - הגנה מינימלית מפני ספאם + נמוך - הגנה בסיסית מפני ספאם + בינוני - הגנה טובה מפני ספאם + גבוה - הגנה חזקה מפני ספאם + גבוה מאוד - עלול לגרום לעיכובים + קיצוני - נדרש חישוב משמעותי + רשת + Tor כבוי + Tor דלוק + נתב תעבורת אינטרנט דרך Tor לפרטיות משופרת. + סטטוס Tor: %1$s, אתחול %2$d%% + אחרון: %1$s + מחיקת נתונים חירומית + הגדרות דיבוג + קוד פתוח • פרטיות תחילה • מבוזר + סגור + פרטיות מוגנת + בטל + אזהרה + שירותי מיקום + פרטיות + שגיאה + ייעול צריכת סוללה + יתרונות + בודק ייעול צריכת סוללה + ייעול צריכת סוללה אינו נתמך + Bluetooth + הודעה שלא נקראה + פתח מפה + הסר סימנייה + טלפורט + צא מ-bitchat + הפעל ברקע + שמור על רשת ה-Mesh פעילה כאשר האפליקציה סגורה (שירות חזית) + עזוב ערוץ + נגיש דרך Nostr + מועדף לא מקוון + הפחת דיוק + הגבר דיוק + בחר geohash + גלול לתחתית + קובץ + תמונה + בטל + קישור + הקלט הודעה קולית + בחר מדיה + צ׳אט Mesh לא מקוון + ערוצי geohash מקוונים + הצפנה מקצה לקצה + #bluetooth • %1$s + תמונה %1$d מתוך %2$d + התמונה אינה זמינה + התמונה נשמרה בהורדות + שמירת התמונה נכשלה + בחר קובץ + [הקובץ אינו זמין] + לא ידוע + בחר פעולה עבור הודעה או משתמש זה + בחר פעולה עבור משתמש זה + העתק הודעה + העתק הודעה זו ללוח + סטור ל-%1$s + שלח הודעת סטירה שובבה + חבק את %1$s + שלח הודעת חיבוק ידידותית + חסום את %1$s + חסום את כל ההודעות ממשתמש זה + הודעה ל-%1$s + שלח הודעה פרטית + #ערוצי מיקום + שוחח עם אנשים בקרבתך באמצעות ערוצי geohash. משותף רק geohash גס, לעולם לא מיקום GPS מדויק. אל תצלם מסך או תשתף מסך זה כדי להגן על פרטיותך. + הענק הרשאת מיקום + הרשאת המיקום נדחתה. אפשר בהגדרות כדי להשתמש בערוצי מיקום. + ✓ הרשאת מיקום ניתנה + בודק הרשאות... + מחפש ערוצים בקרבת מקום… + סומן + geohash + geohash לא תקין + טלפורט + בטל שירותי מיקום + אפשר שירותי מיקום + mesh + רחוב + שכונה + עיר + מחוז + אזור + כלי דיבוג + כלי מפתחים לאבחון ובקרה + רישום מפורט + רושם הצטרפות/עזיבת עמיתים, כיוון חיבור, ניתוב חבילות וממסרים + תפקידי Bluetooth + שרת GATT + חיבורים: %1$d / %2$d + מקסימום שרת + לקוח GATT + מקסימום לקוח + חיבורים: %1$d / %2$d + מקסימום כולל + ממסר חבילות + מאז ההתחלה: %1$d + הפעל/כבה תפקידים וסגור את כל החיבורים כשמושבת + הגדרות סנכרון + מקסימום חבילות לסנכרון: %1$d + גודל מסנן GCS מקסימלי: %1$d בייטים (128–1024) + FPR יעד: %1$.2f%% + מכשירים מחוברים + מזהה המכשיר שלנו: %1$s + ללא + נתק + תוצאות סריקה אחרונות + התחבר + מסוף דיבוג + נקה + 10 שנ׳ אחרונות: %1$d • 1 דקה: %2$d • 15 דקות: %3$d + P נגזר: %1$s • הערכת מקסימום אלמנטים: %2$s + • ישיר + RSSI: %1$s + ? + כשרת (אנחנו מארחים) + כלקוח (אנחנו מתחברים) + נדרשים שירותי מיקום + פרטיות תחילה + bitchat לא עוקב אחר המיקום שלך.\n\nשירותי מיקום נדרשים לסריקת Bluetooth ולתכונת צ׳אט ה-Geohash. + bitchat זקוק לשירותי מיקום עבור: + • סריקת מכשירי Bluetooth\n• איתור משתמשים קרובים ברשת ה-Mesh\n• תכונת צ׳אט Geohash\n• ללא מעקב או איסוף מיקום + מומלץ מיקום ברקע + אופציונלי, משפר את אמינות ה-Mesh + אנדרואיד ממליץ על מיקום ברקע כדי ש-bitchat יוכל לסרוק מכשירים קרובים כשהאפליקציה אינה פתוחה. זה שומר על פעילות ה-Mesh לאחר איתחול מחדש. + כשההגדרות נפתחות, בחר \"אפשר תמיד\". + bitchat משתמש במיקום ברקע עבור: + - סריקת מכשירים קרובים כשהאפליקציה סגורה\n- חיבור מחדש לאחר איתחול\n- שמירה על פעילות ה-Mesh ברקע + אנחנו לעולם לא אוספים או שומרים את המיקום שלך. הפרטיות שלך בטוחה. + אפשר מיקום ברקע + המשך ללא מיקום ברקע + פתח הגדרות מיקום + בדוק שוב + שירותי מיקום אינם זמינים + שירותי מיקום אינם זמינים במכשיר זה. זה נדיר, מכיוון ששירותי מיקום הם סטנדרטיים במכשירי אנדרואיד.\n\nbitchat זקוק לשירותי מיקום כדי שסריקת Bluetooth תפעל כראוי (דרישת אנדרואיד). ללא זה, האפליקציה אינה יכולה לאתר משתמשים קרובים. + בודק שירותי מיקום... + נדרש Bluetooth + bitchat זקוק ל-Bluetooth כדי: + • לאתר משתמשים קרובים\n• ליצור חיבורי רשת Mesh\n• לשלוח ולקבל הודעות\n• לפעול ללא אינטרנט או שרתים + אפשר Bluetooth + Bluetooth אינו נתמך + מכשיר זה אינו תומך ב-Bluetooth Low Energy‏ (BLE), הנדרש כדי ש-bitchat יפעל.\n\nbitchat זקוק ל-BLE כדי ליצור רשתות Mesh ולתקשר עם מכשירים קרובים ללא אינטרנט. + בודק סטטוס Bluetooth... + זוהה ייעול צריכת סוללה + ייעול צריכת סוללה מופעל + bitchat צריך לפעול ברקע כדי לשמור על חיבורי Mesh. ייעול צריכת סוללה עלול לשבש חיבורים אלה. + יתרונות הביטול + • מסירת הודעות אמינה\n• שמירה על קישוריות Mesh\n• מניעת ניתוקי חיבור + בטל ייעול צריכת סוללה + ייעול צריכת סוללה בוטל + המשך + מאתחל רשת Mesh + . + מגדיר רשת Mesh דרך Bluetooth... + זה אמור לקחת רק כמה שניות + ⚠️ + ההגדרה לא הושלמה + נסה שוב + פתח הגדרות + הפרטיות שלך מוגנת + • ללא מעקב או איסוף נתונים\n• צ׳אטים ברשת Mesh דרך Bluetooth הם לחלוטין לא מקוונים\n• צ׳אטים לפי מיקום (Geohash) משתמשים באינטרנט + הרשאות + הענק הרשאות + bitchat לא עוקב אחר המיקום שלך + @ + · ⧉ + אין אף אחד בסביבה... + (אתה) + הזז ושנה תצוגה כדי לבחור geohash + בחר + הקלד הודעה... + @%1$s + אזכור + %1$d / %2$d + @%1$s + v%1$s + # + _ + [%1$s] %2$d%% + + + image/* + תמונה + קובץ + + + + ✓✓ + + + 📷 שלח/ה תמונה + 🎤 שלח/ה הודעה קולית + 📎 שלח/ה קובץ + 📄 + 🗜️ + 📄 + 📊 + 📈 + 📎 + נגן + השהה + נדרש כדי לאתר משתמשי bitchat באמצעות Bluetooth + אפשר ל-bitchat להתחבר למכשירים קרובים + נדרש על ידי אנדרואיד כדי לאתר משתמשי bitchat קרובים באמצעות Bluetooth + bitchat זקוק לזה כדי לסרוק מכשירים קרובים + מומלץ כדי לסרוק מכשירים קרובים כשהאפליקציה ברקע + אפשר גישה למיקום ברקע + קבל התראות כשאתה מקבל הודעות פרטיות + אפשר ל-bitchat לשלוח לך התראות + בטל ייעול צריכת סוללה כדי להבטיח ש-bitchat יפעל באופן אמין ברקע וישמור על חיבורי רשת Mesh + אפשר ל-bitchat לפעול ללא הגבלות סוללה + מכשירים קרובים + מיקום מדויק + מיקום ברקע + מיקרופון + התראות + ייעול צריכת סוללה + אחר + הזן סיסמת ערוץ + הערוץ %1$s מוגן בסיסמה. הזן את הסיסמה כדי להצטרף. + סיסמה + הצטרף + בטל + Tor אינו זמין בגרסה זו + + + איש אחד + %1$d אנשים + + שפה + שפת האפליקציה + ברירת המחדל של המערכת + בחירת שפה diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index fbe2f4b4..ceca0787 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -46,7 +46,7 @@ और %1$d %2$d लोगों से %1$d संदेश और %1$d वार्तालाप - 👥 पास में उपयोगकर्ता! + पास में उपयोगकर्ता! पास में 1 व्यक्ति पास में %1$d लोग नए संदेश @@ -390,4 +390,8 @@ देखें कि यहाँ नोट छोड़े गए हैं या नहीं यहाँ 1 नोट छोड़ा गया है — पढ़ने के लिए टैप करें यहाँ %d नोट छोड़े गए हैं — पढ़ने के लिए टैप करें + भाषा + ऐप की भाषा + सिस्टम डिफ़ॉल्ट + भाषा चुनें diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 13744970..5e2d0279 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -46,7 +46,7 @@ dan %1$d lagi %1$d pesan dari %2$d orang dan %1$d percakapan lagi - 👥 bitchatter terdekat! + bitchatter terdekat! 1 orang terdekat %1$d orang terdekat Pesan baru @@ -390,4 +390,8 @@ periksa catatan yang ditinggalkan di sini 1 catatan ditinggalkan di sini — ketuk untuk membaca %d catatan ditinggalkan di sini — ketuk untuk membaca + Bahasa + Bahasa aplikasi + Default sistem + Pilih bahasa diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a6171cb2..67c22cad 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -46,7 +46,7 @@ e altri %1$d %1$d messaggi da %2$d persone e altre %1$d conversazioni - 👥 bitchatter nelle vicinanze! + bitchatter nelle vicinanze! 1 persona nei dintorni %1$d persone nei dintorni Nuovi messaggi @@ -423,4 +423,8 @@ controlla se ci sono note lasciate qui 1 nota lasciata qui — tocca per leggere %d note lasciate qui — tocca per leggere + Lingua + Lingua dell’app + Predefinita di sistema + Seleziona lingua diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 5c6be0e0..b181eb7d 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -46,7 +46,7 @@ ほか %1$d 件 %2$d 人からの %1$d 件のメッセージ ほか %1$d 会話 - 👥 近くに bitchatter ! + 近くに bitchatter ! 近くに 1 人 近くに %1$d 人 新着メッセージ @@ -390,4 +390,8 @@ ここに残されたメモを確認 ここに1件のメモがあります — タップして読む ここに%d件のメモがあります — タップして読む + 言語 + アプリの言語 + システムのデフォルト + 言語を選択 diff --git a/app/src/main/res/values-ka/strings.xml b/app/src/main/res/values-ka/strings.xml index 6b30bd84..a15eb0dc 100644 --- a/app/src/main/res/values-ka/strings.xml +++ b/app/src/main/res/values-ka/strings.xml @@ -46,7 +46,7 @@ და კიდევ %1$d %2$d ადამიანიდან %1$d შეტყობინება და კიდევ %1$d საუბარი - 👥 bitchatter-ები ახლოს! + bitchatter-ები ახლოს! 1 ადამიანი ახლოს ახლოს %1$d ადამიანი ახალი შეტყობინებები @@ -377,4 +377,8 @@ აქ დატოვებული ჩანაწერების შემოწმება აქ 1 ჩანაწერია დატოვებული — წასაკითხად შეეხეთ აქ %d ჩანაწერია დატოვებული — წასაკითხად შეეხეთ + ენა + აპის ენა + სისტემის ნაგულისხმევი + ენის არჩევა diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 878fc055..354a546a 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -46,7 +46,7 @@ 그리고 %1$d개 더 %2$d명에게서 %1$d개의 메시지 그리고 %1$d개의 대화 더 - 👥 근처 bitchatter! + 근처 bitchatter! 근처 1명 근처 %1$d명 새 메시지 @@ -390,4 +390,8 @@ 여기 남겨진 쪽지 확인 여기 남겨진 쪽지 1개 — 탭하여 읽기 여기 남겨진 쪽지 %d개 — 탭하여 읽기 + 언어 + 앱 언어 + 시스템 기본값 + 언어 선택 diff --git a/app/src/main/res/values-mg/strings.xml b/app/src/main/res/values-mg/strings.xml index f13c0947..72291d80 100644 --- a/app/src/main/res/values-mg/strings.xml +++ b/app/src/main/res/values-mg/strings.xml @@ -46,7 +46,7 @@ ary %1$d hafa %1$d hafatra avy amin\'ny olona %2$d ary %1$d resaka hafa - 👥 bitchatter akaiky! + bitchatter akaiky! Olona 1 manodidina Olona %1$d manodidina Hafatra vaovao @@ -403,4 +403,8 @@ hizaha raha misy naoty navela teto naoty 1 no navela teto — tsindrio raha hamaky naoty %d no navela teto — tsindrio raha hamaky + Fiteny + Fitenin’ny app + Fitenin’ny rafitra + Safidio ny fiteny diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml index f5a16d1d..2dc624ce 100644 --- a/app/src/main/res/values-ms/strings.xml +++ b/app/src/main/res/values-ms/strings.xml @@ -1,48 +1,443 @@ - - Skip - Bluetooth Recommended + + bitchat + Kebenaran Bluetooth diperlukan untuk pemesejan rakan-ke-rakan tanpa internet. + Kebenaran lokasi diperlukan untuk mengesan peranti berdekatan melalui Bluetooth. + Kebenaran pemberitahuan diperlukan untuk memaklumkan anda tentang mesej baharu. + nama samaran + taip mesej… + Kata Laluan + Sertai Saluran + Keluar + Hantar + Tunjukkan arahan + Kembali + Orang + Saluran + Pengguna Dalam Talian + Tiada sesiapa yang disambungkan + Ketik tiga kali untuk memadam semua data + Rangkaian + + + Pengoptimuman Bateri Dikesan + Pengoptimuman Bateri Dilumpuhkan + Pengoptimuman Bateri Tidak Diperlukan + Menyemak Pengoptimuman Bateri + Kenapa lumpuhkan pengoptimuman bateri? + bitchat berjalan di latar belakang untuk mengekalkan sambungan rangkaian mesh dengan peranti berdekatan. Pengoptimuman bateri boleh mengganggu sambungan ini, menyebabkan mesej lewat atau terlepas.\n\nMelumpuhkan pengoptimuman bateri memastikan pemesejan rakan-ke-rakan yang boleh dipercayai. + Lumpuhkan Pengoptimuman Bateri + Nota: Anda boleh menukar tetapan ini kemudian dalam Tetapan Android > Apl > bitchat > Bateri + Peranti anda tidak memerlukan tetapan pengoptimuman bateri. bitchat akan berjalan seperti biasa. + Peranti anda tidak memerlukan tetapan pengoptimuman bateri. bitchat akan berjalan seperti biasa. + bitchat boleh berjalan dengan boleh dipercayai di latar belakang + • Memastikan penghantaran mesej yang boleh dipercayai\n• Mengekalkan ketersambungan rangkaian mesh\n• Membenarkan geganti mesej latar belakang\n• Mengelakkan sambungan terputus + Semak Semula + Langkau Buat Masa Ini + Teruskan + Cuba Lagi + Skip + + + dan %1$d lagi + %1$d mesej daripada %2$d orang + dan %1$d perbualan lagi + 👥 bitchatter berdekatan! + 1 orang berdekatan + %1$d orang berdekatan + Mesej Baharu + Mesej Lokasi Baharu + Disebut dalam %1$s + Disebut dalam %1$s (+%2$d lagi) + %1$d sebutan dalam %2$s + Aktiviti baharu dalam %1$s + Mesej dalam %1$s + %1$s telah menyertai perbualan + bitchat - %1$d sebutan + bitchat - sembang lokasi + %1$d mesej daripada %2$d lokasi + Disebut dalam Sembang Mesh + %1$d sebutan dalam Sembang Mesh + dan %1$d lokasi lagi + + + Perkhidmatan Latar Belakang Mesh + Mengekalkan mesh Bluetooth berjalan di latar belakang Mesh sedang berjalan — %1$d rakan - verify - scan to verify me - scan someone elses qr - scan someone elses qr - show my qr - remove verification - qr unavailable - camera permission is needed to scan qr codes - enable camera - paste verification url - validate - verification requested - security verification - their fingerprint - your fingerprint - handshake pending - open a private chat to view fingerprints - encrypted & verified - encrypted - handshaking - handshake failed - not encrypted - verified - you have verified this persons identity. - not verified - compare these fingerprints with %1$s using a secure channel. - mark as verified - start handshake - copy - Mutual verification - You and %1$s verified each other - mutual verification with %1$s - Verified - You verified %1$s - verified %1$s - Buka Perihal + + Tambah ke kegemaran + Alih keluar daripada kegemaran + Tambah penanda buku + + + Boleh dihubungi melalui Nostr + Mesej peribadi belum dibaca + Nota lokasi + Diteleport + Status Tor Buka tetapan lokasi dan saluran - semak nota yang ditinggalkan di sini - 1 nota ditinggalkan di sini — ketik untuk baca - %d nota ditinggalkan di sini — ketik untuk baca + Rakan disambungkan + Peserta geohash + Sedia untuk berjabat tangan + Jabat tangan sedang berlangsung + Disulitkan hujung-ke-hujung + Jabat tangan gagal + + + 📎 Fail Diterima + 📄 %1$s + 📏 Saiz: %1$s + 🏷️ Jenis: %1$s + 📂 Buka / Simpan + ❌ Tutup + Pilih imej + Simpan imej semasa + Tutup + Imej disimpan ke Muat Turun + Gagal menyimpan imej + Imej %1$d daripada %2$d + Pilih fail + + + pemesejan mesh terdesentralisasi dengan penyulitan hujung-ke-hujung + Sembang Mesh Luar Talian + Berkomunikasi terus melalui Bluetooth LE tanpa internet atau pelayan. Mesej digeganti melalui peranti berdekatan untuk melanjutkan jarak. + Saluran Geohash Dalam Talian + Berhubung dengan orang di kawasan anda menggunakan saluran berasaskan geohash. Melanjutkan mesh menggunakan geganti internet awam. + Penyulitan Hujung-ke-Hujung + Mesej peribadi disulitkan. Mesej saluran adalah awam. + sistem + cerah + gelap + bukti kerja + pow dimatikan + pow dihidupkan + tambah bukti kerja pada mesej geohash untuk mengelakkan spam. + tahap kesukaran: %1$d bit (~%2$s) + kesukaran %1$d memerlukan ~%2$s percubaan hash + tiada bukti kerja diperlukan + sangat rendah - perlindungan spam minimum + rendah - perlindungan spam asas + sederhana - perlindungan spam yang baik + tinggi - perlindungan spam yang kuat + sangat tinggi - mungkin menyebabkan kelewatan + melampau - pengiraan besar diperlukan + rangkaian + tor dimatikan + tor dihidupkan + laluan internet melalui tor untuk privasi yang lebih baik. + Status tor: %1$s, but-mula %2$d%% + Terakhir: %1$s + Pemadaman Data Kecemasan + Tetapan Nyahpepijat + Sumber Terbuka • Privasi Diutamakan • Terdesentralisasi + Tutup + Privasi Dilindungi + batal + + + Amaran + Perkhidmatan Lokasi + Privasi + Ralat + Pengoptimuman Bateri + Faedah + Menyemak Pengoptimuman Bateri + Pengoptimuman Bateri Tidak Disokong + Bluetooth + Mesej belum dibaca + Buka peta + Alih keluar penanda buku + Teleport + Keluar bitchat + jalankan di latar belakang + kekalkan mesh aktif apabila apl ditutup (perkhidmatan latar depan) + Keluar saluran + Boleh dihubungi melalui Nostr + Kegemaran luar talian + Kurangkan ketepatan + Tingkatkan ketepatan + Pilih geohash + Tatal ke bawah + Fail + Imej + Batal + Pautan + Rakam nota suara + Pilih media + Sembang Mesh Luar Talian + Saluran Geohash Dalam Talian + Penyulitan Hujung-ke-Hujung + #bluetooth • %1$s + + Imej %1$d daripada %2$d + Imej tidak tersedia + Imej disimpan ke Muat Turun + Gagal menyimpan imej + Pilih fail + [fail tidak tersedia] + tidak diketahui + + + pilih tindakan untuk mesej atau pengguna ini + pilih tindakan untuk pengguna ini + salin mesej + salin mesej ini ke papan keratan + tampar %1$s + hantar mesej tamparan bergurau + peluk %1$s + hantar mesej pelukan mesra + sekat %1$s + sekat semua mesej daripada pengguna ini + mesej %1$s + hantar mesej peribadi + + + + #saluran lokasi + berbual dengan orang berdekatan anda menggunakan saluran geohash. hanya geohash kasar dikongsi, tidak sekali-kali gps tepat. jangan ambil tangkapan skrin atau kongsi skrin ini untuk melindungi privasi anda. + berikan kebenaran lokasi + kebenaran lokasi ditolak. aktifkan dalam tetapan untuk menggunakan saluran lokasi. + + ✓ kebenaran lokasi diberikan + menyemak kebenaran... + mencari saluran berdekatan… + ditanda buku + geohash + geohash tidak sah + teleport + lumpuhkan perkhidmatan lokasi + aktifkan perkhidmatan lokasi + mesh + blok + kejiranan + bandar + wilayah + rantau + + + + #%1$s ± 1 • %2$d nota + + tambah nota kekal ringkas pada lokasi ini untuk pelawat lain temui. + geganti geo tidak tersedia; nota dijeda + tiada geganti geo berdekatan + nota bergantung pada geganti geo. semak sambungan dan cuba lagi. + memuatkan nota… + belum ada nota + jadilah yang pertama menambah satu untuk tempat ini. + tolak + tambah nota untuk tempat ini + + + alat nyahpepijat + utiliti pembangun untuk diagnostik dan kawalan + log terperinci + merekod penyertaan/pemergian rakan, arah sambungan, penghalaan paket dan geganti + peranan bluetooth + pelayan gatt + sambungan: %1$d / %2$d + maksimum pelayan + klien gatt + maksimum klien + sambungan: %1$d / %2$d + maksimum keseluruhan + geganti paket + sejak permulaan: %1$d + hidup/matikan peranan dan tutup semua sambungan apabila dilumpuhkan + tetapan penyegerakan + maksimum paket setiap penyegerakan: %1$d + saiz penapis GCS maksimum: %1$d bait (128–1024) + FPR sasaran: %1$.2f%% + peranti disambungkan + id peranti kami: %1$s + tiada + putuskan sambungan + keputusan imbasan terkini + + sahkan + imbas untuk sahkan saya + imbas kod qr orang lain + imbas kod qr orang lain + tunjukkan kod qr saya + alih keluar pengesahan + kod qr tidak tersedia + kebenaran kamera diperlukan untuk mengimbas kod qr + dayakan kamera + tampal pautan pengesahan + sahkan + pengesahan diminta + pengesahan keselamatan + cap jari mereka + cap jari anda + jabat tangan tertangguh + buka sembang peribadi untuk melihat cap jari + disulitkan & disahkan + disulitkan + berjabat tangan + jabat tangan gagal + tidak disulitkan + disahkan + anda telah mengesahkan identiti orang ini. + tidak disahkan + bandingkan cap jari ini dengan %1$s menggunakan saluran selamat. + tanda sebagai disahkan + mulakan jabat tangan + salin + + Pengesahan bersama + Anda dan %1$s telah saling mengesahkan + pengesahan bersama dengan %1$s + Disahkan + Anda telah mengesahkan %1$s + telah mengesahkan %1$s + + sambung + konsol nyahpepijat + kosongkan + 10s lepas: %1$d • 1m: %2$d • 15m: %3$d + P terbitan: %1$s • anggaran unsur maks: %2$s + • terus + RSSI: %1$s + ? + sebagai pelayan (kami hos) + sebagai klien (kami sambung) + + + Perkhidmatan Lokasi Diperlukan + Privasi Diutamakan + bitchat TIDAK menjejaki lokasi anda.\n\nPerkhidmatan lokasi diperlukan untuk imbasan Bluetooth dan untuk ciri sembang Geohash. + bitchat memerlukan perkhidmatan lokasi untuk: + • Imbasan peranti Bluetooth\n• Mengesan pengguna berdekatan pada rangkaian mesh\n• Ciri sembang Geohash\n• Tiada penjejakan atau pengumpulan lokasi + Lokasi Latar Belakang Disyorkan + pilihan, meningkatkan kebolehpercayaan mesh + Android mengesyorkan lokasi latar belakang supaya bitchat boleh mengimbas peranti berdekatan semasa apl tidak dibuka. Ini mengekalkan mesh aktif selepas but semula. + Apabila tetapan dibuka, pilih "Benarkan sepanjang masa". + bitchat menggunakan lokasi latar belakang untuk: + - mengimbas peranti berdekatan semasa apl ditutup\n- menyambung semula selepas but semula\n- mengekalkan mesh berjalan di latar belakang + Kami TIDAK PERNAH mengumpul atau menyimpan lokasi anda. Privasi anda selamat. + Benarkan Lokasi Latar Belakang + Teruskan tanpa lokasi latar belakang + Buka Tetapan Lokasi + Semak Semula + Perkhidmatan Lokasi Tidak Tersedia + Perkhidmatan lokasi tidak tersedia pada peranti ini. Ini luar biasa kerana perkhidmatan lokasi adalah standard pada peranti Android.\n\nbitchat memerlukan perkhidmatan lokasi untuk imbasan Bluetooth berfungsi dengan betul (keperluan Android). Tanpa ini, apl tidak dapat mengesan pengguna berdekatan. + Menyemak perkhidmatan lokasi... + Bluetooth Diperlukan + bitchat memerlukan Bluetooth untuk: + • Mengesan pengguna berdekatan\n• Mewujudkan sambungan rangkaian mesh\n• Menghantar dan menerima mesej\n• Berfungsi tanpa internet atau pelayan + Aktifkan Bluetooth + Bluetooth Tidak Disokong + Peranti ini tidak menyokong Bluetooth Low Energy (BLE), yang diperlukan untuk bitchat berfungsi.\n\nbitchat memerlukan BLE untuk mewujudkan rangkaian mesh dan berkomunikasi dengan peranti berdekatan tanpa internet. + Menyemak status Bluetooth... + pengoptimuman bateri dikesan + Pengoptimuman Bateri Diaktifkan + bitchat perlu berjalan di latar belakang untuk mengekalkan sambungan mesh. pengoptimuman bateri boleh mengganggu sambungan ini. + Faedah Melumpuhkan + • penghantaran mesej yang boleh dipercayai\n• mengekalkan ketersambungan mesh\n• mengelakkan sambungan terputus + Lumpuhkan Pengoptimuman Bateri + pengoptimuman bateri dilumpuhkan + Teruskan + Memulakan rangkaian mesh + . + Menyediakan rangkaian mesh Bluetooth... + Ini sepatutnya hanya mengambil masa beberapa saat + ⚠️ + Persediaan Tidak Lengkap + Cuba Lagi + Buka Tetapan + Privasi Anda Dilindungi + • tiada penjejakan atau pengumpulan data\n• sembang mesh Bluetooth sepenuhnya luar talian\n• sembang Geohash menggunakan internet + kebenaran + Berikan Kebenaran + bitchat TIDAK menjejaki lokasi anda + @ + · ⧉ + tiada sesiapa berdekatan... + (anda) + gerak dan zum untuk memilih geohash + pilih + taip mesej... + @%1$s + sebutan + %1$d / %2$d + @%1$s + v%1$s + # + _ + [%1$s] %2$d%% + + + image/* + Imej + Fail + + + + + + ✓✓ + + + + + 📷 menghantar imej + 🎤 menghantar mesej suara + 📎 menghantar fail + 📄 + 🗜️ + 📄 + 📊 + 📈 + 📎 + + + Main + Jeda + + + Diperlukan untuk mengesan pengguna bitchat melalui Bluetooth + Benarkan bitchat menyambung kepada peranti berdekatan + Diperlukan oleh Android untuk mengesan pengguna bitchat berdekatan melalui Bluetooth + bitchat memerlukan ini untuk mengimbas peranti berdekatan + Disyorkan untuk mengimbas peranti berdekatan semasa apl di latar belakang + Benarkan akses lokasi latar belakang + Terima pemberitahuan apabila anda menerima mesej peribadi + Benarkan bitchat menghantar pemberitahuan kepada anda + Lumpuhkan pengoptimuman bateri untuk memastikan bitchat berjalan dengan boleh dipercayai di latar belakang dan mengekalkan sambungan rangkaian mesh + Benarkan bitchat berjalan tanpa sekatan bateri + + + Peranti Berdekatan + Lokasi Tepat + Lokasi Latar Belakang + Mikrofon + Pemberitahuan + Pengoptimuman Bateri + Lain-lain + + + Masukkan Kata Laluan Saluran + Saluran %1$s dilindungi kata laluan. Masukkan kata laluan untuk menyertai. + Kata Laluan + Sertai + Batal + Tor tidak tersedia dalam binaan ini + + + + dan %d lagi + + + + %d orang + + + Bluetooth Disyorkan + Bahasa + Bahasa aplikasi + Lalai sistem + Pilih bahasa diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index b65764bd..64c9bbd6 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -46,7 +46,7 @@ र %1$d थप %1$d सन्देश %2$d जनाबाट र %1$d अरू कुराकानी - 👥 नजिकै bitchatter हरू! + नजिकै bitchatter हरू! १ जना नजिकै %1$d जना नजिकै नयाँ सन्देश @@ -394,4 +394,8 @@ यहाँ छोडिएका नोटहरू छन् कि हेर्नुहोस् यहाँ 1 नोट छोडिएको छ — पढ्न ट्याप गर्नुहोस् यहाँ %d नोटहरू छोडिएका छन् — पढ्न ट्याप गर्नुहोस् + भाषा + एपको भाषा + प्रणालीको पूर्वनिर्धारित + भाषा छान्नुहोस् diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index b160bd3b..e02bc5ce 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -46,7 +46,7 @@ en %1$d meer %1$d berichten van %2$d personen en %1$d meer conversaties - 👥 bitchatters in de buurt! + bitchatters in de buurt! 1 persoon in de buurt %1$d personen in de buurt Nieuwe berichten @@ -421,4 +421,8 @@ kijk of hier notities zijn achtergelaten 1 notitie hier achtergelaten — tik om te lezen %d notities hier achtergelaten — tik om te lezen + Taal + App-taal + Systeemstandaard + Taal selecteren diff --git a/app/src/main/res/values-pa-rPK/strings.xml b/app/src/main/res/values-pa-rPK/strings.xml index 8da58184..0cb9cbe8 100644 --- a/app/src/main/res/values-pa-rPK/strings.xml +++ b/app/src/main/res/values-pa-rPK/strings.xml @@ -46,7 +46,7 @@ تے %1$d ہور %2$d لوکان کولوں %1$d پیغام تے %1$d ہور گلاں - 👥 نیڑے bitchatter! + نیڑے bitchatter! نیڑے 1 بندہ نیڑے %1$d بندے نویں پیغام @@ -377,4 +377,8 @@ ایتھے چھڈے نوٹس ویکھو ایتھے 1 نوٹ چھڈیا گیا — پڑھݨ لئی ٹیپ کرو ایتھے %d نوٹس چھڈے گئے — پڑھݨ لئی ٹیپ کرو + بولی + ایپ دی بولی + سسٹم دی ڈیفالٹ + بولی چݨو diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5755aa47..0196d218 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1,6 +1,8 @@ + + #%1$s ± 1 • %2$d notatka #%1$s ± 1 • %2$d notatek @@ -18,44 +20,389 @@ Bluetooth zalecany Mesh działa — %1$d peerów - verify - scan to verify me - scan someone elses qr - scan someone elses qr - show my qr - remove verification - qr unavailable - camera permission is needed to scan qr codes - enable camera - paste verification url - validate - verification requested - security verification - their fingerprint - your fingerprint - handshake pending - open a private chat to view fingerprints - encrypted & verified - encrypted - handshaking - handshake failed - not encrypted - verified - you have verified this persons identity. - not verified - compare these fingerprints with %1$s using a secure channel. - mark as verified - start handshake - copy - Mutual verification - You and %1$s verified each other - mutual verification with %1$s - Verified - You verified %1$s - verified %1$s - Otwórz informacje - Otwórz ustawienia lokalizacji i kanałów - sprawdź, czy zostawiono tutaj notatki - 1 notatka zostawiona tutaj — stuknij, aby przeczytać - %d notatek zostawionych tutaj — stuknij, aby przeczytać + weryfikuj + zeskanuj, aby mnie zweryfikować + zeskanuj kod QR innej osoby + zeskanuj kod QR innej osoby + pokaż mój kod QR + usuń weryfikację + kod QR niedostępny + wymagane jest uprawnienie do aparatu, aby zeskanować kody QR + włącz aparat + wklej link weryfikacyjny + zweryfikuj + poproszono o weryfikację + weryfikacja bezpieczeństwa + odcisk drugiej osoby + twój odcisk + oczekiwanie na uzgadnianie + otwórz czat prywatny, aby zobaczyć odciski + zaszyfrowane i zweryfikowane + zaszyfrowane + uzgadnianie + uzgadnianie nie powiodło się + niezaszyfrowane + zweryfikowano + zweryfikowałeś tożsamość tej osoby. + niezweryfikowano + porównaj te odciski z %1$s za pomocą bezpiecznego kanału. + oznacz jako zweryfikowane + rozpocznij uzgadnianie + kopiuj + Weryfikacja wzajemna + Ty i %1$s zweryfikowaliście się nawzajem + wzajemna weryfikacja z %1$s + Zweryfikowano + Zweryfikowałeś %1$s + zweryfikowano %1$s + + + bitchat + Uprawnienie Bluetooth jest wymagane do komunikacji peer-to-peer bez internetu. + Uprawnienie lokalizacji jest wymagane do wykrywania pobliskich urządzeń przez Bluetooth. + Uprawnienie powiadomień jest wymagane, aby informować Cię o nowych wiadomościach. + pseudonim + napisz wiadomość… + Hasło + Dołącz do kanału + Opuść + Wyślij + Pokaż komendy + Wstecz + Osoby + Kanały + Użytkownicy online + Nikt nie jest połączony + Stuknij trzykrotnie, aby wyczyścić wszystkie dane + Sieć + Wykryto optymalizację baterii + Optymalizacja baterii wyłączona + Optymalizacja baterii niewymagana + Sprawdzanie optymalizacji baterii + Dlaczego wyłączyć optymalizację baterii? + bitchat działa w tle, aby utrzymać połączenia z siecią mesh z pobliskimi urządzeniami. Optymalizacja baterii może przerywać te połączenia, powodując opóźnienia lub utratę wiadomości.\n\nWyłączenie optymalizacji baterii zapewnia niezawodną komunikację peer-to-peer. + Wyłącz optymalizację baterii + Uwaga: możesz zmienić to ustawienie później w Ustawieniach Androida > Aplikacje > bitchat > Bateria + Twoje urządzenie nie wymaga ustawień optymalizacji baterii. bitchat będzie działać normalnie. + Twoje urządzenie nie wymaga ustawień optymalizacji baterii. bitchat będzie działać normalnie. + bitchat może działać niezawodnie w tle + • Zapewnia niezawodne dostarczanie wiadomości\n• Utrzymuje łączność sieci mesh\n• Umożliwia przekazywanie wiadomości w tle\n• Zapobiega zrywaniu połączeń + Sprawdź ponownie + Pomiń na razie + Kontynuuj + Ponów + i jeszcze %1$d + %1$d wiadomości od %2$d osób + i jeszcze %1$d rozmów + 👥 bitchatowicze w pobliżu! + 1 osoba w pobliżu + %1$d osób w pobliżu + Nowe wiadomości + Nowe wiadomości lokalizacyjne + Wzmianka w %1$s + Wzmianka w %1$s (+%2$d więcej) + %1$d wzmianek w %2$s + Nowa aktywność w %1$s + Wiadomości w %1$s + %1$s dołączył(a) do rozmowy + bitchat - %1$d wzmianek + bitchat - czaty lokalizacyjne + %1$d wiadomości z %2$d lokalizacji + Wzmianka w czacie Mesh + %1$d wzmianek w czacie Mesh + i jeszcze %1$d lokalizacji + Usługa mesh w tle + Utrzymuje działanie sieci mesh Bluetooth w tle + Dodaj do ulubionych + Usuń z ulubionych + Dodaj zakładkę + Dostępny przez Nostr + Nieprzeczytane wiadomości prywatne + Notatki lokalizacji + Teleportowany + Status Tor + Otwórz ustawienia lokalizacji i kanałów + Połączeni użytkownicy + Uczestnicy geohash + Gotowy do uzgadniania + Uzgadnianie w toku + Szyfrowane end-to-end + Uzgadnianie nie powiodło się + 📎 Otrzymano plik + 📄 %1$s + 📏 Rozmiar: %1$s + 🏷️ Typ: %1$s + 📂 Otwórz / Zapisz + ❌ Zamknij + Wybierz obraz + Zapisz bieżący obraz + Zamknij + Obraz zapisany w Pobranych + Nie udało się zapisać obrazu + Obraz %1$d z %2$d + Wybierz plik + zdecentralizowana komunikacja mesh z szyfrowaniem end-to-end + Czat mesh offline + Komunikuj się bezpośrednio przez Bluetooth LE bez internetu i serwerów. Wiadomości są przekazywane przez pobliskie urządzenia, aby zwiększyć zasięg. + Kanały geohash online + Łącz się z ludźmi w Twojej okolicy za pomocą kanałów opartych na geohash. Rozszerz sieć mesh, korzystając z publicznych przekaźników internetowych. + Szyfrowanie end-to-end + Wiadomości prywatne są szyfrowane. Wiadomości na kanałach są publiczne. + systemowy + jasny + ciemny + dowód pracy + pow wyłączony + pow włączony + dodaj dowód pracy do wiadomości geohash, aby zniechęcić do spamu. + trudność: %1$d bitów (~%2$s) + trudność %1$d wymaga ~%2$s prób hashowania + dowód pracy niewymagany + bardzo niska - minimalna ochrona przed spamem + niska - podstawowa ochrona przed spamem + średnia - dobra ochrona przed spamem + wysoka - silna ochrona przed spamem + bardzo wysoka - może powodować opóźnienia + ekstremalna - wymaga znacznych obliczeń + sieć + tor wyłączony + tor włączony + kieruj ruch internetowy przez Tor dla większej prywatności. + Status tor: %1$s, bootstrap %2$d%% + Ostatnio: %1$s + Awaryjne usuwanie danych + Ustawienia debugowania + Open Source • Prywatność przede wszystkim • Zdecentralizowane + Zamknij + Prywatność chroniona + anuluj + Ostrzeżenie + Usługi lokalizacji + Prywatność + Błąd + Optymalizacja baterii + Korzyści + Sprawdzanie optymalizacji baterii + Optymalizacja baterii nieobsługiwana + Bluetooth + Nieprzeczytana wiadomość + Otwórz mapę + Usuń zakładkę + Teleportuj + Zamknij bitchat + działaj w tle + utrzymuj sieć mesh aktywną po zamknięciu aplikacji (usługa pierwszoplanowa) + Opuść kanał + Dostępny przez Nostr + Ulubiony offline + Zmniejsz precyzję + Zwiększ precyzję + Wybierz geohash + Przewiń na dół + Plik + Obraz + Anuluj + Link + Nagraj notatkę głosową + Wybierz multimedia + Czat mesh offline + Kanały geohash online + Szyfrowanie end-to-end + #bluetooth • %1$s + Obraz %1$d z %2$d + Obraz niedostępny + Obraz zapisany w Pobranych + Nie udało się zapisać obrazu + Wybierz plik + [plik niedostępny] + nieznany + wybierz działanie dla tej wiadomości lub użytkownika + wybierz działanie dla tego użytkownika + kopiuj wiadomość + skopiuj tę wiadomość do schowka + spoliczkuj %1$s + wyślij żartobliwą wiadomość o spoliczkowaniu + przytul %1$s + wyślij przyjazną wiadomość z przytuleniem + zablokuj %1$s + zablokuj wszystkie wiadomości od tego użytkownika + napisz do %1$s + wyślij prywatną wiadomość + #kanały lokalizacyjne + rozmawiaj z osobami w pobliżu za pomocą kanałów geohash. udostępniany jest tylko przybliżony geohash, nigdy dokładne GPS. nie rób zrzutów ekranu ani nie udostępniaj tego ekranu, aby chronić swoją prywatność. + przyznaj uprawnienie lokalizacji + odmówiono uprawnienia lokalizacji. włącz je w ustawieniach, aby korzystać z kanałów lokalizacyjnych. + \u2713 przyznano uprawnienie lokalizacji + sprawdzanie uprawnień... + wyszukiwanie pobliskich kanałów… + dodano do zakładek + geohash + nieprawidłowy geohash + teleportuj + wyłącz usługi lokalizacji + włącz usługi lokalizacji + mesh + blok + dzielnica + miasto + województwo + region + narzędzia debugowania + narzędzia deweloperskie do diagnostyki i kontroli + szczegółowe logowanie + loguje dołączenia/odejścia peerów, kierunek połączenia, trasowanie pakietów i przekaźniki + role bluetooth + serwer gatt + połączenia: %1$d / %2$d + maks. serwer + klient gatt + maks. klient + połączenia: %1$d / %2$d + maks. ogółem + przekazywanie pakietów + od startu: %1$d + włączaj/wyłączaj role i zamykaj wszystkie połączenia po wyłączeniu + ustawienia synchronizacji + maks. pakietów na synchronizację: %1$d + maks. rozmiar filtra GCS: %1$d bajtów (128–1024) + docelowy FPR: %1$.2f%% + połączone urządzenia + id naszego urządzenia: %1$s + brak + rozłącz + ostatnie wyniki skanowania + połącz + konsola debugowania + wyczyść + ostatnie 10s: %1$d • 1min: %2$d • 15min: %3$d + wyliczone P: %1$s • szac. maks. elementów: %2$s + • bezpośrednio + RSSI: %1$s + ? + jako serwer (hostujemy) + jako klient (łączymy się) + Wymagane usługi lokalizacji + Prywatność przede wszystkim + bitchat NIE śledzi Twojej lokalizacji.\n\nUsługi lokalizacji są wymagane do skanowania Bluetooth oraz do funkcji czatu Geohash. + bitchat potrzebuje usług lokalizacji do: + • Skanowania urządzeń Bluetooth\n• Wykrywania pobliskich użytkowników w sieci mesh\n• Funkcji czatu geohash\n• Brak śledzenia lub gromadzenia lokalizacji + Zalecana lokalizacja w tle + opcjonalne, poprawia niezawodność sieci mesh + Android zaleca lokalizację w tle, aby bitchat mógł skanować pobliskie urządzenia, gdy aplikacja nie jest otwarta. Utrzymuje to sieć mesh aktywną po ponownym uruchomieniu. + Gdy otworzą się ustawienia, wybierz „Zawsze zezwalaj”. + bitchat używa lokalizacji w tle do: + - skanowania pobliskich urządzeń, gdy aplikacja jest zamknięta\n- ponownego łączenia po restarcie\n- utrzymywania działania sieci mesh w tle + NIGDY nie gromadzimy ani nie zapisujemy Twojej lokalizacji. Twoja prywatność jest bezpieczna. + Zezwól na lokalizację w tle + Kontynuuj bez lokalizacji w tle + Otwórz ustawienia lokalizacji + Sprawdź ponownie + Usługi lokalizacji niedostępne + Usługi lokalizacji są niedostępne na tym urządzeniu. Jest to nietypowe, ponieważ usługi lokalizacji są standardem w urządzeniach z Androidem.\n\nbitchat potrzebuje usług lokalizacji, aby skanowanie Bluetooth działało poprawnie (wymóg Androida). Bez tego aplikacja nie może wykrywać pobliskich użytkowników. + Sprawdzanie usług lokalizacji... + Wymagany Bluetooth + bitchat potrzebuje Bluetooth, aby: + • Wykrywać pobliskich użytkowników\n• Tworzyć połączenia sieci mesh\n• Wysyłać i odbierać wiadomości\n• Działać bez internetu i serwerów + Włącz Bluetooth + Bluetooth nieobsługiwany + To urządzenie nie obsługuje Bluetooth Low Energy (BLE), który jest wymagany do działania bitchat.\n\nbitchat potrzebuje BLE, aby tworzyć sieci mesh i komunikować się z pobliskimi urządzeniami bez internetu. + Sprawdzanie stanu Bluetooth... + wykryto optymalizację baterii + Optymalizacja baterii włączona + bitchat musi działać w tle, aby utrzymać połączenia z siecią mesh. optymalizacja baterii może przerywać te połączenia. + Korzyści z wyłączenia + • niezawodne dostarczanie wiadomości\n• utrzymuje łączność sieci mesh\n• zapobiega zrywaniu połączeń + Wyłącz optymalizację baterii + optymalizacja baterii wyłączona + Kontynuuj + Inicjalizowanie sieci mesh + . + Konfigurowanie sieci mesh Bluetooth... + To powinno zająć tylko kilka sekund + ⚠️ + Konfiguracja niekompletna + Spróbuj ponownie + Otwórz ustawienia + Twoja prywatność jest chroniona + • brak śledzenia ani gromadzenia danych\n• czaty sieci mesh Bluetooth są całkowicie offline\n• czaty geohash korzystają z internetu + uprawnienia + Przyznaj uprawnienia + bitchat NIE śledzi Twojej lokalizacji + @ + · ⧉ + nikogo w pobliżu... + (ty) + przesuwaj i powiększaj, aby wybrać geohash + wybierz + napisz wiadomość... + @%1$s + wzmianka + %1$d / %2$d + @%1$s + v%1$s + # + _ + [%1$s] %2$d%% + + + image/* + Obraz + Plik + + + + ✓✓ + + + 📷 wysłał(a) obraz + 🎤 wysłał(a) wiadomość głosową + 📎 wysłał(a) plik + 📄 + 🗜️ + 📄 + 📊 + 📈 + 📎 + Odtwórz + Wstrzymaj + Wymagane do wykrywania użytkowników bitchat przez Bluetooth + Zezwól bitchat na łączenie się z pobliskimi urządzeniami + Wymagane przez Android do wykrywania pobliskich użytkowników bitchat przez Bluetooth + bitchat potrzebuje tego, aby skanować pobliskie urządzenia + Zalecane do skanowania pobliskich urządzeń, gdy aplikacja działa w tle + Zezwól na dostęp do lokalizacji w tle + Otrzymuj powiadomienia, gdy dostaniesz prywatne wiadomości + Zezwól bitchat na wysyłanie Ci powiadomień + Wyłącz optymalizację baterii, aby zapewnić niezawodne działanie bitchat w tle i utrzymanie połączeń z siecią mesh + Zezwól bitchat na działanie bez ograniczeń baterii + Pobliskie urządzenia + Precyzyjna lokalizacja + Lokalizacja w tle + Mikrofon + Powiadomienia + Optymalizacja baterii + Inne + Wprowadź hasło kanału + Kanał %1$s jest chroniony hasłem. Wprowadź hasło, aby dołączyć. + Hasło + Dołącz + Anuluj + Tor niedostępny w tej wersji + + + i jeszcze %1$d + i jeszcze %1$d + i jeszcze %1$d + i jeszcze %1$d + + + %1$d osoba + %1$d osoby + %1$d osób + %1$d osoby + + Język + Język aplikacji + Domyślny systemu + Wybierz język diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 1f49a3a4..92895e4d 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -46,7 +46,7 @@ e mais %1$d %1$d mensagens de %2$d pessoas e mais %1$d conversas - 👥 pessoas do bitchat por perto! + pessoas do bitchat por perto! 1 pessoa por perto %1$d pessoas por perto Novas mensagens @@ -389,4 +389,8 @@ ver se há notas deixadas aqui 1 nota deixada aqui — toque para ler %d notas deixadas aqui — toque para ler + Idioma + Idioma do app + Padrão do sistema + Selecionar idioma diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 3b05891f..156df94b 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -46,7 +46,7 @@ e mais %1$d %1$d mensagens de %2$d pessoas e mais %1$d conversas - 👥 bitchatters por perto! + bitchatters por perto! 1 pessoa por perto %1$d pessoas por perto Novas mensagens @@ -390,4 +390,8 @@ ver se há notas deixadas aqui 1 nota deixada aqui — toque para ler %d notas deixadas aqui — toque para ler + Idioma + Idioma da aplicação + Predefinição do sistema + Selecionar idioma diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 6bac2ebb..ab246554 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -40,7 +40,7 @@ и ещё %1$d %1$d сообщений от %2$d людей и ещё %1$d бесед - 👥 bitchatter рядом! + bitchatter рядом! Рядом 1 человек Рядом %1$d человек Новые сообщения @@ -384,4 +384,8 @@ проверить, есть ли здесь заметки здесь оставлена 1 заметка — нажмите, чтобы прочитать здесь оставлено заметок: %d — нажмите, чтобы прочитать + Язык + Язык приложения + Системный язык + Выбрать язык diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 9ce76eba..6c6a57d1 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -40,7 +40,7 @@ och %1$d till %1$d meddelanden från %2$d personer och %1$d fler konversationer - 👥 bitchatter i närheten! + bitchatter i närheten! 1 person i närheten %1$d personer i närheten Nya meddelanden @@ -382,4 +382,8 @@ kolla om anteckningar lämnats här 1 anteckning lämnad här — tryck för att läsa %d anteckningar lämnade här — tryck för att läsa + Språk + Appspråk + Systemstandard + Välj språk diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml index 7ca3e8c7..8f6bb836 100644 --- a/app/src/main/res/values-ta/strings.xml +++ b/app/src/main/res/values-ta/strings.xml @@ -1,48 +1,400 @@ + - - Skip + Skip Bluetooth Recommended மெஷ் இயங்குகிறது — %1$d பியர்ஸ் - verify - scan to verify me - scan someone elses qr - scan someone elses qr - show my qr - remove verification - qr unavailable - camera permission is needed to scan qr codes - enable camera - paste verification url - validate - verification requested - security verification - their fingerprint - your fingerprint - handshake pending - open a private chat to view fingerprints - encrypted & verified - encrypted - handshaking - handshake failed - not encrypted - verified - you have verified this persons identity. - not verified - compare these fingerprints with %1$s using a secure channel. - mark as verified - start handshake - copy - Mutual verification - You and %1$s verified each other - mutual verification with %1$s - Verified - You verified %1$s - verified %1$s - அறிமுகத்தைத் திற + சரிபார் + என்னை சரிபார்க்க ஸ்கேன் செய்யவும் + மற்றவரின் QR குறியீட்டை ஸ்கேன் செய்யவும் + மற்றவரின் QR குறியீட்டை ஸ்கேன் செய்யவும் + எனது QR குறியீட்டைக் காட்டு + சரிபார்ப்பை அகற்று + QR குறியீடு கிடைக்கவில்லை + QR குறியீடுகளை ஸ்கேன் செய்ய கேமரா அனுமதி தேவை + கேமராவை இயக்கு + சரிபார்ப்பு இணைப்பை ஒட்டவும் + சரிபார் + சரிபார்ப்பு கோரப்பட்டது + பாதுகாப்பு சரிபார்ப்பு + அவர்களின் கைரேகை + உங்கள் கைரேகை + கைகுலுக்கல் நிலுவையில் உள்ளது + கைரேகைகளைப் பார்க்க ஒரு தனிப்பட்ட உரையாடலைத் திறக்கவும் + குறியாக்கம் செய்யப்பட்டு சரிபார்க்கப்பட்டது + குறியாக்கம் செய்யப்பட்டது + கைகுலுக்கல் நடைபெறுகிறது + கைகுலுக்கல் தோல்வியடைந்தது + குறியாக்கம் செய்யப்படவில்லை + சரிபார்க்கப்பட்டது + இந்த நபரின் அடையாளத்தை நீங்கள் சரிபார்த்துவிட்டீர்கள். + சரிபார்க்கப்படவில்லை + பாதுகாப்பான சேனலைப் பயன்படுத்தி இந்த கைரேகைகளை %1$s உடன் ஒப்பிடவும். + சரிபார்க்கப்பட்டதாகக் குறி + கைகுலுக்கலைத் தொடங்கு + நகலெடு + பரஸ்பர சரிபார்ப்பு + நீங்களும் %1$s உம் ஒருவரையொருவர் சரிபார்த்துக்கொண்டீர்கள் + %1$s உடன் பரஸ்பர சரிபார்ப்பு + சரிபார்க்கப்பட்டது + நீங்கள் %1$s ஐ சரிபார்த்துவிட்டீர்கள் + %1$s சரிபார்க்கப்பட்டது + + bitchat + இணையம் இல்லாமல் பியர்-டு-பியர் செய்திகள் அனுப்ப Bluetooth அனுமதி தேவை. + Bluetooth வழியாக அருகிலுள்ள சாதனங்களைக் கண்டறிய இருப்பிட அனுமதி தேவை. + புதிய செய்திகளை உங்களுக்குத் தெரிவிக்க அறிவிப்பு அனுமதி தேவை. + புனைப்பெயர் + செய்தியை உள்ளிடவும்… + கடவுச்சொல் + சேனலில் சேரவும் + வெளியேறு + அனுப்பு + கட்டளைகளைக் காட்டு + பின் + நபர்கள் + சேனல்கள் + ஆன்லைன் பயனர்கள் + யாரும் இணைக்கப்படவில்லை + அனைத்து தரவையும் அழிக்க மூன்று முறை தட்டவும் + நெட்வொர்க் + பேட்டரி ஆப்டிமைசேஷன் கண்டறியப்பட்டது + பேட்டரி ஆப்டிமைசேஷன் முடக்கப்பட்டது + பேட்டரி ஆப்டிமைசேஷன் தேவையில்லை + பேட்டரி ஆப்டிமைசேஷனைச் சரிபார்க்கிறது + பேட்டரி ஆப்டிமைசேஷனை ஏன் முடக்க வேண்டும்? + அருகிலுள்ள சாதனங்களுடன் மெஷ் நெட்வொர்க் இணைப்புகளைப் பராமரிக்க bitchat பின்னணியில் இயங்குகிறது. பேட்டரி ஆப்டிமைசேஷன் இந்த இணைப்புகளை தடுக்கலாம், இதனால் செய்திகள் தாமதமாகலாம் அல்லது தவறவிடப்படலாம்.\n\nபேட்டரி ஆப்டிமைசேஷனை முடக்குவது நம்பகமான பியர்-டு-பியர் செய்தி அனுப்புதலை உறுதி செய்கிறது. + பேட்டரி ஆப்டிமைசேஷனை முடக்கு + குறிப்பு: Android அமைப்புகள் > ஆப்ஸ் > bitchat > பேட்டரி என்பதில் இந்த அமைப்பை பின்னர் மாற்றலாம் + உங்கள் சாதனத்திற்கு பேட்டரி ஆப்டிமைசேஷன் அமைப்புகள் தேவையில்லை. bitchat சாதாரணமாக இயங்கும். + உங்கள் சாதனத்திற்கு பேட்டரி ஆப்டிமைசேஷன் அமைப்புகள் தேவையில்லை. bitchat சாதாரணமாக இயங்கும். + bitchat பின்னணியில் நம்பகமாக இயங்க முடியும் + • நம்பகமான செய்தி வழங்கலை உறுதி செய்கிறது\n• மெஷ் நெட்வொர்க் இணைப்பைப் பராமரிக்கிறது\n• பின்னணி செய்தி அனுப்புதலை அனுமதிக்கிறது\n• இணைப்பு துண்டிப்புகளைத் தடுக்கிறது + மீண்டும் சரிபார்க்கவும் + இப்போதைக்கு தவிர் + தொடரவும் + மீண்டும் முயற்சி + மற்றும் %1$d மேலும் + %2$d நபர்களிடமிருந்து %1$d செய்திகள் + மற்றும் %1$d மேலும் உரையாடல்கள் + 👥 அருகில் bitchatters! + 1 நபர் அருகில் உள்ளார் + %1$d நபர்கள் அருகில் உள்ளனர் + புதிய செய்திகள் + புதிய இருப்பிட செய்திகள் + %1$s இல் குறிப்பிடப்பட்டது + %1$s இல் குறிப்பிடப்பட்டது (+%2$d மேலும்) + %2$s இல் %1$d குறிப்புகள் + %1$s இல் புதிய செயல்பாடு + %1$s இல் செய்திகள் + %1$s உரையாடலில் சேர்ந்தார் + bitchat - %1$d குறிப்புகள் + bitchat - இருப்பிட அரட்டைகள் + %2$d இருப்பிடங்களிலிருந்து %1$d செய்திகள் + மெஷ் அரட்டையில் குறிப்பிடப்பட்டது + மெஷ் அரட்டையில் %1$d குறிப்புகள் + மற்றும் %1$d மேலும் இருப்பிடங்கள் + + மற்றும் %d மேலும் + மற்றும் %d மேலும் + + + 1 நபர் + %d நபர்கள் + + மெஷ் பின்னணி சேவை + Bluetooth மெஷை பின்னணியில் இயங்க வைக்கிறது + பிடித்தவைகளில் சேர் + பிடித்தவைகளிலிருந்து அகற்று + புக்மார்க் சேர் + Nostr அணுகக்கூடியது + படிக்காத தனிப்பட்ட செய்திகள் + இருப்பிட குறிப்புகள் + டெலிபோர்ட் செய்யப்பட்டது + Tor நிலை இருப்பிடம் மற்றும் சேனல் அமைப்புகளைத் திற - இங்கே விடப்பட்ட குறிப்புகள் உள்ளதா எனப் பார்க்கவும் - இங்கே 1 குறிப்பு விடப்பட்டுள்ளது — படிக்க தட்டவும் - இங்கே %d குறிப்புகள் விடப்பட்டுள்ளன — படிக்க தட்டவும் + இணைக்கப்பட்ட பியர்ஸ் + ஜியோஹாஷ் பங்கேற்பாளர்கள் + ஹேண்ட்ஷேக்கிற்கு தயார் + ஹேண்ட்ஷேக் நடைபெறுகிறது + எண்ட்-டு-எண்ட் என்க்ரிப்ட் செய்யப்பட்டது + ஹேண்ட்ஷேக் தோல்வியடைந்தது + 📎 கோப்பு பெறப்பட்டது + 📄 %1$s + 📏 அளவு: %1$s + 🏷️ வகை: %1$s + 📂 திற / சேமி + ❌ மூடு + படத்தைத் தேர்ந்தெடு + தற்போதைய படத்தைச் சேமி + மூடு + படம் பதிவிறக்கங்களில் சேமிக்கப்பட்டது + படத்தைச் சேமிக்க முடியவில்லை + படம் %1$d / %2$d + கோப்பைத் தேர்ந்தெடு + எண்ட்-டு-எண்ட் என்க்ரிப்ஷனுடன் கூடிய பரவலாக்கப்பட்ட மெஷ் செய்தியிடல் + ஆஃப்லைன் மெஷ் அரட்டை + இணையம் அல்லது சர்வர்கள் இல்லாமல் Bluetooth LE வழியாக நேரடியாக தொடர்பு கொள்ளுங்கள். வரம்பை நீட்டிக்க செய்திகள் அருகிலுள்ள சாதனங்கள் வழியாக அனுப்பப்படுகின்றன. + ஆன்லைன் ஜியோஹாஷ் சேனல்கள் + ஜியோஹாஷ் அடிப்படையிலான சேனல்களைப் பயன்படுத்தி உங்கள் பகுதியிலுள்ள மக்களுடன் இணையுங்கள். பொது இணைய ரிலேகளைப் பயன்படுத்தி மெஷை நீட்டிக்கவும். + எண்ட்-டு-எண்ட் என்க்ரிப்ஷன் + தனிப்பட்ட செய்திகள் என்க்ரிப்ட் செய்யப்பட்டவை. சேனல் செய்திகள் பொதுவானவை. + சிஸ்டம் + ஒளி + இருள் + ப்ரூஃப் ஆஃப் வொர்க் + pow ஆஃப் + pow ஆன் + ஸ்பேம் தடுப்புக்காக ஜியோஹாஷ் செய்திகளுக்கு ப்ரூஃப் ஆஃப் வொர்க் சேர்க்கவும். + சிரமம்: %1$d பிட்ஸ் (~%2$s) + சிரமம் %1$d க்கு ~%2$s ஹாஷ் முயற்சிகள் தேவை + ப்ரூஃப் ஆஃப் வொர்க் தேவையில்லை + மிகக் குறைவு - குறைந்தபட்ச ஸ்பேம் பாதுகாப்பு + குறைவு - அடிப்படை ஸ்பேம் பாதுகாப்பு + நடுத்தரம் - நல்ல ஸ்பேம் பாதுகாப்பு + அதிகம் - வலுவான ஸ்பேம் பாதுகாப்பு + மிக அதிகம் - தாமதங்களை ஏற்படுத்தலாம் + தீவிரம் - கணிசமான கணக்கீடு தேவை + நெட்வொர்க் + tor ஆஃப் + tor ஆன் + மேம்பட்ட தனியுரிமைக்காக இணையத்தை Tor வழியாக அனுப்பவும். + tor நிலை: %1$s, பூட்ஸ்ட்ராப் %2$d%% + கடைசி: %1$s + அவசர தரவு நீக்கம் + பிழைதிருத்த அமைப்புகள் + ஓபன் சோர்ஸ் • தனியுரிமை முதலில் • பரவலாக்கப்பட்டது + மூடு + தனியுரிமை பாதுகாக்கப்பட்டது + ரத்து செய் + எச்சரிக்கை + இருப்பிட சேவைகள் + தனியுரிமை + பிழை + பேட்டரி ஆப்டிமைசேஷன் + நன்மைகள் + பேட்டரி ஆப்டிமைசேஷனைச் சரிபார்க்கிறது + பேட்டரி ஆப்டிமைசேஷன் ஆதரிக்கப்படவில்லை + Bluetooth + படிக்காத செய்தி + வரைபடத்தைத் திற + புக்மார்க்கை அகற்று + டெலிபோர்ட் + bitchat ஐ வெளியேறு + பின்னணியில் இயக்கு + ஆப் மூடப்பட்டாலும் மெஷை செயலில் வைத்திரு (முன்னணி சேவை) + சேனலை விட்டு வெளியேறு + Nostr வழியாக அணுகக்கூடியது + ஆஃப்லைன் பிடித்தவை + துல்லியத்தைக் குறை + துல்லியத்தை அதிகரி + ஜியோஹாஷைத் தேர்ந்தெடு + கீழே ஸ்க்ரோல் செய் + கோப்பு + படம் + ரத்து செய் + இணைப்பு + குரல் குறிப்பை பதிவு செய் + மீடியாவைத் தேர்ந்தெடு + ஆஃப்லைன் மெஷ் அரட்டை + ஆன்லைன் ஜியோஹாஷ் சேனல்கள் + எண்ட்-டு-எண்ட் என்க்ரிப்ஷன் + #bluetooth • %1$s + படம் %1$d / %2$d + படம் கிடைக்கவில்லை + படம் பதிவிறக்கங்களில் சேமிக்கப்பட்டது + படத்தைச் சேமிக்க முடியவில்லை + கோப்பைத் தேர்ந்தெடு + [கோப்பு கிடைக்கவில்லை] + தெரியாதது + இந்த செய்தி அல்லது பயனருக்கான செயலைத் தேர்ந்தெடு + இந்த பயனருக்கான செயலைத் தேர்ந்தெடு + செய்தியை நகலெடு + இந்த செய்தியை கிளிப்போர்டுக்கு நகலெடு + %1$s ஐ அறை + ஒரு விளையாட்டான அறை செய்தியை அனுப்பு + %1$s ஐ கட்டியணை + ஒரு நட்பான கட்டியணைப்பு செய்தியை அனுப்பு + %1$s ஐ தடு + இந்த பயனரிடமிருந்து அனைத்து செய்திகளையும் தடு + %1$s க்கு செய்தி அனுப்பு + ஒரு தனிப்பட்ட செய்தியை அனுப்பு + #இருப்பிட சேனல்கள் + ஜியோஹாஷ் சேனல்களைப் பயன்படுத்தி உங்களுக்கு அருகிலுள்ளவர்களுடன் அரட்டையடியுங்கள். ஒரு தோராயமான ஜியோஹாஷ் மட்டுமே பகிரப்படும், துல்லியமான ஜிபிஎஸ் ஒருபோதும் இல்லை. உங்கள் தனியுரிமையைப் பாதுகாக்க இந்த திரையை ஸ்க்ரீன்ஷாட் எடுக்காதீர்கள் அல்லது பகிர வேண்டாம். + இருப்பிட அனுமதி வழங்கு + இருப்பிட அனுமதி மறுக்கப்பட்டது. இருப்பிட சேனல்களைப் பயன்படுத்த அமைப்புகளில் இயக்கவும். + ✓ இருப்பிட அனுமதி வழங்கப்பட்டது + அனுமதிகளைச் சரிபார்க்கிறது… + அருகிலுள்ள சேனல்களைக் கண்டறிகிறது… + புக்மார்க் செய்யப்பட்டது + ஜியோஹாஷ் + தவறான ஜியோஹாஷ் + டெலிபோர்ட் + இருப்பிட சேவைகளை முடக்கு + இருப்பிட சேவைகளை இயக்கு + மெஷ் + பிளாக் + அக்கம் + நகரம் + மாகாணம் + பிராந்தியம் + + #%1$s ± 1 • %2$d குறிப்பு + #%1$s ± 1 • %2$d குறிப்புகள் + + இந்த இருப்பிடத்திற்கு மற்ற பார்வையாளர்கள் காணும்படி குறுகிய நிரந்தர குறிப்புகளைச் சேர்க்கவும். + ஜியோ ரிலேகள் கிடைக்கவில்லை; குறிப்புகள் இடைநிறுத்தப்பட்டன + அருகில் ஜியோ ரிலேகள் இல்லை + குறிப்புகள் ஜியோ ரிலேகளை நம்பியுள்ளன. இணைப்பைச் சரிபார்த்து மீண்டும் முயற்சிக்கவும். + குறிப்புகளை ஏற்றுகிறது… + இதுவரை குறிப்புகள் இல்லை + இந்த இடத்திற்கு முதலில் ஒன்றைச் சேர்க்கவும். + நிராகரி + இந்த இடத்திற்கான குறிப்பைச் சேர்க்கவும் + பிழைதிருத்த கருவிகள் + கண்டறிதல் மற்றும் கட்டுப்பாட்டிற்கான டெவலப்பர் கருவிகள் + விரிவான பதிவு + பியர் சேர்க்கை/வெளியேறுதல், இணைப்பு திசை, பாக்கெட் ரூட்டிங் மற்றும் ரிலேகளை பதிவு செய்கிறது + Bluetooth பாத்திரங்கள் + GATT சர்வர் + இணைப்புகள்: %1$d / %2$d + அதிகபட்ச சர்வர் + GATT கிளையன்ட் + அதிகபட்ச கிளையன்ட் + இணைப்புகள்: %1$d / %2$d + மொத்த அதிகபட்சம் + பாக்கெட் ரிலே + தொடங்கியதிலிருந்து: %1$d + பாத்திரங்களை ஆன்/ஆஃப் செய்து, முடக்கப்படும்போது அனைத்து இணைப்புகளையும் மூடு + ஒத்திசைவு அமைப்புகள் + ஒத்திசைவுக்கு அதிகபட்ச பாக்கெட்டுகள்: %1$d + அதிகபட்ச GCS ஃபில்டர் அளவு: %1$d பைட்டுகள் (128–1024) + இலக்கு FPR: %1$.2f%% + இணைக்கப்பட்ட சாதனங்கள் + எங்கள் சாதன ஐடி: %1$s + எதுவுமில்லை + துண்டி + சமீபத்திய ஸ்கேன் முடிவுகள் + இணை + பிழைதிருத்த கன்சோல் + அழி + கடைசி 10வி: %1$d • 1நி: %2$d • 15நி: %3$d + பெறப்பட்ட P: %1$s • மதிப்பிடப்பட்ட அதிகபட்ச உறுப்புகள்: %2$s + • நேரடி + RSSI: %1$s + ? + சர்வராக (நாங்கள் ஹோஸ்ட் செய்கிறோம்) + கிளையன்டாக (நாங்கள் இணைக்கிறோம்) + இருப்பிட சேவைகள் தேவை + தனியுரிமை முதலில் + bitchat உங்கள் இருப்பிடத்தை கண்காணிக்காது.\n\nBluetooth ஸ்கேனிங் மற்றும் ஜியோஹாஷ் அரட்டை அம்சத்திற்கு இருப்பிட சேவைகள் தேவை. + bitchat க்கு இருப்பிட சேவைகள் தேவைப்படுவது: + • Bluetooth சாதன ஸ்கேனிங்\n• மெஷ் நெட்வொர்க்கில் அருகிலுள்ள பயனர்களைக் கண்டறிதல்\n• ஜியோஹாஷ் அரட்டை அம்சம்\n• கண்காணிப்பு அல்லது இருப்பிட சேகரிப்பு இல்லை + பின்னணி இருப்பிடம் பரிந்துரைக்கப்படுகிறது + விருப்பத்தேர்வு, மெஷ் நம்பகத்தன்மையை மேம்படுத்துகிறது + ஆப் திறக்கப்படாதபோதும் அருகிலுள்ள சாதனங்களை ஸ்கேன் செய்ய bitchat க்கு பின்னணி இருப்பிடத்தை Android பரிந்துரைக்கிறது. இது ரீபூட்டிற்குப் பிறகும் மெஷை உயிருடன் வைத்திருக்கும். + அமைப்புகள் திறக்கும்போது, "எப்போதும் அனுமதிக்கவும்" என்பதைத் தேர்ந்தெடுக்கவும். + bitchat பின்னணி இருப்பிடத்தைப் பயன்படுத்துவது: + - ஆப் மூடப்பட்டிருக்கும்போது அருகிலுள்ள சாதனங்களை ஸ்கேன் செய்ய\n- ரீபூட்டிற்குப் பிறகு மீண்டும் இணைக்க\n- மெஷை பின்னணியில் இயங்க வைக்க + உங்கள் இருப்பிடத்தை நாங்கள் ஒருபோதும் சேகரிக்கவோ சேமிக்கவோ மாட்டோம். உங்கள் தனியுரிமை பாதுகாப்பானது. + பின்னணி இருப்பிடத்தை அனுமதி + பின்னணி இருப்பிடம் இல்லாமல் தொடரவும் + இருப்பிட அமைப்புகளைத் திற + மீண்டும் சரிபார்க்கவும் + இருப்பிட சேவைகள் கிடைக்கவில்லை + இந்த சாதனத்தில் இருப்பிட சேவைகள் கிடைக்கவில்லை. Android சாதனங்களில் இருப்பிட சேவைகள் இயல்பாக இருப்பதால் இது அசாதாரணமானது.\n\nBluetooth ஸ்கேனிங் சரியாக செயல்பட bitchat க்கு இருப்பிட சேவைகள் தேவை (Android தேவை). இது இல்லாமல், அருகிலுள்ள பயனர்களை ஆப் கண்டறிய முடியாது. + இருப்பிட சேவைகளைச் சரிபார்க்கிறது… + Bluetooth தேவை + bitchat க்கு Bluetooth தேவைப்படுவது: + • அருகிலுள்ள பயனர்களைக் கண்டறிய\n• மெஷ் நெட்வொர்க் இணைப்புகளை உருவாக்க\n• செய்திகளை அனுப்ப மற்றும் பெற\n• இணையம் அல்லது சர்வர்கள் இல்லாமல் செயல்பட + Bluetooth ஐ இயக்கு + Bluetooth ஆதரிக்கப்படவில்லை + bitchat செயல்பட தேவையான Bluetooth Low Energy (BLE) ஐ இந்த சாதனம் ஆதரிக்காது.\n\nஇணையம் இல்லாமல் மெஷ் நெட்வொர்க்குகளை உருவாக்கவும் அருகிலுள்ள சாதனங்களுடன் தொடர்பு கொள்ளவும் bitchat க்கு BLE தேவை. + Bluetooth நிலையைச் சரிபார்க்கிறது… + பேட்டரி ஆப்டிமைசேஷன் கண்டறியப்பட்டது + பேட்டரி ஆப்டிமைசேஷன் இயக்கப்பட்டது + மெஷ் இணைப்புகளைப் பராமரிக்க bitchat பின்னணியில் இயங்க வேண்டும். பேட்டரி ஆப்டிமைசேஷன் இந்த இணைப்புகளை தடுக்கலாம். + முடக்குவதன் நன்மைகள் + • நம்பகமான செய்தி வழங்கல்\n• மெஷ் இணைப்பைப் பராமரிக்கிறது\n• இணைப்பு துண்டிப்புகளைத் தடுக்கிறது + பேட்டரி ஆப்டிமைசேஷனை முடக்கு + பேட்டரி ஆப்டிமைசேஷன் முடக்கப்பட்டது + தொடரவும் + மெஷ் நெட்வொர்க்கைத் தொடங்குகிறது + . + Bluetooth மெஷ் நெட்வொர்க்கிங்கை அமைக்கிறது… + இதற்கு சில வினாடிகள் மட்டுமே ஆகும் + ⚠️ + அமைப்பு முடிக்கப்படவில்லை + மீண்டும் முயற்சி + அமைப்புகளைத் திற + உங்கள் தனியுரிமை பாதுகாக்கப்படுகிறது + • கண்காணிப்பு அல்லது தரவு சேகரிப்பு இல்லை\n• Bluetooth மெஷ் அரட்டைகள் முழுவதுமாக ஆஃப்லைனில் உள்ளன\n• ஜியோஹாஷ் அரட்டைகள் இணையத்தைப் பயன்படுத்துகின்றன + அனுமதிகள் + அனுமதிகளை வழங்கு + bitchat உங்கள் இருப்பிடத்தை கண்காணிக்காது + @ + · ⧉ + யாரும் அருகில் இல்லை… + (நீங்கள்) + ஜியோஹாஷைத் தேர்ந்தெடுக்க பான் செய்து ஜூம் செய்யவும் + தேர்ந்தெடு + செய்தியை உள்ளிடவும்… + @%1$s + குறிப்பிடு + %1$d / %2$d + @%1$s + v%1$s + # + _ + [%1$s] %2$d%% + + + image/* + படம் + கோப்பு + + + + ✓✓ + + + 📷 ஒரு படத்தை அனுப்பியது + 🎤 ஒரு குரல் செய்தியை அனுப்பியது + 📎 ஒரு கோப்பை அனுப்பியது + 📄 + 🗜️ + 📄 + 📊 + 📈 + 📎 + இயக்கு + இடைநிறுத்து + Bluetooth வழியாக bitchat பயனர்களைக் கண்டறிய தேவை + அருகிலுள்ள சாதனங்களுடன் இணைக்க bitchat ஐ அனுமதிக்கவும் + Bluetooth வழியாக அருகிலுள்ள bitchat பயனர்களைக் கண்டறிய Android இதை கட்டாயப்படுத்துகிறது + அருகிலுள்ள சாதனங்களை ஸ்கேன் செய்ய bitchat க்கு இது தேவை + ஆப் பின்னணியில் இருக்கும்போது அருகிலுள்ள சாதனங்களை ஸ்கேன் செய்ய பரிந்துரைக்கப்படுகிறது + பின்னணி இருப்பிட அணுகலை அனுமதிக்கவும் + நீங்கள் தனிப்பட்ட செய்திகளைப் பெறும்போது அறிவிப்புகளைப் பெறுங்கள் + உங்களுக்கு அறிவிப்புகளை அனுப்ப bitchat ஐ அனுமதிக்கவும் + bitchat பின்னணியில் நம்பகமாக இயங்கவும் மெஷ் நெட்வொர்க் இணைப்புகளைப் பராமரிக்கவும் பேட்டரி ஆப்டிமைசேஷனை முடக்கவும் + பேட்டரி கட்டுப்பாடுகள் இல்லாமல் இயங்க bitchat ஐ அனுமதிக்கவும் + அருகிலுள்ள சாதனங்கள் + துல்லியமான இருப்பிடம் + பின்னணி இருப்பிடம் + மைக்ரோஃபோன் + அறிவிப்புகள் + பேட்டரி ஆப்டிமைசேஷன் + மற்றவை + சேனல் கடவுச்சொல்லை உள்ளிடவும் + %1$s சேனல் கடவுச்சொல் பாதுகாக்கப்பட்டுள்ளது. சேர கடவுச்சொல்லை உள்ளிடவும். + கடவுச்சொல் + சேர் + ரத்து செய் + இந்த பதிப்பில் Tor கிடைக்கவில்லை + மொழி + பயன்பாட்டு மொழி + கணினி இயல்புநிலை + மொழியைத் தேர்ந்தெடுக்கவும் diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 4f9ca27f..9db333b3 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -46,7 +46,7 @@ และอีก %1$d ข้อความ %1$d จาก %2$d คน และการสนทนาอีก %1$d รายการ - 👥 มีผู้ใช้ใกล้คุณ! + มีผู้ใช้ใกล้คุณ! มี 1 คนใกล้คุณ มี %1$d คนใกล้คุณ ข้อความใหม่ @@ -377,4 +377,8 @@ ดูว่ามีโน้ตทิ้งไว้ที่นี่หรือไม่ มี 1 โน้ตทิ้งไว้ที่นี่ — แตะเพื่ออ่าน มี %d โน้ตทิ้งไว้ที่นี่ — แตะเพื่ออ่าน + ภาษา + ภาษาของแอป + ค่าเริ่มต้นของระบบ + เลือกภาษา diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 9f62643e..98e99c02 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -40,7 +40,7 @@ ve %1$d daha %2$d kişiden %1$d mesaj ve %1$d sohbet daha - 👥 yakında bitchatter’lar! + yakında bitchatter’lar! Yakında 1 kişi Yakında %1$d kişi Yeni mesajlar @@ -382,4 +382,8 @@ buraya bırakılan notlara bak buraya 1 not bırakıldı — okumak için dokun buraya %d not bırakıldı — okumak için dokun + Dil + Uygulama dili + Sistem varsayılanı + Dil seçin diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index ccc5dfed..d39b00fb 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -1,48 +1,410 @@ - + Пропустити Рекомендується Bluetooth Mesh працює — %1$d пірів - verify - scan to verify me - scan someone elses qr - scan someone elses qr - show my qr - remove verification - qr unavailable - camera permission is needed to scan qr codes - enable camera - paste verification url - validate - verification requested - security verification - their fingerprint - your fingerprint - handshake pending - open a private chat to view fingerprints - encrypted & verified - encrypted - handshaking - handshake failed - not encrypted - verified - you have verified this persons identity. - not verified - compare these fingerprints with %1$s using a secure channel. - mark as verified - start handshake - copy - Mutual verification - You and %1$s verified each other - mutual verification with %1$s - Verified - You verified %1$s - verified %1$s - Відкрити розділ «Про застосунок» - Відкрити налаштування розташування та каналів - перевірити, чи залишено тут нотатки - тут залишено 1 нотатку — торкніться, щоб прочитати - тут залишено %d нотаток — торкніться, щоб прочитати + перевірити + скануйте, щоб підтвердити мене + скануйте QR-код іншої особи + скануйте QR-код іншої особи + показати мій QR-код + видалити підтвердження + QR-код недоступний + потрібен дозвіл на камеру для сканування QR-кодів + увімкнути камеру + вставити посилання для підтвердження + підтвердити + запит на підтвердження надіслано + перевірка безпеки + їхній відбиток + ваш відбиток + очікування рукостискання + відкрийте приватний чат, щоб переглянути відбитки + зашифровано і підтверджено + зашифровано + рукостискання + рукостискання не вдалося + не зашифровано + підтверджено + ви підтвердили особу цієї людини. + не підтверджено + порівняйте ці відбитки з %1$s, використовуючи безпечний канал. + позначити як підтверджено + почати рукостискання + копіювати + Взаємне підтвердження + Ви та %1$s підтвердили одне одного + взаємне підтвердження з %1$s + Підтверджено + Ви підтвердили %1$s + підтверджено %1$s + + + bitchat + Дозвіл на використання Bluetooth потрібен для обміну повідомленнями напряму, без інтернету. + Дозвіл на геолокацію потрібен для виявлення пристроїв поруч через Bluetooth. + Дозвіл на сповіщення потрібен, щоб повідомляти вас про нові повідомлення. + нікнейм + введіть повідомлення… + Пароль + Приєднатися до каналу + Вийти + Надіслати + Показати команди + Назад + Люди + Канали + Користувачі онлайн + Немає підключених + Потрійний дотик, щоб очистити всі дані + Мережа + Виявлено оптимізацію батареї + Оптимізацію батареї вимкнено + Оптимізація батареї не потрібна + Перевірка оптимізації батареї + Навіщо вимикати оптимізацію батареї? + bitchat працює у фоновому режимі, щоб підтримувати з’єднання mesh-мережі з пристроями поруч. Оптимізація батареї може переривати ці з’єднання, через що повідомлення затримуються або губляться.\n\nВимкнення оптимізації батареї забезпечує надійний обмін повідомленнями напряму. + Вимкнути оптимізацію батареї + Примітка: ви можете змінити це налаштування пізніше в Налаштуваннях Android > Додатки > bitchat > Батарея + Ваш пристрій не потребує налаштувань оптимізації батареї. bitchat працюватиме у звичайному режимі. + Ваш пристрій не потребує налаштувань оптимізації батареї. bitchat працюватиме у звичайному режимі. + bitchat може надійно працювати у фоновому режимі + • Забезпечує надійну доставку повідомлень\n• Підтримує зв’язок у mesh-мережі\n• Дозволяє передавати повідомлення у фоні\n• Запобігає розривам з’єднання + Перевірити знову + Пропустити зараз + Продовжити + Повторити + і ще %1$d + %1$d повідомлень від %2$d людей + і ще %1$d розмов + 👥 bitchat-користувачі поруч! + 1 людина поруч + %1$d людей поруч + Нові повідомлення + Нові повідомлення в геолокації + Згадка в %1$s + Згадка в %1$s (+%2$d ще) + %1$d згадок у %2$s + Нова активність у %1$s + Повідомлення в %1$s + %1$s приєднався(-лася) до розмови + bitchat - %1$d згадок + bitchat - геочати + %1$d повідомлень з %2$d місць + Згадка в Mesh-чаті + %1$d згадок у Mesh-чаті + і ще %1$d місць + Фонова служба Mesh + Підтримує роботу Bluetooth mesh-мережі у фоновому режимі + Додати в обране + Прибрати з обраного + Додати закладку + Доступний через Nostr + Непрочитані приватні повідомлення + Нотатки про місце + Телепортовано + Статус Tor + Відкрити налаштування розташування та каналів + Підключені піри + Учасники геохешу + Готовий до рукостискання + Рукостискання триває + Наскрізне шифрування + Рукостискання не вдалося + 📎 Файл отримано + 📄 %1$s + 📏 Розмір: %1$s + 🏷️ Тип: %1$s + 📂 Відкрити / Зберегти + ❌ Закрити + Вибрати зображення + Зберегти поточне зображення + Закрити + Зображення збережено в Завантаження + Не вдалося зберегти зображення + Зображення %1$d з %2$d + Вибрати файл + децентралізований mesh-обмін повідомленнями з наскрізним шифруванням + Офлайн Mesh-чат + Спілкуйтеся напряму через Bluetooth LE без інтернету чи серверів. Повідомлення передаються через пристрої поруч, щоб розширити радіус дії. + Онлайн-канали за геохешем + Спілкуйтеся з людьми у вашому районі за допомогою каналів на основі геохешу. Розширюйте mesh-мережу за допомогою публічних інтернет-ретрансляторів. + Наскрізне шифрування + Приватні повідомлення шифруються. Повідомлення в каналах є публічними. + системний + світлий + темний + підтвердження роботи + pow вимкнено + pow увімкнено + додає підтвердження роботи до повідомлень геохешу для захисту від спаму. + складність: %1$d бітів (~%2$s) + складність %1$d вимагає ~%2$s спроб хешування + підтвердження роботи не потрібне + дуже низька - мінімальний захист від спаму + низька - базовий захист від спаму + середня - хороший захист від спаму + висока - надійний захист від спаму + дуже висока - можливі затримки + екстремальна - потрібні значні обчислення + мережа + tor вимкнено + tor увімкнено + маршрутизувати інтернет через tor для посиленої приватності. + статус tor: %1$s, завантаження %2$d%% + Востаннє: %1$s + Екстрене видалення даних + Налаштування для розробників + Відкритий код • Приватність понад усе • Децентралізовано + Закрити + Приватність захищено + скасувати + Попередження + Служби геолокації + Приватність + Помилка + Оптимізація батареї + Переваги + Перевірка оптимізації батареї + Оптимізація батареї не підтримується + Bluetooth + Непрочитане повідомлення + Відкрити карту + Прибрати закладку + Телепортуватися + Закрити bitchat + працювати у фоновому режимі + підтримувати mesh активним, коли додаток закрито (фонова служба) + Вийти з каналу + Доступний через Nostr + Офлайн обране + Зменшити точність + Збільшити точність + Вибрати геохеш + Прогорнути донизу + Файл + Зображення + Скасувати + Посилання + Записати голосове повідомлення + Вибрати медіа + Офлайн Mesh-чат + Онлайн-канали за геохешем + Наскрізне шифрування + #bluetooth • %1$s + Зображення %1$d з %2$d + Зображення недоступне + Зображення збережено в Завантаження + Не вдалося зберегти зображення + Вибрати файл + [файл недоступний] + невідомо + виберіть дію для цього повідомлення або користувача + виберіть дію для цього користувача + скопіювати повідомлення + скопіювати це повідомлення в буфер обміну + ляснути %1$s + надіслати жартівливе повідомлення про ляпас + обійняти %1$s + надіслати дружнє повідомлення з обіймами + заблокувати %1$s + заблокувати всі повідомлення від цього користувача + написати %1$s + надіслати приватне повідомлення + #канали за геолокацією + спілкуйтеся з людьми поруч, використовуючи канали за геохешем. надається лише приблизний геохеш, ніколи точні gps-координати. не робіть скріншотів і не діліться цим екраном, щоб захистити свою приватність. + надати дозвіл на геолокацію + у дозволі на геолокацію відмовлено. увімкніть його в налаштуваннях, щоб користуватися каналами за геолокацією. + ✓ дозвіл на геолокацію надано + перевірка дозволів... + пошук каналів поруч… + додано в закладки + геохеш + недійсний геохеш + телепорт + вимкнути служби геолокації + увімкнути служби геолокації + mesh + квартал + район + місто + область + регіон + додайте короткі постійні нотатки до цього місця, щоб їх могли знайти інші відвідувачі. + гео-ретранслятори недоступні; нотатки призупинено + поруч немає гео-ретрансляторів + нотатки залежать від гео-ретрансляторів. перевірте з’єднання і спробуйте ще раз. + завантаження нотаток… + поки що немає нотаток + будьте першим, хто додасть нотатку для цього місця. + закрити + додати нотатку для цього місця + інструменти розробника + утиліти розробника для діагностики та контролю + детальне логування + логує приєднання/вихід пірів, напрямок з’єднання, маршрутизацію та ретрансляцію пакетів + ролі bluetooth + gatt-сервер + з’єднання: %1$d / %2$d + макс. сервер + gatt-клієнт + макс. клієнт + з’єднання: %1$d / %2$d + макс. загалом + ретрансляція пакетів + з початку: %1$d + вмикайте/вимикайте ролі та закривайте всі з’єднання, коли вимкнено + налаштування синхронізації + макс. пакетів на синхронізацію: %1$d + макс. розмір GCS-фільтра: %1$d байт (128–1024) + цільовий FPR: %1$.2f%% + підключені пристрої + id нашого пристрою: %1$s + немає + від’єднати + останні результати сканування + підключити + консоль налагодження + очистити + останні 10с: %1$d • 1хв: %2$d • 15хв: %3$d + обчислене P: %1$s • оцінка макс. елементів: %2$s + • напряму + RSSI: %1$s + ? + як сервер (ми хостимо) + як клієнт (ми підключаємось) + Потрібні служби геолокації + Приватність понад усе + bitchat НЕ відстежує вашу локацію.\n\nСлужби геолокації потрібні для сканування Bluetooth та для функції геочатів. + bitchat потребує служб геолокації для: + • Сканування пристроїв Bluetooth\n• Виявлення користувачів поруч у mesh-мережі\n• Функції геочатів\n• Без відстеження чи збору геоданих + Рекомендовано фонову геолокацію + необов’язково, покращує надійність mesh-мережі + Android рекомендує фонову геолокацію, щоб bitchat міг сканувати пристрої поруч, коли додаток не відкрито. Це підтримує mesh-мережу активною після перезавантаження. + Коли відкриються налаштування, виберіть «Дозволити завжди». + bitchat використовує фонову геолокацію для: + - сканування пристроїв поруч, коли додаток закрито\n- повторного підключення після перезавантаження\n- підтримки роботи mesh-мережі у фоновому режимі + Ми НІКОЛИ не збираємо і не зберігаємо вашу локацію. Ваша приватність у безпеці. + Дозволити фонову геолокацію + Продовжити без фонової геолокації + Відкрити налаштування геолокації + Перевірити знову + Служби геолокації недоступні + Служби геолокації недоступні на цьому пристрої. Це незвично, оскільки служби геолокації є стандартними для пристроїв Android.\n\nbitchat потребує служб геолокації для коректної роботи сканування Bluetooth (вимога Android). Без цього додаток не може виявляти користувачів поруч. + Перевірка служб геолокації... + Потрібен Bluetooth + bitchat потребує Bluetooth для: + • Виявлення користувачів поруч\n• Створення з’єднань mesh-мережі\n• Надсилання й отримання повідомлень\n• Роботи без інтернету чи серверів + Увімкнути Bluetooth + Bluetooth не підтримується + Цей пристрій не підтримує Bluetooth Low Energy (BLE), який потрібен для роботи bitchat.\n\nbitchat потребує BLE для створення mesh-мереж і зв’язку з пристроями поруч без інтернету. + Перевірка статусу Bluetooth... + виявлено оптимізацію батареї + Оптимізацію батареї увімкнено + bitchat потрібно працювати у фоновому режимі, щоб підтримувати mesh-з’єднання. оптимізація батареї може переривати ці з’єднання. + Переваги вимкнення + • надійна доставка повідомлень\n• підтримка зв’язку в mesh-мережі\n• запобігання розривам з’єднання + Вимкнути оптимізацію батареї + оптимізацію батареї вимкнено + Продовжити + Ініціалізація mesh-мережі + . + Налаштування Bluetooth mesh-мережі... + Це має зайняти лише кілька секунд + ⚠️ + Налаштування не завершено + Спробувати знову + Відкрити налаштування + Вашу приватність захищено + • без відстеження чи збору даних\n• Bluetooth mesh-чати повністю офлайн\n• Геочати використовують інтернет + дозволи + Надати дозволи + bitchat НЕ відстежує вашу локацію + @ + · ⧉ + нікого немає поруч... + (ви) + панорамуйте та масштабуйте, щоб вибрати геохеш + вибрати + введіть повідомлення... + @%1$s + згадка + %1$d / %2$d + @%1$s + v%1$s + # + _ + [%1$s] %2$d%% + + + image/* + Зображення + Файл + + + + ✓✓ + + + 📷 надіслав(-ла) зображення + 🎤 надіслав(-ла) голосове повідомлення + 📎 надіслав(-ла) файл + 📄 + 🗜️ + 📄 + 📊 + 📈 + 📎 + Відтворити + Пауза + Потрібно для виявлення користувачів bitchat через Bluetooth + Дозволити bitchat підключатися до пристроїв поруч + Потрібно Android для виявлення користувачів bitchat поруч через Bluetooth + bitchat потребує цього для сканування пристроїв поруч + Рекомендовано для сканування пристроїв поруч, коли додаток у фоновому режимі + Дозволити доступ до фонової геолокації + Отримуйте сповіщення, коли надходять приватні повідомлення + Дозволити bitchat надсилати вам сповіщення + Вимкніть оптимізацію батареї, щоб bitchat надійно працював у фоновому режимі та підтримував з’єднання mesh-мережі + Дозволити bitchat працювати без обмежень батареї + Пристрої поруч + Точна геолокація + Фонова геолокація + Мікрофон + Сповіщення + Оптимізація батареї + Інше + Введіть пароль каналу + Канал %1$s захищений паролем. Введіть пароль, щоб приєднатися. + Пароль + Приєднатися + Скасувати + Tor недоступний у цій збірці + + + #%1$s ± 1 • %2$d нотатка + #%1$s ± 1 • %2$d нотатки + #%1$s ± 1 • %2$d нотаток + #%1$s ± 1 • %2$d нотатки + + + + і ще %1$d + і ще %1$d + і ще %1$d + і ще %1$d + + + + %1$d людина + %1$d людини + %1$d людей + %1$d людини + + Мова + Мова застосунку + Системна мова + Вибрати мову diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml index 813b96a7..f2364483 100644 --- a/app/src/main/res/values-ur/strings.xml +++ b/app/src/main/res/values-ur/strings.xml @@ -46,7 +46,7 @@ اور %1$d مزید %2$d لوگوں سے %1$d پیغامات اور %1$d مزید گفتگو - 👥 قریب میں bitchatter! + قریب میں bitchatter! قریب میں 1 شخص قریب میں %1$d لوگ نئے پیغامات @@ -390,4 +390,8 @@ دیکھیں کہ یہاں نوٹ چھوڑے گئے ہیں یا نہیں یہاں 1 نوٹ چھوڑا گیا ہے — پڑھنے کے لیے تھپتھپائیں یہاں %d نوٹ چھوڑے گئے ہیں — پڑھنے کے لیے تھپتھپائیں + زبان + ایپ کی زبان + سسٹم ڈیفالٹ + زبان منتخب کریں diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 70015c8a..fda4b40a 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -46,7 +46,7 @@ và %1$d khác %1$d tin nhắn từ %2$d người và %1$d cuộc trò chuyện khác - 👥 bitchatter gần đó! + bitchatter gần đó! 1 người gần đó %1$d người gần đó Tin nhắn mới @@ -377,4 +377,8 @@ kiểm tra ghi chú để lại ở đây có 1 ghi chú để lại ở đây — chạm để đọc có %d ghi chú để lại ở đây — chạm để đọc + Ngôn ngữ + Ngôn ngữ ứng dụng + Mặc định hệ thống + Chọn ngôn ngữ diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 438131b0..a639dd00 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,6 +1,7 @@ + #%1$s ± 1 • %2$d 条笔记 #%1$s ± 1 • %2$d 条笔记 @@ -53,7 +54,345 @@ 已验证 你已验证 %1$s 已验证 %1$s - 查看这里留下的留言 - 这里留有 1 条留言 — 点按阅读 - 这里留有 %d 条留言 — 点按阅读 + + bitchat + 需要蓝牙权限才能在无网络的情况下进行点对点消息传输。 + 需要位置权限才能通过蓝牙发现附近的设备。 + 需要通知权限才能提醒你收到新消息。 + 昵称 + 输入消息… + 密码 + 加入频道 + 离开 + 发送 + 显示命令 + 返回 + 人员 + 频道 + 在线用户 + 暂无人连接 + 连续三次轻触可清除所有数据 + 网络 + 检测到电池优化 + 电池优化已关闭 + 无需电池优化设置 + 正在检查电池优化设置 + 为什么要关闭电池优化? + bitchat 需要在后台运行,以保持与附近设备的 Mesh 网络连接。电池优化可能会中断这些连接,导致消息延迟或丢失。\n\n关闭电池优化可确保点对点消息传输的可靠性。 + 关闭电池优化 + 提示:你可以稍后在 Android 设置 > 应用 > bitchat > 电池 中更改此设置 + 你的设备不需要电池优化设置。bitchat 将正常运行。 + 你的设备不需要电池优化设置。bitchat 将正常运行。 + bitchat 现在可以在后台稳定运行 + • 确保消息可靠送达\n• 保持 Mesh 网络连接\n• 支持后台消息中继\n• 防止连接中断 + 再次检查 + 暂时跳过 + 继续 + 重试 + 还有 %1$d 条 + 来自 %2$d 人的 %1$d 条消息 + 还有 %1$d 个对话 + 👥 附近有 bitchat 用户! + 附近有 1 人 + 附近有 %1$d 人 + 新消息 + 新的位置消息 + 在 %1$s 中被提及 + 在 %1$s 中被提及(还有 %2$d 条) + 在 %2$s 中被提及 %1$d 次 + %1$s 中有新动态 + %1$s 中的消息 + %1$s 加入了对话 + bitchat - %1$d 条提及 + bitchat - 位置聊天 + 来自 %2$d 个地点的 %1$d 条消息 + 在 Mesh 聊天中被提及 + 在 Mesh 聊天中被提及 %1$d 次 + 还有 %1$d 个地点 + + 还有 %1$d 条 + + Mesh 后台服务 + 使蓝牙 Mesh 网络在后台持续运行 + 添加到收藏 + 从收藏中移除 + 添加书签 + 可通过 Nostr 联系 + 未读私信 + 位置笔记 + 已传送 + Tor 状态 + 已连接的节点 + Geohash 参与者 + 准备握手 + 握手进行中 + 端到端加密 + 握手失败 + 📎 已接收文件 + 📄 %1$s + 📏 大小:%1$s + 🏷️ 类型:%1$s + 📂 打开/保存 + ❌ 关闭 + 选择图片 + 保存当前图片 + 关闭 + 图片已保存到下载文件夹 + 图片保存失败 + 第 %1$d 张,共 %2$d 张图片 + 选择文件 + 具备端到端加密的去中心化 Mesh 消息应用 + 离线 Mesh 聊天 + 无需互联网或服务器,直接通过蓝牙 LE 通信。消息会通过附近的设备中继以扩大覆盖范围。 + 在线 Geohash 频道 + 使用基于 Geohash 的频道与你所在地区的人联系。通过公共互联网中继扩展 Mesh 网络。 + 端到端加密 + 私信是加密的。频道消息是公开的。 + 跟随系统 + 浅色 + 深色 + 工作量证明 + 工作量证明已关闭 + 工作量证明已开启 + 为 Geohash 消息添加工作量证明以遏制垃圾信息。 + 难度:%1$d 位(约 %2$s) + 难度 %1$d 需要约 %2$s 次哈希尝试 + 无需工作量证明 + 极低 - 最基础的垃圾信息防护 + 低 - 基础的垃圾信息防护 + 中 - 较好的垃圾信息防护 + 高 - 强力的垃圾信息防护 + 极高 - 可能导致延迟 + 极限 - 需要大量计算 + 网络 + Tor 已关闭 + Tor 已开启 + 通过 Tor 转发网络流量以增强隐私保护。 + Tor 状态:%1$s,引导进度 %2$d%% + 最近一次:%1$s + 紧急数据删除 + 调试设置 + 开源 • 隐私优先 • 去中心化 + 关闭 + 隐私已受保护 + 取消 + 警告 + 位置服务 + 隐私 + 错误 + 电池优化 + 优势 + 正在检查电池优化设置 + 不支持电池优化设置 + 蓝牙 + 未读消息 + 打开地图 + 移除书签 + 传送 + 退出 bitchat + 后台运行 + 应用关闭时保持 Mesh 处于活动状态(前台服务) + 离开频道 + 可通过 Nostr 联系 + 离线收藏 + 降低精度 + 提高精度 + 选择 Geohash + 滚动到底部 + 文件 + 图片 + 取消 + 链接 + 录制语音消息 + 选择媒体 + 离线 Mesh 聊天 + 在线 Geohash 频道 + 端到端加密 + #bluetooth • %1$s + 第 %1$d 张,共 %2$d 张图片 + 图片不可用 + 图片已保存到下载文件夹 + 图片保存失败 + 选择文件 + [文件不可用] + 未知 + 为此消息或用户选择一个操作 + 为此用户选择一个操作 + 复制消息 + 将此消息复制到剪贴板 + 拍打 %1$s + 发送一条俏皮的拍打消息 + 拥抱 %1$s + 发送一条友好的拥抱消息 + 屏蔽 %1$s + 屏蔽此用户的所有消息 + 私信 %1$s + 发送一条私信 + #位置频道 + 使用 Geohash 频道与你附近的人聊天。仅分享粗略的 Geohash,绝不分享精确的 GPS 位置。请勿截图或分享此屏幕,以保护你的隐私。 + 授予位置权限 + 位置权限已被拒绝。请在设置中启用以使用位置频道。 + ✓ 位置权限已授予 + 正在检查权限… + 正在查找附近的频道… + 已加书签 + geohash + 无效的 geohash + 传送 + 关闭位置服务 + 开启位置服务 + mesh + 街区 + 社区 + 城市 + 省份 + 地区 + 调试工具 + 用于诊断和控制的开发者工具 + 详细日志 + 记录节点加入/离开、连接方向、数据包路由与中继情况 + 蓝牙角色 + GATT 服务端 + 连接数:%1$d / %2$d + 最大服务端数 + GATT 客户端 + 最大客户端数 + 连接数:%1$d / %2$d + 最大总连接数 + 数据包中继 + 启动以来:%1$d + 开启/关闭角色,禁用时将关闭所有连接 + 同步设置 + 每次同步最大数据包数:%1$d + 最大 GCS 过滤器大小:%1$d 字节(128–1024) + 目标 FPR:%1$.2f%% + 已连接设备 + 本机设备 ID:%1$s + + 断开连接 + 最近的扫描结果 + 连接 + 调试控制台 + 清除 + 最近 10 秒:%1$d • 1 分钟:%2$d • 15 分钟:%3$d + 推导 P:%1$s • 预估最大元素数:%2$s + • 直连 + RSSI:%1$s + ? + 作为服务端(我方托管) + 作为客户端(我方连接) + 需要位置服务 + 隐私优先 + bitchat 不会追踪你的位置。\n\n蓝牙扫描以及 Geohash 聊天功能需要位置服务的支持。 + bitchat 需要位置服务以实现: + • 蓝牙设备扫描\n• 发现 Mesh 网络上的附近用户\n• Geohash 聊天功能\n• 不进行任何追踪或位置收集 + 建议开启后台位置 + 可选,可提升 Mesh 可靠性 + Android 建议开启后台位置权限,以便 bitchat 在应用未打开时也能扫描附近设备。这能让 Mesh 网络在重启后保持活跃。 + 设置页面打开后,请选择"始终允许"。 + bitchat 使用后台位置以实现: + - 应用关闭时扫描附近设备\n- 重启后重新连接\n- 使 Mesh 网络在后台持续运行 + 我们绝不会收集或存储你的位置信息。你的隐私是安全的。 + 允许后台位置访问 + 不开启后台位置,继续使用 + 打开位置设置 + 再次检查 + 位置服务不可用 + 此设备上的位置服务不可用。这种情况并不常见,因为位置服务通常是 Android 设备的标准功能。\n\nbitchat 需要位置服务才能正常使用蓝牙扫描(这是 Android 的要求)。缺少此权限,应用将无法发现附近的用户。 + 正在检查位置服务… + 需要蓝牙 + bitchat 需要蓝牙以实现: + • 发现附近的用户\n• 建立 Mesh 网络连接\n• 发送和接收消息\n• 在无网络或服务器的情况下工作 + 开启蓝牙 + 不支持蓝牙 + 此设备不支持 bitchat 所需的低功耗蓝牙(BLE)。\n\nbitchat 需要 BLE 来创建 Mesh 网络并在无网络的情况下与附近的设备通信。 + 正在检查蓝牙状态… + 检测到电池优化 + 电池优化已启用 + bitchat 需要在后台运行以维持 Mesh 连接。电池优化可能会中断这些连接。 + 关闭后的好处 + • 消息可靠送达\n• 保持 Mesh 网络连接\n• 防止连接中断 + 关闭电池优化 + 电池优化已关闭 + 继续 + 正在初始化 Mesh 网络 + + 正在设置蓝牙 Mesh 网络… + 这只需要几秒钟 + ⚠️ + 设置未完成 + 重试 + 打开设置 + 你的隐私已受保护 + • 不进行任何追踪或数据收集\n• 蓝牙 Mesh 聊天完全离线\n• Geohash 聊天使用互联网 + 权限 + 授予权限 + bitchat 不会追踪你的位置 + @ + · ⧉ + 附近没有人… + (你) + 拖动并缩放以选择一个 geohash + 选择 + 输入消息… + @%1$s + 提及 + %1$d / %2$d + @%1$s + v%1$s + # + _ + [%1$s] %2$d%% + + + image/* + 图片 + 文件 + + + + ✓✓ + + + 📷 发送了一张图片 + 🎤 发送了一条语音消息 + 📎 发送了一个文件 + 📄 + 🗜️ + 📄 + 📊 + 📈 + 📎 + 播放 + 暂停 + 需要此权限才能通过蓝牙发现 bitchat 用户 + 允许 bitchat 连接附近的设备 + Android 要求此权限以通过蓝牙发现附近的 bitchat 用户 + bitchat 需要此权限以扫描附近的设备 + 建议开启,以便在应用处于后台时扫描附近的设备 + 允许后台位置访问 + 在你收到私信时接收通知 + 允许 bitchat 向你发送通知 + 关闭电池优化以确保 bitchat 在后台稳定运行并保持 Mesh 网络连接 + 允许 bitchat 在不受电池限制的情况下运行 + 附近的设备 + 精确位置 + 后台位置 + 麦克风 + 通知 + 电池优化 + 其他 + 输入频道密码 + 频道 %1$s 受密码保护。请输入密码以加入。 + 密码 + 加入 + 取消 + 此版本不支持 Tor + + %1$d 人 + + 语言 + 应用语言 + 跟随系统 + 选择语言 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 328696a0..70fc5986 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1,6 +1,7 @@ + #%1$s ± 1 • %2$d 則筆記 #%1$s ± 1 • %2$d 則筆記 @@ -18,42 +19,381 @@ 建議開啟藍牙 Mesh 運行中 — %1$d 個節點 - 验证 - 扫描以验证我 - 扫描他人的QR码 - 扫描他人的QR码 - 显示我的QR码 - 移除验证 - QR码不可用 - 需要相机权限扫描QR码 - 启用相机 - 粘贴验证链接 - 验证 - 已请求验证 - 安全验证 - 对方指纹 - 你的指纹 + 驗證 + 掃描以驗證我 + 掃描他人的QR碼 + 掃描他人的QR碼 + 顯示我的QR碼 + 移除驗證 + QR碼不可用 + 需要相機權限掃描QR碼 + 啟用相機 + 貼上驗證連結 + 驗證 + 已請求驗證 + 安全驗證 + 對方指紋 + 你的指紋 握手中 - 打开私聊查看指纹 - 已加密且已验证 + 打開私聊查看指紋 + 已加密且已驗證 已加密 握手中 - 握手失败 + 握手失敗 未加密 - 已验证 - 你已验证此人身份。 - 未验证 - 请通过安全渠道与 %1$s 比对指纹。 - 标记为已验证 - 开始握手 - 复制 - 相互验证 - 你和 %1$s 已相互验证 - 与 %1$s 相互验证 - 已验证 - 你已验证 %1$s - 已验证 %1$s - 查看這裡留下的留言 - 這裡留有 1 則留言 — 點按閱讀 - 這裡留有 %d 則留言 — 點按閱讀 + 已驗證 + 你已驗證此人身份。 + 未驗證 + 請通過安全渠道與 %1$s 比對指紋。 + 標記為已驗證 + 開始握手 + 複製 + 相互驗證 + 你和 %1$s 已相互驗證 + 與 %1$s 相互驗證 + 已驗證 + 你已驗證 %1$s + 已驗證 %1$s + + bitchat + 點對點傳訊需要藍牙權限,無需網際網路。 + 需要位置權限才能透過藍牙探索附近的裝置。 + 需要通知權限才能提醒你有新訊息。 + 暱稱 + 輸入訊息… + 密碼 + 加入頻道 + 離開 + 傳送 + 顯示指令 + 返回 + 使用者 + 頻道 + 線上使用者 + 目前沒有人連線 + 連續點三下以清除所有資料 + 網路 + 偵測到電池最佳化 + 已停用電池最佳化 + 不需要電池最佳化 + 正在檢查電池最佳化 + 為什麼要停用電池最佳化? + bitchat 需要在背景執行,以維持與附近裝置的 mesh 網路連線。電池最佳化可能會中斷這些連線,導致訊息延遲或遺失。\n\n停用電池最佳化可確保可靠的點對點傳訊。 + 停用電池最佳化 + 注意:你之後可以在 Android 設定 > 應用程式 > bitchat > 電池 中變更此設定 + 你的裝置不需要電池最佳化設定。bitchat 將正常運作。 + 你的裝置不需要電池最佳化設定。bitchat 將正常運作。 + bitchat 可以在背景可靠地運作 + • 確保訊息可靠送達\n• 維持 mesh 網路連線\n• 允許背景訊息中繼\n• 防止連線中斷 + 再次檢查 + 暫時略過 + 繼續 + 重試 + 還有 %1$d 則 + 來自 %2$d 位使用者的 %1$d 則訊息 + 還有 %1$d 個對話 + 👥 附近有 bitchat 使用者! + 附近有 1 人 + 附近有 %1$d 人 + 新訊息 + 新位置訊息 + 在 %1$s 中被提及 + 在 %1$s 中被提及(還有 %2$d 則) + 在 %2$s 中有 %1$d 則提及 + %1$s 中有新動態 + %1$s 中的訊息 + %1$s 加入了對話 + bitchat - %1$d 則提及 + bitchat - 位置聊天 + 來自 %2$d 個位置的 %1$d 則訊息 + 在 Mesh 聊天中被提及 + 在 Mesh 聊天中有 %1$d 則提及 + 還有 %1$d 個位置 + + 還有 %1$d 則 + + Mesh 背景服務 + 讓藍牙 mesh 網路在背景持續運作 + 加入最愛 + 從最愛移除 + 新增書籤 + 可透過 Nostr 連線 + 未讀私訊 + 位置筆記 + 已傳送 + Tor 狀態 + 已連線的節點 + 地理雜湊參與者 + 準備好進行握手 + 握手進行中 + 端對端加密 + 握手失敗 + 📎 已收到檔案 + 📄 %1$s + 📏 大小:%1$s + 🏷️ 類型:%1$s + 📂 開啟/儲存 + ❌ 關閉 + 選擇圖片 + 儲存目前的圖片 + 關閉 + 圖片已儲存至下載資料夾 + 圖片儲存失敗 + 圖片 %1$d/%2$d + 選擇檔案 + 具端對端加密的去中心化 mesh 傳訊 + 離線 Mesh 聊天 + 透過藍牙 LE 直接通訊,無需網際網路或伺服器。訊息會透過附近的裝置中繼以擴大範圍。 + 線上地理雜湊頻道 + 使用基於地理雜湊的頻道與你所在地區的人連線。透過公共網際網路中繼擴充 mesh 網路。 + 端對端加密 + 私訊經過加密。頻道訊息是公開的。 + 系統 + 淺色 + 深色 + 工作量證明 + 工作量證明已關閉 + 工作量證明已開啟 + 為地理雜湊訊息新增工作量證明以遏止垃圾訊息。 + 難度:%1$d 位元(約 %2$s) + 難度 %1$d 需要約 %2$s 次雜湊嘗試 + 不需要工作量證明 + 極低 - 最低限度的垃圾訊息防護 + 低 - 基本垃圾訊息防護 + 中 - 良好的垃圾訊息防護 + 高 - 強力垃圾訊息防護 + 極高 - 可能造成延遲 + 極端 - 需要大量運算 + 網路 + Tor 已關閉 + Tor 已開啟 + 透過 Tor 路由網際網路流量以加強隱私。 + Tor 狀態:%1$s,啟動進度 %2$d%% + 上次:%1$s + 緊急資料刪除 + 除錯設定 + 開放原始碼 • 隱私優先 • 去中心化 + 關閉 + 隱私已受保護 + 取消 + 警告 + 位置服務 + 隱私 + 錯誤 + 電池最佳化 + 優點 + 正在檢查電池最佳化 + 不支援電池最佳化 + 藍牙 + 未讀訊息 + 開啟地圖 + 移除書籤 + 傳送 + 結束 bitchat + 在背景執行 + 應用程式關閉時保持 mesh 網路運作中(前景服務) + 離開頻道 + 可透過 Nostr 連線 + 離線最愛 + 降低精確度 + 提高精確度 + 選擇地理雜湊 + 捲動到底部 + 檔案 + 圖片 + 取消 + 連結 + 錄製語音訊息 + 選擇媒體 + 離線 Mesh 聊天 + 線上地理雜湊頻道 + 端對端加密 + #藍牙 • %1$s + 圖片 %1$d/%2$d + 圖片無法使用 + 圖片已儲存至下載資料夾 + 圖片儲存失敗 + 選擇檔案 + [檔案無法使用] + 未知 + 為此訊息或使用者選擇一項操作 + 為此使用者選擇一項操作 + 複製訊息 + 將此訊息複製到剪貼簿 + 拍打 %1$s + 傳送一則有趣的拍打訊息 + 擁抱 %1$s + 傳送一則友善的擁抱訊息 + 封鎖 %1$s + 封鎖來自此使用者的所有訊息 + 傳訊給 %1$s + 傳送一則私訊 + #位置頻道 + 使用地理雜湊頻道與你附近的人聊天。僅分享粗略的地理雜湊,絕不分享精確的 GPS 位置。請勿對此畫面截圖或分享,以保護你的隱私。 + 授予位置權限 + 位置權限已遭拒。請至設定中啟用以使用位置頻道。 + ✓ 位置權限已授予 + 正在檢查權限… + 正在尋找附近的頻道… + 已加入書籤 + 地理雜湊 + 無效的地理雜湊 + 傳送 + 停用位置服務 + 啟用位置服務 + mesh + 街區 + 鄰里 + 城市 + 省份 + 地區 + 除錯工具 + 用於診斷與控制的開發者工具 + 詳細記錄 + 記錄節點加入/離開、連線方向、封包路由與中繼 + 藍牙角色 + GATT 伺服器 + 連線數:%1$d/%2$d + 最大伺服器數 + GATT 客戶端 + 最大客戶端數 + 連線數:%1$d/%2$d + 最大總數 + 封包中繼 + 自啟動以來:%1$d + 開啟/關閉角色,停用時會關閉所有連線 + 同步設定 + 每次同步最大封包數:%1$d + 最大 GCS 篩選器大小:%1$d 位元組(128–1024) + 目標 FPR:%1$.2f%% + 已連線的裝置 + 我們的裝置 ID:%1$s + + 中斷連線 + 最近的掃描結果 + 連線 + 除錯主控台 + 清除 + 過去 10 秒:%1$d • 1 分鐘:%2$d • 15 分鐘:%3$d + 推導的 P:%1$s • 估計最大元素數:%2$s + • 直連 + RSSI:%1$s + + 作為伺服器(我們主機) + 作為客戶端(我們連線) + 需要位置服務 + 隱私優先 + bitchat 不會追蹤你的位置。\n\n藍牙掃描與地理雜湊聊天功能都需要位置服務。 + bitchat 需要位置服務以進行: + • 藍牙裝置掃描\n• 在 mesh 網路上探索附近的使用者\n• 地理雜湊聊天功能\n• 不會追蹤或收集位置資訊 + 建議開啟背景位置 + 選用,可提升 mesh 網路可靠性 + Android 建議開啟背景位置,讓 bitchat 在應用程式未開啟時也能掃描附近的裝置。這能讓 mesh 網路在重新開機後持續運作。 + 開啟設定後,請選擇「一律允許」。 + bitchat 使用背景位置以進行: + - 在應用程式關閉時掃描附近的裝置\n- 重新開機後重新連線\n- 讓 mesh 網路在背景持續運作 + 我們絕不會收集或儲存你的位置。你的隱私安全無虞。 + 允許背景位置 + 不使用背景位置繼續 + 開啟位置設定 + 再次檢查 + 位置服務無法使用 + 此裝置上無法使用位置服務。這種情況並不常見,因為位置服務在 Android 裝置上是標準功能。\n\nbitchat 需要位置服務才能讓藍牙掃描正常運作(Android 的要求)。若沒有此功能,應用程式將無法探索附近的使用者。 + 正在檢查位置服務… + 需要藍牙 + bitchat 需要藍牙以進行: + • 探索附近的使用者\n• 建立 mesh 網路連線\n• 傳送與接收訊息\n• 無需網際網路或伺服器即可運作 + 啟用藍牙 + 不支援藍牙 + 此裝置不支援 bitchat 運作所需的藍牙低功耗(BLE)。\n\nbitchat 需要 BLE 才能建立 mesh 網路,並在無網際網路的情況下與附近裝置通訊。 + 正在檢查藍牙狀態… + 偵測到電池最佳化 + 電池最佳化已啟用 + bitchat 需要在背景執行以維持 mesh 連線。電池最佳化可能會中斷這些連線。 + 停用的好處 + • 可靠的訊息送達\n• 維持 mesh 連線\n• 防止連線中斷 + 停用電池最佳化 + 電池最佳化已停用 + 繼續 + 正在初始化 mesh 網路 + + 正在設定藍牙 mesh 網路… + 這應該只需要幾秒鐘 + ⚠️ + 設定尚未完成 + 再試一次 + 開啟設定 + 你的隱私已受保護 + • 不追蹤或收集資料\n• 藍牙 mesh 聊天完全離線\n• 地理雜湊聊天使用網際網路 + 權限 + 授予權限 + bitchat 不會追蹤你的位置 + @ + · ⧉ + 附近沒有人… + (你) + 平移並縮放以選擇地理雜湊 + 選擇 + 輸入訊息… + @%1$s + 提及 + %1$d/%2$d + @%1$s + v%1$s + # + _ + [%1$s] %2$d%% + + + image/* + 圖片 + 檔案 + + + + ✓✓ + + + 📷 傳送了一張圖片 + 🎤 傳送了一則語音訊息 + 📎 傳送了一個檔案 + 📄 + 🗜️ + 📄 + 📊 + 📈 + 📎 + 播放 + 暫停 + 需要此權限才能透過藍牙探索 bitchat 使用者 + 允許 bitchat 連線至附近的裝置 + Android 要求此權限,才能透過藍牙探索附近的 bitchat 使用者 + bitchat 需要此權限才能掃描附近的裝置 + 建議開啟,讓應用程式在背景時也能掃描附近的裝置 + 允許背景位置存取 + 在你收到私訊時接收通知 + 允許 bitchat 傳送通知給你 + 停用電池最佳化,以確保 bitchat 能在背景可靠地運作並維持 mesh 網路連線 + 允許 bitchat 在不受電池限制的情況下運作 + 附近的裝置 + 精確位置 + 背景位置 + 麥克風 + 通知 + 電池最佳化 + 其他 + 輸入頻道密碼 + 頻道 %1$s 受密碼保護。請輸入密碼以加入。 + 密碼 + 加入 + 取消 + 此版本不支援 Tor + + + %1$d 人 + + 語言 + 應用程式語言 + 跟隨系統 + 選擇語言 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 85d4ee8f..b84e0e5d 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -46,7 +46,7 @@ 以及另外 %1$d 条 来自 %2$d 位的 %1$d 条消息 以及另外 %1$d 个会话 - 👥 附近的 bitchatter! + 附近的 bitchatter! 附近 1 人 附近 %1$d 人 新消息 @@ -407,4 +407,8 @@ 查看这里留下的留言 这里留有 1 条留言 — 点按阅读 这里留有 %d 条留言 — 点按阅读 + 语言 + 应用语言 + 跟随系统 + 选择语言 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index edbb6a83..b8dff50b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,10 @@ + pay via Cashu + Cashu payment + Copy token + Redeem in wallet + Redeem on web bitchat Bluetooth permission is required for peer-to-peer messaging without internet. Location permission is required to discover nearby devices via Bluetooth. @@ -42,7 +47,7 @@ and %1$d more %1$d messages from %2$d people and %1$d more conversations - 👥 bitchatters nearby! + bitchatters nearby! 1 person around %1$d people around New Messages @@ -69,11 +74,53 @@ Add to favorites Remove from favorites + Favorite + Favorited you Add bookmark Nostr reachable Messages + Conversations + Offline · not in mesh + Offline from mesh · Nostr available + Delete + Delete conversation + Delete conversation? + Delete your conversation with %1$s from this device? + Search conversations + Clear + Loading private conversations… + Private conversations could not be loaded + Private conversations will appear here + No matching conversations + ONLINE + OFFLINE + Mark as read + Mark as unread + Pin conversation + Unpin conversation + Mute conversation + Unmute conversation + Conversation actions + %1$d unread messages + Read + Draft: %1$s + You: %1$s + · %1$s + Conversation could not be deleted + Deleted conversation with %1$s + Undo + Conversation could not be restored + Reply + Mark read + New private message + Open bitchat to view it + Direct Messages + Notifications for private messages from other users + Geohash Chats + Notifications for mentions and messages in geohash location channels + You Location notes Teleported Tor status @@ -253,6 +300,9 @@ Checking Battery Optimization Battery Optimization Not Supported Bluetooth + Direct Wi-Fi Aware + Direct Bluetooth + Routed mesh Unread message Open map Remove bookmark @@ -570,4 +620,8 @@ Bluetooth Recommended + Language + App language + System default + Select language diff --git a/app/src/main/res/xml/locales_config.xml b/app/src/main/res/xml/locales_config.xml new file mode 100644 index 00000000..4bfd7251 --- /dev/null +++ b/app/src/main/res/xml/locales_config.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/test/java/com/bitchat/android/favorites/FavoriteRelationshipTest.kt b/app/src/test/java/com/bitchat/android/favorites/FavoriteRelationshipTest.kt new file mode 100644 index 00000000..123a0ba4 --- /dev/null +++ b/app/src/test/java/com/bitchat/android/favorites/FavoriteRelationshipTest.kt @@ -0,0 +1,48 @@ +package com.bitchat.android.favorites + +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test +import java.util.Date + +class FavoriteRelationshipTest { + + @Test + fun `first inbound favorite creates a received relationship`() { + val noiseKey = ByteArray(32) { it.toByte() } + + val relationship = null.withPeerFavoritedUs( + noisePublicKey = noiseKey, + theyFavoritedUs = true, + now = Date(123L) + ) + + assertFalse(relationship.isFavorite) + assertTrue(relationship.theyFavoritedUs) + assertTrue(relationship.peerNoisePublicKey.contentEquals(noiseKey)) + } + + @Test + fun `inbound favorite preserves our existing favorite`() { + val noiseKey = ByteArray(32) { it.toByte() } + val existing = FavoriteRelationship( + peerNoisePublicKey = noiseKey, + peerNostrPublicKey = null, + peerNickname = "peer", + isFavorite = true, + theyFavoritedUs = false, + favoritedAt = Date(10L), + lastUpdated = Date(20L) + ) + + val relationship = existing.withPeerFavoritedUs( + noisePublicKey = noiseKey, + theyFavoritedUs = true, + now = Date(30L) + ) + + assertTrue(relationship.isFavorite) + assertTrue(relationship.theyFavoritedUs) + assertTrue(relationship.isMutual) + } +} diff --git a/app/src/test/java/com/bitchat/android/ui/CashuTokenDecoderTest.kt b/app/src/test/java/com/bitchat/android/ui/CashuTokenDecoderTest.kt new file mode 100644 index 00000000..8514d088 --- /dev/null +++ b/app/src/test/java/com/bitchat/android/ui/CashuTokenDecoderTest.kt @@ -0,0 +1,165 @@ +package com.bitchat.android.ui + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull +import org.junit.Assert.assertNull +import org.junit.Test +import java.nio.charset.StandardCharsets +import java.util.Base64 + +class CashuTokenDecoderTest { + @Test + fun `v3 sums proofs and sanitizes display metadata`() { + val token = v3Token( + """{"token":[{"mint":"https://MINT.example.com/path","proofs":[{"amount":1},{"amount":4},{"amount":16}]}],"unit":"sat","memo":" lunch\n"}""" + ) + + val info = CashuTokenDecoder.decode(token, strict = true) + + assertEquals(21L, info?.amount) + assertEquals("21 sat", info?.displayAmount) + assertEquals("mint.example.com", info?.mintHost) + assertEquals("lunch", info?.memo) + } + + @Test + fun `display amount applies currency minor units without changing proof sum`() { + val usd = CashuTokenDecoder.decode( + v3Token("""{"token":[{"proofs":[{"amount":900},{"amount":1}]}],"unit":"usd"}"""), + strict = true + ) + val jpy = CashuTokenDecoder.decode( + v3Token("""{"token":[{"proofs":[{"amount":901}]}],"unit":"jpy"}"""), + strict = true + ) + + assertEquals(901L, usd?.amount) + assertEquals("9.01 usd", usd?.displayAmount) + assertEquals("901 jpy", jpy?.displayAmount) + } + + @Test + fun `display amount does not assume decimals for custom units`() { + val token = CashuTokenDecoder.decode( + v3Token("""{"token":[{"proofs":[{"amount":901}]}],"unit":"usdc"}"""), + strict = true + ) + + assertEquals("901 usdc", token?.displayAmount) + } + + @Test + fun `v4 definite length token decodes strictly`() { + val token = validV4Token() + + val info = CashuTokenDecoder.decode(token, strict = true) + + assertEquals(21L, info?.amount) + assertEquals("mint.example.com", info?.mintHost) + } + + @Test + fun `strict v4 rejects truncation junk and trailing data`() { + val valid = validV4Token() + val truncated = valid.dropLast(12) + val junk = "cashuB" + "Q".repeat(40) + val payloadWithTrailingGarbage = decodePayload(valid) + byteArrayOf(0) + val trailing = "cashuB" + base64Url(payloadWithTrailingGarbage) + + assertNull(CashuTokenDecoder.decode(truncated, strict = true)) + assertNull(CashuTokenDecoder.decode(junk, strict = true)) + assertNull(CashuTokenDecoder.decode(trailing, strict = true)) + assertNotNull(CashuTokenDecoder.decode(junk)) + } + + @Test + fun `strict decoding rejects missing nonpositive fractional and overflowing amounts`() { + val values = listOf( + """{"token":[{"proofs":[]}]}""", + """{"token":[{"proofs":[{"amount":0}]}]}""", + """{"token":[{"proofs":[{"amount":1.5}]}]}""", + """{"token":[{"proofs":[{"amount":2100000000000000},{"amount":1}]}]}""" + ) + + values.forEach { assertNull(CashuTokenDecoder.decode(v3Token(it), strict = true)) } + } + + @Test + fun `extracts URI forms as bare deduplicated tokens with a cap`() { + val first = v3Token("""{"token":[{"proofs":[{"amount":1}]}]}""") + val second = v3Token("""{"token":[{"proofs":[{"amount":2}]}]}""") + val text = "cashu:$first and cashu://$first then $second" + + assertEquals(listOf(first, second), CashuTokenDecoder.extractTokens(text, max = 2)) + assertEquals(first, CashuTokenDecoder.bareToken("cashu%3A$first")) + } + + @Test + fun `sentence punctuation is not included in extracted token`() { + val token = v3Token("""{"token":[{"proofs":[{"amount":1}]}]}""") + + assertEquals(listOf(token), CashuTokenDecoder.extractTokens("Redeem $token.")) + assertNull(CashuTokenDecoder.bareToken("$token.")) + } + + @Test + fun `oversized and deeply nested input fails closed`() { + assertNull(CashuTokenDecoder.decode("cashuA" + "A".repeat(CashuTokenDecoder.MAX_TOKEN_LENGTH))) + var nested = byteArrayOf(0) + repeat(20) { nested = byteArrayOf(0x81.toByte()) + nested } + assertNull(CashuTokenDecoder.decode("cashuB" + base64Url(nested), strict = true)) + } + + private fun v3Token(json: String): String = + "cashuA" + base64Url(json.toByteArray(StandardCharsets.UTF_8)) + + private fun validV4Token(): String { + val proofs = listOf(1L, 4L, 16L).map { amount -> + cborMap( + "a" to cborUnsigned(amount), + "s" to cborText("secret"), + "c" to cborBytes(byteArrayOf(2, 0xab.toByte(), 0xcd.toByte())) + ) + } + val payload = cborMap( + "m" to cborText("https://mint.example.com"), + "u" to cborText("sat"), + "t" to cborArray( + cborMap( + "i" to cborBytes(byteArrayOf(0, 0xad.toByte(), 0x26, 0x8c.toByte())), + "p" to cborArray(*proofs.toTypedArray()) + ) + ) + ) + return "cashuB" + base64Url(payload) + } + + private fun cborUnsigned(value: Long) = cborHead(0, value) + private fun cborText(value: String) = + cborHead(3, value.toByteArray().size.toLong()) + value.toByteArray() + private fun cborBytes(value: ByteArray) = cborHead(2, value.size.toLong()) + value + private fun cborArray(vararg values: ByteArray) = + cborHead(4, values.size.toLong()) + values.fold(byteArrayOf(), ByteArray::plus) + private fun cborMap(vararg pairs: Pair) = + cborHead(5, pairs.size.toLong()) + pairs.fold(byteArrayOf()) { bytes, pair -> + bytes + cborText(pair.first) + pair.second + } + + private fun cborHead(major: Int, value: Long): ByteArray = when (value) { + in 0..23 -> byteArrayOf(((major shl 5) or value.toInt()).toByte()) + in 24..255 -> byteArrayOf(((major shl 5) or 24).toByte(), value.toByte()) + else -> byteArrayOf( + ((major shl 5) or 25).toByte(), + (value ushr 8).toByte(), + value.toByte() + ) + } + + private fun decodePayload(token: String): ByteArray { + val encoded = token.substring(6) + return Base64.getUrlDecoder().decode(encoded + "=".repeat((4 - encoded.length % 4) % 4)) + } + + private fun base64Url(bytes: ByteArray): String = + Base64.getUrlEncoder().withoutPadding().encodeToString(bytes) +} diff --git a/app/src/test/java/com/bitchat/android/ui/CommandProcessorTest.kt b/app/src/test/java/com/bitchat/android/ui/CommandProcessorTest.kt index 9eff027c..011f80a2 100644 --- a/app/src/test/java/com/bitchat/android/ui/CommandProcessorTest.kt +++ b/app/src/test/java/com/bitchat/android/ui/CommandProcessorTest.kt @@ -2,6 +2,9 @@ package com.bitchat.android.ui import android.content.Context import androidx.test.core.app.ApplicationProvider +import com.bitchat.android.geohash.ChannelID +import com.bitchat.android.geohash.GeohashChannel +import com.bitchat.android.geohash.GeohashChannelLevel import com.bitchat.android.mesh.MeshService import com.bitchat.android.model.BitchatMessage import junit.framework.TestCase.assertEquals @@ -136,4 +139,26 @@ class CommandProcessorTest() { assertTrue(locallyRead.contains(message.id)) } + + @Test + fun `pay feedback is added to active geohash channel`() { + val geohash = "u0nd" + chatState.setSelectedLocationChannel( + ChannelID.Location(GeohashChannel(GeohashChannelLevel.PROVINCE, geohash)) + ) + + commandProcessor.processCommand( + command = "/pay invalid", + meshService = meshService, + myPeerID = "peer-id", + onSendMessage = { _, _, _ -> }, + viewModel = null + ) + + assertEquals( + "invalid cashu token — not sending it", + chatState.getChannelMessagesValue()["geo:$geohash"]?.single()?.content + ) + assertEquals(0, chatState.getMessagesValue().size) + } } diff --git a/app/src/test/java/com/bitchat/android/ui/ConversationSecurityStateTest.kt b/app/src/test/java/com/bitchat/android/ui/ConversationSecurityStateTest.kt new file mode 100644 index 00000000..c7de0885 --- /dev/null +++ b/app/src/test/java/com/bitchat/android/ui/ConversationSecurityStateTest.kt @@ -0,0 +1,42 @@ +package com.bitchat.android.ui + +import org.junit.Assert.assertEquals +import org.junit.Test + +class ConversationSecurityStateTest { + @Test + fun `active mesh peer session wins for canonical conversation`() { + val result = resolveConversationSessionState( + conversationID = "contact-alice", + activeMeshPeerID = "mesh-alice", + peerSessionStates = mapOf( + "contact-alice" to "uninitialized", + "mesh-alice" to "established" + ) + ) + + assertEquals("established", result) + } + + @Test + fun `conversation session is fallback when live identity has no state`() { + val result = resolveConversationSessionState( + conversationID = "contact-alice", + activeMeshPeerID = "mesh-alice", + peerSessionStates = mapOf("contact-alice" to "handshaking") + ) + + assertEquals("handshaking", result) + } + + @Test + fun `conversation session resolves when mesh and conversation IDs are identical`() { + val result = resolveConversationSessionState( + conversationID = "mesh-alice", + activeMeshPeerID = "mesh-alice", + peerSessionStates = mapOf("mesh-alice" to "established") + ) + + assertEquals("established", result) + } +} diff --git a/app/src/test/kotlin/com/bitchat/NotificationManagerTest.kt b/app/src/test/kotlin/com/bitchat/NotificationManagerTest.kt deleted file mode 100644 index cfe8e5b4..00000000 --- a/app/src/test/kotlin/com/bitchat/NotificationManagerTest.kt +++ /dev/null @@ -1,117 +0,0 @@ -package com.bitchat - -import android.content.Context -import androidx.core.app.NotificationManagerCompat -import androidx.test.core.app.ApplicationProvider -import com.bitchat.android.ui.NotificationManager -import com.bitchat.android.util.NotificationIntervalManager -import org.junit.Before -import org.junit.Ignore -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.Mockito -import org.mockito.Mockito.times -import org.mockito.MockitoAnnotations -import org.mockito.Spy -import org.mockito.kotlin.any -import org.mockito.kotlin.never -import org.mockito.kotlin.verify -import org.robolectric.RobolectricTestRunner - -@RunWith(RobolectricTestRunner::class) -class NotificationManagerTest { - - private val context: Context = ApplicationProvider.getApplicationContext() - private val notificationIntervalManager = NotificationIntervalManager() - lateinit var notificationManager: NotificationManager - private val notificationManagerCompat: NotificationManagerCompat = Mockito.mock(NotificationManagerCompat::class.java) - - @Before - fun setup() { - MockitoAnnotations.openMocks(this) - notificationManager = NotificationManager( - context, - notificationManagerCompat, - notificationIntervalManager - ) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when there are no active peers, do not send active peer notification`() { - notificationManager.setAppBackgroundState(true) - notificationManager.showActiveUserNotification(emptyList()) - verify(notificationManagerCompat, never()).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when app is in foreground, do not send active peer notification`() { - notificationManager.setAppBackgroundState(false) - notificationManager.showActiveUserNotification(listOf("peer-1")) - verify(notificationManagerCompat, never()).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when there is an active peer, send notification`() { - notificationManager.setAppBackgroundState(true) - notificationManager.showActiveUserNotification(listOf("peer-1")) - verify(notificationManagerCompat, times(1)).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when there is an active peer but less than 5 minutes have passed since last notification, do not send notification`() { - notificationManager.setAppBackgroundState(true) - notificationManager.showActiveUserNotification(listOf("peer-1")) - notificationManager.showActiveUserNotification(listOf("peer-2")) - verify(notificationManagerCompat, times(1)).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when there is an active peer and more than 5 minutes have passed since last notification, send notification`() { - notificationManager.setAppBackgroundState(true) - notificationManager.showActiveUserNotification(listOf("peer-1")) - notificationIntervalManager.setLastNetworkNotificationTime(System.currentTimeMillis() - 301_000L) - notificationManager.showActiveUserNotification(listOf("peer-2")) - verify(notificationManagerCompat, times(2)).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when there is a recently seen peer but no new active peers, no notification is sent`() { - notificationManager.setAppBackgroundState(true) - notificationIntervalManager.recentlySeenPeers.add("peer-1") - notificationManager.showActiveUserNotification(emptyList()) - verify(notificationManagerCompat, times(0)).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when an active peer is a recently seen peer, do not send notification`() { - notificationManager.setAppBackgroundState(true) - notificationIntervalManager.recentlySeenPeers.add("peer-1") - notificationManager.showActiveUserNotification(listOf("peer-1")) - verify(notificationManagerCompat, times(0)).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when an active peer is a new peer, send notification`() { - notificationManager.setAppBackgroundState(true) - notificationIntervalManager.recentlySeenPeers.addAll(emptyList()) - notificationManager.showActiveUserNotification(listOf("peer-1")) - verify(notificationManagerCompat, times(1)).notify(any(), any()) - } - - @Ignore // Temporarily disabled due to Mockito final class issues - @Test - fun `when an active peer is a new peer and there are already multiple recently seen peers, send notification`() { - notificationManager.setAppBackgroundState(true) - notificationIntervalManager.recentlySeenPeers.addAll(listOf("peer-1", "peer-2")) - notificationManager.showActiveUserNotification(listOf("peer-3")) - verify(notificationManagerCompat, times(1)).notify(any(), any()) - } -} diff --git a/app/src/test/kotlin/com/bitchat/android/features/file/FileUtilsConversationCleanupTest.kt b/app/src/test/kotlin/com/bitchat/android/features/file/FileUtilsConversationCleanupTest.kt new file mode 100644 index 00000000..3bed330b --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/features/file/FileUtilsConversationCleanupTest.kt @@ -0,0 +1,67 @@ +package com.bitchat.android.features.file + +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.BitchatMessageType +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import java.io.File +import java.util.Date +import java.util.UUID + +@RunWith(RobolectricTestRunner::class) +class FileUtilsConversationCleanupTest { + + @Test + fun `deleting conversation removes only unreferenced app-owned media`() { + val context = ApplicationProvider.getApplicationContext() + val testDirectory = File( + context.cacheDir, + "conversation-cleanup-${UUID.randomUUID()}" + ).apply { mkdirs() } + val deletedOnly = File(testDirectory, "deleted.jpg").apply { + writeBytes(byteArrayOf(1)) + } + val shared = File(testDirectory, "shared.jpg").apply { + writeBytes(byteArrayOf(2)) + } + val outsideAppStorage = File.createTempFile( + "conversation-cleanup-", + ".jpg" + ).apply { + writeBytes(byteArrayOf(3)) + } + + try { + FileUtils.deleteConversationMedia( + context = context, + deletedMessages = listOf( + mediaMessage("deleted", deletedOnly), + mediaMessage("shared-deleted", shared), + mediaMessage("outside", outsideAppStorage) + ), + retainedMessages = listOf(mediaMessage("shared-retained", shared)) + ) + + assertFalse(deletedOnly.exists()) + assertTrue(shared.exists()) + assertTrue(outsideAppStorage.exists()) + } finally { + testDirectory.deleteRecursively() + outsideAppStorage.delete() + } + } + + private fun mediaMessage(id: String, file: File) = BitchatMessage( + id = id, + sender = "alice", + content = file.absolutePath, + type = BitchatMessageType.Image, + timestamp = Date(1L), + isPrivate = true + ) +} diff --git a/app/src/test/kotlin/com/bitchat/android/hotspot/HotspotStartupPolicyTest.kt b/app/src/test/kotlin/com/bitchat/android/hotspot/HotspotStartupPolicyTest.kt new file mode 100644 index 00000000..bb91b072 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/hotspot/HotspotStartupPolicyTest.kt @@ -0,0 +1,170 @@ +package com.bitchat.android.hotspot + +import android.net.wifi.p2p.WifiP2pManager +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Test + +class HotspotStartupPolicyTest { + + @Test + fun `busy while P2P is disabled fails immediately instead of retrying`() { + val decision = HotspotStartupPolicy.decide( + reason = WifiP2pManager.BUSY, + attempt = 1, + p2pState = WifiP2pManager.WIFI_P2P_STATE_DISABLED + ) + + assertEquals( + HotspotStartupPolicy.Decision.Fail(HotspotStartupPolicy.P2P_DISABLED_MESSAGE), + decision + ) + } + + @Test + fun `busy before the P2P state is known still retries`() { + val decision = HotspotStartupPolicy.decide( + reason = WifiP2pManager.BUSY, + attempt = 1, + p2pState = null + ) + + assertTrue(decision is HotspotStartupPolicy.Decision.Retry) + } + + @Test + fun `busy retry delays back off exponentially`() { + val delays = (1..4).map { attempt -> + val decision = HotspotStartupPolicy.decide( + reason = WifiP2pManager.BUSY, + attempt = attempt, + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED + ) + (decision as HotspotStartupPolicy.Decision.Retry).delayMillis + } + + assertEquals(listOf(1_000L, 2_000L, 4_000L, 8_000L), delays) + } + + @Test + fun `busy on the final attempt gives up`() { + val decision = HotspotStartupPolicy.decide( + reason = WifiP2pManager.BUSY, + attempt = HotspotStartupPolicy.MAX_ATTEMPTS, + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED + ) + + assertTrue(decision is HotspotStartupPolicy.Decision.Fail) + } + + @Test + fun `unsupported P2P never retries`() { + val decision = HotspotStartupPolicy.decide( + reason = WifiP2pManager.P2P_UNSUPPORTED, + attempt = 1, + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED + ) + + assertEquals( + HotspotStartupPolicy.Decision.Fail(HotspotStartupPolicy.P2P_UNSUPPORTED_MESSAGE), + decision + ) + } + + @Test + fun `a group we recorded creating is removed before a new one is created`() { + val action = HotspotStartupPolicy.startAction( + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED, + existingGroupName = "DIRECT-BC-CUF6EN63", + ownedGroupName = "DIRECT-BC-CUF6EN63" + ) + + assertEquals(HotspotStartupPolicy.StartAction.RemoveStaleGroupThenCreate, action) + } + + @Test + fun `another app's group is left alone`() { + val action = HotspotStartupPolicy.startAction( + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED, + existingGroupName = "DIRECT-xY-Chromecast", + ownedGroupName = "DIRECT-BC-CUF6EN63" + ) + + assertEquals( + HotspotStartupPolicy.StartAction.Fail(HotspotStartupPolicy.FOREIGN_GROUP_MESSAGE), + action + ) + } + + @Test + fun `an orphan from before we recorded ownership is still recognised by its prefix`() { + val action = HotspotStartupPolicy.startAction( + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED, + existingGroupName = "DIRECT-BC-OLDGROUP", + ownedGroupName = null + ) + + assertEquals(HotspotStartupPolicy.StartAction.RemoveStaleGroupThenCreate, action) + } + + @Test + fun `a foreign group is left alone even when we recorded nothing`() { + val action = HotspotStartupPolicy.startAction( + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED, + existingGroupName = "DIRECT-xY-Chromecast", + ownedGroupName = null + ) + + assertEquals( + HotspotStartupPolicy.StartAction.Fail(HotspotStartupPolicy.FOREIGN_GROUP_MESSAGE), + action + ) + } + + @Test + fun `creation proceeds directly when no group exists`() { + val action = HotspotStartupPolicy.startAction( + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED, + existingGroupName = null, + ownedGroupName = null + ) + + assertEquals(HotspotStartupPolicy.StartAction.Create, action) + } + + @Test + fun `disabled P2P fails before touching any existing group`() { + val action = HotspotStartupPolicy.startAction( + p2pState = WifiP2pManager.WIFI_P2P_STATE_DISABLED, + existingGroupName = "DIRECT-BC-CUF6EN63", + ownedGroupName = "DIRECT-BC-CUF6EN63" + ) + + assertEquals( + HotspotStartupPolicy.StartAction.Fail(HotspotStartupPolicy.P2P_DISABLED_MESSAGE), + action + ) + } + + @Test + fun `busy is retryable so a group orphaned mid-session can be cleared`() { + val decision = HotspotStartupPolicy.decide( + reason = WifiP2pManager.BUSY, + attempt = 1, + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED + ) + + assertEquals(HotspotStartupPolicy.Decision.Retry(1_000L), decision) + } + + @Test + fun `generic framework error never retries`() { + val decision = HotspotStartupPolicy.decide( + reason = WifiP2pManager.ERROR, + attempt = 1, + p2pState = WifiP2pManager.WIFI_P2P_STATE_ENABLED + ) + + assertTrue(decision is HotspotStartupPolicy.Decision.Fail) + } +} \ No newline at end of file diff --git a/app/src/test/kotlin/com/bitchat/android/nostr/NostrDirectMessageHandlerTest.kt b/app/src/test/kotlin/com/bitchat/android/nostr/NostrDirectMessageHandlerTest.kt index f756447a..634e053f 100644 --- a/app/src/test/kotlin/com/bitchat/android/nostr/NostrDirectMessageHandlerTest.kt +++ b/app/src/test/kotlin/com/bitchat/android/nostr/NostrDirectMessageHandlerTest.kt @@ -2,6 +2,8 @@ package com.bitchat.android.nostr import android.os.Build import com.bitchat.android.services.AppStateStore +import com.bitchat.android.services.ConversationRepository +import com.bitchat.android.services.InMemoryConversationStorageCipher import com.bitchat.android.services.SeenMessageStore import com.bitchat.android.ui.ChatState import com.bitchat.android.ui.DataManager @@ -30,6 +32,7 @@ import org.mockito.kotlin.whenever import org.robolectric.RobolectricTestRunner import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config +import java.util.UUID @RunWith(RobolectricTestRunner::class) @Config(sdk = [Build.VERSION_CODES.P], manifest = Config.NONE) @@ -37,17 +40,31 @@ import org.robolectric.annotation.Config class NostrDirectMessageHandlerTest { private val gson = Gson() private lateinit var scope: CoroutineScope + private lateinit var conversationRepository: ConversationRepository + private lateinit var conversationDatabaseName: String @Before fun setUp() { Dispatchers.setMain(UnconfinedTestDispatcher()) scope = CoroutineScope(SupervisorJob() + Dispatchers.Unconfined) AppStateStore.clear() + conversationDatabaseName = "nostr-dm-${UUID.randomUUID()}.db" + conversationRepository = ConversationRepository( + context = RuntimeEnvironment.getApplication(), + dispatcher = Dispatchers.Unconfined, + databaseName = conversationDatabaseName, + storageCipher = InMemoryConversationStorageCipher() + ) + AppStateStore.setConversationRepositoryForTest(conversationRepository) } @After fun tearDown() { AppStateStore.clear() + AppStateStore.setConversationRepositoryForTest(null) + conversationRepository.closeForTest() + RuntimeEnvironment.getApplication() + .deleteDatabase(conversationDatabaseName) scope.cancel() Dispatchers.resetMain() } diff --git a/app/src/test/kotlin/com/bitchat/android/onboarding/OptionalPermissionRequestTest.kt b/app/src/test/kotlin/com/bitchat/android/onboarding/OptionalPermissionRequestTest.kt new file mode 100644 index 00000000..b89a9a74 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/onboarding/OptionalPermissionRequestTest.kt @@ -0,0 +1,53 @@ +package com.bitchat.android.onboarding + +import android.Manifest +import android.app.Application +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.Shadows.shadowOf +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [33]) +class OptionalPermissionRequestTest { + private lateinit var application: Application + + @Before + fun setUp() { + application = ApplicationProvider.getApplicationContext() + application.getSharedPreferences("bitchat_permissions", Context.MODE_PRIVATE) + .edit() + .clear() + .commit() + shadowOf(application).denyPermissions(Manifest.permission.POST_NOTIFICATIONS) + } + + @Test + fun `missing notification permission is offered once`() { + val permissionManager = PermissionManager(application) + + assertEquals( + listOf(Manifest.permission.POST_NOTIFICATIONS), + permissionManager.getUnrequestedOptionalPermissions() + ) + + permissionManager.markOptionalPermissionsRequested( + listOf(Manifest.permission.POST_NOTIFICATIONS) + ) + + assertTrue(permissionManager.getUnrequestedOptionalPermissions().isEmpty()) + } + + @Test + fun `granted notification permission is not requested`() { + shadowOf(application).grantPermissions(Manifest.permission.POST_NOTIFICATIONS) + + assertTrue(PermissionManager(application).getUnrequestedOptionalPermissions().isEmpty()) + } +} diff --git a/app/src/test/kotlin/com/bitchat/android/service/PeerAvailabilityNotifierTest.kt b/app/src/test/kotlin/com/bitchat/android/service/PeerAvailabilityNotifierTest.kt new file mode 100644 index 00000000..176ffad5 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/service/PeerAvailabilityNotifierTest.kt @@ -0,0 +1,267 @@ +package com.bitchat.android.service + +import android.app.Notification +import android.app.NotificationManager +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull +import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.Shadows.shadowOf +import org.robolectric.annotation.Config + +class PeerAvailabilityTrackerTest { + + @Test + fun `repeated flapping produces only one alert during cooldown`() { + val clock = MutableClock() + val tracker = tracker(clock = clock) + var showCount = 0 + + if (tracker.update(1, isAppInBackground = true) == PeerAvailabilityAction.SHOW) { + showCount++ + tracker.markAlertShown() + } + + repeat(5) { + clock.advance(1_000L) + assertEquals( + PeerAvailabilityAction.CLEAR, + tracker.update(0, isAppInBackground = true) + ) + clock.advance(PeerAvailabilityTracker.EMPTY_REARM_DELAY_MS) + if (tracker.update(1, isAppInBackground = true) == PeerAvailabilityAction.SHOW) { + showCount++ + tracker.markAlertShown() + } + } + + assertEquals(1, showCount) + } + + @Test + fun `mesh must remain empty before notification re-arms`() { + val clock = MutableClock() + val tracker = tracker( + clock = clock, + alertCooldownMs = 0L + ) + + assertEquals(PeerAvailabilityAction.SHOW, tracker.update(1, isAppInBackground = true)) + tracker.markAlertShown() + + assertEquals(PeerAvailabilityAction.CLEAR, tracker.update(0, isAppInBackground = true)) + clock.advance(PeerAvailabilityTracker.EMPTY_REARM_DELAY_MS - 1) + assertEquals(PeerAvailabilityAction.NONE, tracker.update(1, isAppInBackground = true)) + + assertEquals(PeerAvailabilityAction.CLEAR, tracker.update(0, isAppInBackground = true)) + clock.advance(PeerAvailabilityTracker.EMPTY_REARM_DELAY_MS) + assertEquals(PeerAvailabilityAction.SHOW, tracker.update(1, isAppInBackground = true)) + } + + @Test + fun `cooldown survives tracker recreation`() { + val clock = MutableClock() + val history = InMemoryAlertHistory() + val originalTracker = tracker(clock = clock, history = history) + + assertEquals( + PeerAvailabilityAction.SHOW, + originalTracker.update(1, isAppInBackground = true) + ) + originalTracker.markAlertShown() + + clock.advance(PeerAvailabilityTracker.ALERT_COOLDOWN_MS - 1) + val restartedDuringCooldown = tracker(clock = clock, history = history) + assertEquals( + PeerAvailabilityAction.NONE, + restartedDuringCooldown.update(1, isAppInBackground = true) + ) + + clock.advance(1) + val restartedAfterCooldown = tracker(clock = clock, history = history) + assertEquals( + PeerAvailabilityAction.SHOW, + restartedAfterCooldown.update(1, isAppInBackground = true) + ) + } + + @Test + fun `foreground discovery is not replayed after app enters background`() { + val tracker = tracker() + + assertEquals(PeerAvailabilityAction.NONE, tracker.update(1, isAppInBackground = false)) + assertEquals(PeerAvailabilityAction.NONE, tracker.update(1, isAppInBackground = true)) + assertEquals(PeerAvailabilityAction.CLEAR, tracker.update(0, isAppInBackground = true)) + assertEquals(PeerAvailabilityAction.SHOW, tracker.update(1, isAppInBackground = true)) + } + + @Test(expected = IllegalArgumentException::class) + fun `negative peer count is rejected`() { + tracker().update(-1, isAppInBackground = true) + } + + private fun tracker( + clock: MutableClock = MutableClock(), + history: InMemoryAlertHistory = InMemoryAlertHistory(), + alertCooldownMs: Long = PeerAvailabilityTracker.ALERT_COOLDOWN_MS + ): PeerAvailabilityTracker { + return PeerAvailabilityTracker( + alertHistory = history, + nowMillis = clock::now, + alertCooldownMs = alertCooldownMs + ) + } +} + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [32]) +class PeerAvailabilityNotifierTest { + private lateinit var context: Context + private lateinit var systemNotificationManager: NotificationManager + + @Before + fun setUp() { + context = ApplicationProvider.getApplicationContext() + systemNotificationManager = + context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + systemNotificationManager.cancelAll() + context.getSharedPreferences( + SharedPreferencesPeerAvailabilityAlertHistory.PREFERENCES_NAME, + Context.MODE_PRIVATE + ).edit().clear().commit() + } + + @Test + fun `background availability posts on dedicated channel`() { + val textProvider = testTextProvider() + val notifier = PeerAvailabilityNotifier( + context = context, + tracker = tracker(), + textProvider = textProvider, + canPostNotifications = { true } + ) + + notifier.onPeerCountChanged(0, isAppInBackground = true) + notifier.onPeerCountChanged(2, isAppInBackground = true) + + val notification = + shadowOf(systemNotificationManager).getNotification( + PeerAvailabilityNotifier.NOTIFICATION_ID + ) + assertNotNull(notification) + assertEquals(PeerAvailabilityNotifier.CHANNEL_ID, notification.channelId) + assertEquals( + textProvider.title(), + notification.extras.getString("android.title") + ) + assertEquals( + textProvider.body(2), + notification.extras.getString("android.text") + ) + assertTrue(notification.flags and Notification.FLAG_ONLY_ALERT_ONCE != 0) + assertNotNull( + systemNotificationManager.getNotificationChannel(PeerAvailabilityNotifier.CHANNEL_ID) + ) + } + + @Test + fun `returning to zero cancels availability notification`() { + val notifier = PeerAvailabilityNotifier( + context = context, + tracker = tracker(), + textProvider = testTextProvider(), + canPostNotifications = { true } + ) + + notifier.onPeerCountChanged(1, isAppInBackground = true) + notifier.onPeerCountChanged(0, isAppInBackground = true) + + assertNull( + shadowOf(systemNotificationManager).getNotification( + PeerAvailabilityNotifier.NOTIFICATION_ID + ) + ) + } + + @Test + fun `explicit clear cancels availability notification`() { + val notifier = PeerAvailabilityNotifier( + context = context, + tracker = tracker(), + textProvider = testTextProvider(), + canPostNotifications = { true } + ) + + notifier.onPeerCountChanged(1, isAppInBackground = true) + notifier.clear() + + assertNull( + shadowOf(systemNotificationManager).getNotification( + PeerAvailabilityNotifier.NOTIFICATION_ID + ) + ) + } + + @Test + fun `disabled notifications do not post`() { + val history = InMemoryAlertHistory() + val notifier = PeerAvailabilityNotifier( + context = context, + tracker = PeerAvailabilityTracker(history), + textProvider = testTextProvider(), + canPostNotifications = { false } + ) + + notifier.onPeerCountChanged(1, isAppInBackground = true) + + assertNull( + shadowOf(systemNotificationManager).getNotification( + PeerAvailabilityNotifier.NOTIFICATION_ID + ) + ) + assertNull(history.lastAlertAtMillis) + } + + @Test + fun `shared preferences history persists last alert time`() { + val history = SharedPreferencesPeerAvailabilityAlertHistory(context) + history.lastAlertAtMillis = 42L + + assertEquals( + 42L, + SharedPreferencesPeerAvailabilityAlertHistory(context).lastAlertAtMillis ?: -1L + ) + } + + private fun tracker(): PeerAvailabilityTracker { + return PeerAvailabilityTracker(InMemoryAlertHistory()) + } + + private fun testTextProvider(): PeerAvailabilityTextProvider { + return object : PeerAvailabilityTextProvider { + override fun title(): String = "Bitchatters nearby" + + override fun body(peerCount: Int): String = "$peerCount people around" + } + } +} + +private class InMemoryAlertHistory( + override var lastAlertAtMillis: Long? = null +) : PeerAvailabilityAlertHistory + +private class MutableClock( + private var currentMillis: Long = 1_000L +) { + fun now(): Long = currentMillis + + fun advance(durationMillis: Long) { + currentMillis += durationMillis + } +} diff --git a/app/src/test/kotlin/com/bitchat/android/services/AppStateStoreTest.kt b/app/src/test/kotlin/com/bitchat/android/services/AppStateStoreTest.kt index 90ab0034..893abe0e 100644 --- a/app/src/test/kotlin/com/bitchat/android/services/AppStateStoreTest.kt +++ b/app/src/test/kotlin/com/bitchat/android/services/AppStateStoreTest.kt @@ -4,19 +4,23 @@ import com.bitchat.android.model.BitchatMessage import com.bitchat.android.model.DeliveryStatus import org.junit.After import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test +import kotlinx.coroutines.runBlocking import java.util.Date class AppStateStoreTest { @Before fun setUp() { + AppStateStore.resumePrivateConversationsAfterPanic() AppStateStore.clear() } @After fun tearDown() { + AppStateStore.resumePrivateConversationsAfterPanic() AppStateStore.clear() } @@ -131,6 +135,60 @@ class AppStateStoreTest { assertEquals(listOf(message), AppStateStore.privateMessages.value[contactID]) } + @Test + fun `live nickname updates retained conversation metadata`() { + val message = BitchatMessage( + id = "rename-message", + sender = "Alice Old", + content = "hello", + timestamp = Date(1), + isPrivate = true + ) + AppStateStore.addPrivateMessage("peer-a", message) + + AppStateStore.updatePrivateConversationDisplayNames( + mapOf("peer-a" to "Alice New") + ) + + assertEquals( + "Alice New", + AppStateStore.privateConversationDisplayNames.value.getValue("peer-a") + ) + } + + @Test + fun `restored unread and nickname state canonicalize with message aliases`() { + val noiseKeyHex = "02".repeat(32) + val contactID = ContactIdentityResolver.contactConversationIdForNoiseKey( + ByteArray(32) { 2 } + ) + val message = BitchatMessage( + id = "restored-alias-message", + sender = "Alice", + content = "hello", + timestamp = Date(1), + isPrivate = true + ) + + AppStateStore.restorePrivateConversations( + PersistedConversationSnapshot( + chats = mapOf(noiseKeyHex to listOf(message)), + readMessageIDs = emptySet(), + arrivalOrder = listOf(message.id), + deletedMessageIDs = emptySet(), + displayNames = mapOf(noiseKeyHex to "Alice Renamed"), + unreadCounts = mapOf(noiseKeyHex to 1) + ) + ) + + assertEquals(setOf(contactID), AppStateStore.privateMessages.value.keys) + assertEquals(mapOf(contactID to 1), AppStateStore.unreadPrivateMessageCounts.value) + assertEquals( + mapOf(contactID to "Alice Renamed"), + AppStateStore.privateConversationDisplayNames.value + ) + } + @Test fun `canonicalized private chat history keeps arrival order when peer clocks differ`() { val noiseKeyHex = "01".repeat(32) @@ -189,4 +247,145 @@ class AppStateStoreTest { .deliveryStatus assertTrue(status is DeliveryStatus.Read) } + + @Test + fun `in flight message can become failed without overwriting confirmed delivery`() { + val sending = BitchatMessage( + id = "send-failure", + sender = "me", + content = "hello", + timestamp = Date(1), + isPrivate = true, + deliveryStatus = DeliveryStatus.Sending + ) + AppStateStore.addPrivateMessage("peer-a", sending) + + AppStateStore.updatePrivateMessageStatus( + sending.id, + DeliveryStatus.Failed("network unavailable") + ) + assertTrue( + AppStateStore.privateMessages.value + .getValue("peer-a") + .single() + .deliveryStatus is DeliveryStatus.Failed + ) + + AppStateStore.updatePrivateMessageStatus( + sending.id, + DeliveryStatus.Delivered("alice", Date(2)) + ) + AppStateStore.updatePrivateMessageStatus( + sending.id, + DeliveryStatus.Failed("late timeout") + ) + assertTrue( + AppStateStore.privateMessages.value + .getValue("peer-a") + .single() + .deliveryStatus is DeliveryStatus.Delivered + ) + } + + @Test + fun `closing a conversation releases full payload history but keeps its summary`() { + repeat(3) { index -> + AppStateStore.addPrivateMessage( + "peer-a", + BitchatMessage( + id = "history-$index", + sender = "alice", + content = "message $index", + timestamp = Date(index.toLong()), + isPrivate = true + ) + ) + } + + AppStateStore.releasePrivateConversationHistory("peer-a") + + assertEquals( + listOf("history-2"), + AppStateStore.privateMessages.value.getValue("peer-a").map { it.id } + ) + } + + @Test + fun `long lived process applies the same bounded private history policy`() { + AppStateStore.setNickname("me") + repeat(ConversationDatabase.MAX_MESSAGES_PER_CONVERSATION) { index -> + AppStateStore.addPrivateMessage( + "peer-a", + BitchatMessage( + id = "incoming-$index", + sender = "alice", + content = "message", + timestamp = Date(index.toLong()), + isPrivate = true + ) + ) + } + AppStateStore.addPrivateMessage( + "peer-a", + BitchatMessage( + id = "latest-outgoing", + sender = "me", + content = "latest", + timestamp = Date(Long.MAX_VALUE), + isPrivate = true + ) + ) + + val retained = AppStateStore.privateMessages.value.getValue("peer-a") + assertEquals(ConversationDatabase.MAX_MESSAGES_PER_CONVERSATION, retained.size) + assertEquals("incoming-1", retained.first().id) + assertEquals("latest-outgoing", retained.last().id) + } + + @Test + fun `private message admission is atomic and can durably classify known read messages`() { + val message = BitchatMessage( + id = "same-transport-message", + sender = "alice", + content = "hello", + timestamp = Date(1L), + isPrivate = true + ) + + assertTrue(AppStateStore.addPrivateMessage("peer-a", message, forceRead = true)) + assertFalse(AppStateStore.addPrivateMessage("peer-a", message)) + + assertEquals(1, AppStateStore.privateMessages.value.getValue("peer-a").size) + assertTrue(AppStateStore.isPrivateMessageRead(message.id)) + } + + @Test + fun `panic clear rejects private messages until explicitly resumed`() { + val beforePanic = BitchatMessage( + id = "before-panic", + sender = "alice", + content = "erase me", + timestamp = Date(1L), + isPrivate = true + ) + val duringPanic = beforePanic.copy(id = "during-panic") + val afterPanic = beforePanic.copy(id = "after-panic") + + assertTrue(AppStateStore.addPrivateMessage("peer-a", beforePanic)) + AppStateStore.updatePrivateConversationDisplayNames( + mapOf("peer-a" to "Alice") + ) + assertTrue(runBlocking { AppStateStore.panicClearPrivateConversations() }) + assertTrue(AppStateStore.privateMessages.value.isEmpty()) + assertTrue(AppStateStore.privateConversationDisplayNames.value.isEmpty()) + assertFalse(AppStateStore.addPrivateMessage("peer-a", duringPanic)) + + AppStateStore.resumePrivateConversationsAfterPanic() + + assertTrue(AppStateStore.addPrivateMessage("peer-a", afterPanic)) + assertEquals( + listOf(afterPanic), + AppStateStore.privateMessages.value.getValue("peer-a") + ) + } } diff --git a/app/src/test/kotlin/com/bitchat/android/services/ConversationDatabaseTest.kt b/app/src/test/kotlin/com/bitchat/android/services/ConversationDatabaseTest.kt new file mode 100644 index 00000000..9a01ef37 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/services/ConversationDatabaseTest.kt @@ -0,0 +1,573 @@ +package com.bitchat.android.services + +import android.content.ContentValues +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.BitchatMessageType +import com.bitchat.android.model.DeliveryStatus +import org.junit.After +import org.junit.Assert.assertArrayEquals +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertNotNull +import org.junit.Assert.assertNull +import org.junit.Assert.assertThrows +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import java.util.Date +import java.util.UUID +import java.io.File + +@RunWith(RobolectricTestRunner::class) +class ConversationDatabaseTest { + private lateinit var context: Context + private lateinit var databaseName: String + private lateinit var database: ConversationDatabase + private lateinit var storageCipher: InMemoryConversationStorageCipher + + @Before + fun setUp() { + context = ApplicationProvider.getApplicationContext() + databaseName = "conversation-test-${UUID.randomUUID()}.db" + storageCipher = InMemoryConversationStorageCipher() + database = ConversationDatabase(context, databaseName, storageCipher = storageCipher) + } + + @After + fun tearDown() { + database.close() + context.deleteDatabase(databaseName) + } + + @Test + fun `message fields read state and delivery status survive reopen`() { + val message = BitchatMessage( + id = "round-trip", + sender = "alice", + content = "photo path", + type = BitchatMessageType.Image, + timestamp = Date(123_456L), + isRelay = true, + originalSender = "alice-original", + isPrivate = true, + recipientNickname = "me", + senderPeerID = "0123456789abcdef", + mentions = listOf("me", "bob"), + channel = "private", + encryptedContent = byteArrayOf(1, 2, 3), + isEncrypted = true, + deliveryStatus = DeliveryStatus.Delivered("me", Date(123_999L)), + senderNostrPubkey = "a".repeat(64) + ) + + database.upsertMessage( + conversationID = "contact_alice", + aliases = setOf("contact_alice", "0123456789abcdef"), + displayName = "alice", + message = message, + isRead = false + ) + database.markRead(message.id) + database.updateDeliveryStatus( + message.id, + DeliveryStatus.Read("me", Date(124_000L)) + ) + database.close() + + database = ConversationDatabase(context, databaseName, storageCipher = storageCipher) + val restored = database.loadSnapshot() + val restoredMessage = restored.chats.getValue("contact_alice").single() + + assertEquals(message.id, restoredMessage.id) + assertEquals(message.sender, restoredMessage.sender) + assertEquals(message.content, restoredMessage.content) + assertEquals(message.type, restoredMessage.type) + assertEquals(message.timestamp, restoredMessage.timestamp) + assertEquals(message.mentions, restoredMessage.mentions) + assertEquals(message.senderNostrPubkey, restoredMessage.senderNostrPubkey) + assertArrayEquals(message.encryptedContent, restoredMessage.encryptedContent) + assertEquals( + DeliveryStatus.Read("me", Date(124_000L)), + restoredMessage.deliveryStatus + ) + assertEquals(setOf(message.id), restored.readMessageIDs) + assertEquals(listOf(message.id), restored.arrivalOrder) + assertEquals("alice", restored.displayNames.getValue("contact_alice")) + } + + @Test + fun `aliases merge into one conversation and duplicate transport delivery stays unique`() { + val first = message("first", "alice", 100L) + val second = message("second", "alice", 200L) + + database.upsertMessage("mesh-alias", setOf("mesh-alias"), "alice", first, false) + database.upsertMessage("nostr_alias", setOf("nostr_alias"), "alice", second, false) + database.mergeAliases( + targetConversationID = "contact_alice", + aliases = setOf("mesh-alias", "nostr_alias", "contact_alice") + ) + val duplicate = database.upsertMessage( + "contact_alice", + setOf("mesh-alias", "nostr_alias"), + null, + first, + false + ) + + val restored = database.loadSnapshot() + assertFalse(duplicate.inserted) + assertEquals(setOf("contact_alice"), restored.chats.keys) + assertEquals(listOf("first", "second"), restored.chats.getValue("contact_alice").map { it.id }) + assertEquals("alice", restored.displayNames.getValue("contact_alice")) + } + + @Test + fun `conversation deletion cascades messages while a later message starts fresh`() { + database.upsertMessage( + "contact_alice", + setOf("mesh-alias", "contact_alice"), + "alice", + message("old", "alice", 100L), + false + ) + + database.deleteConversation( + "contact_alice", + setOf("mesh-alias", "contact_alice") + ) + assertTrue(database.loadSnapshot().chats.isEmpty()) + + database.close() + database = ConversationDatabase(context, databaseName, storageCipher = storageCipher) + database.upsertMessage( + "contact_alice", + setOf("mesh-alias", "contact_alice"), + "alice", + message("old", "alice", 100L), + false + ) + assertTrue(database.loadSnapshot().chats.isEmpty()) + + database.upsertMessage( + "contact_alice", + setOf("mesh-alias", "contact_alice"), + "alice", + message("new", "alice", 200L), + false + ) + val restored = database.loadSnapshot() + assertEquals(listOf("new"), restored.chats.getValue("contact_alice").map { it.id }) + assertFalse(restored.readMessageIDs.contains("old")) + assertTrue(restored.deletedMessageIDs.contains("old")) + } + + @Test + fun `per conversation retention keeps the newest bounded history`() { + val total = ConversationDatabase.MAX_MESSAGES_PER_CONVERSATION + 5 + repeat(total) { index -> + database.upsertMessage( + conversationID = "contact_alice", + aliases = setOf("contact_alice"), + displayName = "alice", + message = message("message-$index", "alice", index.toLong()), + isRead = true + ) + } + + val snapshot = database.loadSnapshot() + val messages = snapshot.chats.getValue("contact_alice") + assertEquals(ConversationDatabase.MAX_MESSAGES_PER_CONVERSATION, messages.size) + assertEquals("message-5", messages.first().id) + assertEquals("message-${total - 1}", messages.last().id) + assertEquals( + (0 until 5).mapTo(mutableSetOf()) { "message-$it" }, + snapshot.deletedMessageIDs + ) + } + + @Test + fun `global retention is hard bounded when every conversation has one message`() { + database.close() + context.deleteDatabase(databaseName) + database = ConversationDatabase( + context = context, + databaseName = databaseName, + maxMessagesPerConversation = 10, + maxMessagesTotal = 3, + maxPayloadBytes = Long.MAX_VALUE, + storageCipher = storageCipher + ) + repeat(4) { index -> + database.upsertMessage( + conversationID = "peer-$index", + aliases = setOf("peer-$index"), + displayName = "peer $index", + message = message("single-$index", "peer $index", index.toLong()), + isRead = true + ) + } + + database.pruneToRetentionLimits() + + val snapshot = database.loadSnapshot() + assertEquals(3, snapshot.chats.values.sumOf { it.size }) + assertFalse(snapshot.chats.containsKey("peer-0")) + assertTrue(snapshot.deletedMessageIDs.contains("single-0")) + } + + @Test + fun `initial snapshot decrypts only latest row while preserving exact unread count`() { + repeat(3) { index -> + database.upsertMessage( + conversationID = "contact_alice", + aliases = setOf("contact_alice"), + displayName = "alice", + message = message("summary-$index", "alice", index.toLong()), + isRead = index == 2 + ) + } + + val initial = database.loadInitialSnapshot() + + assertEquals(listOf("summary-2"), initial.chats.getValue("contact_alice").map { it.id }) + assertEquals(2, initial.unreadCounts.getValue("contact_alice")) + assertEquals(setOf("summary-2"), initial.readMessageIDs) + assertEquals(3, database.loadConversation("contact_alice").arrivalOrder.size) + } + + @Test + fun `nickname metadata updates without requiring a new message`() { + database.upsertMessage( + conversationID = "mesh-alias", + aliases = setOf("mesh-alias"), + displayName = "Alice Old", + message = message("rename-message", "Alice Old", 1L), + isRead = true + ) + + database.updateConversationIdentity( + conversationID = "contact_alice", + aliases = setOf("mesh-alias", "contact_alice"), + displayName = "Alice New" + ) + database.close() + database = ConversationDatabase(context, databaseName, storageCipher = storageCipher) + + val restored = database.loadInitialSnapshot() + + assertEquals(setOf("contact_alice"), restored.chats.keys) + assertEquals("Alice New", restored.displayNames.getValue("contact_alice")) + assertEquals("Alice Old", restored.chats.getValue("contact_alice").single().sender) + } + + @Test + fun `sensitive message and display fields are encrypted and legacy columns are scrubbed`() { + val secret = "unique-secret-${UUID.randomUUID()}" + database.upsertMessage( + conversationID = "contact_alice", + aliases = setOf("contact_alice"), + displayName = "display-$secret", + message = BitchatMessage( + id = "encrypted-row", + sender = "sender-$secret", + content = "content-$secret", + timestamp = Date(42L), + isPrivate = true, + recipientNickname = "recipient-$secret" + ), + isRead = false + ) + + database.readableDatabase.query( + "private_messages", + arrayOf("sender", "content", "recipient_nickname", "payload_ciphertext"), + "message_id = ?", + arrayOf("encrypted-row"), + null, + null, + null + ).use { cursor -> + assertTrue(cursor.moveToFirst()) + assertEquals("", cursor.getString(0)) + assertEquals("", cursor.getString(1)) + assertNull(cursor.getString(2)) + val envelope = cursor.getBlob(3) + assertFalse(envelope.toString(Charsets.ISO_8859_1).contains(secret)) + val plaintext = storageCipher.decrypt( + envelope, + "message:encrypted-row".toByteArray() + ).toString(Charsets.UTF_8) + assertTrue(plaintext.contains(secret)) + } + database.readableDatabase.query( + "conversations", + arrayOf("display_name", "display_name_ciphertext"), + "conversation_id = ?", + arrayOf("contact_alice"), + null, + null, + null + ).use { cursor -> + assertTrue(cursor.moveToFirst()) + assertNull(cursor.getString(0)) + assertNotNull(cursor.getBlob(1)) + } + } + + @Test + fun `media byte retention reports only orphaned app-owned attachments`() { + database.close() + context.deleteDatabase(databaseName) + database = ConversationDatabase( + context = context, + databaseName = databaseName, + maxMessagesPerConversation = 10, + maxMessagesTotal = 10, + maxPayloadBytes = Long.MAX_VALUE, + maxMediaBytes = 4, + storageCipher = storageCipher + ) + val first = File(context.filesDir, "conversation-first-${UUID.randomUUID()}.bin") + .apply { writeBytes(byteArrayOf(1, 2, 3, 4)) } + val second = File(context.filesDir, "conversation-second-${UUID.randomUUID()}.bin") + .apply { writeBytes(byteArrayOf(5, 6, 7, 8)) } + try { + database.upsertMessage( + "contact_alice", + setOf("contact_alice"), + "alice", + message("media-1", "alice", 1L).copy( + type = BitchatMessageType.File, + content = first.absolutePath + ), + true + ) + database.upsertMessage( + "contact_alice", + setOf("contact_alice"), + "alice", + message("media-2", "alice", 2L).copy( + type = BitchatMessageType.File, + content = second.absolutePath + ), + true + ) + + val orphaned = database.pruneToRetentionLimits() + + assertEquals(setOf(first.canonicalPath), orphaned) + assertEquals(listOf("media-2"), database.loadSnapshot().arrivalOrder) + } finally { + first.delete() + second.delete() + } + } + + @Test + fun `shared attachment path is counted once and retained while referenced`() { + database.close() + context.deleteDatabase(databaseName) + database = ConversationDatabase( + context = context, + databaseName = databaseName, + maxMessagesPerConversation = 10, + maxMessagesTotal = 10, + maxPayloadBytes = Long.MAX_VALUE, + maxMediaBytes = 4, + storageCipher = storageCipher + ) + val shared = File(context.filesDir, "conversation-shared-${UUID.randomUUID()}.bin") + .apply { writeBytes(byteArrayOf(1, 2, 3, 4)) } + try { + repeat(2) { index -> + database.upsertMessage( + "contact_alice", + setOf("contact_alice"), + "alice", + message("shared-$index", "alice", index.toLong()).copy( + type = BitchatMessageType.File, + content = shared.absolutePath + ), + true + ) + } + + assertTrue(database.pruneToRetentionLimits().isEmpty()) + assertEquals(2, database.loadSnapshot().arrivalOrder.size) + } finally { + shared.delete() + } + } + + @Test + fun `panic clear rotates the storage key before erasing rows`() { + database.upsertMessage( + "contact_alice", + setOf("contact_alice"), + "alice", + message("before-panic", "alice", 1L), + true + ) + val envelope = database.readableDatabase.query( + "private_messages", + arrayOf("payload_ciphertext"), + "message_id = ?", + arrayOf("before-panic"), + null, + null, + null + ).use { cursor -> + assertTrue(cursor.moveToFirst()) + cursor.getBlob(0) + } + + database.clearAll() + + assertTrue(database.loadSnapshot().chats.isEmpty()) + assertThrows(Exception::class.java) { + storageCipher.decrypt(envelope, "message:before-panic".toByteArray()) + } + } + + @Test + fun `version one plaintext database migrates without losing history`() { + database.close() + context.deleteDatabase(databaseName) + createVersionOneDatabase( + conversationID = "legacy-contact", + messageID = "legacy-message", + sender = "legacy-alice", + content = "legacy-content" + ) + + database = ConversationDatabase(context, databaseName, storageCipher = storageCipher) + val restored = database.loadSnapshot() + + assertEquals("legacy-content", restored.chats.getValue("legacy-contact").single().content) + database.readableDatabase.query( + "private_messages", + arrayOf("sender", "content", "payload_ciphertext", "received_at"), + "message_id = ?", + arrayOf("legacy-message"), + null, + null, + null + ).use { cursor -> + assertTrue(cursor.moveToFirst()) + assertEquals("", cursor.getString(0)) + assertEquals("", cursor.getString(1)) + assertNotNull(cursor.getBlob(2)) + assertEquals(123L, cursor.getLong(3)) + } + } + + private fun createVersionOneDatabase( + conversationID: String, + messageID: String, + sender: String, + content: String + ) { + context.openOrCreateDatabase(databaseName, Context.MODE_PRIVATE, null).use { db -> + db.execSQL( + """ + CREATE TABLE conversations ( + conversation_id TEXT COLLATE NOCASE PRIMARY KEY NOT NULL, + display_name TEXT, + created_at INTEGER NOT NULL, + updated_at INTEGER NOT NULL + ) + """.trimIndent() + ) + db.execSQL( + """ + CREATE TABLE conversation_aliases ( + alias TEXT COLLATE NOCASE PRIMARY KEY NOT NULL, + conversation_id TEXT COLLATE NOCASE NOT NULL + ) + """.trimIndent() + ) + db.execSQL( + """ + CREATE TABLE private_messages ( + arrival_sequence INTEGER PRIMARY KEY AUTOINCREMENT, + message_id TEXT UNIQUE NOT NULL, + conversation_id TEXT COLLATE NOCASE NOT NULL, + sender TEXT NOT NULL, + content TEXT NOT NULL, + message_type INTEGER NOT NULL, + sent_at INTEGER NOT NULL, + is_relay INTEGER NOT NULL, + original_sender TEXT, + is_private INTEGER NOT NULL, + recipient_nickname TEXT, + sender_peer_id TEXT, + mentions_json TEXT, + channel_name TEXT, + encrypted_content BLOB, + is_encrypted INTEGER NOT NULL, + delivery_type INTEGER NOT NULL, + delivery_text TEXT, + delivery_at INTEGER, + delivery_reached INTEGER, + delivery_total INTEGER, + sender_nostr_pubkey TEXT, + is_read INTEGER NOT NULL DEFAULT 0 + ) + """.trimIndent() + ) + db.execSQL( + "CREATE TABLE deleted_private_messages (" + + "message_id TEXT PRIMARY KEY NOT NULL, deleted_at INTEGER NOT NULL)" + ) + db.insertOrThrow( + "conversations", + null, + ContentValues().apply { + put("conversation_id", conversationID) + put("display_name", sender) + put("created_at", 1L) + put("updated_at", 1L) + } + ) + db.insertOrThrow( + "conversation_aliases", + null, + ContentValues().apply { + put("alias", conversationID) + put("conversation_id", conversationID) + } + ) + db.insertOrThrow( + "private_messages", + null, + ContentValues().apply { + put("message_id", messageID) + put("conversation_id", conversationID) + put("sender", sender) + put("content", content) + put("message_type", BitchatMessageType.Message.ordinal) + put("sent_at", 123L) + put("is_relay", 0) + put("is_private", 1) + put("is_encrypted", 0) + put("delivery_type", 2) + put("is_read", 0) + } + ) + db.version = 1 + } + } + + private fun message(id: String, sender: String, timestamp: Long) = BitchatMessage( + id = id, + sender = sender, + content = "hello-$id", + timestamp = Date(timestamp), + isPrivate = true, + senderPeerID = "0123456789abcdef" + ) +} diff --git a/app/src/test/kotlin/com/bitchat/android/services/ConversationListPreferencesTest.kt b/app/src/test/kotlin/com/bitchat/android/services/ConversationListPreferencesTest.kt new file mode 100644 index 00000000..48928ef4 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/services/ConversationListPreferencesTest.kt @@ -0,0 +1,110 @@ +package com.bitchat.android.services + +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import com.bitchat.android.identity.SecureIdentityStateManager +import org.junit.After +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import java.util.UUID + +@RunWith(RobolectricTestRunner::class) +class ConversationListPreferencesTest { + private lateinit var context: Context + private lateinit var preferencesName: String + + @Before + fun setUp() { + context = ApplicationProvider.getApplicationContext() + preferencesName = "conversation-list-${UUID.randomUUID()}" + ContactDirectory.initialize(context) { null } + } + + @After + fun tearDown() { + ContactDirectory.initialize(context) { null } + } + + @Test + fun `pin mute and draft persist while conversation removal clears all three`() { + val first = preferences() + first.togglePinned("CONTACT_ALICE") + first.toggleMuted("contact_alice") + first.setDraft("contact_alice", "unfinished reply") + + val restored = preferences() + assertTrue(restored.isPinned("contact_alice")) + assertTrue(restored.isMuted("CONTACT_ALICE")) + assertTrue(restored.draftFor("contact_alice") == "unfinished reply") + + restored.removeConversation("contact_alice") + val afterDelete = preferences() + assertFalse(afterDelete.isPinned("contact_alice")) + assertFalse(afterDelete.isMuted("contact_alice")) + assertNull(afterDelete.draftFor("contact_alice")) + } + + @Test + fun `draft persistence is globally bounded and panic clear is durable`() { + val preferences = preferences() + repeat(60) { index -> + preferences.setDraft("peer-$index", "x".repeat(3_000)) + } + + assertTrue(preferences.drafts.value.size <= 50) + assertTrue(preferences.drafts.value.values.sumOf(String::length) <= 128_000) + assertNull(preferences.draftFor("peer-0")) + assertTrue(preferences.draftFor("peer-59")?.isNotEmpty() == true) + + preferences.togglePinned("peer-59") + preferences.toggleMuted("peer-59") + preferences.clearAll() + + val afterPanic = preferences() + assertTrue(afterPanic.pinned.value.isEmpty()) + assertTrue(afterPanic.muted.value.isEmpty()) + assertTrue(afterPanic.drafts.value.isEmpty()) + } + + @Test + fun `identity canonicalization preserves pin mute and draft state`() { + val peerID = "1122334455667788" + val contactID = "contact_alice" + val beforeIdentityResolution = preferences(canonicalize = { it }) + beforeIdentityResolution.togglePinned(peerID) + beforeIdentityResolution.toggleMuted(peerID) + beforeIdentityResolution.setDraft(peerID, "unfinished reply") + + val afterIdentityResolution = preferences( + canonicalize = { value -> + if (value.equals(peerID, ignoreCase = true)) contactID else value + } + ) + afterIdentityResolution.canonicalizeAliases() + + assertEquals(setOf(contactID), afterIdentityResolution.pinned.value) + assertEquals(setOf(contactID), afterIdentityResolution.muted.value) + assertEquals( + mapOf(contactID to "unfinished reply"), + afterIdentityResolution.drafts.value + ) + } + + private fun preferences( + canonicalize: (String) -> String = ContactDirectory::canonicalConversationId + ): ConversationListPreferences { + val sharedPreferences = + context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE) + return ConversationListPreferences( + stateManager = SecureIdentityStateManager(sharedPreferences, testOnly = true), + testOnly = true, + canonicalize = canonicalize + ) + } +} diff --git a/app/src/test/kotlin/com/bitchat/android/services/ConversationRepositoryTest.kt b/app/src/test/kotlin/com/bitchat/android/services/ConversationRepositoryTest.kt new file mode 100644 index 00000000..0d5947c9 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/services/ConversationRepositoryTest.kt @@ -0,0 +1,113 @@ +package com.bitchat.android.services + +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import com.bitchat.android.model.BitchatMessage +import kotlinx.coroutines.asCoroutineDispatcher +import kotlinx.coroutines.runBlocking +import org.junit.After +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import java.util.Date +import java.util.UUID +import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicReference + +@RunWith(RobolectricTestRunner::class) +class ConversationRepositoryTest { + private lateinit var context: Context + private lateinit var databaseName: String + private lateinit var repository: ConversationRepository + private val executor = Executors.newSingleThreadExecutor() + private val dispatcher = executor.asCoroutineDispatcher() + + @Before + fun setUp() { + context = ApplicationProvider.getApplicationContext() + databaseName = "conversation-repository-test-${UUID.randomUUID()}.db" + } + + @After + fun tearDown() { + if (::repository.isInitialized) repository.closeForTest() + dispatcher.close() + context.deleteDatabase(databaseName) + } + + @Test + fun `reload restores persisted history after initial process restore`() { + repository = ConversationRepository( + context = context, + dispatcher = dispatcher, + databaseName = databaseName, + storageCipher = InMemoryConversationStorageCipher() + ) + val message = BitchatMessage( + id = "persisted-message", + sender = "alice", + content = "survives restart", + timestamp = Date(100L), + isPrivate = true + ) + repository.upsertMessage( + conversationID = "peer-alice", + aliases = setOf("peer-alice"), + displayName = "alice", + message = message, + isRead = true + ) + runBlocking { repository.awaitPendingWrites() } + + val initialSnapshot = AtomicReference() + repository.initialize(initialSnapshot::set) + runBlocking { repository.awaitPendingWrites() } + assertEquals( + listOf(message), + initialSnapshot.get().chats.getValue("peer-alice") + ) + + val reloadedSnapshot = AtomicReference() + repository.reload(reloadedSnapshot::set) + runBlocking { repository.awaitPendingWrites() } + assertEquals( + listOf(message), + reloadedSnapshot.get().chats.getValue("peer-alice") + ) + } + + @Test + fun `panic clear drains queued writes and leaves database empty`() { + repository = ConversationRepository( + context = context, + dispatcher = dispatcher, + databaseName = databaseName, + storageCipher = InMemoryConversationStorageCipher() + ) + repository.upsertMessage( + conversationID = "peer-alice", + aliases = setOf("peer-alice"), + displayName = "alice", + message = BitchatMessage( + id = "queued-before-panic", + sender = "alice", + content = "must be erased", + timestamp = Date(100L), + isPrivate = true + ), + isRead = true + ) + + assertTrue(runBlocking { repository.clearAllAndWait() }) + + val snapshot = AtomicReference() + repository.reload(snapshot::set) + runBlocking { repository.awaitPendingWrites() } + assertTrue(snapshot.get().chats.isEmpty()) + assertTrue(snapshot.get().readMessageIDs.isEmpty()) + assertTrue(snapshot.get().deletedMessageIDs.isEmpty()) + } +} diff --git a/app/src/test/kotlin/com/bitchat/android/services/InMemoryConversationStorageCipher.kt b/app/src/test/kotlin/com/bitchat/android/services/InMemoryConversationStorageCipher.kt new file mode 100644 index 00000000..ee93be23 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/services/InMemoryConversationStorageCipher.kt @@ -0,0 +1,39 @@ +package com.bitchat.android.services + +import java.security.SecureRandom +import javax.crypto.Cipher +import javax.crypto.KeyGenerator +import javax.crypto.SecretKey +import javax.crypto.spec.GCMParameterSpec + +internal class InMemoryConversationStorageCipher : ConversationStorageCipher { + private var key: SecretKey = generateKey() + + override fun encrypt(plaintext: ByteArray, associatedData: ByteArray): ByteArray { + val cipher = Cipher.getInstance("AES/GCM/NoPadding") + cipher.init(Cipher.ENCRYPT_MODE, key) + cipher.updateAAD(associatedData) + return byteArrayOf(1) + cipher.iv + cipher.doFinal(plaintext) + } + + override fun decrypt(envelope: ByteArray, associatedData: ByteArray): ByteArray { + require(envelope.size > 13 && envelope[0] == 1.toByte()) + val cipher = Cipher.getInstance("AES/GCM/NoPadding") + cipher.init( + Cipher.DECRYPT_MODE, + key, + GCMParameterSpec(128, envelope.copyOfRange(1, 13)) + ) + cipher.updateAAD(associatedData) + return cipher.doFinal(envelope.copyOfRange(13, envelope.size)) + } + + override fun destroyKey() { + key = generateKey() + } + + private fun generateKey(): SecretKey = + KeyGenerator.getInstance("AES").apply { + init(256, SecureRandom()) + }.generateKey() +} diff --git a/app/src/test/kotlin/com/bitchat/android/services/IncomingMessageAdmissionTest.kt b/app/src/test/kotlin/com/bitchat/android/services/IncomingMessageAdmissionTest.kt new file mode 100644 index 00000000..94cdcec4 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/services/IncomingMessageAdmissionTest.kt @@ -0,0 +1,248 @@ +package com.bitchat.android.services + +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.DeliveryStatus +import com.bitchat.android.ui.ChatState +import com.bitchat.android.ui.DataManager +import com.bitchat.android.ui.MessageManager +import com.bitchat.android.ui.NoiseSessionDelegate +import com.bitchat.android.ui.PrivateChatManager +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.test.TestScope +import org.junit.After +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import java.util.Date +import java.util.UUID + +@RunWith(RobolectricTestRunner::class) +class IncomingMessageAdmissionTest { + private lateinit var context: Context + private lateinit var databaseName: String + private lateinit var repository: ConversationRepository + private val repositoriesToClose = mutableListOf() + + @Before + fun setUp() { + context = ApplicationProvider.getApplicationContext() + databaseName = "admission-test-${UUID.randomUUID()}.db" + repository = ConversationRepository( + context = context, + dispatcher = Dispatchers.Unconfined, + databaseName = databaseName, + storageCipher = InMemoryConversationStorageCipher() + ) + repositoriesToClose += repository + AppStateStore.setConversationRepositoryForTest(repository) + AppStateStore.resumePrivateConversationsAfterPanic() + AppStateStore.clear() + } + + @After + fun tearDown() { + AppStateStore.resumePrivateConversationsAfterPanic() + AppStateStore.clear() + AppStateStore.setConversationRepositoryForTest(null) + repositoriesToClose.forEach(ConversationRepository::closeForTest) + context.deleteDatabase(databaseName) + context.deleteDatabase("failing-$databaseName") + } + + @Test + fun `private message rejected during panic cannot continue transport dispatch`() { + assertTrue(runBlocking { AppStateStore.panicClearPrivateConversations() }) + + assertFalse( + IncomingMessageAdmission.admitToAppState( + privateMessage(id = "during-panic") + ) + ) + assertTrue(AppStateStore.privateMessages.value.isEmpty()) + } + + @Test + fun `duplicate private transport delivery is rejected before downstream effects`() { + val message = privateMessage(id = "same-message-over-two-transports") + + assertTrue(IncomingMessageAdmission.admitToAppState(message)) + assertFalse(IncomingMessageAdmission.admitToAppState(message)) + } + + @Test + fun `older retained replay is rejected after summary-only restart`() { + val older = privateMessage(id = "older-retained") + val latest = privateMessage(id = "latest-summary").copy(timestamp = Date(2L)) + assertTrue(IncomingMessageAdmission.admitToAppState(older)) + assertTrue(IncomingMessageAdmission.admitToAppState(latest)) + + AppStateStore.clear() + repository.reload { snapshot -> + AppStateStore.restorePrivateConversations(snapshot) + } + runBlocking { repository.awaitPendingWrites() } + assertEquals( + listOf(latest.id), + AppStateStore.privateMessages.value.getValue("peer-a").map { it.id } + ) + + assertFalse(IncomingMessageAdmission.admitToAppState(older)) + assertEquals( + listOf(latest.id), + AppStateStore.privateMessages.value.getValue("peer-a").map { it.id } + ) + } + + @Test + fun `delivery receipt persists after older message is unloaded from memory`() { + val older = privateMessage(id = "older-outgoing").copy( + sender = "me", + senderPeerID = "self", + recipientNickname = "alice", + deliveryStatus = DeliveryStatus.Sent + ) + val latest = privateMessage(id = "latest-summary").copy(timestamp = Date(2L)) + assertTrue(AppStateStore.addPrivateMessage("peer-a", older, forceRead = true)) + assertTrue(IncomingMessageAdmission.admitToAppState(latest)) + runBlocking { repository.awaitPendingWrites() } + + AppStateStore.releasePrivateConversationHistory("peer-a") + assertEquals( + listOf(latest.id), + AppStateStore.privateMessages.value.getValue("peer-a").map { it.id } + ) + + val delivered = DeliveryStatus.Delivered(to = "alice", at = Date(3L)) + AppStateStore.updatePrivateMessageStatus(older.id, delivered) + runBlocking { repository.awaitPendingWrites() } + + val snapshot = runBlocking { + repository.loadConversationAndWait("peer-a") + } + assertEquals( + delivered, + snapshot?.chats?.getValue("peer-a") + ?.single { it.id == older.id } + ?.deliveryStatus + ) + } + + @Test + fun `public and channel messages preserve best effort admission`() { + val public = BitchatMessage( + id = "public", + sender = "alice", + content = "hello", + timestamp = Date(1L) + ) + val channel = public.copy(id = "channel", channel = "#mesh") + + assertTrue(IncomingMessageAdmission.admitToAppState(public)) + assertTrue(IncomingMessageAdmission.admitToAppState(channel)) + assertTrue(AppStateStore.publicMessages.value.contains(public)) + } + + @Test + fun `outgoing callback runs only after local echo survives process state clear`() { + val state = ChatState(TestScope()) + state.setNickname("me") + val manager = PrivateChatManager( + state = state, + messageManager = MessageManager(state), + dataManager = DataManager(context), + noiseSessionDelegate = testNoiseDelegate() + ) + var callbackInvoked = false + + val sent = runBlocking { + manager.sendPrivateMessageDurably( + content = "durable outgoing", + peerID = "peer-a", + recipientNickname = "alice", + senderNickname = "me", + myPeerID = "self" + ) { _, _, _, _ -> + callbackInvoked = true + } + } + + assertTrue(sent) + assertTrue(callbackInvoked) + AppStateStore.clear() + repository.reload { snapshot -> + assertEquals( + "durable outgoing", + snapshot.chats.getValue("peer-a").single().content + ) + } + runBlocking { repository.awaitPendingWrites() } + } + + @Test + fun `outgoing callback is suppressed when durable storage fails`() { + val failingRepository = ConversationRepository( + context = context, + dispatcher = Dispatchers.Unconfined, + databaseName = "failing-$databaseName", + storageCipher = object : ConversationStorageCipher { + override fun encrypt( + plaintext: ByteArray, + associatedData: ByteArray + ): ByteArray = error("storage unavailable") + + override fun decrypt( + envelope: ByteArray, + associatedData: ByteArray + ): ByteArray = error("storage unavailable") + + override fun destroyKey() = Unit + } + ) + repositoriesToClose += failingRepository + AppStateStore.setConversationRepositoryForTest(failingRepository) + val state = ChatState(TestScope()) + val manager = PrivateChatManager( + state = state, + messageManager = MessageManager(state), + dataManager = DataManager(context), + noiseSessionDelegate = testNoiseDelegate() + ) + var callbackInvoked = false + + val sent = runBlocking { + manager.sendPrivateMessageDurably( + "lost", + "peer-a", + "alice", + "me", + "self" + ) { _, _, _, _ -> callbackInvoked = true } + } + + assertFalse(sent) + assertFalse(callbackInvoked) + assertTrue(state.getPrivateChatsValue().isEmpty()) + } + + private fun privateMessage(id: String) = BitchatMessage( + id = id, + sender = "alice", + content = "secret", + timestamp = Date(1L), + isPrivate = true, + senderPeerID = "peer-a" + ) + + private fun testNoiseDelegate() = object : NoiseSessionDelegate { + override fun hasEstablishedSession(peerID: String) = false + override fun initiateHandshake(peerID: String) = Unit + override fun getMyPeerID() = "self" + } +} diff --git a/app/src/test/kotlin/com/bitchat/android/ui/ConversationSummaryTest.kt b/app/src/test/kotlin/com/bitchat/android/ui/ConversationSummaryTest.kt new file mode 100644 index 00000000..2e6128a1 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/ui/ConversationSummaryTest.kt @@ -0,0 +1,269 @@ +package com.bitchat.android.ui + +import com.bitchat.android.model.BitchatMessage +import com.bitchat.android.model.BitchatMessageType +import com.bitchat.android.services.PrivateMessageArrivalOrder +import org.junit.After +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test +import java.util.Date + +class ConversationSummaryTest { + @After + fun tearDown() { + PrivateMessageArrivalOrder.clear() + } + + @Test + fun `read offline conversation remains present`() { + val message = incoming("message", "alice", 100L) + PrivateMessageArrivalOrder.record(message.id) + + val conversations = buildConversationSummaries( + unreadConversationIDs = emptySet(), + privateChats = mapOf("alice-peer" to listOf(message)), + currentUserIdentifiers = setOf("me"), + canonicalize = { it }, + isMessageRead = { true } + ) + + assertEquals(1, conversations.size) + assertEquals("alice-peer", conversations.single().conversationID) + assertEquals(0, conversations.single().unreadCount) + assertFalse(conversations.single().isConnected) + } + + @Test + fun `canonical aliases yield one conversation with unique messages`() { + val first = incoming("first", "alice", 300L) + val second = incoming("second", "alice", 100L) + PrivateMessageArrivalOrder.record(first.id) + PrivateMessageArrivalOrder.record(second.id) + + val conversations = buildConversationSummaries( + unreadConversationIDs = setOf("mesh-alias"), + privateChats = mapOf( + "mesh-alias" to listOf(first), + "nostr_alias" to listOf(first, second) + ), + currentUserIdentifiers = setOf("me"), + canonicalize = { "contact_alice" }, + isMessageRead = { false } + ) + + assertEquals(1, conversations.size) + assertEquals(2, conversations.single().unreadCount) + assertEquals( + setOf("mesh-alias", "nostr_alias", "contact_alice"), + conversations.single().identityAliases + ) + assertEquals("alice", conversations.single().displayName) + assertEquals(DirectMessageTransport.NOSTR, conversations.single().transport) + } + + @Test + fun `online conversations sort before newer offline conversations`() { + val offline = summary( + id = "offline", + isConnected = false, + unreadCount = 3, + activity = 300L + ) + val onlineRead = summary( + id = "online-read", + isConnected = true, + unreadCount = 0, + activity = 100L + ) + val onlineUnread = summary( + id = "online-unread", + isConnected = true, + unreadCount = 1, + activity = 50L + ) + + assertEquals( + listOf("online-unread", "online-read", "offline"), + sortConversationSummaries(listOf(offline, onlineRead, onlineUnread)) + .map { it.conversationID } + ) + } + + @Test + fun `preview follows local arrival order instead of remote timestamp`() { + val first = incoming( + id = "first", + sender = "alice", + timestamp = 900L, + content = "older arrival" + ) + val second = incoming( + id = "second", + sender = "alice", + timestamp = 100L, + content = " latest\nmessage " + ) + PrivateMessageArrivalOrder.record(first.id) + PrivateMessageArrivalOrder.record(second.id) + + val conversation = buildConversationSummaries( + unreadConversationIDs = emptySet(), + privateChats = mapOf("alice-peer" to listOf(first, second)), + currentUserIdentifiers = setOf("me"), + canonicalize = { it }, + isMessageRead = { true } + ).single() + + assertEquals("latest message", conversation.latestMessagePreview) + assertEquals(BitchatMessageType.Message, conversation.latestMessageType) + } + + @Test + fun `file preview contains filename without local path`() { + val message = incoming( + id = "file", + sender = "alice", + timestamp = 100L, + content = "/private/conversations/quarterly report.pdf", + type = BitchatMessageType.File + ) + + val conversation = buildConversationSummaries( + unreadConversationIDs = emptySet(), + privateChats = mapOf("alice-peer" to listOf(message)), + currentUserIdentifiers = setOf("me"), + canonicalize = { it }, + isMessageRead = { true } + ).single() + + assertEquals("quarterly report.pdf", conversation.latestMessagePreview) + assertEquals(BitchatMessageType.File, conversation.latestMessageType) + } + + @Test + fun `case variants cannot create duplicate conversations or misclassify outgoing messages`() { + val outgoing = incoming( + id = "outgoing", + sender = "Me", + timestamp = 200L, + content = "sent by me" + ) + + val conversations = buildConversationSummaries( + unreadConversationIDs = emptySet(), + privateChats = mapOf( + "CONTACT_ALICE" to listOf(outgoing), + "contact_alice" to listOf(outgoing) + ), + currentUserIdentifiers = setOf("me"), + canonicalize = { it }, + isMessageRead = { true } + ) + + assertEquals(1, conversations.size) + assertEquals(setOf("contact_alice"), conversations.single().identityAliases) + assertEquals(true, conversations.single().latestMessageIsOutgoing) + } + + @Test + fun `outgoing messages remain outgoing after local nickname changes`() { + val outgoing = incoming( + id = "outgoing-before-rename", + sender = "old nickname", + timestamp = 200L, + content = "sent before rename" + ).copy(senderPeerID = "my-stable-peer-id") + + val conversation = buildConversationSummaries( + unreadConversationIDs = setOf("contact_alice"), + privateChats = mapOf("contact_alice" to listOf(outgoing)), + currentUserIdentifiers = setOf("new nickname", "my-stable-peer-id"), + canonicalize = { it }, + isMessageRead = { false }, + persistedUnreadCounts = emptyMap() + ).single() + + assertTrue(conversation.latestMessageIsOutgoing) + assertEquals(0, conversation.unreadCount) + } + + @Test + fun `connected nickname overrides cached conversation names`() { + assertEquals( + "Alice Renamed", + resolveConversationDisplayName( + fallbackName = "Alice From Message", + connectedPeerID = "peer-a", + peerNicknames = mapOf("peer-a" to "Alice Renamed"), + resolvedContactName = "Alice Favorite Snapshot", + persistedDisplayName = "Alice Persisted" + ) + ) + } + + @Test + fun `persisted nickname is used when no live or contact name remains`() { + assertEquals( + "Alice Persisted", + resolveConversationDisplayName( + fallbackName = "Alice From Message", + connectedPeerID = null, + peerNicknames = emptyMap(), + resolvedContactName = null, + persistedDisplayName = "Alice Persisted" + ) + ) + } + + @Test + fun `summary-only startup uses persisted unread count`() { + val latest = incoming("latest", "alice", 300L) + + val conversation = buildConversationSummaries( + unreadConversationIDs = setOf("contact_alice"), + privateChats = mapOf("contact_alice" to listOf(latest)), + currentUserIdentifiers = setOf("me"), + canonicalize = { it }, + isMessageRead = { false }, + persistedUnreadCounts = mapOf("contact_alice" to 47) + ).single() + + assertEquals(47, conversation.unreadCount) + } + + private fun incoming( + id: String, + sender: String, + timestamp: Long, + content: String = "hello", + type: BitchatMessageType = BitchatMessageType.Message + ) = BitchatMessage( + id = id, + sender = sender, + content = content, + type = type, + timestamp = Date(timestamp), + isPrivate = true + ) + + private fun summary( + id: String, + isConnected: Boolean, + unreadCount: Int, + activity: Long + ) = ConversationSummary( + conversationID = id, + displayName = id, + unreadCount = unreadCount, + latestMessageAt = activity, + latestActivityOrder = activity, + latestMessageType = BitchatMessageType.Message, + latestMessagePreview = "hello", + transport = DirectMessageTransport.MESH, + nostrPubkey = null, + identityAliases = setOf(id), + isConnected = isConnected + ) +} diff --git a/app/src/test/kotlin/com/bitchat/android/ui/LanguageCatalogContractTest.kt b/app/src/test/kotlin/com/bitchat/android/ui/LanguageCatalogContractTest.kt new file mode 100644 index 00000000..b8720e19 --- /dev/null +++ b/app/src/test/kotlin/com/bitchat/android/ui/LanguageCatalogContractTest.kt @@ -0,0 +1,72 @@ +package com.bitchat.android.ui + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Test +import java.io.File + +class LanguageCatalogContractTest { + private val resourcesDirectory = File("src/main/res") + + @Test + fun `locale config contains every shipped locale exactly once`() { + val shippedLanguageTags = resourcesDirectory + .listFiles() + .orEmpty() + .filter { it.isDirectory && it.name.startsWith("values-") } + .mapNotNull { directory -> directory.name.toLanguageTagOrNull() } + .toSet() + + val configuredLanguageTags = Regex("""android:name="([^"]+)"""") + .findAll(File(resourcesDirectory, "xml/locales_config.xml").readText()) + .map { match -> match.groupValues[1] } + .toList() + + assertEquals( + "Locale configuration must not contain duplicate entries", + configuredLanguageTags.toSet().size, + configuredLanguageTags.size, + ) + assertEquals(shippedLanguageTags, configuredLanguageTags.toSet()) + } + + @Test + fun `language picker strings exist in every locale pack`() { + val requiredKeys = setOf( + "about_language", + "about_app_language", + "about_system_default", + "about_select_language", + ) + + resourcesDirectory + .listFiles() + .orEmpty() + .filter { directory -> + directory.isDirectory && + (directory.name == "values" || directory.name.toLanguageTagOrNull() != null) + } + .forEach { directory -> + val strings = File(directory, "strings.xml").readText() + requiredKeys.forEach { key -> + assertTrue( + "$key is missing from ${directory.name}/strings.xml", + """name="$key""" in strings, + ) + } + } + } + + private fun String.toLanguageTagOrNull(): String? { + if (!startsWith("values-") || this == "values-night") return null + return removePrefix("values-") + .split("-") + .joinToString("-") { qualifier -> + if (qualifier.startsWith("r") && qualifier.length == 3) { + qualifier.drop(1) + } else { + qualifier + } + } + } +} diff --git a/app/src/test/kotlin/com/bitchat/android/ui/MediaSendingManagerMigrationTest.kt b/app/src/test/kotlin/com/bitchat/android/ui/MediaSendingManagerMigrationTest.kt index 6d6b1b1f..51204f30 100644 --- a/app/src/test/kotlin/com/bitchat/android/ui/MediaSendingManagerMigrationTest.kt +++ b/app/src/test/kotlin/com/bitchat/android/ui/MediaSendingManagerMigrationTest.kt @@ -6,7 +6,11 @@ import com.bitchat.android.mesh.PreparedPrivateMediaTransfer import com.bitchat.android.mesh.PrivateMediaPreparation import com.bitchat.android.mesh.PrivateMediaWireMode import com.bitchat.android.model.BitchatMessageType +import com.bitchat.android.model.DeliveryStatus +import com.bitchat.android.services.AppStateStore import com.bitchat.android.services.ContactIdentityResolver +import com.bitchat.android.services.ConversationRepository +import com.bitchat.android.services.InMemoryConversationStorageCipher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob @@ -32,6 +36,7 @@ import java.util.concurrent.Executors import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicReference +import java.util.UUID @RunWith(RobolectricTestRunner::class) class MediaSendingManagerMigrationTest { @@ -40,11 +45,22 @@ class MediaSendingManagerMigrationTest { private lateinit var mesh: MeshService private lateinit var manager: MediaSendingManager private lateinit var file: File + private lateinit var conversationRepository: ConversationRepository + private lateinit var conversationDatabaseName: String @Before fun setup() { state = ChatState(CoroutineScope(SupervisorJob() + Dispatchers.Unconfined)) state.setNickname("me") + conversationDatabaseName = "media-send-${UUID.randomUUID()}.db" + conversationRepository = ConversationRepository( + context = org.robolectric.RuntimeEnvironment.getApplication(), + dispatcher = Dispatchers.Unconfined, + databaseName = conversationDatabaseName, + storageCipher = InMemoryConversationStorageCipher() + ) + AppStateStore.clear() + AppStateStore.setConversationRepositoryForTest(conversationRepository) mesh = mock() whenever(mesh.myPeerID).thenReturn("0011223344556677") whenever(mesh.getPeerNicknames()).thenReturn(mapOf(peerID to "old peer")) @@ -63,6 +79,11 @@ class MediaSendingManagerMigrationTest { @After fun tearDown() { + AppStateStore.clear() + AppStateStore.setConversationRepositoryForTest(null) + conversationRepository.closeForTest() + org.robolectric.RuntimeEnvironment.getApplication() + .deleteDatabase(conversationDatabaseName) file.delete() } @@ -362,7 +383,7 @@ class MediaSendingManagerMigrationTest { } @Test - fun `failed prepared commit rolls back the local file echo`() { + fun `failed prepared commit keeps a retryable failed local file echo`() { whenever(mesh.prepareFilePrivate(eq(peerID), any(), any(), eq(false))) .thenAnswer { invocation -> PrivateMediaPreparation.Ready( @@ -378,9 +399,13 @@ class MediaSendingManagerMigrationTest { manager.sendImageNote(peerID, null, file.absolutePath) val messages = state.privateChats.value[peerID].orEmpty() - assertEquals(1, messages.size) - assertTrue(messages.single().content.contains("could not be committed")) - assertTrue(messages.none { it.type == com.bitchat.android.model.BitchatMessageType.Image }) + assertEquals(2, messages.size) + val fileEcho = messages.single { it.type == BitchatMessageType.Image } + assertTrue(fileEcho.deliveryStatus is DeliveryStatus.Failed) + assertTrue( + messages.single { it.sender == "system" } + .content.contains("could not be committed") + ) } @Test diff --git a/app/src/test/kotlin/com/bitchat/android/ui/MeshDelegateHandlerStateContractTest.kt b/app/src/test/kotlin/com/bitchat/android/ui/MeshDelegateHandlerStateContractTest.kt index 162a5ef6..1bd4f61c 100644 --- a/app/src/test/kotlin/com/bitchat/android/ui/MeshDelegateHandlerStateContractTest.kt +++ b/app/src/test/kotlin/com/bitchat/android/ui/MeshDelegateHandlerStateContractTest.kt @@ -66,14 +66,12 @@ class MeshDelegateHandlerStateContractTest { assertEquals(listOf("peer-a", "peer-b"), state.connectedPeers.value) assertTrue(state.isConnected.value) - verify(notifications).showActiveUserNotification(listOf("peer-a", "peer-b")) verify(channels).cleanupDisconnectedMembers(listOf("peer-a", "peer-b"), "self") handler.didUpdatePeerList(emptyList()) assertTrue(state.connectedPeers.value.isEmpty()) assertFalse(state.isConnected.value) - verify(notifications).showActiveUserNotification(emptyList()) } @Test diff --git a/build.gradle.kts b/build.gradle.kts index 5aac5518..16bf6428 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.api.artifacts.dsl.LockMode + // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { alias(libs.plugins.android.application) apply false @@ -5,6 +7,39 @@ plugins { alias(libs.plugins.kotlin.compose) apply false } +val resolveIdeRuntimeClasspathCopyLocks = tasks.register("resolveIdeRuntimeClasspathCopyLocks") { + group = "build setup" + description = "Resolves Android Studio runtime classpath copies when refreshing lock state." +} + +subprojects { + dependencyLocking { + lockAllConfigurations() + lockMode.set(LockMode.STRICT) + } + + pluginManager.withPlugin("com.android.application") { + val resolveIdeRuntimeClasspathCopyLock = tasks.register("resolveIdeRuntimeClasspathCopyLock") { + group = "build setup" + description = "Resolves this module's Android Studio runtime classpath copies." + notCompatibleWithConfigurationCache("Resolves copied configurations at execution time") + doFirst { + check(gradle.startParameter.isWriteDependencyLocks) { + "$path must be run with --write-locks" + } + } + doLast { + listOf("debugRuntimeClasspath", "releaseRuntimeClasspath").forEach { configurationName -> + configurations.getByName(configurationName).copy().resolve() + } + } + } + resolveIdeRuntimeClasspathCopyLocks.configure { + dependsOn(resolveIdeRuntimeClasspathCopyLock) + } + } +} + tasks.whenTaskAdded { if (name.contains("ArtProfile")) { enabled = false diff --git a/docs/maintainer-release-guide.md b/docs/maintainer-release-guide.md new file mode 100644 index 00000000..991cc520 --- /dev/null +++ b/docs/maintainer-release-guide.md @@ -0,0 +1,588 @@ +# Android maintainer release guide + +This is the operational runbook for publishing a Bitchat Android release to +GitHub and Google Play. Follow it from top to bottom for every release. + +The central rule is: + +> GitHub Actions builds and attests the unsigned release. A maintainer signs +> those exact files locally. Nothing is rebuilt after the tag. + +No keystore or password is stored in GitHub, GitHub Actions, the repository, +release notes, or workflow artifacts. + +This runbook currently releases only the phone app, `com.bitchat.droid`. +The `:wear` module is tested and dependency-locked in CI but is not included in +the canonical release artifact set. Do not publish its development-signed +outputs. Wear distribution requires a separate signing identity, reproducible +artifact contract, Play listing, and maintainer runbook. + +For the technical trust model and third-party verification instructions, see +[Reproducible builds](reproducible-builds.md). + +## Release flow + +| Stage | Where it happens | Result | +|---|---|---| +| Approve source | Pull requests and the release gate | One reviewed commit on `main` | +| Create tag | Maintainer machine | Signed `vX.Y.Z` tag | +| Build twice | GitHub Actions | Two identical unsigned APK/AAB builds | +| Promote build | GitHub Actions | Attested `verified-unsigned-release` artifact | +| Sign | Maintainer machine | Three installable APKs and one Play upload AAB | +| Test Play build | Play Console internal track | Play-generated APKs tested before public rollout | +| Prepare release | Maintainer machine and GitHub draft | Checksummed public release assets | +| Publish | GitHub Releases and Play Console | Public GitHub release and promoted Play rollout | + +## What the signing identities mean + +These are four separate signing identities: + +1. **Git tag signature**: identifies the maintainer who approved the source + commit. It is created locally by `git tag -s`. +2. **GitHub APK signature**: lets Android install and update the APKs published + on GitHub. Use the existing GitHub release key. Its certificate SHA-256 must + match `BITCHAT_GITHUB_RELEASE_CERT_SHA256` in `gradle.properties`. +3. **Play upload signature**: the maintainer signs the AAB with the Play upload + key so Play will accept it. +4. **Play app signature**: Google generates device APKs and signs them with the + separate Play app-signing key. + +APK and AAB signatures are embedded in those files. Do not create or publish +detached `.sig` files. GitHub build-provenance attestations are stored by GitHub +and verified with `gh attestation verify`; they are not release asset files. + +Never request, export, or use Google's Play app-signing private key during this +process. + +## Prerequisites + +### Access + +The maintainer needs: + +- permission to push a release tag and create GitHub Releases; +- a GitHub CLI login authorized for + `permissionlesstech/bitchat-android`; +- Play Console permission to create and promote releases for + `com.bitchat.droid`; and +- access to the project's release approval record. + +Check the GitHub login: + +```bash +gh auth status +``` + +### Local tools + +Install: + +- Git; +- [GitHub CLI](https://cli.github.com/); +- the exact JDK in `tools/reproducible-builds/TOOLCHAIN.env`; +- Android SDK Build Tools 37.0.0, including `apksigner` and `zipalign`; and +- Docker with Linux/amd64 support if doing the optional independent rebuild. + +Android Studio's SDK Manager can install the required Build Tools version. +Select **SDK Tools**, enable **Show Package Details**, and install 37.0.0. + +Load the toolchain pins and check the local tools: + +```bash +export JAVA_HOME=/secure/path/to/jdk-21 +export ANDROID_SDK_ROOT=/secure/path/to/android-sdk +source tools/reproducible-builds/TOOLCHAIN.env +gh --version +"$JAVA_HOME/bin/java" -version +"$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner" version +"$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/zipalign" -h +``` + +The JDK output must match `JAVA_VERSION`; the Android path must use +`ANDROID_BUILD_TOOLS_VERSION`. + +### Local key material + +Keep these in a password manager or encrypted offline storage: + +- the existing GitHub APK release keystore, alias, store password, and key + password; +- the Play upload keystore, alias, store password, and key password; and +- the maintainer's configured Git tag signing key. + +The GitHub APK key and Play upload key may be different. Treat them as different +credentials even if the project's historical setup placed them in one +keystore. + +Do not put a keystore inside the repository checkout. Do not place passwords on +a command line, in a shell profile, or in a release-notes file. + +## 1. Prepare and approve the release commit + +1. Update `versionCode` and `versionName` in `app/build.gradle.kts`. + `versionCode` must be greater than every build previously uploaded to Play. + `versionName` must match the release tag without the leading `v`. +2. Merge all intended release changes into `main`. +3. Confirm required CI checks are green. +4. Complete the + [physical-device and cross-client release gate](release-gate-runbook.md). + Keep its privacy-reviewed evidence in the release approval record; do not + attach raw device identifiers or logs to the public release. +5. Confirm the release notes and user-visible Play changelog are ready. + +Start from a clean, current checkout: + +```bash +git switch main +git pull --ff-only +git status --short +git log -1 --oneline +``` + +`git status --short` must print nothing. + +Set shell variables for the rest of the release: + +```bash +export REPOSITORY=permissionlesstech/bitchat-android +export TAG=vX.Y.Z +export VERSION_CODE=NN +export RELEASE_DIR="release-${TAG#v}" +``` + +Confirm the source version: + +```bash +grep -nE 'versionCode|versionName' app/build.gradle.kts +test "$(sed -n 's/.*versionName = "\([^"]*\)".*/\1/p' app/build.gradle.kts)" = "${TAG#v}" +test "$(sed -n 's/.*versionCode = \([0-9][0-9]*\).*/\1/p' app/build.gradle.kts)" = "$VERSION_CODE" +``` + +Stop if either `test` command fails. + +## 2. Create and push the release tag + +Create a signed annotated tag on the approved commit: + +```bash +git tag -s "$TAG" -m "Bitchat Android $TAG" +git tag -v "$TAG" +git push origin "$TAG" +``` + +Do not create the GitHub Release yet. Pushing the tag starts the `Release` +workflow, which checks out that exact tag. + +Never move or replace a release tag after pushing it. If source must change, +increment `versionCode`, create a new version, and use a new tag. + +## 3. Wait for the reproducible GitHub build + +Find the `Release` workflow run: + +```bash +gh run list \ + --repo "$REPOSITORY" \ + --workflow release.yml \ + --limit 20 +``` + +Copy the run ID for `$TAG`, then: + +```bash +export RUN_ID=123456789 +gh run watch "$RUN_ID" --repo "$REPOSITORY" --exit-status +gh run view "$RUN_ID" --repo "$REPOSITORY" +``` + +The run is successful only when: + +- both independent unsigned build jobs pass; +- the byte-for-byte comparison passes; +- provenance attestation succeeds; and +- `verified-unsigned-release` is uploaded. + +If the tag already existed and the workflow must be dispatched manually, run +it against the tag ref: + +```bash +gh workflow run release.yml \ + --repo "$REPOSITORY" \ + --ref "$TAG" \ + -f tag="$TAG" +``` + +The workflow rejects a dispatch from a different ref because that would produce +incorrect provenance. + +### Accessing the artifacts + +With the CLI: + +```bash +test ! -e "$RELEASE_DIR" +gh run download "$RUN_ID" \ + --repo "$REPOSITORY" \ + --name verified-unsigned-release \ + --dir "$RELEASE_DIR" +``` + +In the GitHub web interface: + +1. Open **Actions** in the repository. +2. Open the **Release** workflow run for `$TAG`. +3. Scroll to **Artifacts**. +4. Download **verified-unsigned-release**. + +Do not sign `unsigned-release-a` or `unsigned-release-b`. Those are the two +replicas retained for diagnostics. Only `verified-unsigned-release` passed the +comparison gate. Workflow artifacts expire after 30 days, so finish the release +before then. + +## 4. Verify the downloaded unsigned release + +The directory must initially contain exactly these canonical files: + +- `BUILDINFO.json` +- `SHA256SUMS.unsigned` +- `bitchat-android-arm64-unsigned.apk` +- `bitchat-android-armv7-unsigned.apk` +- `bitchat-android-universal-unsigned.apk` +- `bitchat-android-x86-unsigned.apk` +- `bitchat-android-x86_64-unsigned.apk` +- `bitchat-android-release-unsigned.aab` + +Verify the checksum manifest: + +```bash +( + cd "$RELEASE_DIR" + if command -v sha256sum >/dev/null 2>&1; then + sha256sum -c SHA256SUMS.unsigned + else + shasum -a 256 -c SHA256SUMS.unsigned + fi +) +``` + +Verify that `BUILDINFO.json` identifies the tag commit: + +```bash +TAG_COMMIT="$(git rev-list -n 1 "$TAG")" +ARTIFACT_COMMIT="$( + sed -n 's/.*"sourceCommit": *"\([^"]*\)".*/\1/p' \ + "$RELEASE_DIR/BUILDINFO.json" +)" +test "$TAG_COMMIT" = "$ARTIFACT_COMMIT" +``` + +Verify GitHub's provenance for every unsigned APK and AAB: + +```bash +for artifact in \ + "$RELEASE_DIR"/*-unsigned.apk \ + "$RELEASE_DIR"/*-unsigned.aab +do + gh attestation verify "$artifact" --repo "$REPOSITORY" +done +``` + +Stop immediately if a checksum, commit, or attestation check fails. + +## 5. Sign the GitHub APKs locally + +Set the SDK and GitHub release-key locations. Load passwords from the password +manager without placing their values in shell history: + +```bash +export ANDROID_SDK_ROOT=/secure/path/to/android-sdk +export BITCHAT_GITHUB_KEYSTORE=/secure/path/to/github-release.jks +export BITCHAT_GITHUB_KEY_ALIAS=release-key-alias + +printf 'GitHub keystore password: ' +IFS= read -r -s BITCHAT_GITHUB_KEYSTORE_PASSWORD +printf '\nGitHub key password: ' +IFS= read -r -s BITCHAT_GITHUB_KEY_PASSWORD +printf '\n' +export BITCHAT_GITHUB_KEYSTORE_PASSWORD +export BITCHAT_GITHUB_KEY_PASSWORD +``` + +Run: + +```bash +tools/reproducible-builds/sign-release.sh "$RELEASE_DIR" +``` + +The helper: + +- re-verifies `SHA256SUMS.unsigned`; +- uses the pinned Android Build Tools; +- signs each selected APK twice and requires identical results; +- verifies the embedded APK signatures; +- rejects a key whose certificate fingerprint does not match the pinned + GitHub release certificate; and +- writes `SHA256SUMS`. + +It creates: + +- `bitchat-android-arm64.apk` +- `bitchat-android-universal.apk` +- `bitchat-android-x86_64.apk` + +The unsigned armv7 and x86 APKs remain available for reproducibility, but are +not published as signed install targets under the current release policy. + +If the helper stops after creating any signed file, do not continue or overwrite +files manually. Start again in a new directory downloaded from the same +successful workflow run. + +## 6. Sign the Google Play AAB locally + +Set the pinned JDK and Play upload-key locations, then load the passwords: + +```bash +export JAVA_HOME=/secure/path/to/jdk-21 +export BITCHAT_PLAY_UPLOAD_KEYSTORE=/secure/path/to/play-upload.jks +export BITCHAT_PLAY_UPLOAD_KEY_ALIAS=upload-key-alias + +printf 'Play upload keystore password: ' +IFS= read -r -s BITCHAT_PLAY_KEYSTORE_PASSWORD +printf '\nPlay upload key password: ' +IFS= read -r -s BITCHAT_PLAY_KEY_PASSWORD +printf '\n' +export BITCHAT_PLAY_KEYSTORE_PASSWORD +export BITCHAT_PLAY_KEY_PASSWORD +``` + +Run: + +```bash +tools/reproducible-builds/sign-play-bundle.sh "$RELEASE_DIR" +``` + +The helper creates `bitchat-android-play-upload.aab`, verifies its JAR +signature, proves that every non-signature payload entry matches the canonical +unsigned AAB, and updates `SHA256SUMS`. + +This is the only file to upload to Play Console: + +```text +release-X.Y.Z/bitchat-android-play-upload.aab +``` + +Do not upload an APK or `bitchat-android-release-unsigned.aab` to Play. Do not +open Android Studio and rebuild the bundle. + +Remove passwords from the environment after both signing steps: + +```bash +unset BITCHAT_GITHUB_KEYSTORE_PASSWORD +unset BITCHAT_GITHUB_KEY_PASSWORD +unset BITCHAT_PLAY_KEYSTORE_PASSWORD +unset BITCHAT_PLAY_KEY_PASSWORD +``` + +## 7. Prepare all GitHub Release assets + +Run: + +```bash +tools/reproducible-builds/prepare-github-release.sh "$RELEASE_DIR" +``` + +The helper verifies all checksums and renames the public build information and +checksum manifests. It refuses missing or pre-existing release files. + +The final GitHub Release must contain all 13 files below: + +| Asset | Signed? | Why it is published | +|---|---:|---| +| `bitchat-android-arm64.apk` | APK release key | Primary direct-install APK | +| `bitchat-android-universal.apk` | APK release key | Fallback direct-install APK | +| `bitchat-android-x86_64.apk` | APK release key | x86_64 install APK | +| Five `bitchat-android-*-unsigned.apk` files | No | Reproducibility inputs for every ABI target | +| `bitchat-android-release-unsigned.aab` | No | Canonical reproducible Play input | +| `bitchat-android-play-upload.aab` | Play upload key | Exact bundle uploaded to Play | +| `BITCHAT_BUILDINFO.json` | GitHub attestation | Source commit and pinned toolchain | +| `BITCHAT_SHA256SUMS.unsigned` | GitHub attestation | Original canonical CI manifest | +| `BITCHAT_SHA256SUMS` | No detached signature | SHA-256 for every published asset | + +Run the public checksum verification once more: + +```bash +( + cd "$RELEASE_DIR" + if command -v sha256sum >/dev/null 2>&1; then + sha256sum -c BITCHAT_SHA256SUMS + else + shasum -a 256 -c BITCHAT_SHA256SUMS + fi +) +``` + +Do not add keystores, certificate exports, passwords, raw release-gate logs, +local paths, or device/user identifiers to this directory. + +## 8. Create release notes and a draft GitHub Release + +Create a local release-notes file. At minimum it must contain: + +```markdown +## Bitchat Android vX.Y.Z + +- Version code: NN +- Source tag: vX.Y.Z +- GitHub APK signing certificate SHA-256: FINGERPRINT +- Play upload certificate SHA-256: FINGERPRINT +- Play app-signing certificate SHA-256: FINGERPRINT + +Checksums, canonical unsigned APK/AAB inputs, the exact Play upload AAB, and +build information are attached. See `docs/reproducible-builds.md` for public +verification instructions. + +## Changes + +- User-visible change +``` + +The GitHub APK fingerprint comes from `gradle.properties`. Obtain both Play +certificate fingerprints from **Play Console > Setup > App integrity**. Publish +only the SHA-256 fingerprints, not certificate subject details or private-key +material. + +Create a draft release and upload every prepared asset: + +```bash +gh release create "$TAG" "$RELEASE_DIR"/* \ + --repo "$REPOSITORY" \ + --verify-tag \ + --draft \ + --title "Bitchat Android $TAG" \ + --notes-file "release-notes-$TAG.md" +``` + +`--verify-tag` prevents `gh` from silently creating a tag at the wrong commit. +GitHub automatically exposes source archives for the tag; do not upload separate +source ZIP or tar files. + +Inspect the draft: + +```bash +gh release view "$TAG" --repo "$REPOSITORY" --web +``` + +Keep it as a draft until the Play internal-track checks below pass. + +## 9. Upload and test the AAB in Google Play + +1. Open Play Console and select `com.bitchat.droid`. +2. Open **Test and release > Testing > Internal testing**. +3. Create a new release. +4. Upload exactly: + `release-X.Y.Z/bitchat-android-play-upload.aab`. +5. Confirm Play accepts the upload signature and reports the expected package, + `versionCode`, and `versionName`. +6. Add the user-visible Play release notes. +7. Resolve blocking Play checks, save the release, and start the internal + rollout. +8. Install the build through the internal-test opt-in link on a representative + physical device. Confirm startup, upgrade from the previous public release, + networking, and the release-critical scenarios. +9. In **App bundle explorer**, select the uploaded version. If the account + permits downloading the original AAB, download it and verify that its digest + matches `bitchat-android-play-upload.aab` in `BITCHAT_SHA256SUMS`. +10. In **Setup > App integrity**, confirm the Play app-signing certificate + SHA-256 is the value recorded in the GitHub release notes. + +Promote this same tested Play release from internal testing to production. +Do not rebuild or upload a second AAB for production. Use a staged production +rollout when appropriate. + +Google signs the device APKs with the Play app-signing key, so Play-delivered +APKs will not be byte-identical to the GitHub APKs. That is expected. + +## 10. Publish GitHub and promote Play + +After the internal Play build passes and the GitHub draft has all 13 assets: + +```bash +gh release edit "$TAG" \ + --repo "$REPOSITORY" \ + --draft=false \ + --latest +``` + +Then complete or schedule the production promotion in Play Console. If managed +publishing is enabled, send the approved changes for review and publish them at +the coordinated release time. + +Do not replace assets after the GitHub Release is public. If any published +binary is wrong, create a new version and release. + +## 11. Verify the public release + +From a clean checkout of the tag: + +```bash +git checkout "$TAG" +tools/reproducible-builds/verify-github-release.sh "$TAG" --no-rebuild +``` + +For the strongest check, omit `--no-rebuild` and let the pinned container +rebuild and compare all unsigned artifacts: + +```bash +tools/reproducible-builds/verify-github-release.sh "$TAG" +``` + +Also verify: + +- the GitHub release is marked **Latest**; +- the three signed APKs install and show the expected version; +- the Play listing shows the intended production version and rollout state; +- a Play-installed build is signed by the app-signing certificate recorded in + the release notes; and +- the final GitHub URL and Play status are added to the internal release + approval record. + +## Failure and retry rules + +- **A GitHub build or comparison fails:** do not sign anything. Fix the source, + increment the version, and create a new tag. Rerun the same tag only for an + infrastructure-only failure that did not change source. +- **A checksum, provenance, or commit check fails:** stop. Do not publish. +- **A local signing helper fails:** use a fresh download directory. Do not + overwrite partially created signed artifacts. +- **Play rejects the upload key:** stop and resolve the registered upload key in + Play Console. Never substitute the app-signing key. +- **Play has accepted the version code but the binary must change:** increment + `versionCode` and create a new release. +- **A GitHub draft is wrong:** keep it private while correcting it from a fresh, + verified artifact directory. +- **A public release is wrong:** do not move the tag or replace assets. Publish + a new version. + +## Final checklist + +- [ ] Version name and version code updated and approved +- [ ] Required CI and physical-device release gate passed +- [ ] Signed tag pushed from the approved commit +- [ ] `Release` workflow and two-build comparison passed +- [ ] `verified-unsigned-release` downloaded by run ID +- [ ] Checksums, source commit, and attestations verified +- [ ] GitHub APKs signed locally with the pinned certificate +- [ ] Play AAB signed locally with the registered upload key +- [ ] `BITCHAT_SHA256SUMS` verifies all 13 release assets +- [ ] GitHub draft created with certificate fingerprints and all assets +- [ ] Exact signed AAB uploaded to and tested on Play internal track +- [ ] GitHub Release published +- [ ] Same tested Play release promoted to production +- [ ] Public GitHub and Play verification completed + +## Official references + +- [GitHub CLI: download workflow artifacts](https://cli.github.com/manual/gh_run_download) +- [GitHub CLI: create a release](https://cli.github.com/manual/gh_release_create) +- [Google Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756) +- [Play Console App bundle explorer](https://support.google.com/googleplay/android-developer/answer/9859152) diff --git a/docs/release-gate-runbook.md b/docs/release-gate-runbook.md index 00fdc98e..c8de2c55 100644 --- a/docs/release-gate-runbook.md +++ b/docs/release-gate-runbook.md @@ -296,6 +296,7 @@ python3 tools/release_gate/mesh_lab.py scenario all \ | Scenario | What it asserts | |---|---| | `dm` | Noise handshake both ways, encrypted DM round trips with content match | +| `favorite_verification` | favorite signal, orange-outline/filled mutual state, and peer fingerprint verification | | `broadcast` | public mesh message A→B | | `file` | 1 KB broadcast file, receiver SHA-256 matches fixture | | `file_oversize` | >256-fragment broadcast file is rejected sender-side, receiver sees nothing | @@ -323,7 +324,8 @@ python3 tools/release_gate/mesh_lab.py cmd --serial state # full mesh See `TestHookDriver.kt` for the full command set (`ping`, `start`, `stop`, `whoami`, `set_nickname`, `scan`, `peers`, `connect`, `handshake`, `session`, -`announce`, `broadcast_msg`, `dm_send`, `dm_recv`, `msg_recv`, `file_send`, +`announce`, `broadcast_msg`, `dm_send`, `dm_recv`, `msg_recv`, `favorite_set`, +`favorite_status`, `verification_set`, `verification_status`, `file_send`, `file_recv`, `file_cancel`, `raw_send`, `ble`, `state`, `clear_results`). ### Troubleshooting diff --git a/docs/reproducible-builds.md b/docs/reproducible-builds.md new file mode 100644 index 00000000..3d94e8f1 --- /dev/null +++ b/docs/reproducible-builds.md @@ -0,0 +1,273 @@ +# Reproducible builds + +Bitchat's canonical phone-app release build produces byte-for-byte reproducible +unsigned APKs and an unsigned Android App Bundle (AAB). CI builds the release +twice in independent jobs and exposes a verified release artifact only when +every canonical byte matches. The `:wear` module is tested and +dependency-locked but is outside this phone artifact contract until a separate +Wear release and signing process is defined. + +Signing remains local: no keystore or signing password is stored in or exposed +to GitHub Actions. Anyone can reproduce the unsigned artifacts; maintainers +download the verified CI output, sign the selected GitHub APKs and Play upload +AAB locally, then manually publish those exact files. + +Maintainers should use the complete +[Android maintainer release guide](maintainer-release-guide.md) for the +step-by-step release procedure, artifact inventory, local signing commands, and +GitHub/Google Play publication checklist. + +## What is pinned + +- Gradle wrapper version and distribution SHA-256 +- dependency versions, strict Gradle dependency locks, and downloaded-artifact + SHA-256 verification metadata +- exact Temurin JDK release and digest-pinned Linux builder image +- Android platform, Platform Tools, and Build Tools archives by filename and + SHA-256, plus the accepted SDK license-text SHA-1 required to use them +- Kotlin/JVM toolchain and bytecode target +- Arti source tag and full commit, stable native build epoch, Rust, `cargo-ndk`, + Android NDK, Cargo lockfile, digest-pinned Rust builder image, and immutable + Debian package snapshot +- immutable full commit SHAs for every third-party GitHub Action + +The build uses a clean source tree, an isolated Gradle user home, UTC, a stable +locale, `SOURCE_DATE_EPOCH` from the Git commit, no Gradle build or configuration +cache, fresh tasks, and a non-incremental in-process Kotlin compiler. Native +builds remap source paths and release validation rejects host paths in packaged +libraries. The container overlays a canonical `local.properties`, so an ignored +Android Studio file cannot redirect Gradle to a host-specific SDK. + +AGP's embedded VCS record is disabled because its Git discovery depends on the +host checkout layout. The canonical `BUILDINFO.json` and GitHub provenance +attestation record the host-verified commit instead. + +The authoritative pins are: + +- `gradle/wrapper/gradle-wrapper.properties` +- `gradle/libs.versions.toml` +- `settings-gradle.lockfile` +- `app/gradle.lockfile` +- `wear/gradle.lockfile` +- `gradle/verification-metadata.xml` +- `tools/reproducible-builds/TOOLCHAIN.env` +- `tools/arti-build/TOOLCHAIN.env` +- `tools/arti-build/Cargo.lock` + +## Reproduce a release locally + +Requirements are Git, Docker with Linux/amd64 support, and enough free space for +the Android and Gradle images and dependencies. + +```bash +git clone https://github.com/permissionlesstech/bitchat-android.git +cd bitchat-android +git checkout vX.Y.Z +tools/reproducible-builds/build-in-container.sh \ + .reproducible-build/local-vX.Y.Z +``` + +The output contains: + +- unsigned APKs for arm64, armv7, x86, x86_64, and universal installs +- `bitchat-android-release-unsigned.aab` +- `BUILDINFO.json` +- `SHA256SUMS.unsigned` + +The output directory must not already contain files. The script rejects a dirty +checkout so the commit in `BUILDINFO.json` identifies all source inputs. + +To test reproducibility yourself, build into two empty directories and compare: + +```bash +BITCHAT_CONTAINER_GRADLE_HOME_NAME=gradle-home-first \ + tools/reproducible-builds/build-in-container.sh .reproducible-build/first +BITCHAT_CONTAINER_GRADLE_HOME_NAME=gradle-home-second \ + tools/reproducible-builds/build-in-container.sh .reproducible-build/second +tools/reproducible-builds/compare-release.sh \ + .reproducible-build/first \ + .reproducible-build/second +``` + +If a comparison fails and `diffoscope` is installed, the comparison script +automatically reports the first differing artifact. + +## Verify a GitHub release + +Install the GitHub CLI, authenticate it if necessary, check out the release tag, +and run: + +```bash +git checkout vX.Y.Z +tools/reproducible-builds/verify-github-release.sh vX.Y.Z +``` + +That command: + +1. downloads all release APKs, the AAB, build information, and checksum files; +2. verifies the canonical unsigned build's GitHub artifact-attestation subjects + against this repository; +3. verifies `BITCHAT_SHA256SUMS`; +4. checks that the local source commit is the release commit; +5. rebuilds in the pinned container; and +6. byte-compares every unsigned APK, the unsigned AAB, build information, and + the unsigned checksum manifest. + +To verify the published checksums and attestations without rebuilding: + +```bash +tools/reproducible-builds/verify-github-release.sh vX.Y.Z --no-rebuild +``` + +For a manual signature check, use the exact `apksigner` from Android Build Tools +37.0.0: + +```bash +apksigner verify --verbose --print-certs bitchat-android-universal.apk +``` + +Compare the reported signer certificate SHA-256 with +`BITCHAT_GITHUB_RELEASE_CERT_SHA256` in `gradle.properties`. A matching +certificate proves who signed the APK; the checksum, attestation, and local +unsigned rebuild establish which source and build produced it. A third party +cannot recreate the signed bytes without the private release key. + +You can also prove that the signed APK contains the same archive entries and +uncompressed payload bytes as the reproduced unsigned APK: + +```bash +tools/reproducible-builds/compare-archive-payloads.sh \ + .reproducible-build/local-vX.Y.Z/bitchat-android-universal-unsigned.apk \ + bitchat-android-universal.apk +``` + +GitHub's manual equivalents are: + +```bash +gh release download vX.Y.Z +sha256sum -c BITCHAT_SHA256SUMS +gh attestation verify bitchat-android-universal-unsigned.apk \ + --repo permissionlesstech/bitchat-android +``` + +## Verify a Google Play release + +Google Play App Signing changes the verification boundary: + +- maintainers upload a signed AAB using the upload key; +- Google Play generates optimized, device-specific APK splits from that AAB; +- Google signs the delivered APKs with the app-signing key. + +Consequently, a Play-delivered APK is not expected to be byte-identical to the +GitHub universal APK or to a locally built APK. Use this procedure instead: + +1. In Play Console, open **Test and release > App bundle explorer**, select the + release/version code, and download the original app bundle if that option is + available to your account. Compare its unsigned payload with the reproduced + `bitchat-android-release-unsigned.aab`: + + ```bash + tools/reproducible-builds/compare-archive-payloads.sh \ + .reproducible-build/local-vX.Y.Z/bitchat-android-release-unsigned.aab \ + downloaded-from-play.aab + ``` + + The helper excludes JAR-signing metadata and compares every other entry name + and uncompressed byte. +2. In **Setup > App integrity**, record the SHA-256 fingerprint under **App + signing key certificate**. This is different from the upload-key certificate + and may be different from the GitHub release certificate. +3. In App bundle explorer, download the Play-generated universal APK or the APKs + for a representative device. Verify each APK: + + ```bash + apksigner verify --verbose --print-certs downloaded-from-play.apk + ``` + + The signer SHA-256 must equal the Play Console app-signing certificate. +4. Confirm package name `com.bitchat.droid`, version code, version name, and + manifest/security configuration with Android's `apkanalyzer` or `aapt2`. +5. Recreate Google's split-generation behavior from the reproduced AAB with the + same `bundletool` version and a saved device specification: + + ```bash + bundletool build-apks \ + --bundle=bitchat-android-release-unsigned.aab \ + --output=local.apks \ + --device-spec=device.json + ``` + +This last check validates bundle-to-APK behavior, but it is not a byte-equality +claim: Play's server-side `bundletool` version, optimization, and signing inputs +are controlled by Google. The strongest public Play verification requires +maintainers to retain the uploaded AAB, publish its digest and provenance, and +record the Play version code and app-signing certificate fingerprint alongside +the release. + +The GitHub workflow builds and attests the canonical unsigned AAB. A maintainer +locally creates `bitchat-android-play-upload.aab` from that exact file and +uploads it manually to Google Play. + +## Maintainer release process + +Follow the +[Android maintainer release guide](maintainer-release-guide.md). It is the +authoritative operational runbook from version preparation through the signed +tag, GitHub Actions artifact download, local APK/AAB signing, GitHub draft, +Play internal test, public rollout, and post-release verification. + +The workflow has no signing secrets and never publishes a release by itself. + +## Updating dependencies or toolchains + +Dependency changes must update and review both the lock state and verification +metadata: + +```bash +./gradlew testDebugUnitTest lintDebug resolveIdeRuntimeClasspathCopyLocks \ + --write-locks \ + --write-verification-metadata sha256 +``` + +`resolveIdeRuntimeClasspathCopyLocks` records the transient runtime classpath +copies that Android Studio resolves during model import. Their selected versions +are persisted under the generated copy configuration names while the canonical +debug and release runtime classpaths remain strictly locked. + +Generate release lock entries in separate invocations because split APK and AAB +intermediates cannot coexist: + +```bash +./gradlew :app:clean :app:bundleRelease \ + --write-locks \ + --write-verification-metadata sha256 +./gradlew :app:clean :app:assembleRelease \ + --write-locks \ + --write-verification-metadata sha256 +``` + +Review every new repository, component, artifact name, version, and checksum. +Do not accept verification metadata generated after an unexplained checksum +failure. + +The verification metadata deliberately trusts only IDE documentation and source +attachments (`*-javadoc.jar`, `*-sources.jar`, and Gradle's `*-src.zip`). Android +Studio resolves these outside the build dependency graph, and they are not build +inputs. Compiled artifacts and dependency metadata remain checksum-verified. + +When changing Gradle, update the wrapper and independently verify the new +distribution SHA-256. When changing JDK or Android tools, update the exact +version, archive checksum, and base-image digest together. Native updates follow +[`tools/arti-build/README.md`](../tools/arti-build/README.md). + +## References + +- [Gradle dependency locking](https://docs.gradle.org/current/userguide/dependency_locking.html) +- [Gradle dependency verification](https://docs.gradle.org/current/userguide/dependency_verification.html) +- [Gradle wrapper checksum verification](https://docs.gradle.org/current/userguide/best_practices_security.html#use_the_gradle_wrapper_and_verify_the_wrapper_checksum) +- [GitHub Actions security hardening](https://docs.github.com/en/actions/reference/security/secure-use) +- [GitHub artifact attestation verification](https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations) +- [Google Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756) +- [Play Console App bundle explorer](https://support.google.com/googleplay/android-developer/answer/9859152) +- [Android `bundletool`](https://developer.android.com/tools/bundletool) +- [Android `apksigner`](https://developer.android.com/tools/apksigner) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b20767c0..fa19edb4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,7 @@ kotlin = "2.4.10" compileSdk = "37" minSdk = "26" # API 26 for proper BLE support targetSdk = "37" +buildTools = "37.0.0" # AndroidX Core core-ktx = "1.19.0" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml new file mode 100644 index 00000000..a62cbff6 --- /dev/null +++ b/gradle/verification-metadata.xml @@ -0,0 +1,5194 @@ + + + + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a351597e..e3ec95fa 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip +distributionSha256Sum=9c0f7faeeb306cb14e4279a3e084ca6b596894089a0638e68a07c945a32c9e14 networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings-gradle.lockfile b/settings-gradle.lockfile new file mode 100644 index 00000000..1aa2035e --- /dev/null +++ b/settings-gradle.lockfile @@ -0,0 +1,5 @@ +# This is a Gradle generated file for dependency locking. +# 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 dependencies --write-locks +empty=incomingCatalogForLibs0 diff --git a/settings.gradle.kts b/settings.gradle.kts index 0d96a216..ffd88519 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -10,8 +10,6 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - // Guardian Project raw GitHub Maven (hosts info.guardianproject:arti-mobile-ex) - maven { url = uri("https://raw.githubusercontent.com/guardianproject/gpmaven/master") } } } diff --git a/tools/arti-build/ARTI_VERSION b/tools/arti-build/ARTI_VERSION deleted file mode 100644 index 5b590193..00000000 --- a/tools/arti-build/ARTI_VERSION +++ /dev/null @@ -1 +0,0 @@ -arti-v1.9.0 \ No newline at end of file diff --git a/tools/arti-build/Cargo.lock b/tools/arti-build/Cargo.lock new file mode 100644 index 00000000..7438c8f7 --- /dev/null +++ b/tools/arti-build/Cargo.lock @@ -0,0 +1,5429 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", + "zeroize", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloca" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4" +dependencies = [ + "cc", +] + +[[package]] +name = "amplify" +version = "4.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f7fb4ac7c881e54a8e7015e399b6112a2a5bc958b6c89ac510840ff20273b31" +dependencies = [ + "amplify_derive", + "amplify_num", + "ascii", + "getrandom 0.2.17", + "getrandom 0.3.4", + "wasm-bindgen", +] + +[[package]] +name = "amplify_derive" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a6309e6b8d89b36b9f959b7a8fa093583b94922a0f6438a24fb08936de4d428" +dependencies = [ + "amplify_syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "amplify_num" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afed304556696656d2d71495e1e5f2c4b524a3fb6eb0f2f3778ffc482a40b8a8" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "amplify_syn" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7736fb8d473c0d83098b5bac44df6a561e20470375cd8bcae30516dc889fd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "arti-android-wrapper" +version = "1.9.0" +dependencies = [ + "anyhow", + "arti-client", + "jni", + "tokio", + "tor-rtcompat", +] + +[[package]] +name = "arti-client" +version = "0.38.0" +dependencies = [ + "async-trait", + "cfg-if", + "derive-deftly", + "derive_builder_fork_arti", + "derive_more", + "educe", + "fs-mistrust", + "futures", + "hostname-validator", + "humantime", + "humantime-serde", + "libc", + "once_cell", + "postage", + "rand 0.9.5", + "safelog", + "serde", + "thiserror 2.0.19", + "time", + "tor-async-utils", + "tor-basic-utils", + "tor-chanmgr", + "tor-circmgr", + "tor-config", + "tor-config-path", + "tor-dircommon", + "tor-dirmgr", + "tor-error", + "tor-guardmgr", + "tor-hsclient", + "tor-hscrypto", + "tor-keymgr", + "tor-linkspec", + "tor-llcrypto", + "tor-memquota", + "tor-netdir", + "tor-netdoc", + "tor-persist", + "tor-proto", + "tor-protover", + "tor-rtcompat", + "tracing", + "void", +] + +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + +[[package]] +name = "asn1-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror 2.0.19", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "async-compression" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79b3f8a79cccc2898f31920fc69f304859b3bd567490f75ebf51ae1c792a9ac" +dependencies = [ + "compression-codecs", + "compression-core", + "futures-io", + "pin-project-lite", +] + +[[package]] +name = "async-trait" +version = "0.1.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "async_executors" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a982d2f86de6137cc05c9db9a915a19886c97911f9790d04f174cede74be01a5" +dependencies = [ + "blanket", + "futures-core", + "futures-task", + "futures-util", + "pin-project", + "rustc_version", + "tokio", +] + +[[package]] +name = "asynchronous-codec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite", +] + +[[package]] +name = "atomic" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + +[[package]] +name = "atomic" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89cbf775b137e9b968e67227ef7f775587cde3fd31b0d8599dbd0f598a48340" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bincode" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" +dependencies = [ + "serde", + "unty", +] + +[[package]] +name = "bitflags" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" + +[[package]] +name = "bitvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blanket" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0b121a9fe0df916e362fb3271088d071159cdf11db0e4182d02152850756eff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bstr" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f7dc094d718f2e1c1559ad110e27eeaae14a5465d3d56dd6dbd793079fbd530" +dependencies = [ + "memchr", + "regex-automata", + "serde_core", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "by_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "caret" +version = "0.8.1" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.1", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "clap" +version = "4.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "coarsetime" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e58eb270476aa4fc7843849f8a35063e8743b4dbcdf6dd0f8ea0886980c204c2" +dependencies = [ + "libc", + "wasix", + "wasm-bindgen", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "compression-codecs" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2548391e9c1929c21bf6aa2680af86fe4c1b33e6cea9ac1cfeec0bd11218cf" +dependencies = [ + "compression-core", + "flate2", + "liblzma", + "zstd", + "zstd-safe", +] + +[[package]] +name = "compression-core" +version = "0.4.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cookie-factory" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" +dependencies = [ + "futures", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3" +dependencies = [ + "alloca", + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "itertools 0.13.0", + "num-traits", + "oorandom", + "page_size", + "plotters", + "rayon", + "regex", + "serde", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-cycles-per-byte" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5396de42a52e9e5d8f67ef0702dae30451f310a9ba1c3094dcf228f0be0e54bc" +dependencies = [ + "cfg-if", + "criterion", +] + +[[package]] +name = "criterion-plot" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea" +dependencies = [ + "cast", + "itertools 0.13.0", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "803d13fb3b09d88be9f4dbc29062c66b19bf7170867ceb746d2a8689bf6c7a26" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core 0.23.0", + "darling_macro 0.23.0", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core 0.21.3", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core 0.23.0", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "data-encoding" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" +dependencies = [ + "asn1-rs", + "cookie-factory", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "serde_core", +] + +[[package]] +name = "derive-deftly" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284db66a66f03c3dafbe17360d959eb76b83f77cfe191677e2a7899c0da291f3" +dependencies = [ + "derive-deftly-macros", + "heck", +] + +[[package]] +name = "derive-deftly-macros" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caef6056a5788d05d173cdc3c562ac28ae093828f851f69378b74e4e3d578e41" +dependencies = [ + "heck", + "indexmap 2.14.0", + "itertools 0.15.0", + "proc-macro-crate", + "proc-macro2", + "quote", + "sha3", + "strum", + "syn 2.0.119", + "void", +] + +[[package]] +name = "derive_builder_core_fork_arti" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24c1b715c79be6328caa9a5e1a387a196ea503740f0722ec3dd8f67a9e72314d" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_builder_fork_arti" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3eae24d595f4d0ecc90a9a5a6d11c2bd8dafe2375ec4a1ec63250e5ade7d228" +dependencies = [ + "derive_builder_macro_fork_arti", +] + +[[package]] +name = "derive_builder_macro_fork_arti" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69887769a2489cd946bf782eb2b1bb2cb7bc88551440c94a765d4f040c08ebf3" +dependencies = [ + "derive_builder_core_fork_arti", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "directories" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "displaydoc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "downcast-rs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117240f60069e65410b3ae1bb213295bd828f707b5bec6596a1afc8793ce0cbc" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "merlin", + "rand_core 0.6.4", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "educe" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "either" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "enum-ordinalize" +version = "3.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "enumset" +version = "1.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccc5801fd11762e24d1e420d01d2ac518f2a2ca4329d4fbb6639f2412b6204e0" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd536557b58c682b217b8fb199afdff47cd3eff260623f19e77074eb073d63a" +dependencies = [ + "darling 0.21.3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "figment" +version = "0.10.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cb01cd46b0cf372153850f4c6c272d9cbea2da513e07538405148f95bd789f3" +dependencies = [ + "atomic 0.6.1", + "serde", + "toml 0.8.23", + "uncased", + "version_check", +] + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fluid-let" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "749cff877dc1af878a0b31a41dd221a753634401ea0ef2f87b62d3171522485a" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "fs-mistrust" +version = "0.13.1" +dependencies = [ + "derive_builder_fork_arti", + "dirs", + "libc", + "pwd-grp", + "serde", + "thiserror 2.0.19", + "walkdir", +] + +[[package]] +name = "fslock" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04412b8935272e3a9bae6f48c7bfff74c2911f60525404edfdd28e49884c3bfb" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" + +[[package]] +name = "futures-executor" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a" + +[[package]] +name = "futures-macro" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "futures-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" +dependencies = [ + "futures-io", + "rustls", + "rustls-pki-types", +] + +[[package]] +name = "futures-sink" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" + +[[package]] +name = "futures-task" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" + +[[package]] +name = "futures-util" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 5.3.0", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "getset" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cf442baaabe4213ce7d1239afc26c039180b6456da2cededa316ae2c8a77a77" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "glob-match" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985c9503b412198aa4197559e9a318524ebc4519c229bfa05a535828c950b9d" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "hostname-validator" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f558a64ac9af88b5ba400d99b579451af0d39c6d360980045b91aac966d705e2" + +[[package]] +name = "http" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15" + +[[package]] +name = "humantime-serde" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c" +dependencies = [ + "humantime", + "serde", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "inotify" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "153be1941a183ec9ccd095ddbe17a8b8d435ef6c76e9e02451b933c3999af2c8" +dependencies = [ + "bitflags", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d" +dependencies = [ + "libc", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "inventory" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f0c30c76f2f4ccee3fe55a2435f691ca00c0e4bd87abe4f4a851b1d4dac39b" +dependencies = [ + "rustversion", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kqueue" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "273c0752728918e0ac4976f2b275b6fefb9ecd400585dec929419f3844cd87b5" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "liblzma" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45aec2360b3933207e27908049d8e4df4e476b58180afb1e56b2a4fb72efe4ba" +dependencies = [ + "liblzma-sys", +] + +[[package]] +name = "liblzma-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a046c7f353ba30f810545151e04f63545833803f5b86ee3ddf1517247fe560a5" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652" +dependencies = [ + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nonany" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b8866ec53810a9a4b3d434a29801e78c707430a9ae11c2db4b8b62bb9675a0" + +[[package]] +name = "notify" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" +dependencies = [ + "bitflags", + "inotify", + "kqueue", + "libc", + "log", + "mio", + "notify-types", + "walkdir", + "windows-sys 0.60.2", +] + +[[package]] +name = "notify-types" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.7", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", +] + +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "oneshot-fused-workaround" +version = "0.5.1" +dependencies = [ + "futures", +] + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "openssl" +version = "0.10.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-src" +version = "300.6.1+3.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46eb8fb9fb3b61ce1c0f8a026c4c1a0714d3a9e138e7fbde78753ce2babc3846" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" +dependencies = [ + "memchr", +] + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p521" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc9e2161f1f215afdfce23677034ae137bbd45016a880c2eb3ba8eb95f085b2" +dependencies = [ + "base16ct", + "ecdsa", + "elliptic-curve", + "primeorder", + "rand_core 0.6.4", + "sha2", +] + +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "plotters" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" + +[[package]] +name = "plotters-svg" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "postage" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3fb618632874fb76937c2361a7f22afd393c982a2165595407edc75b06d3c1" +dependencies = [ + "atomic 0.5.3", + "crossbeam-queue", + "futures", + "parking_lot", + "pin-project", + "static_assertions", + "thiserror 1.0.69", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "priority-queue" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93980406f12d9f8140ed5abe7155acb10bb1e69ea55c88960b9c2f117445ef96" +dependencies = [ + "equivalent", + "indexmap 2.14.0", + "serde", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.13+spec-1.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "pwd-grp" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e2023f41b5fcb7c30eb5300a5733edfaa9e0e0d502d51b586f65633fd39e40c" +dependencies = [ + "derive-deftly", + "libc", + "paste", + "thiserror 2.0.19", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" +dependencies = [ + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_jitter" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16df48f071248e67b8fc5e866d9448d45c08ad8b672baaaf796e2f15e606ff0" +dependencies = [ + "libc", + "rand_core 0.9.5", + "winapi", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "rdrand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92195228612ac8eed47adbc2ed0f04e513a4ccb98175b6f2bd04d963b533655" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.19", +] + +[[package]] +name = "ref-cast" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216e8f773d7923bcba9ceb86a86c93cabb3903a11872fc3f138c49630e50b96d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9283685feec7d69af75fb0e858d5e7378f33fe4fc699383b2916ab9273e03c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "retry-error" +version = "0.10.0" +dependencies = [ + "humantime", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "sha2", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rusqlite" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f" +dependencies = [ + "bitflags", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", + "time", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "safelog" +version = "0.7.1" +dependencies = [ + "derive_more", + "educe", + "either", + "fluid-let", + "thiserror 2.0.19", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "sanitize-filename" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc984f4f9ceb736a7bb755c3e3bd17dc56370af2600c9780dcc48c66453da34d" +dependencies = [ + "regex", +] + +[[package]] +name = "saturating-time" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63583a1dd0647d1484228529ab4ecaa874048d2956f117362aa5f5826456230" + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "serde_ignored" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115dffd5f3853e06e746965a20dcbae6ee747ae30b543d91b0e089668bb07798" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_with" +version = "3.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" +dependencies = [ + "base64", + "bs58", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.0", + "schemars 0.9.0", + "schemars 1.2.2", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660" +dependencies = [ + "darling 0.23.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shellexpand" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8" +dependencies = [ + "bstr", + "dirs", + "os_str_bytes", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "serde", + "version_check", +] + +[[package]] +name = "slotmap-careful" +version = "0.5.1" +dependencies = [ + "paste", + "serde", + "slotmap", + "thiserror 2.0.19", + "void", +] + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "ssh-cipher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caac132742f0d33c3af65bfcde7f6aa8f62f0e991d80db99149eb9d44708784f" +dependencies = [ + "cipher", + "ssh-encoding", +] + +[[package]] +name = "ssh-encoding" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9242b9ef4108a78e8cd1a2c98e193ef372437f8c22be363075233321dd4a15" +dependencies = [ + "base64ct", + "pem-rfc7468", + "sha2", +] + +[[package]] +name = "ssh-key" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b86f5297f0f04d08cabaa0f6bff7cb6aec4d9c3b49d87990d63da9d9156a8c3" +dependencies = [ + "num-bigint-dig", + "p256", + "p384", + "p521", + "rand_core 0.6.4", + "rsa", + "sec1", + "sha2", + "signature", + "ssh-cipher", + "ssh-encoding", + "subtle", + "zeroize", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "sysinfo" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252800745060e7b9ffb7b2badbd8b31cfa4aa2e61af879d0a3bf2a317c20217d" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" +dependencies = [ + "thiserror-impl 2.0.19", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e1d5e639ff6bab73cb6885cc7e7b1de96c3f32c68ec55f3952614bec1092244" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "tinyvec" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6328af13490e73a9b4694030fafd93f8c8c6a9dede33e821c3fc63eddf8042ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tokio-util" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap 2.14.0", + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap 2.14.0", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.15", +] + +[[package]] +name = "toml_edit" +version = "0.25.13+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b" +dependencies = [ + "indexmap 2.14.0", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.4", +] + +[[package]] +name = "toml_parser" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" +dependencies = [ + "winnow 1.0.4", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "toml_writer" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" + +[[package]] +name = "tor-async-utils" +version = "0.38.0" +dependencies = [ + "derive-deftly", + "educe", + "futures", + "oneshot-fused-workaround", + "pin-project", + "postage", + "thiserror 2.0.19", + "void", +] + +[[package]] +name = "tor-basic-utils" +version = "0.38.0" +dependencies = [ + "derive_more", + "hex", + "itertools 0.14.0", + "libc", + "paste", + "rand 0.9.5", + "rand_chacha 0.9.0", + "serde", + "slab", + "smallvec", + "thiserror 2.0.19", + "weak-table", +] + +[[package]] +name = "tor-bytes" +version = "0.38.0" +dependencies = [ + "bytes", + "derive-deftly", + "digest", + "educe", + "getrandom 0.3.4", + "safelog", + "thiserror 2.0.19", + "tor-error", + "tor-llcrypto", + "zeroize", +] + +[[package]] +name = "tor-cell" +version = "0.38.0" +dependencies = [ + "amplify", + "bitflags", + "bytes", + "caret", + "derive-deftly", + "derive_more", + "educe", + "itertools 0.14.0", + "paste", + "rand 0.9.5", + "smallvec", + "thiserror 2.0.19", + "tor-basic-utils", + "tor-bytes", + "tor-cert", + "tor-error", + "tor-hscrypto", + "tor-linkspec", + "tor-llcrypto", + "tor-memquota", + "tor-protover", + "tor-units", + "void", +] + +[[package]] +name = "tor-cert" +version = "0.38.0" +dependencies = [ + "caret", + "derive_builder_fork_arti", + "derive_more", + "digest", + "thiserror 2.0.19", + "tor-bytes", + "tor-checkable", + "tor-error", + "tor-llcrypto", +] + +[[package]] +name = "tor-chanmgr" +version = "0.38.0" +dependencies = [ + "async-trait", + "caret", + "derive_builder_fork_arti", + "derive_more", + "educe", + "futures", + "oneshot-fused-workaround", + "postage", + "rand 0.9.5", + "safelog", + "serde", + "thiserror 2.0.19", + "tor-async-utils", + "tor-basic-utils", + "tor-cell", + "tor-config", + "tor-error", + "tor-keymgr", + "tor-linkspec", + "tor-llcrypto", + "tor-memquota", + "tor-netdir", + "tor-proto", + "tor-rtcompat", + "tor-socksproto", + "tor-units", + "tracing", + "void", +] + +[[package]] +name = "tor-checkable" +version = "0.38.0" +dependencies = [ + "humantime", + "signature", + "thiserror 2.0.19", + "tor-llcrypto", +] + +[[package]] +name = "tor-circmgr" +version = "0.38.0" +dependencies = [ + "amplify", + "async-trait", + "cfg-if", + "derive-deftly", + "derive_builder_fork_arti", + "derive_more", + "downcast-rs", + "dyn-clone", + "educe", + "futures", + "humantime-serde", + "itertools 0.14.0", + "once_cell", + "oneshot-fused-workaround", + "pin-project", + "rand 0.9.5", + "retry-error", + "safelog", + "serde", + "thiserror 2.0.19", + "tor-async-utils", + "tor-basic-utils", + "tor-cell", + "tor-chanmgr", + "tor-config", + "tor-dircommon", + "tor-error", + "tor-guardmgr", + "tor-linkspec", + "tor-memquota", + "tor-netdir", + "tor-netdoc", + "tor-persist", + "tor-proto", + "tor-protover", + "tor-relay-selection", + "tor-rtcompat", + "tor-units", + "tracing", + "void", + "weak-table", +] + +[[package]] +name = "tor-config" +version = "0.38.0" +dependencies = [ + "amplify", + "cfg-if", + "derive-deftly", + "derive_builder_fork_arti", + "educe", + "either", + "figment", + "fs-mistrust", + "futures", + "humantime-serde", + "itertools 0.14.0", + "notify", + "paste", + "postage", + "regex", + "serde", + "serde-value", + "serde_ignored", + "strum", + "thiserror 2.0.19", + "toml 0.9.12+spec-1.1.0", + "tor-basic-utils", + "tor-error", + "tor-rtcompat", + "tracing", + "void", +] + +[[package]] +name = "tor-config-path" +version = "0.38.0" +dependencies = [ + "directories", + "serde", + "shellexpand", + "thiserror 2.0.19", + "tor-error", + "tor-general-addr", +] + +[[package]] +name = "tor-consdiff" +version = "0.38.0" +dependencies = [ + "digest", + "hex", + "thiserror 2.0.19", + "tor-llcrypto", +] + +[[package]] +name = "tor-dirclient" +version = "0.38.0" +dependencies = [ + "async-compression", + "base64ct", + "derive_more", + "futures", + "hex", + "http", + "httparse", + "httpdate", + "itertools 0.14.0", + "memchr", + "thiserror 2.0.19", + "tor-circmgr", + "tor-error", + "tor-hscrypto", + "tor-linkspec", + "tor-llcrypto", + "tor-netdoc", + "tor-proto", + "tor-rtcompat", + "tracing", +] + +[[package]] +name = "tor-dircommon" +version = "0.38.0" +dependencies = [ + "base64ct", + "derive_builder_fork_arti", + "getset", + "humantime", + "humantime-serde", + "serde", + "tor-basic-utils", + "tor-checkable", + "tor-config", + "tor-linkspec", + "tor-llcrypto", + "tor-netdoc", + "tracing", +] + +[[package]] +name = "tor-dirmgr" +version = "0.38.0" +dependencies = [ + "async-trait", + "base64ct", + "derive_builder_fork_arti", + "derive_more", + "digest", + "educe", + "event-listener", + "fs-mistrust", + "fslock", + "futures", + "hex", + "humantime", + "humantime-serde", + "itertools 0.14.0", + "memmap2", + "oneshot-fused-workaround", + "paste", + "postage", + "rand 0.9.5", + "rusqlite", + "safelog", + "scopeguard", + "serde", + "serde_json", + "signature", + "static_assertions", + "strum", + "thiserror 2.0.19", + "time", + "tor-async-utils", + "tor-basic-utils", + "tor-checkable", + "tor-circmgr", + "tor-config", + "tor-consdiff", + "tor-dirclient", + "tor-dircommon", + "tor-error", + "tor-guardmgr", + "tor-llcrypto", + "tor-netdir", + "tor-netdoc", + "tor-persist", + "tor-proto", + "tor-protover", + "tor-rtcompat", + "tracing", +] + +[[package]] +name = "tor-error" +version = "0.38.0" +dependencies = [ + "derive_more", + "futures", + "paste", + "retry-error", + "static_assertions", + "strum", + "thiserror 2.0.19", + "tracing", + "void", +] + +[[package]] +name = "tor-general-addr" +version = "0.38.0" +dependencies = [ + "derive_more", + "thiserror 2.0.19", + "void", +] + +[[package]] +name = "tor-guardmgr" +version = "0.38.0" +dependencies = [ + "amplify", + "base64ct", + "derive-deftly", + "derive_builder_fork_arti", + "derive_more", + "dyn-clone", + "educe", + "futures", + "humantime", + "humantime-serde", + "itertools 0.14.0", + "num_enum", + "oneshot-fused-workaround", + "pin-project", + "postage", + "rand 0.9.5", + "safelog", + "serde", + "strum", + "thiserror 2.0.19", + "tor-async-utils", + "tor-basic-utils", + "tor-config", + "tor-dircommon", + "tor-error", + "tor-linkspec", + "tor-llcrypto", + "tor-netdir", + "tor-netdoc", + "tor-persist", + "tor-proto", + "tor-protover", + "tor-relay-selection", + "tor-rtcompat", + "tor-units", + "tracing", +] + +[[package]] +name = "tor-hsclient" +version = "0.38.0" +dependencies = [ + "async-trait", + "derive-deftly", + "derive_more", + "educe", + "either", + "futures", + "itertools 0.14.0", + "oneshot-fused-workaround", + "postage", + "rand 0.9.5", + "retry-error", + "safelog", + "slotmap-careful", + "strum", + "thiserror 2.0.19", + "tor-async-utils", + "tor-basic-utils", + "tor-bytes", + "tor-cell", + "tor-checkable", + "tor-circmgr", + "tor-config", + "tor-dirclient", + "tor-error", + "tor-hscrypto", + "tor-keymgr", + "tor-linkspec", + "tor-llcrypto", + "tor-memquota", + "tor-netdir", + "tor-netdoc", + "tor-persist", + "tor-proto", + "tor-protover", + "tor-rtcompat", + "tracing", +] + +[[package]] +name = "tor-hscrypto" +version = "0.38.0" +dependencies = [ + "data-encoding", + "derive-deftly", + "derive_more", + "digest", + "hex", + "humantime", + "itertools 0.14.0", + "paste", + "rand 0.9.5", + "safelog", + "serde", + "signature", + "subtle", + "thiserror 2.0.19", + "tor-basic-utils", + "tor-bytes", + "tor-error", + "tor-key-forge", + "tor-llcrypto", + "tor-memquota", + "tor-units", + "void", +] + +[[package]] +name = "tor-key-forge" +version = "0.38.0" +dependencies = [ + "derive-deftly", + "derive_more", + "downcast-rs", + "paste", + "rand 0.9.5", + "rsa", + "signature", + "ssh-key", + "thiserror 2.0.19", + "tor-bytes", + "tor-cert", + "tor-checkable", + "tor-error", + "tor-llcrypto", +] + +[[package]] +name = "tor-keymgr" +version = "0.38.0" +dependencies = [ + "amplify", + "arrayvec", + "cfg-if", + "derive-deftly", + "derive_builder_fork_arti", + "derive_more", + "downcast-rs", + "dyn-clone", + "fs-mistrust", + "glob-match", + "humantime", + "inventory", + "itertools 0.14.0", + "rand 0.9.5", + "safelog", + "serde", + "signature", + "ssh-key", + "thiserror 2.0.19", + "tor-basic-utils", + "tor-bytes", + "tor-config", + "tor-config-path", + "tor-error", + "tor-hscrypto", + "tor-key-forge", + "tor-llcrypto", + "tor-persist", + "tracing", + "visibility", + "walkdir", + "zeroize", +] + +[[package]] +name = "tor-linkspec" +version = "0.38.0" +dependencies = [ + "base64ct", + "by_address", + "caret", + "derive-deftly", + "derive_builder_fork_arti", + "derive_more", + "hex", + "itertools 0.14.0", + "safelog", + "serde", + "serde_with", + "strum", + "thiserror 2.0.19", + "tor-basic-utils", + "tor-bytes", + "tor-config", + "tor-llcrypto", + "tor-memquota", + "tor-protover", +] + +[[package]] +name = "tor-llcrypto" +version = "0.38.0" +dependencies = [ + "aes", + "base64ct", + "ctr", + "curve25519-dalek", + "der-parser", + "derive-deftly", + "derive_more", + "digest", + "ed25519-dalek", + "educe", + "getrandom 0.3.4", + "hex", + "rand 0.9.5", + "rand_chacha 0.9.0", + "rand_core 0.6.4", + "rand_core 0.9.5", + "rand_jitter", + "rdrand", + "rsa", + "safelog", + "serde", + "sha1", + "sha2", + "sha3", + "signature", + "subtle", + "thiserror 2.0.19", + "tor-error", + "tor-memquota", + "visibility", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "tor-log-ratelim" +version = "0.38.0" +dependencies = [ + "futures", + "humantime", + "thiserror 2.0.19", + "tor-error", + "tor-rtcompat", + "tracing", + "weak-table", +] + +[[package]] +name = "tor-memquota" +version = "0.38.0" +dependencies = [ + "cfg-if", + "derive-deftly", + "derive_more", + "dyn-clone", + "educe", + "futures", + "itertools 0.14.0", + "paste", + "pin-project", + "serde", + "slotmap-careful", + "static_assertions", + "sysinfo", + "thiserror 2.0.19", + "tor-async-utils", + "tor-basic-utils", + "tor-config", + "tor-error", + "tor-log-ratelim", + "tor-rtcompat", + "tracing", + "void", +] + +[[package]] +name = "tor-netdir" +version = "0.38.0" +dependencies = [ + "async-trait", + "bitflags", + "derive_more", + "digest", + "futures", + "hex", + "humantime", + "itertools 0.14.0", + "num_enum", + "rand 0.9.5", + "serde", + "strum", + "thiserror 2.0.19", + "time", + "tor-basic-utils", + "tor-error", + "tor-hscrypto", + "tor-linkspec", + "tor-llcrypto", + "tor-netdoc", + "tor-protover", + "tor-units", + "tracing", + "typed-index-collections", +] + +[[package]] +name = "tor-netdoc" +version = "0.38.0" +dependencies = [ + "amplify", + "base64ct", + "cipher", + "derive-deftly", + "derive_builder_fork_arti", + "derive_more", + "digest", + "educe", + "enumset", + "hex", + "humantime", + "itertools 0.14.0", + "memchr", + "paste", + "phf", + "rand 0.9.5", + "saturating-time", + "serde", + "serde_with", + "signature", + "smallvec", + "strum", + "subtle", + "thiserror 2.0.19", + "time", + "tinystr", + "tor-basic-utils", + "tor-bytes", + "tor-cell", + "tor-cert", + "tor-checkable", + "tor-error", + "tor-hscrypto", + "tor-linkspec", + "tor-llcrypto", + "tor-protover", + "tor-units", + "void", + "zeroize", +] + +[[package]] +name = "tor-persist" +version = "0.38.0" +dependencies = [ + "derive-deftly", + "derive_more", + "filetime", + "fs-mistrust", + "fslock", + "futures", + "itertools 0.14.0", + "oneshot-fused-workaround", + "paste", + "sanitize-filename", + "serde", + "serde_json", + "thiserror 2.0.19", + "time", + "tor-async-utils", + "tor-basic-utils", + "tor-error", + "tracing", + "void", +] + +[[package]] +name = "tor-proto" +version = "0.38.0" +dependencies = [ + "amplify", + "asynchronous-codec", + "bitvec", + "bytes", + "caret", + "cfg-if", + "cipher", + "coarsetime", + "criterion-cycles-per-byte", + "derive-deftly", + "derive_builder_fork_arti", + "derive_more", + "digest", + "educe", + "enum_dispatch", + "futures", + "futures-util", + "hkdf", + "hmac", + "itertools 0.14.0", + "nonany", + "oneshot-fused-workaround", + "pin-project", + "postage", + "rand 0.9.5", + "rand_core 0.9.5", + "safelog", + "slotmap-careful", + "smallvec", + "static_assertions", + "subtle", + "sync_wrapper", + "thiserror 2.0.19", + "tokio", + "tokio-util", + "tor-async-utils", + "tor-basic-utils", + "tor-bytes", + "tor-cell", + "tor-cert", + "tor-checkable", + "tor-config", + "tor-error", + "tor-hscrypto", + "tor-linkspec", + "tor-llcrypto", + "tor-log-ratelim", + "tor-memquota", + "tor-protover", + "tor-relay-crypto", + "tor-rtcompat", + "tor-rtmock", + "tor-units", + "tracing", + "typenum", + "visibility", + "void", + "zeroize", +] + +[[package]] +name = "tor-protover" +version = "0.38.0" +dependencies = [ + "caret", + "paste", + "serde_with", + "thiserror 2.0.19", + "tor-basic-utils", + "tor-bytes", +] + +[[package]] +name = "tor-relay-crypto" +version = "0.38.0" +dependencies = [ + "derive-deftly", + "derive_more", + "humantime", + "tor-cert", + "tor-checkable", + "tor-error", + "tor-key-forge", + "tor-keymgr", + "tor-llcrypto", + "tor-persist", +] + +[[package]] +name = "tor-relay-selection" +version = "0.38.0" +dependencies = [ + "rand 0.9.5", + "serde", + "tor-basic-utils", + "tor-linkspec", + "tor-netdir", + "tor-netdoc", +] + +[[package]] +name = "tor-rtcompat" +version = "0.38.0" +dependencies = [ + "async-trait", + "async_executors", + "asynchronous-codec", + "coarsetime", + "derive_more", + "dyn-clone", + "educe", + "futures", + "futures-rustls", + "hex", + "libc", + "native-tls", + "paste", + "pin-project", + "rustls-pki-types", + "rustls-webpki", + "socket2", + "thiserror 2.0.19", + "tokio", + "tokio-util", + "tor-error", + "tor-general-addr", + "tracing", + "void", +] + +[[package]] +name = "tor-rtmock" +version = "0.38.0" +dependencies = [ + "amplify", + "assert_matches", + "async-trait", + "derive-deftly", + "derive_more", + "educe", + "futures", + "humantime", + "itertools 0.14.0", + "oneshot-fused-workaround", + "pin-project", + "priority-queue", + "slotmap-careful", + "strum", + "thiserror 2.0.19", + "tor-error", + "tor-general-addr", + "tor-rtcompat", + "tracing", + "tracing-test", + "void", +] + +[[package]] +name = "tor-socksproto" +version = "0.38.0" +dependencies = [ + "amplify", + "caret", + "derive-deftly", + "educe", + "safelog", + "subtle", + "thiserror 2.0.19", + "tor-bytes", + "tor-error", +] + +[[package]] +name = "tor-units" +version = "0.38.0" +dependencies = [ + "derive-deftly", + "derive_more", + "serde", + "thiserror 2.0.19", + "tor-memquota", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "tracing-test" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a4c448db514d4f24c5ddb9f73f2ee71bfb24c526cf0c570ba142d1119e0051" +dependencies = [ + "tracing-core", + "tracing-subscriber", + "tracing-test-macro", +] + +[[package]] +name = "tracing-test-macro" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad06847b7afb65c7866a36664b75c40b895e318cea4f71299f013fb22965329d" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "typed-index-collections" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "898160f1dfd383b4e92e17f0512a7d62f3c51c44937b23b6ffc3a1614a8eaccd" +dependencies = [ + "bincode", + "serde", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "uncased" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "visibility" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d674d135b4a8c1d7e813e2f8d1c9a58308aee4a680323066025e53132218bd91" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasix" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae86f02046da16a333a9129d31451423e1657737ecdafed4193838a5f54c5cfe" +dependencies = [ + "wasi", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.119", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "weak-table" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "323f4da9523e9a669e1eaf9c6e763892769b1d38c623913647bfdc1532fe4549" + +[[package]] +name = "web-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link 0.1.3", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", + "serde", + "zeroize", +] + +[[package]] +name = "zerocopy" +version = "0.8.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "serde", + "zerofrom", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/tools/arti-build/Cargo.toml b/tools/arti-build/Cargo.toml index 05664f90..d5858590 100644 --- a/tools/arti-build/Cargo.toml +++ b/tools/arti-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arti-android-wrapper" -version = "1.7.0" +version = "1.9.0" edition = "2021" [workspace] @@ -11,8 +11,8 @@ crate-type = ["cdylib"] name = "arti_android" [dependencies] -arti-client = { path = "../crates/arti-client", default-features = false, features = ["tokio", "rustls", "compression", "bridge-client", "onion-service-client", "static-sqlite"] } -tor-rtcompat = { path = "../crates/tor-rtcompat", features = ["tokio", "rustls"] } +arti-client = { path = "../crates/arti-client", default-features = false, features = ["tokio", "rustls", "compression", "bridge-client", "onion-service-client", "static", "static-sqlite"] } +tor-rtcompat = { path = "../crates/tor-rtcompat", features = ["tokio", "rustls", "static"] } jni = "0.21" tokio = { version = "1", features = ["full"] } anyhow = "1.0" @@ -22,4 +22,4 @@ opt-level = "z" # Optimize for size lto = true # Link-time optimization codegen-units = 1 # Better optimization strip = true # Strip symbols -panic = "abort" # Smaller panic handler \ No newline at end of file +panic = "abort" # Smaller panic handler diff --git a/tools/arti-build/Dockerfile b/tools/arti-build/Dockerfile new file mode 100644 index 00000000..15c0ea7f --- /dev/null +++ b/tools/arti-build/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1@sha256:87999aa3d42bdc6bea60565083ee17e86d1f3339802f543c0d03998580f9cb89 +FROM rust:1.95.0-slim-bookworm@sha256:d7482085ff5b415f84dba5647ae71606650bdef00db7aeb69f4b3d170c3e4082 + +SHELL ["/bin/bash", "-euo", "pipefail", "-c"] + +COPY tools/arti-build/TOOLCHAIN.env /tmp/TOOLCHAIN.env + +RUN source /tmp/TOOLCHAIN.env \ + && printf '%s\n' \ + 'Types: deb' \ + "URIs: https://snapshot.debian.org/archive/debian/${DEBIAN_SNAPSHOT}" \ + 'Suites: bookworm bookworm-updates' \ + 'Components: main' \ + 'Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg' \ + 'Check-Valid-Until: no' \ + '' \ + 'Types: deb' \ + "URIs: https://snapshot.debian.org/archive/debian-security/${DEBIAN_SNAPSHOT}" \ + 'Suites: bookworm-security' \ + 'Components: main' \ + 'Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg' \ + 'Check-Valid-Until: no' \ + > /etc/apt/sources.list.d/debian.sources \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + binutils \ + ca-certificates \ + curl \ + git \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +RUN source /tmp/TOOLCHAIN.env \ + && curl -fsSL \ + "https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}" \ + -o "/tmp/${ANDROID_NDK_ARCHIVE}" \ + && echo "${ANDROID_NDK_SHA256} /tmp/${ANDROID_NDK_ARCHIVE}" | sha256sum -c - \ + && unzip -q "/tmp/${ANDROID_NDK_ARCHIVE}" -d /opt \ + && rm "/tmp/${ANDROID_NDK_ARCHIVE}" \ + && test "$(sed -n 's/^Pkg.Revision *= *//p' /opt/android-ndk-r27d/source.properties | tr -d '\r')" = "$ANDROID_NDK_VERSION" + +RUN source /tmp/TOOLCHAIN.env \ + && test "$(rustc --version | awk '{print $2}')" = "$RUST_VERSION" \ + && cargo install cargo-ndk --version "$CARGO_NDK_VERSION" --locked \ + && rustup target add \ + aarch64-linux-android \ + armv7-linux-androideabi \ + i686-linux-android \ + x86_64-linux-android + +ENV ANDROID_NDK_HOME=/opt/android-ndk-r27d +ENV PATH=/usr/local/cargo/bin:${PATH} +ENV TZ=UTC +ENV LC_ALL=C.UTF-8 + +WORKDIR /workspace + +ENTRYPOINT ["/bin/bash", "tools/arti-build/build-arti.sh", "--clean"] diff --git a/tools/arti-build/README.md b/tools/arti-build/README.md index f547b773..2307a53a 100644 --- a/tools/arti-build/README.md +++ b/tools/arti-build/README.md @@ -1,223 +1,70 @@ -# Arti Android Build Tools +# Rebuilding Arti for Android -This directory contains the build scripts and source files for compiling the custom Arti (Tor in Rust) library for Android. - -## Overview - -bitchat-android uses a custom-built Arti library instead of Guardian Project's outdated `arti-mobile-ex` AAR. This provides: - -- **Smaller APK size**: ~11MB total vs ~140MB with Guardian Project AAR (28x reduction) -- **Latest Arti version**: Currently v1.7.0 with pure Rust TLS (rustls) -- **16KB page size support**: Required for Google Play (Nov 2025) -- **Full transparency**: Build from official Arti source + our JNI wrapper - -## Quick Start - -The pre-built `.so` files are committed to the repo, so you don't need to build unless you want to: - -1. **Verify the binaries** match the source -2. **Update to a new Arti version** -3. **Modify the JNI wrapper** - -## Directory Structure - -``` -tools/arti-build/ -├── README.md # This file -├── build-arti.sh # Main build script (clones Arti, builds .so files) -├── ARTI_VERSION # Pinned Arti version tag (e.g., arti-v1.7.0) -├── Cargo.toml # Rust package configuration -├── src/ -│ └── lib.rs # JNI wrapper (Rust -> Kotlin/Java bridge) -└── .arti-source/ # [GITIGNORED] Cloned official Arti repo - -app/src/main/jniLibs/ # [COMMITTED] Pre-built native libraries -├── arm64-v8a/ -│ └── libarti_android.so (~5.3MB) -└── x86_64/ - └── libarti_android.so (~6.2MB) -``` - -## Rebuilding from Source - -### Prerequisites - -1. **Rust toolchain** with Android targets: - ```bash - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - rustup target add aarch64-linux-android x86_64-linux-android - ``` - -2. **cargo-ndk** for Android cross-compilation: - ```bash - cargo install cargo-ndk - ``` - -3. **Android NDK 25+** (for 16KB page size support): - ```bash - # Via Android Studio SDK Manager, or: - $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "ndk;27.0.12077973" - - # Set environment variable - export ANDROID_NDK_HOME="$HOME/Library/Android/sdk/ndk/27.0.12077973" - ``` - -### Build Commands +The four committed `libarti_android.so` files are built from the official Arti +source plus the JNI wrapper in this directory. The supported build path is the +pinned Linux container: ```bash -cd tools/arti-build - -# Build both architectures (arm64 + x86_64 for emulator) -./build-arti.sh - -# Build ARM64 only (smaller, for production releases) -./build-arti.sh --release - -# Clean rebuild (re-clone Arti source) -./build-arti.sh --clean +tools/arti-build/rebuild-in-container.sh +tools/arti-build/verify-checksums.sh ``` -The script will: -1. Clone official Arti from https://gitlab.torproject.org/tpo/core/arti -2. Checkout the version specified in `ARTI_VERSION` -3. Copy our JNI wrapper into the cloned repo -4. Build with `cargo ndk` -5. Copy `.so` files to `app/src/main/jniLibs/` +The container builds all four Android ABIs, verifies the exported JNI symbols +and rejects native binaries containing host-specific paths. It then rewrites +`tools/arti-build/SHA256SUMS`; both that manifest and the rebuilt libraries are +release inputs. -### Verification +## Pinned inputs -After building, verify the libraries: +- `TOOLCHAIN.env`: Arti tag and commit, stable build epoch, Rust, `cargo-ndk`, + Android NDK, and immutable Debian snapshot +- `rust-toolchain.toml`: Rust release and Android targets +- `Cargo.lock`: complete Rust dependency graph +- `Dockerfile`: digest-pinned Rust base image and checksum-verified NDK archive +- `Cargo.toml` and `src/lib.rs`: JNI wrapper package and source -```bash -# Check file sizes -ls -lh ../../app/src/main/jniLibs/*/libarti_android.so +Rust source paths are remapped to stable virtual paths, incremental compilation +is disabled, and `SOURCE_DATE_EPOCH` is pinned to the value used for the +committed libraries. -# Verify JNI symbols are exported -nm -gU ../../app/src/main/jniLibs/arm64-v8a/libarti_android.so | grep Java_org_torproject +## Updating Arti or the native toolchain -# Verify 16KB page alignment -readelf -l ../../app/src/main/jniLibs/arm64-v8a/libarti_android.so | grep LOAD -# Look for: Align 0x4000 (16KB) -``` +1. Update the tag, full source commit, stable build epoch, tool versions, + archive name, and archive checksum in `TOOLCHAIN.env`. +2. Update `Cargo.toml` if Arti changed its crate features or wrapper version. +3. Regenerate `Cargo.lock` against the exact Arti checkout and review every + dependency change: -## Updating Arti Version - -1. **Check available versions**: ```bash - git ls-remote --tags https://gitlab.torproject.org/tpo/core/arti.git | grep arti-v + tools/arti-build/rebuild-in-container.sh --update-lockfile ``` -2. **Update the version file**: - ```bash - echo "arti-v1.8.0" > ARTI_VERSION - ``` +4. Update the digest-pinned base image and `rust-toolchain.toml` when changing + Rust. +5. Run `tools/arti-build/rebuild-in-container.sh` twice from clean generated + state and confirm `tools/arti-build/SHA256SUMS` is unchanged. +6. Run the Android tests and the two-build release comparison described in + [`docs/reproducible-builds.md`](../../docs/reproducible-builds.md). -3. **Rebuild from scratch**: - ```bash - ./build-arti.sh --clean - ``` +Do not build release native libraries with an unpinned local NDK or Rust +toolchain. `build-arti.sh` deliberately rejects mismatched tool versions. -4. **Test the build**: - ```bash - cd ../.. - ./gradlew clean assembleDebug - ./gradlew installDebug - # Enable Tor in app and verify it works - ``` +## JNI surface -5. **Commit the new libraries**: - ```bash - git add app/src/main/jniLibs/ tools/arti-build/ARTI_VERSION - git commit -m "chore: update Arti to v1.8.0" - ``` +The wrapper exports the native methods used by `ArtiNative`: -## JNI Wrapper Architecture +- `getVersion` +- `setLogCallback` +- `initialize` +- `startSocksProxy` +- `stop` -The `src/lib.rs` file implements a JNI bridge between Kotlin and Rust: - -``` -Kotlin (ArtiNative.kt) - ↓ JNI -Rust (lib.rs) - ↓ -Arti Client (TorClient) - ↓ -SOCKS5 Proxy (localhost:9060) -``` - -**Exported JNI Functions**: -- `getVersion()` - Returns Arti version string -- `setLogCallback(callback)` - Registers log listener for bootstrap progress -- `initialize(dataDir)` - Creates Tokio runtime and TorClient -- `startSocksProxy(port)` - Starts SOCKS5 proxy on specified port -- `stop()` - Stops SOCKS proxy (TorClient is reused) - -**Key Design Decisions**: -- Global `TorClient` persists across stop/start cycles (fixes Nov 2024 toggle bug) -- Tokio runtime created once and never destroyed -- Log messages bridged to Java via `GlobalRef` callback - -## Feature Configuration - -Edit `Cargo.toml` to customize Arti features: - -```toml -[dependencies] -arti-client = { - path = "../crates/arti-client", - default-features = false, - features = [ - "tokio", # Required: async runtime - "rustls", # Required: pure Rust TLS (no OpenSSL) - "compression", # Optional: directory compression - "bridge-client", # Optional: Tor bridge support - "onion-service-client", # Optional: .onion site support - "static-sqlite" # Required: bundled SQLite - ] -} -``` - -## Size Comparison - -| Configuration | arm64-v8a | x86_64 | Total | APK Size | -|---------------|-----------|--------|-------|----------| -| Guardian Project AAR | - | - | ~140 MB | ~150 MB | -| Custom (both arch) | 5.3 MB | 6.2 MB | 11.5 MB | ~15 MB | -| Custom (ARM-only) | 5.3 MB | - | 5.3 MB | ~10 MB | - -**28x size reduction** vs Guardian Project implementation. - -## Troubleshooting - -### "cargo-ndk not found" -```bash -cargo install cargo-ndk -``` - -### "Android NDK not found" -```bash -export ANDROID_NDK_HOME="$HOME/Library/Android/sdk/ndk/27.0.12077973" -``` - -### "Rust target not installed" -```bash -rustup target add aarch64-linux-android x86_64-linux-android -``` - -### "Version not found" -Check available versions: -```bash -git ls-remote --tags https://gitlab.torproject.org/tpo/core/arti.git | grep arti-v | tail -10 -``` - -### Library too large -1. Ensure building with `--release` flag -2. Verify `strip = true` in `Cargo.toml` `[profile.release]` -3. Consider removing optional features +The build fails if any expected symbol is absent. The NDK `readelf` check also +reports ELF load-segment alignment for Android's 16 KiB page-size requirement. ## References -- [Arti Documentation](https://gitlab.torproject.org/tpo/core/arti/-/blob/main/doc/README.md) -- [cargo-ndk](https://github.com/bbqsrc/cargo-ndk) -- [Android NDK Guide](https://developer.android.com/ndk/guides) -- [Google Play 16KB Page Size](https://developer.android.com/guide/practices/page-sizes) +- [Arti source](https://gitlab.torproject.org/tpo/core/arti) +- [Cargo lockfiles](https://doc.rust-lang.org/cargo/faq.html#why-have-cargolock-in-version-control) +- [Rust source-path remapping](https://doc.rust-lang.org/rustc/remap-source-paths.html) +- [Install a specific Android NDK](https://developer.android.com/studio/projects/install-ndk) diff --git a/tools/arti-build/SHA256SUMS b/tools/arti-build/SHA256SUMS new file mode 100644 index 00000000..4972e4e3 --- /dev/null +++ b/tools/arti-build/SHA256SUMS @@ -0,0 +1,4 @@ +bb92268898b51a7b2979e74aa5263bdffb6450a1703c2fa6f2779e714e154d61 app/src/main/jniLibs/arm64-v8a/libarti_android.so +2a037d0cef4cef2227dba4bd8ad6c10ccf29064c5718298b21dae0de0a7c11ad app/src/main/jniLibs/armeabi-v7a/libarti_android.so +e70eece0ccf425032c11c3177801fe10b964c8be0e14c926da6b613a2d06aead app/src/main/jniLibs/x86/libarti_android.so +ae6f389c4fe9d969c65e64a1d55169fc941e7d95737aa3ba0b8d42f5d54d6c56 app/src/main/jniLibs/x86_64/libarti_android.so diff --git a/tools/arti-build/TOOLCHAIN.env b/tools/arti-build/TOOLCHAIN.env new file mode 100644 index 00000000..2ca10ad4 --- /dev/null +++ b/tools/arti-build/TOOLCHAIN.env @@ -0,0 +1,9 @@ +ARTI_VERSION=arti-v1.9.0 +ARTI_COMMIT=ba421ece1acb47e5c554c2bfa043cc9156451bab +NATIVE_SOURCE_DATE_EPOCH=1785193050 +DEBIAN_SNAPSHOT=20260720T000000Z +RUST_VERSION=1.95.0 +CARGO_NDK_VERSION=4.1.2 +ANDROID_NDK_VERSION=27.3.13750724 +ANDROID_NDK_ARCHIVE=android-ndk-r27d-linux.zip +ANDROID_NDK_SHA256=601246087a682d1944e1e16dd85bc6e49560fe8b6d61255be2829178c8ed15d9 diff --git a/tools/arti-build/build-arti.sh b/tools/arti-build/build-arti.sh index 2a31fefa..5d20541a 100755 --- a/tools/arti-build/build-arti.sh +++ b/tools/arti-build/build-arti.sh @@ -8,17 +8,14 @@ # - Update to a new Arti version # - Debug or modify the wrapper code # -# Requirements: -# - Bash 4+ (macOS default bash is 3.2; install via Homebrew: brew install bash) -# - Rust toolchain with Android targets: -# rustup target add aarch64-linux-android x86_64-linux-android -# - cargo-ndk: cargo install cargo-ndk -# - Android NDK 25+ (for 16KB page size support) +# Requirements are pinned in TOOLCHAIN.env and rust-toolchain.toml. The +# supported entry point is rebuild-in-container.sh, which supplies all of them. # # Usage: # ./build-arti.sh # Build both architectures (debug/emulator) -# ./build-arti.sh --release # Build ARM64 only (production) +# ./build-arti.sh --release # Build ARM targets only # ./build-arti.sh --clean # Remove cloned Arti repo and rebuild +# ./build-arti.sh --update-lockfile # Refresh Cargo.lock without building set -euo pipefail @@ -38,57 +35,21 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" ARTI_SOURCE_DIR="$SCRIPT_DIR/.arti-source" JNILIBS_DIR="$PROJECT_ROOT/app/src/main/jniLibs" +TOOLCHAIN_FILE="$SCRIPT_DIR/TOOLCHAIN.env" +LOCKFILE_SOURCE="$SCRIPT_DIR/Cargo.lock" - -detect_default_ndk_home() { - local candidates=( - "$HOME/Library/Android/sdk/ndk/27.0.12077973" - "$HOME/Library/Android/sdk/ndk" - "$HOME/Library/Android/sdk/ndk-bundle" - "$HOME/Android/Sdk/ndk/27.0.12077973" - "$HOME/Android/Sdk/ndk" - "$HOME/Android/Sdk/ndk-bundle" - ) - - for candidate in "${candidates[@]}"; do - if [ -d "$candidate" ]; then - echo "$candidate" - return - fi - done - - local base - for base in "$HOME/Library/Android/sdk/ndk" "$HOME/Android/Sdk/ndk"; do - if [ -d "$base" ]; then - local latest - latest="$(find "$base" -maxdepth 1 -mindepth 1 -type d 2>/dev/null | sort | tail -1)" - if [ -n "$latest" ]; then - echo "$latest" - return - fi - fi - done - - echo "" -} - -# Read pinned version -if [ ! -f "$SCRIPT_DIR/ARTI_VERSION" ]; then - echo -e "${RED}Error: ARTI_VERSION file not found${NC}" +if [ ! -f "$TOOLCHAIN_FILE" ]; then + echo -e "${RED}Error: TOOLCHAIN.env file not found${NC}" exit 1 fi -VERSION="$(tr -d '[:space:]' < "$SCRIPT_DIR/ARTI_VERSION")" +# shellcheck disable=SC1090 +source "$TOOLCHAIN_FILE" + +VERSION="$ARTI_VERSION" +export RUSTUP_TOOLCHAIN="$RUST_VERSION" -# Android NDK path if [ -z "${ANDROID_NDK_HOME:-}" ]; then - AUTO_NDK_HOME="$(detect_default_ndk_home)" - if [ -n "$AUTO_NDK_HOME" ]; then - ANDROID_NDK_HOME="$AUTO_NDK_HOME" - fi -fi -if [ -z "${ANDROID_NDK_HOME:-}" ]; then - echo -e "${RED}Error: ANDROID_NDK_HOME is not set and automatic detection failed.${NC}" - echo "Set ANDROID_NDK_HOME to your NDK installation (e.g., ~/Android/Sdk/ndk/)." + echo -e "${RED}Error: ANDROID_NDK_HOME must point to NDK $ANDROID_NDK_VERSION.${NC}" exit 1 fi export ANDROID_NDK_HOME @@ -96,9 +57,29 @@ export ANDROID_NDK_HOME # Min SDK version (must match bitchat-android minSdk) MIN_SDK_VERSION=26 +# Keep host paths and timestamps out of Rust objects and panic-location strings. +SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$NATIVE_SOURCE_DATE_EPOCH}" +if ! [[ "$SOURCE_DATE_EPOCH" =~ ^[0-9]+$ ]]; then + echo -e "${RED}Error: SOURCE_DATE_EPOCH must be an integer.${NC}" + exit 1 +fi +CARGO_HOME_PATH="${CARGO_HOME:-$HOME/.cargo}" +REPRO_RUSTFLAGS=( + "--remap-path-prefix=$PROJECT_ROOT=/usr/src/bitchat-android" + "--remap-path-prefix=$ARTI_SOURCE_DIR=/usr/src/arti" + "--remap-path-prefix=$CARGO_HOME_PATH=/usr/local/cargo" +) +for rustflag in "${REPRO_RUSTFLAGS[@]}"; do + RUSTFLAGS="${RUSTFLAGS:+$RUSTFLAGS }$rustflag" +done +export CARGO_INCREMENTAL=0 +export RUSTFLAGS +export SOURCE_DATE_EPOCH + # Parse arguments RELEASE_ONLY=false CLEAN_BUILD=false +UPDATE_LOCKFILE=false while [[ $# -gt 0 ]]; do case "$1" in @@ -110,12 +91,17 @@ while [[ $# -gt 0 ]]; do CLEAN_BUILD=true shift ;; + --update-lockfile) + UPDATE_LOCKFILE=true + shift + ;; --help|-h) echo "Usage: $0 [--release] [--clean]" echo "" echo "Options:" - echo " --release Build ARM64 only (smaller, for production)" + echo " --release Build ARM targets only" echo " --clean Remove cached Arti source and rebuild from scratch" + echo " --update-lockfile Regenerate the wrapper Cargo.lock and exit" echo "" exit 0 ;; @@ -220,10 +206,16 @@ check_prerequisites() { # Rust if ! command -v rustc >/dev/null 2>&1; then - print_error "Rust is not installed. Install from https://rustup.rs/" + print_error "Rust is not installed." exit 1 fi - print_success "Rust found: $(rustc --version)" + local actual_rust_version + actual_rust_version="$(rustc --version | awk '{print $2}')" + if [ "$actual_rust_version" != "$RUST_VERSION" ]; then + print_error "Rust $RUST_VERSION is required; found $actual_rust_version" + exit 1 + fi + print_success "Rust version verified: $actual_rust_version" # rustup if ! command -v rustup >/dev/null 2>&1; then @@ -234,10 +226,16 @@ check_prerequisites() { # cargo-ndk if ! command -v cargo-ndk >/dev/null 2>&1; then - print_error "cargo-ndk is not installed. Run: cargo install cargo-ndk" + print_error "cargo-ndk $CARGO_NDK_VERSION is not installed." exit 1 fi - print_success "cargo-ndk found: $(cargo-ndk --version 2>/dev/null || echo 'installed')" + local actual_cargo_ndk_version + actual_cargo_ndk_version="$(cargo ndk --version | awk '{print $2}')" + if [ "$actual_cargo_ndk_version" != "$CARGO_NDK_VERSION" ]; then + print_error "cargo-ndk $CARGO_NDK_VERSION is required; found $actual_cargo_ndk_version" + exit 1 + fi + print_success "cargo-ndk version verified: $actual_cargo_ndk_version" # NDK if [ ! -d "$ANDROID_NDK_HOME" ]; then @@ -247,17 +245,18 @@ check_prerequisites() { fi print_success "Android NDK found: $ANDROID_NDK_HOME" - # NDK version (should be 25+) - NDK_VERSION="$(basename "$ANDROID_NDK_HOME" | cut -d'.' -f1)" - if ! [[ "$NDK_VERSION" =~ ^[0-9]+$ ]]; then - print_error "Could not parse NDK version from ANDROID_NDK_HOME: $ANDROID_NDK_HOME" + local ndk_properties="$ANDROID_NDK_HOME/source.properties" + if [ ! -f "$ndk_properties" ]; then + print_error "NDK source.properties not found." exit 1 fi - if [ "$NDK_VERSION" -lt 25 ]; then - print_error "NDK version $NDK_VERSION is too old. NDK 25+ required for 16KB page size support" + local actual_ndk_version + actual_ndk_version="$(sed -n 's/^Pkg.Revision *= *//p' "$ndk_properties" | tr -d '\r')" + if [ "$actual_ndk_version" != "$ANDROID_NDK_VERSION" ]; then + print_error "Android NDK $ANDROID_NDK_VERSION is required; found $actual_ndk_version" exit 1 fi - print_success "NDK version: $NDK_VERSION (supports 16KB page size)" + print_success "Android NDK version verified: $actual_ndk_version" detect_ndk_host if [ ! -d "$NDK_LLVM_BIN" ]; then @@ -267,10 +266,10 @@ check_prerequisites() { print_success "NDK host tag: $NDK_HOST" if [ ! -x "$LLVM_STRIP" ]; then - print_info "llvm-strip not found at: $LLVM_STRIP (stripping will be skipped)" - else - print_success "llvm-strip found" + print_error "Pinned llvm-strip is missing." + exit 1 fi + print_success "llvm-strip found" if [ ! -x "$LLVM_NM" ] && ! command -v nm >/dev/null 2>&1; then print_error "Neither llvm-nm nor nm found. Cannot verify JNI symbols." @@ -301,7 +300,7 @@ check_prerequisites() { } clone_or_update_arti() { - print_header "Setting up Arti Source (version: $VERSION)" + print_header "Setting up Arti Source (version: $VERSION, commit: $ARTI_COMMIT)" if [ "$CLEAN_BUILD" = true ] && [ -d "$ARTI_SOURCE_DIR" ]; then print_info "Cleaning existing Arti source..." @@ -310,29 +309,32 @@ clone_or_update_arti() { if [ ! -d "$ARTI_SOURCE_DIR" ]; then print_info "Cloning official Arti repository..." - git clone https://gitlab.torproject.org/tpo/core/arti.git "$ARTI_SOURCE_DIR" + git clone --filter=blob:none --no-checkout \ + https://gitlab.torproject.org/tpo/core/arti.git "$ARTI_SOURCE_DIR" else print_info "Using cached Arti source at $ARTI_SOURCE_DIR" fi cd "$ARTI_SOURCE_DIR" - print_info "Fetching tags..." - git fetch --tags --quiet + print_info "Fetching pinned commit..." + git fetch --depth 1 origin "$ARTI_COMMIT" --quiet - print_info "Checking out version: $VERSION" - git checkout "$VERSION" --quiet 2>/dev/null || { - print_error "Version $VERSION not found. Available versions:" - git tag | grep "^arti-v" | tail -10 - exit 1 - } + print_info "Checking out commit: $ARTI_COMMIT" + git checkout --detach "$ARTI_COMMIT" --quiet # Ensure clean working tree to avoid cached modifications influencing builds print_info "Resetting repository state (hard) and cleaning untracked files..." git reset --hard --quiet git clean -ffdqx --quiet - print_success "Arti source ready at version $VERSION" + local actual_commit + actual_commit="$(git rev-parse HEAD)" + if [ "$actual_commit" != "$ARTI_COMMIT" ]; then + print_error "Arti checkout mismatch." + exit 1 + fi + print_success "Arti source commit verified" # Apply patches if [ -d "$SCRIPT_DIR/patches" ]; then @@ -359,11 +361,43 @@ setup_wrapper() { cp "$SCRIPT_DIR/src/lib.rs" "$WRAPPER_DIR/src/" cp "$SCRIPT_DIR/Cargo.toml" "$WRAPPER_DIR/" + cp "$LOCKFILE_SOURCE" "$WRAPPER_DIR/Cargo.lock" print_success "Wrapper files copied to $WRAPPER_DIR" echo "" } +ensure_wrapper_lockfile() { + print_header "Ensuring wrapper Cargo.lock exists" + + local WRAPPER_DIR="$ARTI_SOURCE_DIR/arti-android-wrapper" + local LOCKFILE="$WRAPPER_DIR/Cargo.lock" + + if [ ! -f "$LOCKFILE_SOURCE" ] || [ ! -f "$LOCKFILE" ]; then + print_error "Committed Cargo.lock is required." + return 1 + fi + + if ! cmp -s "$LOCKFILE_SOURCE" "$LOCKFILE"; then + print_error "Wrapper Cargo.lock differs from the committed lockfile." + return 1 + fi + + print_success "Committed Cargo.lock verified" + echo "" +} + +update_wrapper_lockfile() { + print_header "Updating wrapper Cargo.lock" + + local WRAPPER_DIR="$ARTI_SOURCE_DIR/arti-android-wrapper" + cargo generate-lockfile --manifest-path "$WRAPPER_DIR/Cargo.toml" + cp "$WRAPPER_DIR/Cargo.lock" "$LOCKFILE_SOURCE" + + print_success "Updated $LOCKFILE_SOURCE" + echo "" +} + build_for_target() { local TARGET="$1" local ABI="${ABI_MAP[$TARGET]}" @@ -396,10 +430,8 @@ build_for_target() { # Strip debug symbols safely print_info "Stripping debug symbols..." if [ -x "$LLVM_STRIP" ]; then - "$LLVM_STRIP" --strip-debug "$OUTPUT_PATH/$LIB_NAME" 2>/dev/null || true + "$LLVM_STRIP" --strip-debug "$OUTPUT_PATH/$LIB_NAME" print_success "Stripped debug symbols" - else - print_info "Skipping strip (llvm-strip not available)" fi local SIZE @@ -434,6 +466,44 @@ build_for_target() { echo "" } +verify_no_host_paths() { + print_header "Verifying Native Build Privacy" + + if ! command -v strings >/dev/null 2>&1; then + print_error "strings is required to check native artifacts for host paths." + return 1 + fi + + for TARGET in "${TARGETS[@]}"; do + local ABI="${ABI_MAP[$TARGET]}" + local LIB_PATH="$JNILIBS_DIR/$ABI/libarti_android.so" + if strings "$LIB_PATH" | grep -Eq '/Users/|/home/|[A-Za-z]:\\\\Users\\\\'; then + print_error "Host-specific path detected in $ABI native library." + return 1 + fi + done + + print_success "No host-specific paths detected" + echo "" +} + +write_checksums() { + print_header "Writing Native Checksums" + + local checksum_file="$SCRIPT_DIR/SHA256SUMS" + : > "$checksum_file" + for abi in arm64-v8a armeabi-v7a x86 x86_64; do + local lib_path="$JNILIBS_DIR/$abi/libarti_android.so" + if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$lib_path" | sed "s# $JNILIBS_DIR/# app/src/main/jniLibs/#" >> "$checksum_file" + else + shasum -a 256 "$lib_path" | sed "s# $JNILIBS_DIR/# app/src/main/jniLibs/#" >> "$checksum_file" + fi + done + print_success "Wrote $checksum_file" + echo "" +} + verify_jni_symbols_for_lib() { local LIB_PATH="$1" @@ -525,11 +595,11 @@ show_summary() { echo "" echo -e "${GREEN}Next steps:${NC}" echo " 1. Test the build: ./gradlew assembleDebug" - echo " 2. Commit the .so files: git add app/src/main/jniLibs/" + echo " 2. Verify checksums: tools/arti-build/verify-checksums.sh" echo "" echo -e "${GREEN}To update Arti version:${NC}" - echo " 1. Edit ARTI_VERSION with new version tag (e.g., arti-v1.8.0)" - echo " 2. Run: ./build-arti.sh --clean" + echo " 1. Update TOOLCHAIN.env and regenerate Cargo.lock" + echo " 2. Run: tools/arti-build/rebuild-in-container.sh" echo "" } @@ -547,6 +617,10 @@ main() { check_prerequisites clone_or_update_arti setup_wrapper + if [ "$UPDATE_LOCKFILE" = true ]; then + update_wrapper_lockfile + return 0 + fi ensure_wrapper_lockfile for TARGET in "${TARGETS[@]}"; do @@ -554,31 +628,11 @@ main() { done verify_jni_symbols + verify_no_host_paths + if [ "$RELEASE_ONLY" = false ]; then + write_checksums + fi show_summary } -ensure_wrapper_lockfile() { - print_header "Ensuring wrapper Cargo.lock exists" - - local WRAPPER_DIR="$ARTI_SOURCE_DIR/arti-android-wrapper" - local LOCKFILE="$WRAPPER_DIR/Cargo.lock" - - if [ -f "$LOCKFILE" ]; then - print_success "Cargo.lock already exists" - echo "" - return 0 - fi - - print_info "Cargo.lock missing; generating it once (network access may be required)..." - (cd "$WRAPPER_DIR" && cargo generate-lockfile) - - if [ ! -f "$LOCKFILE" ]; then - print_error "Failed to generate Cargo.lock at $LOCKFILE" - return 1 - fi - - print_success "Generated Cargo.lock" - echo "" -} - main diff --git a/tools/arti-build/rebuild-in-container.sh b/tools/arti-build/rebuild-in-container.sh new file mode 100755 index 00000000..ad7918b9 --- /dev/null +++ b/tools/arti-build/rebuild-in-container.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +IMAGE_NAME="bitchat-android-arti-builder:1.9.0" +MODE="${1:-}" + +if ! command -v docker >/dev/null 2>&1; then + echo "error: Docker is required to rebuild the native Arti libraries" >&2 + exit 1 +fi + +mkdir -p "$PROJECT_ROOT/.reproducible-build/cargo-home" +# shellcheck disable=SC1091 +source "$SCRIPT_DIR/TOOLCHAIN.env" +if ! [[ "$NATIVE_SOURCE_DATE_EPOCH" =~ ^[0-9]+$ ]]; then + echo "error: NATIVE_SOURCE_DATE_EPOCH must be an integer" >&2 + exit 1 +fi + +docker build \ + --platform linux/amd64 \ + --file "$SCRIPT_DIR/Dockerfile" \ + --tag "$IMAGE_NAME" \ + "$PROJECT_ROOT" + +docker run \ + --rm \ + --platform linux/amd64 \ + --user "$(id -u):$(id -g)" \ + --env CARGO_HOME=/workspace/.reproducible-build/cargo-home \ + --env HOME=/workspace/.reproducible-build \ + --env SOURCE_DATE_EPOCH="$NATIVE_SOURCE_DATE_EPOCH" \ + --volume "$PROJECT_ROOT:/workspace" \ + "$IMAGE_NAME" \ + ${MODE:+"$MODE"} + +if [ "$MODE" = "--update-lockfile" ]; then + echo "Cargo.lock updated in the pinned native container; review it before rebuilding." + exit 0 +fi +"$SCRIPT_DIR/verify-checksums.sh" diff --git a/tools/arti-build/rust-toolchain.toml b/tools/arti-build/rust-toolchain.toml new file mode 100644 index 00000000..47e85ae9 --- /dev/null +++ b/tools/arti-build/rust-toolchain.toml @@ -0,0 +1,9 @@ +[toolchain] +channel = "1.95.0" +profile = "minimal" +targets = [ + "aarch64-linux-android", + "armv7-linux-androideabi", + "i686-linux-android", + "x86_64-linux-android", +] diff --git a/tools/arti-build/verify-checksums.sh b/tools/arti-build/verify-checksums.sh new file mode 100755 index 00000000..4ae8957f --- /dev/null +++ b/tools/arti-build/verify-checksums.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +CHECKSUM_FILE="$SCRIPT_DIR/SHA256SUMS" + +if [ ! -f "$CHECKSUM_FILE" ]; then + echo "error: missing native checksum manifest: $CHECKSUM_FILE" >&2 + exit 1 +fi + +cd "$PROJECT_ROOT" + +if command -v sha256sum >/dev/null 2>&1; then + sha256sum -c "$CHECKSUM_FILE" +else + shasum -a 256 -c "$CHECKSUM_FILE" +fi + +for library in app/src/main/jniLibs/*/libarti_android.so; do + if strings "$library" | grep -Eq '/Users/|/home/|[A-Za-z]:\\\\Users\\\\'; then + echo "error: host-specific path detected in a native library" >&2 + exit 1 + fi +done + +echo "Native Arti libraries match the pinned checksums and contain no host paths." diff --git a/tools/release_gate/mesh_lab.py b/tools/release_gate/mesh_lab.py index 214d4af0..b3c04b70 100644 --- a/tools/release_gate/mesh_lab.py +++ b/tools/release_gate/mesh_lab.py @@ -424,6 +424,101 @@ def scenario_dm(a: Device, b: Device) -> dict: } +def scenario_favorite_verification(a: Device, b: Device) -> dict: + """Assert the three-state favorite exchange and local cryptographic verification.""" + id_a = whoami(a)["peer_id"] + id_b = whoami(b)["peer_id"] + identity_a = whoami(a)["identity_fingerprint"] + + a.cmd_ok("handshake", timeout_ms=60_000, peer=id_b) + b.cmd_ok("handshake", timeout_ms=60_000, peer=id_a) + + def wait_for_status( + device: Device, + command: str, + peer_id: str, + predicate, + timeout_s: int = 30, + ) -> dict: + deadline = time.monotonic() + timeout_s + last: dict = {} + while time.monotonic() < deadline: + last = device.cmd_ok(command, peer=peer_id) + if predicate(last): + return last + time.sleep(1) + raise MeshLabError( + f"[{device.alias}] {command} did not reach the expected state: {last}" + ) + + # Start from a known non-favorite relationship without clearing either app's data. + a.cmd_ok("favorite_set", peer=id_b, enabled=False) + b.cmd_ok("favorite_set", peer=id_a, enabled=False) + neutral_a = wait_for_status( + a, + "favorite_status", + id_b, + lambda state: not state["is_favorite"] and not state["they_favorited_us"], + ) + neutral_b = wait_for_status( + b, + "favorite_status", + id_a, + lambda state: not state["is_favorite"] and not state["they_favorited_us"], + ) + + # A favorites B. B must show the orange outline while its own favorite remains false. + a.cmd_ok("favorite_set", peer=id_b, enabled=True) + received_only = wait_for_status( + b, + "favorite_status", + id_a, + lambda state: ( + not state["is_favorite"] + and state["they_favorited_us"] + and state["star_state"] == "outlined_orange" + ), + ) + + # B favorites back. Both relationships become mutual and B's star becomes filled. + b.cmd_ok("favorite_set", peer=id_a, enabled=True) + mutual_b = wait_for_status( + b, + "favorite_status", + id_a, + lambda state: state["is_mutual"] and state["star_state"] == "filled", + ) + mutual_a = wait_for_status( + a, + "favorite_status", + id_b, + lambda state: state["is_mutual"] and state["star_state"] == "filled", + ) + + # The code B displays for A must be A's SHA-256 Noise identity fingerprint. + verification_before = b.cmd_ok("verification_status", peer=id_a) + if verification_before.get("fingerprint") != identity_a: + raise MeshLabError("displayed verification fingerprint does not match peer identity") + b.cmd_ok("verification_set", peer=id_a, enabled=True) + verification_after = wait_for_status( + b, + "verification_status", + id_a, + lambda state: state["verified"], + ) + + return { + "neutral": {"a": neutral_a, "b": neutral_b}, + "received_favorite": received_only, + "mutual": {"a": mutual_a, "b": mutual_b}, + "verification": { + "fingerprint_matches_peer_identity": True, + "before": verification_before, + "after": verification_after, + }, + } + + def scenario_broadcast(a: Device, b: Device) -> dict: """Public broadcast from A received by B.""" id_a = whoami(a)["peer_id"] @@ -682,6 +777,7 @@ def scenario_file_oversize(a: Device, b: Device, fixtures: dict[str, dict]) -> d SCENARIOS = { "dm": scenario_dm, + "favorite_verification": scenario_favorite_verification, "broadcast": scenario_broadcast, # Broadcast transfers are receiver-capped at 256 fragments (~120 KB); only # the small fixture is end-to-end receivable. @@ -707,7 +803,16 @@ SCENARIOS = { # Scenarios supported when device B is a watch (file scenarios are receive-only: phone sends, # the watch must receive with matching digests). -WATCH_SCENARIOS = ["dm", "broadcast", "raw", "file", "file_private", "session_recovery", "identity_reset"] +WATCH_SCENARIOS = [ + "dm", + "favorite_verification", + "broadcast", + "raw", + "file", + "file_private", + "session_recovery", + "identity_reset", +] def run_scenario(name: str, a: Device, b: Device, out: Path | None) -> dict: diff --git a/tools/reproducible-builds/Dockerfile b/tools/reproducible-builds/Dockerfile new file mode 100644 index 00000000..a2a59a92 --- /dev/null +++ b/tools/reproducible-builds/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1@sha256:87999aa3d42bdc6bea60565083ee17e86d1f3339802f543c0d03998580f9cb89 +FROM eclipse-temurin:21.0.11_10-jdk-noble@sha256:35685c7e23352983a48882d97cd9875f5284c228db71d1e2476e5e6c1bab1080 + +SHELL ["/bin/bash", "-euo", "pipefail", "-c"] + +COPY tools/reproducible-builds/TOOLCHAIN.env /tmp/TOOLCHAIN.env +COPY tools/reproducible-builds/sdk-metadata /tmp/sdk-metadata + +ENV ANDROID_HOME=/opt/android-sdk +ENV ANDROID_SDK_ROOT=/opt/android-sdk + +RUN source /tmp/TOOLCHAIN.env \ + && mkdir -p "$ANDROID_HOME/build-tools" "$ANDROID_HOME/licenses" "$ANDROID_HOME/platforms" /tmp/android-packages \ + && printf '%s\n' "$ANDROID_SDK_LICENSE_SHA1" > "$ANDROID_HOME/licenses/android-sdk-license" \ + && curl -fsSL \ + "https://dl.google.com/android/repository/${ANDROID_BUILD_TOOLS_ARCHIVE}" \ + -o "/tmp/${ANDROID_BUILD_TOOLS_ARCHIVE}" \ + && echo "${ANDROID_BUILD_TOOLS_SHA256} /tmp/${ANDROID_BUILD_TOOLS_ARCHIVE}" | sha256sum -c - \ + && mkdir -p /tmp/android-packages/build-tools \ + && cd /tmp/android-packages/build-tools \ + && jar xf "/tmp/${ANDROID_BUILD_TOOLS_ARCHIVE}" \ + && mv "/tmp/android-packages/build-tools/android-${ANDROID_PLATFORM_VERSION}" \ + "$ANDROID_HOME/build-tools/${ANDROID_BUILD_TOOLS_VERSION}" \ + && cp /tmp/sdk-metadata/build-tools-37.0.0.xml \ + "$ANDROID_HOME/build-tools/${ANDROID_BUILD_TOOLS_VERSION}/package.xml" \ + && find "$ANDROID_HOME/build-tools/${ANDROID_BUILD_TOOLS_VERSION}" \ + -maxdepth 1 -type f -exec chmod 755 {} + \ + && curl -fsSL \ + "https://dl.google.com/android/repository/${ANDROID_PLATFORM_ARCHIVE}" \ + -o "/tmp/${ANDROID_PLATFORM_ARCHIVE}" \ + && echo "${ANDROID_PLATFORM_SHA256} /tmp/${ANDROID_PLATFORM_ARCHIVE}" | sha256sum -c - \ + && cd "$ANDROID_HOME/platforms" \ + && jar xf "/tmp/${ANDROID_PLATFORM_ARCHIVE}" \ + && cp /tmp/sdk-metadata/platform-37.0.xml \ + "$ANDROID_HOME/platforms/android-${ANDROID_PLATFORM_VERSION}/package.xml" \ + && test -f "$ANDROID_HOME/platforms/android-${ANDROID_PLATFORM_VERSION}/android.jar" \ + && curl -fsSL \ + "https://dl.google.com/android/repository/${ANDROID_PLATFORM_TOOLS_ARCHIVE}" \ + -o "/tmp/${ANDROID_PLATFORM_TOOLS_ARCHIVE}" \ + && echo "${ANDROID_PLATFORM_TOOLS_SHA256} /tmp/${ANDROID_PLATFORM_TOOLS_ARCHIVE}" | sha256sum -c - \ + && cd "$ANDROID_HOME" \ + && jar xf "/tmp/${ANDROID_PLATFORM_TOOLS_ARCHIVE}" \ + && cp /tmp/sdk-metadata/platform-tools-37.0.0.xml \ + "$ANDROID_HOME/platform-tools/package.xml" \ + && find "$ANDROID_HOME/platform-tools" -maxdepth 1 -type f -exec chmod 755 {} + \ + && rm -rf /tmp/android-packages \ + "/tmp/${ANDROID_BUILD_TOOLS_ARCHIVE}" \ + "/tmp/${ANDROID_PLATFORM_ARCHIVE}" \ + "/tmp/${ANDROID_PLATFORM_TOOLS_ARCHIVE}" + +ENV PATH=/opt/android-sdk/build-tools/37.0.0:${PATH} + +ENV TZ=UTC +ENV LC_ALL=C.UTF-8 + +WORKDIR /workspace + +ENTRYPOINT ["/bin/bash", "tools/reproducible-builds/build-release.sh"] diff --git a/tools/reproducible-builds/TOOLCHAIN.env b/tools/reproducible-builds/TOOLCHAIN.env new file mode 100644 index 00000000..75d47323 --- /dev/null +++ b/tools/reproducible-builds/TOOLCHAIN.env @@ -0,0 +1,14 @@ +JAVA_VERSION=21.0.11+10 +JAVA_MAJOR_VERSION=21 +GRADLE_VERSION=9.6.1 +ANDROID_COMPILE_SDK=37 +ANDROID_PLATFORM_VERSION=37.0 +ANDROID_PLATFORM_ARCHIVE=platform-37.0_r02.zip +ANDROID_PLATFORM_SHA256=840b23e827f96e64aea4c89a1194aac3dc5f6bad37edb231c5c795d890330e8d +ANDROID_SDK_LICENSE_SHA1=24333f8a63b6825ea9c5514f83c2829b004d1fee +ANDROID_PLATFORM_TOOLS_VERSION=37.0.0 +ANDROID_PLATFORM_TOOLS_ARCHIVE=platform-tools_r37.0.0-linux.zip +ANDROID_PLATFORM_TOOLS_SHA256=198ae156ab285fa555987219af237b31102fefe8b9d2bc274708a8d4f2865a07 +ANDROID_BUILD_TOOLS_VERSION=37.0.0 +ANDROID_BUILD_TOOLS_ARCHIVE=build-tools_r37_linux.zip +ANDROID_BUILD_TOOLS_SHA256=01af179347cbcd9c208b7f8171f7b21f6dd1d2f85bcd15e88caa51d5d7b86060 diff --git a/tools/reproducible-builds/build-in-container.sh b/tools/reproducible-builds/build-in-container.sh new file mode 100755 index 00000000..76bcc15d --- /dev/null +++ b/tools/reproducible-builds/build-in-container.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +IMAGE_NAME="bitchat-android-reproducible-builder:21.0.11" +OUTPUT_DIR="${1:-$PROJECT_ROOT/.reproducible-build/release}" +GRADLE_HOME_NAME="${BITCHAT_CONTAINER_GRADLE_HOME_NAME:-gradle-home-container}" +CONTAINER_LOCAL_PROPERTIES="$SCRIPT_DIR/container-local.properties" + +if ! command -v docker >/dev/null 2>&1; then + echo "error: Docker is required for the canonical container build" >&2 + exit 1 +fi +if [ ! -f "$CONTAINER_LOCAL_PROPERTIES" ]; then + echo "error: missing canonical container local.properties" >&2 + exit 1 +fi + +if [ "${BITCHAT_ALLOW_DIRTY:-0}" != "1" ] && [ -n "$(git -C "$PROJECT_ROOT" status --porcelain --untracked-files=normal)" ]; then + echo "error: reproducible builds require a clean source tree" >&2 + exit 1 +fi + +source_commit="$(git -C "$PROJECT_ROOT" rev-parse HEAD)" +source_date_epoch="$(git -C "$PROJECT_ROOT" log -1 --format=%ct)" + +if ! [[ "$GRADLE_HOME_NAME" =~ ^[A-Za-z0-9._-]+$ ]]; then + echo "error: BITCHAT_CONTAINER_GRADLE_HOME_NAME must be a simple directory name" >&2 + exit 1 +fi + +mkdir -p "$PROJECT_ROOT/.reproducible-build" +staging_root="$(mktemp -d "$PROJECT_ROOT/.reproducible-build/source.XXXXXX")" +cleanup() { + rm -rf -- "$staging_root" +} +trap cleanup EXIT + +# Build from the exact committed tree rather than the host checkout. This keeps +# ignored files and Android Studio state out of the canonical build and avoids +# nested bind mounts, which are not portable across Docker runtimes. +git -C "$PROJECT_ROOT" archive --format=tar "$source_commit" | + tar -xf - -C "$staging_root" +cp "$CONTAINER_LOCAL_PROPERTIES" "$staging_root/local.properties" + +gradle_home="$PROJECT_ROOT/.reproducible-build/$GRADLE_HOME_NAME" +mkdir -p "$gradle_home" + +docker build \ + --platform linux/amd64 \ + --file "$SCRIPT_DIR/Dockerfile" \ + --tag "$IMAGE_NAME" \ + "$PROJECT_ROOT" + +mkdir -p "$OUTPUT_DIR" +OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)" + +docker run \ + --rm \ + --platform linux/amd64 \ + --user "$(id -u):$(id -g)" \ + --env BITCHAT_ALLOW_DIRTY="${BITCHAT_ALLOW_DIRTY:-0}" \ + --env BITCHAT_GRADLE_USER_HOME=/gradle-home \ + --env BITCHAT_SOURCE_COMMIT="$source_commit" \ + --env BITCHAT_SOURCE_TREE_VERIFIED=1 \ + --env HOME=/tmp/build-home \ + --env SOURCE_DATE_EPOCH="$source_date_epoch" \ + --volume "$staging_root:/workspace" \ + --volume "$gradle_home:/gradle-home" \ + --volume "$OUTPUT_DIR:/output" \ + "$IMAGE_NAME" \ + /output diff --git a/tools/reproducible-builds/build-release.sh b/tools/reproducible-builds/build-release.sh new file mode 100755 index 00000000..197dffc9 --- /dev/null +++ b/tools/reproducible-builds/build-release.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +OUTPUT_DIR="${1:-$PROJECT_ROOT/.reproducible-build/release}" + +# shellcheck disable=SC1091 +source "$SCRIPT_DIR/TOOLCHAIN.env" + +if [ "${BITCHAT_SOURCE_TREE_VERIFIED:-0}" != "1" ] && + [ "${BITCHAT_ALLOW_DIRTY:-0}" != "1" ] && + [ -n "$(git -C "$PROJECT_ROOT" status --porcelain --untracked-files=normal)" ]; then + echo "error: reproducible builds require a clean source tree" >&2 + exit 1 +fi + +mkdir -p "$OUTPUT_DIR" +OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)" +if [ -n "$(find "$OUTPUT_DIR" -mindepth 1 -maxdepth 1 -print -quit)" ]; then + echo "error: output directory must be empty: $OUTPUT_DIR" >&2 + exit 1 +fi + +actual_java_version="$(java -XshowSettings:properties -version 2>&1 | sed -n 's/^ *java.version = //p' | head -1)" +expected_java_version="${JAVA_VERSION%%+*}" +if [ "$actual_java_version" != "$expected_java_version" ]; then + echo "error: JDK $expected_java_version is required; found $actual_java_version" >&2 + exit 1 +fi + +"$PROJECT_ROOT/tools/arti-build/verify-checksums.sh" + +export GRADLE_USER_HOME="${BITCHAT_GRADLE_USER_HOME:-$PROJECT_ROOT/.reproducible-build/gradle-home}" +export LC_ALL=C.UTF-8 +export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(git -C "$PROJECT_ROOT" log -1 --format=%ct)}" +export TZ=UTC +if ! [[ "$SOURCE_DATE_EPOCH" =~ ^[0-9]+$ ]]; then + echo "error: SOURCE_DATE_EPOCH must be an integer" >&2 + exit 1 +fi + +gradle_args=( + -Pkotlin.compiler.execution.strategy=in-process + -Pkotlin.incremental=false + --no-build-cache + --no-configuration-cache + --no-daemon + --no-watch-fs + --rerun-tasks +) + +cd "$PROJECT_ROOT" +./gradlew "${gradle_args[@]}" :app:clean :app:bundleRelease + +aab_source="$PROJECT_ROOT/app/build/outputs/bundle/release/app-release.aab" +if [ ! -f "$aab_source" ]; then + echo "error: expected release AAB not found" >&2 + exit 1 +fi +cp "$aab_source" "$OUTPUT_DIR/bitchat-android-release-unsigned.aab" + +# AGP cannot build split APKs and an app bundle from the same intermediates. +./gradlew "${gradle_args[@]}" :app:clean :app:assembleRelease + +declare -A apk_names=( + ["app-arm64-v8a-release-unsigned.apk"]="bitchat-android-arm64-unsigned.apk" + ["app-armeabi-v7a-release-unsigned.apk"]="bitchat-android-armv7-unsigned.apk" + ["app-universal-release-unsigned.apk"]="bitchat-android-universal-unsigned.apk" + ["app-x86-release-unsigned.apk"]="bitchat-android-x86-unsigned.apk" + ["app-x86_64-release-unsigned.apk"]="bitchat-android-x86_64-unsigned.apk" +) + +for source_name in "${!apk_names[@]}"; do + source_path="$PROJECT_ROOT/app/build/outputs/apk/release/$source_name" + if [ ! -f "$source_path" ]; then + echo "error: expected release APK not found: $source_name" >&2 + exit 1 + fi + cp "$source_path" "$OUTPUT_DIR/${apk_names[$source_name]}" +done + +source_commit="${BITCHAT_SOURCE_COMMIT:-$(git -C "$PROJECT_ROOT" rev-parse HEAD)}" +if ! [[ "$source_commit" =~ ^([0-9a-f]{40}|[0-9a-f]{64})$ ]]; then + echo "error: source commit must be a full Git object ID" >&2 + exit 1 +fi +native_manifest_sha256="$(sha256sum "$PROJECT_ROOT/tools/arti-build/SHA256SUMS" | awk '{print $1}')" + +cat > "$OUTPUT_DIR/BUILDINFO.json" < SHA256SUMS.unsigned +) + +echo "Reproducible unsigned release written to $OUTPUT_DIR" diff --git a/tools/reproducible-builds/compare-archive-payloads.sh b/tools/reproducible-builds/compare-archive-payloads.sh new file mode 100755 index 00000000..6cb5a9ea --- /dev/null +++ b/tools/reproducible-builds/compare-archive-payloads.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +set -euo pipefail + +FIRST_ARCHIVE="${1:?usage: compare-archive-payloads.sh FIRST.apk|aab SECOND.apk|aab}" +SECOND_ARCHIVE="${2:?usage: compare-archive-payloads.sh FIRST.apk|aab SECOND.apk|aab}" +TEMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TEMP_DIR"' EXIT + +if ! command -v unzip >/dev/null 2>&1; then + echo "error: unzip is required" >&2 + exit 1 +fi +if command -v sha256sum >/dev/null 2>&1; then + SHA256=(sha256sum) +elif command -v shasum >/dev/null 2>&1; then + SHA256=(shasum -a 256) +else + echo "error: sha256sum or shasum is required" >&2 + exit 1 +fi + +write_payload_manifest() { + local archive="$1" + local output="$2" + + : > "$output" + while IFS= read -r entry; do + case "$entry" in + */|META-INF/MANIFEST.MF|META-INF/*.SF|META-INF/*.RSA|META-INF/*.DSA|META-INF/*.EC) + continue + ;; + esac + local digest + digest="$(unzip -p "$archive" "$entry" | "${SHA256[@]}" | awk '{print $1}')" + printf '%s %s\n' "$digest" "$entry" >> "$output" + done < <(unzip -Z1 "$archive" | LC_ALL=C sort) +} + +write_payload_manifest "$FIRST_ARCHIVE" "$TEMP_DIR/first" +write_payload_manifest "$SECOND_ARCHIVE" "$TEMP_DIR/second" + +if ! diff -u "$TEMP_DIR/first" "$TEMP_DIR/second"; then + echo "error: signed/unsigned archive payloads differ" >&2 + exit 1 +fi + +echo "Archive entry names and uncompressed payload bytes match (signing metadata excluded)." diff --git a/tools/reproducible-builds/compare-release.sh b/tools/reproducible-builds/compare-release.sh new file mode 100755 index 00000000..611c2d0e --- /dev/null +++ b/tools/reproducible-builds/compare-release.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -euo pipefail + +FIRST_DIR="${1:?usage: compare-release.sh FIRST_DIR SECOND_DIR}" +SECOND_DIR="${2:?usage: compare-release.sh FIRST_DIR SECOND_DIR}" + +artifacts=( + BUILDINFO.json + SHA256SUMS.unsigned + bitchat-android-arm64-unsigned.apk + bitchat-android-armv7-unsigned.apk + bitchat-android-release-unsigned.aab + bitchat-android-universal-unsigned.apk + bitchat-android-x86-unsigned.apk + bitchat-android-x86_64-unsigned.apk +) + +for artifact in "${artifacts[@]}"; do + if ! cmp -s "$FIRST_DIR/$artifact" "$SECOND_DIR/$artifact"; then + echo "error: reproducibility mismatch: $artifact" >&2 + if command -v diffoscope >/dev/null 2>&1; then + diffoscope "$FIRST_DIR/$artifact" "$SECOND_DIR/$artifact" || true + fi + exit 1 + fi + echo "MATCH $artifact" +done + +echo "All unsigned APK, AAB, checksum, and build-info bytes match." diff --git a/tools/reproducible-builds/container-local.properties b/tools/reproducible-builds/container-local.properties new file mode 100644 index 00000000..daae45e6 --- /dev/null +++ b/tools/reproducible-builds/container-local.properties @@ -0,0 +1 @@ +sdk.dir=/opt/android-sdk diff --git a/tools/reproducible-builds/install-android-build-tools.sh b/tools/reproducible-builds/install-android-build-tools.sh new file mode 100755 index 00000000..bf2bf1b5 --- /dev/null +++ b/tools/reproducible-builds/install-android-build-tools.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SDK_ROOT="${1:?usage: install-android-build-tools.sh SDK_ROOT}" + +# shellcheck disable=SC1091 +source "$SCRIPT_DIR/TOOLCHAIN.env" + +for command in curl sha256sum unzip; do + if ! command -v "$command" >/dev/null 2>&1; then + echo "error: $command is required" >&2 + exit 1 + fi +done + +destination="$SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION" +if [ -e "$destination" ]; then + echo "error: Android Build Tools destination already exists: $destination" >&2 + exit 1 +fi + +TEMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TEMP_DIR"' EXIT +archive="$TEMP_DIR/$ANDROID_BUILD_TOOLS_ARCHIVE" + +curl -fsSL \ + "https://dl.google.com/android/repository/$ANDROID_BUILD_TOOLS_ARCHIVE" \ + -o "$archive" +echo "$ANDROID_BUILD_TOOLS_SHA256 $archive" | sha256sum -c - +unzip -q "$archive" -d "$TEMP_DIR/unpacked" + +mkdir -p "$SDK_ROOT/build-tools" +mv "$TEMP_DIR/unpacked/android-$ANDROID_PLATFORM_VERSION" "$destination" +test "$( + sed -n 's/^Pkg.Revision=//p' "$destination/source.properties" | tr -d '\r' +)" = "$ANDROID_BUILD_TOOLS_VERSION" + +echo "Installed checksum-verified Android Build Tools $ANDROID_BUILD_TOOLS_VERSION." diff --git a/tools/reproducible-builds/prepare-github-release.sh b/tools/reproducible-builds/prepare-github-release.sh new file mode 100755 index 00000000..73ea9f32 --- /dev/null +++ b/tools/reproducible-builds/prepare-github-release.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +set -euo pipefail + +RELEASE_DIR="${1:?usage: prepare-github-release.sh RELEASE_DIR}" + +if [ ! -d "$RELEASE_DIR" ]; then + echo "error: release directory not found" >&2 + exit 1 +fi +RELEASE_DIR="$(cd "$RELEASE_DIR" && pwd)" + +if command -v sha256sum >/dev/null 2>&1; then + SHA256=(sha256sum) +elif command -v shasum >/dev/null 2>&1; then + SHA256=(shasum -a 256) +else + echo "error: sha256sum or shasum is required" >&2 + exit 1 +fi + +required=( + BUILDINFO.json + SHA256SUMS + SHA256SUMS.unsigned + bitchat-android-arm64-unsigned.apk + bitchat-android-arm64.apk + bitchat-android-armv7-unsigned.apk + bitchat-android-play-upload.aab + bitchat-android-release-unsigned.aab + bitchat-android-universal-unsigned.apk + bitchat-android-universal.apk + bitchat-android-x86-unsigned.apk + bitchat-android-x86_64-unsigned.apk + bitchat-android-x86_64.apk +) +for artifact in "${required[@]}"; do + if [ ! -f "$RELEASE_DIR/$artifact" ]; then + echo "error: required release artifact missing: $artifact" >&2 + exit 1 + fi +done + +for artifact_path in "$RELEASE_DIR"/*; do + if [ ! -f "$artifact_path" ]; then + echo "error: unexpected non-file in release directory: $(basename "$artifact_path")" >&2 + exit 1 + fi + artifact="$(basename "$artifact_path")" + case "$artifact" in + BUILDINFO.json|SHA256SUMS|SHA256SUMS.unsigned|\ + bitchat-android-arm64-unsigned.apk|bitchat-android-arm64.apk|\ + bitchat-android-armv7-unsigned.apk|\ + bitchat-android-play-upload.aab|bitchat-android-release-unsigned.aab|\ + bitchat-android-universal-unsigned.apk|bitchat-android-universal.apk|\ + bitchat-android-x86-unsigned.apk|\ + bitchat-android-x86_64-unsigned.apk|bitchat-android-x86_64.apk) + ;; + *) + echo "error: unexpected release artifact: $artifact" >&2 + exit 1 + ;; + esac +done + +for destination in BITCHAT_BUILDINFO.json BITCHAT_SHA256SUMS BITCHAT_SHA256SUMS.unsigned; do + if [ -e "$RELEASE_DIR/$destination" ]; then + echo "error: public release manifest already exists: $destination" >&2 + exit 1 + fi +done + +( + cd "$RELEASE_DIR" + "${SHA256[@]}" -c SHA256SUMS +) + +mv "$RELEASE_DIR/BUILDINFO.json" "$RELEASE_DIR/BITCHAT_BUILDINFO.json" +mv "$RELEASE_DIR/SHA256SUMS.unsigned" "$RELEASE_DIR/BITCHAT_SHA256SUMS.unsigned" +sed \ + -e 's/ BUILDINFO.json$/ BITCHAT_BUILDINFO.json/' \ + -e 's/ SHA256SUMS.unsigned$/ BITCHAT_SHA256SUMS.unsigned/' \ + "$RELEASE_DIR/SHA256SUMS" > "$RELEASE_DIR/BITCHAT_SHA256SUMS" +rm "$RELEASE_DIR/SHA256SUMS" + +( + cd "$RELEASE_DIR" + "${SHA256[@]}" -c BITCHAT_SHA256SUMS +) + +echo "Release assets are checksummed and ready for manual GitHub publication." diff --git a/tools/reproducible-builds/sdk-metadata/build-tools-37.0.0.xml b/tools/reproducible-builds/sdk-metadata/build-tools-37.0.0.xml new file mode 100644 index 00000000..5a405083 --- /dev/null +++ b/tools/reproducible-builds/sdk-metadata/build-tools-37.0.0.xml @@ -0,0 +1,16 @@ + + + + + + 37 + 0 + 0 + + Android SDK Build-Tools 37 + + diff --git a/tools/reproducible-builds/sdk-metadata/platform-37.0.xml b/tools/reproducible-builds/sdk-metadata/platform-37.0.xml new file mode 100644 index 00000000..dba2134d --- /dev/null +++ b/tools/reproducible-builds/sdk-metadata/platform-37.0.xml @@ -0,0 +1,20 @@ + + + + + 37.0 + + 22 + true + + + + 2 + + Android SDK Platform 37.0 + + diff --git a/tools/reproducible-builds/sdk-metadata/platform-tools-37.0.0.xml b/tools/reproducible-builds/sdk-metadata/platform-tools-37.0.0.xml new file mode 100644 index 00000000..5936e574 --- /dev/null +++ b/tools/reproducible-builds/sdk-metadata/platform-tools-37.0.0.xml @@ -0,0 +1,16 @@ + + + + + + 37 + 0 + 0 + + Android SDK Platform-Tools + + diff --git a/tools/reproducible-builds/sign-play-bundle.sh b/tools/reproducible-builds/sign-play-bundle.sh new file mode 100755 index 00000000..fabb8409 --- /dev/null +++ b/tools/reproducible-builds/sign-play-bundle.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +RELEASE_DIR="${1:?usage: sign-play-bundle.sh RELEASE_DIR}" + +: "${BITCHAT_PLAY_UPLOAD_KEYSTORE:?BITCHAT_PLAY_UPLOAD_KEYSTORE is required}" +: "${BITCHAT_PLAY_UPLOAD_KEY_ALIAS:?BITCHAT_PLAY_UPLOAD_KEY_ALIAS is required}" +: "${BITCHAT_PLAY_KEYSTORE_PASSWORD:?BITCHAT_PLAY_KEYSTORE_PASSWORD is required}" +: "${BITCHAT_PLAY_KEY_PASSWORD:?BITCHAT_PLAY_KEY_PASSWORD is required}" + +if [ ! -d "$RELEASE_DIR" ]; then + echo "error: release directory not found" >&2 + exit 1 +fi +RELEASE_DIR="$(cd "$RELEASE_DIR" && pwd)" + +if [ ! -f "$BITCHAT_PLAY_UPLOAD_KEYSTORE" ]; then + echo "error: Play upload keystore not found" >&2 + exit 1 +fi +KEYSTORE="$( + cd "$(dirname "$BITCHAT_PLAY_UPLOAD_KEYSTORE")" + printf '%s/%s\n' "$PWD" "$(basename "$BITCHAT_PLAY_UPLOAD_KEYSTORE")" +)" + +if [ -n "${JAVA_HOME:-}" ] && [ -x "$JAVA_HOME/bin/jarsigner" ]; then + JARSIGNER="$JAVA_HOME/bin/jarsigner" +elif command -v jarsigner >/dev/null 2>&1; then + JARSIGNER="$(command -v jarsigner)" +else + echo "error: jarsigner is required; set JAVA_HOME to the pinned JDK" >&2 + exit 1 +fi + +if command -v sha256sum >/dev/null 2>&1; then + SHA256=(sha256sum) +elif command -v shasum >/dev/null 2>&1; then + SHA256=(shasum -a 256) +else + echo "error: sha256sum or shasum is required" >&2 + exit 1 +fi + +( + cd "$RELEASE_DIR" + "${SHA256[@]}" -c SHA256SUMS.unsigned +) + +UNSIGNED_AAB="$RELEASE_DIR/bitchat-android-release-unsigned.aab" +SIGNED_AAB="$RELEASE_DIR/bitchat-android-play-upload.aab" +if [ -e "$SIGNED_AAB" ]; then + echo "error: signed Play upload AAB already exists" >&2 + exit 1 +fi + +TEMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TEMP_DIR"' EXIT +STOREPASS_FILE="$TEMP_DIR/storepass" +KEYPASS_FILE="$TEMP_DIR/keypass" +printf '%s\n' "$BITCHAT_PLAY_KEYSTORE_PASSWORD" > "$STOREPASS_FILE" +printf '%s\n' "$BITCHAT_PLAY_KEY_PASSWORD" > "$KEYPASS_FILE" +chmod 600 "$STOREPASS_FILE" "$KEYPASS_FILE" + +"$JARSIGNER" \ + -keystore "$KEYSTORE" \ + -storepass:file "$STOREPASS_FILE" \ + -keypass:file "$KEYPASS_FILE" \ + -digestalg SHA-256 \ + -signedjar "$SIGNED_AAB" \ + "$UNSIGNED_AAB" \ + "$BITCHAT_PLAY_UPLOAD_KEY_ALIAS" + +"$JARSIGNER" -verify "$SIGNED_AAB" >/dev/null +"$SCRIPT_DIR/compare-archive-payloads.sh" "$UNSIGNED_AAB" "$SIGNED_AAB" + +( + cd "$RELEASE_DIR" + { + for artifact in *; do + [ "$artifact" = "SHA256SUMS" ] && continue + [ -f "$artifact" ] || continue + "${SHA256[@]}" "$artifact" + done + } | sort -k2 > SHA256SUMS +) + +echo "Verified unsigned AAB was signed locally with the Play upload key and checksummed." diff --git a/tools/reproducible-builds/sign-release.sh b/tools/reproducible-builds/sign-release.sh new file mode 100755 index 00000000..b36d2da9 --- /dev/null +++ b/tools/reproducible-builds/sign-release.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +RELEASE_DIR="${1:?usage: sign-release.sh RELEASE_DIR}" + +# shellcheck disable=SC1091 +source "$SCRIPT_DIR/TOOLCHAIN.env" + +: "${BITCHAT_GITHUB_KEYSTORE:?BITCHAT_GITHUB_KEYSTORE is required}" +: "${BITCHAT_GITHUB_KEY_ALIAS:?BITCHAT_GITHUB_KEY_ALIAS is required}" +: "${BITCHAT_GITHUB_KEYSTORE_PASSWORD:?BITCHAT_GITHUB_KEYSTORE_PASSWORD is required}" +: "${BITCHAT_GITHUB_KEY_PASSWORD:?BITCHAT_GITHUB_KEY_PASSWORD is required}" + +if [ ! -f "$BITCHAT_GITHUB_KEYSTORE" ]; then + echo "error: GitHub release keystore not found" >&2 + exit 1 +fi +KEYSTORE="$( + cd "$(dirname "$BITCHAT_GITHUB_KEYSTORE")" + printf '%s/%s\n' "$PWD" "$(basename "$BITCHAT_GITHUB_KEYSTORE")" +)" + +ANDROID_SDK_HOME="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}" +if [ -z "$ANDROID_SDK_HOME" ]; then + echo "error: ANDROID_SDK_ROOT or ANDROID_HOME is required" >&2 + exit 1 +fi + +APKSIGNER="$ANDROID_SDK_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner" +ZIPALIGN="$ANDROID_SDK_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION/zipalign" +if [ ! -x "$APKSIGNER" ] || [ ! -x "$ZIPALIGN" ]; then + echo "error: Android Build Tools $ANDROID_BUILD_TOOLS_VERSION are required" >&2 + exit 1 +fi + +if command -v sha256sum >/dev/null 2>&1; then + SHA256=(sha256sum) +elif command -v shasum >/dev/null 2>&1; then + SHA256=(shasum -a 256) +else + echo "error: sha256sum or shasum is required" >&2 + exit 1 +fi + +( + cd "$RELEASE_DIR" + "${SHA256[@]}" -c SHA256SUMS.unsigned +) + +EXPECTED_CERT_SHA256="$( + sed -n 's/^BITCHAT_GITHUB_RELEASE_CERT_SHA256=//p' "$PROJECT_ROOT/gradle.properties" | + tr -d ':\r[:space:]' | + tr '[:upper:]' '[:lower:]' +)" +if ! [[ "$EXPECTED_CERT_SHA256" =~ ^[a-f0-9]{64}$ ]]; then + echo "error: expected GitHub release certificate fingerprint is invalid" >&2 + exit 1 +fi + +TEMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TEMP_DIR"' EXIT +export BITCHAT_GITHUB_KEYSTORE_PASSWORD +export BITCHAT_GITHUB_KEY_PASSWORD + +unsigned_names=( + "bitchat-android-arm64-unsigned.apk" + "bitchat-android-universal-unsigned.apk" + "bitchat-android-x86_64-unsigned.apk" +) +signed_names=( + "bitchat-android-arm64.apk" + "bitchat-android-universal.apk" + "bitchat-android-x86_64.apk" +) + +for ((index = 0; index < ${#unsigned_names[@]}; index++)); do + unsigned_name="${unsigned_names[$index]}" + signed_name="${signed_names[$index]}" + unsigned_apk="$RELEASE_DIR/$unsigned_name" + signed_apk="$RELEASE_DIR/$signed_name" + first_signed="$TEMP_DIR/first.apk" + second_signed="$TEMP_DIR/second.apk" + + if [ -e "$signed_apk" ]; then + echo "error: signed APK already exists: $signed_name" >&2 + exit 1 + fi + "$ZIPALIGN" -c -P 16 4 "$unsigned_apk" + + for output_apk in "$first_signed" "$second_signed"; do + "$APKSIGNER" sign \ + --ks "$KEYSTORE" \ + --ks-key-alias "$BITCHAT_GITHUB_KEY_ALIAS" \ + --ks-pass env:BITCHAT_GITHUB_KEYSTORE_PASSWORD \ + --key-pass env:BITCHAT_GITHUB_KEY_PASSWORD \ + --deterministic-dsa-signing true \ + --min-sdk-version 26 \ + --v1-signing-enabled false \ + --v2-signing-enabled true \ + --v3-signing-enabled true \ + --v4-signing-enabled false \ + --out "$output_apk" \ + "$unsigned_apk" + done + + if ! cmp -s "$first_signed" "$second_signed"; then + echo "error: signing is not deterministic for $unsigned_name" >&2 + exit 1 + fi + + mv "$first_signed" "$signed_apk" + actual_cert_sha256="$( + "$APKSIGNER" verify --print-certs "$signed_apk" | + sed -n 's/.*certificate SHA-256 digest: //p' | + head -1 | + tr -d ':\r[:space:]' | + tr '[:upper:]' '[:lower:]' + )" + if [ "$actual_cert_sha256" != "$EXPECTED_CERT_SHA256" ]; then + echo "error: signing certificate fingerprint mismatch" >&2 + exit 1 + fi + "$APKSIGNER" verify --verbose "$signed_apk" >/dev/null + rm -f "$second_signed" +done + +( + cd "$RELEASE_DIR" + { + for artifact in *; do + [ "$artifact" = "SHA256SUMS" ] && continue + [ -f "$artifact" ] || continue + "${SHA256[@]}" "$artifact" + done + } | sort -k2 > SHA256SUMS +) + +echo "Verified unsigned APKs were deterministically signed locally and checksummed." diff --git a/tools/reproducible-builds/verify-github-release.sh b/tools/reproducible-builds/verify-github-release.sh new file mode 100755 index 00000000..64cb7574 --- /dev/null +++ b/tools/reproducible-builds/verify-github-release.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +TAG="${1:?usage: verify-github-release.sh TAG [--no-rebuild]}" +MODE="${2:-}" +REPOSITORY="${BITCHAT_GITHUB_REPOSITORY:-permissionlesstech/bitchat-android}" +TEMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TEMP_DIR"' EXIT + +if ! [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then + echo "error: release tag must look like vX.Y.Z" >&2 + exit 1 +fi +if [ -n "$MODE" ] && [ "$MODE" != "--no-rebuild" ]; then + echo "error: unknown option: $MODE" >&2 + exit 1 +fi + +if ! command -v gh >/dev/null 2>&1; then + echo "error: gh is required" >&2 + exit 1 +fi +if command -v sha256sum >/dev/null 2>&1; then + SHA256=(sha256sum) +elif command -v shasum >/dev/null 2>&1; then + SHA256=(shasum -a 256) +else + echo "error: sha256sum or shasum is required" >&2 + exit 1 +fi + +DOWNLOAD_DIR="$TEMP_DIR/github" +mkdir -p "$DOWNLOAD_DIR" +gh release download "$TAG" \ + --repo "$REPOSITORY" \ + --dir "$DOWNLOAD_DIR" \ + --pattern 'BITCHAT_BUILDINFO.json' \ + --pattern 'BITCHAT_SHA256SUMS' \ + --pattern 'BITCHAT_SHA256SUMS.unsigned' \ + --pattern 'bitchat-android-*.apk' \ + --pattern 'bitchat-android-*.aab' + +attested_artifacts=( + BITCHAT_BUILDINFO.json + BITCHAT_SHA256SUMS.unsigned + bitchat-android-arm64-unsigned.apk + bitchat-android-armv7-unsigned.apk + bitchat-android-release-unsigned.aab + bitchat-android-universal-unsigned.apk + bitchat-android-x86-unsigned.apk + bitchat-android-x86_64-unsigned.apk +) +for artifact in "${attested_artifacts[@]}"; do + if [ ! -f "$DOWNLOAD_DIR/$artifact" ]; then + echo "error: attested canonical artifact missing: $artifact" >&2 + exit 1 + fi + gh attestation verify "$DOWNLOAD_DIR/$artifact" --repo "$REPOSITORY" >/dev/null +done +echo "GitHub provenance attestations for the canonical unsigned build verified." + +( + cd "$DOWNLOAD_DIR" + "${SHA256[@]}" -c BITCHAT_SHA256SUMS +) +echo "GitHub release checksums verified." + +mv "$DOWNLOAD_DIR/BITCHAT_BUILDINFO.json" "$DOWNLOAD_DIR/BUILDINFO.json" +mv "$DOWNLOAD_DIR/BITCHAT_SHA256SUMS" "$DOWNLOAD_DIR/SHA256SUMS" +mv "$DOWNLOAD_DIR/BITCHAT_SHA256SUMS.unsigned" "$DOWNLOAD_DIR/SHA256SUMS.unsigned" + +if [ "$MODE" = "--no-rebuild" ]; then + exit 0 +fi + +release_commit="$(sed -n 's/.*"sourceCommit": *"\([^"]*\)".*/\1/p' "$DOWNLOAD_DIR/BUILDINFO.json")" +local_commit="$(git -C "$PROJECT_ROOT" rev-parse HEAD)" +if [ "$release_commit" != "$local_commit" ]; then + echo "error: check out release commit $release_commit before rebuilding" >&2 + exit 1 +fi + +LOCAL_DIR="$PROJECT_ROOT/.reproducible-build/verify-$TAG" +if [ -e "$LOCAL_DIR" ]; then + echo "error: local verification output already exists: $LOCAL_DIR" >&2 + exit 1 +fi + +"$SCRIPT_DIR/build-in-container.sh" "$LOCAL_DIR" +"$SCRIPT_DIR/compare-release.sh" "$LOCAL_DIR" "$DOWNLOAD_DIR" +echo "GitHub release $TAG was reproduced successfully from source." diff --git a/tools/reproducible-builds/verify-no-host-paths.sh b/tools/reproducible-builds/verify-no-host-paths.sh new file mode 100755 index 00000000..b4b277c5 --- /dev/null +++ b/tools/reproducible-builds/verify-no-host-paths.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ARTIFACT_DIR="${1:?usage: verify-no-host-paths.sh ARTIFACT_DIR}" +TEMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TEMP_DIR"' EXIT + +archive_index=0 +for artifact in "$ARTIFACT_DIR"/*.apk "$ARTIFACT_DIR"/*.aab; do + [ -f "$artifact" ] || continue + archive_index=$((archive_index + 1)) + archive_dir="$TEMP_DIR/$archive_index" + mkdir -p "$archive_dir" + if command -v unzip >/dev/null 2>&1; then + unzip -qq "$artifact" 'lib/*/*.so' 'base/lib/*/*.so' -d "$archive_dir" 2>/dev/null || true + elif command -v jar >/dev/null 2>&1; then + ( + cd "$archive_dir" + jar xf "$artifact" + ) + else + echo "error: unzip or jar is required to inspect release artifacts" >&2 + exit 1 + fi +done + +while IFS= read -r -d '' library; do + if strings "$library" | grep -Eq '/Users/|/home/|[A-Za-z]:\\\\Users\\\\'; then + echo "error: host-specific path detected in a release artifact" >&2 + exit 1 + fi +done < <(find "$TEMP_DIR" -type f -name '*.so' -print0) + +echo "Release artifacts contain no host-specific native paths." diff --git a/wear/build.gradle.kts b/wear/build.gradle.kts index 03ae1431..819fc5cd 100644 --- a/wear/build.gradle.kts +++ b/wear/build.gradle.kts @@ -77,6 +77,8 @@ val sharedSourceIncludes = listOf( "com/bitchat/android/services/AppStateStore.kt", "com/bitchat/android/services/ContactDirectory.kt", "com/bitchat/android/services/ContactIdentityResolver.kt", + "com/bitchat/android/services/ConversationRepository.kt", + "com/bitchat/android/services/ConversationStorageCipher.kt", "com/bitchat/android/services/PrivateMessageArrivalOrder.kt", "com/bitchat/android/services/SeenMessageStore.kt", "com/bitchat/android/services/VerificationService.kt", diff --git a/wear/gradle.lockfile b/wear/gradle.lockfile new file mode 100644 index 00000000..2f0a7566 --- /dev/null +++ b/wear/gradle.lockfile @@ -0,0 +1,412 @@ +# This is a Gradle generated file for dependency locking. +# 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 :wear:dependencies --write-locks +androidx.activity:activity-compose:1.13.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.activity:activity-ktx:1.13.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.activity:activity:1.13.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.annotation:annotation-experimental:1.4.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.annotation:annotation-jvm:1.10.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.annotation:annotation:1.10.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.arch.core:core-common:2.2.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.arch.core:core-runtime:2.2.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.autofill:autofill:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.collection:collection-jvm:1.5.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.collection:collection-ktx:1.5.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.collection:collection:1.5.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-android:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.animation:animation-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-core-android:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.animation:animation-core-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-core:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.animation:animation-core:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-graphics-android:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.animation:animation-graphics-android:1.9.0=releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation-graphics:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.animation:animation-graphics:1.9.0=releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.animation:animation:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.animation:animation:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation-android:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.foundation:foundation-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation-layout-android:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.foundation:foundation-layout-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation-layout:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.foundation:foundation-layout:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.foundation:foundation:1.10.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.foundation:foundation:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material3:material3-android:1.3.1=debugRuntimeClasspath,debugUnitTestRuntimeClasspath +androidx.compose.material3:material3-desktop:1.3.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugUnitTestLintChecksClasspath +androidx.compose.material3:material3:1.3.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.material:material-icons-core-android:1.7.8=debugAndroidTestCompileClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath +androidx.compose.material:material-icons-core-desktop:1.7.8=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugUnitTestLintChecksClasspath,releaseLintChecksClasspath +androidx.compose.material:material-icons-core:1.7.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material:material-icons-extended-android:1.7.8=debugAndroidTestCompileClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath +androidx.compose.material:material-icons-extended-desktop:1.7.8=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugUnitTestLintChecksClasspath,releaseLintChecksClasspath +androidx.compose.material:material-icons-extended:1.7.8=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material:material-ripple-android:1.9.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.material:material-ripple:1.9.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-android:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-annotation-android:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-annotation:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-retain-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-retain:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-saveable-android:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime-saveable:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.runtime:runtime:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-geometry-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-geometry-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-geometry:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-geometry:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-graphics-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-graphics-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-graphics:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-graphics:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-text-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-text-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-text:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-text:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-tooling-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath +androidx.compose.ui:ui-tooling-data-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-data-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath +androidx.compose.ui:ui-tooling-data:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-data:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath +androidx.compose.ui:ui-tooling-preview-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-preview-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath +androidx.compose.ui:ui-tooling-preview:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling-preview:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath +androidx.compose.ui:ui-tooling:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.compose.ui:ui-tooling:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath +androidx.compose.ui:ui-unit-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-unit-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-unit:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-unit:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-util-android:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-util-android:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui-util:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui-util:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.compose.ui:ui:1.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.compose.ui:ui:1.9.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugUnitTestCompileClasspath,releaseCompileClasspath +androidx.concurrent:concurrent-futures-ktx:1.2.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.concurrent:concurrent-futures:1.1.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.concurrent:concurrent-futures:1.2.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.core:core-ktx:1.19.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.core:core-viewtree:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.core:core:1.19.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.customview:customview-poolingcontainer:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.documentfile:documentfile:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.dynamicanimation:dynamicanimation:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.emoji2:emoji2:1.4.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.graphics:graphics-path:1.0.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.graphics:graphics-shapes-android:1.0.1=debugRuntimeClasspath,debugUnitTestRuntimeClasspath,releaseRuntimeClasspath +androidx.graphics:graphics-shapes-desktop:1.0.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugUnitTestLintChecksClasspath,releaseLintChecksClasspath +androidx.graphics:graphics-shapes:1.0.1=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.interpolator:interpolator:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.legacy:legacy-support-core-utils:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-common-java8:2.11.0=debugRuntimeClasspath,debugUnitTestRuntimeClasspath +androidx.lifecycle:lifecycle-common-jvm:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-common:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-livedata-core-ktx:2.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-livedata-core:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-livedata:2.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-process:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-compose-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-compose:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-ktx-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime-ktx:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-runtime:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-compose-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-compose:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-ktx:2.11.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel-savedstate:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.lifecycle:lifecycle-viewmodel:2.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.loader:loader:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.localbroadcastmanager:localbroadcastmanager:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent-android:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent-compose-android:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent-compose:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.navigationevent:navigationevent:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.print:print:1.0.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.profileinstaller:profileinstaller:1.4.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-android:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-compose-android:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-compose:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate-ktx:1.4.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.savedstate:savedstate:1.4.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.security:security-crypto:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.startup:startup-runtime:1.1.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.test.espresso:espresso-core:3.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test.espresso:espresso-idling-resource:3.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test.ext:junit:1.3.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test.services:storage:1.6.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test:core:1.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test:monitor:1.8.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.test:runner:1.7.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +androidx.tracing:tracing:1.1.0=debugUnitTestCompileClasspath +androidx.tracing:tracing:1.2.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.transition:transition:1.6.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.versionedparcelable:versionedparcelable:1.1.1=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.wear.compose:compose-foundation:1.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.wear.compose:compose-material-core:1.6.2=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.wear.compose:compose-material3:1.6.2=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.wear:wear-tooling-preview:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.window:window-core-android:1.5.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.window:window-core:1.5.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +androidx.window:window:1.5.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.almworks.sqlite4java:sqlite4java:1.0.392=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.android.tools.analytics-library:protos:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.analytics-library:shared:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.analytics-library:tracker:32.3.1=androidLintTool +com.android.tools.build:aapt2-proto:9.3.1-15703166=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.build:builder-model:9.3.1=androidLintTool +com.android.tools.build:manifest-merger:32.3.1=androidLintTool +com.android.tools.ddms:ddmlib:32.3.1=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools.emulator:proto:32.3.1=unified-test-platform-android-test-plugin-host-emulator-control +com.android.tools.external.com-intellij:intellij-core:32.3.1=androidLintTool +com.android.tools.external.com-intellij:kotlin-compiler:32.3.1=androidLintTool +com.android.tools.external.org-jetbrains:uast:32.3.1=androidLintTool +com.android.tools.layoutlib:layoutlib-api:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.lint:lint-api:32.3.1=androidLintTool +com.android.tools.lint:lint-checks:32.3.1=androidLintTool +com.android.tools.lint:lint-gradle:32.3.1=androidLintTool +com.android.tools.lint:lint-model:32.3.1=androidLintTool +com.android.tools.lint:lint-typedef-remover:32.3.1=androidLintTool +com.android.tools.lint:lint:32.3.1=androidLintTool +com.android.tools.utp:android-device-provider-ddmlib-proto:32.3.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-gradle-work-action +com.android.tools.utp:android-device-provider-ddmlib:32.3.1=unified-test-platform-android-device-provider-ddmlib +com.android.tools.utp:android-test-plugin-host-additional-test-output-proto:32.3.1=unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-additional-test-output:32.3.1=unified-test-platform-android-test-plugin-host-additional-test-output +com.android.tools.utp:android-test-plugin-host-apk-installer-proto:32.3.1=unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-apk-installer:32.3.1=unified-test-platform-android-test-plugin-host-apk-installer +com.android.tools.utp:android-test-plugin-host-coverage-proto:32.3.1=unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-coverage:32.3.1=unified-test-platform-android-test-plugin-host-coverage +com.android.tools.utp:android-test-plugin-host-device-info-proto:32.3.1=unified-test-platform-android-test-plugin-host-device-info +com.android.tools.utp:android-test-plugin-host-device-info:32.3.1=unified-test-platform-android-test-plugin-host-device-info +com.android.tools.utp:android-test-plugin-host-emulator-control-proto:32.3.1=unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-emulator-control:32.3.1=unified-test-platform-android-test-plugin-host-emulator-control +com.android.tools.utp:android-test-plugin-host-logcat-proto:32.3.1=unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-host-logcat:32.3.1=unified-test-platform-android-test-plugin-host-logcat +com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:32.3.1=unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools.utp:android-test-plugin-result-listener-gradle:32.3.1=unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools.utp:gradle-work-action:32.3.1=unified-test-platform-gradle-work-action +com.android.tools.utp:utp-common:32.3.1=unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-logcat +com.android.tools:annotations:32.3.1=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools:common:32.3.1=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.android.tools:dvlib:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools:play-sdk-proto:32.3.1=androidLintTool +com.android.tools:repository:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools:sdk-common:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.android.tools:sdklib:32.3.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.android:annotations:4.1.1.4=unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-core +com.google.api.grpc:proto-google-common-protos:2.17.0=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core +com.google.api.grpc:proto-google-common-protos:2.48.0=unified-test-platform-android-test-plugin-host-emulator-control +com.google.auto.service:auto-service-annotations:1.1.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.auto.service:auto-service:1.1.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.auto.value:auto-value-annotations:1.11.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.auto:auto-common:1.2.1=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.code.findbugs:jsr305:3.0.2=androidLintTool,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.code.gson:gson:2.10.1=unified-test-platform-core,unified-test-platform-gradle-work-action +com.google.code.gson:gson:2.11.0=androidLintTool,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.code.gson:gson:2.14.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.code.gson:gson:2.8.9=unified-test-platform-android-driver-instrumentation,unified-test-platform-launcher +com.google.crypto.tink:tink-android:1.8.0=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.crypto.tink:tink:1.18.0=unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action +com.google.dagger:dagger:2.48=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action +com.google.errorprone:error_prone_annotation:2.38.0=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.23.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.errorprone:error_prone_annotations:2.36.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.errorprone:error_prone_annotations:2.48.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.guava:failureaccess:1.0.1=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.guava:failureaccess:1.0.2=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.guava:failureaccess:1.0.3=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.guava:guava:32.0.1-jre=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.guava:guava:33.4.0-jre=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.guava:guava:33.4.8-jre=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.google.guava:listenablefuture:1.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=androidLintTool,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.j2objc:j2objc-annotations:2.8=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +com.google.j2objc:j2objc-annotations:3.0.0=androidLintTool,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.jimfs:jimfs:1.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.protobuf:protobuf-java-util:3.22.3=unified-test-platform-core +com.google.protobuf:protobuf-java-util:4.28.3=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.protobuf:protobuf-java:3.25.5=androidLintTool +com.google.protobuf:protobuf-java:4.28.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.protobuf:protobuf-kotlin:4.28.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.testing.platform:android-device-provider-local:0.0.9-alpha04=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle +com.google.testing.platform:android-driver-instrumentation:0.0.9-alpha04=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control +com.google.testing.platform:android-test-plugin:0.0.9-alpha04=unified-test-platform-android-test-plugin +com.google.testing.platform:core-proto:0.0.9-alpha04=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +com.google.testing.platform:core:0.0.9-alpha04=unified-test-platform-core +com.google.testing.platform:launcher:0.0.9-alpha04=unified-test-platform-gradle-work-action,unified-test-platform-launcher +com.google.testparameterinjector:test-parameter-injector:1.18=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.ibm.icu:icu4j:77.1=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +com.sun.istack:istack-commons-runtime:3.0.8=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +com.sun.xml.fastinfoset:FastInfoset:1.2.16=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +commons-codec:commons-codec:1.17.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +commons-io:commons-io:2.16.1=androidLintTool,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +commons-logging:commons-logging:1.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +io.grpc:grpc-api:1.57.2=unified-test-platform-core +io.grpc:grpc-api:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-context:1.57.2=unified-test-platform-core +io.grpc:grpc-context:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-core:1.57.2=unified-test-platform-core +io.grpc:grpc-core:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-netty:1.57.2=unified-test-platform-core +io.grpc:grpc-netty:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-protobuf-lite:1.57.2=unified-test-platform-core +io.grpc:grpc-protobuf-lite:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-protobuf:1.57.2=unified-test-platform-core +io.grpc:grpc-protobuf:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-services:1.57.2=unified-test-platform-core +io.grpc:grpc-stub:1.57.2=unified-test-platform-core +io.grpc:grpc-stub:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.grpc:grpc-util:1.69.1=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-buffer:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-buffer:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec-http2:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec-http2:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec-http:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec-http:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec-socks:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec-socks:4.1.93.Final=unified-test-platform-core +io.netty:netty-codec:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-codec:4.1.93.Final=unified-test-platform-core +io.netty:netty-common:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-common:4.1.93.Final=unified-test-platform-core +io.netty:netty-handler-proxy:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-handler-proxy:4.1.93.Final=unified-test-platform-core +io.netty:netty-handler:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-handler:4.1.93.Final=unified-test-platform-core +io.netty:netty-resolver:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-resolver:4.1.93.Final=unified-test-platform-core +io.netty:netty-transport-native-unix-common:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-transport-native-unix-common:4.1.93.Final=unified-test-platform-core +io.netty:netty-transport:4.1.110.Final=unified-test-platform-android-test-plugin-host-emulator-control +io.netty:netty-transport:4.1.93.Final=unified-test-platform-core +io.opencensus:opencensus-api:0.31.0=unified-test-platform-core +io.opencensus:opencensus-proto:0.2.0=unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +io.perfmark:perfmark-api:0.26.0=unified-test-platform-core +io.perfmark:perfmark-api:0.27.0=unified-test-platform-android-test-plugin-host-emulator-control +jakarta.activation:jakarta.activation-api:1.2.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +jakarta.xml.bind:jakarta.xml.bind-api:2.3.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +javax.annotation:javax.annotation-api:1.3.2=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-test-plugin-host-emulator-control +javax.inject:javax.inject:1=androidLintTool,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action +junit:junit:4.13.2=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.17.7=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +net.bytebuddy:byte-buddy:1.17.7=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +net.java.dev.jna:jna-platform:5.6.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +net.java.dev.jna:jna:5.6.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +net.sf.kxml:kxml2:2.3.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +org.apache.commons:commons-compress:1.27.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.commons:commons-lang3:3.16.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.httpcomponents:httpclient:4.5.6=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.httpcomponents:httpcore:4.4.16=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.apache.httpcomponents:httpmime:4.5.6=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.bouncycastle:bcpkix-jdk18on:1.79=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.bouncycastle:bcprov-jdk18on:1.79=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.bouncycastle:bcprov-jdk18on:1.85=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.bouncycastle:bcutil-jdk18on:1.79=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.checkerframework:checker-qual:3.33.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +org.checkerframework:checker-qual:3.43.0=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +org.codehaus.groovy:groovy:3.0.22=androidLintTool +org.codehaus.mojo:animal-sniffer-annotations:1.23=unified-test-platform-core +org.codehaus.mojo:animal-sniffer-annotations:1.24=unified-test-platform-android-test-plugin-host-emulator-control +org.conscrypt:conscrypt-openjdk-uber:2.5.2=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.glassfish.jaxb:jaxb-runtime:2.3.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.glassfish.jaxb:txw2:2.3.2=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.hamcrest:hamcrest-core:1.3=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.hamcrest:hamcrest-library:1.3=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlin:compose-group-mapping:2.4.10=composeMappingProducerClasspath +org.jetbrains.kotlin:kotlin-build-tools-api:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-build-tools-api:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-build-tools-compat:2.4.10=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-build-tools-cri-impl:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-build-tools-cri-impl:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-build-tools-impl:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-build-tools-impl:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-compiler-embeddable:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-compiler-embeddable:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-compiler-runner:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-compiler-runner:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.4.10=kotlin-extension,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-daemon-client:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-daemon-client:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlin:kotlin-daemon-embeddable:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-daemon-embeddable:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-parcelize-compiler:2.4.10=kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-parcelize-runtime:2.4.10=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugRuntimeClasspathCopy,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,releaseRuntimeClasspathCopy +org.jetbrains.kotlin:kotlin-reflect:1.6.10=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-reflect:1.8.21=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-reflect:2.1.20=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlin:kotlin-reflect:2.2.10=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlin:kotlin-script-runtime:2.4.0=kotlinAbiValidationCompatClasspath +org.jetbrains.kotlin:kotlin-script-runtime:2.4.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlin:kotlin-stdlib-common:1.8.21=unified-test-platform-android-test-plugin,unified-test-platform-core +org.jetbrains.kotlin:kotlin-stdlib-common:1.9.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib-common:2.2.10=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-gradle-work-action +org.jetbrains.kotlin:kotlin-stdlib-common:2.4.10=debugAndroidTestLintChecksClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.2.10=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-core,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.2.10=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-gradle-work-action +org.jetbrains.kotlin:kotlin-stdlib:1.8.21=unified-test-platform-android-test-plugin,unified-test-platform-core +org.jetbrains.kotlin:kotlin-stdlib:1.9.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-launcher +org.jetbrains.kotlin:kotlin-stdlib:2.2.10=androidLintTool,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,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.10=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugRuntimeClasspathCopy,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,releaseRuntimeClasspathCopy +org.jetbrains.kotlin:kotlin-tooling-core:2.4.10=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath +org.jetbrains.kotlinx:atomicfu-jvm:0.22.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:atomicfu:0.22.0=unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.9.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0=kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.9.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3=unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm:1.11.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jetbrains:annotations:13.0=composeMappingProducerClasspath,debugRuntimeClasspathCopy,kotlinAbiValidationCompatClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathDebug,kotlinCompilerPluginClasspathDebugAndroidTest,kotlinCompilerPluginClasspathDebugUnitTest,kotlinCompilerPluginClasspathRelease,releaseRuntimeClasspathCopy +org.jetbrains:annotations:23.0.0=androidLintTool,debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath,unified-test-platform-android-device-provider-ddmlib,unified-test-platform-android-driver-instrumentation,unified-test-platform-android-test-plugin,unified-test-platform-android-test-plugin-host-additional-test-output,unified-test-platform-android-test-plugin-host-apk-installer,unified-test-platform-android-test-plugin-host-coverage,unified-test-platform-android-test-plugin-host-device-info,unified-test-platform-android-test-plugin-host-emulator-control,unified-test-platform-android-test-plugin-host-logcat,unified-test-platform-android-test-plugin-result-listener-gradle,unified-test-platform-core,unified-test-platform-gradle-work-action,unified-test-platform-launcher +org.jspecify:jspecify:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestLintChecksClasspath,debugCompileClasspath,debugLintChecksClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseLintChecksClasspath,releaseRuntimeClasspath +org.jvnet.staxex:stax-ex:1.8.1=androidLintTool,unified-test-platform-android-test-plugin-result-listener-gradle +org.mockito.kotlin:mockito-kotlin:6.3.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.mockito:mockito-core:5.23.0=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.objenesis:objenesis:3.3=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm-analysis:9.9=androidLintTool +org.ow2.asm:asm-commons:9.8=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm-commons:9.9=androidLintTool +org.ow2.asm:asm-tree:9.8=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm-tree:9.9=androidLintTool +org.ow2.asm:asm-tree:9.9.1=composeMappingProducerClasspath +org.ow2.asm:asm:9.8=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.ow2.asm:asm:9.9=androidLintTool +org.ow2.asm:asm:9.9.1=composeMappingProducerClasspath +org.robolectric:annotations:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:junit:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:nativeruntime-dist-compat:1.0.17=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:nativeruntime:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:pluginapi:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:plugins-maven-dependency-resolver:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:resources:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:robolectric:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:sandbox:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:shadowapi:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:shadows-framework:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:utils-reflector:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.robolectric:utils:4.15=debugUnitTestCompileClasspath,debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +org.yaml:snakeyaml:2.4=debugUnitTestLintChecksClasspath,debugUnitTestRuntimeClasspath +empty=androidApis,androidJdkImage,androidTestUtil,coreLibraryDesugaring,debugAndroidTestAnnotationProcessorClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAnnotationProcessorClasspath,debugImplementationDependenciesMetadata,debugReverseMetadataValues,debugUnitTestAnnotationProcessorClasspath,debugUnitTestImplementationDependenciesMetadata,kotlinCompilerPluginClasspath,lintChecks,lintPublish,releaseAnnotationProcessorClasspath,releaseImplementationDependenciesMetadata,releaseReverseMetadataValues diff --git a/wear/src/debug/java/com/bitchat/watch/testhook/WearTestHookDriver.kt b/wear/src/debug/java/com/bitchat/watch/testhook/WearTestHookDriver.kt index c43ef258..6b68c628 100644 --- a/wear/src/debug/java/com/bitchat/watch/testhook/WearTestHookDriver.kt +++ b/wear/src/debug/java/com/bitchat/watch/testhook/WearTestHookDriver.kt @@ -10,6 +10,7 @@ import com.bitchat.android.service.TransportBridgeService import com.bitchat.android.services.AppStateStore import com.bitchat.watch.mesh.WearMeshService import com.bitchat.watch.service.WearMeshForegroundService +import com.bitchat.watch.ui.WearPeerIdentityState import kotlinx.coroutines.delay import kotlinx.coroutines.flow.first import kotlinx.coroutines.withTimeoutOrNull @@ -49,6 +50,18 @@ object WearTestHookDriver { "dm_send" -> dmSend(context, intent.requiredString("peer"), intent.requiredString("content"), intent.getStringExtra("msg_id")) "dm_recv" -> dmRecv(context, intent) "msg_recv" -> msgRecv(context, intent) + "favorite_set" -> favoriteSet( + context, + intent.requiredString("peer"), + intent.getBooleanExtra("enabled", true) + ) + "favorite_status" -> favoriteStatus(context, intent.requiredString("peer")) + "verification_set" -> verificationSet( + context, + intent.requiredString("peer"), + intent.getBooleanExtra("enabled", true) + ) + "verification_status" -> verificationStatus(context, intent.requiredString("peer")) "raw_send" -> rawSend(context, intent) "file_recv" -> fileRecv(context, intent) "state" -> state(context) @@ -252,6 +265,55 @@ object WearTestHookDriver { .put("msg_id", found.id) } + // MARK: - Favorite and verification state + + private fun favoriteSet(context: Context, peerID: String, enabled: Boolean): JSONObject { + val mesh = mesh(context) + WearPeerIdentityState.initialize(context) + if (!WearPeerIdentityState.setFavorite(peerID, enabled, mesh)) { + return err("favorite_set", "peer Noise identity is unavailable") + } + return favoriteStatus(context, peerID) + } + + private fun favoriteStatus(context: Context, peerID: String): JSONObject { + val mesh = mesh(context) + WearPeerIdentityState.initialize(context) + val identity = WearPeerIdentityState.snapshot(peerID, mesh) + return ok("favorite_status") + .put("peer", peerID) + .put("is_favorite", identity.isFavorite) + .put("they_favorited_us", identity.theyFavoritedUs) + .put("is_mutual", identity.isFavorite && identity.theyFavoritedUs) + .put( + "star_state", + when (identity.favoriteIndicator) { + com.bitchat.watch.ui.FavoriteIndicator.Favorite -> "filled" + com.bitchat.watch.ui.FavoriteIndicator.FavoritedUs -> "outlined_orange" + com.bitchat.watch.ui.FavoriteIndicator.None -> "outlined" + } + ) + } + + private fun verificationSet(context: Context, peerID: String, enabled: Boolean): JSONObject { + val mesh = mesh(context) + WearPeerIdentityState.initialize(context) + if (!WearPeerIdentityState.setVerified(peerID, enabled, mesh)) { + return err("verification_set", "peer fingerprint is unavailable") + } + return verificationStatus(context, peerID) + } + + private fun verificationStatus(context: Context, peerID: String): JSONObject { + val mesh = mesh(context) + WearPeerIdentityState.initialize(context) + val identity = WearPeerIdentityState.snapshot(peerID, mesh) + return ok("verification_status") + .put("peer", peerID) + .put("fingerprint", identity.fingerprint ?: JSONObject.NULL) + .put("verified", identity.isVerified) + } + // MARK: - Raw packet injection private fun rawSend(context: Context, intent: Intent): JSONObject { diff --git a/wear/src/main/java/com/bitchat/watch/BitchatWatchApplication.kt b/wear/src/main/java/com/bitchat/watch/BitchatWatchApplication.kt index f480cfdd..8a52c1d8 100644 --- a/wear/src/main/java/com/bitchat/watch/BitchatWatchApplication.kt +++ b/wear/src/main/java/com/bitchat/watch/BitchatWatchApplication.kt @@ -3,11 +3,13 @@ package com.bitchat.watch import android.app.Application import com.bitchat.android.mesh.PowerManager import com.bitchat.watch.notification.WearNotificationCoordinator +import com.bitchat.watch.ui.WearPeerIdentityState class BitchatWatchApplication : Application() { override fun onCreate() { super.onCreate() PowerManager.getInstance(applicationContext) WearNotificationCoordinator.getInstance(applicationContext) + WearPeerIdentityState.initialize(applicationContext) } } diff --git a/wear/src/main/java/com/bitchat/watch/MainActivity.kt b/wear/src/main/java/com/bitchat/watch/MainActivity.kt index 7770a6f4..e128a08a 100644 --- a/wear/src/main/java/com/bitchat/watch/MainActivity.kt +++ b/wear/src/main/java/com/bitchat/watch/MainActivity.kt @@ -27,8 +27,9 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.runtime.saveable.listSaver +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight @@ -46,6 +47,8 @@ import com.bitchat.watch.ui.ChatScreen import com.bitchat.watch.ui.DmScreen import com.bitchat.watch.ui.NicknameSetupScreen import com.bitchat.watch.ui.PeopleScreen +import com.bitchat.watch.ui.UserDetailScreen +import com.bitchat.watch.ui.VerificationCodeScreen import com.bitchat.watch.ui.WearChatState import com.bitchat.watch.ui.sendPrivateMessage import com.bitchat.watch.ui.sendPublicMessage @@ -56,6 +59,8 @@ sealed interface WearScreen { data object People : WearScreen data object Nickname : WearScreen data class Dm(val peerID: String) : WearScreen + data class UserDetail(val peerID: String) : WearScreen + data class Verification(val peerID: String) : WearScreen data class TextInput(val peerID: String?) : WearScreen } @@ -66,13 +71,24 @@ class MainActivity : ComponentActivity() { private var nicknameChosen by mutableStateOf(false) private var notificationsGranted by mutableStateOf(false) private var notificationPromptDismissed by mutableStateOf(false) - private var pendingDmPeer by mutableStateOf(null) + private var pendingLaunchRequest by mutableStateOf(null) + private var nextLaunchRequestID = 0L override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) nicknameChosen = getSharedPreferences("bitchat_watch_prefs", Context.MODE_PRIVATE) .getBoolean("nickname_chosen", false) - pendingDmPeer = privateMessagePeerFromIntent(intent) + pendingLaunchRequest = restoreWearLaunchRequest( + savedInstanceState?.getStringArrayList(KEY_PENDING_LAUNCH_REQUEST) + ) + nextLaunchRequestID = maxOf( + savedInstanceState?.getLong(KEY_NEXT_LAUNCH_REQUEST_ID, 0L) ?: 0L, + pendingLaunchRequest?.id ?: 0L + ) + val notificationPeer = consumePrivateMessagePeer(intent) + if (savedInstanceState == null && notificationPeer != null) { + requestLaunch(WearLaunchTarget.Dm(notificationPeer)) + } refreshState() setContent { BitchatWearTheme { @@ -96,14 +112,29 @@ class MainActivity : ComponentActivity() { onSkip = { notificationPromptDismissed = true } ) else -> WearNavHost( - openDmPeer = pendingDmPeer, - onOpenDmHandled = { pendingDmPeer = null } + launchRequest = pendingLaunchRequest, + onLaunchRequestHandled = { requestID -> + if (pendingLaunchRequest?.id == requestID) { + pendingLaunchRequest = null + } + } ) } } } } + override fun onSaveInstanceState(outState: Bundle) { + outState.putLong(KEY_NEXT_LAUNCH_REQUEST_ID, nextLaunchRequestID) + pendingLaunchRequest?.let { + outState.putStringArrayList( + KEY_PENDING_LAUNCH_REQUEST, + it.toSavedStateValues() + ) + } + super.onSaveInstanceState(outState) + } + override fun onResume() { super.onResume() WearChatState.setAppInForeground(true) @@ -122,7 +153,10 @@ class MainActivity : ComponentActivity() { override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) setIntent(intent) - privateMessagePeerFromIntent(intent)?.let { pendingDmPeer = it } + val notificationPeer = consumePrivateMessagePeer(intent) + requestLaunch( + notificationPeer?.let(WearLaunchTarget::Dm) ?: WearLaunchTarget.Chat + ) } private fun refreshState() { @@ -142,6 +176,13 @@ class MainActivity : ComponentActivity() { startForegroundService(Intent(this, WearMeshForegroundService::class.java)) } + private fun consumePrivateMessagePeer(intent: Intent?): String? { + val peerID = privateMessagePeerFromIntent(intent) + intent?.removeExtra(WearNotificationCoordinator.EXTRA_OPEN_DM) + intent?.removeExtra(WearNotificationCoordinator.EXTRA_PEER_ID) + return peerID + } + private fun privateMessagePeerFromIntent(intent: Intent?): String? { if (intent?.getBooleanExtra(WearNotificationCoordinator.EXTRA_OPEN_DM, false) != true) { return null @@ -150,6 +191,13 @@ class MainActivity : ComponentActivity() { ?.takeIf { it.isNotBlank() } } + private fun requestLaunch(target: WearLaunchTarget) { + pendingLaunchRequest = WearLaunchRequest( + id = ++nextLaunchRequestID, + target = target + ) + } + private fun notificationPermissionGranted(): Boolean { return Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || ContextCompat.checkSelfPermission( @@ -159,6 +207,9 @@ class MainActivity : ComponentActivity() { } companion object { + private const val KEY_NEXT_LAUNCH_REQUEST_ID = "next_launch_request_id" + private const val KEY_PENDING_LAUNCH_REQUEST = "pending_launch_request" + fun requiredPermissions(): List = buildList { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { add(Manifest.permission.BLUETOOTH_SCAN) @@ -169,36 +220,175 @@ class MainActivity : ComponentActivity() { } } -@Composable -fun WearNavHost(openDmPeer: String?, onOpenDmHandled: () -> Unit) { - var screen by remember { mutableStateOf(WearScreen.Chat) } - val backStack = remember { mutableStateListOf() } +internal sealed interface WearLaunchTarget { + data object Chat : WearLaunchTarget + data class Dm(val peerID: String) : WearLaunchTarget +} + +internal data class WearLaunchRequest( + val id: Long, + val target: WearLaunchTarget +) + +internal fun WearLaunchRequest.toSavedStateValues(): ArrayList { + val (type, peerID) = when (val launchTarget = target) { + WearLaunchTarget.Chat -> "chat" to "" + is WearLaunchTarget.Dm -> "dm" to launchTarget.peerID + } + return arrayListOf(id.toString(), type, peerID) +} + +internal fun restoreWearLaunchRequest(values: List?): WearLaunchRequest? { + if (values?.size != 3) return null + val id = values[0].toLongOrNull()?.takeIf { it > 0L } ?: return null + val target = when (values[1]) { + "chat" -> WearLaunchTarget.Chat + "dm" -> values[2] + .takeIf(String::isNotBlank) + ?.let(WearLaunchTarget::Dm) + ?: return null + else -> return null + } + return WearLaunchRequest(id = id, target = target) +} + +internal class WearNavigationState( + initialScreen: WearScreen = WearScreen.Chat, + initialBackStack: List = emptyList() +) { + private val backStack = mutableStateListOf().apply { + addAll(initialBackStack) + } + + var screen by mutableStateOf(initialScreen) + private set + + val canGoBack: Boolean + get() = screen != WearScreen.Chat || backStack.isNotEmpty() fun navigate(to: WearScreen) { backStack.add(screen) screen = to } - fun goBack(): Boolean { - val previous = backStack.removeLastOrNull() - return if (previous != null) { - screen = previous - true - } else false + fun openChat() { + backStack.clear() + screen = WearScreen.Chat } - BackHandler(enabled = backStack.isNotEmpty()) { goBack() } + fun openDmFromNotification(peerID: String) { + backStack.clear() + backStack.add(WearScreen.Chat) + screen = WearScreen.Dm(peerID) + } - LaunchedEffect(openDmPeer) { - openDmPeer?.let { peerID -> - backStack.clear() - screen = WearScreen.Dm(peerID) - onOpenDmHandled() + fun goBack(): Boolean { + if (screen is WearScreen.Dm) { + openChat() + return true + } + + val previous = backStack.removeLastOrNull() ?: return false + screen = previous + return true + } + + internal fun toSavedStateValues(): List { + return buildList { + add(SAVED_STATE_VERSION) + (listOf(screen) + backStack).forEach { savedScreen -> + val (type, peerID) = encodeScreen(savedScreen) + add(type) + add(peerID) + } + } + } + + companion object { + private const val SAVED_STATE_VERSION = "1" + + val Saver = listSaver( + save = { it.toSavedStateValues() }, + restore = ::restore + ) + + internal fun restore(values: List): WearNavigationState? { + if ( + values.firstOrNull() != SAVED_STATE_VERSION || + values.size < 3 || + (values.size - 1) % 2 != 0 + ) { + return null + } + + val screens = mutableListOf() + var index = 1 + while (index < values.size) { + val restoredScreen = decodeScreen( + type = values[index], + peerID = values[index + 1] + ) ?: return null + screens += restoredScreen + index += 2 + } + return WearNavigationState( + initialScreen = screens.first(), + initialBackStack = screens.drop(1) + ) + } + + private fun encodeScreen(screen: WearScreen): Pair = when (screen) { + WearScreen.Chat -> "chat" to "" + WearScreen.People -> "people" to "" + WearScreen.Nickname -> "nickname" to "" + is WearScreen.Dm -> "dm" to screen.peerID + is WearScreen.UserDetail -> "user_detail" to screen.peerID + is WearScreen.Verification -> "verification" to screen.peerID + is WearScreen.TextInput -> screen.peerID?.let { "text_dm" to it } + ?: ("text_public" to "") + } + + private fun decodeScreen(type: String, peerID: String): WearScreen? = when (type) { + "chat" -> WearScreen.Chat + "people" -> WearScreen.People + "nickname" -> WearScreen.Nickname + "dm" -> peerID.takeIf(String::isNotBlank)?.let(WearScreen::Dm) + "user_detail" -> peerID + .takeIf(String::isNotBlank) + ?.let(WearScreen::UserDetail) + "verification" -> peerID + .takeIf(String::isNotBlank) + ?.let(WearScreen::Verification) + "text_dm" -> peerID.takeIf(String::isNotBlank)?.let(WearScreen::TextInput) + "text_public" -> WearScreen.TextInput(null) + else -> null + } + } +} + +@Composable +internal fun WearNavHost( + launchRequest: WearLaunchRequest?, + onLaunchRequestHandled: (Long) -> Unit +) { + val navigation = rememberSaveable(saver = WearNavigationState.Saver) { + WearNavigationState() + } + + BackHandler(enabled = navigation.canGoBack) { navigation.goBack() } + + LaunchedEffect(launchRequest) { + launchRequest?.let { request -> + when (val target = request.target) { + WearLaunchTarget.Chat -> navigation.openChat() + is WearLaunchTarget.Dm -> navigation.openDmFromNotification(target.peerID) + } + onLaunchRequestHandled(request.id) } } AnimatedContent( - targetState = screen, + targetState = navigation.screen, transitionSpec = { fadeIn(tween(com.bitchat.watch.ui.theme.BitchatMotion.EMPHASIZED_MS)) togetherWith fadeOut(tween(com.bitchat.watch.ui.theme.BitchatMotion.QUICK_MS)) @@ -207,12 +397,12 @@ fun WearNavHost(openDmPeer: String?, onOpenDmHandled: () -> Unit) { ) { current -> when (current) { is WearScreen.Chat -> ChatScreen( - onOpenPeople = { navigate(WearScreen.People) }, - onOpenTextInput = { navigate(WearScreen.TextInput(null)) } + onOpenPeople = { navigation.navigate(WearScreen.People) }, + onOpenTextInput = { navigation.navigate(WearScreen.TextInput(null)) } ) is WearScreen.People -> PeopleScreen( - onOpenDm = { navigate(WearScreen.Dm(it)) }, - onEditNickname = { navigate(WearScreen.Nickname) } + onOpenDm = { navigation.navigate(WearScreen.Dm(it)) }, + onEditNickname = { navigation.navigate(WearScreen.Nickname) } ) is WearScreen.Nickname -> { val mesh = WearMeshService.peek() @@ -223,14 +413,26 @@ fun WearNavHost(openDmPeer: String?, onOpenDmHandled: () -> Unit) { confirmLabel = "Save", onConfirm = { name -> mesh?.setNickname(name) - goBack() + navigation.goBack() } ) } is WearScreen.Dm -> DmScreen( peerID = current.peerID, - onOpenTextInput = { navigate(WearScreen.TextInput(current.peerID)) } + onOpenUserDetail = { + navigation.navigate(WearScreen.UserDetail(current.peerID)) + }, + onOpenTextInput = { + navigation.navigate(WearScreen.TextInput(current.peerID)) + } ) + is WearScreen.UserDetail -> UserDetailScreen( + peerID = current.peerID, + onOpenVerification = { + navigation.navigate(WearScreen.Verification(current.peerID)) + } + ) + is WearScreen.Verification -> VerificationCodeScreen(peerID = current.peerID) is WearScreen.TextInput -> { val mesh = WearMeshService.peek() val sendScope = androidx.compose.runtime.rememberCoroutineScope() @@ -244,7 +446,7 @@ fun WearNavHost(openDmPeer: String?, onOpenDmHandled: () -> Unit) { sendPrivateMessage(m, current.peerID, nick, text, sendScope) } } - goBack() + navigation.goBack() } ) } diff --git a/wear/src/main/java/com/bitchat/watch/mesh/WearMeshService.kt b/wear/src/main/java/com/bitchat/watch/mesh/WearMeshService.kt index 71d707f1..d66dd751 100644 --- a/wear/src/main/java/com/bitchat/watch/mesh/WearMeshService.kt +++ b/wear/src/main/java/com/bitchat/watch/mesh/WearMeshService.kt @@ -4,6 +4,7 @@ import android.bluetooth.BluetoothDevice import android.content.Context import android.util.Log import com.bitchat.android.crypto.EncryptionService +import com.bitchat.android.favorites.FavoriteControlMessage import com.bitchat.android.mesh.BluetoothConnectionManager import com.bitchat.android.mesh.BluetoothConnectionManagerDelegate import com.bitchat.android.mesh.DirectLinkAnnouncementPolicy @@ -227,18 +228,27 @@ class WearMeshService private constructor(private val context: Context) { } } - private fun handleMessageReceived(message: com.bitchat.android.model.BitchatMessage) { - try { - when { - message.isPrivate -> { - val peer = message.senderPeerID ?: return - AppStateStore.addPrivateMessage(peer, message) - try { onPrivateMessage?.invoke(message) } catch (_: Exception) { } - } - message.channel != null -> AppStateStore.addChannelMessage(message.channel!!, message) - else -> AppStateStore.addPublicMessage(message) + private fun handleMessageReceived( + message: com.bitchat.android.model.BitchatMessage + ): Boolean = try { + when { + message.isPrivate -> { + val peer = message.senderPeerID ?: return false + if (!AppStateStore.addPrivateMessage(peer, message)) return false + try { onPrivateMessage?.invoke(message) } catch (_: Exception) { } + true } - } catch (_: Exception) { } + message.channel != null -> { + AppStateStore.addChannelMessage(message.channel, message) + true + } + else -> { + AppStateStore.addPublicMessage(message) + true + } + } + } catch (_: Exception) { + !message.isPrivate } fun startServices() { @@ -297,6 +307,32 @@ class WearMeshService private constructor(private val context: Context) { meshCore.sendPrivateMessage(content, recipientPeerID, recipientNickname) } + /** + * Favorite controls travel as encrypted private control messages. If the profile is opened + * while a handshake is still settling, wait briefly rather than silently losing the change. + */ + fun sendFavoriteNotification(peerID: String, isFavorite: Boolean) { + serviceScope.launch { + val deadline = System.currentTimeMillis() + 15_000L + if (!hasEstablishedSession(peerID)) { + runCatching { initiateNoiseHandshake(peerID) } + } + while (!hasEstablishedSession(peerID) && System.currentTimeMillis() < deadline) { + delay(250L) + } + if (!hasEstablishedSession(peerID)) { + Log.w(TAG, "Favorite update could not be sent before the Noise timeout") + return@launch + } + val recipientNickname = getPeerNickname(peerID) ?: peerID.take(8) + meshCore.sendPrivateMessage( + content = FavoriteControlMessage.encode(isFavorite, npub = null), + recipientPeerID = peerID, + recipientNickname = recipientNickname + ) + } + } + fun initiateNoiseHandshake(peerID: String) = meshCore.initiateNoiseHandshake(peerID) fun hasEstablishedSession(peerID: String): Boolean = meshCore.hasEstablishedSession(peerID) diff --git a/wear/src/main/java/com/bitchat/watch/notification/WearNotificationCoordinator.kt b/wear/src/main/java/com/bitchat/watch/notification/WearNotificationCoordinator.kt index ab69375c..69f4ed9b 100644 --- a/wear/src/main/java/com/bitchat/watch/notification/WearNotificationCoordinator.kt +++ b/wear/src/main/java/com/bitchat/watch/notification/WearNotificationCoordinator.kt @@ -33,8 +33,6 @@ class WearNotificationCoordinator private constructor(context: Context) { const val EXTRA_PEER_ID = "com.bitchat.watch.extra.PEER_ID" private const val MESSAGE_CHANNEL_ID = "bitchat_watch_messages" - private const val GROUP_KEY_DM = "bitchat_watch_dm_group" - private const val SUMMARY_NOTIFICATION_ID = 2 private const val CONVERSATION_NOTIFICATION_ID_BASE = 10_000 @Volatile @@ -86,16 +84,12 @@ class WearNotificationCoordinator private constructor(context: Context) { ) postConversationNotification(senderPeerID) - if (pendingMessages.size > 1) { - postSummaryNotification() - } } @Synchronized fun clearConversation(peerID: String) { pendingMessages.remove(peerID) notificationManager.cancel(conversationNotificationId(peerID)) - updateSummaryNotification() } private fun postConversationNotification(peerID: String) { @@ -109,7 +103,6 @@ class WearNotificationCoordinator private constructor(context: Context) { .setName(appContext.getString(R.string.app_name)) .build() val style = NotificationCompat.MessagingStyle(user) - .setConversationTitle(latest.senderNickname) messages.takeLast(5).forEach { pending -> style.addMessage(pending.preview, pending.timestamp, sender) } @@ -142,11 +135,8 @@ class WearNotificationCoordinator private constructor(context: Context) { .setVisibility(NotificationCompat.VISIBILITY_PRIVATE) .setPublicVersion(publicVersion) .setAutoCancel(true) - .setOnlyAlertOnce(messages.size > 1) .setWhen(latest.timestamp) .setShowWhen(true) - .setGroup(GROUP_KEY_DM) - .addPerson(sender) .build() try { @@ -156,50 +146,6 @@ class WearNotificationCoordinator private constructor(context: Context) { } } - private fun postSummaryNotification() { - val totalMessages = pendingMessages.values.sumOf { it.size } - val contentIntent = PendingIntent.getActivity( - appContext, - SUMMARY_NOTIFICATION_ID, - Intent(appContext, MainActivity::class.java).apply { - flags = Intent.FLAG_ACTIVITY_SINGLE_TOP - }, - PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE - ) - val summary = NotificationCompat.Builder(appContext, MESSAGE_CHANNEL_ID) - .setSmallIcon(R.drawable.ic_notification) - .setContentTitle(appContext.getString(R.string.app_name)) - .setContentText( - appContext.resources.getQuantityString( - R.plurals.notification_private_message_summary, - totalMessages, - totalMessages - ) - ) - .setContentIntent(contentIntent) - .setCategory(NotificationCompat.CATEGORY_MESSAGE) - .setPriority(NotificationCompat.PRIORITY_HIGH) - .setVisibility(NotificationCompat.VISIBILITY_PRIVATE) - .setAutoCancel(true) - .setOnlyAlertOnce(true) - .setGroup(GROUP_KEY_DM) - .setGroupSummary(true) - .build() - try { - notificationManager.notify(SUMMARY_NOTIFICATION_ID, summary) - } catch (_: SecurityException) { - // Permission can be revoked between the preflight check and notify(). - } - } - - private fun updateSummaryNotification() { - if (pendingMessages.size > 1) { - if (canPostNotifications()) postSummaryNotification() - } else { - notificationManager.cancel(SUMMARY_NOTIFICATION_ID) - } - } - private fun createMessageChannel() { val channel = NotificationChannel( MESSAGE_CHANNEL_ID, diff --git a/wear/src/main/java/com/bitchat/watch/service/WearMeshForegroundService.kt b/wear/src/main/java/com/bitchat/watch/service/WearMeshForegroundService.kt index d1fdac0e..ff1e1cbb 100644 --- a/wear/src/main/java/com/bitchat/watch/service/WearMeshForegroundService.kt +++ b/wear/src/main/java/com/bitchat/watch/service/WearMeshForegroundService.kt @@ -144,11 +144,15 @@ class WearMeshForegroundService : Service() { .setSmallIcon(R.drawable.ic_notification) .setContentTitle(getString(R.string.app_name)) .setContentText( - resources.getQuantityString( - R.plurals.mesh_notification_text, - activePeers, - activePeers - ) + if (activePeers == 0) { + getString(R.string.mesh_notification_no_peers) + } else { + resources.getQuantityString( + R.plurals.mesh_notification_text, + activePeers, + activePeers + ) + } ) .setContentIntent(launchIntent) .setOngoing(true) diff --git a/wear/src/main/java/com/bitchat/watch/ui/DmScreen.kt b/wear/src/main/java/com/bitchat/watch/ui/DmScreen.kt index 689251a1..05ebf23c 100644 --- a/wear/src/main/java/com/bitchat/watch/ui/DmScreen.kt +++ b/wear/src/main/java/com/bitchat/watch/ui/DmScreen.kt @@ -1,5 +1,6 @@ package com.bitchat.watch.ui +import androidx.compose.foundation.clickable import androidx.compose.foundation.focusable import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.layout.Arrangement @@ -9,6 +10,8 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Verified import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect @@ -23,6 +26,7 @@ import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalHapticFeedback +import androidx.compose.ui.res.painterResource import androidx.wear.compose.foundation.rotary.RotaryScrollableDefaults import androidx.wear.compose.foundation.rotary.rotaryScrollable import androidx.compose.ui.text.font.FontWeight @@ -30,9 +34,11 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.foundation.lazy.items import androidx.wear.compose.material3.MaterialTheme +import androidx.wear.compose.material3.Icon import androidx.wear.compose.material3.ScreenScaffold import androidx.wear.compose.material3.Text import com.bitchat.android.services.AppStateStore +import com.bitchat.watch.R import com.bitchat.watch.mesh.WearMeshService import com.bitchat.watch.notification.WearNotificationCoordinator import com.bitchat.watch.ui.media.FullScreenImageViewer @@ -42,7 +48,11 @@ import com.bitchat.watch.ui.theme.LocalBitchatPalette import com.bitchat.watch.ui.theme.colorForPeer @Composable -fun DmScreen(peerID: String, onOpenTextInput: () -> Unit) { +fun DmScreen( + peerID: String, + onOpenUserDetail: () -> Unit, + onOpenTextInput: () -> Unit +) { val context = LocalContext.current val privateMessages by AppStateStore.privateMessages.collectAsState() val messages = privateMessages[peerID] ?: emptyList() @@ -55,6 +65,10 @@ fun DmScreen(peerID: String, onOpenTextInput: () -> Unit) { } val nickname = mesh?.getPeerNickname(peerID) ?: peerID.take(8) + val identityRevision by WearPeerIdentityState.revision.collectAsState() + val identity = remember(peerID, identityRevision) { + WearPeerIdentityState.snapshot(peerID, mesh) + } var sessionEstablished by remember { mutableStateOf(mesh?.hasEstablishedSession(peerID) == true) } @@ -87,7 +101,10 @@ fun DmScreen(peerID: String, onOpenTextInput: () -> Unit) { nickname = nickname, peerID = peerID, sessionEstablished = sessionEstablished, - expanded = expanded + expanded = expanded, + isFavorite = identity.isFavorite, + isVerified = identity.isVerified, + onClick = onOpenUserDetail ) }, actionBar = { @@ -105,7 +122,10 @@ private fun DmHeader( nickname: String, peerID: String, sessionEstablished: Boolean, - expanded: Boolean + expanded: Boolean, + isFavorite: Boolean, + isVerified: Boolean, + onClick: () -> Unit ) { val palette = LocalBitchatPalette.current // Floating title row: full-size at the newest messages, shrinks to its dense form @@ -127,6 +147,10 @@ private fun DmHeader( Row( modifier = Modifier .fillMaxWidth() + .clickable( + onClickLabel = "Open user details", + onClick = onClick + ) .padding(horizontal = 8.dp, vertical = headerVPadding), horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically @@ -146,5 +170,25 @@ private fun DmHeader( size = headerIconSize, modifier = Modifier.padding(start = 5.dp) ) + if (isFavorite) { + Icon( + painter = painterResource(R.drawable.ic_spec_star_filled), + contentDescription = "Favorite", + tint = palette.accentOrange, + modifier = Modifier + .padding(start = 4.dp) + .size(headerIconSize) + ) + } + if (isVerified) { + Icon( + imageVector = Icons.Filled.Verified, + contentDescription = "Verified", + tint = MaterialTheme.colorScheme.primary, + modifier = Modifier + .padding(start = 4.dp) + .size(headerIconSize) + ) + } } } diff --git a/wear/src/main/java/com/bitchat/watch/ui/PeerDebugScreen.kt b/wear/src/main/java/com/bitchat/watch/ui/PeerDebugScreen.kt index 17568387..1994f976 100644 --- a/wear/src/main/java/com/bitchat/watch/ui/PeerDebugScreen.kt +++ b/wear/src/main/java/com/bitchat/watch/ui/PeerDebugScreen.kt @@ -5,11 +5,15 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Verified import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow @@ -17,11 +21,13 @@ import androidx.compose.ui.unit.dp import androidx.wear.compose.foundation.lazy.ScalingLazyColumn import androidx.wear.compose.foundation.lazy.items import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState +import androidx.wear.compose.material3.Icon import androidx.wear.compose.material3.ListHeader import androidx.wear.compose.material3.MaterialTheme import androidx.wear.compose.material3.ScreenScaffold import androidx.wear.compose.material3.Text import com.bitchat.android.services.AppStateStore +import com.bitchat.watch.R import com.bitchat.watch.mesh.WearMeshService import com.bitchat.watch.ui.theme.LocalBitchatPalette import com.bitchat.watch.ui.theme.colorForPeer @@ -38,6 +44,7 @@ fun PeerDebugScreen() { val palette = LocalBitchatPalette.current val nicknames = mesh?.getPeerNicknames() ?: emptyMap() val rssi = mesh?.getPeerRSSI() ?: emptyMap() + val identityRevision by WearPeerIdentityState.revision.collectAsState() ScreenScaffold(scrollState = listState) { ScalingLazyColumn( @@ -68,6 +75,10 @@ fun PeerDebugScreen() { } items(peers) { peerID -> val nick = nicknames[peerID] ?: peerID.take(8) + val encrypted = mesh?.hasEstablishedSession(peerID) == true + val identity = androidx.compose.runtime.remember(peerID, identityRevision) { + WearPeerIdentityState.snapshot(peerID, mesh) + } Row( modifier = Modifier .fillMaxWidth() @@ -83,6 +94,33 @@ fun PeerDebugScreen() { overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f) ) + if (encrypted) { + NoiseLockIcon( + state = NoiseSessionUiState.Established, + size = 11.dp, + modifier = Modifier.padding(start = 4.dp) + ) + } + if (identity.isFavorite) { + Icon( + painter = painterResource(R.drawable.ic_spec_star_filled), + contentDescription = "Favorite", + tint = palette.accentOrange, + modifier = Modifier + .padding(start = 4.dp) + .size(11.dp) + ) + } + if (identity.isVerified) { + Icon( + imageVector = Icons.Filled.Verified, + contentDescription = "Verified", + tint = MaterialTheme.colorScheme.primary, + modifier = Modifier + .padding(start = 4.dp) + .size(11.dp) + ) + } rssi[peerID]?.let { Text( text = "${it}dBm", diff --git a/wear/src/main/java/com/bitchat/watch/ui/PeopleScreen.kt b/wear/src/main/java/com/bitchat/watch/ui/PeopleScreen.kt index f701a887..3687ec3d 100644 --- a/wear/src/main/java/com/bitchat/watch/ui/PeopleScreen.kt +++ b/wear/src/main/java/com/bitchat/watch/ui/PeopleScreen.kt @@ -9,11 +9,13 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.MailOutline +import androidx.compose.material.icons.filled.Verified import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow @@ -28,6 +30,7 @@ import androidx.wear.compose.material3.MaterialTheme import androidx.wear.compose.material3.ScreenScaffold import androidx.wear.compose.material3.Text import com.bitchat.android.services.AppStateStore +import com.bitchat.watch.R import com.bitchat.watch.mesh.WearMeshService import com.bitchat.watch.ui.theme.ChatVisualTokens import com.bitchat.watch.ui.theme.LocalBitchatPalette @@ -41,9 +44,15 @@ fun PeopleScreen(onOpenDm: (String) -> Unit, onEditNickname: () -> Unit) { val listState = rememberScalingLazyListState() val palette = LocalBitchatPalette.current val nicknames = mesh?.getPeerNicknames() ?: emptyMap() + val identityRevision by WearPeerIdentityState.revision.collectAsState() // Peers with unread messages float to the top so they are easy to see and reach. - val sortedPeers = androidx.compose.runtime.remember(peers, unread, nicknames) { + val sortedPeers = androidx.compose.runtime.remember( + peers, + unread, + nicknames, + identityRevision + ) { peers.sortedWith( compareByDescending { (unread[it] ?: 0) > 0 } .thenBy { (nicknames[it] ?: it).lowercase() } @@ -85,10 +94,13 @@ fun PeopleScreen(onOpenDm: (String) -> Unit, onEditNickname: () -> Unit) { } items(sortedPeers, key = { it }) { peerID -> val nick = nicknames[peerID] ?: peerID.take(8) + val identity = WearPeerIdentityState.snapshot(peerID, mesh) PersonRow( nickname = nick, peerID = peerID, encrypted = mesh?.hasEstablishedSession(peerID) == true, + isFavorite = identity.isFavorite, + isVerified = identity.isVerified, unreadCount = unread[peerID] ?: 0, onClick = { onOpenDm(peerID) } ) @@ -136,6 +148,8 @@ private fun PersonRow( nickname: String, peerID: String, encrypted: Boolean, + isFavorite: Boolean, + isVerified: Boolean, unreadCount: Int, onClick: () -> Unit ) { @@ -168,6 +182,26 @@ private fun PersonRow( modifier = Modifier.padding(start = 4.dp) ) } + if (isFavorite) { + Icon( + painter = painterResource(R.drawable.ic_spec_star_filled), + contentDescription = "Favorite", + tint = palette.accentOrange, + modifier = Modifier + .padding(start = 4.dp) + .size(11.dp) + ) + } + if (isVerified) { + Icon( + imageVector = Icons.Filled.Verified, + contentDescription = "Verified", + tint = MaterialTheme.colorScheme.primary, + modifier = Modifier + .padding(start = 4.dp) + .size(11.dp) + ) + } } if (!encrypted) { Text( diff --git a/wear/src/main/java/com/bitchat/watch/ui/UserDetailScreen.kt b/wear/src/main/java/com/bitchat/watch/ui/UserDetailScreen.kt new file mode 100644 index 00000000..a36c7ec6 --- /dev/null +++ b/wear/src/main/java/com/bitchat/watch/ui/UserDetailScreen.kt @@ -0,0 +1,213 @@ +package com.bitchat.watch.ui + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Lock +import androidx.compose.material.icons.filled.Verified +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.wear.compose.foundation.lazy.ScalingLazyColumn +import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState +import androidx.wear.compose.material3.Card +import androidx.wear.compose.material3.Icon +import androidx.wear.compose.material3.ListHeader +import androidx.wear.compose.material3.MaterialTheme +import androidx.wear.compose.material3.ScreenScaffold +import androidx.wear.compose.material3.Text +import com.bitchat.watch.R +import com.bitchat.watch.mesh.WearMeshService +import com.bitchat.watch.ui.theme.ChatVisualTokens +import com.bitchat.watch.ui.theme.LocalBitchatPalette +import com.bitchat.watch.ui.theme.colorForPeer + +@Composable +fun UserDetailScreen( + peerID: String, + onOpenVerification: () -> Unit +) { + val mesh = WearMeshService.peek() + val revision by WearPeerIdentityState.revision.collectAsState() + val identity = androidx.compose.runtime.remember(peerID, revision) { + WearPeerIdentityState.snapshot(peerID, mesh) + } + val nickname = mesh?.getPeerNickname(peerID) ?: peerID.take(8) + val listState = rememberScalingLazyListState() + val palette = LocalBitchatPalette.current + + ScreenScaffold(scrollState = listState) { + ScalingLazyColumn( + state = listState, + modifier = Modifier.fillMaxSize(), + contentPadding = PaddingValues(horizontal = 10.dp, vertical = 8.dp) + ) { + item { + ListHeader { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier.fillMaxWidth() + ) { + Text( + text = nickname, + style = MaterialTheme.typography.titleSmall, + fontWeight = FontWeight.Bold, + color = colorForPeer(nickname + peerID, palette), + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + Text( + text = "User details", + style = ChatVisualTokens.SystemActionStyle, + color = palette.textTertiary + ) + } + } + } + + item { + Card( + onClick = { + mesh?.let { + WearPeerIdentityState.setFavorite( + peerID = peerID, + isFavorite = !identity.isFavorite, + mesh = it + ) + } + }, + modifier = Modifier.fillMaxWidth() + ) { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + painter = painterResource( + if (identity.isFavorite) { + R.drawable.ic_spec_star_filled + } else { + R.drawable.ic_spec_star + } + ), + contentDescription = when { + identity.isFavorite -> "Favorite" + identity.theyFavoritedUs -> "They favorited you" + else -> "Not a favorite" + }, + tint = if ( + identity.isFavorite || identity.theyFavoritedUs + ) { + palette.accentOrange + } else { + palette.textTertiary + }, + modifier = Modifier.size(24.dp) + ) + Column( + modifier = Modifier + .weight(1f) + .padding(start = 8.dp) + ) { + Text( + text = favoriteTitle(identity), + style = ChatVisualTokens.SenderStyle, + color = MaterialTheme.colorScheme.onSurface + ) + Text( + text = favoriteSubtitle(identity), + style = ChatVisualTokens.SystemActionStyle, + color = palette.textTertiary + ) + } + } + } + } + + item { + Card( + onClick = onOpenVerification, + modifier = Modifier.fillMaxWidth() + ) { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = if (identity.isVerified) { + Icons.Filled.Verified + } else { + Icons.Filled.Lock + }, + contentDescription = null, + tint = if (identity.isVerified) { + MaterialTheme.colorScheme.primary + } else { + palette.textTertiary + }, + modifier = Modifier.size(22.dp) + ) + Column( + modifier = Modifier + .weight(1f) + .padding(start = 8.dp) + ) { + Text( + text = if (identity.isVerified) { + "Identity verified" + } else { + "Verification code" + }, + style = ChatVisualTokens.SenderStyle, + color = MaterialTheme.colorScheme.onSurface + ) + Text( + text = "Compare cryptographic fingerprints", + style = ChatVisualTokens.SystemActionStyle, + color = palette.textTertiary + ) + } + } + } + } + + item { + Text( + text = "Peer ${peerID.take(8)}", + style = ChatVisualTokens.SystemActionStyle, + color = palette.textTertiary, + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .padding(top = 4.dp) + ) + } + } + } +} + +private fun favoriteTitle(identity: WearPeerIdentitySnapshot): String = when { + identity.isFavorite && identity.theyFavoritedUs -> "Mutual favorite" + identity.isFavorite -> "Favorited" + identity.theyFavoritedUs -> "Favorite back" + else -> "Add favorite" +} + +private fun favoriteSubtitle(identity: WearPeerIdentitySnapshot): String = when { + identity.isFavorite && identity.theyFavoritedUs -> "You favorited each other" + identity.isFavorite -> "Remove from favorites" + identity.theyFavoritedUs -> "They favorited you" + else -> "Keep this person easy to find" +} diff --git a/wear/src/main/java/com/bitchat/watch/ui/VerificationCodeScreen.kt b/wear/src/main/java/com/bitchat/watch/ui/VerificationCodeScreen.kt new file mode 100644 index 00000000..c4c4ef0f --- /dev/null +++ b/wear/src/main/java/com/bitchat/watch/ui/VerificationCodeScreen.kt @@ -0,0 +1,177 @@ +package com.bitchat.watch.ui + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Verified +import androidx.compose.material.icons.outlined.Warning +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.wear.compose.foundation.lazy.ScalingLazyColumn +import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState +import androidx.wear.compose.material3.Button +import androidx.wear.compose.material3.Icon +import androidx.wear.compose.material3.ListHeader +import androidx.wear.compose.material3.MaterialTheme +import androidx.wear.compose.material3.ScreenScaffold +import androidx.wear.compose.material3.Text +import com.bitchat.watch.mesh.WearMeshService +import com.bitchat.watch.ui.theme.ChatVisualTokens +import com.bitchat.watch.ui.theme.LocalBitchatPalette + +@Composable +fun VerificationCodeScreen(peerID: String) { + val mesh = WearMeshService.peek() + val revision by WearPeerIdentityState.revision.collectAsState() + val identity = androidx.compose.runtime.remember(peerID, revision) { + WearPeerIdentityState.snapshot(peerID, mesh) + } + val myFingerprint = WearPeerIdentityState.myFingerprint(mesh) + val listState = rememberScalingLazyListState() + val palette = LocalBitchatPalette.current + + ScreenScaffold(scrollState = listState) { + ScalingLazyColumn( + state = listState, + modifier = Modifier.fillMaxSize(), + contentPadding = PaddingValues(horizontal = 10.dp, vertical = 8.dp) + ) { + item { + ListHeader { + Column( + modifier = Modifier.fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon( + imageVector = if (identity.isVerified) { + Icons.Filled.Verified + } else { + Icons.Outlined.Warning + }, + contentDescription = null, + tint = if (identity.isVerified) { + MaterialTheme.colorScheme.primary + } else { + palette.accentOrange + } + ) + Text( + text = if (identity.isVerified) "Verified" else "Verify identity", + style = MaterialTheme.typography.titleSmall, + fontWeight = FontWeight.Bold, + color = MaterialTheme.colorScheme.primary + ) + } + } + } + + item { + FingerprintCard( + title = "Their code", + fingerprint = identity.fingerprint + ) + } + + item { + FingerprintCard( + title = "Your code", + fingerprint = myFingerprint + ) + } + + item { + Text( + text = "Compare both full codes in person or over a trusted channel.", + style = ChatVisualTokens.SystemActionStyle, + color = palette.textTertiary, + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 8.dp, vertical = 4.dp) + ) + } + + item { + Button( + onClick = { + WearPeerIdentityState.setVerified( + peerID = peerID, + verified = !identity.isVerified, + mesh = mesh + ) + }, + enabled = identity.fingerprint != null + ) { + Text( + if (identity.isVerified) { + "Remove verification" + } else { + "Mark verified" + } + ) + } + } + } + } +} + +@Composable +private fun FingerprintCard( + title: String, + fingerprint: String? +) { + val palette = LocalBitchatPalette.current + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier + .fillMaxWidth() + .clip(MaterialTheme.shapes.large) + .background(MaterialTheme.colorScheme.surfaceContainer) + .padding(horizontal = 16.dp, vertical = 12.dp) + ) { + Text( + text = title, + style = ChatVisualTokens.SystemActionStyle, + color = palette.textTertiary, + fontWeight = FontWeight.Bold + ) + Text( + text = fingerprint?.let(::formatVerificationCode) ?: "Handshake pending", + style = MaterialTheme.typography.bodySmall.copy( + fontFamily = FontFamily.Monospace, + fontSize = 10.sp, + lineHeight = 13.sp + ), + color = if (fingerprint == null) { + palette.accentOrange + } else { + MaterialTheme.colorScheme.onSurface + }, + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .padding(top = 4.dp) + ) + } +} + +fun formatVerificationCode(fingerprint: String): String { + return fingerprint + .uppercase() + .chunked(4) + .chunked(4) + .joinToString("\n") { line -> line.joinToString(" ") } +} diff --git a/wear/src/main/java/com/bitchat/watch/ui/WearPeerIdentityState.kt b/wear/src/main/java/com/bitchat/watch/ui/WearPeerIdentityState.kt new file mode 100644 index 00000000..0a636251 --- /dev/null +++ b/wear/src/main/java/com/bitchat/watch/ui/WearPeerIdentityState.kt @@ -0,0 +1,140 @@ +package com.bitchat.watch.ui + +import android.content.Context +import com.bitchat.android.favorites.FavoriteRelationship +import com.bitchat.android.favorites.FavoritesChangeListener +import com.bitchat.android.favorites.FavoritesPersistenceService +import com.bitchat.android.identity.SecureIdentityStateManager +import com.bitchat.watch.mesh.WearMeshService +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update + +enum class FavoriteIndicator { + None, + FavoritedUs, + Favorite +} + +data class WearPeerIdentitySnapshot( + val isFavorite: Boolean, + val theyFavoritedUs: Boolean, + val favoriteIndicator: FavoriteIndicator, + val fingerprint: String?, + val isVerified: Boolean +) + +fun favoriteIndicator( + isFavorite: Boolean, + theyFavoritedUs: Boolean +): FavoriteIndicator = when { + isFavorite -> FavoriteIndicator.Favorite + theyFavoritedUs -> FavoriteIndicator.FavoritedUs + else -> FavoriteIndicator.None +} + +/** + * Process-wide bridge between the shared identity stores and the Watch Compose UI. + * + * Favorites are keyed by the authenticated Noise public key, while screens navigate with the + * short mesh peer ID. The shared persistence service resolves that mapping and notifies this + * object whenever either side changes the relationship. + */ +object WearPeerIdentityState : FavoritesChangeListener { + private val _revision = MutableStateFlow(0L) + val revision: StateFlow = _revision.asStateFlow() + + @Volatile + private var initialized = false + + private lateinit var identityManager: SecureIdentityStateManager + + fun initialize(context: Context) { + if (initialized) return + synchronized(this) { + if (initialized) return + FavoritesPersistenceService.initialize(context.applicationContext) + identityManager = SecureIdentityStateManager(context.applicationContext) + FavoritesPersistenceService.shared.addListener(this) + initialized = true + } + publishChange() + } + + fun snapshot(peerID: String, mesh: WearMeshService?): WearPeerIdentitySnapshot { + check(initialized) { "WearPeerIdentityState must be initialized by the application" } + val relationship = relationship(peerID, mesh) + val fingerprint = mesh?.getPeerFingerprint(peerID) + ?: relationship?.peerNoisePublicKey?.let(identityManager::generateFingerprint) + val isVerified = fingerprint != null && + identityManager.getVerifiedFingerprints().any { + it.equals(fingerprint, ignoreCase = true) + } + val isFavorite = relationship?.isFavorite == true + val theyFavoritedUs = relationship?.theyFavoritedUs == true + return WearPeerIdentitySnapshot( + isFavorite = isFavorite, + theyFavoritedUs = theyFavoritedUs, + favoriteIndicator = favoriteIndicator(isFavorite, theyFavoritedUs), + fingerprint = fingerprint, + isVerified = isVerified + ) + } + + fun setFavorite( + peerID: String, + isFavorite: Boolean, + mesh: WearMeshService + ): Boolean { + check(initialized) { "WearPeerIdentityState must be initialized by the application" } + val peerInfo = mesh.getPeerInfo(peerID) ?: return false + val noisePublicKey = peerInfo.noisePublicKey ?: return false + val nickname = mesh.getPeerNickname(peerID) + ?: peerInfo.nickname.takeIf(String::isNotBlank) + ?: peerID.take(8) + + FavoritesPersistenceService.shared.updateFavoriteStatus( + noisePublicKey = noisePublicKey, + nickname = nickname, + isFavorite = isFavorite + ) + mesh.sendFavoriteNotification(peerID, isFavorite) + return true + } + + fun setVerified( + peerID: String, + verified: Boolean, + mesh: WearMeshService? + ): Boolean { + check(initialized) { "WearPeerIdentityState must be initialized by the application" } + val fingerprint = snapshot(peerID, mesh).fingerprint ?: return false + identityManager.setVerifiedFingerprint(fingerprint.lowercase(), verified) + publishChange() + return true + } + + fun myFingerprint(mesh: WearMeshService?): String? = mesh?.getIdentityFingerprint() + + override fun onFavoriteChanged(noiseKeyHex: String) { + publishChange() + } + + override fun onAllCleared() { + publishChange() + } + + private fun relationship( + peerID: String, + mesh: WearMeshService? + ): FavoriteRelationship? { + FavoritesPersistenceService.shared.getFavoriteStatus(peerID)?.let { return it } + val noisePublicKey = mesh?.getPeerInfo(peerID)?.noisePublicKey ?: return null + return FavoritesPersistenceService.shared.getFavoriteStatus(noisePublicKey) + } + + private fun publishChange() { + _revision.update { it + 1L } + } +} diff --git a/wear/src/main/res/drawable/ic_spec_star.xml b/wear/src/main/res/drawable/ic_spec_star.xml new file mode 100644 index 00000000..d132b2ce --- /dev/null +++ b/wear/src/main/res/drawable/ic_spec_star.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/wear/src/main/res/drawable/ic_spec_star_filled.xml b/wear/src/main/res/drawable/ic_spec_star_filled.xml new file mode 100644 index 00000000..a3fae5e5 --- /dev/null +++ b/wear/src/main/res/drawable/ic_spec_star_filled.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml index 2a2ef2f3..2a2d1beb 100644 --- a/wear/src/main/res/values/strings.xml +++ b/wear/src/main/res/values/strings.xml @@ -3,9 +3,10 @@ bitchat Mesh network Keeps the Bluetooth mesh running in the background + Mesh running - Mesh running — %1$d peer - Mesh running — %1$d peers + %1$d peer + %1$d peers Direct messages Encrypted direct-message alerts diff --git a/wear/src/test/java/com/bitchat/watch/WearNavigationStateTest.kt b/wear/src/test/java/com/bitchat/watch/WearNavigationStateTest.kt new file mode 100644 index 00000000..e59d5153 --- /dev/null +++ b/wear/src/test/java/com/bitchat/watch/WearNavigationStateTest.kt @@ -0,0 +1,109 @@ +package com.bitchat.watch + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Test + +class WearNavigationStateTest { + + @Test + fun `notification dm goes back to main chat`() { + val navigation = WearNavigationState() + navigation.navigate(WearScreen.People) + navigation.navigate(WearScreen.Nickname) + + navigation.openDmFromNotification("peer-a") + + assertEquals(WearScreen.Dm("peer-a"), navigation.screen) + assertTrue(navigation.goBack()) + assertEquals(WearScreen.Chat, navigation.screen) + assertFalse(navigation.canGoBack) + } + + @Test + fun `dm opened from people also goes back to main chat`() { + val navigation = WearNavigationState() + navigation.navigate(WearScreen.People) + navigation.navigate(WearScreen.Dm("peer-a")) + + assertTrue(navigation.goBack()) + + assertEquals(WearScreen.Chat, navigation.screen) + assertFalse(navigation.canGoBack) + } + + @Test + fun `dm text input returns to dm before main chat`() { + val navigation = WearNavigationState() + navigation.navigate(WearScreen.People) + navigation.navigate(WearScreen.Dm("peer-a")) + navigation.navigate(WearScreen.TextInput("peer-a")) + + assertTrue(navigation.goBack()) + assertEquals(WearScreen.Dm("peer-a"), navigation.screen) + + assertTrue(navigation.goBack()) + assertEquals(WearScreen.Chat, navigation.screen) + assertFalse(navigation.canGoBack) + } + + @Test + fun `normal app launch resets an open dm to main chat`() { + val navigation = WearNavigationState() + navigation.openDmFromNotification("peer-a") + + navigation.openChat() + + assertEquals(WearScreen.Chat, navigation.screen) + assertFalse(navigation.canGoBack) + } + + @Test + fun `user detail and verification return through dm before main chat`() { + val navigation = WearNavigationState() + navigation.openDmFromNotification("peer-a") + navigation.navigate(WearScreen.UserDetail("peer-a")) + navigation.navigate(WearScreen.Verification("peer-a")) + + assertTrue(navigation.goBack()) + assertEquals(WearScreen.UserDetail("peer-a"), navigation.screen) + + assertTrue(navigation.goBack()) + assertEquals(WearScreen.Dm("peer-a"), navigation.screen) + + assertTrue(navigation.goBack()) + assertEquals(WearScreen.Chat, navigation.screen) + } + + @Test + fun `navigation state survives activity recreation`() { + val navigation = WearNavigationState() + navigation.openDmFromNotification("peer-a") + navigation.navigate(WearScreen.UserDetail("peer-a")) + navigation.navigate(WearScreen.Verification("peer-a")) + + val restored = WearNavigationState.restore(navigation.toSavedStateValues()) + + requireNotNull(restored) + assertEquals(WearScreen.Verification("peer-a"), restored.screen) + assertTrue(restored.goBack()) + assertEquals(WearScreen.UserDetail("peer-a"), restored.screen) + assertTrue(restored.goBack()) + assertEquals(WearScreen.Dm("peer-a"), restored.screen) + assertTrue(restored.goBack()) + assertEquals(WearScreen.Chat, restored.screen) + } + + @Test + fun `unhandled notification launch survives activity recreation`() { + val request = WearLaunchRequest( + id = 42L, + target = WearLaunchTarget.Dm("peer-a") + ) + + val restored = restoreWearLaunchRequest(request.toSavedStateValues()) + + assertEquals(request, restored) + } +} diff --git a/wear/src/test/java/com/bitchat/watch/ui/WearPeerIdentityStateTest.kt b/wear/src/test/java/com/bitchat/watch/ui/WearPeerIdentityStateTest.kt new file mode 100644 index 00000000..1b241690 --- /dev/null +++ b/wear/src/test/java/com/bitchat/watch/ui/WearPeerIdentityStateTest.kt @@ -0,0 +1,38 @@ +package com.bitchat.watch.ui + +import org.junit.Assert.assertEquals +import org.junit.Test + +class WearPeerIdentityStateTest { + + @Test + fun `favorite indicator matches Android three-state star`() { + assertEquals( + FavoriteIndicator.None, + favoriteIndicator(isFavorite = false, theyFavoritedUs = false) + ) + assertEquals( + FavoriteIndicator.FavoritedUs, + favoriteIndicator(isFavorite = false, theyFavoritedUs = true) + ) + assertEquals( + FavoriteIndicator.Favorite, + favoriteIndicator(isFavorite = true, theyFavoritedUs = false) + ) + assertEquals( + FavoriteIndicator.Favorite, + favoriteIndicator(isFavorite = true, theyFavoritedUs = true) + ) + } + + @Test + fun `verification code keeps every fingerprint character`() { + val fingerprint = (0 until 64).joinToString("") { (it % 16).toString(16) } + + val formatted = formatVerificationCode(fingerprint) + + assertEquals(fingerprint.uppercase(), formatted.filterNot(Char::isWhitespace)) + assertEquals(4, formatted.lines().size) + assertEquals(listOf(4, 4, 4, 4), formatted.lines().map { it.split(" ").size }) + } +}