diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 25d5526100..87b64cd731 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -20,10 +20,16 @@ jobs: - name: ๐Ÿ“š Git Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: โ˜• Set Up Java 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' # Optionally, adjust Java distribution (e.g., adopt, zulu, etc.) + - name: ๐Ÿฆ Setup Flutter uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa with: - flutter-version: "3.10.2" + flutter-version: "3.24.1" channel: stable cache: true cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} @@ -31,7 +37,7 @@ jobs: - name: ๐Ÿ“ฆ Install Dependencies run: flutter pub get - # do not fail if the analyze issue is info level + # Do not fail if the analyze issue is info level - name: ๐Ÿ•ต๏ธ Analyze run: | if flutter analyze 2>&1 | grep -q -E 'error:|warning:'; @@ -42,6 +48,6 @@ jobs: - name: ๐Ÿงช Run Tests run: flutter test - - name: Build Example app + - name: ๐Ÿš€ Build Example App (APK) working-directory: ./example run: flutter build apk --target-platform android-arm diff --git a/.gitmodules b/.gitmodules index cf49523818..21f8d67abf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = binary-websocket-api url = git@github.com:regentmarkets/binary-websocket-api.git branch = master +[submodule "bom-core"] + path = bom-core + url = https://github.com/regentmarkets/bom-core.git diff --git a/api_builder.dart b/api_builder.dart index d6fe0154b4..f79f5b8bd5 100644 --- a/api_builder.dart +++ b/api_builder.dart @@ -3,7 +3,7 @@ import 'dart:convert'; import 'package:build/build.dart'; import 'package:dart_style/dart_style.dart'; -import 'package:json_schema2/json_schema2.dart'; +import 'package:json_schema/json_schema.dart'; import 'package:recase/recase.dart'; Builder apiBuilder(final BuilderOptions _) => APIBuilder(); @@ -60,7 +60,7 @@ class APIBuilder extends Builder { final Map schemaDefinition = jsonDecode(await buildStep.readAsString(buildStep.inputId)); - final JsonSchema schema = JsonSchema.createSchema(schemaDefinition); + final JsonSchema schema = JsonSchema.create(schemaDefinition); // We keep our list of property keys in original form here so we can iterate over and map them. final List properties = schema.properties.keys.toList()..sort(); diff --git a/bom-core b/bom-core new file mode 160000 index 0000000000..7a290b0bc2 --- /dev/null +++ b/bom-core @@ -0,0 +1 @@ +Subproject commit 7a290b0bc21a30e1e54998e7e3a867e6bdeb5a0e diff --git a/example/.metadata b/example/.metadata index 0958d2896b..391c336b2f 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,42 @@ # This file should be version controlled and should not be manually edited. version: - revision: e70236e36ce1d32067dc68eb55519ec3e14b6b01 - channel: beta + revision: "5874a72aa4c779a02553007c47dacbefba2374dc" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + - platform: android + create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + - platform: ios + create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + - platform: linux + create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + - platform: macos + create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + - platform: web + create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + - platform: windows + create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/android/.gitignore b/example/android/.gitignore index d159b3fb3f..55afd919c6 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -5,4 +5,9 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java -/app/build/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 71951229de..a5029d27de 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,74 +1,44 @@ 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" } -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - android { - compileSdk 34 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } + namespace = "com.deriv.example" + compileSdk = 34 + ndkVersion = flutter.ndkVersion - lintOptions { - disable 'InvalidPackage' + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } - namespace "com.deriv.flutter_deriv_api_example" - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { - applicationId "com.deriv.flutter_deriv_api_example" - minSdkVersion 21 - targetSdkVersion 34 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.deriv.example" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } buildTypes { release { + // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig = signingConfigs.debug } } } flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test:runner:1.6.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' + source = "../.." } diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index 28e53278d8..399f6981d5 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 333732b805..74a78b939e 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,37 +1,45 @@ - - - + - + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> + + + + + + + + diff --git a/example/android/app/src/main/kotlin/com/deriv/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/deriv/example/MainActivity.kt new file mode 100644 index 0000000000..a26f282b14 --- /dev/null +++ b/example/android/app/src/main/kotlin/com/deriv/example/MainActivity.kt @@ -0,0 +1,5 @@ +package com.deriv.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/example/android/app/src/main/kotlin/com/example/flutter_deriv_api_example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/flutter_deriv_api_example/MainActivity.kt deleted file mode 100644 index e36cb16fc6..0000000000 --- a/example/android/app/src/main/kotlin/com/example/flutter_deriv_api_example/MainActivity.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.deriv.flutter_deriv_api_example - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() {} diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000000..f74085f3f6 --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000000..06952be745 --- /dev/null +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml index 00fa4417cf..cb1ef88056 100644 --- a/example/android/app/src/main/res/values/styles.xml +++ b/example/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml index 28e53278d8..399f6981d5 100644 --- a/example/android/app/src/profile/AndroidManifest.xml +++ b/example/android/app/src/profile/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/example/android/build.gradle b/example/android/build.gradle index dce5750243..d2ffbffa4c 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,43 +1,18 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - id "org.jetbrains.kotlin.android" version "1.9.20" apply false -} - -allprojects { - tasks.withType(KotlinCompile).configureEach { - kotlinOptions { - jvmTarget = "17" - } - } -} - allprojects { repositories { google() mavenCentral() } - - tasks.withType(KotlinCompile).configureEach { - kotlinOptions { - jvmTarget = "17" - } - } - - subprojects { - afterEvaluate { project -> - if (project.hasProperty('android')) { - project.android { - if (namespace == null) { - namespace project.group - } - } - } - } - } } -ext { - kotlin_version = '1.9.20' +rootProject.buildDir = "../build" +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(":app") } +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 38c8d4544f..2597170821 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,4 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableR8=true +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index a35eb1fa3b..5d6560a4ef 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 1235d04c3c..14bb32e0af 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -18,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version '8.5.0' apply false - id "org.jetbrains.kotlin.android" version "1.9.20" apply false + id "com.android.application" version "8.4.2" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false } -include ':app' +include ":app" diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec deleted file mode 100644 index 98e1633950..0000000000 --- a/example/ios/Flutter/Flutter.podspec +++ /dev/null @@ -1,18 +0,0 @@ -# -# This podspec is NOT to be published. It is only used as a local source! -# This is a generated file; do not edit or check into version control. -# - -Pod::Spec.new do |s| - s.name = 'Flutter' - s.version = '1.0.0' - s.summary = 'A UI toolkit for beautiful and fast apps.' - s.homepage = 'https://flutter.dev' - s.license = { :type => 'BSD' } - s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } - s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '12.0' - # Framework linking is handled by Flutter tooling, not CocoaPods. - # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. - s.vendored_frameworks = 'path/to/nothing' -end diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..f9b0d7c5ea --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..f9b0d7c5ea --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/RunnerTests/RunnerTests.swift b/example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000000..86a7c3b1b6 --- /dev/null +++ b/example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/example/lib/main.dart b/example/lib/main.dart index 8aa9a8d1c6..4b5ca73933 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,8 +1,13 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'sample_app.dart'; -void main() => runApp(App()); +void main() { + HttpOverrides.global = MyHttpOverrides(); + runApp(App()); +} /// The main widget. class App extends StatefulWidget { @@ -14,3 +19,12 @@ class _AppState extends State { @override Widget build(BuildContext context) => MaterialApp(home: SampleApp()); } + +class MyHttpOverrides extends HttpOverrides { + @override + HttpClient createHttpClient(SecurityContext? context) { + return super.createHttpClient(context) + ..badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + } +} diff --git a/example/lib/sample_app.dart b/example/lib/sample_app.dart index a3799bfe71..4955fc8ddf 100644 --- a/example/lib/sample_app.dart +++ b/example/lib/sample_app.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; - import 'package:flutter_deriv_api/services/connection/api_manager/connection_information.dart'; import 'package:flutter_deriv_api/state/connection/connection_cubit.dart' - as api_connection; + as conn; import 'package:flutter_deriv_api_example/pages/main_page.dart'; /// Sample App main widget @@ -13,20 +12,20 @@ class SampleApp extends StatefulWidget { } class _SampleAppState extends State { - late api_connection.ConnectionCubit _connectionCubit; + late conn.ConnectionCubit _connectionCubit; @override void initState() { super.initState(); - _connectionCubit = api_connection.ConnectionCubit( - ConnectionInformation( - appId: '1089', - brand: 'binary', - endpoint: 'frontend.binaryws.com', - authEndpoint: '', - ), - ); + _connectionCubit = conn.ConnectionCubit( + ConnectionInformation( + appId: '36544', + brand: 'deriv', + endpoint: 'ws.derivws.com', + authEndpoint: '', + ), + proxyAwareConnection: false); } @override @@ -39,7 +38,7 @@ class _SampleAppState extends State { @override Widget build(BuildContext context) => MultiBlocProvider( providers: >[ - BlocProvider.value( + BlocProvider.value( value: _connectionCubit, ), ], @@ -47,20 +46,19 @@ class _SampleAppState extends State { appBar: AppBar( title: const Text('API Sample App'), ), - body: BlocBuilder( + body: BlocBuilder( builder: ( BuildContext context, - api_connection.ConnectionState state, + conn.ConnectionState state, ) { - if (state is api_connection.ConnectionConnectedState) { + if (state is conn.ConnectionConnectedState) { return MainPage(); - } else if (state is api_connection.ConnectionInitialState || - state is api_connection.ConnectionConnectingState) { + } else if (state is conn.ConnectionInitialState || + state is conn.ConnectionConnectingState) { return _buildCenterText('Connecting...'); - } else if (state is api_connection.ConnectionErrorState) { + } else if (state is conn.ConnectionErrorState) { return _buildCenterText('Connection Error\n${state.error}'); - } else if (state is api_connection.ConnectionDisconnectedState) { + } else if (state is conn.ConnectionDisconnectedState) { return _buildCenterText( 'Connection is down, trying to reconnect...', ); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index b4d30506ab..c661594db1 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,7 +5,7 @@ version: 0.0.1 environment: sdk: ">=3.0.0" - flutter: "3.10.2" + flutter: "3.24.1" dependencies: flutter: @@ -13,13 +13,14 @@ dependencies: rxdart: ^0.27.7 flutter_bloc: ^8.1.2 + win32: ^5.5.4 + flutter_deriv_api: + path: ../ dev_dependencies: flutter_test: sdk: flutter - flutter_deriv_api: - path: ../ flutter: uses-material-design: true diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart index 96d87a6f4a..41624c3933 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_create_response.dart @@ -18,6 +18,7 @@ const String p2pAdvertCreateResponse = ''' "name": "za advertiser 1010", "completed_orders_count" : 1, "rating_count" : 0, + "is_schedule_available": true, "is_online": true }, "amount": 100, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_info_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_info_response.dart index 5070d2c9a8..6b334db3f1 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_info_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_info_response.dart @@ -13,7 +13,8 @@ const String p2pAdvertInfoResponse = ''' "name": "za advertiser 1010", "completed_orders_count" : 1, "rating_count" : 0, - "is_online": true + "is_online": true, + "is_schedule_available": true }, "counterparty_type": "sell", "country": "za", diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart index e27468536a..453234b2a1 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_list_response.dart @@ -15,6 +15,7 @@ const String p2pAdvertListResponse = ''' "name": "advertiser CR90000018", "completed_orders_count" : 1, "rating_count" : 0, + "is_schedule_available": true, "is_online": true }, "block_trade": 1, @@ -47,6 +48,7 @@ const String p2pAdvertListResponse = ''' "name": "advertiser CR90000022", "completed_orders_count" : 1, "rating_count" : 0, + "is_schedule_available": true, "is_online": true }, "block_trade": 1, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_update_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_update_response.dart index 87a6c9a845..3112e1e2d4 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_update_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advert_update_response.dart @@ -18,6 +18,7 @@ const String p2pAdvertUpdateResponse = ''' "name": "za advertiser 1010", "completed_orders_count" : 1, "rating_count" : 0, + "is_schedule_available": true, "is_online": true }, "amount": 100, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart index 744619ee4a..36e1b87683 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_adverts_response.dart @@ -13,6 +13,7 @@ const String p2pAdvertiserAdvertsResponse = ''' "id": "1", "name": "John Doe", "completed_orders_count" : 1, + "is_schedule_available": true, "rating_count" : 0, "is_online": true }, @@ -60,6 +61,7 @@ const String p2pAdvertiserAdvertsResponse = ''' "id": "1", "name": "John Doe", "completed_orders_count" : 1, + "is_schedule_available": true, "rating_count" : 0, "is_online": true }, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_create_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_create_response.dart index 1eecaed0ea..5b0c0be1b9 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_create_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_create_response.dart @@ -26,6 +26,7 @@ const String p2pAdvertiserCreateResponse = ''' "partner_count": 1, "sell_orders_amount" : "", "total_turnover" : "", + "is_schedule_available": true, "balance_available" : 1, "cancels_remaining" : 1, "show_name" : true, diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_info_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_info_response.dart index 782285501e..9707bce824 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_info_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_info_response.dart @@ -12,6 +12,7 @@ const String p2pAdvertiserInfoResponse = ''' "buy_orders_count" : 1, "full_verification" : 1, "sell_orders_count" : 1, + "is_schedule_available": true, "total_orders_count" : 1, "chat_token": "invalid_token_for_test_2ea8d690e2e98582", "chat_user_id": "p2p_CR_1589256468", diff --git a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_update_response.dart b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_update_response.dart index 4d6f111c6a..f4608476a2 100644 --- a/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_update_response.dart +++ b/lib/services/connection/api_manager/mock_data/p2p/p2p_advertiser_update_response.dart @@ -10,6 +10,7 @@ const String p2pAdvertiserUpdateResponse = ''' "favourited" : 1, "buy_orders_amount" : "1", "buy_orders_count" : 1, + "is_schedule_available": true, "full_verification" : 1, "sell_orders_count" : 1, "total_orders_count" : 1, diff --git a/lib/state/connection/connection_cubit.dart b/lib/state/connection/connection_cubit.dart index 3c90cc438a..49a8daaae9 100644 --- a/lib/state/connection/connection_cubit.dart +++ b/lib/state/connection/connection_cubit.dart @@ -26,6 +26,8 @@ class ConnectionCubit extends Cubit { this.printResponse = false, this.proxyAwareConnection = false, }) : super(const ConnectionInitialState()) { + _connectionInformation = connectionInformation; + APIInitializer().initialize( api: api ?? BinaryAPI( @@ -37,8 +39,6 @@ class ConnectionCubit extends Cubit { _api = Injector()(); - _connectionInformation = connectionInformation; - _connect(_connectionInformation); _startKeepAliveTimer(); diff --git a/pubspec.yaml b/pubspec.yaml index 23c81842d6..0275e4b57b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,13 +24,14 @@ dependencies: meta: ^1.8.0 recase: ^4.0.0 rxdart: ^0.27.7 - device_info_plus: ^8.1.0 flutter_system_proxy: git: - url: git@github.com:BrowserStackCE/flutter_system_proxy.git - ref: main - package_info_plus: ^4.2.0 + url: https://github.com/BrowserStackCE/flutter_system_proxy.git + ref: v0.1.5 + package_info_plus: ^8.0.2 connectivity_plus: ^5.0.2 + web_socket_channel: ^3.0.1 + device_info_plus: ^10.1.2 dev_dependencies: bloc_test: ^9.1.1 @@ -38,6 +39,6 @@ dev_dependencies: build_config: ^1.0.0 build_runner: ^2.3.0 build_test: ^2.1.5 - json_schema2: ^2.0.2 + json_schema: ^5.2.0 path: ^1.8.0 test: ^1.19.5 diff --git a/setup.sh b/setup.sh index ce4197620e..b651bc347a 100755 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # symlink files from submodule to lib/basic_api/generated -ls binary-websocket-api/config/v3/**/{receive,send}.json | perl -lpe'my $base = s{^binary-websocket-api/config/v3/}{}r; my $target = "lib/basic_api/generated/" . ($base =~ s{/}{_}r); symlink "../../../$_" => $target or die "no luck with symlink on $_ - $!" unless -r $target' +ls bom-core/binary-websocket-api/config/v3/**/{receive,send}.json | perl -lpe'my $base = s{^bom-core/binary-websocket-api/config/v3/}{}r; my $target = "lib/basic_api/generated/" . ($base =~ s{/}{_}r); symlink "../../../$_" => $target or die "no luck with symlink on $_ - $!" unless -r $target' # copy manually added json files to lib/basic_api/generated if not already there # cp -n lib/basic_api/manually/*.json lib/basic_api/generated