Skip to content

Commit dfee86c

Browse files
authored
fix: avoid reopening root when using multiple FlutterEngines (#153)
1 parent ae1f0f5 commit dfee86c

File tree

25 files changed

+157
-158
lines changed

25 files changed

+157
-158
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ Many thanks to my sponsors, no matter how much or how little they donated. Spons
1414

1515
# Changelog
1616

17-
## [9.0.0] - "Just Another Rewrite" - 2024/04/XX
17+
## [9.0.1] - 2024/04/29
18+
19+
* Fixed bug on initialisation, where using multiple/background `FlutterEngine`s would attempt to re-open a single ObjectBox Store (aka. root) multiple times
20+
21+
## [9.0.0] - "Just Another Rewrite" - 2024/04/11
1822

1923
This update has essentially rewritten FMTC from the ground up, over hundreds of hours. It focuses on:
2024

example/.metadata

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "2524052335ec76bb03e04ede244b071f1b86d190"
8-
channel: "stable"
7+
revision: "29babcb32a591b9e5be8c6a6075d4fe605d46ad3"
8+
channel: "beta"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 2524052335ec76bb03e04ede244b071f1b86d190
17-
base_revision: 2524052335ec76bb03e04ede244b071f1b86d190
18-
- platform: windows
19-
create_revision: 2524052335ec76bb03e04ede244b071f1b86d190
20-
base_revision: 2524052335ec76bb03e04ede244b071f1b86d190
16+
create_revision: 29babcb32a591b9e5be8c6a6075d4fe605d46ad3
17+
base_revision: 29babcb32a591b9e5be8c6a6075d4fe605d46ad3
18+
- platform: android
19+
create_revision: 29babcb32a591b9e5be8c6a6075d4fe605d46ad3
20+
base_revision: 29babcb32a591b9e5be8c6a6075d4fe605d46ad3
2121

2222
# User provided section
2323

example/android/app/build.gradle

Lines changed: 25 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,53 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id "dev.flutter.flutter-gradle-plugin"
6+
}
7+
18
def localProperties = new Properties()
2-
def localPropertiesFile = rootProject.file('local.properties')
9+
def localPropertiesFile = rootProject.file("local.properties")
310
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withReader('UTF-8') { reader ->
11+
localPropertiesFile.withReader("UTF-8") { reader ->
512
localProperties.load(reader)
613
}
714
}
815

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
14-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16+
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
1517
if (flutterVersionCode == null) {
16-
flutterVersionCode = '9'
18+
flutterVersionCode = "9"
1719
}
1820

19-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
21+
def flutterVersionName = localProperties.getProperty("flutter.versionName")
2022
if (flutterVersionName == null) {
21-
flutterVersionName = '9.0.0'
22-
}
23-
24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
28-
def keystoreProperties = new Properties()
29-
def keystorePropertiesFile = rootProject.file('key.properties')
30-
if (keystorePropertiesFile.exists()) {
31-
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
23+
flutterVersionName = "9.0"
3224
}
3325

3426
android {
35-
compileSdkVersion rootProject.ext.compileSdkVersion
36-
37-
defaultConfig {
38-
multiDexEnabled true
39-
}
27+
namespace = "dev.jaffaketchup.fmtc.demo"
28+
compileSdk = flutter.compileSdkVersion
29+
ndkVersion = flutter.ndkVersion
4030

4131
compileOptions {
42-
coreLibraryDesugaringEnabled true
43-
sourceCompatibility JavaVersion.VERSION_1_8
44-
targetCompatibility JavaVersion.VERSION_1_8
45-
}
46-
47-
kotlinOptions {
48-
jvmTarget = '1.8'
49-
}
50-
51-
sourceSets {
52-
main.java.srcDirs += 'src/main/kotlin'
32+
sourceCompatibility = JavaVersion.VERSION_1_8
33+
targetCompatibility = JavaVersion.VERSION_1_8
5334
}
5435

5536
defaultConfig {
56-
applicationId "dev.jaffaketchup.fmtc.demo"
57-
minSdkVersion rootProject.ext.minSdkVersion
58-
targetSdkVersion rootProject.ext.targetSdkVersion
59-
versionCode flutterVersionCode.toInteger()
60-
versionName flutterVersionName
37+
applicationId = "dev.jaffaketchup.fmtc.demo"
38+
minSdk = flutter.minSdkVersion
39+
targetSdk = flutter.targetSdkVersion
40+
versionCode = flutterVersionCode.toInteger()
41+
versionName = flutterVersionName
6142
}
6243

6344
buildTypes {
6445
release {
65-
signingConfig signingConfigs.debug
46+
signingConfig = signingConfigs.debug
6647
}
6748
}
6849
}
6950

7051
flutter {
71-
source '../..'
72-
}
73-
74-
dependencies {
75-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
76-
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
52+
source = "../.."
7753
}
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dev.jaffaketchup.fmtc.demo">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<uses-permission android:name="android.permission.INTERNET"/>
4-
<queries>
5-
<intent>
6-
<action android:name="android.intent.action.VIEW" />
7-
<data android:scheme="https" />
8-
</intent>
9-
</queries>
103
</manifest>
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dev.jaffaketchup.fmtc.demo">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<uses-permission android:name="android.permission.INTERNET"/>
43
<application
54
android:label="FMTC Demo"
5+
android:name="${applicationName}"
66
android:icon="@mipmap/ic_launcher">
77
<activity
88
android:name=".MainActivity"
9+
android:exported="true"
910
android:launchMode="singleTop"
11+
android:taskAffinity=""
1012
android:theme="@style/LaunchTheme"
1113
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1214
android:hardwareAccelerated="true"
1315
android:windowSoftInputMode="adjustResize">
16+
<!-- Specifies an Android theme to apply to this Activity as soon as
17+
the Android process has started. This theme is visible to the user
18+
while the Flutter UI initializes. After that, this theme continues
19+
to determine the Window background behind the Flutter UI. -->
1420
<meta-data
1521
android:name="io.flutter.embedding.android.NormalTheme"
1622
android:resource="@style/NormalTheme"
@@ -20,14 +26,21 @@
2026
<category android:name="android.intent.category.LAUNCHER"/>
2127
</intent-filter>
2228
</activity>
29+
<!-- Don't delete the meta-data below.
30+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
2331
<meta-data
2432
android:name="flutterEmbedding"
2533
android:value="2" />
2634
</application>
35+
<!-- Required to query activities that can process text, see:
36+
https://developer.android.com/training/package-visibility and
37+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
38+
39+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
2740
<queries>
2841
<intent>
29-
<action android:name="android.intent.action.VIEW" />
30-
<data android:scheme="https" />
42+
<action android:name="android.intent.action.PROCESS_TEXT"/>
43+
<data android:mimeType="text/plain"/>
3144
</intent>
32-
</queries>
45+
</queries>
3346
</manifest>

example/android/app/src/main/kotlin/dev/org/fmtc/example/fmtc_example/MainActivity.kt renamed to example/android/app/src/main/kotlin/com/example/example/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ package dev.jaffaketchup.fmtc.demo
22

33
import io.flutter.embedding.android.FlutterActivity
44

5-
class MainActivity: FlutterActivity() {
6-
}
5+
class MainActivity: FlutterActivity()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)