build: Use gradle in kotlin
This commit is contained in:
parent
02c8db1c9f
commit
4afd9684c9
22 changed files with 196 additions and 2262 deletions
6
.github/workflows/integrate.yaml
vendored
6
.github/workflows/integrate.yaml
vendored
|
|
@ -25,8 +25,8 @@ jobs:
|
|||
- 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
|
||||
- name: Add Firebase Messaging
|
||||
run: ./scripts/add-firebase-messaging.sh
|
||||
- run: flutter analyze
|
||||
- run: flutter test
|
||||
|
||||
|
|
@ -96,5 +96,7 @@ jobs:
|
|||
xcode-version: latest
|
||||
- run: brew install sqlcipher
|
||||
- uses: moonrepo/setup-rust@v1
|
||||
- name: Add Firebase Key
|
||||
run: echo '${{secrets.GOOGLE_SERVICES_INFO_PLIST}}' | base64 -d > ios/Runner/GoogleService-Info.plist
|
||||
- run: flutter pub get
|
||||
- run: flutter build ios --no-codesign
|
||||
|
|
|
|||
6
.github/workflows/main_deploy.yaml
vendored
6
.github/workflows/main_deploy.yaml
vendored
|
|
@ -56,8 +56,10 @@ jobs:
|
|||
- uses: moonrepo/setup-rust@v1
|
||||
- name: Install Fastlane
|
||||
run: gem install fastlane -NV
|
||||
- name: Apply Google Services Patch
|
||||
run: git apply ./scripts/enable-android-google-services.patch
|
||||
- name: Add Firebase Messaging
|
||||
run: |
|
||||
echo '${{secrets.GOOGLE_SERVICES_JSON}}' | base64 -d > android/app/google-services.json
|
||||
./scripts/add-firebase-messaging.sh
|
||||
- run: flutter pub get
|
||||
- name: Prepare Android Release Build
|
||||
env:
|
||||
|
|
|
|||
12
.github/workflows/release.yaml
vendored
12
.github/workflows/release.yaml
vendored
|
|
@ -82,8 +82,10 @@ jobs:
|
|||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
- name: Apply Google Services Patch
|
||||
run: git apply ./scripts/enable-android-google-services.patch
|
||||
- name: Add Firebase Messaging
|
||||
run: |
|
||||
echo '${{secrets.GOOGLE_SERVICES_JSON}}' | base64 -d > android/app/google-services.json
|
||||
./scripts/add-firebase-messaging.sh
|
||||
- uses: moonrepo/setup-rust@v1
|
||||
- run: flutter pub get
|
||||
- name: Prepare Android Release Build
|
||||
|
|
@ -153,8 +155,10 @@ jobs:
|
|||
- name: Install Fastlane
|
||||
working-directory: android
|
||||
run: gem install fastlane -NV
|
||||
- name: Apply Google Services Patch
|
||||
run: git apply ./scripts/enable-android-google-services.patch
|
||||
- name: Add Firebase Messaging
|
||||
run: |
|
||||
echo '${{secrets.GOOGLE_SERVICES_JSON}}' | base64 -d > android/app/google-services.json
|
||||
./scripts/add-firebase-messaging.sh
|
||||
- run: flutter pub get
|
||||
- name: Prepare Android Release Build
|
||||
env:
|
||||
|
|
|
|||
1848
.gitignore
vendored
1848
.gitignore
vendored
File diff suppressed because it is too large
Load diff
12
.metadata
12
.metadata
|
|
@ -4,7 +4,7 @@
|
|||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "abb292a07e20d696c4568099f918f6c5f330e6b0"
|
||||
revision: "fcf2c11572af6f390246c056bc905eca609533a0"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
|
@ -13,11 +13,11 @@ project_type: app
|
|||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
|
||||
base_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
|
||||
- platform: linux
|
||||
create_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
|
||||
base_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
|
||||
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
|
||||
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
|
||||
- platform: android
|
||||
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
|
||||
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
|
||||
|
||||
# User provided section
|
||||
|
||||
|
|
|
|||
|
|
@ -1,107 +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 = "chat.fluffy.fluffychat"
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "chat.fluffy.fluffychat"
|
||||
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 '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'
|
||||
}
|
||||
73
android/app/build.gradle.kts
Normal file
73
android/app/build.gradle.kts
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
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")
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "im.fluffychat.fluffychat"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = "27.0.12077973"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.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 = "chat.fluffy.fluffychat"
|
||||
minSdk = 21
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "865731724731",
|
||||
"project_id": "fluffychat-ef3e8",
|
||||
"storage_bucket": "fluffychat-ef3e8.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:865731724731:android:ec427b3b1dcd4a1e64309e",
|
||||
"android_client_info": {
|
||||
"package_name": "chat.fluffy.fluffychat"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "865731724731-od6969v178ul9970elgacpt936v5t7qg.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyBLdZpGSPjcinikB4lAU6awW_h88NG17Sg"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "865731724731-od6969v178ul9970elgacpt936v5t7qg.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "865731724731-ofdr7e6m04murgb1bvchlj9oaos0q5i3.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "im.fluffychat.app"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +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
|
||||
}
|
||||
21
android/build.gradle.kts
Normal file
21
android/build.gradle.kts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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)
|
||||
}
|
||||
|
|
@ -1,26 +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()
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
28
android/settings.gradle.kts
Normal file
28
android/settings.gradle.kts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
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()
|
||||
}
|
||||
}
|
||||
|
||||
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.0" apply false
|
||||
if (file("app/google-services.json").exists()) {
|
||||
id("com.google.gms.google-services") version "4.3.8" apply false
|
||||
}
|
||||
}
|
||||
|
||||
include(":app")
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CLIENT_ID</key>
|
||||
<string>865731724731-ofdr7e6m04murgb1bvchlj9oaos0q5i3.apps.googleusercontent.com</string>
|
||||
<key>REVERSED_CLIENT_ID</key>
|
||||
<string>com.googleusercontent.apps.865731724731-ofdr7e6m04murgb1bvchlj9oaos0q5i3</string>
|
||||
<key>API_KEY</key>
|
||||
<string>AIzaSyA8ZUBcuny0HjPwF2Q2fvDyQTC5dG2VHlE</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
<string>865731724731</string>
|
||||
<key>PLIST_VERSION</key>
|
||||
<string>1</string>
|
||||
<key>BUNDLE_ID</key>
|
||||
<string>im.fluffychat.app</string>
|
||||
<key>PROJECT_ID</key>
|
||||
<string>fluffychat-ef3e8</string>
|
||||
<key>STORAGE_BUCKET</key>
|
||||
<string>fluffychat-ef3e8.appspot.com</string>
|
||||
<key>IS_ADS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_APPINVITE_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_GCM_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true></true>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:865731724731:ios:79fd983ce46cb40c64309e</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
|
@ -7,6 +6,7 @@ import 'package:flutter_typeahead/flutter_typeahead.dart';
|
|||
import 'package:matrix/matrix.dart';
|
||||
import 'package:slugify/slugify.dart';
|
||||
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/utils/markdown_context_builder.dart';
|
||||
import 'package:fluffychat/widgets/mxc_image.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';
|
||||
//<GOOGLE_SERVICES>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();
|
||||
//<GOOGLE_SERVICES>final firebase = FcmSharedIsolate();
|
||||
|
||||
DateTime? lastReceivedPush;
|
||||
|
||||
|
|
@ -80,17 +80,17 @@ class BackgroundPush {
|
|||
onDidReceiveNotificationResponse: goToRoom,
|
||||
);
|
||||
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,
|
||||
),
|
||||
);
|
||||
//<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>);
|
||||
if (Platform.isAndroid) {
|
||||
await UnifiedPush.initialize(
|
||||
onNewEndpoint: _newUpEndpoint,
|
||||
|
|
@ -148,7 +148,7 @@ class BackgroundPush {
|
|||
bool useDeviceSpecificAppId = false,
|
||||
}) async {
|
||||
if (PlatformInfos.isIOS) {
|
||||
await firebase?.requestPermission();
|
||||
//<GOOGLE_SERVICES>await firebase.requestPermission();
|
||||
}
|
||||
if (PlatformInfos.isAndroid) {
|
||||
_flutterLocalNotificationsPlugin
|
||||
|
|
@ -308,7 +308,7 @@ class BackgroundPush {
|
|||
Logs().v('Setup firebase');
|
||||
if (_fcmToken?.isEmpty ?? true) {
|
||||
try {
|
||||
_fcmToken = await firebase?.getToken();
|
||||
//<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);
|
||||
|
|
@ -384,8 +384,8 @@ class BackgroundPush {
|
|||
Logs().i('[Push] UnifiedPush using endpoint $endpoint');
|
||||
final oldTokens = <String?>{};
|
||||
try {
|
||||
final fcmToken = await firebase?.getToken();
|
||||
oldTokens.add(fcmToken);
|
||||
//<GOOGLE_SERVICES>final fcmToken = await firebase.getToken();
|
||||
//<GOOGLE_SERVICES>oldTokens.add(fcmToken);
|
||||
} catch (_) {}
|
||||
await setupPusher(
|
||||
gatewayUrl: endpoint,
|
||||
|
|
|
|||
24
pubspec.lock
24
pubspec.lock
|
|
@ -572,26 +572,34 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_local_notifications
|
||||
sha256: "674173fd3c9eda9d4c8528da2ce0ea69f161577495a9cc835a2a4ecd7eadeb35"
|
||||
sha256: edae0c34573233ab03f5ba1f07465e55c384743893042cb19e010b4ee8541c12
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "17.2.4"
|
||||
version: "19.3.0"
|
||||
flutter_local_notifications_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_local_notifications_linux
|
||||
sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af
|
||||
sha256: e3c277b2daab8e36ac5a6820536668d07e83851aeeb79c446e525a70710770a5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.1"
|
||||
version: "6.0.0"
|
||||
flutter_local_notifications_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_local_notifications_platform_interface
|
||||
sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66"
|
||||
sha256: "277d25d960c15674ce78ca97f57d0bae2ee401c844b6ac80fcd972a9c99d09fe"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.2.0"
|
||||
version: "9.1.0"
|
||||
flutter_local_notifications_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_local_notifications_windows
|
||||
sha256: f8fc0652a601f83419d623c85723a3e82ad81f92b33eaa9bcc21ea1b94773e6e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
flutter_localizations:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
|
@ -1973,10 +1981,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: timezone
|
||||
sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d"
|
||||
sha256: dd14a3b83cfd7cb19e7888f1cbc20f258b8d71b54c06f79ac585f14093a287d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.4"
|
||||
version: "0.10.1"
|
||||
tint:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ dependencies:
|
|||
dynamic_color: ^1.7.0
|
||||
emoji_picker_flutter: ^4.3.0
|
||||
emojis: ^0.9.9
|
||||
#fcm_shared_isolate: ^0.2.0
|
||||
file_picker: ^8.1.2
|
||||
file_selector: ^1.0.3
|
||||
flutter:
|
||||
|
|
@ -33,7 +32,7 @@ dependencies:
|
|||
flutter_foreground_task: ^6.1.3
|
||||
flutter_highlighter: ^0.1.1
|
||||
flutter_linkify: ^6.0.0
|
||||
flutter_local_notifications: ^17.2.3
|
||||
flutter_local_notifications: ^19.2.1
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
flutter_map: ^6.1.0
|
||||
|
|
|
|||
10
scripts/add-firebase-messaging.sh
Executable file
10
scripts/add-firebase-messaging.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/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
|
||||
else
|
||||
sed -i 's,//<GOOGLE_SERVICES>,,g' lib/utils/background_push.dart
|
||||
fi
|
||||
|
|
@ -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: ^4.3.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:
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh -ve
|
||||
git apply ./scripts/enable-android-google-services.patch
|
||||
./scripts/add-firebase-messaging.sh
|
||||
yq eval '.dependencies.fcm_shared_isolate = "0.1.0"' -i pubspec.yaml # Workaround: 0.2.0 does not work on iOS
|
||||
flutter clean
|
||||
flutter pub get
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
flutter_local_notifications_windows
|
||||
flutter_vodozemac
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue