Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b22654b99f | ||
|
|
50816588e4 | ||
|
|
116d3fb1d3 | ||
|
|
f74057ce9b | ||
|
|
0245f792de | ||
|
|
9b37565887 | ||
|
|
5d115e0f9e | ||
|
|
0091b5f272 | ||
|
|
6dc1835377 | ||
|
|
101262897f | ||
|
|
d9e29f8651 | ||
|
|
04235e0972 | ||
|
|
c3027a82fb | ||
|
|
973a4cc4d7 | ||
|
|
5578309f95 | ||
|
|
6c732dc729 |
@@ -42,6 +42,6 @@
|
||||
## Проверка
|
||||
|
||||
- [ ] `flutter analyze`
|
||||
- [ ] Сборка `komet` flavor
|
||||
- [ ] Сборка `qlyra` flavor
|
||||
- [ ] Ручная проверка затронутых сценариев
|
||||
- [ ] Регресс по безопасности (если затронута)
|
||||
|
||||
@@ -21,4 +21,4 @@ runs:
|
||||
- name: Cache Rust build
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: native/komet_crypto/rust
|
||||
workspaces: native/qlyra_crypto/rust
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Android Emulator Smoke
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'dev/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
launch-qlyra:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
cache: gradle
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.44.3'
|
||||
channel: stable
|
||||
cache: true
|
||||
|
||||
- name: Setup Rust
|
||||
uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build smoke APK
|
||||
run: flutter build apk --debug --flavor qlyra
|
||||
|
||||
- name: Launch on emulator
|
||||
uses: ReactiveCircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 35
|
||||
arch: x86_64
|
||||
profile: pixel_6
|
||||
disable-animations: true
|
||||
script: |
|
||||
adb install -r build/app/outputs/flutter-apk/app-qlyra-debug.apk
|
||||
adb logcat -c
|
||||
adb shell am start -W -n ru.qlyra.app/.MainActivity
|
||||
sleep 10
|
||||
adb shell pidof ru.qlyra.app
|
||||
if adb logcat -d '*:E' | grep -E 'FATAL EXCEPTION|Process: ru.qlyra.app'; then
|
||||
exit 1
|
||||
fi
|
||||
@@ -10,12 +10,10 @@ on:
|
||||
- 'lib/**'
|
||||
- 'android/**'
|
||||
- 'pubspec.yaml'
|
||||
- '.github/workflows/build-android-fcm.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/**'
|
||||
- 'android/**'
|
||||
- 'pubspec.yaml'
|
||||
- 'pubspec.lock'
|
||||
- 'native/**'
|
||||
- 'third_party/**'
|
||||
- 'scripts/verify_android_signing.sh'
|
||||
- '.github/workflows/build-android-fcm.yml'
|
||||
|
||||
jobs:
|
||||
@@ -49,6 +47,27 @@ jobs:
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify formatting
|
||||
run: dart format --output=none --set-exit-if-changed lib test
|
||||
|
||||
- name: Flutter analyze
|
||||
run: flutter analyze --no-fatal-infos lib test
|
||||
|
||||
- name: Install native plugin build dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libclang-dev
|
||||
|
||||
- name: Prepare native plugin runtime for tests
|
||||
run: dart run tool/prepare_plugin_runtime.dart
|
||||
|
||||
- name: Build native crypto test library
|
||||
run: cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
|
||||
- name: Flutter tests
|
||||
run: flutter test
|
||||
|
||||
- name: Configure Gradle
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
@@ -66,15 +85,15 @@ jobs:
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set — release will be debug-signed."
|
||||
exit 0
|
||||
echo "Release signing secrets are required."
|
||||
exit 1
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/komet-release.jks
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/qlyra-release.jks
|
||||
{
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "storeFile=komet-release.jks"
|
||||
echo "storeFile=qlyra-release.jks"
|
||||
} > android/key.properties
|
||||
echo "Release signing configured."
|
||||
|
||||
@@ -84,10 +103,16 @@ jobs:
|
||||
- name: Build Split APKs
|
||||
run: flutter build apk --release --split-per-abi --flavor oneme --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Verify APK release certificates
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload Universal APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-fcm-universal
|
||||
name: qlyra-android-fcm-universal
|
||||
path: build/app/outputs/flutter-apk/app-oneme-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
@@ -95,7 +120,7 @@ jobs:
|
||||
- name: Upload arm64-v8a APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-fcm-arm64-v8a
|
||||
name: qlyra-android-fcm-arm64-v8a
|
||||
path: build/app/outputs/flutter-apk/app-arm64-v8a-oneme-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
@@ -103,7 +128,7 @@ jobs:
|
||||
- name: Upload armeabi-v7a APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-fcm-armeabi-v7a
|
||||
name: qlyra-android-fcm-armeabi-v7a
|
||||
path: build/app/outputs/flutter-apk/app-armeabi-v7a-oneme-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
@@ -111,7 +136,7 @@ jobs:
|
||||
- name: Upload x86_64 APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-fcm-x86_64
|
||||
name: qlyra-android-fcm-x86_64
|
||||
path: build/app/outputs/flutter-apk/app-x86_64-oneme-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
@@ -119,10 +144,16 @@ jobs:
|
||||
- name: Build App Bundle
|
||||
run: flutter build appbundle --release --flavor oneme --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Verify App Bundle release certificate
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload App Bundle artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-fcm-aab
|
||||
name: qlyra-android-fcm-aab
|
||||
path: build/app/outputs/bundle/onemeRelease/app-oneme-release.aab
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
@@ -130,7 +161,7 @@ jobs:
|
||||
- name: Upload debug symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-fcm-symbols
|
||||
name: qlyra-android-fcm-symbols
|
||||
path: build/symbols
|
||||
if-no-files-found: error
|
||||
retention-days: 90
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
name: Build Android (Google Play)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
cache: 'gradle'
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.44.3'
|
||||
channel: 'stable'
|
||||
cache: true
|
||||
|
||||
- name: Setup Rust
|
||||
uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android
|
||||
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify formatting
|
||||
run: dart format --output=none --set-exit-if-changed lib test
|
||||
|
||||
- name: Flutter analyze
|
||||
run: flutter analyze --no-fatal-infos lib test
|
||||
|
||||
- name: Install native plugin build dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libclang-dev
|
||||
|
||||
- name: Prepare native plugin runtime for tests
|
||||
run: dart run tool/prepare_plugin_runtime.dart
|
||||
|
||||
- name: Build native crypto test library
|
||||
run: cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
|
||||
- name: Flutter tests
|
||||
run: flutter test
|
||||
|
||||
- name: Configure Gradle
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
echo "org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m" >> ~/.gradle/gradle.properties
|
||||
echo "kotlin.daemon.jvmargs=-Xmx1536m" >> ~/.gradle/gradle.properties
|
||||
echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties
|
||||
echo "org.gradle.parallel=true" >> ~/.gradle/gradle.properties
|
||||
echo "org.gradle.configureondemand=true" >> ~/.gradle/gradle.properties
|
||||
|
||||
- name: Setup release signing
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.PLAY_KEYSTORE_BASE64 || secrets.KEYSTORE_BASE64 }}
|
||||
KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD || secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD || secrets.KEY_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS || secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "Release signing secrets are required."
|
||||
exit 1
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/qlyra-release.jks
|
||||
{
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "storeFile=qlyra-release.jks"
|
||||
} > android/key.properties
|
||||
echo "Release signing configured."
|
||||
|
||||
- name: Build Universal APK
|
||||
run: flutter build apk --release --flavor store --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Verify store manifest
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
manifest=$(find build/app/intermediates -path '*storeRelease*' -path '*merged_manifests*' -name AndroidManifest.xml -print -quit)
|
||||
test -n "$manifest"
|
||||
if grep -Eq 'REQUEST_INSTALL_PACKAGES|android:host="(www\.)?max\.ru"|firebaseinitprovider' "$manifest"; then
|
||||
echo '::error::Store manifest contains forbidden entries'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Build Split APKs
|
||||
run: flutter build apk --release --split-per-abi --flavor store --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Verify APK release certificates
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD || secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS || secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload Universal APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qlyra-play-universal
|
||||
path: build/app/outputs/flutter-apk/app-store-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload arm64-v8a APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qlyra-play-arm64-v8a
|
||||
path: build/app/outputs/flutter-apk/app-arm64-v8a-store-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload armeabi-v7a APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qlyra-play-armeabi-v7a
|
||||
path: build/app/outputs/flutter-apk/app-armeabi-v7a-store-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload x86_64 APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qlyra-play-x86_64
|
||||
path: build/app/outputs/flutter-apk/app-x86_64-store-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Build App Bundle
|
||||
run: flutter build appbundle --release --flavor store --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Verify App Bundle release certificate
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD || secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS || secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload App Bundle artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qlyra-play-aab
|
||||
path: build/app/outputs/bundle/storeRelease/app-store-release.aab
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload debug symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qlyra-play-symbols
|
||||
path: build/symbols
|
||||
if-no-files-found: error
|
||||
retention-days: 90
|
||||
@@ -10,12 +10,10 @@ on:
|
||||
- 'lib/**'
|
||||
- 'android/**'
|
||||
- 'pubspec.yaml'
|
||||
- '.github/workflows/build-android.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/**'
|
||||
- 'android/**'
|
||||
- 'pubspec.yaml'
|
||||
- 'pubspec.lock'
|
||||
- 'native/**'
|
||||
- 'third_party/**'
|
||||
- 'scripts/verify_android_signing.sh'
|
||||
- '.github/workflows/build-android.yml'
|
||||
|
||||
jobs:
|
||||
@@ -49,6 +47,27 @@ jobs:
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify formatting
|
||||
run: dart format --output=none --set-exit-if-changed lib test
|
||||
|
||||
- name: Flutter analyze
|
||||
run: flutter analyze --no-fatal-infos lib test
|
||||
|
||||
- name: Install native plugin build dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libclang-dev
|
||||
|
||||
- name: Prepare native plugin runtime for tests
|
||||
run: dart run tool/prepare_plugin_runtime.dart
|
||||
|
||||
- name: Build native crypto test library
|
||||
run: cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
|
||||
- name: Flutter tests
|
||||
run: flutter test
|
||||
|
||||
- name: Configure Gradle
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
@@ -66,71 +85,83 @@ jobs:
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set — release will be debug-signed."
|
||||
exit 0
|
||||
echo "Release signing secrets are required."
|
||||
exit 1
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/komet-release.jks
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/qlyra-release.jks
|
||||
{
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "storeFile=komet-release.jks"
|
||||
echo "storeFile=qlyra-release.jks"
|
||||
} > android/key.properties
|
||||
echo "Release signing configured."
|
||||
|
||||
- name: Build Universal APK
|
||||
run: flutter build apk --release --flavor komet --obfuscate --split-debug-info=build/symbols
|
||||
run: flutter build apk --release --flavor qlyra --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Build Split APKs
|
||||
run: flutter build apk --release --split-per-abi --flavor komet --obfuscate --split-debug-info=build/symbols
|
||||
run: flutter build apk --release --split-per-abi --flavor qlyra --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Verify APK release certificates
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload Universal APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-universal
|
||||
path: build/app/outputs/flutter-apk/app-komet-release.apk
|
||||
name: qlyra-android-universal
|
||||
path: build/app/outputs/flutter-apk/app-qlyra-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload arm64-v8a APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-arm64-v8a
|
||||
path: build/app/outputs/flutter-apk/app-arm64-v8a-komet-release.apk
|
||||
name: qlyra-android-arm64-v8a
|
||||
path: build/app/outputs/flutter-apk/app-arm64-v8a-qlyra-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload armeabi-v7a APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-armeabi-v7a
|
||||
path: build/app/outputs/flutter-apk/app-armeabi-v7a-komet-release.apk
|
||||
name: qlyra-android-armeabi-v7a
|
||||
path: build/app/outputs/flutter-apk/app-armeabi-v7a-qlyra-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload x86_64 APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-x86_64
|
||||
path: build/app/outputs/flutter-apk/app-x86_64-komet-release.apk
|
||||
name: qlyra-android-x86_64
|
||||
path: build/app/outputs/flutter-apk/app-x86_64-qlyra-release.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Build App Bundle
|
||||
run: flutter build appbundle --release --flavor komet --obfuscate --split-debug-info=build/symbols
|
||||
run: flutter build appbundle --release --flavor qlyra --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
- name: Verify App Bundle release certificate
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload App Bundle artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-aab
|
||||
path: build/app/outputs/bundle/kometRelease/app-komet-release.aab
|
||||
name: qlyra-android-aab
|
||||
path: build/app/outputs/bundle/qlyraRelease/app-qlyra-release.aab
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload debug symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-android-symbols
|
||||
name: qlyra-android-symbols
|
||||
path: build/symbols
|
||||
if-no-files-found: error
|
||||
retention-days: 90
|
||||
|
||||
@@ -54,14 +54,14 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist build/ios/Payload
|
||||
cp -R build/ios/iphoneos/Runner.app build/ios/Payload/
|
||||
(cd build/ios && zip -qr ../../dist/Komet-ios-unsigned.ipa Payload)
|
||||
(cd build/ios && zip -qr ../../dist/Qlyra-ios-unsigned.ipa Payload)
|
||||
rm -rf build/ios/Payload
|
||||
|
||||
- name: Upload unsigned iOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-ios-unsigned
|
||||
path: dist/Komet-ios-unsigned.ipa
|
||||
name: qlyra-ios-unsigned
|
||||
path: dist/Qlyra-ios-unsigned.ipa
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
@@ -79,9 +79,9 @@ jobs:
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>get-task-allow</key><true/>
|
||||
<key>application-identifier</key><string>ru.komet.app</string>
|
||||
<key>application-identifier</key><string>ru.qlyra.app</string>
|
||||
<key>keychain-access-groups</key>
|
||||
<array><string>ru.komet.app</string></array>
|
||||
<array><string>ru.qlyra.app</string></array>
|
||||
</dict>
|
||||
</plist>
|
||||
PLIST
|
||||
@@ -104,12 +104,12 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist build/ios/Payload
|
||||
cp -R build/ios/iphoneos/Runner.app build/ios/Payload/
|
||||
(cd build/ios && zip -qr ../../dist/Komet-ios-pseudosigned.ipa Payload)
|
||||
(cd build/ios && zip -qr ../../dist/Qlyra-ios-pseudosigned.ipa Payload)
|
||||
|
||||
- name: Upload iOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-ios-pseudosigned
|
||||
path: dist/Komet-ios-pseudosigned.ipa
|
||||
name: qlyra-ios-pseudosigned
|
||||
path: dist/Qlyra-ios-pseudosigned.ipa
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
@@ -56,12 +56,12 @@ jobs:
|
||||
- name: Package Linux
|
||||
run: |
|
||||
mkdir -p dist
|
||||
tar -C build/linux/x64/release/bundle -czf dist/Komet-linux-x64.tar.gz .
|
||||
tar -C build/linux/x64/release/bundle -czf dist/Qlyra-linux-x64.tar.gz .
|
||||
|
||||
- name: Upload Linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-linux-x64
|
||||
path: dist/Komet-linux-x64.tar.gz
|
||||
name: qlyra-linux-x64
|
||||
path: dist/Qlyra-linux-x64.tar.gz
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
- name: Upload macOS DMG artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-macos
|
||||
name: qlyra-macos
|
||||
path: dist/*.dmg
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
@@ -52,12 +52,12 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path dist | Out-Null
|
||||
Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath dist/Komet-windows-x64.zip
|
||||
Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath dist/Qlyra-windows-x64.zip
|
||||
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komet-windows-x64
|
||||
path: dist/Komet-windows-x64.zip
|
||||
name: qlyra-windows-x64
|
||||
path: dist/Qlyra-windows-x64.zip
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
@@ -37,8 +37,33 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify formatting
|
||||
run: dart format --output=none --set-exit-if-changed lib test
|
||||
|
||||
- name: Flutter analyze
|
||||
run: flutter analyze
|
||||
run: flutter analyze --no-fatal-infos lib test
|
||||
|
||||
- name: Install native plugin build dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libclang-dev
|
||||
|
||||
- name: Prepare native plugin runtime for tests
|
||||
run: dart run tool/prepare_plugin_runtime.dart
|
||||
|
||||
- name: Build native crypto test library
|
||||
run: cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
|
||||
- name: Flutter tests with coverage
|
||||
run: flutter test --coverage
|
||||
|
||||
- name: Upload coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: flutter-dev-coverage
|
||||
path: coverage/lcov.info
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Configure Gradle
|
||||
run: |
|
||||
@@ -49,28 +74,8 @@ jobs:
|
||||
echo "org.gradle.parallel=true" >> ~/.gradle/gradle.properties
|
||||
echo "org.gradle.configureondemand=true" >> ~/.gradle/gradle.properties
|
||||
|
||||
- name: Setup release signing
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set — release will be debug-signed."
|
||||
exit 0
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/komet-release.jks
|
||||
{
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "storeFile=komet-release.jks"
|
||||
} > android/key.properties
|
||||
echo "Release signing configured."
|
||||
|
||||
- name: Build Android APK
|
||||
run: flutter build apk --release --flavor komet
|
||||
- name: Build debug APK
|
||||
run: flutter build apk --debug --flavor qlyra
|
||||
|
||||
build-ios:
|
||||
runs-on: macos-latest
|
||||
@@ -96,6 +101,24 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify formatting
|
||||
run: dart format --output=none --set-exit-if-changed lib test
|
||||
|
||||
- name: Install native plugin build dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libclang-dev
|
||||
|
||||
- name: Prepare native plugin runtime for tests
|
||||
run: dart run tool/prepare_plugin_runtime.dart
|
||||
|
||||
- name: Build native crypto test library
|
||||
run: cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
|
||||
- name: Flutter tests
|
||||
run: flutter test
|
||||
|
||||
- name: Build iOS (no codesign)
|
||||
run: |
|
||||
flutter config --no-enable-swift-package-manager
|
||||
|
||||
@@ -36,8 +36,33 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify formatting
|
||||
run: dart format --output=none --set-exit-if-changed lib test
|
||||
|
||||
- name: Flutter analyze
|
||||
run: flutter analyze
|
||||
run: flutter analyze --no-fatal-infos lib test
|
||||
|
||||
- name: Install native plugin build dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libclang-dev
|
||||
|
||||
- name: Prepare native plugin runtime for tests
|
||||
run: dart run tool/prepare_plugin_runtime.dart
|
||||
|
||||
- name: Build native crypto test library
|
||||
run: cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
|
||||
- name: Flutter tests with coverage
|
||||
run: flutter test --coverage
|
||||
|
||||
- name: Upload coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: flutter-main-coverage
|
||||
path: coverage/lcov.info
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Configure Gradle
|
||||
run: |
|
||||
@@ -48,28 +73,8 @@ jobs:
|
||||
echo "org.gradle.parallel=true" >> ~/.gradle/gradle.properties
|
||||
echo "org.gradle.configureondemand=true" >> ~/.gradle/gradle.properties
|
||||
|
||||
- name: Setup release signing
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set — release will be debug-signed."
|
||||
exit 0
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/komet-release.jks
|
||||
{
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "storeFile=komet-release.jks"
|
||||
} > android/key.properties
|
||||
echo "Release signing configured."
|
||||
|
||||
- name: Build Android APK
|
||||
run: flutter build apk --release --flavor komet
|
||||
- name: Build debug APK
|
||||
run: flutter build apk --debug --flavor qlyra
|
||||
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
name: Native crypto
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
native-crypto:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.44.3'
|
||||
cache: true
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: flutter pub get
|
||||
- run: cargo test --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
- run: cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
- run: flutter test --no-pub test/chat_crypto_roundtrip_test.dart test/outbox_queue_test.dart test/message_persistence_test.dart
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Dependency Vulnerability Scan
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'dev/**'
|
||||
merge_group:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '30 2 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
scan:
|
||||
uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v2.5.0
|
||||
with:
|
||||
scan-args: |-
|
||||
--lockfile=./pubspec.lock
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [komet, oneme]
|
||||
flavor: [qlyra, oneme]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
@@ -50,6 +50,12 @@ jobs:
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify native crypto and message delivery
|
||||
run: |
|
||||
cargo test --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
flutter test --no-pub test/chat_crypto_roundtrip_test.dart test/outbox_queue_test.dart test/message_persistence_test.dart test/messages_delivery_test.dart
|
||||
|
||||
- name: Configure Gradle
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
@@ -67,15 +73,15 @@ jobs:
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set — release will be debug-signed."
|
||||
exit 0
|
||||
echo "Release signing secrets are required."
|
||||
exit 1
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/komet-release.jks
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/qlyra-release.jks
|
||||
{
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "storeFile=komet-release.jks"
|
||||
echo "storeFile=qlyra-release.jks"
|
||||
} > android/key.properties
|
||||
echo "Release signing configured."
|
||||
|
||||
@@ -89,12 +95,18 @@ jobs:
|
||||
run: |
|
||||
F=${{ matrix.flavor }}
|
||||
mkdir -p dist
|
||||
cp build/app/outputs/flutter-apk/app-$F-release.apk dist/Komet-android-$F-universal.apk
|
||||
cp build/app/outputs/flutter-apk/app-arm64-v8a-$F-release.apk dist/Komet-android-$F-arm64-v8a.apk
|
||||
cp build/app/outputs/flutter-apk/app-armeabi-v7a-$F-release.apk dist/Komet-android-$F-armeabi-v7a.apk
|
||||
cp build/app/outputs/flutter-apk/app-x86_64-$F-release.apk dist/Komet-android-$F-x86_64.apk
|
||||
cp build/app/outputs/bundle/${F}Release/app-$F-release.aab dist/Komet-android-$F.aab
|
||||
tar -czf dist/Komet-android-$F-symbols.tar.gz -C build/symbols .
|
||||
cp build/app/outputs/flutter-apk/app-$F-release.apk dist/Qlyra-android-$F-universal.apk
|
||||
cp build/app/outputs/flutter-apk/app-arm64-v8a-$F-release.apk dist/Qlyra-android-$F-arm64-v8a.apk
|
||||
cp build/app/outputs/flutter-apk/app-armeabi-v7a-$F-release.apk dist/Qlyra-android-$F-armeabi-v7a.apk
|
||||
cp build/app/outputs/flutter-apk/app-x86_64-$F-release.apk dist/Qlyra-android-$F-x86_64.apk
|
||||
cp build/app/outputs/bundle/${F}Release/app-$F-release.aab dist/Qlyra-android-$F.aab
|
||||
tar -czf dist/Qlyra-android-$F-symbols.tar.gz -C build/symbols .
|
||||
|
||||
- name: Verify APK release certificates
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload Android artifacts (${{ matrix.flavor }})
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -127,7 +139,7 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path dist | Out-Null
|
||||
Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath dist/Komet-windows-x64.zip
|
||||
Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath dist/Qlyra-windows-x64.zip
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -162,7 +174,7 @@ jobs:
|
||||
- name: Package Linux
|
||||
run: |
|
||||
mkdir -p dist
|
||||
tar -C build/linux/x64/release/bundle -czf dist/Komet-linux-x64.tar.gz .
|
||||
tar -C build/linux/x64/release/bundle -czf dist/Qlyra-linux-x64.tar.gz .
|
||||
- name: Upload Linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -196,7 +208,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist
|
||||
APP=$(find build/macos/Build/Products/Release -maxdepth 1 -name "*.app" | head -1)
|
||||
ditto -c -k --keepParent "$APP" dist/Komet-macos.zip
|
||||
ditto -c -k --keepParent "$APP" dist/Qlyra-macos.zip
|
||||
- name: Upload macOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -230,7 +242,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist build/ios/Payload
|
||||
cp -R build/ios/iphoneos/Runner.app build/ios/Payload/
|
||||
(cd build/ios && zip -qr ../../dist/Komet-ios-unsigned.ipa Payload)
|
||||
(cd build/ios && zip -qr ../../dist/Qlyra-ios-unsigned.ipa Payload)
|
||||
rm -rf build/ios/Payload
|
||||
- name: Install ldid
|
||||
run: brew install ldid
|
||||
@@ -246,9 +258,9 @@ jobs:
|
||||
<dict>
|
||||
<key>platform-application</key><true/>
|
||||
<key>get-task-allow</key><true/>
|
||||
<key>application-identifier</key><string>ru.komet.app</string>
|
||||
<key>application-identifier</key><string>ru.qlyra.app</string>
|
||||
<key>keychain-access-groups</key>
|
||||
<array><string>ru.komet.app</string></array>
|
||||
<array><string>ru.qlyra.app</string></array>
|
||||
<key>com.apple.private.security.no-container</key><true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -271,7 +283,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist build/ios/Payload
|
||||
cp -R build/ios/iphoneos/Runner.app build/ios/Payload/
|
||||
(cd build/ios && zip -qr ../../dist/Komet-ios-pseudosigned.ipa Payload)
|
||||
(cd build/ios && zip -qr ../../dist/Qlyra-ios-pseudosigned.ipa Payload)
|
||||
- name: Upload iOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -297,7 +309,7 @@ jobs:
|
||||
BUILD="${{ github.event.inputs.build_number }}"
|
||||
BUILD="${BUILD:-$GITHUB_RUN_NUMBER}"
|
||||
echo "tag=v${BRANCH_VERSION}-dev.${BUILD}" >> "$GITHUB_OUTPUT"
|
||||
echo "name=Komet ${BRANCH_VERSION}-dev (build ${BUILD})" >> "$GITHUB_OUTPUT"
|
||||
echo "name=Qlyra ${BRANCH_VERSION}-dev (build ${BUILD})" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: List artifacts
|
||||
run: ls -lhR dist
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [komet, oneme]
|
||||
flavor: [qlyra, oneme]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
@@ -45,6 +45,12 @@ jobs:
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Verify native crypto and message delivery
|
||||
run: |
|
||||
cargo test --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
flutter test --no-pub test/chat_crypto_roundtrip_test.dart test/outbox_queue_test.dart test/message_persistence_test.dart test/messages_delivery_test.dart
|
||||
|
||||
- name: Configure Gradle
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
@@ -62,15 +68,15 @@ jobs:
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
if [ -z "$KEYSTORE_BASE64" ]; then
|
||||
echo "KEYSTORE_BASE64 secret not set — release will be debug-signed."
|
||||
exit 0
|
||||
echo "Release signing secrets are required."
|
||||
exit 1
|
||||
fi
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/komet-release.jks
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/qlyra-release.jks
|
||||
{
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "storeFile=komet-release.jks"
|
||||
echo "storeFile=qlyra-release.jks"
|
||||
} > android/key.properties
|
||||
echo "Release signing configured."
|
||||
|
||||
@@ -84,12 +90,18 @@ jobs:
|
||||
run: |
|
||||
F=${{ matrix.flavor }}
|
||||
mkdir -p dist
|
||||
cp build/app/outputs/flutter-apk/app-$F-release.apk dist/Komet-android-$F-universal.apk
|
||||
cp build/app/outputs/flutter-apk/app-arm64-v8a-$F-release.apk dist/Komet-android-$F-arm64-v8a.apk
|
||||
cp build/app/outputs/flutter-apk/app-armeabi-v7a-$F-release.apk dist/Komet-android-$F-armeabi-v7a.apk
|
||||
cp build/app/outputs/flutter-apk/app-x86_64-$F-release.apk dist/Komet-android-$F-x86_64.apk
|
||||
cp build/app/outputs/bundle/${F}Release/app-$F-release.aab dist/Komet-android-$F.aab
|
||||
tar -czf dist/Komet-android-$F-symbols.tar.gz -C build/symbols .
|
||||
cp build/app/outputs/flutter-apk/app-$F-release.apk dist/Qlyra-android-$F-universal.apk
|
||||
cp build/app/outputs/flutter-apk/app-arm64-v8a-$F-release.apk dist/Qlyra-android-$F-arm64-v8a.apk
|
||||
cp build/app/outputs/flutter-apk/app-armeabi-v7a-$F-release.apk dist/Qlyra-android-$F-armeabi-v7a.apk
|
||||
cp build/app/outputs/flutter-apk/app-x86_64-$F-release.apk dist/Qlyra-android-$F-x86_64.apk
|
||||
cp build/app/outputs/bundle/${F}Release/app-$F-release.aab dist/Qlyra-android-$F.aab
|
||||
tar -czf dist/Qlyra-android-$F-symbols.tar.gz -C build/symbols .
|
||||
|
||||
- name: Verify APK release certificates
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: bash scripts/verify_android_signing.sh
|
||||
|
||||
- name: Upload Android artifacts (${{ matrix.flavor }})
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -122,7 +134,7 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path dist | Out-Null
|
||||
Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath dist/Komet-windows-x64.zip
|
||||
Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath dist/Qlyra-windows-x64.zip
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -157,7 +169,7 @@ jobs:
|
||||
- name: Package Linux
|
||||
run: |
|
||||
mkdir -p dist
|
||||
tar -C build/linux/x64/release/bundle -czf dist/Komet-linux-x64.tar.gz .
|
||||
tar -C build/linux/x64/release/bundle -czf dist/Qlyra-linux-x64.tar.gz .
|
||||
- name: Upload Linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -189,7 +201,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist
|
||||
APP=$(find build/macos/Build/Products/Release -maxdepth 1 -name "*.app" | head -1)
|
||||
ditto -c -k --keepParent "$APP" dist/Komet-macos.zip
|
||||
ditto -c -k --keepParent "$APP" dist/Qlyra-macos.zip
|
||||
- name: Upload macOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -233,9 +245,9 @@ jobs:
|
||||
<dict>
|
||||
<key>platform-application</key><true/>
|
||||
<key>get-task-allow</key><true/>
|
||||
<key>application-identifier</key><string>ru.komet.app</string>
|
||||
<key>application-identifier</key><string>ru.qlyra.app</string>
|
||||
<key>keychain-access-groups</key>
|
||||
<array><string>ru.komet.app</string></array>
|
||||
<array><string>ru.qlyra.app</string></array>
|
||||
<key>com.apple.private.security.no-container</key><true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -258,7 +270,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p dist build/ios/Payload
|
||||
cp -R build/ios/iphoneos/Runner.app build/ios/Payload/
|
||||
(cd build/ios && zip -qr ../../dist/Komet-ios-pseudosigned.ipa Payload)
|
||||
(cd build/ios && zip -qr ../../dist/Qlyra-ios-pseudosigned.ipa Payload)
|
||||
- name: Upload iOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -286,7 +298,7 @@ jobs:
|
||||
run: |
|
||||
PUBSPEC_VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}' | cut -d'+' -f1)
|
||||
echo "tag=v${PUBSPEC_VERSION}+${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
|
||||
echo "name=Komet ${PUBSPEC_VERSION} (сборка ${GITHUB_RUN_NUMBER})" >> "$GITHUB_OUTPUT"
|
||||
echo "name=Qlyra ${PUBSPEC_VERSION} (сборка ${GITHUB_RUN_NUMBER})" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: List artifacts
|
||||
run: ls -lhR dist
|
||||
@@ -305,31 +317,31 @@ jobs:
|
||||
|
||||
## Какой файл качать
|
||||
|
||||
### Android — версия Komet (без push-уведомлений)
|
||||
- **`Komet-android-komet-arm64-v8a.apk`** — рекомендуется для большинства современных телефонов (64-битный ARM).
|
||||
- `Komet-android-komet-universal.apk` — универсальный APK, работает везде, но весит больше.
|
||||
- `Komet-android-komet-armeabi-v7a.apk` — для старых 32-битных устройств.
|
||||
- `Komet-android-komet-x86_64.apk` — для эмуляторов и редких x86-устройств.
|
||||
- `Komet-android-komet.aab` — App Bundle для публикации в Google Play (не для ручной установки).
|
||||
### Android — версия Qlyra (без push-уведомлений)
|
||||
- **`Qlyra-android-qlyra-arm64-v8a.apk`** — рекомендуется для большинства современных телефонов (64-битный ARM).
|
||||
- `Qlyra-android-qlyra-universal.apk` — универсальный APK, работает везде, но весит больше.
|
||||
- `Qlyra-android-qlyra-armeabi-v7a.apk` — для старых 32-битных устройств.
|
||||
- `Qlyra-android-qlyra-x86_64.apk` — для эмуляторов и редких x86-устройств.
|
||||
- `Qlyra-android-qlyra.aab` — App Bundle для публикации в Google Play (не для ручной установки).
|
||||
|
||||
### Android — версия OneMe (с push-уведомлениями через Firebase)
|
||||
- **`Komet-android-oneme-arm64-v8a.apk`** — рекомендуется для большинства современных телефонов.
|
||||
- `Komet-android-oneme-universal.apk` — универсальный APK.
|
||||
- `Komet-android-oneme-armeabi-v7a.apk` — для старых 32-битных устройств.
|
||||
- `Komet-android-oneme-x86_64.apk` — для эмуляторов и x86-устройств.
|
||||
- `Komet-android-oneme.aab` — App Bundle для Google Play.
|
||||
- **`Qlyra-android-oneme-arm64-v8a.apk`** — рекомендуется для большинства современных телефонов.
|
||||
- `Qlyra-android-oneme-universal.apk` — универсальный APK.
|
||||
- `Qlyra-android-oneme-armeabi-v7a.apk` — для старых 32-битных устройств.
|
||||
- `Qlyra-android-oneme-x86_64.apk` — для эмуляторов и x86-устройств.
|
||||
- `Qlyra-android-oneme.aab` — App Bundle для Google Play.
|
||||
|
||||
### Windows
|
||||
- **`Komet-windows-x64.zip`** — портативная сборка для Windows 10/11 (x64). Распаковать и запустить `Komet.exe`.
|
||||
- **`Qlyra-windows-x64.zip`** — портативная сборка для Windows 10/11 (x64). Распаковать и запустить `Qlyra.exe`.
|
||||
|
||||
### Linux
|
||||
- **`Komet-linux-x64.tar.gz`** — сборка для 64-битного Linux. Требуются `libgtk-3`, `libsecret-1`, `libjsoncpp`. Распаковать и запустить бинарник.
|
||||
- **`Qlyra-linux-x64.tar.gz`** — сборка для 64-битного Linux. Требуются `libgtk-3`, `libsecret-1`, `libjsoncpp`. Распаковать и запустить бинарник.
|
||||
|
||||
### macOS
|
||||
- **`Komet-macos.zip`** — `.app` для macOS. Распаковать и перетащить в `/Applications`. Приложение не нотаризовано — при первом запуске разрешите через «Системные настройки → Защита и безопасность».
|
||||
- **`Qlyra-macos.zip`** — `.app` для macOS. Распаковать и перетащить в `/Applications`. Приложение не нотаризовано — при первом запуске разрешите через «Системные настройки → Защита и безопасность».
|
||||
|
||||
### iOS
|
||||
- **`Komet-ios-pseudosigned.ipa`** — IPA с псевдо-подписью (ldid).
|
||||
- **`Qlyra-ios-pseudosigned.ipa`** — IPA с псевдо-подписью (ldid).
|
||||
⚠️ Не устанавливается через App Store. Подходит для:
|
||||
- jailbreak (Filza, rootless),
|
||||
- TrollStore,
|
||||
|
||||
@@ -136,7 +136,7 @@ agents.md
|
||||
.env
|
||||
.env.*
|
||||
# Локальные дампы трафика и скрипты анализа (содержат секреты)
|
||||
komet.txt
|
||||
qlyra.txt
|
||||
original_app.txt
|
||||
fingerprint.py
|
||||
PCAPdroid_*.txt
|
||||
@@ -149,8 +149,7 @@ maxtun/
|
||||
turnprobe/
|
||||
test/live_server_probe_test.dart
|
||||
|
||||
# local kolibri development: point the plugin at third_party/kolibri and the
|
||||
# Rust core at third_party/kolibri/kolibri-net instead of the published ones
|
||||
pubspec_overrides.yaml
|
||||
.cargo/
|
||||
third_party/kolibri/
|
||||
**/target/
|
||||
.codex-temp/
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"cmake.sourceDirectory": "/run/media/invisedivine/Drive/! My projects/Komet/linux/runner",
|
||||
"kiroAgent.configureMCP": "Disabled"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
Не оставляй комментарии в код
|
||||
Старайся писать чистый код
|
||||
Лучше качество чем количество
|
||||
Когда при исправления какой то ошибки/добавление новой возникает ситуация 50/50 где можно выбрать починить сейчас но костылём, или чинить долго, упорно, может даже вообще не починить и переписать пол приложения - выбирай долго и упорно.
|
||||
ВМЕСТО СНЕКБАРОВ ИСПОЛЬЗУЙ НАШИ КАСТОМНЫЕ УВЕДОМЛЕНИЕ showCustomNotification(context, 'текст')
|
||||
Never leave real data in test files, including existing message contents or real IDs captured from requests. Use synthetic fixtures instead.
|
||||
Не пытайся собирать APK/AAB (flutter build apk, flutter build appbundle, gradle assemble) — сборку запускает пользователь, тебе достаточно flutter analyze
|
||||
Если делаешь кнопку, где иконка переключается перечёркнутая/неперечёркнутая (вспышка, микрофон, звук, уведомления) — она должна анимироваться lottie-иконкой, а не подменяться мгновенно: добавь спеку в SLASH_SPECS в tool/make_morph_icons.py (fill=1.0, если кнопка рисует Icon(..., fill: 1)), прогони python3 tool/make_morph_icons.py и выводи через LottieSlashIcon. Ассеты в assets/lottie/ руками не правь — только через генератор.
|
||||
@@ -0,0 +1,26 @@
|
||||
# Android permission matrix
|
||||
|
||||
The machine-readable source of truth is [`tool/android_permissions.json`](tool/android_permissions.json). CI tests require every permission in the main Android manifest to have one owner, feature and trigger.
|
||||
|
||||
Triggers have these meanings:
|
||||
|
||||
- `user_action`: Android permission or settings UI may be requested only after a related tap, toggle or confirmed WebView prompt.
|
||||
- `feature_enabled`: background behavior may start only after the user enables the feature.
|
||||
- `active_feature`: the permission is used only while the related feature is active.
|
||||
- `system`: install-time capability without a runtime prompt.
|
||||
|
||||
| Area | Permissions | User-visible entry point |
|
||||
| --- | --- | --- |
|
||||
| Transport | `INTERNET`, `ACCESS_NETWORK_STATE` | Login and normal messaging |
|
||||
| Updates | `REQUEST_INSTALL_PACKAGES` | Confirmed update installation |
|
||||
| Camera and audio | `CAMERA`, `RECORD_AUDIO`, `MODIFY_AUDIO_SETTINGS` | Attachment camera, voice/video note, QR scanner or call |
|
||||
| Location | `ACCESS_FINE_LOCATION`, `ACCESS_COARSE_LOCATION` | Location attachment; legacy BLE contact exchange |
|
||||
| Bluetooth and NFC | `BLUETOOTH*`, `NFC` | Contact exchange sheet |
|
||||
| Notifications | `POST_NOTIFICATIONS`, `VIBRATE`, `WAKE_LOCK` | Notification settings or active notification feature |
|
||||
| Foreground services | `FOREGROUND_SERVICE*` | Enabled FKM, active call, screen sharing, or audio playback started by the user |
|
||||
| Background startup | `RECEIVE_BOOT_COMPLETED` | Previously enabled FKM only |
|
||||
| Special settings | `REQUEST_IGNORE_BATTERY_OPTIMIZATIONS`, `USE_FULL_SCREEN_INTENT` | Separate confirmation in notification settings |
|
||||
| Media library | `READ_EXTERNAL_STORAGE`, `READ_MEDIA_*` | Attachment picker or explicit save action |
|
||||
| Contacts | `READ_CONTACTS` | Optional phonebook-name feature |
|
||||
|
||||
WebView camera, microphone and location requests additionally require an HTTPS allowlisted origin and a per-request confirmation dialog.
|
||||
@@ -1,101 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project
|
||||
|
||||
Komet is a cross-platform Flutter messaging client (Android, iOS, macOS, Windows, Linux, Web) that communicates via a custom packet-based protocol with MessagePack serialization and Zstd compression.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
flutter pub get # install dependencies
|
||||
flutter analyze # lint / static analysis
|
||||
flutter run # run on connected device (default: komet flavor)
|
||||
flutter run --flavor oneme -t lib/main.dart # run oneme flavor (FCM)
|
||||
|
||||
# Android builds (release builds use obfuscation; keep symbols to de-obfuscate crashes)
|
||||
flutter build apk --release --flavor komet --obfuscate --split-debug-info=build/symbols
|
||||
flutter build apk --release --split-per-abi --flavor komet --obfuscate --split-debug-info=build/symbols
|
||||
flutter build appbundle --release --flavor komet --obfuscate --split-debug-info=build/symbols
|
||||
|
||||
# Other platforms
|
||||
flutter build ios --release --no-codesign
|
||||
flutter build macos --release
|
||||
flutter build web --release
|
||||
flutter build linux --release
|
||||
flutter build windows --release
|
||||
```
|
||||
|
||||
Android builds require **Java 17**. Gradle memory is configured to `-Xmx4096m`.
|
||||
|
||||
**Never run APK/AAB builds yourself** (`flutter build apk`, `flutter build appbundle`, gradle assemble tasks) — they are slow and the user builds them. Verify changes with `flutter analyze`; the build commands above are documentation only.
|
||||
|
||||
## Build Flavors
|
||||
|
||||
| Flavor | App ID | Notes |
|
||||
|--------|--------|-------|
|
||||
| `komet` | `ru.komet.app` | Default, no FCM |
|
||||
| `oneme` | `ru.oneme.app` | FCM push notifications via Firebase |
|
||||
|
||||
Flavor-specific Android resources live in `android/app/src/komet/` and `android/app/src/oneme/`.
|
||||
|
||||
## Architecture
|
||||
|
||||
The codebase follows a strict layered architecture:
|
||||
|
||||
```
|
||||
core/transport/ — raw socket I/O: connection, sender, receiver, dispatcher, proxy
|
||||
core/protocol/ — Packet struct, opcode map, MessagePack + Zstd serialization
|
||||
core/storage/ — SQLite (sqflite), secure token storage, spoofing service
|
||||
core/push/ — FCM integration (oneme flavor only)
|
||||
core/config/ — app config, proxy config, device presets, countries list
|
||||
|
||||
backend/api.dart — session lifecycle: connect, handshake, ping, auto-reconnect
|
||||
backend/modules/ — feature modules: account, messages, chats, contacts, calls, folders
|
||||
|
||||
state/ — ChangeNotifier state classes consumed by the UI
|
||||
models/ — plain data classes (User, Chat, Message, Call, Attachment, Session)
|
||||
|
||||
frontend/screens/ — full-page widgets grouped by feature (auth/, chats/, contacts/, calls/, profile/)
|
||||
frontend/widgets/ — reusable components (message_bubble, chat_tile, avatar, etc.)
|
||||
```
|
||||
|
||||
Data flow: UI → backend module → `api.dart` → transport layer → server.
|
||||
Incoming packets: transport → dispatcher → backend module → state → UI rebuild.
|
||||
|
||||
## Key Conventions (from AGENTS.md)
|
||||
|
||||
- **No comments in code.** Write self-documenting code instead.
|
||||
- **Use `showCustomNotification(context, 'text')`** for all user-facing notifications — never use SnackBars.
|
||||
- When a fix can be done quickly with a hack or properly with a rewrite, **choose the proper rewrite**.
|
||||
- Quality over quantity.
|
||||
- **Never leave real data in test files**, including existing message contents or real IDs captured from requests. Use synthetic fixtures instead.
|
||||
- **A button whose icon toggles between plain and slashed** (flash on/off, mic muted, sound, notifications) **must animate with a Lottie icon** — never swap two `Icon`s instantly. See *Animated icons* below.
|
||||
|
||||
## Animated icons
|
||||
|
||||
Everything in `assets/lottie/` is generated from the Material Symbols font by `tool/make_morph_icons.py` (stdlib-only Python, no deps). Never hand-edit the JSON — add a spec and re-run `python3 tool/make_morph_icons.py`.
|
||||
|
||||
| Kind | Spec list | Widget |
|
||||
|------|-----------|--------|
|
||||
| Morph between two glyphs | `SPECS` | `ComposerMorphIcon` |
|
||||
| Plain ↔ slashed toggle | `SLASH_SPECS` | `LottieSlashIcon` |
|
||||
|
||||
A slash spec takes the plain and slashed codepoints; the generator lays both glyphs out as static layers and sweeps a mask across the diagonal, so the slash looks drawn on top of the icon. Pass `fill=1.0` when the button renders `Icon(..., fill: 1)` — contours are then taken from the `FILL=1` instance of the variable font.
|
||||
|
||||
`LottieSlashIcon` plays the asset forward when `slashed` turns true and backward when it turns false, so a single asset covers both directions. The older `AnimatedSlashIcon` (clip wipe over two glyphs) stays where it is already used; new buttons use the Lottie one.
|
||||
|
||||
## Localization
|
||||
|
||||
Two locales supported: English (`lib/l10n/app_en.arb`) and Russian (`lib/l10n/app_ru.arb`).
|
||||
Generated code is in `lib/l10n/` (produced by `flutter gen-l10n` via `l10n.yaml`).
|
||||
|
||||
## CI/CD
|
||||
|
||||
Four GitHub Actions workflows in `.github/workflows/`:
|
||||
|
||||
- `flutter-dev.yml` — PR lint + Android build for dev branch
|
||||
- `flutter-main.yml` — PR lint + all-platform builds for main branch
|
||||
- `build-android.yml` — production APKs + AAB (`komet` flavor), triggered on push to main
|
||||
- `build-android-fcm.yml` — production APKs + AAB (`oneme` flavor with FCM), triggered on push to main
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,5 +1,52 @@
|
||||
> [!IMPORTANT]
|
||||
> Потерялись? Возможно вы ищите старую версию Komet. Она расположена [здесь](https://github.com/KometTeam/KometOld).
|
||||
---
|
||||
<img src="assets/qlyra.png" width="100" alt="Qlyra Logo">
|
||||
|
||||
# Komet
|
||||
# Qlyra
|
||||
|
||||
Кроссплатформенный клиент для мессенджера MAX.
|
||||
|
||||
## Android
|
||||
|
||||
Основной вариант приложения использует идентификатор `ru.qlyra.app` и flavor `qlyra`.
|
||||
|
||||
## Сборка из исходного кода
|
||||
|
||||
Используйте Flutter 3.44.3, Rust и Java 17 для Android. Перед запуском тестов
|
||||
соберите нативную библиотеку шифрования:
|
||||
|
||||
```console
|
||||
flutter pub get
|
||||
cargo build --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
cargo test --locked --manifest-path native/qlyra_crypto/rust/Cargo.toml
|
||||
flutter test --no-pub
|
||||
flutter analyze --no-pub --no-fatal-infos lib test
|
||||
```
|
||||
|
||||
Криптотесты требуют библиотеку для текущей ОС в
|
||||
`native/qlyra_crypto/rust/target/debug`. Другой путь задаётся переменной
|
||||
`QLYRA_CRYPTO_LIBRARY`. Отсутствие библиотеки считается ошибкой проверки.
|
||||
|
||||
Для release-сборки Android обязателен локальный `android/key.properties`
|
||||
с полями `storeFile`, `storePassword`, `keyAlias`, `keyPassword`.
|
||||
Используйте тот же ключ, которым подписана установленная версия.
|
||||
Без ключа release-сборка останавливается. Для разработки доступна
|
||||
`flutter build apk --debug --flavor qlyra`.
|
||||
|
||||
Release-варианты подключают Flutter JNI через Android Components API.
|
||||
Перед удалением отладочных символов задача `verifyQlyraReleaseFlutterJni`
|
||||
(или `verifyOnemeReleaseFlutterJni`) сверяет SHA-256 скомпилированных и
|
||||
объединённых библиотек и останавливает упаковку при несовпадении.
|
||||
|
||||
```console
|
||||
$ flutter build [windows|linux] [--release]
|
||||
$ flutter build apk --release --flavor qlyra
|
||||
```
|
||||
|
||||
Отправка текста проходит через `OutgoingText` и `OutboxQueue`: в БД сохраняются
|
||||
подготовленный текст, постоянный `cid` и срок повторной попытки. При включённом
|
||||
шифровании в очереди находится шифротекст. Подтверждение заменяет временную
|
||||
запись одной транзакцией. Старые pending-записи без метаданных подготовки
|
||||
получают статус ошибки и автоматически не отправляются.
|
||||
|
||||
`cid` сохраняется при повторе; серверная дедупликация зависит от реализации
|
||||
сервера MAX. Локальные тесты моделируют потерю ответа и не заменяют проверку
|
||||
этого поведения на сервере.
|
||||
|
||||
@@ -16,6 +16,8 @@ analyzer:
|
||||
- windows/**
|
||||
- macos/**
|
||||
- linux/**
|
||||
- native/**
|
||||
- third_party/**
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
|
||||
@@ -11,6 +11,6 @@ GeneratedPluginRegistrant.java
|
||||
# See https://flutter.dev/to/reference-keystore
|
||||
key.properties
|
||||
app/key.properties
|
||||
app/komet-release.jks
|
||||
app/qlyra-release.jks
|
||||
**/*.keystore
|
||||
**/*.jks
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import java.util.Properties
|
||||
import java.io.FileInputStream
|
||||
import java.security.MessageDigest
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import javax.inject.Inject
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
@@ -10,14 +17,26 @@ plugins {
|
||||
}
|
||||
|
||||
val keystoreProperties = Properties()
|
||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||
val keystorePropertiesFile = rootProject.file(
|
||||
providers.gradleProperty("releaseSigningProperties").getOrElse("key.properties")
|
||||
)
|
||||
val hasReleaseSigning = keystorePropertiesFile.exists()
|
||||
if (hasReleaseSigning) {
|
||||
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady {
|
||||
if (allTasks.any { it.project == project && it.name.contains("Release", ignoreCase = true) }) {
|
||||
check(hasReleaseSigning) { "Release signing requires android/key.properties" }
|
||||
for (key in listOf("keyAlias", "keyPassword", "storeFile", "storePassword")) {
|
||||
check(!keystoreProperties.getProperty(key).isNullOrBlank()) { "Missing release signing property: $key" }
|
||||
}
|
||||
check(file(keystoreProperties.getProperty("storeFile")).isFile) { "Release keystore does not exist" }
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "ru.komet.app"
|
||||
namespace = "ru.qlyra.app"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
@@ -32,7 +51,7 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "ru.komet.app"
|
||||
applicationId = "ru.qlyra.app"
|
||||
minSdk = maxOf(flutter.minSdkVersion, 23)
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
@@ -54,10 +73,14 @@ android {
|
||||
flavorDimensions += "distribution"
|
||||
|
||||
productFlavors {
|
||||
create("komet") {
|
||||
create("qlyra") {
|
||||
dimension = "distribution"
|
||||
isDefault = true
|
||||
applicationId = "ru.komet.app"
|
||||
applicationId = "ru.qlyra.app"
|
||||
}
|
||||
create("store") {
|
||||
dimension = "distribution"
|
||||
applicationId = "ru.qlyra.app"
|
||||
}
|
||||
create("oneme") {
|
||||
dimension = "distribution"
|
||||
@@ -80,9 +103,7 @@ android {
|
||||
release {
|
||||
signingConfig = if (hasReleaseSigning) {
|
||||
signingConfigs.getByName("release")
|
||||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
} else null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +118,76 @@ flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
abstract class StageFlutterJni : DefaultTask() {
|
||||
@get:InputDirectory
|
||||
abstract val inputDirectory: DirectoryProperty
|
||||
|
||||
@get:OutputDirectory
|
||||
abstract val outputDirectory: DirectoryProperty
|
||||
|
||||
@get:Inject
|
||||
abstract val fileSystem: FileSystemOperations
|
||||
|
||||
@TaskAction
|
||||
fun stage() {
|
||||
fileSystem.sync {
|
||||
from(inputDirectory)
|
||||
into(outputDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants(selector().withBuildType("release")) { variant ->
|
||||
val variantName = variant.name
|
||||
val capitalized = variantName.replaceFirstChar { it.uppercase() }
|
||||
val stage = tasks.register<StageFlutterJni>("stage${capitalized}FlutterJni") {
|
||||
dependsOn("copyJniLibsflutterBuild$capitalized")
|
||||
inputDirectory.set(layout.buildDirectory.dir("intermediates/flutter/$variantName/jniLibs"))
|
||||
outputDirectory.set(layout.buildDirectory.dir("intermediates/qlyra_flutter_jni/$variantName"))
|
||||
}
|
||||
variant.sources.jniLibs?.addGeneratedSourceDirectory(stage) { it.outputDirectory }
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all {
|
||||
if (buildType.name == "release") {
|
||||
val variantName = name
|
||||
val capitalized = variantName.replaceFirstChar { it.uppercase() }
|
||||
val generated = layout.buildDirectory.dir("intermediates/flutter/$variantName/jniLibs")
|
||||
val merged = layout.buildDirectory.dir(
|
||||
"intermediates/merged_native_libs/$variantName/merge${capitalized}NativeLibs/out/lib"
|
||||
)
|
||||
val verifyJni = tasks.register("verify${capitalized}FlutterJni") {
|
||||
dependsOn("merge${capitalized}NativeLibs", "copyJniLibsflutterBuild$capitalized")
|
||||
doLast {
|
||||
val root = generated.get().asFile
|
||||
val libraries = root.walkTopDown().filter { it.isFile && it.extension == "so" }.toList()
|
||||
check(libraries.any { it.name == "libapp.so" }) { "Compiled Flutter library is missing" }
|
||||
for (appLibrary in libraries.filter { it.name == "libapp.so" }) {
|
||||
val abi = appLibrary.parentFile.name
|
||||
val runtime = merged.get().asFile.resolve("$abi/libfjs.so")
|
||||
check(runtime.isFile && runtime.length() > 0) {
|
||||
"Plugin runtime is missing for $abi; inspect the fjs/cargokit build log"
|
||||
}
|
||||
}
|
||||
for (library in libraries) {
|
||||
val relative = library.relativeTo(root)
|
||||
val packaged = merged.get().asFile.resolve(relative)
|
||||
check(packaged.isFile) { "Flutter library was not merged: $relative" }
|
||||
val expected = MessageDigest.getInstance("SHA-256").digest(library.readBytes())
|
||||
val actual = MessageDigest.getInstance("SHA-256").digest(packaged.readBytes())
|
||||
check(expected.contentEquals(actual)) { "Stale Flutter library in package: $relative" }
|
||||
}
|
||||
logger.lifecycle("Verified fresh Flutter JNI for $variantName (${libraries.size} libraries)")
|
||||
}
|
||||
}
|
||||
tasks.matching { it.name == "strip${capitalized}DebugSymbols" }.configureEach {
|
||||
dependsOn(verifyJni)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
|
||||
implementation("androidx.media3:media3-transformer:1.9.3")
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"/>
|
||||
@@ -33,15 +34,15 @@
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
|
||||
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>
|
||||
<application
|
||||
android:label="Komet"
|
||||
android:name="${applicationName}"
|
||||
android:label="Qlyra"
|
||||
android:name="ru.qlyra.app.QlyraApplication"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name="ru.komet.app.MainActivity"
|
||||
android:name="ru.qlyra.app.MainActivity"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="Komet"
|
||||
android:label="Qlyra"
|
||||
android:launchMode="singleTop"
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/LaunchTheme"
|
||||
@@ -64,35 +65,33 @@
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="https" android:host="max.ru"/>
|
||||
<data android:scheme="https" android:host="www.max.ru"/>
|
||||
<data android:scheme="http" android:host="max.ru"/>
|
||||
<data android:scheme="http" android:host="www.max.ru"/>
|
||||
<data android:scheme="qlyra"/>
|
||||
</intent-filter>
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<intent-filter android:label="@string/share_target_label">
|
||||
<action android:name="android.intent.action.SEND"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="https" android:host="komet.pw"/>
|
||||
<data android:scheme="https" android:host="www.komet.pw"/>
|
||||
<data android:path="/export-logs"/>
|
||||
<data android:path="/export-logs/"/>
|
||||
<data android:mimeType="text/*"/>
|
||||
<data android:mimeType="image/*"/>
|
||||
<data android:mimeType="video/*"/>
|
||||
<data android:mimeType="audio/*"/>
|
||||
<data android:mimeType="application/*"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<intent-filter android:label="@string/share_target_label">
|
||||
<action android:name="android.intent.action.SEND_MULTIPLE"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="komet"/>
|
||||
<data android:scheme="max"/>
|
||||
<data android:mimeType="image/*"/>
|
||||
<data android:mimeType="video/*"/>
|
||||
<data android:mimeType="audio/*"/>
|
||||
<data android:mimeType="application/*"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity-alias
|
||||
android:name="ru.komet.app.MinimalIcon"
|
||||
android:name="ru.qlyra.app.MinimalIcon"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_minimal"
|
||||
android:label="Komet"
|
||||
android:targetActivity="ru.komet.app.MainActivity">
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="Qlyra"
|
||||
android:targetActivity="ru.qlyra.app.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
@@ -104,6 +103,23 @@
|
||||
android:name=".UploadForegroundService"
|
||||
android:foregroundServiceType="dataSync"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name="com.ryanheise.audioservice.AudioService"
|
||||
android:foregroundServiceType="mediaPlayback"
|
||||
android:exported="true"
|
||||
tools:ignore="Instantiatable">
|
||||
<intent-filter>
|
||||
<action android:name="android.media.browse.MediaBrowserService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<receiver
|
||||
android:name="com.ryanheise.audioservice.MediaButtonReceiver"
|
||||
android:exported="true"
|
||||
tools:ignore="Instantiatable">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service
|
||||
android:name=".NfcHostApduService"
|
||||
android:exported="true"
|
||||
@@ -113,10 +129,10 @@
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.nfc.cardemulation.host_apdu_service"
|
||||
android:resource="@xml/komet_nfc_apdu"/>
|
||||
android:resource="@xml/qlyra_nfc_apdu"/>
|
||||
</service>
|
||||
<service
|
||||
android:name=".KometFcmService"
|
||||
android:name=".QlyraFcmService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
@@ -135,7 +151,7 @@
|
||||
android:exported="false">
|
||||
<property
|
||||
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="Maintains the app's own persistent connection to the messaging server so that message notifications are delivered on builds without Google Play Services" />
|
||||
android:value="User-enabled option that keeps the app's own authenticated connection to the messaging service open solely to deliver incoming message and call notifications. Firebase Cloud Messaging cannot be used for this app: push delivery is operated by the third-party messaging service, which sends pushes only to its own FCM sender, so the app cannot receive them. The service is off by default, is started only after the user turns it on, carries a persistent notification, and can be stopped from that notification at any time." />
|
||||
</service>
|
||||
<receiver
|
||||
android:name=".FkmDisableReceiver"
|
||||
@@ -158,7 +174,7 @@
|
||||
android:value="2" />
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="komet_messages" />
|
||||
android:value="qlyra_messages" />
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(komet_rlottie LANGUAGES C CXX ASM)
|
||||
project(qlyra_rlottie LANGUAGES C CXX ASM)
|
||||
|
||||
add_subdirectory(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../../third_party/rlottie_build"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.bluetooth.BluetoothAdapter
|
||||
import android.bluetooth.BluetoothDevice
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.app.Service
|
||||
import android.content.Context
|
||||
@@ -8,7 +8,9 @@ import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.app.Person
|
||||
import androidx.core.app.ServiceCompat
|
||||
|
||||
object CallState {
|
||||
@Volatile
|
||||
@@ -18,15 +20,18 @@ object CallState {
|
||||
class CallForegroundService : Service() {
|
||||
|
||||
companion object {
|
||||
const val ACTION_START = "ru.komet.app.CALL_ONGOING_START"
|
||||
const val ACTION_STOP = "ru.komet.app.CALL_ONGOING_STOP"
|
||||
const val ACTION_SCREEN_SHARE = "ru.komet.app.CALL_SCREEN_SHARE"
|
||||
const val ACTION_START = "ru.qlyra.app.CALL_ONGOING_START"
|
||||
const val ACTION_STOP = "ru.qlyra.app.CALL_ONGOING_STOP"
|
||||
const val ACTION_SCREEN_SHARE = "ru.qlyra.app.CALL_SCREEN_SHARE"
|
||||
const val EXTRA_SCREEN_SHARE = "screenShare"
|
||||
const val ONGOING_ID = 424243
|
||||
|
||||
@Volatile
|
||||
var screenShare = false
|
||||
|
||||
@Volatile
|
||||
private var running: CallForegroundService? = null
|
||||
|
||||
fun setScreenShare(ctx: Context, enabled: Boolean, caller: String) {
|
||||
screenShare = enabled
|
||||
val intent = Intent(ctx, CallForegroundService::class.java).apply {
|
||||
@@ -41,7 +46,7 @@ class CallForegroundService : Service() {
|
||||
ctx.startService(intent)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "screen share FGS update failed: ${e.message}")
|
||||
Log.w("QlyraFcm", "screen share FGS update failed: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,13 +63,19 @@ class CallForegroundService : Service() {
|
||||
ctx.startService(intent)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "ongoing FGS start failed: ${e.message}")
|
||||
Log.w("QlyraFcm", "ongoing FGS start failed: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
fun stop(ctx: Context) {
|
||||
CallState.inCall = false
|
||||
screenShare = false
|
||||
val service = running
|
||||
if (service != null) {
|
||||
service.shutdown()
|
||||
return
|
||||
}
|
||||
NotificationManagerCompat.from(ctx).cancel(ONGOING_ID)
|
||||
try {
|
||||
ctx.startService(
|
||||
Intent(ctx, CallForegroundService::class.java).apply {
|
||||
@@ -78,18 +89,25 @@ class CallForegroundService : Service() {
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
running = this
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
if (running === this) running = null
|
||||
CallState.inCall = false
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun shutdown() {
|
||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
||||
stopSelf()
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
when (intent?.action) {
|
||||
ACTION_STOP -> {
|
||||
@Suppress("DEPRECATION")
|
||||
stopForeground(true)
|
||||
stopSelf()
|
||||
}
|
||||
ACTION_STOP -> shutdown()
|
||||
ACTION_SCREEN_SHARE -> {
|
||||
screenShare = intent.getBooleanExtra(EXTRA_SCREEN_SHARE, false)
|
||||
val caller = intent.getStringExtra(CallConst.EXTRA_CALLER) ?: "Звонок"
|
||||
@@ -142,7 +160,7 @@ class CallForegroundService : Service() {
|
||||
startForeground(ONGOING_ID, notif)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "startForeground failed: ${e.message}")
|
||||
Log.w("QlyraFcm", "startForeground failed: ${e.message}")
|
||||
stopSelf()
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
@@ -46,21 +46,21 @@ object CallEvents {
|
||||
}
|
||||
|
||||
object CallConst {
|
||||
const val CHANNEL_ID = "komet_calls"
|
||||
const val CHANNEL_ID = "qlyra_calls"
|
||||
const val CHANNEL_NAME = "Звонки"
|
||||
const val NOTIF_ID = 424242
|
||||
const val ACCENT = 0xFF7C6BF0.toInt()
|
||||
|
||||
const val EXTRA_CALL = "komet_call"
|
||||
const val EXTRA_ACTION = "komet_call_action"
|
||||
const val EXTRA_DECLINE_PAYLOAD = "komet_decline_payload"
|
||||
const val EXTRA_NOTIF_ID = "komet_notif_id"
|
||||
const val EXTRA_CALLER = "komet_caller"
|
||||
const val EXTRA_CALL = "qlyra_call"
|
||||
const val EXTRA_ACTION = "qlyra_call_action"
|
||||
const val EXTRA_DECLINE_PAYLOAD = "qlyra_decline_payload"
|
||||
const val EXTRA_NOTIF_ID = "qlyra_notif_id"
|
||||
const val EXTRA_CALLER = "qlyra_caller"
|
||||
|
||||
const val ACTION_RING = "ring"
|
||||
const val ACTION_ANSWER = "answer"
|
||||
const val ACTION_DECLINE = "ru.komet.app.CALL_DECLINE"
|
||||
const val ACTION_HANGUP = "ru.komet.app.CALL_HANGUP"
|
||||
const val ACTION_DECLINE = "ru.qlyra.app.CALL_DECLINE"
|
||||
const val ACTION_HANGUP = "ru.qlyra.app.CALL_HANGUP"
|
||||
|
||||
const val FLN_RECEIVER =
|
||||
"com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver"
|
||||
@@ -72,7 +72,7 @@ object CallNotifier {
|
||||
|
||||
fun showIncoming(ctx: Context, data: Map<String, String>) {
|
||||
if (AppState.resumed) {
|
||||
Log.d("KometFcm", "call push suppressed (app foreground)")
|
||||
Log.d("QlyraFcm", "call push suppressed (app foreground)")
|
||||
return
|
||||
}
|
||||
val name = data["userName"] ?: data["title"] ?: "Неизвестный"
|
||||
@@ -82,7 +82,7 @@ object CallNotifier {
|
||||
val account = data["c"] ?: ""
|
||||
val callJson = JSONObject(data as Map<*, *>).toString()
|
||||
|
||||
Log.d("KometFcm", "showIncoming caller=$callerId conv=$conversationId keys=${data.keys}")
|
||||
Log.d("QlyraFcm", "showIncoming caller=$callerId conv=$conversationId keys=${data.keys}")
|
||||
|
||||
ensureChannel(ctx)
|
||||
|
||||
@@ -117,7 +117,7 @@ object CallNotifier {
|
||||
}
|
||||
|
||||
fun finishCall(ctx: Context, data: Map<String, String>) {
|
||||
Log.d("KometFcm", "finishCall keys=${data.keys}")
|
||||
Log.d("QlyraFcm", "finishCall keys=${data.keys}")
|
||||
CallRinger.stop()
|
||||
NotificationManagerCompat.from(ctx).cancel(CallConst.NOTIF_ID)
|
||||
CallEvents.emit("ended")
|
||||
@@ -208,7 +208,7 @@ object CallRinger {
|
||||
activeConversationId = conversationId
|
||||
|
||||
val power = ctx.getSystemService(Context.POWER_SERVICE) as PowerManager
|
||||
wakeLock = power.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "komet:call").apply {
|
||||
wakeLock = power.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "qlyra:call").apply {
|
||||
setReferenceCounted(false)
|
||||
acquire(60_000L)
|
||||
}
|
||||
@@ -271,7 +271,7 @@ object CallRinger {
|
||||
rt.play()
|
||||
ringtone = rt
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "ringtone failed: ${e.message}")
|
||||
Log.w("QlyraFcm", "ringtone failed: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ object CallRinger {
|
||||
}
|
||||
vibrator = vib
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "vibrate failed: ${e.message}")
|
||||
Log.w("QlyraFcm", "vibrate failed: ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ class CallActionReceiver : BroadcastReceiver() {
|
||||
try {
|
||||
ctx.sendBroadcast(fln)
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "decline broadcast failed: ${e.message}")
|
||||
Log.w("QlyraFcm", "decline broadcast failed: ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.content.Intent
|
||||
import io.flutter.plugin.common.EventChannel
|
||||
|
||||
object ChatNotifications {
|
||||
const val EXTRA_CHAT = "komet_chat"
|
||||
const val EXTRA_CHAT = "qlyra_chat"
|
||||
|
||||
@Volatile
|
||||
var activeChatId: Long = 0L
|
||||
@@ -0,0 +1,202 @@
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.content.ClipDescription
|
||||
import android.content.ClipboardManager
|
||||
import android.content.ContentResolver
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.OpenableColumns
|
||||
import android.util.Log
|
||||
import android.webkit.MimeTypeMap
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import java.io.File
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
object ClipboardMedia {
|
||||
|
||||
private const val TAG = "ClipboardMedia"
|
||||
private const val CHANNEL = "ru.qlyra.app/clipboard"
|
||||
private const val CACHE_DIR = "clipboard_in"
|
||||
private const val MAX_ITEMS = 20
|
||||
private const val RETENTION_MS = 24L * 60L * 60L * 1000L
|
||||
private const val MAX_NAME = 96
|
||||
|
||||
private val textualTypes = setOf(
|
||||
ClipDescription.MIMETYPE_TEXT_PLAIN,
|
||||
ClipDescription.MIMETYPE_TEXT_HTML,
|
||||
ClipDescription.MIMETYPE_TEXT_URILIST,
|
||||
ClipDescription.MIMETYPE_TEXT_INTENT,
|
||||
)
|
||||
|
||||
private val executor = Executors.newSingleThreadExecutor()
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val seq = AtomicLong(0L)
|
||||
|
||||
fun attach(engine: FlutterEngine, context: Context) {
|
||||
val app = context.applicationContext
|
||||
MethodChannel(engine.dartExecutor.binaryMessenger, CHANNEL)
|
||||
.setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"hasMedia" -> result.success(hasMedia(app))
|
||||
"read" -> read(app, result)
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun clipboard(context: Context): ClipboardManager? =
|
||||
context.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
|
||||
|
||||
private fun hasMedia(context: Context): Boolean {
|
||||
val description = try {
|
||||
clipboard(context)?.primaryClipDescription
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "clipboard description unavailable: $e")
|
||||
null
|
||||
} ?: return false
|
||||
for (index in 0 until description.mimeTypeCount) {
|
||||
if (description.getMimeType(index) !in textualTypes) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun read(context: Context, result: MethodChannel.Result) {
|
||||
val clip = try {
|
||||
clipboard(context)?.primaryClip
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "clipboard unavailable: $e")
|
||||
null
|
||||
}
|
||||
if (clip == null || clip.itemCount == 0) {
|
||||
result.success(null)
|
||||
return
|
||||
}
|
||||
|
||||
val uris = ArrayList<Uri>(clip.itemCount)
|
||||
for (index in 0 until minOf(clip.itemCount, MAX_ITEMS)) {
|
||||
val uri = clip.getItemAt(index).uri ?: continue
|
||||
if (uri.scheme != ContentResolver.SCHEME_CONTENT &&
|
||||
uri.scheme != ContentResolver.SCHEME_FILE
|
||||
) {
|
||||
continue
|
||||
}
|
||||
uris.add(uri)
|
||||
}
|
||||
if (uris.isEmpty()) {
|
||||
result.success(null)
|
||||
return
|
||||
}
|
||||
|
||||
val declaredMime = clip.description?.getMimeType(0)
|
||||
executor.execute {
|
||||
val paths = materialize(context, uris, declaredMime)
|
||||
handler.post { result.success(if (paths.isEmpty()) null else mapOf("files" to paths)) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun materialize(context: Context, uris: List<Uri>, declaredMime: String?): List<String> {
|
||||
val root = File(context.cacheDir, CACHE_DIR)
|
||||
prune(root)
|
||||
val paths = ArrayList<String>(uris.size)
|
||||
for (uri in uris) {
|
||||
val copied = copyToCache(context, root, uri, declaredMime) ?: continue
|
||||
paths.add(copied)
|
||||
}
|
||||
return paths
|
||||
}
|
||||
|
||||
private fun copyToCache(
|
||||
context: Context,
|
||||
root: File,
|
||||
uri: Uri,
|
||||
declaredMime: String?,
|
||||
): String? {
|
||||
val resolver = context.contentResolver
|
||||
val dir = File(root, "${System.currentTimeMillis()}_${seq.incrementAndGet()}")
|
||||
return try {
|
||||
val mime = resolveMime(resolver, uri, declaredMime)
|
||||
dir.mkdirs()
|
||||
val target = File(dir, fileName(resolver, uri, mime))
|
||||
resolver.openInputStream(uri).use { input ->
|
||||
if (input == null) {
|
||||
dir.deleteRecursively()
|
||||
return null
|
||||
}
|
||||
target.outputStream().use { output -> input.copyTo(output) }
|
||||
}
|
||||
if (target.length() <= 0L) {
|
||||
dir.deleteRecursively()
|
||||
null
|
||||
} else {
|
||||
target.absolutePath
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "cannot read $uri: $e")
|
||||
dir.deleteRecursively()
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveMime(resolver: ContentResolver, uri: Uri, declaredMime: String?): String {
|
||||
val fromResolver = resolver.getType(uri)
|
||||
if (!fromResolver.isNullOrBlank() && fromResolver != "*/*") return fromResolver
|
||||
val extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString())
|
||||
if (!extension.isNullOrBlank()) {
|
||||
val guessed = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.lowercase())
|
||||
if (!guessed.isNullOrBlank()) return guessed
|
||||
}
|
||||
if (!declaredMime.isNullOrBlank() && declaredMime != "*/*") return declaredMime
|
||||
return "application/octet-stream"
|
||||
}
|
||||
|
||||
private fun fileName(resolver: ContentResolver, uri: Uri, mime: String): String {
|
||||
val declared = queryDisplayName(resolver, uri)
|
||||
?: uri.lastPathSegment?.substringAfterLast('/')
|
||||
val base = sanitize(declared.orEmpty())
|
||||
.ifEmpty { "paste_${System.currentTimeMillis()}" }
|
||||
val current = base.substringAfterLast('.', "")
|
||||
if (current.length in 1..5 && current.all { it.isLetterOrDigit() }) return base
|
||||
val extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime)
|
||||
return if (extension.isNullOrBlank()) "$base.bin" else "$base.$extension"
|
||||
}
|
||||
|
||||
private fun queryDisplayName(resolver: ContentResolver, uri: Uri): String? {
|
||||
if (uri.scheme == ContentResolver.SCHEME_FILE) return uri.lastPathSegment
|
||||
return try {
|
||||
resolver.query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)?.use { cursor ->
|
||||
val index = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
|
||||
if (index >= 0 && cursor.moveToFirst()) cursor.getString(index) else null
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "display name for $uri: $e")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun sanitize(name: String): String {
|
||||
val cleaned = name
|
||||
.replace(Regex("[\\\\/:*?\"<>|\\x00-\\x1F]"), "_")
|
||||
.trim()
|
||||
.trimStart('.')
|
||||
return if (cleaned.length <= MAX_NAME) cleaned else cleaned.takeLast(MAX_NAME)
|
||||
}
|
||||
|
||||
private fun prune(root: File) {
|
||||
try {
|
||||
if (!root.isDirectory) {
|
||||
root.mkdirs()
|
||||
return
|
||||
}
|
||||
val cutoff = System.currentTimeMillis() - RETENTION_MS
|
||||
root.listFiles()?.forEach { entry ->
|
||||
if (entry.lastModified() < cutoff) entry.deleteRecursively()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "cache cleanup failed: $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
@@ -20,7 +20,7 @@ import io.flutter.plugin.common.MethodChannel
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
object FkmChannel {
|
||||
private const val NAME = "ru.komet.app/fkm"
|
||||
private const val NAME = "ru.qlyra.app/fkm"
|
||||
const val NOTIF_PERMS_REQUEST = 7713
|
||||
|
||||
private val main = Handler(Looper.getMainLooper())
|
||||
@@ -117,7 +117,7 @@ object FkmChannel {
|
||||
val data = call.argument<Map<String, String>>("data") ?: return false
|
||||
worker.execute {
|
||||
try {
|
||||
KometNotifier(ctx).handle(data)
|
||||
QlyraNotifier(ctx).handle(data)
|
||||
FkmState.countDelivered(ctx)
|
||||
FkmService.refresh(ctx)
|
||||
} catch (e: Exception) {
|
||||
@@ -132,12 +132,12 @@ object FkmChannel {
|
||||
ctx: Context,
|
||||
call: MethodCall,
|
||||
tag: String,
|
||||
action: (KometNotifier, Map<String, String>) -> Unit,
|
||||
action: (QlyraNotifier, Map<String, String>) -> Unit,
|
||||
): Boolean {
|
||||
val data = call.argument<Map<String, String>>("data") ?: return false
|
||||
worker.execute {
|
||||
try {
|
||||
action(KometNotifier(ctx), data)
|
||||
action(QlyraNotifier(ctx), data)
|
||||
} catch (e: Exception) {
|
||||
Log.w("Fkm", "$tag failed: ${e.message}")
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
@@ -15,7 +15,7 @@ import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
|
||||
object FkmState {
|
||||
private const val PREFS = "komet_fkm"
|
||||
private const val PREFS = "qlyra_fkm"
|
||||
private const val KEY_ENABLED = "enabled"
|
||||
private const val KEY_DELIVERED = "delivered"
|
||||
|
||||
@@ -60,7 +60,7 @@ object FkmState {
|
||||
}
|
||||
|
||||
object FkmNotification {
|
||||
const val CHANNEL_ID = "komet_fkm"
|
||||
const val CHANNEL_ID = "qlyra_fkm"
|
||||
const val NOTIFICATION_ID = 424244
|
||||
|
||||
fun build(ctx: Context): Notification {
|
||||
@@ -228,7 +228,7 @@ class FkmService : Service() {
|
||||
|
||||
class FkmDisableReceiver : BroadcastReceiver() {
|
||||
companion object {
|
||||
const val ACTION_DISABLE = "ru.komet.app.FKM_DISABLE"
|
||||
const val ACTION_DISABLE = "ru.qlyra.app.FKM_DISABLE"
|
||||
}
|
||||
|
||||
override fun onReceive(ctx: Context, intent: Intent) {
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.Manifest
|
||||
import android.app.KeyguardManager
|
||||
@@ -23,9 +23,8 @@ import android.view.WindowManager
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import com.ryanheise.audioservice.AudioServiceActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.embedding.engine.FlutterEngineCache
|
||||
import io.flutter.plugin.common.EventChannel
|
||||
import io.flutter.plugin.common.MethodCall
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
@@ -49,10 +48,11 @@ import java.net.NetworkInterface
|
||||
import java.util.Collections
|
||||
import java.util.Random
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.security.MessageDigest
|
||||
|
||||
class MainActivity : FlutterActivity() {
|
||||
class MainActivity : AudioServiceActivity() {
|
||||
|
||||
private val channelName = "ru.komet.app/vpn_bypass"
|
||||
private val channelName = "ru.qlyra.app/vpn_bypass"
|
||||
private val iconPackage = MainActivity::class.java.name.substringBeforeLast('.')
|
||||
private val iconComponents = mapOf(
|
||||
"MainActivity" to "$iconPackage.MainActivity",
|
||||
@@ -77,11 +77,18 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
private var pendingCall: Map<String, Any?>? = null
|
||||
private var pendingChat: Long = 0L
|
||||
private var pendingShare: Map<String, Any?>? = null
|
||||
private var pendingShareTask: java.util.concurrent.Future<Map<String, Any?>?>? = null
|
||||
private val shareExecutor = java.util.concurrent.Executors.newSingleThreadExecutor()
|
||||
private val shareHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
private companion object {
|
||||
@Volatile
|
||||
var keepAwake = false
|
||||
|
||||
const val LOG_TAG = "VpnBypass"
|
||||
const val SHARE_TAG = "ShareIntake"
|
||||
const val NFC_TAG = "NfcExchange"
|
||||
const val KEEP_ENGINE_ID = "komet_keep_engine"
|
||||
const val NFC_PHASE_MIN_MS = 350L
|
||||
const val NFC_PHASE_JITTER_MS = 400
|
||||
const val BLE_PERMS_REQUEST = 7711
|
||||
@@ -113,12 +120,30 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine)
|
||||
ClipboardMedia.attach(flutterEngine, applicationContext)
|
||||
|
||||
nfcAdapter = NfcAdapter.getDefaultAdapter(this)
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/nfc",
|
||||
"ru.qlyra.app/update_integrity",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"verifyApkSigner" -> {
|
||||
val path = call.argument<String>("path")
|
||||
if (path == null) {
|
||||
result.error("INVALID_PATH", "APK path is required", null)
|
||||
} else {
|
||||
result.success(apkSignerMatchesInstalled(path))
|
||||
}
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.qlyra.app/nfc",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"status" -> result.success(nfcStatus())
|
||||
@@ -142,7 +167,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
EventChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/nfc_events",
|
||||
"ru.qlyra.app/nfc_events",
|
||||
).setStreamHandler(object : EventChannel.StreamHandler {
|
||||
override fun onListen(arguments: Any?, events: EventChannel.EventSink?) {
|
||||
nfcEvents = events
|
||||
@@ -167,7 +192,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/app_icon",
|
||||
"ru.qlyra.app/app_icon",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"setAppIcon" -> {
|
||||
@@ -189,7 +214,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/upload_service",
|
||||
"ru.qlyra.app/upload_service",
|
||||
).setMethodCallHandler { call, result ->
|
||||
val ctx = this
|
||||
fun uploadIntent(call: MethodCall, action: String) =
|
||||
@@ -240,7 +265,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/video_note",
|
||||
"ru.qlyra.app/video_note",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"permission" -> requestNotePermissions(result)
|
||||
@@ -279,7 +304,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/video",
|
||||
"ru.qlyra.app/video",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"cropSquare" -> {
|
||||
@@ -324,7 +349,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/calls",
|
||||
"ru.qlyra.app/calls",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"consumeInitialCall" -> {
|
||||
@@ -354,6 +379,10 @@ class MainActivity : FlutterActivity() {
|
||||
)
|
||||
result.success(null)
|
||||
}
|
||||
"dropOngoing" -> {
|
||||
CallForegroundService.stop(applicationContext)
|
||||
result.success(null)
|
||||
}
|
||||
"notifyEnded" -> {
|
||||
CallRinger.stop()
|
||||
NotificationManagerCompat.from(this).cancel(CallConst.NOTIF_ID)
|
||||
@@ -381,7 +410,7 @@ class MainActivity : FlutterActivity() {
|
||||
),
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "open FSI settings failed: ${e.message}")
|
||||
Log.w("QlyraFcm", "open FSI settings failed: ${e.message}")
|
||||
}
|
||||
}
|
||||
result.success(null)
|
||||
@@ -390,9 +419,22 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.qlyra.app/screen",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"setKeepAwake" -> {
|
||||
setKeepAwake(call.argument<Boolean>("enabled") == true)
|
||||
result.success(null)
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
||||
EventChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/calls_events",
|
||||
"ru.qlyra.app/calls_events",
|
||||
).setStreamHandler(object : EventChannel.StreamHandler {
|
||||
override fun onListen(arguments: Any?, events: EventChannel.EventSink?) {
|
||||
CallEvents.sink = events
|
||||
@@ -405,7 +447,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/notifications",
|
||||
"ru.qlyra.app/notifications",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"consumeInitialChat" -> {
|
||||
@@ -428,7 +470,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
EventChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.komet.app/notification_events",
|
||||
"ru.qlyra.app/notification_events",
|
||||
).setStreamHandler(object : EventChannel.StreamHandler {
|
||||
override fun onListen(arguments: Any?, events: EventChannel.EventSink?) {
|
||||
ChatNotifications.sink = events
|
||||
@@ -439,14 +481,96 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
})
|
||||
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.qlyra.app/share",
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"consumeInitialShare" -> {
|
||||
stashShare(intent, emit = false)
|
||||
val ready = pendingShare
|
||||
val task = pendingShareTask
|
||||
if (ready != null) {
|
||||
pendingShare = null
|
||||
result.success(ready)
|
||||
} else if (task != null) {
|
||||
pendingShareTask = null
|
||||
shareExecutor.execute {
|
||||
val payload = try {
|
||||
task.get()
|
||||
} catch (e: Exception) {
|
||||
Log.w(SHARE_TAG, "materialize failed: $e")
|
||||
null
|
||||
}
|
||||
shareHandler.post { result.success(payload) }
|
||||
}
|
||||
} else {
|
||||
result.success(null)
|
||||
}
|
||||
}
|
||||
"clearCache" -> {
|
||||
ShareIntake.clearCache(applicationContext)
|
||||
result.success(null)
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
||||
EventChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"ru.qlyra.app/share_events",
|
||||
).setStreamHandler(object : EventChannel.StreamHandler {
|
||||
override fun onListen(arguments: Any?, events: EventChannel.EventSink?) {
|
||||
ShareIntake.sink = events
|
||||
}
|
||||
|
||||
override fun onCancel(arguments: Any?) {
|
||||
ShareIntake.sink = null
|
||||
}
|
||||
})
|
||||
|
||||
FkmChannel.attach(flutterEngine, this)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun apkSignerMatchesInstalled(path: String): Boolean {
|
||||
return try {
|
||||
val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
PackageManager.GET_SIGNING_CERTIFICATES
|
||||
} else {
|
||||
PackageManager.GET_SIGNATURES
|
||||
}
|
||||
val archive = packageManager.getPackageArchiveInfo(path, flags) ?: return false
|
||||
if (archive.packageName != packageName) return false
|
||||
val installed = packageManager.getPackageInfo(packageName, flags)
|
||||
val archiveSigners = signerDigests(archive)
|
||||
archiveSigners.isNotEmpty() && archiveSigners == signerDigests(installed)
|
||||
} catch (_: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
private fun signerDigests(info: android.content.pm.PackageInfo): Set<String> {
|
||||
val signatures = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
info.signingInfo?.apkContentsSigners.orEmpty()
|
||||
} else {
|
||||
info.signatures.orEmpty()
|
||||
}
|
||||
return signatures.map { signature ->
|
||||
MessageDigest.getInstance("SHA-256")
|
||||
.digest(signature.toByteArray())
|
||||
.joinToString("") { byte -> "%02x".format(byte) }
|
||||
}.toSet()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
if (intent?.hasExtra(CallConst.EXTRA_CALL) == true) applyCallWindowFlags()
|
||||
super.onCreate(savedInstanceState)
|
||||
applyKeepAwake()
|
||||
intent?.let { if (it.hasExtra(CallConst.EXTRA_CALL)) stashCall(it, emit = false) }
|
||||
stashChatOpen(intent, emit = false)
|
||||
stashShare(intent, emit = false)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
@@ -457,6 +581,7 @@ class MainActivity : FlutterActivity() {
|
||||
stashCall(intent, emit = true)
|
||||
}
|
||||
stashChatOpen(intent, emit = true)
|
||||
stashShare(intent, emit = true)
|
||||
}
|
||||
|
||||
private fun stashChatOpen(source: Intent?, emit: Boolean) {
|
||||
@@ -471,9 +596,40 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun stashShare(source: Intent?, emit: Boolean) {
|
||||
if (!ShareIntake.isShare(source)) return
|
||||
val intent = source ?: return
|
||||
val snapshot = ShareIntake.snapshot(intent) ?: return
|
||||
intent.action = Intent.ACTION_MAIN
|
||||
intent.removeExtra(Intent.EXTRA_STREAM)
|
||||
intent.removeExtra(Intent.EXTRA_TEXT)
|
||||
val task = shareExecutor.submit<Map<String, Any?>?> {
|
||||
ShareIntake.materialize(applicationContext, snapshot)
|
||||
}
|
||||
if (!emit) {
|
||||
pendingShareTask = task
|
||||
return
|
||||
}
|
||||
shareExecutor.execute {
|
||||
val payload = try {
|
||||
task.get()
|
||||
} catch (e: Exception) {
|
||||
Log.w(SHARE_TAG, "materialize failed: $e")
|
||||
null
|
||||
} ?: return@execute
|
||||
shareHandler.post {
|
||||
val sink = ShareIntake.sink
|
||||
if (sink != null) sink.success(payload) else pendingShare = payload
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun stashCall(intent: Intent, emit: Boolean) {
|
||||
val json = intent.getStringExtra(CallConst.EXTRA_CALL) ?: return
|
||||
val action = intent.getStringExtra(CallConst.EXTRA_ACTION) ?: CallConst.ACTION_RING
|
||||
intent.removeExtra(CallConst.EXTRA_CALL)
|
||||
intent.removeExtra(CallConst.EXTRA_ACTION)
|
||||
intent.removeExtra(CallConst.EXTRA_CALLER)
|
||||
if (action == CallConst.ACTION_ANSWER) CallRinger.stop()
|
||||
val map = mapOf<String, Any?>("data" to json, "action" to action)
|
||||
val sink = CallEvents.sink
|
||||
@@ -492,8 +648,7 @@ class MainActivity : FlutterActivity() {
|
||||
@Suppress("DEPRECATION")
|
||||
window.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON,
|
||||
)
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@@ -510,12 +665,24 @@ class MainActivity : FlutterActivity() {
|
||||
@Suppress("DEPRECATION")
|
||||
window.clearFlags(
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setKeepAwake(enabled: Boolean) {
|
||||
keepAwake = enabled
|
||||
runOnUiThread { applyKeepAwake() }
|
||||
}
|
||||
|
||||
private fun applyKeepAwake() {
|
||||
if (keepAwake) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
} else {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
}
|
||||
|
||||
// Центр-кроп видео в квадрат size×size (без искажений) через media3
|
||||
// Transformer: LAYOUT_SCALE_TO_FIT_WITH_CROP заполняет квадрат и обрезает
|
||||
// лишнее по бокам.
|
||||
@@ -823,32 +990,21 @@ class MainActivity : FlutterActivity() {
|
||||
// в обоих случаях в фоне должно жить то же соединение, что и в UI.
|
||||
private fun keepEngineAlive(): Boolean = CallState.inCall || FkmState.enabled
|
||||
|
||||
override fun provideFlutterEngine(context: Context): FlutterEngine? {
|
||||
val cache = FlutterEngineCache.getInstance()
|
||||
val cached = cache.get(KEEP_ENGINE_ID)
|
||||
if (cached != null) {
|
||||
if (keepEngineAlive()) return cached
|
||||
cache.remove(KEEP_ENGINE_ID)
|
||||
cached.destroy()
|
||||
}
|
||||
return super.provideFlutterEngine(context)
|
||||
}
|
||||
|
||||
override fun shouldDestroyEngineWithHost(): Boolean = !keepEngineAlive()
|
||||
// Движок общий с audio_service (AudioServiceActivity.provideFlutterEngine), и
|
||||
// уничтожает его AudioServicePlugin.disposeFlutterEngine, когда останавливается
|
||||
// медиа-сервис. Активити не должна рвать его из-под сервиса.
|
||||
override fun shouldDestroyEngineWithHost(): Boolean = false
|
||||
|
||||
override fun cleanUpFlutterEngine(flutterEngine: FlutterEngine) {
|
||||
if (!keepEngineAlive()) {
|
||||
FlutterEngineCache.getInstance().remove(KEEP_ENGINE_ID)
|
||||
FkmChannel.detach()
|
||||
ChatNotifications.activeChatId = 0L
|
||||
}
|
||||
super.cleanUpFlutterEngine(flutterEngine)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
if (keepEngineAlive() && isFinishing) {
|
||||
Log.d("KometFcm", "task removed, caching engine (call=${CallState.inCall} fkm=${FkmState.enabled})")
|
||||
flutterEngine?.let { FlutterEngineCache.getInstance().put(KEEP_ENGINE_ID, it) }
|
||||
}
|
||||
shareExecutor.shutdown()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
object NfcExchange {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.nfc.cardemulation.HostApduService
|
||||
import android.os.Bundle
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
@@ -0,0 +1,20 @@
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.app.Application
|
||||
import com.ryanheise.audioservice.AudioServicePlugin
|
||||
|
||||
// id движка audio_service обязан быть выставлен до создания первого FlutterEngine.
|
||||
// Создаёт его не только активити: AudioService поднимает движок сам, когда система
|
||||
// стартует сервис по кнопке на гарнитуре. Выставленный позже id даёт второй движок —
|
||||
// второй изолят со своим соединением и своей сессией БД.
|
||||
class QlyraApplication : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
AudioServicePlugin.setFlutterEngineId(ENGINE_ID)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val ENGINE_ID = "qlyra_keep_engine"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
@@ -26,29 +26,29 @@ import com.google.firebase.messaging.RemoteMessage
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
class KometFcmService : FirebaseMessagingService() {
|
||||
class QlyraFcmService : FirebaseMessagingService() {
|
||||
override fun onMessageReceived(message: RemoteMessage) {
|
||||
val data = message.data
|
||||
Log.d("KometFcm", "onMessageReceived type=${data["type"]} keys=${data.keys}")
|
||||
Log.d("QlyraFcm", "onMessageReceived type=${data["type"]} keys=${data.keys}")
|
||||
if (data.isEmpty()) return
|
||||
val type = data["type"]
|
||||
FkmState.restore(applicationContext)
|
||||
if (FkmState.enabled && type != "InboundCall" && type != "CallFinished") {
|
||||
Log.d("KometFcm", "message push dropped: FKM handles messages")
|
||||
Log.d("QlyraFcm", "message push dropped: FKM handles messages")
|
||||
return
|
||||
}
|
||||
KometNotifier(applicationContext).handle(data)
|
||||
QlyraNotifier(applicationContext).handle(data)
|
||||
}
|
||||
}
|
||||
|
||||
class KometNotifier(private val ctx: Context) {
|
||||
class QlyraNotifier(private val ctx: Context) {
|
||||
|
||||
companion object {
|
||||
private const val CHANNEL_ID = "komet_messages"
|
||||
private const val CHANNEL_ID = "qlyra_messages"
|
||||
private const val CHANNEL_NAME = "Сообщения"
|
||||
private const val GROUP_KEY = "komet_messages_group"
|
||||
private const val GROUP_KEY = "qlyra_messages_group"
|
||||
private const val SUMMARY_ID = 424200
|
||||
private const val PREFS = "komet_push"
|
||||
private const val PREFS = "qlyra_push"
|
||||
private const val FLN_RECEIVER =
|
||||
"com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver"
|
||||
private const val FLN_ACTION_TAPPED =
|
||||
@@ -336,7 +336,7 @@ class KometNotifier(private val ctx: Context) {
|
||||
.setShowWhen(true)
|
||||
.setNumber(entries.size)
|
||||
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN)
|
||||
.setContentTitle("Komet")
|
||||
.setContentTitle("Qlyra")
|
||||
.setContentText(boldLine(newest.first, newest.second))
|
||||
.setStyle(inbox)
|
||||
.build()
|
||||
@@ -399,7 +399,7 @@ class KometNotifier(private val ctx: Context) {
|
||||
.build()
|
||||
ShortcutManagerCompat.pushDynamicShortcut(ctx, shortcut)
|
||||
} catch (e: Exception) {
|
||||
Log.w("KometFcm", "shortcut push failed: $e")
|
||||
Log.w("QlyraFcm", "shortcut push failed: $e")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.content.ContentResolver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.provider.OpenableColumns
|
||||
import android.util.Log
|
||||
import android.webkit.MimeTypeMap
|
||||
import io.flutter.plugin.common.EventChannel
|
||||
import java.io.File
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
object ShareIntake {
|
||||
|
||||
private const val TAG = "ShareIntake"
|
||||
private const val CACHE_DIR = "shared_in"
|
||||
private const val MAX_FILES = 30
|
||||
|
||||
private val seq = AtomicLong(0L)
|
||||
|
||||
@Volatile
|
||||
var sink: EventChannel.EventSink? = null
|
||||
|
||||
fun isShare(intent: Intent?): Boolean {
|
||||
val action = intent?.action ?: return false
|
||||
return action == Intent.ACTION_SEND || action == Intent.ACTION_SEND_MULTIPLE
|
||||
}
|
||||
|
||||
class Snapshot(
|
||||
val uris: List<Uri>,
|
||||
val text: String?,
|
||||
val subject: String?,
|
||||
val intentType: String?,
|
||||
)
|
||||
|
||||
fun snapshot(intent: Intent): Snapshot? {
|
||||
val uris = collectUris(intent).take(MAX_FILES)
|
||||
val text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT)?.toString()
|
||||
val subject = intent.getStringExtra(Intent.EXTRA_SUBJECT)
|
||||
if (uris.isEmpty() && text.isNullOrBlank()) return null
|
||||
return Snapshot(uris, text, subject, intent.type)
|
||||
}
|
||||
|
||||
fun materialize(context: Context, snapshot: Snapshot): Map<String, Any?>? {
|
||||
val files = ArrayList<Map<String, Any?>>()
|
||||
for (uri in snapshot.uris) {
|
||||
val copied = copyToCache(context, uri, snapshot.intentType)
|
||||
if (copied != null) files.add(copied)
|
||||
}
|
||||
|
||||
if (files.isEmpty() && snapshot.text.isNullOrBlank()) return null
|
||||
|
||||
return mapOf(
|
||||
"files" to files,
|
||||
"text" to snapshot.text,
|
||||
"subject" to snapshot.subject,
|
||||
)
|
||||
}
|
||||
|
||||
fun clearCache(context: Context) {
|
||||
try {
|
||||
val dir = File(context.cacheDir, CACHE_DIR)
|
||||
if (!dir.isDirectory) return
|
||||
dir.listFiles()?.forEach { it.delete() }
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "cache cleanup failed: $e")
|
||||
}
|
||||
}
|
||||
|
||||
private fun collectUris(intent: Intent): List<Uri> {
|
||||
if (intent.action == Intent.ACTION_SEND_MULTIPLE) {
|
||||
val list = if (android.os.Build.VERSION.SDK_INT >= 33) {
|
||||
intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM, Uri::class.java)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
intent.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM)
|
||||
}
|
||||
return list?.filterNotNull() ?: emptyList()
|
||||
}
|
||||
val single = if (android.os.Build.VERSION.SDK_INT >= 33) {
|
||||
intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri::class.java)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM)
|
||||
}
|
||||
return if (single != null) listOf(single) else emptyList()
|
||||
}
|
||||
|
||||
private fun copyToCache(context: Context, uri: Uri, intentType: String?): Map<String, Any?>? {
|
||||
val resolver = context.contentResolver
|
||||
val mime = resolveMime(resolver, uri, intentType)
|
||||
val displayName = queryDisplayName(resolver, uri) ?: fallbackName(uri, mime)
|
||||
|
||||
return try {
|
||||
val dir = File(context.cacheDir, CACHE_DIR).apply { mkdirs() }
|
||||
val target = File(dir, "${System.currentTimeMillis()}_${seq.incrementAndGet()}_${sanitize(displayName)}")
|
||||
resolver.openInputStream(uri).use { input ->
|
||||
if (input == null) return null
|
||||
target.outputStream().use { output -> input.copyTo(output) }
|
||||
}
|
||||
if (target.length() <= 0L) {
|
||||
target.delete()
|
||||
return null
|
||||
}
|
||||
mapOf(
|
||||
"path" to target.absolutePath,
|
||||
"name" to displayName,
|
||||
"mime" to mime,
|
||||
"size" to target.length(),
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "cannot read $uri: $e")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveMime(resolver: ContentResolver, uri: Uri, intentType: String?): String {
|
||||
val fromResolver = resolver.getType(uri)
|
||||
if (!fromResolver.isNullOrBlank() && fromResolver != "*/*") return fromResolver
|
||||
val ext = MimeTypeMap.getFileExtensionFromUrl(uri.toString())
|
||||
if (!ext.isNullOrBlank()) {
|
||||
val guessed = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.lowercase())
|
||||
if (!guessed.isNullOrBlank()) return guessed
|
||||
}
|
||||
if (!intentType.isNullOrBlank() && intentType != "*/*") return intentType
|
||||
return "application/octet-stream"
|
||||
}
|
||||
|
||||
private fun queryDisplayName(resolver: ContentResolver, uri: Uri): String? {
|
||||
if (uri.scheme == ContentResolver.SCHEME_FILE) return uri.lastPathSegment
|
||||
return try {
|
||||
resolver.query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)?.use { cursor ->
|
||||
val index = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
|
||||
if (index >= 0 && cursor.moveToFirst()) cursor.getString(index) else null
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "display name for $uri: $e")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun fallbackName(uri: Uri, mime: String): String {
|
||||
val last = uri.lastPathSegment?.substringAfterLast('/')
|
||||
if (!last.isNullOrBlank() && last.contains('.')) return last
|
||||
val ext = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime) ?: "bin"
|
||||
return "shared_${System.currentTimeMillis()}.$ext"
|
||||
}
|
||||
|
||||
private fun sanitize(name: String): String {
|
||||
val cleaned = name.replace(Regex("[^A-Za-z0-9._-]"), "_")
|
||||
return if (cleaned.length <= 64) cleaned else cleaned.takeLast(64)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.app.*
|
||||
import android.content.Intent
|
||||
@@ -11,11 +11,11 @@ import androidx.core.app.NotificationCompat
|
||||
class UploadForegroundService : Service() {
|
||||
|
||||
companion object {
|
||||
const val CHANNEL_ID = "komet_upload"
|
||||
const val CHANNEL_ID = "qlyra_upload"
|
||||
const val NOTIFICATION_ID = 9001
|
||||
const val ACTION_START = "ru.komet.app.UPLOAD_START"
|
||||
const val ACTION_UPDATE = "ru.komet.app.UPLOAD_UPDATE"
|
||||
const val ACTION_STOP = "ru.komet.app.UPLOAD_STOP"
|
||||
const val ACTION_START = "ru.qlyra.app.UPLOAD_START"
|
||||
const val ACTION_UPDATE = "ru.qlyra.app.UPLOAD_UPDATE"
|
||||
const val ACTION_STOP = "ru.qlyra.app.UPLOAD_STOP"
|
||||
const val EXTRA_TITLE = "title"
|
||||
const val EXTRA_BODY = "body"
|
||||
const val EXTRA_PROGRESS = "progress"
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.komet.app
|
||||
package ru.qlyra.app
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 49 KiB |
@@ -2,11 +2,12 @@
|
||||
<string name="upload_channel_name">Отправка медиа</string>
|
||||
<string name="fkm_channel_name">Сервис уведомлений</string>
|
||||
<string name="fkm_channel_description">Держит фоновое соединение с сервером</string>
|
||||
<string name="fkm_title">Komet · сервис уведомлений</string>
|
||||
<string name="fkm_title">Qlyra · сервис уведомлений</string>
|
||||
<string name="fkm_status_active">Соединение активно</string>
|
||||
<string name="fkm_status_inactive">Соединение не активно</string>
|
||||
<string name="fkm_status_line">%1$s · принято %2$d</string>
|
||||
<string name="fkm_explain">Это уведомление держит фоновое соединение с сервером, чтобы сообщения приходили без гугловых пушей. Убрать его можно, выключив FKM — кнопкой ниже или в Настройки → Уведомления → FKM.</string>
|
||||
<string name="fkm_disable">Выключить</string>
|
||||
<string name="notif_deleted_prefix">Удалено:</string>
|
||||
<string name="share_target_label">Отправить в чат</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<resources>
|
||||
<string name="nfc_service_description">Komet contact exchange</string>
|
||||
<string name="nfc_aid_group_description">Komet contact exchange</string>
|
||||
<string name="nfc_service_description">Qlyra contact exchange</string>
|
||||
<string name="nfc_aid_group_description">Qlyra contact exchange</string>
|
||||
<string name="upload_channel_name">Sending media</string>
|
||||
<string name="fkm_channel_name">Notification service</string>
|
||||
<string name="fkm_channel_description">Keeps the background connection to the server alive</string>
|
||||
<string name="fkm_title">Komet · notification service</string>
|
||||
<string name="fkm_title">Qlyra · notification service</string>
|
||||
<string name="fkm_status_active">Connection active</string>
|
||||
<string name="fkm_status_inactive">Connection inactive</string>
|
||||
<string name="fkm_status_line">%1$s · %2$d delivered</string>
|
||||
<string name="fkm_explain">This notification is what keeps a background connection to the server, so messages arrive without Google push. To get rid of it, turn FKM off — with the button below, or in Settings → Notifications → FKM.</string>
|
||||
<string name="fkm_disable">Turn off</string>
|
||||
<string name="notif_deleted_prefix">Deleted:</string>
|
||||
<string name="share_target_label">Send to a chat</string>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application>
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="https" android:host="max.ru"/>
|
||||
<data android:scheme="https" android:host="www.max.ru"/>
|
||||
<data android:scheme="http" android:host="max.ru"/>
|
||||
<data android:scheme="http" android:host="www.max.ru"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,33 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<application>
|
||||
<provider
|
||||
android:name="com.google.firebase.provider.FirebaseInitProvider"
|
||||
android:authorities="${applicationId}.firebaseinitprovider"
|
||||
tools:node="remove" />
|
||||
<provider
|
||||
android:name="io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingInitProvider"
|
||||
android:authorities="${applicationId}.flutterfirebasemessaginginitprovider"
|
||||
tools:node="remove" />
|
||||
<service
|
||||
android:name="com.google.firebase.messaging.FirebaseMessagingService"
|
||||
tools:node="remove" />
|
||||
<service
|
||||
android:name="io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingService"
|
||||
tools:node="remove" />
|
||||
<receiver
|
||||
android:name="io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingReceiver"
|
||||
tools:node="remove" />
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="https" android:host="max.ru"/>
|
||||
<data android:scheme="https" android:host="www.max.ru"/>
|
||||
<data android:scheme="http" android:host="max.ru"/>
|
||||
<data android:scheme="http" android:host="www.max.ru"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -9,7 +9,7 @@
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:659634599081:android:00000000000000000000ab",
|
||||
"android_client_info": {
|
||||
"package_name": "ru.komet.app"
|
||||
"package_name": "ru.qlyra.app"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
@@ -1,5 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove"/>
|
||||
<application>
|
||||
<provider
|
||||
android:name="com.google.firebase.provider.FirebaseInitProvider"
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "659634599081",
|
||||
"project_id": "max-messenger-app",
|
||||
"storage_bucket": "max-messenger-app.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:659634599081:android:00000000000000000000ab",
|
||||
"android_client_info": {
|
||||
"package_name": "ru.qlyra.app"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyABuDYeeDXIOrKTXLkUj30Ii143ofPe63Q"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 168 KiB |
@@ -0,0 +1,29 @@
|
||||
import { chat, contact, runtime, ui } from 'komet:api';
|
||||
|
||||
function date(value) {
|
||||
if (!Number.isInteger(value) || value <= 0) return '—';
|
||||
return new Date(value).toLocaleString();
|
||||
}
|
||||
|
||||
export async function info() {
|
||||
if (!(await runtime.isOnline())) {
|
||||
await ui.notify('Нет соединения');
|
||||
return;
|
||||
}
|
||||
const id = await chat.sendText('сбор данных...');
|
||||
const peer = await contact.getPeer();
|
||||
if (!peer) {
|
||||
await chat.editText(id, 'Команда доступна только в диалоге');
|
||||
return;
|
||||
}
|
||||
const summary = [
|
||||
`Никнейм: ${peer.displayName || '—'}`,
|
||||
`Дата регистрации: ${date(peer.registrationTime)}`,
|
||||
`Дата последнего изменения профиля: ${date(peer.updateTime)}`,
|
||||
`id: ${peer.id}`,
|
||||
`Регион: ${peer.country || '—'}`,
|
||||
`Флаги: ${peer.options.length ? peer.options.join(', ') : '—'}`,
|
||||
'ip: not fetched'
|
||||
].join('\n');
|
||||
await chat.editText(id, summary);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "pw.qlyra.info",
|
||||
"name": "Qlyra Info",
|
||||
"version": "1.0.0",
|
||||
"apiVersion": 1,
|
||||
"description": "Сводка данных о собеседнике",
|
||||
"author": "Qlyra",
|
||||
"main": "main.js",
|
||||
"permissions": ["chat.write", "chat.edit", "ui.notify", "contact.read"],
|
||||
"commands": [
|
||||
{"name": "/info", "description": "сводка данных о человеке", "handler": "info"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { chat, network, ui } from 'komet:api';
|
||||
|
||||
export async function nekogirl() {
|
||||
const response = await network.fetch('https://api.nekosapi.com/v4/images/random?rating=safe', {
|
||||
headers: { Accept: 'application/json' }
|
||||
});
|
||||
if (response.status !== 200) {
|
||||
await ui.notify(`Nekogirl вернул HTTP ${response.status}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(response.body);
|
||||
} catch (_) {
|
||||
await ui.notify('Nekogirl вернул некорректный ответ');
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof data[0].url !== 'string' || !data[0].url.startsWith('https://')) {
|
||||
await ui.notify('Nekogirl не вернул ссылку на изображение');
|
||||
return;
|
||||
}
|
||||
|
||||
const filename = data[0].url.split('/').pop() || 'nekogirl.jpg';
|
||||
|
||||
const source = data[0].url;
|
||||
await chat.sendPhoto({
|
||||
url: data[0].url,
|
||||
filename,
|
||||
caption: `Случайная кошкодевочкa`
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"schemaVersion":1,"id":"pw.qlyra.nekos","name":"Qlyra Nekos","version":"1.0.0","apiVersion":1,"description":"Случайные картинки кошкодевочек через nekosapi.com","author":"nyakokitsu","main":"main.js","permissions":["network","chat.photo","chat.write","ui.notify"],"commands":[{"name":"/nekogirl","description":"отправить случайную картинку кошкодевочки","handler":"nekogirl"}]}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { chat, network, ui } from 'komet:api';
|
||||
|
||||
function value(source, key, fallback = '—') {
|
||||
const result = source?.[key];
|
||||
return result === undefined || result === null || result === '' ? fallback : String(result);
|
||||
}
|
||||
|
||||
function description(source) {
|
||||
return source?.weatherDesc?.[0]?.value || '—';
|
||||
}
|
||||
|
||||
function dayLabel(date, index) {
|
||||
if (index === 0) return 'Сегодня';
|
||||
if (index === 1) return 'Завтра';
|
||||
return date || `День ${index + 1}`;
|
||||
}
|
||||
|
||||
export async function weather(context) {
|
||||
const city = context.arguments.city.trim();
|
||||
const url = `https://wttr.in/${encodeURIComponent(city)}?format=j1&lang=ru`;
|
||||
const response = await network.fetch(url, {
|
||||
headers: { Accept: 'application/json' }
|
||||
});
|
||||
if (response.status !== 200) {
|
||||
await ui.notify(`wttr.in вернул HTTP ${response.status}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(response.body);
|
||||
} catch (_) {
|
||||
await ui.notify('wttr.in вернул некорректный ответ');
|
||||
return;
|
||||
}
|
||||
|
||||
const current = data.current_condition?.[0];
|
||||
const area = data.nearest_area?.[0];
|
||||
if (!current) {
|
||||
await ui.notify('Погода для этого города не найдена');
|
||||
return;
|
||||
}
|
||||
|
||||
const place = area?.areaName?.[0]?.value || city;
|
||||
const country = area?.country?.[0]?.value;
|
||||
const lines = [
|
||||
`Погода: ${place}${country ? `, ${country}` : ''}`,
|
||||
`${description(current)}, ${value(current, 'temp_C')} °C`,
|
||||
`Ощущается как ${value(current, 'FeelsLikeC')} °C`,
|
||||
`Влажность ${value(current, 'humidity')}% · ветер ${value(current, 'windspeedKmph')} км/ч`,
|
||||
'',
|
||||
'Прогноз:'
|
||||
];
|
||||
|
||||
for (const [index, day] of (data.weather || []).slice(0, 3).entries()) {
|
||||
const noon = day.hourly?.find(item => item.time === '1200') || day.hourly?.[4] || day.hourly?.[0];
|
||||
lines.push(
|
||||
`${dayLabel(day.date, index)}: ${description(noon)}, ${value(day, 'mintempC')}…${value(day, 'maxtempC')} °C`
|
||||
);
|
||||
}
|
||||
|
||||
await chat.sendText(lines.join('\n'));
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "pw.qlyra.weather",
|
||||
"name": "Qlyra Weather",
|
||||
"version": "1.0.0",
|
||||
"apiVersion": 1,
|
||||
"description": "Текущая погода и прогноз через wttr.in",
|
||||
"author": "Qlyra",
|
||||
"main": "main.js",
|
||||
"permissions": ["chat.write", "ui.notify", "network"],
|
||||
"commands": [
|
||||
{
|
||||
"name": "/weather",
|
||||
"description": "погода и прогноз для города",
|
||||
"handler": "weather",
|
||||
"arguments": [
|
||||
{"name": "city", "description": "название города", "rest": true}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
@@ -15,7 +15,7 @@
|
||||
<rect width="1440" height="2280" fill="#F8F4FE"/>
|
||||
|
||||
<g id="header">
|
||||
<text x="64" y="84" class="title" fill="#1B1B21">Komet — Design System</text>
|
||||
<text x="64" y="84" class="title" fill="#1B1B21">Qlyra — Design System</text>
|
||||
<text x="64" y="112" class="small" fill="#46464F">Seed #C1C4FF · Material 3 Expressive · Inter</text>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -7,7 +7,7 @@ ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
require 'json'
|
||||
|
||||
# Firebase is Android-only: FCM is used solely by the `oneme` flavor, and on
|
||||
# iOS there is a single `ru.komet.app` bundle that never initialises push.
|
||||
# iOS there is a single `ru.qlyra.app` bundle that never initialises push.
|
||||
# Keep the Firebase SDK out of the iOS build entirely so iOS is not forced up
|
||||
# to the iOS 15 deployment target that firebase_core's podspec requires.
|
||||
FIREBASE_IOS_PLUGINS = %w[firebase_core firebase_messaging].freeze
|
||||
@@ -79,7 +79,7 @@ end
|
||||
# xcframeworks into the pod target's own build dir, so for Runner that variable
|
||||
# expands to a file nothing ever produces and Xcode fails on the missing input.
|
||||
OPUS_XCFRAMEWORK = 'ogg_opus_player/darwin/Frameworks/libopus.xcframework'.freeze
|
||||
OPUS_LIB_VAR = 'KOMET_OPUS_LIB'.freeze
|
||||
OPUS_LIB_VAR = 'QLYRA_OPUS_LIB'.freeze
|
||||
OPUS_FORCE_LOAD = %(-force_load "$(#{OPUS_LIB_VAR})").freeze
|
||||
OPUS_XCFRAMEWORK_DIR =
|
||||
File.expand_path(File.join('.symlinks', 'plugins', OPUS_XCFRAMEWORK), __dir__).freeze
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
4B1A4BBCD56B3CE42AD0A480 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 789A1AEF2F4FF7DEED202476 /* Pods_Runner.framework */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
AA11BB22CC33DD44EE550101 /* KometVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550001 /* KometVideo.swift */; };
|
||||
AA11BB22CC33DD44EE550102 /* KometVideoNote.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550002 /* KometVideoNote.swift */; };
|
||||
AA11BB22CC33DD44EE550103 /* KometNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550003 /* KometNotifications.swift */; };
|
||||
AA11BB22CC33DD44EE550101 /* QlyraVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550001 /* QlyraVideo.swift */; };
|
||||
AA11BB22CC33DD44EE550102 /* QlyraVideoNote.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550002 /* QlyraVideoNote.swift */; };
|
||||
AA11BB22CC33DD44EE550103 /* QlyraNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550003 /* QlyraNotifications.swift */; };
|
||||
AA11BB22CC33DD44EE550105 /* QlyraClipboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550005 /* QlyraClipboard.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
@@ -59,9 +60,10 @@
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550001 /* KometVideo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KometVideo.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550002 /* KometVideoNote.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KometVideoNote.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550003 /* KometNotifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KometNotifications.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550001 /* QlyraVideo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QlyraVideo.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550002 /* QlyraVideoNote.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QlyraVideoNote.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550003 /* QlyraNotifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QlyraNotifications.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550005 /* QlyraClipboard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QlyraClipboard.swift; sourceTree = "<group>"; };
|
||||
AA11BB22CC33DD44EE550004 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||
782E66FE4E292DCFD0D1B7D2 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
789A1AEF2F4FF7DEED202476 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -164,9 +166,10 @@
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
AA11BB22CC33DD44EE550001 /* KometVideo.swift */,
|
||||
AA11BB22CC33DD44EE550002 /* KometVideoNote.swift */,
|
||||
AA11BB22CC33DD44EE550003 /* KometNotifications.swift */,
|
||||
AA11BB22CC33DD44EE550001 /* QlyraVideo.swift */,
|
||||
AA11BB22CC33DD44EE550002 /* QlyraVideoNote.swift */,
|
||||
AA11BB22CC33DD44EE550003 /* QlyraNotifications.swift */,
|
||||
AA11BB22CC33DD44EE550005 /* QlyraClipboard.swift */,
|
||||
AA11BB22CC33DD44EE550004 /* Runner.entitlements */,
|
||||
);
|
||||
path = Runner;
|
||||
@@ -407,9 +410,10 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
||||
AA11BB22CC33DD44EE550101 /* KometVideo.swift in Sources */,
|
||||
AA11BB22CC33DD44EE550102 /* KometVideoNote.swift in Sources */,
|
||||
AA11BB22CC33DD44EE550103 /* KometNotifications.swift in Sources */,
|
||||
AA11BB22CC33DD44EE550101 /* QlyraVideo.swift in Sources */,
|
||||
AA11BB22CC33DD44EE550102 /* QlyraVideoNote.swift in Sources */,
|
||||
AA11BB22CC33DD44EE550103 /* QlyraNotifications.swift in Sources */,
|
||||
AA11BB22CC33DD44EE550105 /* QlyraClipboard.swift in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -510,7 +514,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.komet.app;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.qlyra.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -527,7 +531,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.komet.app.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.qlyra.app.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@@ -545,7 +549,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.komet.app.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.qlyra.app.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@@ -561,7 +565,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.komet.app.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.qlyra.app.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@@ -693,7 +697,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.komet.app;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.qlyra.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@@ -716,7 +720,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.komet.app;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.qlyra.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
|
||||
final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
final class QlyraStreamHandler: NSObject, FlutterStreamHandler {
|
||||
private let onSink: (FlutterEventSink?) -> Void
|
||||
|
||||
init(onSink: @escaping (FlutterEventSink?) -> Void) {
|
||||
@@ -26,15 +26,15 @@ final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
private var channels: [FlutterMethodChannel] = []
|
||||
private var eventChannels: [FlutterEventChannel] = []
|
||||
private var streamHandlers: [KometStreamHandler] = []
|
||||
private var videoNote: KometVideoNote?
|
||||
private var streamHandlers: [QlyraStreamHandler] = []
|
||||
private var videoNote: QlyraVideoNote?
|
||||
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
KometNotifications.shared.start()
|
||||
QlyraNotifications.shared.start()
|
||||
|
||||
if let controller = window?.rootViewController as? FlutterViewController {
|
||||
let messenger = controller.binaryMessenger
|
||||
@@ -42,6 +42,8 @@ final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
registerVideo(messenger)
|
||||
registerVideoNote(messenger)
|
||||
registerNotifications(messenger)
|
||||
registerScreen(messenger)
|
||||
registerClipboard(messenger)
|
||||
}
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
@@ -56,7 +58,7 @@ final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
|
||||
private func events(_ name: String, _ messenger: FlutterBinaryMessenger,
|
||||
_ onSink: @escaping (FlutterEventSink?) -> Void) {
|
||||
let handler = KometStreamHandler(onSink: onSink)
|
||||
let handler = QlyraStreamHandler(onSink: onSink)
|
||||
let channel = FlutterEventChannel(name: name, binaryMessenger: messenger)
|
||||
channel.setStreamHandler(handler)
|
||||
streamHandlers.append(handler)
|
||||
@@ -64,7 +66,7 @@ final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
}
|
||||
|
||||
private func registerAppIcon(_ messenger: FlutterBinaryMessenger) {
|
||||
method("ru.komet.app/app_icon", messenger) { call, result in
|
||||
method("ru.qlyra.app/app_icon", messenger) { call, result in
|
||||
switch call.method {
|
||||
case "getAppIcon":
|
||||
result(UIApplication.shared.alternateIconName)
|
||||
@@ -99,23 +101,23 @@ final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
}
|
||||
|
||||
private func registerVideo(_ messenger: FlutterBinaryMessenger) {
|
||||
method("ru.komet.app/video", messenger) { call, result in
|
||||
KometVideo.shared.handle(call, result: result)
|
||||
method("ru.qlyra.app/video", messenger) { call, result in
|
||||
QlyraVideo.shared.handle(call, result: result)
|
||||
}
|
||||
}
|
||||
|
||||
private func registerVideoNote(_ messenger: FlutterBinaryMessenger) {
|
||||
guard let textures = registrar(forPlugin: "KometVideoNote")?.textures() else { return }
|
||||
guard let textures = registrar(forPlugin: "QlyraVideoNote")?.textures() else { return }
|
||||
|
||||
method("ru.komet.app/video_note", messenger) { [weak self] call, result in
|
||||
method("ru.qlyra.app/video_note", messenger) { [weak self] call, result in
|
||||
guard let self = self else { return }
|
||||
switch call.method {
|
||||
case "permission":
|
||||
KometVideoNote.requestPermission(result)
|
||||
QlyraVideoNote.requestPermission(result)
|
||||
case "init":
|
||||
let args = call.arguments as? [String: Any] ?? [:]
|
||||
self.videoNote?.dispose()
|
||||
let recorder = KometVideoNote(registry: textures)
|
||||
let recorder = QlyraVideoNote(registry: textures)
|
||||
self.videoNote = recorder
|
||||
recorder.initialize(
|
||||
front: (args["front"] as? NSNumber)?.boolValue ?? true,
|
||||
@@ -142,7 +144,7 @@ final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
}
|
||||
|
||||
private func withRecorder(_ result: @escaping FlutterResult,
|
||||
_ body: (KometVideoNote) -> Void) {
|
||||
_ body: (QlyraVideoNote) -> Void) {
|
||||
guard let recorder = videoNote else {
|
||||
result(FlutterError(code: "NOT_READY", message: "recorder not initialized", details: nil))
|
||||
return
|
||||
@@ -150,12 +152,33 @@ final class KometStreamHandler: NSObject, FlutterStreamHandler {
|
||||
body(recorder)
|
||||
}
|
||||
|
||||
private func registerNotifications(_ messenger: FlutterBinaryMessenger) {
|
||||
method("ru.komet.app/notifications", messenger) { call, result in
|
||||
KometNotifications.shared.handle(call, result: result)
|
||||
private func registerScreen(_ messenger: FlutterBinaryMessenger) {
|
||||
method("ru.qlyra.app/screen", messenger) { call, result in
|
||||
switch call.method {
|
||||
case "setKeepAwake":
|
||||
let enabled = ((call.arguments as? [String: Any])?["enabled"] as? NSNumber)?.boolValue ?? false
|
||||
DispatchQueue.main.async {
|
||||
UIApplication.shared.isIdleTimerDisabled = enabled
|
||||
result(nil)
|
||||
}
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
events("ru.komet.app/notification_events", messenger) { sink in
|
||||
KometNotifications.shared.attach(sink)
|
||||
}
|
||||
|
||||
private func registerClipboard(_ messenger: FlutterBinaryMessenger) {
|
||||
method("ru.qlyra.app/clipboard", messenger) { call, result in
|
||||
QlyraClipboard.handle(call, result: result)
|
||||
}
|
||||
}
|
||||
|
||||
private func registerNotifications(_ messenger: FlutterBinaryMessenger) {
|
||||
method("ru.qlyra.app/notifications", messenger) { call, result in
|
||||
QlyraNotifications.shared.handle(call, result: result)
|
||||
}
|
||||
events("ru.qlyra.app/notification_events", messenger) { sink in
|
||||
QlyraNotifications.shared.attach(sink)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 797 KiB |
|
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 32 KiB |
@@ -5,7 +5,7 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Komet</string>
|
||||
<string>Qlyra</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -13,7 +13,7 @@
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Komet</string>
|
||||
<string>Qlyra</string>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict>
|
||||
<key>CFBundleAlternateIcons</key>
|
||||
@@ -76,10 +76,10 @@
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>ru.komet.app</string>
|
||||
<string>ru.qlyra.app</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>komet</string>
|
||||
<string>qlyra</string>
|
||||
<string>max</string>
|
||||
</array>
|
||||
</dict>
|
||||
|
||||