Skip to content

Commit 8123b2d

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into dev
2 parents 2f01df9 + 9c4c80f commit 8123b2d

File tree

726 files changed

+21225
-10604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

726 files changed

+21225
-10604
lines changed

.circleci/config.yml

-82
This file was deleted.

.github/workflows/main.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Flutter Analyze, Test, and Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- dev
8+
pull_request:
9+
branches:
10+
- "*"
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: "ubuntu-latest"
19+
steps:
20+
- name: 📚 Git Checkout
21+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
22+
23+
- name: 🐦 Setup Flutter
24+
uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
25+
with:
26+
flutter-version: "3.10.2"
27+
channel: stable
28+
cache: true
29+
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
30+
31+
- name: 📦 Install Dependencies
32+
run: flutter pub get
33+
34+
# do not fail if the analyze issue is info level
35+
- name: 🕵️ Analyze
36+
run: |
37+
if flutter analyze 2>&1 | grep -q -E 'error:|warning:';
38+
then exit 1
39+
else exit 0
40+
fi
41+
42+
- name: 🧪 Run Tests
43+
run: flutter test
44+
45+
- name: Build Example app
46+
working-directory: ./example
47+
run: flutter build apk --target-platform android-arm

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "binary-websocket-api"]
22
path = binary-websocket-api
3-
url = https://github.com/regentmarkets/binary-websocket-api.git
3+
url = git@github.com:regentmarkets/binary-websocket-api.git
44
branch = master

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ dependencies:
141141
```
142142
$ git submodule init
143143
$ git submodule update --remote
144+
$ ./setup.sh
145+
$ flutter pub run build_runner build --delete-conflicting-outputs
144146
```
145147

146148
### Run the tests

analysis_options.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ analyzer:
22
exclude:
33
- lib/basic_api/generated/api.dart
44

5-
strong-mode:
6-
implicit-dynamic: false
7-
5+
language:
6+
strict-raw-types: true
7+
88
errors:
99
todo: ignore
1010
missing_required_param: warning
@@ -92,7 +92,6 @@ linter:
9292
- prefer_const_literals_to_create_immutables
9393
- prefer_constructors_over_static_methods
9494
- prefer_contains
95-
- prefer_equal_for_default_values
9695
- prefer_expression_function_bodies # https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
9796
- prefer_final_fields
9897
- prefer_final_in_for_each

android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ group 'com.deriv.flutter_deriv_api'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.50'
5+
ext.kotlin_version = '1.7.10'
66
repositories {
77
google()
88
jcenter()
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.0'
12+
classpath 'com.android.tools.build:gradle:7.3.0'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
1515
}

android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip

api_builder.dart

+25-18
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ class APIBuilder extends Builder {
122122
/// Initialize $classFullName.
123123
const $classFullName({
124124
${_getConstructorParameters(methodName, schema, schemaType, properties)}
125-
${_getSuperClassParameters(schemaType)},
126-
}): super(${_getSuperClassCallParameters(schemaType, methodName)},);
125+
${_getSuperClassConstructorParameters(schemaType, methodName)},
126+
});
127127
128128
${_getFromJsonMethod(classFullName, schema, schemaType, properties)}
129129
@@ -169,6 +169,7 @@ class APIBuilder extends Builder {
169169
return '${_isFieldRequired(key, schemaType, property) ? 'required ' : ''} this.${ReCase(key).camelCase}';
170170
},
171171
).join(', ');
172+
172173
return fields.isEmpty ? result : '$result , ';
173174
}
174175

@@ -380,6 +381,7 @@ class APIBuilder extends Builder {
380381
fields.map(
381382
(String key) {
382383
final String name = ReCase(key).camelCase;
384+
383385
return '$name: $name ?? this.$name';
384386
},
385387
).join(', '),
@@ -388,40 +390,45 @@ class APIBuilder extends Builder {
388390
..write('${_getSupperClassAssignments(schemaType)},);');
389391
}
390392

391-
static String _getSuperClassParameters(String? schemaType) {
393+
static String _getSuperClassParameters(String schemaType) {
392394
final Map<String, String> superClassFields =
393395
_getSuperClassFields(schemaType);
394396

395-
return superClassFields.keys
396-
.map((String key) =>
397-
'${typeMap[superClassFields[key]!]} ${ReCase(key).camelCase}')
398-
.join(', ');
397+
final Iterable<String> parameters = superClassFields.keys.map((String key) {
398+
final String type = typeMap[superClassFields[key]!] ?? 'dynamic';
399+
final String parameterName = ReCase(key).camelCase;
400+
401+
return '$type $parameterName';
402+
});
403+
404+
return parameters.join(', ');
399405
}
400406

401-
static String _getSuperClassCallParameters(
407+
static String _getSuperClassConstructorParameters(
402408
String schemaType,
403409
String methodName,
404410
) {
405-
final StringBuffer superCallParameters = StringBuffer();
411+
final Map<String, String> superClassFields =
412+
_getSuperClassFields(schemaType);
413+
final StringBuffer superClassParameters = StringBuffer();
406414

407415
if (schemaType == 'send') {
408-
superCallParameters.write('msgType: \'$methodName\',');
416+
superClassParameters.write('super.msgType = \'$methodName\', ');
409417
}
410418

411-
superCallParameters.write(_getSuperClassFields(schemaType).keys.map(
412-
(String key) {
413-
final String parameterName = ReCase(key).camelCase;
414-
return '$parameterName: $parameterName';
415-
},
416-
).join(', '));
419+
final Iterable<String> parameters = superClassFields.keys
420+
.map((String key) => 'super.${ReCase(key).camelCase}');
417421

418-
return superCallParameters.toString();
422+
superClassParameters.write(parameters.join(', '));
423+
424+
return superClassParameters.toString();
419425
}
420426

421427
static String _getSupperClassAssignments(String schemaType) =>
422428
_getSuperClassFields(schemaType).keys.map(
423429
(String key) {
424430
final String propertyName = ReCase(key).camelCase;
431+
425432
return '$propertyName: $propertyName ?? this.$propertyName';
426433
},
427434
).join(', ');
@@ -458,7 +465,7 @@ class APIBuilder extends Builder {
458465
}
459466
}
460467

461-
class GeneratedResponseJson extends Comparable<GeneratedResponseJson> {
468+
class GeneratedResponseJson implements Comparable<GeneratedResponseJson> {
462469
GeneratedResponseJson({
463470
this.msgType,
464471
this.fileName,

binary-websocket-api

example/android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 28
29+
compileSdkVersion 33
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -39,7 +39,7 @@ android {
3939
defaultConfig {
4040
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4141
applicationId "com.deriv.flutter_deriv_api_example"
42-
minSdkVersion 16
42+
minSdkVersion 19
4343
targetSdkVersion 28
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName

example/android/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.50'
2+
ext.kotlin_version = '1.7.10'
33
repositories {
44
google()
55
jcenter()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.5.0'
9+
classpath 'com.android.tools.build:gradle:7.3.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip

example/ios/Podfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '9.0'
2+
platform :ios, '12.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

example/ios/Runner/Info.plist

+4
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@
4141
</array>
4242
<key>UIViewControllerBasedStatusBarAppearance</key>
4343
<false/>
44+
<key>CADisableMinimumFrameDurationOnPhone</key>
45+
<true/>
46+
<key>UIApplicationSupportsIndirectInputEvents</key>
47+
<true/>
4448
</dict>
4549
</plist>

0 commit comments

Comments
 (0)