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 <ggurdin@gmail.com>
pull/2245/head
Brord van Wierst 1 month ago committed by GitHub
parent c6816aea03
commit 57520bf512
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +1,9 @@
# #Pangea
# name: Check duplicates
on:
# on:
# issues:
# types: [opened]

@ -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

@ -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

@ -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

@ -1,2 +1,2 @@
FLUTTER_VERSION=3.32.4
FLUTTER_VERSION=3.35.3
JAVA_VERSION=17

@ -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#

@ -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 = "../.."
}

@ -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 {

@ -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
}
}
}
}

@ -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
}
}

@ -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'
}
}

@ -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<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.google.gms:google-services:4.4.1")
}
}

@ -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"

@ -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")

@ -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(),

@ -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';
//<GOOGLE_SERVICES>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 = <String, Completer<void>>{};
// final dynamic firebase = null; //FcmSharedIsolate();
// #Pangea
// uncommented to enable notifications on IOS
final FcmSharedIsolate? firebase = FcmSharedIsolate();
// Pangea#
//<GOOGLE_SERVICES>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<String, dynamic>.from(message['data'] ?? message),
),
client: client,
l10n: l10n,
activeRoomId: matrix?.activeRoomId,
flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin,
),
// #Pangea
onNewToken: _newFcmToken,
// Pangea#
);
//<GOOGLE_SERVICES>firebase.setListeners(
//<GOOGLE_SERVICES> onMessage: (message) => pushHelper(
//<GOOGLE_SERVICES> PushNotification.fromJson(
//<GOOGLE_SERVICES> Map<String, dynamic>.from(message['data'] ?? message),
//<GOOGLE_SERVICES> ),
//<GOOGLE_SERVICES> client: client,
//<GOOGLE_SERVICES> l10n: l10n,
//<GOOGLE_SERVICES> activeRoomId: matrix?.activeRoomId,
//<GOOGLE_SERVICES> flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin,
//<GOOGLE_SERVICES> ),
//<GOOGLE_SERVICES> // #Pangea
//<GOOGLE_SERVICES> onNewToken: (token) {
//<GOOGLE_SERVICES> _fcmToken = token;
//<GOOGLE_SERVICES> debugPrint('Fcm token $_fcmToken');
//<GOOGLE_SERVICES> setupPush();
//<GOOGLE_SERVICES> },
//<GOOGLE_SERVICES> // Pangea#
//<GOOGLE_SERVICES>);
if (Platform.isAndroid) {
await UnifiedPush.initialize(
@ -224,13 +223,6 @@ class BackgroundPush {
StreamSubscription<LoginState>? onLogin;
void _newFcmToken(String token) {
_fcmToken = token;
debugPrint('Fcm foken $_fcmToken');
setupPush();
}
// Pangea#
Future<void> 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();
//<GOOGLE_SERVICES>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#
//<GOOGLE_SERVICES>_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 = <String?>{};
try {
// #Pangea
// final fcmToken = await firebase?.getToken();
final fcmToken = await _getToken();
// Pangea#
oldTokens.add(fcmToken);
//<GOOGLE_SERVICES>final fcmToken = await firebase.getToken();
//<GOOGLE_SERVICES>oldTokens.add(fcmToken);
} catch (_) {}
await setupPusher(
gatewayUrl: endpoint,
@ -588,15 +574,6 @@ class BackgroundPush {
flutterLocalNotificationsPlugin: _flutterLocalNotificationsPlugin,
);
}
// #Pangea
Future<String?> _getToken() async {
if (Platform.isAndroid) {
return (await FirebaseMessaging.instance.getToken());
}
return await firebase?.getToken();
}
// Pangea#
}
class UPFunctions extends UnifiedPushFunctions {

@ -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

@ -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:

@ -0,0 +1,12 @@
#!/usr/bin/env bash
flutter pub add fcm_shared_isolate
flutter pub get
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's,//<GOOGLE_SERVICES>,,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,//<GOOGLE_SERVICES>,,g' lib/utils/background_push.dart
sed -i -e 's,^/\*,,' -e 's,\*/$,,' android/app/src/main/kotlin/com/talktolearn/chat/FcmPushService.kt
fi

@ -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/

@ -1,2 +0,0 @@
#!/usr/bin/env bash
flutter build apk --debug

@ -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}"
}
}

@ -1,5 +0,0 @@
#!/bin/sh -ve
flutter config --enable-linux-desktop
flutter clean
flutter pub get
flutter build linux --release -v

@ -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"

@ -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

@ -3,5 +3,4 @@ flutter config --enable-windows-desktop
flutter clean
flutter pub get
flutter build windows --release -v
flutter build windows --release -v

@ -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

@ -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

@ -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

@ -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.** { <fields>; }
+
+# 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 <fields>;
+}
+
+# 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 = <String, Completer<void>>{};
- 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:

@ -28,4 +28,4 @@ done
# XML Footer
echo '</locale-config>' >> "$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."

@ -27,4 +27,4 @@ $(sed -n \
return \"\";
}
}\
" > lib/pages/chat/command_hints.dart
" > lib/pages/chat/command_hints.dart

@ -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

@ -3,4 +3,4 @@
export USER1_NAME="alice"
export USER1_PW="AliceInWonderland"
export USER2_NAME="bob"
export USER2_PW="JoWirSchaffenDas"
export USER2_PW="JoWirSchaffenDas"

@ -1,2 +0,0 @@
#!/usr/bin/env bash
apk update && apk add docker drill grep

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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.";

@ -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

@ -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

@ -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 ..

@ -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

@ -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

@ -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,//<GOOGLE_SERVICES>,,g' lib/utils/background_push.dart
flutter clean
flutter pub get
cd ios

Loading…
Cancel
Save