Skip to content

Commit c919a92

Browse files
authored
refactor: [DRGO-1247] upgrade for Flutter 3.24.x (#346)
* update depdendencies * add HttpOverride * update flutter_system_proxy dep * Update main.yaml * fix tests * change buildType to debug * update some configs on Android side 🔧 * Update main.yaml * update flutter_system_proxy dep * replace json_schema2 with json_schema * Delete example/analysis_options.yaml * fix api_builder
1 parent e8da245 commit c919a92

39 files changed

+270
-179
lines changed

.github/workflows/main.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,24 @@ jobs:
2020
- name: 📚 Git Checkout
2121
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
2222

23+
- name: ☕ Set Up Java 17
24+
uses: actions/setup-java@v3
25+
with:
26+
java-version: '17'
27+
distribution: 'temurin' # Optionally, adjust Java distribution (e.g., adopt, zulu, etc.)
28+
2329
- name: 🐦 Setup Flutter
2430
uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
2531
with:
26-
flutter-version: "3.10.2"
32+
flutter-version: "3.24.1"
2733
channel: stable
2834
cache: true
2935
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
3036

3137
- name: 📦 Install Dependencies
3238
run: flutter pub get
3339

34-
# do not fail if the analyze issue is info level
40+
# Do not fail if the analyze issue is info level
3541
- name: 🕵️ Analyze
3642
run: |
3743
if flutter analyze 2>&1 | grep -q -E 'error:|warning:';
@@ -42,6 +48,6 @@ jobs:
4248
- name: 🧪 Run Tests
4349
run: flutter test
4450

45-
- name: Build Example app
51+
- name: 🚀 Build Example App (APK)
4652
working-directory: ./example
4753
run: flutter build apk --target-platform android-arm

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
path = binary-websocket-api
33
url = [email protected]:regentmarkets/binary-websocket-api.git
44
branch = master
5+
[submodule "bom-core"]
6+
path = bom-core
7+
url = https://github.com/regentmarkets/bom-core.git

api_builder.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'dart:convert';
33

44
import 'package:build/build.dart';
55
import 'package:dart_style/dart_style.dart';
6-
import 'package:json_schema2/json_schema2.dart';
6+
import 'package:json_schema/json_schema.dart';
77
import 'package:recase/recase.dart';
88

99
Builder apiBuilder(final BuilderOptions _) => APIBuilder();
@@ -60,7 +60,7 @@ class APIBuilder extends Builder {
6060
final Map<dynamic, dynamic> schemaDefinition =
6161
jsonDecode(await buildStep.readAsString(buildStep.inputId));
6262

63-
final JsonSchema schema = JsonSchema.createSchema(schemaDefinition);
63+
final JsonSchema schema = JsonSchema.create(schemaDefinition);
6464

6565
// We keep our list of property keys in original form here so we can iterate over and map them.
6666
final List<String> properties = schema.properties.keys.toList()..sort();

bom-core

Submodule bom-core added at 7a290b0

example/.metadata

+37-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,42 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: e70236e36ce1d32067dc68eb55519ec3e14b6b01
8-
channel: beta
7+
revision: "5874a72aa4c779a02553007c47dacbefba2374dc"
8+
channel: "stable"
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
17+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
18+
- platform: android
19+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
20+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
21+
- platform: ios
22+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
23+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
24+
- platform: linux
25+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
26+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
27+
- platform: macos
28+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
29+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
30+
- platform: web
31+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
32+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
33+
- platform: windows
34+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
35+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/android/.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
GeneratedPluginRegistrant.java
8-
/app/build/
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/to/reference-keystore
11+
key.properties
12+
**/*.keystore
13+
**/*.jks

example/android/app/build.gradle

+20-50
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,44 @@
11
plugins {
22
id "com.android.application"
33
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
45
id "dev.flutter.flutter-gradle-plugin"
56
}
67

7-
def localProperties = new Properties()
8-
def localPropertiesFile = rootProject.file('local.properties')
9-
if (localPropertiesFile.exists()) {
10-
localPropertiesFile.withReader('UTF-8') { reader ->
11-
localProperties.load(reader)
12-
}
13-
}
14-
15-
def flutterRoot = localProperties.getProperty('flutter.sdk')
16-
if (flutterRoot == null) {
17-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
18-
}
19-
20-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
21-
if (flutterVersionCode == null) {
22-
flutterVersionCode = '1'
23-
}
24-
25-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
26-
if (flutterVersionName == null) {
27-
flutterVersionName = '1.0'
28-
}
29-
308
android {
31-
compileSdk 34
32-
33-
sourceSets {
34-
main.java.srcDirs += 'src/main/kotlin'
35-
}
9+
namespace = "com.deriv.example"
10+
compileSdk = 34
11+
ndkVersion = flutter.ndkVersion
3612

37-
lintOptions {
38-
disable 'InvalidPackage'
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_1_8
15+
targetCompatibility = JavaVersion.VERSION_1_8
3916
}
4017

41-
namespace "com.deriv.flutter_deriv_api_example"
42-
43-
compileOptions {
44-
sourceCompatibility JavaVersion.VERSION_17
45-
targetCompatibility JavaVersion.VERSION_17
18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_1_8
4620
}
4721

4822
defaultConfig {
49-
applicationId "com.deriv.flutter_deriv_api_example"
50-
minSdkVersion 21
51-
targetSdkVersion 34
52-
versionCode flutterVersionCode.toInteger()
53-
versionName flutterVersionName
54-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24+
applicationId = "com.deriv.example"
25+
// You can update the following values to match your application needs.
26+
// For more information, see: https://flutter.dev/to/review-gradle-config.
27+
minSdk = flutter.minSdkVersion
28+
targetSdk = flutter.targetSdkVersion
29+
versionCode = flutter.versionCode
30+
versionName = flutter.versionName
5531
}
5632

5733
buildTypes {
5834
release {
35+
// TODO: Add your own signing config for the release build.
5936
// Signing with the debug keys for now, so `flutter run --release` works.
60-
signingConfig signingConfigs.debug
37+
signingConfig = signingConfigs.debug
6138
}
6239
}
6340
}
6441

6542
flutter {
66-
source '../..'
67-
}
68-
69-
dependencies {
70-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
71-
testImplementation 'junit:junit:4.13.2'
72-
androidTestImplementation 'androidx.test:runner:1.6.1'
73-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
43+
source = "../.."
7444
}

example/android/app/src/debug/AndroidManifest.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.deriv.flutter_deriv_api_example">
3-
<!-- Flutter needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.deriv.flutter_deriv_api_example">
3-
4-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5-
calls FlutterMain.startInitialization(this); in its onCreate method.
6-
In most cases you can leave this as-is, but you if you want to provide
7-
additional functionality it is fine to subclass or reimplement
8-
FlutterApplication and put your custom class here. -->
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
92
<application
3+
android:label="example"
104
android:name="${applicationName}"
11-
android:label="flutter_deriv_api_example"
125
android:icon="@mipmap/ic_launcher">
136
<activity
147
android:name=".MainActivity"
158
android:exported="true"
169
android:launchMode="singleTop"
10+
android:taskAffinity=""
1711
android:theme="@style/LaunchTheme"
18-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
12+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1913
android:hardwareAccelerated="true"
2014
android:windowSoftInputMode="adjustResize">
21-
<!-- This keeps the window background of the activity showing
22-
until Flutter renders its first frame. It can be removed if
23-
there is no splash screen (such as the default splash screen
24-
defined in @style/LaunchTheme). -->
15+
<!-- Specifies an Android theme to apply to this Activity as soon as
16+
the Android process has started. This theme is visible to the user
17+
while the Flutter UI initializes. After that, this theme continues
18+
to determine the Window background behind the Flutter UI. -->
2519
<meta-data
26-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
27-
android:value="true" />
20+
android:name="io.flutter.embedding.android.NormalTheme"
21+
android:resource="@style/NormalTheme"
22+
/>
2823
<intent-filter>
2924
<action android:name="android.intent.action.MAIN"/>
3025
<category android:name="android.intent.category.LAUNCHER"/>
3126
</intent-filter>
3227
</activity>
28+
<!-- Don't delete the meta-data below.
29+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
3330
<meta-data
3431
android:name="flutterEmbedding"
3532
android:value="2" />
3633
</application>
34+
<!-- Required to query activities that can process text, see:
35+
https://developer.android.com/training/package-visibility and
36+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
37+
38+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
39+
<queries>
40+
<intent>
41+
<action android:name="android.intent.action.PROCESS_TEXT"/>
42+
<data android:mimeType="text/plain"/>
43+
</intent>
44+
</queries>
3745
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.deriv.example
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity()

example/android/app/src/main/kotlin/com/example/flutter_deriv_api_example/MainActivity.kt

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="?android:colorBackground" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
5+
<!-- Show a splash screen on the activity. Automatically removed when
6+
the Flutter engine draws its first frame -->
7+
<item name="android:windowBackground">@drawable/launch_background</item>
8+
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
18+
</resources>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
45
<!-- Show a splash screen on the activity. Automatically removed when
5-
Flutter draws its first frame -->
6+
the Flutter engine draws its first frame -->
67
<item name="android:windowBackground">@drawable/launch_background</item>
78
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
818
</resources>

example/android/app/src/profile/AndroidManifest.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.deriv.flutter_deriv_api_example">
3-
<!-- Flutter needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>

0 commit comments

Comments
 (0)