diff --git a/.github/scripts/d1-migration-manifest.mjs b/.github/scripts/d1-migration-manifest.mjs
index 9d14f189..7fa7b095 100644
--- a/.github/scripts/d1-migration-manifest.mjs
+++ b/.github/scripts/d1-migration-manifest.mjs
@@ -129,13 +129,22 @@ export const D1_MIGRATIONS = [
file: "worker/migrations/2026-09-01-message-mentions.sql",
artifacts: ["column:messages.mention_user_ids"],
},
- {
- id: "2026-09-02-voice-messages",
+ {
+ id: "2026-09-02-voice-messages",
file: "worker/migrations/2026-09-02-voice-messages.sql",
artifacts: [
"column:messages.attachment_kind",
"column:messages.attachment_duration_ms",
"column:messages.attachment_waveform",
+ ],
+ },
+ {
+ id: "2026-09-04-message-replies",
+ file: "worker/migrations/2026-09-04-message-replies.sql",
+ artifacts: [
+ "column:messages.reply_to_message_id",
+ "column:messages.reply_to_sender_id",
+ "index:idx_messages_reply_attention",
],
},
];
diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml
index fe2923ee..5d5db5ce 100644
--- a/.github/workflows/android-release.yml
+++ b/.github/workflows/android-release.yml
@@ -27,11 +27,20 @@ jobs:
fetch-depth: 0
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4
+ - name: Setup Node.js
+ uses: actions/setup-node@v5
+ with:
+ node-version: "24"
+ cache: npm
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
- java-version: "17"
+ java-version: "21"
+ - name: Setup Android SDK
+ uses: android-actions/setup-android@v3
+ - name: Install Android SDK 36
+ run: sdkmanager "platforms;android-36" "build-tools;36.0.0"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Resolve release version
@@ -61,36 +70,43 @@ jobs:
for name in ANDROID_KEYSTORE_BASE64 ANDROID_KEYSTORE_PASSWORD ANDROID_KEY_ALIAS ANDROID_KEY_PASSWORD; do
test -n "${!name}"
done
- printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > android/release.keystore
- cat > android/signing.properties < capacitor/android/release.keystore
+ cat > capacitor/android/signing.properties <-
- ./gradlew testDebugUnitTest assembleDebugAndroidTest lintRelease assembleRelease bundleRelease
+ node capacitor/scripts/run-gradle.mjs
+ :app:testDebugUnitTest :app:assembleDebugAndroidTest
+ :app:lintRelease :app:assembleRelease :app:bundleRelease
-PedgechatVersionName=${{ steps.version.outputs.version }}
-PedgechatVersionCode=${{ github.run_number }}
--stacktrace
- name: Prepare checksums
shell: bash
run: |
- mkdir -p android/release-artifacts
- cp android/app/build/outputs/apk/release/app-release.apk android/release-artifacts/edgechat-${{ steps.version.outputs.version }}.apk
- cp android/app/build/outputs/bundle/release/app-release.aab android/release-artifacts/edgechat-${{ steps.version.outputs.version }}.aab
- cd android/release-artifacts
+ mkdir -p capacitor/release-artifacts
+ cp capacitor/android/app/build/outputs/apk/release/app-release.apk capacitor/release-artifacts/edgechat-${{ steps.version.outputs.version }}.apk
+ cp capacitor/android/app/build/outputs/bundle/release/app-release.aab capacitor/release-artifacts/edgechat-${{ steps.version.outputs.version }}.aab
+ cd capacitor/release-artifacts
sha256sum *.apk *.aab > SHA256SUMS.txt
- name: Verify APK signature
shell: bash
run: |
apksigner_path="$(find "$ANDROID_HOME/build-tools" -type f -name apksigner | sort -V | tail -n 1)"
test -n "$apksigner_path"
- "$apksigner_path" verify --verbose --print-certs android/release-artifacts/*.apk
- # AAB 是 JAR 签名格式;JDK 17 的 strict 模式会把 App Bundle 合法的 ZIP 结构警告误判为失败。
- jarsigner -verify -verbose -certs android/release-artifacts/*.aab
+ "$apksigner_path" verify --verbose --print-certs capacitor/release-artifacts/*.apk
+ # AAB 使用 JAR 签名格式;这里只校验签名完整性,不把 ZIP 结构警告升级为失败。
+ jarsigner -verify -verbose -certs capacitor/release-artifacts/*.aab
- name: Publish GitHub Release
shell: bash
env:
@@ -105,12 +121,12 @@ jobs:
git push origin "$RELEASE_TAG"
fi
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
- gh release upload "$RELEASE_TAG" android/release-artifacts/* --clobber
+ gh release upload "$RELEASE_TAG" capacitor/release-artifacts/* --clobber
else
- gh release create "$RELEASE_TAG" android/release-artifacts/* \
+ gh release create "$RELEASE_TAG" capacitor/release-artifacts/* \
--title "EdgeChat Android ${{ steps.version.outputs.version }}" \
--generate-notes $prerelease_flag
fi
- name: Remove signing material
if: always()
- run: rm -f android/release.keystore android/signing.properties
+ run: rm -f capacitor/android/release.keystore capacitor/android/signing.properties
diff --git a/.github/workflows/capacitor-android-ci.yml b/.github/workflows/capacitor-android-ci.yml
new file mode 100644
index 00000000..3bd3e65f
--- /dev/null
+++ b/.github/workflows/capacitor-android-ci.yml
@@ -0,0 +1,61 @@
+name: Capacitor Android CI
+on:
+ push:
+ branches: [master, main]
+ paths:
+ - "frontend/**"
+ - "capacitor/**"
+ - "package.json"
+ - "package-lock.json"
+ - "test/**"
+ - ".github/workflows/capacitor-android-ci.yml"
+ pull_request:
+ paths:
+ - "frontend/**"
+ - "capacitor/**"
+ - "package.json"
+ - "package-lock.json"
+ - "test/**"
+ - ".github/workflows/capacitor-android-ci.yml"
+ workflow_dispatch:
+
+concurrency:
+ group: capacitor-android-ci-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ verify:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v5
+ - name: Setup Node.js
+ uses: actions/setup-node@v5
+ with:
+ node-version: "24"
+ cache: npm
+ - name: Setup Java
+ uses: actions/setup-java@v5
+ with:
+ distribution: temurin
+ java-version: "21"
+ - name: Setup Android SDK
+ uses: android-actions/setup-android@v3
+ - name: Install Android SDK 36
+ run: sdkmanager "platforms;android-36" "build-tools;36.0.0"
+ - name: Validate Gradle wrappers
+ uses: gradle/actions/wrapper-validation@v4
+ - name: Install dependencies
+ run: npm ci
+ - name: Run Node tests
+ run: npm test
+ - name: Test, lint and build Capacitor debug APK
+ run: npm run build:capacitor
+ - name: Upload Capacitor debug APK
+ uses: actions/upload-artifact@v4
+ with:
+ name: edgechat-capacitor-debug
+ path: capacitor/android/app/build/outputs/apk/debug/app-debug.apk
+ if-no-files-found: error
diff --git a/.github/workflows/deploy-demo.yml b/.github/workflows/deploy-demo.yml
index 77f2e5e9..29f9f7e4 100644
--- a/.github/workflows/deploy-demo.yml
+++ b/.github/workflows/deploy-demo.yml
@@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v5
with:
- node-version: "20"
+ node-version: "24"
cache: npm
- name: Install dependencies
run: npm ci
diff --git a/.github/workflows/deploy-worker.yml b/.github/workflows/deploy-worker.yml
index 196a79b4..674e3157 100644
--- a/.github/workflows/deploy-worker.yml
+++ b/.github/workflows/deploy-worker.yml
@@ -40,7 +40,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v5
with:
- node-version: "20"
+ node-version: "24"
cache: npm
- name: Install dependencies
run: npm ci
diff --git a/.gitignore b/.gitignore
index 5e5454a9..c1e8aa3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,10 @@ android/local.properties
android/signing.properties
android/*.jks
android/*.keystore
+capacitor/android/.gradle/
+capacitor/android/.kotlin/
+capacitor/android/**/build/
+capacitor/android/local.properties
+capacitor/android/signing.properties
+capacitor/android/*.jks
+capacitor/android/*.keystore
diff --git a/README.en.md b/README.en.md
index ed0fa19e..c0ab6179 100644
--- a/README.en.md
+++ b/README.en.md
@@ -116,6 +116,7 @@ Admins can bind any group in EdgeChat to a Telegram group. Once bound, messages
- Public groups, private groups, and direct message conversations
- [Two-way Telegram group bridge](#featured-feature-telegram-two-way-message-bridge) — one Bot connects members on both sides
- Real-time messaging, paginated history, Telegram-style voice messages, and file messages
+- The web client supports Telegram-style replies, quoted-message navigation, and reply-aware direct-attention alerts
- Web and Android recording, waveform seeking, playback speed controls, and two-way Telegram voice/audio sync
- File uploads and avatar management
- Scheduled hard deletion of expired messages
@@ -161,14 +162,20 @@ GitHub Actions deployment is recommended first — it suits long-term maintenanc
- Quick start:
- Detailed guide:
-### Native Android Client
+### Android Clients
-The repository's `android/` directory is an independent Kotlin + Jetpack Compose client for Android 8 / API 26 and newer. It depends only on the stable `/api/v1` contract and never packages Vue components or CSS. When signed out, enter the HTTPS server origin, username, and password on one screen, or use `edgechat://connect?server=https%3A%2F%2Fchat.example.com` to prefill the server. The app validates server capabilities before completing sign-in.
+The primary Android release is now the `capacitor/` client. Its APK bundles the Vue Web UI, while a small Kotlin bridge handles system file selection, notifications, microphone permission, notification room opening, and external links. It uses the application ID `com.aozorae.edgechat.web`; users enter their own EdgeChat HTTPS origin on first sign-in, so the package is not tied to one deployment.
- Installation: download `edgechat-*.apk` from GitHub Releases and verify `SHA256SUMS.txt`
-- CI: `.github/workflows/android-ci.yml` runs unit tests, Lint, and a Debug APK build
-- Release: push an `android-v*` tag or run `Android Release` manually after configuring `ANDROID_KEYSTORE_BASE64`, `ANDROID_KEYSTORE_PASSWORD`, `ANDROID_KEY_ALIAS`, and `ANDROID_KEY_PASSWORD`
-- Limitation: the first release has no FCM. WebSockets close in the background and incremental sync catches up after returning to the foreground, so background instant notifications are not promised
+- First use: enter the self-hosted EdgeChat HTTPS origin, username, and password on the sign-in screen
+- Local build: install JDK 21 and Android SDK 36, then run `npm run build:capacitor`
+- Debug APK: `capacitor/android/app/build/outputs/apk/debug/app-debug.apk`
+- CI: `.github/workflows/capacitor-android-ci.yml` uploads `edgechat-capacitor-debug`
+- Release: push an `android-v*` tag or run `Android Release`; the workflow uses the four `ANDROID_KEYSTORE_*` Secrets to build signed APK/AAB artifacts
+- Server switching: sign out and edit the URL; changing instances clears the previous instance token
+- Limitation: this client currently has no Room offline database, WorkManager outbox, or FCM, so instant background notifications are not guaranteed when the app stops receiving messages
+
+The native Kotlin + Jetpack Compose client in `android/` is temporarily deprecated and is no longer the default release. Its source, API v1 contract, and separate CI remain available for historical verification and future evaluation; use the Capacitor build for new installations and routine updates.
Full guide:
diff --git a/README.ja.md b/README.ja.md
index 458a79dd..a4ae2a39 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -116,6 +116,7 @@ EdgeChat は Cloudflare 上にデプロイするチーム向けチャットシ
- 公開グループ、プライベートグループ、ダイレクトメッセージの会話に対応
- [Telegram グループ双方向メッセージブリッジ](#注目機能telegram-双方向メッセージブリッジ):1 つの Bot で両側のメンバーをつなぐ
- リアルタイムメッセージ、履歴のページング、Telegram 風ボイスメッセージ、ファイルメッセージ
+- Web では Telegram 風の返信、引用元へのジャンプ、返信を含む「メンション」優先通知に対応
- Web / Android の録音、波形シーク、倍速再生、Telegram voice/audio の双方向同期
- ファイルアップロードとアバター管理
- 期限切れメッセージの定期ハード削除に対応
@@ -161,14 +162,20 @@ GitHub Actions でのデプロイを優先的に推奨します。長期的な
- クイックスタート:
- 詳細チュートリアル:
-### ネイティブ Android クライアント
+### Android クライアント
-リポジトリの `android/` は Android 8 / API 26 以降向けの独立した Kotlin + Jetpack Compose クライアントです。安定した `/api/v1` 契約だけを共有し、Vue コンポーネントや CSS は APK に含めません。未ログイン時は 1 つの画面で HTTPS サーバー URL、ユーザー名、パスワードを入力できます。`edgechat://connect?server=https%3A%2F%2Fchat.example.com` でサーバーを事前入力することもでき、送信後にサーバー機能を確認してからログインします。
+現在の Android 向け主要リリースは `capacitor/` クライアントです。APK に Vue Web UI を直接同梱し、システムのファイル選択、通知、マイク権限、通知から会話を開く処理、外部リンクだけを小さな Kotlin ブリッジで実装します。Application ID は `com.aozorae.edgechat.web` で、初回ログイン時に利用者自身の EdgeChat HTTPS サーバー URL を入力するため、特定のデプロイ先には固定されません。
- インストール:GitHub Releases から `edgechat-*.apk` を取得し、`SHA256SUMS.txt` を確認
-- CI:`.github/workflows/android-ci.yml` が単体テスト、Lint、Debug APK ビルドを実行
-- リリース:`android-v*` タグ、または手動の `Android Release` を使用し、4 つの `ANDROID_KEYSTORE_*` Secret を設定
-- 制限:初版は FCM 非対応です。バックグラウンドでは WebSocket を閉じ、フォアグラウンド復帰時に差分同期するため、バックグラウンド即時通知は保証しません
+- 初回利用:ログイン画面で自分の EdgeChat HTTPS サーバー URL、ユーザー名、パスワードを入力
+- ローカルビルド:JDK 21 と Android SDK 36 を用意して `npm run build:capacitor` を実行
+- Debug APK:`capacitor/android/app/build/outputs/apk/debug/app-debug.apk`
+- CI:`.github/workflows/capacitor-android-ci.yml` が `edgechat-capacitor-debug` をアップロード
+- リリース:`android-v*` タグ、または手動の `Android Release` を使用し、4 つの `ANDROID_KEYSTORE_*` Secret から署名済み APK/AAB を生成
+- サーバー切替:ログアウト後に URL を変更でき、別インスタンスへ切り替えると以前のトークンを削除します
+- 制限:現時点では Room オフライン DB、WorkManager Outbox、FCM を含まないため、アプリがメッセージを受信できない間の即時通知は保証しません
+
+`android/` の Kotlin + Jetpack Compose ネイティブクライアントは一時的に非推奨となり、既定のリリース対象ではありません。ソース、API v1 契約、独立 CI は過去の検証と将来の再評価のため残しますが、新規インストールと通常更新には Capacitor 版を使用してください。
詳細:
diff --git a/README.md b/README.md
index 593da634..11b15def 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@
中文 ·
English ·
日本語 ·
- 在线 Demo ·
+ 在线 Demo ·
项目文档 ·
Telegram 社区
@@ -117,6 +117,7 @@ EdgeChat 是一个部署在 Cloudflare 上的团队聊天系统:账号体系
- 支持公开群组、私有群组与私信会话
- [Telegram 群组双向消息桥接](#特色功能telegram-消息双向桥接),一个 Bot 打通两侧成员
- 实时消息、历史消息分页、Telegram 风格语音消息与文件消息
+- 网页支持 Telegram 风格消息回复、引用跳转,以及将回复纳入「有人@我」优先提醒
- 网页和 Android 均支持录音、波形进度、倍速播放;Telegram voice/audio 可双向同步
- 文件上传与头像管理
- 支持定时硬删除过期消息
@@ -162,14 +163,20 @@ EdgeChat 是一个部署在 Cloudflare 上的团队聊天系统:账号体系
- 快速开始:
- 详细教程:
-### 原生 Android 客户端
+### Android 客户端
-仓库内的 `android/` 是独立的 Kotlin + Jetpack Compose 客户端(Android 8 / API 26 起),只依赖稳定的 `/api/v1` 协议,不复用网页组件或 CSS。未登录时可在同一页输入 HTTPS 服务器地址、用户名和密码;也可以通过 `edgechat://connect?server=https%3A%2F%2Fchat.example.com` 预填服务器。提交后客户端会先校验服务器能力,再完成登录。
+当前主要发行版是 `capacitor/` 客户端:APK 直接内置 Vue Web UI,以少量 Kotlin 对接系统文件选择、通知、麦克风权限、通知会话跳转和外部链接。它使用包名 `com.aozorae.edgechat.web`,首次登录时由用户填写自己的 EdgeChat HTTPS 服务地址,不绑定固定部署。
- 安装包:从 GitHub Releases 下载 `edgechat-*.apk` 并核对 `SHA256SUMS.txt`
-- CI:`.github/workflows/android-ci.yml` 运行单元测试、Lint 和 Debug APK 构建
-- 发布:推送 `android-v*` 标签或手动运行 `Android Release`,需要配置 `ANDROID_KEYSTORE_BASE64`、`ANDROID_KEYSTORE_PASSWORD`、`ANDROID_KEY_ALIAS`、`ANDROID_KEY_PASSWORD`
-- 限制:首版不接入 FCM,应用进入后台后会关闭 WebSocket;恢复前台时通过增量同步补齐消息,不承诺后台即时通知
+- 首次使用:登录页填写自己的 EdgeChat HTTPS 服务地址、账号和密码
+- 本地构建:准备 JDK 21 与 Android SDK 36 后运行 `npm run build:capacitor`
+- Debug APK:`capacitor/android/app/build/outputs/apk/debug/app-debug.apk`
+- CI:`.github/workflows/capacitor-android-ci.yml` 上传 `edgechat-capacitor-debug`
+- 发布:推送 `android-v*` 标签或手动运行 `Android Release`,使用四个 `ANDROID_KEYSTORE_*` Secrets 构建签名 APK/AAB
+- 服务切换:退出登录后可修改地址;切换实例时自动清理旧实例令牌
+- 限制:当前不包含 Room 离线数据库、WorkManager Outbox 或 FCM,应用停止接收消息时不承诺后台即时通知
+
+原生 `android/` Kotlin + Jetpack Compose 客户端暂时弃用,不再作为默认发行版。源码、API v1 契约和独立 CI 暂时保留,供历史验证与后续评估;新安装与日常更新请使用 Capacitor 版本。
完整说明:
diff --git a/capacitor/README.md b/capacitor/README.md
new file mode 100644
index 00000000..b7af9ba5
--- /dev/null
+++ b/capacitor/README.md
@@ -0,0 +1,20 @@
+# EdgeChat Capacitor Android
+
+This is the primary EdgeChat Android release. It bundles the Web UI, uses the application ID `com.aozorae.edgechat.web`, and remains installable beside the temporarily deprecated Kotlin + Compose client in `android/`.
+
+The Vue UI remains the source of product behavior. A small Kotlin plugin provides Android file selection, local notifications, notification room opening, and external URL handling. The APK contains no fixed EdgeChat deployment: users enter their HTTPS server URL on the first sign-in screen.
+
+## Build
+
+Install JDK 21 and Android SDK 36 first.
+
+```bash
+npm ci
+npm run build:capacitor
+```
+
+The Debug APK is written to `capacitor/android/app/build/outputs/apk/debug/app-debug.apk`.
+
+## Release
+
+Push an `android-v*` tag or run the GitHub `Android Release` workflow. It restores the signing keystore from the four `ANDROID_KEYSTORE_*` Repository Secrets, then publishes a signed APK, AAB, and `SHA256SUMS.txt`.
diff --git a/capacitor/android/.gitignore b/capacitor/android/.gitignore
new file mode 100644
index 00000000..48354a3d
--- /dev/null
+++ b/capacitor/android/.gitignore
@@ -0,0 +1,101 @@
+# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
+
+# Built application files
+*.apk
+*.aar
+*.ap_
+*.aab
+
+# Files for the ART/Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+out/
+# Uncomment the following line in case you need and you don't have the release build type files in your app
+# release/
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
+
+# IntelliJ
+*.iml
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/gradle.xml
+.idea/assetWizardSettings.xml
+.idea/dictionaries
+.idea/libraries
+# Android Studio 3 in .gitignore file.
+.idea/caches
+.idea/modules.xml
+# Comment next line if keeping position of elements in Navigation Editor is relevant for you
+.idea/navEditor.xml
+
+# Keystore files
+# Uncomment the following lines if you do not want to check your keystore files in.
+#*.jks
+#*.keystore
+
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
+.cxx/
+
+# Google Services (e.g. APIs or Firebase)
+# google-services.json
+
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
+
+# fastlane
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+fastlane/readme.md
+
+# Version control
+vcs.xml
+
+# lint
+lint/intermediates/
+lint/generated/
+lint/outputs/
+lint/tmp/
+# lint/reports/
+
+# Android Profiling
+*.hprof
+
+# Cordova plugins for Capacitor
+capacitor-cordova-android-plugins
+
+# Copied web assets
+app/src/main/assets/public
+
+# Generated Config files
+app/src/main/assets/capacitor.config.json
+app/src/main/assets/capacitor.plugins.json
+app/src/main/res/xml/config.xml
diff --git a/capacitor/android/app/.gitignore b/capacitor/android/app/.gitignore
new file mode 100644
index 00000000..043df802
--- /dev/null
+++ b/capacitor/android/app/.gitignore
@@ -0,0 +1,2 @@
+/build/*
+!/build/.npmkeep
diff --git a/capacitor/android/app/build.gradle b/capacitor/android/app/build.gradle
new file mode 100644
index 00000000..1aa21d4e
--- /dev/null
+++ b/capacitor/android/app/build.gradle
@@ -0,0 +1,74 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+
+def signingProperties = new Properties()
+def signingPropertiesFile = rootProject.file('signing.properties')
+if (signingPropertiesFile.exists()) {
+ signingPropertiesFile.withInputStream { signingProperties.load(it) }
+}
+def edgechatVersionCode = (project.findProperty('edgechatVersionCode') ?: '1').toInteger()
+def edgechatVersionName = project.findProperty('edgechatVersionName') ?: '0.1.0'
+
+android {
+ namespace = "com.aozorae.edgechat.web"
+ compileSdk = rootProject.ext.compileSdkVersion
+ defaultConfig {
+ applicationId "com.aozorae.edgechat.web"
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode edgechatVersionCode
+ versionName edgechatVersionName
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ aaptOptions {
+ // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
+ // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
+ ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
+ }
+ }
+ signingConfigs {
+ if (!signingProperties.isEmpty()) {
+ release {
+ storeFile rootProject.file(signingProperties.getProperty('storeFile'))
+ storePassword signingProperties.getProperty('storePassword')
+ keyAlias signingProperties.getProperty('keyAlias')
+ keyPassword signingProperties.getProperty('keyPassword')
+ }
+ }
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ if (!signingProperties.isEmpty()) {
+ signingConfig signingConfigs.release
+ }
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_21
+ targetCompatibility JavaVersion.VERSION_21
+ }
+ kotlinOptions {
+ jvmTarget = '21'
+ }
+}
+
+repositories {
+ flatDir{
+ dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
+ }
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
+ implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
+ implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
+ implementation project(':capacitor-android')
+ testImplementation "junit:junit:$junitVersion"
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
+ implementation project(':capacitor-cordova-android-plugins')
+}
+
+apply from: 'capacitor.build.gradle'
diff --git a/capacitor/android/app/capacitor.build.gradle b/capacitor/android/app/capacitor.build.gradle
new file mode 100644
index 00000000..bbfb44fa
--- /dev/null
+++ b/capacitor/android/app/capacitor.build.gradle
@@ -0,0 +1,19 @@
+// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
+
+android {
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_21
+ targetCompatibility JavaVersion.VERSION_21
+ }
+}
+
+apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
+dependencies {
+
+
+}
+
+
+if (hasProperty('postBuildExtras')) {
+ postBuildExtras()
+}
diff --git a/capacitor/android/app/proguard-rules.pro b/capacitor/android/app/proguard-rules.pro
new file mode 100644
index 00000000..f1b42451
--- /dev/null
+++ b/capacitor/android/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/capacitor/android/app/src/androidTest/java/com/getcapacitor/myapp/EdgeChatAndroidContractTest.java b/capacitor/android/app/src/androidTest/java/com/getcapacitor/myapp/EdgeChatAndroidContractTest.java
new file mode 100644
index 00000000..0d886538
--- /dev/null
+++ b/capacitor/android/app/src/androidTest/java/com/getcapacitor/myapp/EdgeChatAndroidContractTest.java
@@ -0,0 +1,177 @@
+package com.getcapacitor.myapp;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import android.Manifest;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.SystemClock;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.webkit.WebView;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+import com.aozorae.edgechat.web.MainActivity;
+import com.aozorae.edgechat.web.nativebridge.EdgeChatNativePlugin;
+import com.getcapacitor.annotation.CapacitorPlugin;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class EdgeChatAndroidContractTest {
+ private static final String APPLICATION_ID = "com.aozorae.edgechat.web";
+
+ @Test
+ public void appUsesProductionApplicationIdAndDeclaresAudioPermissions() throws Exception {
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ assertEquals(APPLICATION_ID, context.getPackageName());
+
+ PackageInfo packageInfo = context.getPackageManager().getPackageInfo(
+ context.getPackageName(),
+ PackageManager.GET_PERMISSIONS
+ );
+ assertNotNull(packageInfo.requestedPermissions);
+ assertTrue(Arrays.asList(packageInfo.requestedPermissions).contains(Manifest.permission.RECORD_AUDIO));
+ assertTrue(Arrays.asList(packageInfo.requestedPermissions).contains(Manifest.permission.MODIFY_AUDIO_SETTINGS));
+ }
+
+ @Test
+ public void nativePluginExposesMicrophoneRecoveryContract() throws Exception {
+ CapacitorPlugin annotation = EdgeChatNativePlugin.class.getAnnotation(CapacitorPlugin.class);
+ assertNotNull(annotation);
+ assertEquals("EdgeChatNative", annotation.name());
+ assertNotNull(EdgeChatNativePlugin.class.getMethod("requestMicrophonePermission", com.getcapacitor.PluginCall.class));
+ assertNotNull(EdgeChatNativePlugin.class.getMethod("openAppSettings", com.getcapacitor.PluginCall.class));
+ }
+
+ @Test
+ public void packagedConfigLeavesTextInputToTheSystemIme() throws Exception {
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ String config;
+ try (
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(
+ context.getAssets().open("capacitor.config.json"),
+ StandardCharsets.UTF_8
+ )
+ )
+ ) {
+ config = reader.lines().collect(Collectors.joining("\n"));
+ }
+ assertFalse(config.contains("\"captureInput\""));
+
+ Intent intent = new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Activity activity = InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
+ try {
+ WebView webView = activity.findViewById(com.getcapacitor.android.R.id.webview);
+ assertNotNull(webView);
+ String focusResult = "\"missing\"";
+ long deadline = System.currentTimeMillis() + 5_000;
+ while (System.currentTimeMillis() < deadline && "\"missing\"".equals(focusResult)) {
+ focusResult = evaluateJavascript(
+ webView,
+ "(() => { const field = document.querySelector('input, textarea');"
+ + " if (!field) return 'missing'; field.focus();"
+ + " return document.activeElement === field ? 'focused' : 'failed'; })()"
+ );
+ if ("\"missing\"".equals(focusResult)) Thread.sleep(100);
+ }
+ assertEquals("\"focused\"", focusResult);
+ } finally {
+ activity.finish();
+ }
+ }
+
+ @Test
+ public void webViewMicrophoneCanBeDeniedThenAllowed() throws Exception {
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ Intent intent = new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Activity activity = InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
+ try {
+ WebView webView = activity.findViewById(com.getcapacitor.android.R.id.webview);
+ assertNotNull(webView);
+ waitForJavascript(webView, "typeof Capacitor !== 'undefined'", "true", 5_000);
+
+ evaluateJavascript(
+ webView,
+ "window.__micState = 'pending'; Capacitor.Plugins.EdgeChatNative"
+ + ".requestMicrophonePermission().then(r => window.__micState = r.state)"
+ );
+ clickPermissionButton("com.android.permissioncontroller:id/permission_deny_button");
+ assertEquals(
+ "\"prompt-with-rationale\"",
+ waitForJavascript(webView, "window.__micState", "\"prompt-with-rationale\"", 5_000)
+ );
+
+ evaluateJavascript(
+ webView,
+ "window.__micState = 'pending'; Capacitor.Plugins.EdgeChatNative"
+ + ".requestMicrophonePermission().then(r => window.__micState = r.state)"
+ );
+ clickPermissionButton("com.android.permissioncontroller:id/permission_allow_foreground_only_button");
+ assertEquals("\"granted\"", waitForJavascript(webView, "window.__micState", "\"granted\"", 5_000));
+
+ evaluateJavascript(
+ webView,
+ "window.__mediaState = 'pending'; navigator.mediaDevices.getUserMedia({audio:true})"
+ + ".then(s => { window.__mediaState = s.getAudioTracks().length > 0 ? 'audio' : 'empty';"
+ + " s.getTracks().forEach(t => t.stop()); })"
+ + ".catch(e => window.__mediaState = 'error:' + e.name)"
+ );
+ assertEquals("\"audio\"", waitForJavascript(webView, "window.__mediaState", "\"audio\"", 8_000));
+ } finally {
+ activity.finish();
+ }
+ }
+
+ private static void clickPermissionButton(String viewId) {
+ long deadline = System.currentTimeMillis() + 5_000;
+ while (System.currentTimeMillis() < deadline) {
+ AccessibilityNodeInfo root = InstrumentationRegistry.getInstrumentation().getUiAutomation().getRootInActiveWindow();
+ if (root != null) {
+ java.util.List buttons = root.findAccessibilityNodeInfosByViewId(viewId);
+ if (!buttons.isEmpty() && buttons.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK)) return;
+ }
+ SystemClock.sleep(100);
+ }
+ throw new AssertionError("系统权限按钮未出现: " + viewId);
+ }
+
+ private static String waitForJavascript(WebView webView, String script, String expected, long timeoutMillis)
+ throws InterruptedException {
+ String result = null;
+ long deadline = System.currentTimeMillis() + timeoutMillis;
+ while (System.currentTimeMillis() < deadline) {
+ result = evaluateJavascript(webView, script);
+ if (expected.equals(result)) return result;
+ Thread.sleep(100);
+ }
+ return result;
+ }
+
+ private static String evaluateJavascript(WebView webView, String script) throws InterruptedException {
+ CountDownLatch latch = new CountDownLatch(1);
+ AtomicReference result = new AtomicReference<>();
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(() ->
+ webView.evaluateJavascript(script, value -> {
+ result.set(value);
+ latch.countDown();
+ })
+ );
+ assertTrue(latch.await(2, TimeUnit.SECONDS));
+ return result.get();
+ }
+}
diff --git a/capacitor/android/app/src/main/AndroidManifest.xml b/capacitor/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..df00536d
--- /dev/null
+++ b/capacitor/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/capacitor/android/app/src/main/java/com/aozorae/edgechat/web/MainActivity.kt b/capacitor/android/app/src/main/java/com/aozorae/edgechat/web/MainActivity.kt
new file mode 100644
index 00000000..a6c6ef3c
--- /dev/null
+++ b/capacitor/android/app/src/main/java/com/aozorae/edgechat/web/MainActivity.kt
@@ -0,0 +1,13 @@
+package com.aozorae.edgechat.web
+
+import android.os.Bundle
+import com.aozorae.edgechat.web.nativebridge.EdgeChatNativePlugin
+import com.getcapacitor.BridgeActivity
+
+class MainActivity : BridgeActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ // 插件在 Bridge 创建前注册,保证冷启动通知也能把目标会话交给网页层。
+ registerPlugin(EdgeChatNativePlugin::class.java)
+ super.onCreate(savedInstanceState)
+ }
+}
diff --git a/capacitor/android/app/src/main/java/com/aozorae/edgechat/web/nativebridge/EdgeChatNativePlugin.kt b/capacitor/android/app/src/main/java/com/aozorae/edgechat/web/nativebridge/EdgeChatNativePlugin.kt
new file mode 100644
index 00000000..7556062c
--- /dev/null
+++ b/capacitor/android/app/src/main/java/com/aozorae/edgechat/web/nativebridge/EdgeChatNativePlugin.kt
@@ -0,0 +1,256 @@
+package com.aozorae.edgechat.web.nativebridge
+
+import android.Manifest
+import android.annotation.SuppressLint
+import android.app.NotificationChannel
+import android.app.NotificationManager
+import android.app.PendingIntent
+import android.content.ActivityNotFoundException
+import android.content.Intent
+import android.database.Cursor
+import android.net.Uri
+import android.os.Build
+import android.provider.OpenableColumns
+import android.provider.Settings
+import androidx.activity.result.ActivityResult
+import androidx.core.app.NotificationCompat
+import androidx.core.app.NotificationManagerCompat
+import com.aozorae.edgechat.web.MainActivity
+import com.aozorae.edgechat.web.R
+import com.getcapacitor.JSObject
+import com.getcapacitor.Plugin
+import com.getcapacitor.PluginCall
+import com.getcapacitor.PluginMethod
+import com.getcapacitor.PermissionState
+import com.getcapacitor.annotation.ActivityCallback
+import com.getcapacitor.annotation.CapacitorPlugin
+import com.getcapacitor.annotation.Permission
+import com.getcapacitor.annotation.PermissionCallback
+
+private const val NOTIFICATION_PERMISSION_ALIAS = "notifications"
+private const val MICROPHONE_PERMISSION_ALIAS = "microphone"
+private const val NOTIFICATION_CHANNEL_ID = "edgechat_messages"
+private const val NOTIFICATION_ACTION = "com.aozorae.edgechat.web.OPEN_NOTIFICATION"
+private const val EXTRA_ROOM_KIND = "roomKind"
+private const val EXTRA_ROOM_ID = "roomId"
+private const val MAX_FILE_BYTES = 20 * 1024 * 1024
+
+@CapacitorPlugin(
+ name = "EdgeChatNative",
+ permissions = [
+ Permission(
+ alias = NOTIFICATION_PERMISSION_ALIAS,
+ strings = [Manifest.permission.POST_NOTIFICATIONS],
+ ),
+ Permission(
+ alias = MICROPHONE_PERMISSION_ALIAS,
+ strings = [Manifest.permission.RECORD_AUDIO],
+ ),
+ ],
+)
+class EdgeChatNativePlugin : Plugin() {
+ override fun load() {
+ createNotificationChannel()
+ emitNotificationTarget(activity.intent)
+ }
+
+ @PluginMethod
+ fun pickFile(call: PluginCall) {
+ val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
+ addCategory(Intent.CATEGORY_OPENABLE)
+ type = call.getString("accept", "*/*") ?: "*/*"
+ }
+ startActivityForResult(call, intent, "handlePickedFile")
+ }
+
+ @ActivityCallback
+ private fun handlePickedFile(call: PluginCall, result: ActivityResult) {
+ val uri = result.data?.data
+ if (result.resultCode != android.app.Activity.RESULT_OK || uri == null) {
+ call.resolve(JSObject().put("cancelled", true))
+ return
+ }
+
+ val metadata = readFileMetadata(uri)
+ if (metadata.size > MAX_FILE_BYTES) {
+ call.reject("文件不能超过 20 MB")
+ return
+ }
+
+ call.resolve(
+ JSObject()
+ .put("name", metadata.name)
+ .put("type", context.contentResolver.getType(uri) ?: "application/octet-stream")
+ .put("uri", uri.toString()),
+ )
+ }
+
+ @PluginMethod
+ fun requestMicrophonePermission(call: PluginCall) {
+ // 先走应用权限,再让 WebView 获取音频流,网页才能明确区分拒绝授权与设备故障。
+ if (getPermissionState(MICROPHONE_PERMISSION_ALIAS) == PermissionState.GRANTED) {
+ microphonePermissionResult(call)
+ } else {
+ requestPermissionForAlias(MICROPHONE_PERMISSION_ALIAS, call, "microphonePermissionResult")
+ }
+ }
+
+ @PermissionCallback
+ private fun microphonePermissionResult(call: PluginCall) {
+ call.resolve(JSObject().put("state", getPermissionState(MICROPHONE_PERMISSION_ALIAS).toString()))
+ }
+
+ @PluginMethod
+ fun openAppSettings(call: PluginCall) {
+ // 用户选择“不再询问”后系统不再弹窗,提供直达本应用权限页的恢复入口。
+ activity.startActivity(
+ Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:${context.packageName}")),
+ )
+ call.resolve()
+ }
+
+ @PluginMethod
+ fun checkNotificationPermission(call: PluginCall) {
+ call.resolve(JSObject().put("state", notificationPermissionState()))
+ }
+
+ @PluginMethod
+ fun requestNotificationPermission(call: PluginCall) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
+ call.resolve(JSObject().put("state", "granted"))
+ return
+ }
+ requestPermissionForAlias(
+ NOTIFICATION_PERMISSION_ALIAS,
+ call,
+ "notificationPermissionResult",
+ )
+ }
+
+ @PermissionCallback
+ private fun notificationPermissionResult(call: PluginCall) {
+ call.resolve(JSObject().put("state", notificationPermissionState()))
+ }
+
+ @PluginMethod
+ @SuppressLint("MissingPermission")
+ fun showNotification(call: PluginCall) {
+ if (notificationPermissionState() != "granted") {
+ call.resolve(JSObject().put("shown", false))
+ return
+ }
+
+ val title = call.getString("title") ?: return call.reject("通知标题不能为空")
+ val body = call.getString("body") ?: ""
+ val tag = call.getString("tag", "edgechat") ?: "edgechat"
+ val roomKind = call.getString("roomKind")
+ val roomId = call.getInt("roomId")
+ val launchIntent = Intent(context, MainActivity::class.java).apply {
+ action = NOTIFICATION_ACTION
+ flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
+ putExtra(EXTRA_ROOM_KIND, roomKind)
+ putExtra(EXTRA_ROOM_ID, roomId ?: 0)
+ }
+ val pendingIntent = PendingIntent.getActivity(
+ context,
+ tag.hashCode(),
+ launchIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
+ )
+ val notification = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
+ .setSmallIcon(R.drawable.ic_stat_edgechat)
+ .setColor(context.getColor(R.color.edgechat_notification))
+ .setContentTitle(title)
+ .setContentText(body)
+ .setStyle(NotificationCompat.BigTextStyle().bigText(body))
+ .setContentIntent(pendingIntent)
+ .setAutoCancel(true)
+ .setPriority(NotificationCompat.PRIORITY_HIGH)
+ .build()
+
+ NotificationManagerCompat.from(context).notify(tag, tag.hashCode(), notification)
+ call.resolve(JSObject().put("shown", true))
+ }
+
+ @PluginMethod
+ fun openExternal(call: PluginCall) {
+ val url = call.getString("url") ?: return call.reject("链接不能为空")
+ val uri = Uri.parse(url)
+ if (uri.scheme !in setOf("http", "https", "mailto", "tel")) {
+ call.reject("不支持此链接类型")
+ return
+ }
+
+ try {
+ activity.startActivity(Intent(Intent.ACTION_VIEW, uri))
+ call.resolve()
+ } catch (_: ActivityNotFoundException) {
+ call.reject("没有可打开此链接的应用")
+ }
+ }
+
+ override fun handleOnNewIntent(intent: Intent) {
+ emitNotificationTarget(intent)
+ }
+
+ private fun notificationPermissionState(): String {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
+ return "granted"
+ }
+ return getPermissionState(NOTIFICATION_PERMISSION_ALIAS)?.toString() ?: "prompt"
+ }
+
+ private fun createNotificationChannel() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
+
+ val channel = NotificationChannel(
+ NOTIFICATION_CHANNEL_ID,
+ context.getString(R.string.notification_channel_name),
+ NotificationManager.IMPORTANCE_HIGH,
+ ).apply {
+ description = context.getString(R.string.notification_channel_description)
+ }
+ context.getSystemService(NotificationManager::class.java).createNotificationChannel(channel)
+ }
+
+ private fun emitNotificationTarget(intent: Intent?) {
+ if (intent?.action != NOTIFICATION_ACTION) return
+
+ val roomKind = intent.getStringExtra(EXTRA_ROOM_KIND) ?: return
+ val roomId = intent.getIntExtra(EXTRA_ROOM_ID, 0)
+ if (roomId <= 0) return
+
+ // 保留事件直到网页监听器就绪,避免冷启动阶段丢失用户点击的会话目标。
+ notifyListeners(
+ "notificationOpened",
+ JSObject().put("kind", roomKind).put("id", roomId),
+ true,
+ )
+ intent.action = null
+ intent.removeExtra(EXTRA_ROOM_KIND)
+ intent.removeExtra(EXTRA_ROOM_ID)
+ }
+
+ private data class FileMetadata(val name: String, val size: Long)
+
+ private fun readFileMetadata(uri: Uri): FileMetadata {
+ var name = "attachment"
+ var size = 0L
+ val cursor: Cursor? = context.contentResolver.query(
+ uri,
+ arrayOf(OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE),
+ null,
+ null,
+ null,
+ )
+ cursor?.use {
+ if (it.moveToFirst()) {
+ val nameIndex = it.getColumnIndex(OpenableColumns.DISPLAY_NAME)
+ val sizeIndex = it.getColumnIndex(OpenableColumns.SIZE)
+ if (nameIndex >= 0) name = it.getString(nameIndex) ?: name
+ if (sizeIndex >= 0 && !it.isNull(sizeIndex)) size = it.getLong(sizeIndex)
+ }
+ }
+ return FileMetadata(name, size)
+ }
+}
diff --git a/capacitor/android/app/src/main/res/drawable-land-hdpi/splash.png b/capacitor/android/app/src/main/res/drawable-land-hdpi/splash.png
new file mode 100644
index 00000000..e31573b4
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-land-hdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-land-mdpi/splash.png b/capacitor/android/app/src/main/res/drawable-land-mdpi/splash.png
new file mode 100644
index 00000000..f7a64923
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-land-mdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-land-xhdpi/splash.png b/capacitor/android/app/src/main/res/drawable-land-xhdpi/splash.png
new file mode 100644
index 00000000..80772550
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-land-xhdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-land-xxhdpi/splash.png b/capacitor/android/app/src/main/res/drawable-land-xxhdpi/splash.png
new file mode 100644
index 00000000..14c6c8fe
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-land-xxhdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-land-xxxhdpi/splash.png b/capacitor/android/app/src/main/res/drawable-land-xxxhdpi/splash.png
new file mode 100644
index 00000000..244ca250
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-land-xxxhdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-port-hdpi/splash.png b/capacitor/android/app/src/main/res/drawable-port-hdpi/splash.png
new file mode 100644
index 00000000..74faaa58
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-port-hdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-port-mdpi/splash.png b/capacitor/android/app/src/main/res/drawable-port-mdpi/splash.png
new file mode 100644
index 00000000..e944f4ad
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-port-mdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-port-xhdpi/splash.png b/capacitor/android/app/src/main/res/drawable-port-xhdpi/splash.png
new file mode 100644
index 00000000..564a82ff
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-port-xhdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-port-xxhdpi/splash.png b/capacitor/android/app/src/main/res/drawable-port-xxhdpi/splash.png
new file mode 100644
index 00000000..bfabe687
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-port-xxhdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-port-xxxhdpi/splash.png b/capacitor/android/app/src/main/res/drawable-port-xxxhdpi/splash.png
new file mode 100644
index 00000000..69290712
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable-port-xxxhdpi/splash.png differ
diff --git a/capacitor/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/capacitor/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 00000000..c7bd21db
--- /dev/null
+++ b/capacitor/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/drawable/ic_edgechat_foreground.xml b/capacitor/android/app/src/main/res/drawable/ic_edgechat_foreground.xml
new file mode 100644
index 00000000..805c643e
--- /dev/null
+++ b/capacitor/android/app/src/main/res/drawable/ic_edgechat_foreground.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/drawable/ic_launcher_background.xml b/capacitor/android/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 00000000..d5fccc53
--- /dev/null
+++ b/capacitor/android/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/drawable/ic_stat_edgechat.xml b/capacitor/android/app/src/main/res/drawable/ic_stat_edgechat.xml
new file mode 100644
index 00000000..a38fac7e
--- /dev/null
+++ b/capacitor/android/app/src/main/res/drawable/ic_stat_edgechat.xml
@@ -0,0 +1,15 @@
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/drawable/splash.png b/capacitor/android/app/src/main/res/drawable/splash.png
new file mode 100644
index 00000000..f7a64923
Binary files /dev/null and b/capacitor/android/app/src/main/res/drawable/splash.png differ
diff --git a/capacitor/android/app/src/main/res/layout/activity_main.xml b/capacitor/android/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 00000000..b5ad1387
--- /dev/null
+++ b/capacitor/android/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 00000000..35f55384
--- /dev/null
+++ b/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 00000000..35f55384
--- /dev/null
+++ b/capacitor/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..c023e505
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
new file mode 100644
index 00000000..2127973b
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000..b441f37d
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..72905b85
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
new file mode 100644
index 00000000..8ed0605c
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000..9502e47a
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..4d1e0771
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 00000000..df0f1588
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..853db043
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..6cdf97c1
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 00000000..2960cbb6
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..8e3093a8
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..46de6e25
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 00000000..d2ea9abe
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..a40d73e9
Binary files /dev/null and b/capacitor/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/capacitor/android/app/src/main/res/values/colors.xml b/capacitor/android/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..2475798c
--- /dev/null
+++ b/capacitor/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+ #008069
+ #005C4B
+ #25A36F
+ #008069
+
diff --git a/capacitor/android/app/src/main/res/values/ic_launcher_background.xml b/capacitor/android/app/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 00000000..327b1feb
--- /dev/null
+++ b/capacitor/android/app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #C6D8E6
+
diff --git a/capacitor/android/app/src/main/res/values/strings.xml b/capacitor/android/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..0f23d3a7
--- /dev/null
+++ b/capacitor/android/app/src/main/res/values/strings.xml
@@ -0,0 +1,9 @@
+
+
+ EdgeChat Web
+ EdgeChat Web
+ com.aozorae.edgechat.web
+ com.aozorae.edgechat.web
+ 聊天消息
+ EdgeChat 新消息与提及通知
+
diff --git a/capacitor/android/app/src/main/res/values/styles.xml b/capacitor/android/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..232679a6
--- /dev/null
+++ b/capacitor/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/capacitor/android/app/src/main/res/xml/file_paths.xml b/capacitor/android/app/src/main/res/xml/file_paths.xml
new file mode 100644
index 00000000..bd0c4d80
--- /dev/null
+++ b/capacitor/android/app/src/main/res/xml/file_paths.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/capacitor/android/app/src/test/java/com/getcapacitor/myapp/EdgeChatApplicationIdTest.java b/capacitor/android/app/src/test/java/com/getcapacitor/myapp/EdgeChatApplicationIdTest.java
new file mode 100644
index 00000000..23b22cd3
--- /dev/null
+++ b/capacitor/android/app/src/test/java/com/getcapacitor/myapp/EdgeChatApplicationIdTest.java
@@ -0,0 +1,13 @@
+package com.getcapacitor.myapp;
+
+import static org.junit.Assert.assertEquals;
+
+import com.aozorae.edgechat.web.MainActivity;
+import org.junit.Test;
+
+public class EdgeChatApplicationIdTest {
+ @Test
+ public void mainActivityUsesProductionPackage() {
+ assertEquals("com.aozorae.edgechat.web", MainActivity.class.getPackageName());
+ }
+}
diff --git a/capacitor/android/build.gradle b/capacitor/android/build.gradle
new file mode 100644
index 00000000..704d3b71
--- /dev/null
+++ b/capacitor/android/build.gradle
@@ -0,0 +1,29 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.13.0'
+ classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.21'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+apply from: "variables.gradle"
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/capacitor/android/capacitor.settings.gradle b/capacitor/android/capacitor.settings.gradle
new file mode 100644
index 00000000..874b109a
--- /dev/null
+++ b/capacitor/android/capacitor.settings.gradle
@@ -0,0 +1,3 @@
+// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
+include ':capacitor-android'
+project(':capacitor-android').projectDir = new File('../../node_modules/@capacitor/android/capacitor')
diff --git a/capacitor/android/gradle.properties b/capacitor/android/gradle.properties
new file mode 100644
index 00000000..2e87c52f
--- /dev/null
+++ b/capacitor/android/gradle.properties
@@ -0,0 +1,22 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
diff --git a/capacitor/android/gradle/wrapper/gradle-wrapper.jar b/capacitor/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..1b33c55b
Binary files /dev/null and b/capacitor/android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/capacitor/android/gradle/wrapper/gradle-wrapper.properties b/capacitor/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..41c7db73
--- /dev/null
+++ b/capacitor/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
+networkTimeout=60000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/capacitor/android/gradlew b/capacitor/android/gradlew
new file mode 100755
index 00000000..23d15a93
--- /dev/null
+++ b/capacitor/android/gradlew
@@ -0,0 +1,251 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH="\\\"\\\""
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/capacitor/android/gradlew.bat b/capacitor/android/gradlew.bat
new file mode 100644
index 00000000..db3a6ac2
--- /dev/null
+++ b/capacitor/android/gradlew.bat
@@ -0,0 +1,94 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/capacitor/android/settings.gradle b/capacitor/android/settings.gradle
new file mode 100644
index 00000000..3b4431d7
--- /dev/null
+++ b/capacitor/android/settings.gradle
@@ -0,0 +1,5 @@
+include ':app'
+include ':capacitor-cordova-android-plugins'
+project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
+
+apply from: 'capacitor.settings.gradle'
\ No newline at end of file
diff --git a/capacitor/android/variables.gradle b/capacitor/android/variables.gradle
new file mode 100644
index 00000000..ee4ba41c
--- /dev/null
+++ b/capacitor/android/variables.gradle
@@ -0,0 +1,16 @@
+ext {
+ minSdkVersion = 24
+ compileSdkVersion = 36
+ targetSdkVersion = 36
+ androidxActivityVersion = '1.11.0'
+ androidxAppCompatVersion = '1.7.1'
+ androidxCoordinatorLayoutVersion = '1.3.0'
+ androidxCoreVersion = '1.17.0'
+ androidxFragmentVersion = '1.8.9'
+ coreSplashScreenVersion = '1.2.0'
+ androidxWebkitVersion = '1.14.0'
+ junitVersion = '4.13.2'
+ androidxJunitVersion = '1.3.0'
+ androidxEspressoCoreVersion = '3.7.0'
+ cordovaAndroidVersion = '14.0.1'
+}
\ No newline at end of file
diff --git a/capacitor/capacitor.config.json b/capacitor/capacitor.config.json
new file mode 100644
index 00000000..c86f0758
--- /dev/null
+++ b/capacitor/capacitor.config.json
@@ -0,0 +1,9 @@
+{
+ "appId": "com.aozorae.edgechat.web",
+ "appName": "EdgeChat Web",
+ "webDir": "../frontend/dist",
+ "android": {
+ "allowMixedContent": false,
+ "backgroundColor": "#ffffff"
+ }
+}
diff --git a/capacitor/package.json b/capacitor/package.json
new file mode 100644
index 00000000..b7704f1c
--- /dev/null
+++ b/capacitor/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "edgechat-capacitor",
+ "private": true,
+ "type": "module"
+}
diff --git a/capacitor/scripts/run-gradle.mjs b/capacitor/scripts/run-gradle.mjs
new file mode 100644
index 00000000..1353453f
--- /dev/null
+++ b/capacitor/scripts/run-gradle.mjs
@@ -0,0 +1,30 @@
+import { spawnSync } from "node:child_process";
+import { fileURLToPath } from "node:url";
+
+const androidDirectory = fileURLToPath(new URL("../android/", import.meta.url));
+const command = process.platform === "win32" ? "gradlew.bat" : "./gradlew";
+const tasks = process.argv.slice(2);
+const javaHomeArgument = process.env.JAVA_HOME
+ ? [`-Dorg.gradle.java.home=${process.env.JAVA_HOME}`]
+ : [];
+const result = spawnSync(
+ command,
+ [
+ ...javaHomeArgument,
+ ...(tasks.length
+ ? tasks
+ : [
+ ":app:testDebugUnitTest",
+ ":app:lintDebug",
+ ":app:assembleDebug",
+ ":app:assembleDebugAndroidTest",
+ ]),
+ ],
+ {
+ cwd: androidDirectory,
+ stdio: "inherit",
+ shell: process.platform === "win32",
+ },
+);
+
+process.exit(result.status ?? 1);
diff --git a/docs/api/edgechat-v1.openapi.yaml b/docs/api/edgechat-v1.openapi.yaml
index def9042a..46cb34e5 100644
--- a/docs/api/edgechat-v1.openapi.yaml
+++ b/docs/api/edgechat-v1.openapi.yaml
@@ -289,6 +289,7 @@ paths:
mentionUserIds:
type: array
items: { type: integer }
+ replyMessageId: { type: [integer, "null"], minimum: 1 }
responses:
"200": { $ref: "#/components/responses/MessageSubmission" }
"201": { $ref: "#/components/responses/MessageSubmission" }
@@ -551,7 +552,9 @@ components:
memberCount: { type: integer }
lastMessageAt: { type: [string, "null"] }
unreadCount: { type: integer }
- mentionUnreadCount: { type: integer }
+ mentionUnreadCount:
+ type: integer
+ description: Legacy field name for Telegram-style direct attention unread messages, including mentions and replies.
Member:
type: object
required: [id, username, displayName, avatarUrl, role]
@@ -594,6 +597,15 @@ components:
userId: { type: integer }
username: { type: string }
displayName: { type: string }
+ ReplyPreview:
+ type: object
+ required: [id, deleted]
+ properties:
+ id: { type: integer }
+ deleted: { type: boolean }
+ content: { type: string }
+ sender: { $ref: "#/components/schemas/Sender" }
+ attachment: { oneOf: [{ $ref: "#/components/schemas/Attachment" }, { type: "null" }] }
Message:
type: object
required: [id, content, createdAt, source, sender, attachment]
@@ -607,6 +619,8 @@ components:
attachment: { oneOf: [{ $ref: "#/components/schemas/Attachment" }, { type: "null" }] }
mentionUserIds: { type: array, items: { type: integer } }
mentions: { type: array, items: { $ref: "#/components/schemas/Mention" } }
+ replyToMessageId: { type: integer }
+ replyTo: { $ref: "#/components/schemas/ReplyPreview" }
Bootstrap:
type: object
required: [users, channels, dms]
diff --git a/docs/api/websocket-v1.md b/docs/api/websocket-v1.md
index c90ff2ee..de443541 100644
--- a/docs/api/websocket-v1.md
+++ b/docs/api/websocket-v1.md
@@ -15,17 +15,17 @@ The ticket is bound to one device session and one scope. It is consumed once, in
Every server frame is JSON and contains `protocolVersion: 1` plus `type`.
- `ready`: the connection is authorized; room sockets include `room`.
-- `message`: includes the canonical `message`, including `mentionUserIds` and resolved `mentions`. Room clients merge by `message.id` and `message.clientMessageId`.
+- `message`: includes the canonical `message`, including `mentionUserIds`, resolved `mentions`, and optional `replyToMessageId` / `replyTo` preview fields. A deleted or expired target is represented by `replyTo.deleted: true`. Room clients merge by `message.id` and `message.clientMessageId`.
- `message_deleted`: includes `messageId`.
- `message_pinned`: includes the canonical pinned `message` for the room.
- `message_unpinned`: includes `messageId`; clients clear the pin only when it still matches that ID.
-- `room_message`: inbox signal with `room`, `messageId`, `createdAt`, `unreadCount`, `mentionsMe`, `contentPreview` and `sender`; `mentionUnreadCount` is included for mentioned recipients and may be omitted otherwise so clients preserve their current value. The client then runs room sync.
+- `room_message`: inbox signal with `room`, `messageId`, `createdAt`, `unreadCount`, `mentionsMe`, `replyToMe`, `contentPreview` and `sender`; `mentionUnreadCount` keeps its legacy name but counts both mentions and replies, and is included only for directly addressed recipients so clients preserve their current value otherwise. The client then runs room sync.
- `error`: includes a client-safe `error` message and never contains a stack trace.
Example:
```json
-{"protocolVersion":1,"type":"room_message","room":{"id":7,"kind":"private","name":"team"},"messageId":52,"createdAt":"2026-09-01 12:00:00","unreadCount":3,"mentionUnreadCount":1,"mentionsMe":true,"contentPreview":"@alice please review","sender":{"kind":"local","id":4,"username":"bob","displayName":"Bob","avatarUrl":"","source":"edgechat"}}
+{"protocolVersion":1,"type":"room_message","room":{"id":7,"kind":"private","name":"team"},"messageId":52,"createdAt":"2026-09-04 12:00:00","unreadCount":3,"mentionUnreadCount":1,"mentionsMe":false,"replyToMe":true,"contentPreview":"handled","sender":{"kind":"local","id":4,"username":"bob","displayName":"Bob","avatarUrl":"","source":"edgechat"}}
```
## Lifecycle and recovery
diff --git a/frontend/src/api.js b/frontend/src/api.js
index 94ca27fe..5e02846e 100644
--- a/frontend/src/api.js
+++ b/frontend/src/api.js
@@ -1,9 +1,8 @@
import { dispatchAuthInvalid, getStoredToken } from './auth-storage.js';
+import { getEdgeChatServerOrigin, resolveServerUrl } from './capacitor-platform.ts';
import { localizedError, localizeErrorMessage } from './localized-error.js';
import { getRuntimeFileUrl, isDemoMode, requestRuntime } from './runtime.js';
-const API_PREFIX = '/api';
-
function buildHeaders(extra = {}) {
const headers = { ...extra };
const token = getStoredToken();
@@ -22,7 +21,7 @@ async function request(path, options = {}) {
}
}
- const response = await fetch(`${API_PREFIX}${path}`, {
+ const response = await fetch(resolveServerUrl(`/api${path}`), {
...options,
headers: buildHeaders(options.headers),
body:
@@ -183,14 +182,14 @@ export default {
},
getRoomWebSocketUrl(kind, roomId) {
const token = getStoredToken();
- const url = new URL(`/api/ws/${kind}/${roomId}`, window.location.origin);
+ const url = new URL(`/api/ws/${kind}/${roomId}`, getEdgeChatServerOrigin());
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
url.searchParams.set('token', token || '');
return url.toString();
},
getInboxWebSocketUrl() {
const token = getStoredToken();
- const url = new URL('/api/inbox/ws', window.location.origin);
+ const url = new URL('/api/inbox/ws', getEdgeChatServerOrigin());
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
url.searchParams.set('token', token || '');
return url.toString();
@@ -205,13 +204,13 @@ export default {
}
const url = raw.startsWith('/files/')
- ? new URL(raw, window.location.origin)
- : new URL(`/files/${encodeURIComponent(raw)}`, window.location.origin);
+ ? new URL(resolveServerUrl(raw), getEdgeChatServerOrigin())
+ : new URL(resolveServerUrl(`/files/${encodeURIComponent(raw)}`), getEdgeChatServerOrigin());
const token = getStoredToken();
if (token) {
url.searchParams.set('token', token);
}
- return url.pathname + url.search;
+ return resolveServerUrl(url.pathname + url.search);
},
adminUsers() {
return request('/admin/users');
diff --git a/frontend/src/capacitor-platform.ts b/frontend/src/capacitor-platform.ts
new file mode 100644
index 00000000..58be0845
--- /dev/null
+++ b/frontend/src/capacitor-platform.ts
@@ -0,0 +1,198 @@
+import { Capacitor, registerPlugin } from "@capacitor/core";
+
+type NotificationPermissionState = "granted" | "denied" | "prompt";
+
+type NativeFileResult = {
+ cancelled?: boolean;
+ name?: string;
+ type?: string;
+ uri?: string;
+};
+
+export type NativeRoomTarget = {
+ kind: string;
+ id: number;
+};
+
+type NativeNotification = {
+ title: string;
+ body: string;
+ tag: string;
+ roomKind?: string;
+ roomId?: number;
+};
+
+interface EdgeChatNativePlugin {
+ requestMicrophonePermission(): Promise<{
+ state: "granted" | "denied" | "prompt" | "prompt-with-rationale";
+ }>;
+ openAppSettings(): Promise;
+ pickFile(options: { accept: string }): Promise;
+ checkNotificationPermission(): Promise<{
+ state: NotificationPermissionState;
+ }>;
+ requestNotificationPermission(): Promise<{
+ state: NotificationPermissionState;
+ }>;
+ showNotification(
+ notification: NativeNotification,
+ ): Promise<{ shown: boolean }>;
+ openExternal(options: { url: string }): Promise;
+ addListener(
+ eventName: "notificationOpened",
+ listener: (target: NativeRoomTarget) => void,
+ ): Promise<{ remove: () => Promise }>;
+}
+
+const NATIVE_SERVER_STORAGE_KEY = "edgechat.nativeServerOrigin";
+const MAX_NATIVE_FILE_BYTES = 20 * 1024 * 1024;
+const EdgeChatNative = registerPlugin("EdgeChatNative");
+
+export const isCapacitorAndroid =
+ Capacitor.isNativePlatform() && Capacitor.getPlatform() === "android";
+export const NATIVE_ROOM_OPEN_EVENT = "edgechat:native-room-open";
+let pendingNativeRoomTarget: NativeRoomTarget | null = null;
+
+export async function requestNativeMicrophonePermission() {
+ if (!isCapacitorAndroid) return;
+ const { state } = await EdgeChatNative.requestMicrophonePermission();
+ if (state !== "granted") throw new Error("native_microphone_permission_denied");
+}
+
+export async function openNativeAppSettings() {
+ if (isCapacitorAndroid) await EdgeChatNative.openAppSettings();
+}
+
+export function queueNativeRoomTarget(target: NativeRoomTarget) {
+ pendingNativeRoomTarget = target;
+ globalThis.window?.dispatchEvent(new CustomEvent(NATIVE_ROOM_OPEN_EVENT));
+}
+
+export function consumeNativeRoomTarget() {
+ const target = pendingNativeRoomTarget;
+ pendingNativeRoomTarget = null;
+ return target;
+}
+
+export function resolveConfiguredServerOrigin(configuredOrigin: string) {
+ let url: URL;
+ try {
+ url = new URL(String(configuredOrigin || "").trim());
+ } catch {
+ throw new Error("native_server_https_required");
+ }
+ if (url.protocol !== "https:") {
+ throw new Error("native_server_https_required");
+ }
+ return url.origin;
+}
+
+export function getStoredNativeServerOrigin() {
+ if (!isCapacitorAndroid) {
+ return "";
+ }
+ return globalThis.localStorage?.getItem(NATIVE_SERVER_STORAGE_KEY) || "";
+}
+
+export function setStoredNativeServerOrigin(configuredOrigin: string) {
+ const origin = resolveConfiguredServerOrigin(configuredOrigin);
+ globalThis.localStorage?.setItem(NATIVE_SERVER_STORAGE_KEY, origin);
+ return origin;
+}
+
+export function restoreStoredNativeServerOrigin(origin: string) {
+ if (origin) {
+ globalThis.localStorage?.setItem(NATIVE_SERVER_STORAGE_KEY, origin);
+ } else {
+ globalThis.localStorage?.removeItem(NATIVE_SERVER_STORAGE_KEY);
+ }
+}
+
+export function getEdgeChatServerOrigin() {
+ if (isCapacitorAndroid) {
+ const storedOrigin = getStoredNativeServerOrigin();
+ if (!storedOrigin) {
+ throw new Error("native_server_not_configured");
+ }
+ return storedOrigin;
+ }
+ return globalThis.location?.origin || "";
+}
+
+export function resolveServerUrl(path: string) {
+ if (!isCapacitorAndroid) {
+ return path;
+ }
+ return new URL(path, `${getEdgeChatServerOrigin()}/`).toString();
+}
+
+export function resolveServerAssetUrl(value: string) {
+ const raw = String(value || "");
+ return isCapacitorAndroid && raw.startsWith("/")
+ ? resolveServerUrl(raw)
+ : raw;
+}
+
+export async function pickNativeFile(accept = "*/*") {
+ if (!isCapacitorAndroid) {
+ return null;
+ }
+
+ const result = await EdgeChatNative.pickFile({ accept });
+ if (result.cancelled || !result.uri || !result.name) {
+ return null;
+ }
+
+ const response = await fetch(Capacitor.convertFileSrc(result.uri));
+ const blob = await response.blob();
+ if (blob.size > MAX_NATIVE_FILE_BYTES) {
+ throw new Error("file_too_large");
+ }
+ return new File([blob], result.name, {
+ type: result.type || blob.type || "application/octet-stream",
+ });
+}
+
+export function getNativeNotificationBridge() {
+ if (!isCapacitorAndroid) {
+ return null;
+ }
+
+ return {
+ async checkPermission() {
+ return (await EdgeChatNative.checkNotificationPermission()).state;
+ },
+ async requestPermission() {
+ return (await EdgeChatNative.requestNotificationPermission()).state;
+ },
+ showNotification(notification: NativeNotification) {
+ return EdgeChatNative.showNotification(notification);
+ },
+ };
+}
+
+function isExternalAnchor(anchor: HTMLAnchorElement) {
+ return (
+ anchor.target === "_blank" &&
+ /^(https?:|mailto:|tel:)$/.test(anchor.protocol)
+ );
+}
+
+export async function installCapacitorIntegration(options: {
+ onOpenRoom: (target: NativeRoomTarget) => void;
+}) {
+ if (!isCapacitorAndroid) {
+ return;
+ }
+
+ await EdgeChatNative.addListener("notificationOpened", options.onOpenRoom);
+ document.addEventListener("click", (event) => {
+ const anchor = (event.target as Element | null)?.closest?.("a[href]");
+ if (!(anchor instanceof HTMLAnchorElement) || !isExternalAnchor(anchor)) {
+ return;
+ }
+
+ event.preventDefault();
+ void EdgeChatNative.openExternal({ url: anchor.href });
+ });
+}
diff --git a/frontend/src/components/chat/GroupSettingsDialog.vue b/frontend/src/components/chat/GroupSettingsDialog.vue
index 7c262e1a..1cdd41ae 100644
--- a/frontend/src/components/chat/GroupSettingsDialog.vue
+++ b/frontend/src/components/chat/GroupSettingsDialog.vue
@@ -1,5 +1,6 @@
@@ -40,6 +53,7 @@ function openAvatarPicker() {
{{ avatarUploading ? t('common.uploading') : t('group.changeAvatar') }}
+ {{ pickerError }}