From 57520bf512be3337fb0a8462439fd5e5aa7d2a4e Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Tue, 16 Sep 2025 15:30:46 +0200 Subject: [PATCH] fix: Reintroduce shared isolate (#3981) * initial scripts n actions * custom cshared isolate * kitlin fixes * integrate and token fix * executable and gstreamer * disable check dupes, fix gstreamer * another linux update, removed 2 android builds * new updates * final android attempt * formatting --------- Co-authored-by: ggurdin --- .github/workflows/check_duplicates.yaml | 3 + .github/workflows/integrate.yaml | 194 +++++++++--------- .github/workflows/manual.yml | 4 +- .github/workflows/release.yaml | 72 +++---- .github/workflows/versions.env | 2 +- android/app/build.gradle | 115 ----------- android/app/build.gradle.kts | 104 ++++++++++ .../com/talktolearn/chat/FcmPushService.kt | 8 - .../com/talktolearn/chat/MainActivity.kt | 4 +- .../talktolearn/chat/UnifiedPushService.kt | 23 --- android/build.gradle | 27 --- android/build.gradle.kts | 31 +++ android/settings.gradle | 38 ---- android/settings.gradle.kts | 40 ++++ lib/main.dart | 2 - lib/utils/background_push.dart | 71 +++---- .../fcm_shared_isolate/.gitlab-ci.yml | 13 -- pubspec.yaml | 5 +- scripts/add-firebase-messaging.sh | 12 ++ scripts/build-android-apk.sh | 5 - scripts/build-android-debug.sh | 2 - scripts/build-ios.sh | 2 +- scripts/build-linux.sh | 5 - scripts/build-macos.sh | 2 +- scripts/build-web.sh | 5 - scripts/build-windows.ps1 | 3 +- scripts/code_analyze.sh | 8 - scripts/create_fdroid_repos.sh | 2 +- scripts/download-web-stable.sh | 12 -- scripts/enable-android-google-services.patch | 144 ------------- scripts/generate-locale-config.sh | 2 +- scripts/generate_command_hints_glue.sh | 2 +- scripts/integration-check-release-build.sh | 2 +- ...ntegration-create-environment-variables.sh | 2 +- scripts/integration-prepare-alpine.sh | 2 - scripts/integration-prepare-host.sh | 2 +- scripts/integration-server-conduit.sh | 2 +- scripts/integration-server-dendrite.sh | 2 +- scripts/integration-server-synapse.sh | 2 +- scripts/integration-start-avd.sh | 2 +- scripts/open-mr.sh | 37 ---- scripts/package-windows.ps1 | 2 +- scripts/prepare-android-release.sh | 4 +- scripts/prepare-fdroid.sh | 2 +- scripts/prepare-web.sh | 2 +- scripts/prepare-windows.ps1 | 2 +- scripts/release-ios-testflight.sh | 4 +- scripts/temp.49243.json | 0 48 files changed, 370 insertions(+), 661 deletions(-) delete mode 100644 android/app/build.gradle create mode 100644 android/app/build.gradle.kts delete mode 100644 android/app/src/main/kotlin/com/talktolearn/chat/UnifiedPushService.kt delete mode 100644 android/build.gradle create mode 100644 android/build.gradle.kts delete mode 100644 android/settings.gradle create mode 100644 android/settings.gradle.kts delete mode 100644 pangea_packages/fcm_shared_isolate/.gitlab-ci.yml create mode 100755 scripts/add-firebase-messaging.sh delete mode 100644 scripts/build-android-apk.sh delete mode 100644 scripts/build-android-debug.sh delete mode 100644 scripts/build-linux.sh delete mode 100755 scripts/build-web.sh delete mode 100644 scripts/code_analyze.sh delete mode 100644 scripts/download-web-stable.sh delete mode 100644 scripts/enable-android-google-services.patch delete mode 100644 scripts/integration-prepare-alpine.sh delete mode 100644 scripts/open-mr.sh delete mode 100644 scripts/temp.49243.json diff --git a/.github/workflows/check_duplicates.yaml b/.github/workflows/check_duplicates.yaml index 0f37d621c..ff88e8768 100644 --- a/.github/workflows/check_duplicates.yaml +++ b/.github/workflows/check_duplicates.yaml @@ -1,6 +1,9 @@ # #Pangea # name: Check duplicates +on: + + # on: # issues: # types: [opened] diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index dc4df96cf..40f746865 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -1,105 +1,101 @@ -# #Pangea -# name: Pull Request Workflow +name: Pull Request Workflow -# on: -# pull_request: -# merge_group: +on: + pull_request: + merge_group: -# jobs: -# code_tests: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - run: ./scripts/generate-locale-config.sh -# - run: git diff --exit-code -# - run: cat .github/workflows/versions.env >> $GITHUB_ENV -# - uses: subosito/flutter-action@v2 -# with: -# flutter-version: ${{ env.FLUTTER_VERSION }} -# cache: true -# - run: flutter pub get -# - run: flutter gen-l10n -# - name: Check formatting -# run: dart format lib/ test/ --set-exit-if-changed -# - name: Check import formatting -# run: dart run import_sorter:main --no-comments --exit-if-changed -# - name: Check license compliance -# run: dart run license_checker check-licenses -c licenses.yaml --problematic -# - run: flutter analyze -# - name: Apply google services patch -# run: git apply ./scripts/enable-android-google-services.patch -# - run: flutter analyze -# - run: flutter test +jobs: + code_tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: ./scripts/generate-locale-config.sh + - run: git diff --exit-code + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - run: flutter pub get + - run: flutter gen-l10n + - name: Check formatting + run: dart format lib/ test/ --set-exit-if-changed + - name: Check import formatting + run: dart run import_sorter:main --no-comments --exit-if-changed + - name: Check license compliance + run: dart run license_checker check-licenses -c licenses.yaml --problematic + - run: flutter analyze + - name: Add Firebase Messaging # Add android and analyze again + run: ./scripts/add-firebase-messaging.sh + - run: flutter analyze + - run: flutter test -# build_apk: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - run: cat .github/workflows/versions.env >> $GITHUB_ENV -# - uses: actions/setup-java@v4 -# with: -# java-version: ${{ env.JAVA_VERSION }} -# distribution: "zulu" -# - uses: subosito/flutter-action@v2 -# with: -# flutter-version: ${{ env.FLUTTER_VERSION }} -# cache: false -# - run: flutter pub get -# - name: Free Disk Space (Ubuntu) -# uses: jlumbroso/free-disk-space@main -# with: -# # this might remove tools that are actually needed, -# # if set to "true" but frees about 6 GB -# tool-cache: false -# android: false -# - run: flutter build apk --debug + build_debug_apk: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: actions/setup-java@v5 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: "zulu" + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - uses: moonrepo/setup-rust@v1 + - name: Add Firebase Messaging + run: ./scripts/add-firebase-messaging.sh + - run: flutter build apk --debug --target-platform android-arm # Pangea change, only build arm to decrease size & time -# build_web: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - run: cat .github/workflows/versions.env >> $GITHUB_ENV -# - uses: subosito/flutter-action@v2 -# with: -# flutter-version: ${{ env.FLUTTER_VERSION }} -# cache: false -# - run: flutter pub get -# - name: Prepare web -# run: ./scripts/prepare-web.sh -# - run: flutter build web + build_debug_web: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - uses: moonrepo/setup-rust@v1 + - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu + - run: flutter pub get + - name: Prepare web + run: ./scripts/prepare-web.sh + - run: flutter build web -# commented out because we do not build Pangea Chat to linux -# build_debug_linux: -# strategy: -# matrix: -# arch: [ x64, arm64 ] -# runs-on: ${{ matrix.arch == 'arm64' && 'self-hosted' || 'ubuntu-latest'}} -# steps: -# - uses: actions/checkout@v4 -# - run: cat .github/workflows/versions.env >> $GITHUB_ENV -# - name: Install dependencies -# run: sudo apt-get update && sudo apt-get install git wget curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 libssl-dev libwebkit2gtk-4.1-dev -y -# - name: Install Flutter -# run: | -# git clone --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git -# ./flutter/bin/flutter doctor -# - run: ./flutter/bin/flutter pub get -# - run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }} + build_debug_linux: + strategy: + matrix: + arch: [ arm64 ] # Pangea Disabled x64 + runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest'}} + steps: + - uses: actions/checkout@v5 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install git wget curl libcurl4-openssl-dev clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 libssl-dev libwebkit2gtk-4.1-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev -y + - name: Install Flutter + run: | + git clone --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git + ./flutter/bin/flutter doctor + - uses: moonrepo/setup-rust@v1 + - run: ./flutter/bin/flutter pub get + - run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }} -# build_debug_ios: -# runs-on: macos-15 -# steps: -# - uses: actions/checkout@v4 -# - run: cat .github/workflows/versions.env >> $GITHUB_ENV -# - uses: subosito/flutter-action@v2 -# with: -# flutter-version: ${{ env.FLUTTER_VERSION }} -# cache: true -# - name: Setup Xcode version -# uses: maxim-lobanov/setup-xcode@v1.6.0 -# with: -# xcode-version: latest -# - run: brew install sqlcipher -# - run: flutter pub get -# - run: flutter build ipa --no-codesign -# Pangea# + build_debug_ios: + runs-on: macos-15 + steps: + - uses: actions/checkout@v5 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - name: Use Xcode 16.4 + run: sudo xcode-select --switch /Applications/Xcode_16.4.app + - run: brew install sqlcipher + - uses: moonrepo/setup-rust@v1 + - name: Add Firebase Messaging + run: ./scripts/add-firebase-messaging.sh + - run: flutter pub get + - run: flutter build ios --no-codesign \ No newline at end of file diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index e9d809e60..5c2bbb70f 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -28,7 +28,6 @@ jobs: - uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} - distribution: 'zulu' - uses: subosito/flutter-action@v2 with: flutter-version: ${{ env.FLUTTER_VERSION }} @@ -40,6 +39,9 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: '3.3' + distribution: 'zulu' + - name: Add Firebase Messaging + run: ./scripts/add-firebase-messaging.sh - name: Update env files to selected environment run: | rm .env diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 71b93dfc7..5f17483fc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -60,11 +60,7 @@ jobs: echo "$WEB_APP_ENV" > .env echo "$WEB_APP_ENV" > assets/.env - name: Build Release Web - run: | - flutter config --enable-web - flutter clean - flutter pub get - flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps + run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/web/" - name: Create archive run: tar -czf pangeachat-web.tar.gz build/web/ - name: Upload Web Build @@ -104,6 +100,8 @@ jobs: with: flutter-version: ${{ env.FLUTTER_VERSION }} cache: true + - name: Add Firebase Messaging + run: ./scripts/add-firebase-messaging.sh - name: Set up Android SDK if: ${{ env.ACT }} # Only run on local act setups, as GitHub Actions provides the Android SDK on Ubuntu uses: android-actions/setup-android@v2 @@ -119,12 +117,11 @@ jobs: cp .env assets/.env - name: Apply .env patch run: git apply ./scripts/enable_mobile_env.patch - - name: Install Fastlane - run: gem install fastlane -NV - name: Remove Emoji Font run: | rm -rf fonts/NotoEmoji yq -i 'del( .flutter.fonts[] | select(.family == "NotoEmoji") )' pubspec.yaml + - uses: moonrepo/setup-rust@v1 - run: flutter pub get - name: Prepare Android Release Build env: @@ -145,38 +142,35 @@ jobs: asset_name: pangeachat.apk asset_content_type: application/vnd.android.package-archive - # #Pangea - # build_linux: - # strategy: - # matrix: - # arch: [ x64 ] - # runs-on: ubuntu-latest - # needs: create_release - # steps: - # - uses: actions/checkout@v4 - # - run: cat .github/workflows/versions.env >> $GITHUB_ENV - # - name: Install dependencies - # run: sudo apt-get update && sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 libssl-dev libwebkit2gtk-4.1-dev -y - # - name: Install dependencies for audio-player - # run: sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev - # - name: Install Flutter - # run: | - # git clone --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git - # ./flutter/bin/flutter doctor - # - run: ./flutter/bin/flutter pub get - # - run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }} - # - name: Create archive - # run: tar -czf pangeachat-linux-${{ matrix.arch }}.tar.gz -C build/linux/${{ matrix.arch }}/release/bundle/ . - # - name: Upload to release - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }} - # with: - # upload_url: ${{ needs.create_release.outputs.upload_url }} - # asset_path: pangeachat-linux-${{ matrix.arch }}.tar.gz - # asset_name: pangeachat-linux-${{ matrix.arch }}.tar.gz - # asset_content_type: application/gzip - # Pangea# + build_linux: + strategy: + matrix: + arch: [ x64 ] + runs-on: ubuntu-latest + needs: create_release + steps: + - uses: actions/checkout@v5 + - run: cat .github/workflows/versions.env >> $GITHUB_ENV + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 libssl-dev libwebkit2gtk-4.1-dev -y + - name: Install Flutter + run: | + git clone --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git + ./flutter/bin/flutter doctor + - uses: moonrepo/setup-rust@v1 + - run: ./flutter/bin/flutter pub get + - run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }} + - name: Create archive + run: tar -czf fluffychat-linux-${{ matrix.arch }}.tar.gz -C build/linux/${{ matrix.arch }}/release/bundle/ . + - name: Upload to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: pangeachat-linux-${{ matrix.arch }}.tar.gz + asset_name: pangeachat-linux-${{ matrix.arch }}.tar.gz + asset_content_type: application/gzip deploy_web: runs-on: ubuntu-latest diff --git a/.github/workflows/versions.env b/.github/workflows/versions.env index f0e244aae..4d5a9ba26 100644 --- a/.github/workflows/versions.env +++ b/.github/workflows/versions.env @@ -1,2 +1,2 @@ -FLUTTER_VERSION=3.32.4 +FLUTTER_VERSION=3.35.3 JAVA_VERSION=17 diff --git a/android/app/build.gradle b/android/app/build.gradle deleted file mode 100644 index ce52c7683..000000000 --- a/android/app/build.gradle +++ /dev/null @@ -1,115 +0,0 @@ -plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" - id "com.google.gms.google-services" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -def keystoreProperties = new Properties() -def keystorePropertiesFile = rootProject.file('key.properties') -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} - -android { - compileSdk = 35 - namespace = "com.talktolearn.chat" - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // #Pangea - // applicationId "chat.fluffy.fluffychat" - applicationId "com.talktolearn.chat" - // Pangea# - minSdkVersion 21 - targetSdkVersion 35 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - multiDexEnabled true - } - - signingConfigs { - release { - if (keystorePropertiesFile.exists()) { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - } - } - } - buildTypes { - debug { - signingConfig signingConfigs.debug - versionNameSuffix "-debug" - } - release { - minifyEnabled false - shrinkResources false - signingConfig signingConfigs.release - } - } - // https://stackoverflow.com/a/77494454/8222484 - packagingOptions { - pickFirst 'lib/x86/libc++_shared.so' - pickFirst 'lib/x86_64/libc++_shared.so' - pickFirst 'lib/armeabi-v7a/libc++_shared.so' - pickFirst 'lib/arm64-v8a/libc++_shared.so' - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - coreLibraryDesugaringEnabled true - } - - kotlinOptions { - jvmTarget = "17" - } -} - - -flutter { - source '../..' -} - -dependencies { - implementation platform('com.google.firebase:firebase-bom:32.8.0') - implementation 'com.google.firebase:firebase-analytics' - implementation 'com.google.firebase:firebase-database' - - implementation 'androidx.multidex:multidex:2.0.1' - coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4") -} - -// #Pangea -// configurations.all { -// exclude group: 'com.google.android.gms' -// } -// Pangea# \ No newline at end of file diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 000000000..5e699e0aa --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,104 @@ +import java.util.Properties +import java.io.FileInputStream + +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +// conditionally apply google-services (keeps your original intent) +if (file("google-services.json").exists()) { + apply(plugin = "com.google.gms.google-services") +} + +dependencies { + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4") // For flutter_local_notifications // Workaround for: https://github.com/MaikuB/flutter_local_notifications/issues/2286 + + implementation(platform("com.google.firebase:firebase-bom:32.8.0")) + implementation("com.google.firebase:firebase-analytics") + implementation("com.google.firebase:firebase-database") + + implementation("androidx.multidex:multidex:2.0.1") +} + +// Workaround for https://pub.dev/packages/unifiedpush#the-build-fails-because-of-duplicate-classes +configurations.all { + // Use the latest version published: https://central.sonatype.com/artifact/com.google.crypto.tink/tink-android + val tink = "com.google.crypto.tink:tink-android:1.17.0" + // You can also use the library declaration catalog + // val tink = libs.google.tink + resolutionStrategy { + force(tink) + dependencySubstitution { + substitute(module("com.google.crypto.tink:tink")).using(module(tink)) + } + } +} + +android { + namespace = "com.talktolearn.chat" + compileSdk = 35 + // compileSdk = flutter.compileSdkVersion + // ndkVersion = "27.0.12077973" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + isCoreLibraryDesugaringEnabled = true + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + signingConfigs { + create("release") { + keyAlias = "dummyAlias" + keyPassword = "dummyPassword" + storeFile = file("dummy.keystore") + storePassword = "dummyStorePassword" + } + } + + val keystoreProperties = Properties() + val keystorePropertiesFile = rootProject.file("key.properties") + if (keystorePropertiesFile.exists()) { + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) + signingConfigs.getByName("release").apply { + keyAlias = keystoreProperties["keyAlias"] as String + keyPassword = keystoreProperties["keyPassword"] as String + storeFile = keystoreProperties["storeFile"]?.let { file(it) } + storePassword = keystoreProperties["storePassword"] as String + } + } + + defaultConfig { + applicationId = "com.talktolearn.chat" + minSdk = 21 + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + debug { + signingConfig = signingConfigs.getByName("debug") + versionNameSuffix = "-debug" + isMinifyEnabled = false + isShrinkResources = false + } + release { + isMinifyEnabled = false + isShrinkResources = false + // use the release signing config we created above (will be used only if key properties exist) + signingConfig = signingConfigs.getByName("release") + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + } +} + +flutter { + source = "../.." +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/talktolearn/chat/FcmPushService.kt b/android/app/src/main/kotlin/com/talktolearn/chat/FcmPushService.kt index ad301c9f0..8d8321510 100644 --- a/android/app/src/main/kotlin/com/talktolearn/chat/FcmPushService.kt +++ b/android/app/src/main/kotlin/com/talktolearn/chat/FcmPushService.kt @@ -2,17 +2,9 @@ import com.famedly.fcm_shared_isolate.FcmSharedIsolateService -import com.talktolearn.chat.MainActivity - -import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.engine.FlutterEngine -import io.flutter.view.FlutterMain import io.flutter.embedding.engine.dart.DartExecutor.DartEntrypoint - import android.content.Context -import android.os.Bundle -import android.util.Log -import android.view.WindowManager class FcmPushService : FcmSharedIsolateService() { override fun getEngine(): FlutterEngine { diff --git a/android/app/src/main/kotlin/com/talktolearn/chat/MainActivity.kt b/android/app/src/main/kotlin/com/talktolearn/chat/MainActivity.kt index 77d3c6e32..88970e6fe 100644 --- a/android/app/src/main/kotlin/com/talktolearn/chat/MainActivity.kt +++ b/android/app/src/main/kotlin/com/talktolearn/chat/MainActivity.kt @@ -4,13 +4,11 @@ import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.engine.FlutterEngine import android.content.Context -import androidx.multidex.MultiDex class MainActivity : FlutterActivity() { override fun attachBaseContext(base: Context) { super.attachBaseContext(base) - MultiDex.install(this) } @@ -30,4 +28,4 @@ class MainActivity : FlutterActivity() { return eng } } -} +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/talktolearn/chat/UnifiedPushService.kt b/android/app/src/main/kotlin/com/talktolearn/chat/UnifiedPushService.kt deleted file mode 100644 index 3c1696e65..000000000 --- a/android/app/src/main/kotlin/com/talktolearn/chat/UnifiedPushService.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.talktolearn.chat - -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.embedding.engine.dart.DartExecutor -import org.unifiedpush.flutter.connector.UnifiedPushReceiver - -import android.content.Context - -class UnifiedPushReceiver : UnifiedPushReceiver() { - override fun getEngine(context: Context): FlutterEngine { - var engine = MainActivity.engine - if (engine == null) { - engine = MainActivity.provideEngine(context) - engine.localizationPlugin.sendLocalesToFlutter( - context.resources.configuration - ) - engine.dartExecutor.executeDartEntrypoint( - DartExecutor.DartEntrypoint.createDefault() - ) - } - return engine - } -} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 25753ab39..000000000 --- a/android/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' - -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" - project.evaluationDependsOn(":app") -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.google.gms:google-services:4.4.1' - } -} \ No newline at end of file diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 000000000..f0f9ebc77 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,31 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.google.gms:google-services:4.4.1") + } +} \ No newline at end of file diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index 7f011b163..000000000 --- a/android/settings.gradle +++ /dev/null @@ -1,38 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -buildscript { - repositories { - mavenCentral() - maven { - url = uri("https://storage.googleapis.com/r8-releases/raw") - } - } - dependencies { - classpath("com.android.tools:r8:8.2.24") - } -} - -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.7.3" apply false - id "org.jetbrains.kotlin.android" version "2.1.10" apply false - id "com.google.gms.google-services" version "4.3.8" apply false -} - -include ":app" \ No newline at end of file diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 000000000..699da6575 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,40 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +buildscript { + repositories { + mavenCentral() + maven { + url = uri("https://storage.googleapis.com/r8-releases/raw") + } + } + dependencies { + classpath("com.android.tools:r8:8.2.24") + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.3" apply false + id("org.jetbrains.kotlin.android") version "2.1.10" apply false + if (file("app/google-services.json").exists()) { + id("com.google.gms.google-services") version "4.3.8" apply false + } +} + +include(":app") \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index c9ab5ce21..8fe1712c5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -30,8 +30,6 @@ void main() async { } catch (e) { Logs().e('Failed to load .env file', e); } - // await dotenv.load(fileName: ".env"); - // await dotenv.load(fileName: Environment.fileName); await Future.wait([ ErrorHandler.initialize(), diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index d75622eb4..b0d1da8c5 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -25,7 +25,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:collection/collection.dart'; -import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_new_badger/flutter_new_badger.dart'; @@ -44,7 +43,7 @@ import '../config/setting_keys.dart'; import '../widgets/matrix.dart'; import 'platform_infos.dart'; -//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; +//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; class NoTokenException implements Exception { String get cause => 'Cannot get firebase token'; @@ -69,11 +68,7 @@ class BackgroundPush { final pendingTests = >{}; - // final dynamic firebase = null; //FcmSharedIsolate(); - // #Pangea - // uncommented to enable notifications on IOS - final FcmSharedIsolate? firebase = FcmSharedIsolate(); - // Pangea# + //final firebase = FcmSharedIsolate(); DateTime? lastReceivedPush; @@ -106,20 +101,24 @@ class BackgroundPush { // Pangea# Logs().v('Flutter Local Notifications initialized'); - firebase?.setListeners( - onMessage: (message) => pushHelper( - PushNotification.fromJson( - Map.from(message['data'] ?? message), - ), - client: client, - l10n: l10n, - activeRoomId: matrix?.activeRoomId, - flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin, - ), - // #Pangea - onNewToken: _newFcmToken, - // Pangea# - ); + //firebase.setListeners( + // onMessage: (message) => pushHelper( + // PushNotification.fromJson( + // Map.from(message['data'] ?? message), + // ), + // client: client, + // l10n: l10n, + // activeRoomId: matrix?.activeRoomId, + // flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin, + // ), + // // #Pangea + // onNewToken: (token) { + // _fcmToken = token; + // debugPrint('Fcm token $_fcmToken'); + // setupPush(); + // }, + // // Pangea# + //); if (Platform.isAndroid) { await UnifiedPush.initialize( @@ -224,13 +223,6 @@ class BackgroundPush { StreamSubscription? onLogin; - void _newFcmToken(String token) { - _fcmToken = token; - debugPrint('Fcm foken $_fcmToken'); - setupPush(); - } - // Pangea# - Future cancelNotification(String roomId) async { Logs().v('Cancel notification for room', roomId); await _flutterLocalNotificationsPlugin.cancel(roomId.hashCode); @@ -267,7 +259,7 @@ class BackgroundPush { try { // Pangea# if (PlatformInfos.isIOS) { - await firebase?.requestPermission(); + //await firebase?.requestPermission(); } if (PlatformInfos.isAndroid) { _flutterLocalNotificationsPlugin @@ -454,10 +446,7 @@ class BackgroundPush { Logs().v('Setup firebase'); if (_fcmToken?.isEmpty ?? true) { try { - // #Pangea - // _fcmToken = await firebase?.getToken(); - _fcmToken = await _getToken(); - // Pangea# + //_fcmToken = await firebase.getToken(); if (_fcmToken == null) throw ('PushToken is null'); } catch (e, s) { Logs().w('[Push] cannot get token', e, e is String ? null : s); @@ -542,11 +531,8 @@ class BackgroundPush { Logs().i('[Push] UnifiedPush using endpoint $endpoint'); final oldTokens = {}; try { - // #Pangea - // final fcmToken = await firebase?.getToken(); - final fcmToken = await _getToken(); - // Pangea# - oldTokens.add(fcmToken); + //final fcmToken = await firebase.getToken(); + //oldTokens.add(fcmToken); } catch (_) {} await setupPusher( gatewayUrl: endpoint, @@ -588,15 +574,6 @@ class BackgroundPush { flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin, ); } - - // #Pangea - Future _getToken() async { - if (Platform.isAndroid) { - return (await FirebaseMessaging.instance.getToken()); - } - return await firebase?.getToken(); - } - // Pangea# } class UPFunctions extends UnifiedPushFunctions { diff --git a/pangea_packages/fcm_shared_isolate/.gitlab-ci.yml b/pangea_packages/fcm_shared_isolate/.gitlab-ci.yml deleted file mode 100644 index 615c3cab9..000000000 --- a/pangea_packages/fcm_shared_isolate/.gitlab-ci.yml +++ /dev/null @@ -1,13 +0,0 @@ -image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter/stable - -stages: - - test - -code_analyze: - tags: - - docker - stage: test - script: - - flutter pub get - - flutter format --set-exit-if-changed lib/ test/ - - flutter analyze diff --git a/pubspec.yaml b/pubspec.yaml index cbce229f6..8a0ae94f5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,7 +32,6 @@ dependencies: dynamic_color: ^1.7.0 emoji_picker_flutter: ^3.1.0 emojis: ^0.9.9 - #fcm_shared_isolate: ^0.2.0 file_picker: ^8.1.2 file_selector: ^1.0.3 flutter: @@ -121,8 +120,6 @@ dependencies: firebase_core: ^3.1.0 firebase_messaging: ^15.1.5 flutter_dotenv: ^5.1.0 - fcm_shared_isolate: - path: pangea_packages/fcm_shared_isolate flutter_svg: ^2.0.10+1 get_storage: ^2.1.1 in_app_purchase: ^3.2.1 @@ -193,6 +190,8 @@ msix_config: install_certificate: false dependency_overrides: + fcm_shared_isolate: + path: pangea_packages/fcm_shared_isolate # https://github.com/juliansteenbakker/flutter_secure_storage/issues/920 flutter_secure_storage_linux: git: diff --git a/scripts/add-firebase-messaging.sh b/scripts/add-firebase-messaging.sh new file mode 100755 index 000000000..38f17b20f --- /dev/null +++ b/scripts/add-firebase-messaging.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +flutter pub add fcm_shared_isolate +flutter pub get + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's,//,,g' lib/utils/background_push.dart + sed -i '' -e 's,^/\*,,' -e 's,\*/$,,' android/app/src/main/kotlin/com/talktolearn/chat/FcmPushService.kt +else + sed -i 's,//,,g' lib/utils/background_push.dart + sed -i -e 's,^/\*,,' -e 's,\*/$,,' android/app/src/main/kotlin/com/talktolearn/chat/FcmPushService.kt +fi \ No newline at end of file diff --git a/scripts/build-android-apk.sh b/scripts/build-android-apk.sh deleted file mode 100644 index 4b1b641be..000000000 --- a/scripts/build-android-apk.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -flutter pub get -flutter build apk --release -mkdir -p build/android -cp build/app/outputs/apk/release/app-release.apk build/android/ diff --git a/scripts/build-android-debug.sh b/scripts/build-android-debug.sh deleted file mode 100644 index 5c2744a4c..000000000 --- a/scripts/build-android-debug.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -flutter build apk --debug diff --git a/scripts/build-ios.sh b/scripts/build-ios.sh index 7fd791b5e..109b1cfeb 100644 --- a/scripts/build-ios.sh +++ b/scripts/build-ios.sh @@ -75,4 +75,4 @@ flutter build ipa --release # 2. ...and install it on your connected devices cfgutil --foreach install-app "${TMPDIR}/fluffychat.ipa" rm -rf "${TMPDIR}" -} +} \ No newline at end of file diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh deleted file mode 100644 index e1df0e603..000000000 --- a/scripts/build-linux.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -ve -flutter config --enable-linux-desktop -flutter clean -flutter pub get -flutter build linux --release -v diff --git a/scripts/build-macos.sh b/scripts/build-macos.sh index f25711e13..8aab1c87f 100644 --- a/scripts/build-macos.sh +++ b/scripts/build-macos.sh @@ -30,4 +30,4 @@ FLUFFYCHAT_ORIG_TEAM="4NXF6Z997G" ### Make release build ### flutter build macos --release -echo "Build build/macos/Build/Products/Release/FluffyChat.app" +echo "Build build/macos/Build/Products/Release/FluffyChat.app" \ No newline at end of file diff --git a/scripts/build-web.sh b/scripts/build-web.sh deleted file mode 100755 index 5746a6f90..000000000 --- a/scripts/build-web.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -ve -flutter config --enable-web -flutter clean -flutter pub get -flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --profile --source-maps \ No newline at end of file diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1 index 0c02f80cb..e359995cc 100644 --- a/scripts/build-windows.ps1 +++ b/scripts/build-windows.ps1 @@ -3,5 +3,4 @@ flutter config --enable-windows-desktop flutter clean flutter pub get -flutter build windows --release -v - +flutter build windows --release -v \ No newline at end of file diff --git a/scripts/code_analyze.sh b/scripts/code_analyze.sh deleted file mode 100644 index c0249a7c5..000000000 --- a/scripts/code_analyze.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -ve -flutter pub get -flutter pub run import_sorter:main --no-comments --exit-if-changed -flutter format lib/ test/ --set-exit-if-changed -git apply ./scripts/enable-android-google-services.patch -flutter pub get -flutter analyze -flutter pub run dart_code_metrics:metrics lib -r gitlab > code-quality-report.json || true \ No newline at end of file diff --git a/scripts/create_fdroid_repos.sh b/scripts/create_fdroid_repos.sh index 595e1cfae..b1fa00989 100644 --- a/scripts/create_fdroid_repos.sh +++ b/scripts/create_fdroid_repos.sh @@ -64,4 +64,4 @@ done fdroid update --rename-apks mkdir /fdroid && fdroid deploy rm -rf /fdroid/archive -cd .. && mv -v /fdroid repo/stable +cd .. && mv -v /fdroid repo/stable \ No newline at end of file diff --git a/scripts/download-web-stable.sh b/scripts/download-web-stable.sh deleted file mode 100644 index 8467d1bf0..000000000 --- a/scripts/download-web-stable.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -GITLAB_PROJECT_ID="16112282" - -PIPELINE="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines\?scope=tags\&status=success\&order_by=updated_at | jq '.[].id' | head -n1)" -JOB="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/${PIPELINE}/jobs | jq -r '.[] | select(.name == "build_web").id')" - -wget --output-document web.zip https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/jobs/${JOB}/artifacts - -unzip web.zip - -mv build/web stable diff --git a/scripts/enable-android-google-services.patch b/scripts/enable-android-google-services.patch deleted file mode 100644 index 14101ede0..000000000 --- a/scripts/enable-android-google-services.patch +++ /dev/null @@ -1,144 +0,0 @@ -diff --git a/android/app/build.gradle b/android/app/build.gradle -index bb8e015cd..3ff4a7579 100644 ---- a/android/app/build.gradle -+++ b/android/app/build.gradle -@@ -2,7 +2,7 @@ plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -- //id "com.google.gms.google-services" -+ id "com.google.gms.google-services" - } - - def localProperties = new Properties() -@@ -97,11 +97,12 @@ flutter { - } - - dependencies { -- //implementation 'com.google.firebase:firebase-messaging:19.0.1' // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 -+ implementation 'com.google.firebase:firebase-messaging:19.0.1' -+ // Workaround for https://github.com/microg/android_packages_apps_GmsCore/issues/313#issuecomment-617651698 - implementation 'androidx.multidex:multidex:2.0.1' - coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4") - } - - configurations.all { -- exclude group: 'com.google.android.gms' -+ //exclude group: 'com.google.android.gms' - } -\ No newline at end of file -diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro -index d0e0fbc9..0a546da0 100644 ---- a/android/app/proguard-rules.pro -+++ b/android/app/proguard-rules.pro -@@ -1 +1,42 @@ ---keep class net.sqlcipher.** { *; } -\ No newline at end of file -+-optimizationpasses 5 -+## Flutter wrapper -+-keep class net.sqlcipher.** { *; } -+-keep class io.flutter.app.** { *; } -+-keep class io.flutter.plugin.** { *; } -+-keep class io.flutter.util.** { *; } -+-keep class io.flutter.view.** { *; } -+-keep class io.flutter.** { *; } -+-keep class io.flutter.plugins.** { *; } -+-dontwarn io.flutter.embedding.** -+ -+##---------------Begin: proguard configuration for Gson (Needed for flutter_local_notifications) ---------- -+# Gson uses generic type information stored in a class file when working with fields. Proguard -+# removes such information by default, so configure it to keep all of it. -+-keepattributes Signature -+ -+# For using GSON @Expose annotation -+-keepattributes *Annotation* -+ -+# Gson specific classes -+-dontwarn sun.misc.** -+ -+# Application classes that will be serialized/deserialized over Gson -+-keep class com.google.gson.examples.android.model.** { ; } -+ -+# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, -+# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) -+-keep class * extends com.google.gson.TypeAdapter -+-keep class * implements com.google.gson.TypeAdapterFactory -+-keep class * implements com.google.gson.JsonSerializer -+-keep class * implements com.google.gson.JsonDeserializer -+ -+# Prevent R8 from leaving Data object members always null -+-keepclassmembers,allowobfuscation class * { -+ @com.google.gson.annotations.SerializedName ; -+} -+ -+# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. -+-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken -+-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken -+ -+##---------------End: proguard configuration for Gson (Needed for flutter_local_notifications) ---------- -\ No newline at end of file -diff --git a/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt b/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt -index d9930f55..510e9845 100644 ---- a/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt -+++ b/android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt -@@ -1,4 +1,4 @@ --/*package chat.fluffy.fluffychat -+package chat.fluffy.fluffychat - - import com.famedly.fcm_shared_isolate.FcmSharedIsolateService - -@@ -33,4 +33,3 @@ class FcmPushService : FcmSharedIsolateService() { - } - } - } --*/ -\ No newline at end of file -diff --git a/android/settings.gradle b/android/settings.gradle -index b2fd960a..fdb01a4d 100644 ---- a/android/settings.gradle -+++ b/android/settings.gradle -@@ -20,7 +20,7 @@ plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.7.3" apply false - id "org.jetbrains.kotlin.android" version "2.1.10" apply false -- // id "com.google.gms.google-services" version "4.3.8" apply false -+ id "com.google.gms.google-services" version "4.3.8" apply false - } - - include ":app" -\ No newline at end of file -diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart -index 1ba2659a..989f458e 100644 ---- a/lib/utils/background_push.dart -+++ b/lib/utils/background_push.dart -@@ -39,7 +39,7 @@ import '../config/setting_keys.dart'; - import '../widgets/matrix.dart'; - import 'platform_infos.dart'; - --//import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; -+import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; - - class NoTokenException implements Exception { - String get cause => 'Cannot get firebase token'; -@@ -64,7 +64,7 @@ class BackgroundPush { - - final pendingTests = >{}; - -- final dynamic firebase = null; //FcmSharedIsolate(); -+ final dynamic firebase = FcmSharedIsolate(); - - DateTime? lastReceivedPush; - -diff --git a/pubspec.yaml b/pubspec.yaml -index fb3e3ca4..039b2ccc 100644 ---- a/pubspec.yaml -+++ b/pubspec.yaml -@@ -25,7 +25,7 @@ dependencies: - dynamic_color: ^1.7.0 - emoji_picker_flutter: ^3.1.0 - emojis: ^0.9.9 -- #fcm_shared_isolate: ^0.2.0 -+ fcm_shared_isolate: ^0.2.0 - file_picker: ^8.1.2 - file_selector: ^1.0.3 - flutter: diff --git a/scripts/generate-locale-config.sh b/scripts/generate-locale-config.sh index b697850be..7fd281071 100755 --- a/scripts/generate-locale-config.sh +++ b/scripts/generate-locale-config.sh @@ -28,4 +28,4 @@ done # XML Footer echo '' >> "$xml_file" -echo "locale_config.xml file has been successfully created in the $xml_dir directory." +echo "locale_config.xml file has been successfully created in the $xml_dir directory." \ No newline at end of file diff --git a/scripts/generate_command_hints_glue.sh b/scripts/generate_command_hints_glue.sh index 530f5487e..bdcc443d1 100644 --- a/scripts/generate_command_hints_glue.sh +++ b/scripts/generate_command_hints_glue.sh @@ -27,4 +27,4 @@ $(sed -n \ return \"\"; } }\ -" > lib/pages/chat/command_hints.dart +" > lib/pages/chat/command_hints.dart \ No newline at end of file diff --git a/scripts/integration-check-release-build.sh b/scripts/integration-check-release-build.sh index 5e329189f..cd1ac1674 100644 --- a/scripts/integration-check-release-build.sh +++ b/scripts/integration-check-release-build.sh @@ -23,4 +23,4 @@ adb shell am start -n chat.fluffy.fluffychat/chat.fluffy.fluffychat.MainActivity sleep 5 # check whether FluffyChat runs -adb shell ps | awk '{print $9}' | grep chat.fluffy.fluffychat +adb shell ps | awk '{print $9}' | grep chat.fluffy.fluffychat \ No newline at end of file diff --git a/scripts/integration-create-environment-variables.sh b/scripts/integration-create-environment-variables.sh index d2b3a8fe1..eaa01a846 100644 --- a/scripts/integration-create-environment-variables.sh +++ b/scripts/integration-create-environment-variables.sh @@ -3,4 +3,4 @@ export USER1_NAME="alice" export USER1_PW="AliceInWonderland" export USER2_NAME="bob" -export USER2_PW="JoWirSchaffenDas" +export USER2_PW="JoWirSchaffenDas" \ No newline at end of file diff --git a/scripts/integration-prepare-alpine.sh b/scripts/integration-prepare-alpine.sh deleted file mode 100644 index f4a57b6d5..000000000 --- a/scripts/integration-prepare-alpine.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -apk update && apk add docker drill grep \ No newline at end of file diff --git a/scripts/integration-prepare-host.sh b/scripts/integration-prepare-host.sh index f110aab72..b9fbbd9aa 100644 --- a/scripts/integration-prepare-host.sh +++ b/scripts/integration-prepare-host.sh @@ -3,4 +3,4 @@ if ! command -v apk &>/dev/null; then apt update && apt install -y -qq docker.io ldnsutils grep scrcpy ffmpeg else apk update && apk add docker drill grep scrcpy ffmpeg -fi +fi \ No newline at end of file diff --git a/scripts/integration-server-conduit.sh b/scripts/integration-server-conduit.sh index f4b031f56..a6a4b6cf6 100644 --- a/scripts/integration-server-conduit.sh +++ b/scripts/integration-server-conduit.sh @@ -9,4 +9,4 @@ docker run -d \ -e CONDUIT_TRUSTED_SERVERS="[\"conduit.rs\"]" \ -e CONDUIT_MAX_CONCURRENT_REQUESTS="100" \ -e CONDUIT_LOG="info,rocket=off,_=off,sled=off" \ - --name conduit -p 80:8008 matrixconduit/matrix-conduit:latest + --name conduit -p 80:8008 matrixconduit/matrix-conduit:latest \ No newline at end of file diff --git a/scripts/integration-server-dendrite.sh b/scripts/integration-server-dendrite.sh index ee23da191..666290114 100644 --- a/scripts/integration-server-dendrite.sh +++ b/scripts/integration-server-dendrite.sh @@ -11,4 +11,4 @@ docker run --rm --entrypoint="" \ -tls-key /mnt/server.key docker run -d --volume="$(pwd)/integration_test/dendrite/data":/etc/dendrite:rw \ - --name dendrite -p 80:8008 matrixdotorg/dendrite-monolith:latest -really-enable-open-registration + --name dendrite -p 80:8008 matrixdotorg/dendrite-monolith:latest -really-enable-open-registration \ No newline at end of file diff --git a/scripts/integration-server-synapse.sh b/scripts/integration-server-synapse.sh index 03d21847a..a992c8e56 100644 --- a/scripts/integration-server-synapse.sh +++ b/scripts/integration-server-synapse.sh @@ -2,4 +2,4 @@ docker run -d --name synapse --tmpfs /data \ --volume="$(pwd)/integration_test/synapse/data/homeserver.yaml":/data/homeserver.yaml:rw \ --volume="$(pwd)/integration_test/synapse/data/localhost.log.config":/data/localhost.log.config:rw \ - -p 80:80 matrixdotorg/synapse:latest + -p 80:80 matrixdotorg/synapse:latest \ No newline at end of file diff --git a/scripts/integration-start-avd.sh b/scripts/integration-start-avd.sh index fb608e440..a35a47a5e 100644 --- a/scripts/integration-start-avd.sh +++ b/scripts/integration-start-avd.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash chmod 777 -R /dev/kvm adb start-server -emulator -avd test -wipe-data -no-audio -no-boot-anim -no-window -accel on -gpu swiftshader_indirect +emulator -avd test -wipe-data -no-audio -no-boot-anim -no-window -accel on -gpu swiftshader_indirect \ No newline at end of file diff --git a/scripts/open-mr.sh b/scripts/open-mr.sh deleted file mode 100644 index 4af2c7128..000000000 --- a/scripts/open-mr.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -ve - -# source: https://about.gitlab.com/blog/2017/09/05/how-to-automatically-create-a-new-mr-on-gitlab-with-gitlab-ci/ - -# Extract the host where the server is running, and add the URL to the APIs -[[ $HOST =~ ^https?://[^/]+ ]] && HOST="${BASH_REMATCH[0]}/api/v4/projects/" - -# Look which is the default branch -TARGET_BRANCH=`curl --silent "${HOST}${CI_PROJECT_ID}" --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}" | python3 -c "import sys, json; print(json.load(sys.stdin)['default_branch'])"`; - -# The description of our new MR, we want to remove the branch after the MR has -# been closed -BODY="{ - \"id\": ${CI_PROJECT_ID}, - \"source_branch\": \"${UPDATE_BRANCH}\", - \"target_branch\": \"${TARGET_BRANCH}\", - \"remove_source_branch\": true, - \"title\": \"chore: automated dependency update\" -}"; - -# Require a list of all the merge request and take a look if there is already -# one with the same source branch -LISTMR=`curl --silent "${HOST}${CI_PROJECT_ID}/merge_requests?state=opened" --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}"`; -COUNTBRANCHES=`echo ${LISTMR} | grep -o "\"source_branch\":\"${UPDATE_BRANCH}\"" | wc -l`; - -# No MR found, let's create a new one -if [ ${COUNTBRANCHES} -eq "0" ]; then - curl -X POST "${HOST}${CI_PROJECT_ID}/merge_requests" \ - --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}" \ - --header "Content-Type: application/json" \ - --data "${BODY}"; - - echo "Opened a new dependency update MR." - exit; -fi - -echo "No new merge request opened."; diff --git a/scripts/package-windows.ps1 b/scripts/package-windows.ps1 index b3ba0e70a..7fe516a97 100644 --- a/scripts/package-windows.ps1 +++ b/scripts/package-windows.ps1 @@ -2,4 +2,4 @@ Write-Output "$WINDOWN_PFX" Move-Item -Path $WINDOWS_PFX -Destination fluffychat.pem certutil -decode fluffychat.pem fluffychat.pfx -flutter pub run msix:create -c fluffychat.pfx -p $WINDOWS_PFX_PASS --sign-msix true --install-certificate false +flutter pub run msix:create -c fluffychat.pfx -p $WINDOWS_PFX_PASS --sign-msix true --install-certificate false \ No newline at end of file diff --git a/scripts/prepare-android-release.sh b/scripts/prepare-android-release.sh index 3ef7a7b6a..e087a6e98 100755 --- a/scripts/prepare-android-release.sh +++ b/scripts/prepare-android-release.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash cd android -echo $PLAY_STORE_UPLOAD_KEY | base64 --decode > key.jks +echo $PLAY_STORE_UPLOAD_KEY | base64 --decode --ignore-garbage > key.jks echo "storePassword=${PLAY_STORE_KEYSTORE_STORE_PASSWORD}" >> key.properties echo "keyPassword=${PLAY_STORE_KEYSTORE_KEY_PASSWORD}" >> key.properties echo "keyAlias=${PLAY_STORE_KEYSTORE_KEY_ALIAS}" >> key.properties echo "storeFile=../key.jks" >> key.properties -echo $PLAY_STORE_CONFIG_JSON | base64 --decode > keys.json +echo $PLAY_STORE_CONFIG_JSON | base64 --decode --ignore-garbage > keys.json ls | grep key bundle install bundle update fastlane diff --git a/scripts/prepare-fdroid.sh b/scripts/prepare-fdroid.sh index f9384b0f0..1ae174241 100644 --- a/scripts/prepare-fdroid.sh +++ b/scripts/prepare-fdroid.sh @@ -9,4 +9,4 @@ echo "keystorepass=\"${FDROID_KEY_PASS}\"" >> config.stable.py echo "keypass=\"${FDROID_NIGHTLY_KEY_PASS}\"" >> config.nightly.py echo "keystorepass=\"${FDROID_NIGHTLY_KEY_PASS}\"" >> config.nightly.py chmod 600 config.stable.py key.jks config.nightly.py key.nightly.jks -cd .. +cd .. \ No newline at end of file diff --git a/scripts/prepare-web.sh b/scripts/prepare-web.sh index 875ae0a46..bc47f0237 100755 --- a/scripts/prepare-web.sh +++ b/scripts/prepare-web.sh @@ -7,4 +7,4 @@ flutter_rust_bridge_codegen build-web --dart-root dart --rust-root $(readlink -f cd .. rm -f ./assets/vodozemac/vodozemac_bindings_dart* mv .vodozemac/dart/web/pkg/vodozemac_bindings_dart* ./assets/vodozemac/ -rm -rf .vodozemac +rm -rf .vodozemac \ No newline at end of file diff --git a/scripts/prepare-windows.ps1 b/scripts/prepare-windows.ps1 index 97451b44f..72be4f360 100644 --- a/scripts/prepare-windows.ps1 +++ b/scripts/prepare-windows.ps1 @@ -2,4 +2,4 @@ choco install flutter cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" refreshenv -flutter config --no-analytics +flutter config --no-analytics \ No newline at end of file diff --git a/scripts/release-ios-testflight.sh b/scripts/release-ios-testflight.sh index f3ca8b4fb..14e6ea08d 100644 --- a/scripts/release-ios-testflight.sh +++ b/scripts/release-ios-testflight.sh @@ -1,6 +1,6 @@ #!/bin/sh -ve -git apply ./scripts/enable-android-google-services.patch -yq eval '.dependencies.fcm_shared_isolate = "0.1.0"' -i pubspec.yaml # Workaround: 0.2.0 does not work on iOS +flutter pub add fcm_shared_isolate:0.1.0 +sed -i '' 's,//,,g' lib/utils/background_push.dart flutter clean flutter pub get cd ios diff --git a/scripts/temp.49243.json b/scripts/temp.49243.json deleted file mode 100644 index e69de29bb..000000000