diff --git a/android/app/build.gradle b/android/app/build.gradle index 1ebcf72..b2464c3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -12,6 +12,7 @@ if (flutterRoot == null) { } apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { @@ -24,7 +25,7 @@ android { defaultConfig { targetSdkVersion 27 - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + minSdkVersion 16 applicationId "com.dinect.checker" } @@ -35,13 +36,13 @@ android { } release { signingConfig signingConfigs.debug + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } flavorDimensions "checker" - // Не смог разобраться, как коомбинировать flavors в flutter при запуске - productFlavors { dinect { @@ -174,16 +175,9 @@ android { buildConfigField "boolean", "showBonus", "true" } } - - sourceSets { - - main.jniLibs.srcDir 'jniLibs' - - pip { - res.srcDirs = ['src/pip/res'] - manifest.srcFile 'src/pip/AndroidManifest.xml' - } - + compileOptions { + targetCompatibility 1.8 + sourceCompatibility 1.8 } } @@ -192,9 +186,22 @@ flutter { } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:appcompat-v7:27.1.0' - compile 'com.squareup.okhttp3:okhttp:3.8.1' - compile 'com.squareup.okio:okio:1.13.0' - compile 'me.dm7.barcodescanner:zxing:1.9.8' + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support:recyclerview-v7:27.1.1' + implementation 'com.google.firebase:firebase-core:15.0.0' + implementation 'com.google.firebase:firebase-crash:15.0.0' + implementation 'com.android.support:support-v4:27.1.1' + implementation 'com.android.support:support-media-compat:27.1.1' + implementation 'com.squareup.okhttp3:okhttp:3.9.0' + implementation 'com.squareup.okio:okio:1.13.0' + implementation 'me.dm7.barcodescanner:zxing:1.9.8' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} + + +apply plugin: 'com.google.gms.google-services' + +repositories { + mavenCentral() } diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000..0c3fb8c --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,363 @@ +{ + "project_info": { + "project_number": "930872418262", + "firebase_url": "https://choker-d8897.firebaseio.com", + "project_id": "choker-d8897", + "storage_bucket": "choker-d8897.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:5a64db21df36f8f2", + "android_client_info": { + "package_name": "com.dinect.checker.autoclub" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-26ligstlb75a1s453r8t79l2jc0hk0ak.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.dinect.checker.autoclub", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:7889aafb1e16814e", + "android_client_info": { + "package_name": "com.dinect.checker.int" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-as5veeoulblnv8pc53u60s4isd0m4qll.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.dinect.checker.int", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:5525e12f52441ac8", + "android_client_info": { + "package_name": "com.dinect.checker.ote" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-n3rv7njq92gddlji1cp1bljcntao2r2k.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.dinect.checker.ote", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:39049aaa560f7f4b", + "android_client_info": { + "package_name": "com.dinect.checker.pip" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-id10iejb9f87vs1qt8lbtiq6oue2v1co.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.dinect.checker.pip", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:5b51a93686bedd68", + "android_client_info": { + "package_name": "com.dinect.checker.staging" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-3kldujcmf26hmhssefj8qqvt7hbfv4ro.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.dinect.checker.staging", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:17854c6d56c76a29", + "android_client_info": { + "package_name": "com.dinect.checker.testing" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-0rtlks627b91ve32alkgpoondelhmciv.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.dinect.checker.testing", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:ac7262e14afe8c26", + "android_client_info": { + "package_name": "com.joys.checker.crypto" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-rh2es35igpv1d0i2caj21oac56ieqhnb.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.joys.checker.crypto", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:930872418262:android:1989d1b101c854c1", + "android_client_info": { + "package_name": "ru.fivefit.biochecker" + } + }, + "oauth_client": [ + { + "client_id": "930872418262-5qmhf3e05a16ndhkj7jsv6qb7t6ut081.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "ru.fivefit.biochecker", + "certificate_hash": "26e013fe8b305ca736d5513db6281fb3b43a3e30" + } + }, + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCh7I1Za0MfKMN2EnsYYEO_hSW4RTkqfFk" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 2, + "other_platform_oauth_client": [ + { + "client_id": "930872418262-uv19fji9j1p16hjstr06jt5ec7joq4kp.apps.googleusercontent.com", + "client_type": 3 + } + ] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/jniLibs/armeabi-v7a/libiconv.so b/android/app/jniLibs/armeabi-v7a/libiconv.so deleted file mode 100644 index 2bcbb70..0000000 Binary files a/android/app/jniLibs/armeabi-v7a/libiconv.so and /dev/null differ diff --git a/android/app/jniLibs/armeabi-v7a/libzbarjni.so b/android/app/jniLibs/armeabi-v7a/libzbarjni.so deleted file mode 100644 index 2693dbb..0000000 Binary files a/android/app/jniLibs/armeabi-v7a/libzbarjni.so and /dev/null differ diff --git a/android/app/jniLibs/armeabi/libiconv.so b/android/app/jniLibs/armeabi/libiconv.so deleted file mode 100644 index 9c7150d..0000000 Binary files a/android/app/jniLibs/armeabi/libiconv.so and /dev/null differ diff --git a/android/app/jniLibs/armeabi/libzbarjni.so b/android/app/jniLibs/armeabi/libzbarjni.so deleted file mode 100644 index 3d4a8ac..0000000 Binary files a/android/app/jniLibs/armeabi/libzbarjni.so and /dev/null differ diff --git a/android/app/jniLibs/x86/libiconv.so b/android/app/jniLibs/x86/libiconv.so deleted file mode 100644 index 6ab43e5..0000000 Binary files a/android/app/jniLibs/x86/libiconv.so and /dev/null differ diff --git a/android/app/jniLibs/x86/libzbarjni.so b/android/app/jniLibs/x86/libzbarjni.so deleted file mode 100644 index d64f517..0000000 Binary files a/android/app/jniLibs/x86/libzbarjni.so and /dev/null differ diff --git a/android/app/libs/zbar.jar b/android/app/libs/zbar.jar deleted file mode 100644 index 7d50b95..0000000 Binary files a/android/app/libs/zbar.jar and /dev/null differ diff --git a/android/app/src/biohacker/web_hi_res_512.png b/android/app/src/biohacker/web_hi_res_512.png deleted file mode 100644 index 473d89d..0000000 Binary files a/android/app/src/biohacker/web_hi_res_512.png and /dev/null differ diff --git a/android/app/src/crypto/ic_launcher-web.png b/android/app/src/crypto/ic_launcher-web.png deleted file mode 100644 index f6c630e..0000000 Binary files a/android/app/src/crypto/ic_launcher-web.png and /dev/null differ diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6b1e77d..0f491a0 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -4,10 +4,6 @@ android:versionCode="13" android:versionName="1.1.18"> - - - - - diff --git a/android/build.gradle b/android/build.gradle index 6331892..c19783c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,34 +1,36 @@ buildscript { - repositories { - jcenter() - google() - } + ext.kotlin_version = '1.2.40' + repositories { + jcenter() + google() + } - dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + dependencies { + classpath 'com.android.tools.build:gradle:3.1.1' + classpath('com.google.gms:google-services:3.2.0') { + exclude group: 'com.google.guava', module: 'guava-jdk5' } + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } } allprojects { - repositories { - jcenter() - google() - maven { - url "https://maven.google.com" - } - } + repositories { + jcenter() + google() + } } rootProject.buildDir = '../build' subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" - project.evaluationDependsOn(':app') + project.buildDir = "${rootProject.buildDir}/${project.name}" + project.evaluationDependsOn(':app') } task clean(type: Delete) { - delete rootProject.buildDir + delete rootProject.buildDir } task wrapper(type: Wrapper) { - gradleVersion = '2.14.1' + gradleVersion = '2.14.1' } diff --git a/assets/values-en/strings.xml b/assets/values-en/strings.xml index 4fcff21..9bbc2b5 100644 --- a/assets/values-en/strings.xml +++ b/assets/values-en/strings.xml @@ -120,4 +120,13 @@ To improve barcode scanning quality, adjust the distance between the camera and Joys was charged Joys to charge Phone + + Откройте Настройки. + Найдите пункт Приложения. + В появившемся списке выберите %s. + На открывшейся странице выберите строчку Разрешения. + Поставьте галочку напротив слова Камера + Вернитесь к приложению %s. + + Открыть настройки diff --git a/assets/values-es/strings.xml b/assets/values-es/strings.xml index 4ffb2ee..7e183f6 100644 --- a/assets/values-es/strings.xml +++ b/assets/values-es/strings.xml @@ -116,4 +116,13 @@ Hay que poner el dibujo del codigo de tarjeta en cámara del escanear totalmente Joys fueron insumido ¿Cuántas Joys hay que insumir? Número de teléfono + + Откройте Настройки. + Найдите пункт Приложения. + В появившемся списке выберите %s. + На открывшейся странице выберите строчку Разрешения. + Поставьте галочку напротив слова Камера + Вернитесь к приложению %s. + + Открыть настройки diff --git a/assets/values-ru/strings.xml b/assets/values-ru/strings.xml index e0e6c38..ec2bd8b 100644 --- a/assets/values-ru/strings.xml +++ b/assets/values-ru/strings.xml @@ -119,4 +119,13 @@ Joys было списано Joys списать Телефон + + Откройте Настройки. + Найдите пункт Приложения. + В появившемся списке выберите %s. + На открывшейся странице выберите строчку Разрешения. + Поставьте галочку напротив слова Камера + Вернитесь к приложению %s. + + Открыть настройки diff --git a/assets/values-ua/strings.xml b/assets/values-ua/strings.xml index e59ed49..a0f60d6 100644 --- a/assets/values-ua/strings.xml +++ b/assets/values-ua/strings.xml @@ -121,4 +121,13 @@ Joys списано Скільки Joys списати? Телефон + + Откройте Настройки. + Найдите пункт Приложения. + В появившемся списке выберите %s. + На открывшейся странице выберите строчку Разрешения. + Поставьте галочку напротив слова Камера + Вернитесь к приложению %s. + + Открыть настройки diff --git a/lib/common.dart b/lib/common.dart index 7cc001c..532acd1 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:checker/screens/faq.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:image_picker/image_picker.dart'; import 'db.dart'; import 'strings.dart'; @@ -51,8 +50,3 @@ getLocaleTitle(String code) { return 'Español'; } } - -// Добавил вызов, что-бы AOT компилер не выкинул либу. -getImage() async { - return await ImagePicker.pickImage(); -} diff --git a/lib/db.dart b/lib/db.dart index 66711c7..3db1ace 100644 --- a/lib/db.dart +++ b/lib/db.dart @@ -37,14 +37,14 @@ class SqliteHelper { db = await openDatabase(path, version: 1, onCreate: (Database db, int version) async { - await db.execute('''create table $tableSession ( + await db.execute('''create table $tableSession ( $columnMerchantID text primary key, - $columnToken text, + $columnToken text, $columnPosID text, $columnDocID integer)'''); - await db.execute('''create table $tableSettings ( - $columnCurrency integer, + await db.execute('''create table $tableSettings ( + $columnCurrency integer, $columnLocale text)'''); }); } @@ -52,14 +52,12 @@ class SqliteHelper { /// Создается запись в таблице, содержащая /// необходимые для идентификации пользователя и проведения запросов. Future createSession(String merchantID, String posID, String token) async { - Map session = { columnMerchantID: merchantID, columnPosID: posID, columnToken: token, columnDocID: 0 }; - return db.insert(tableSession, session); } @@ -109,7 +107,8 @@ class SqliteHelper { Future getPosID() async { Map session = await selectAll(tableSession); - return session != null ? session[columnPosID] : new DateTime.now().millisecondsSinceEpoch.toString(); + String time = new DateTime.now().millisecondsSinceEpoch.toString(); + return session != null ? session[columnPosID] : time; } Future getDocID() async { diff --git a/lib/main.dart b/lib/main.dart index 0c5ab5f..08c6b2b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,21 +1,16 @@ +import 'dart:core'; import 'package:checker/db.dart'; import 'package:checker/strings.dart'; import 'package:flutter/material.dart'; import 'package:checker/screens/splash.dart'; -import 'package:flutter/services.dart'; - -const platform = const MethodChannel('com.dinect.checker/instance_id'); +import 'package:checker/common.dart'; main() { - platform.invokeMethod('getFlavor').then((flavor) { platform.invokeMethod('getAppTitle').then((title) { - - String app = flavor; // dinect, autobonus - String appName= title; // Dinect, Dinect (INT), Autobonus - + String app = flavor; // dinect, autobonus + String appName = title; // Dinect, Dinect (INT), Autobonus SqliteHelper helper = new SqliteHelper(); - helper.open().then((_) { helper.getLocale().then((locale) { if (locale == null) { @@ -23,13 +18,22 @@ main() { } else { start(app, appName, locale, helper); } + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); } -initWithSystemValue(String app, String name, String locale, SqliteHelper helper) { +initWithSystemValue(String app, String name, String locale, + SqliteHelper helper) { helper.getSettings(false).then((settings) { if (settings.isEmpty) { createSettingsTable(app, name, helper); @@ -44,7 +48,11 @@ createSettingsTable(String app, String name, SqliteHelper helper) { platform.invokeMethod('getCurrency').then((currency) { helper.createAppInfo(currency, locale).then((_) { start(app, name, locale, helper); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); }); } @@ -64,10 +72,11 @@ class Checker extends StatefulWidget { Checker(this.app, this.appName, this.helper); @override - State createState() => new CheckerState( - this.app, - this.appName, - this.helper); + State createState() => + new CheckerState( + this.app, + this.appName, + this.helper); } class CheckerState extends State { @@ -81,8 +90,8 @@ class CheckerState extends State { @override Widget build(BuildContext context) { return new MaterialApp( - title: appName, - home: new SplashScreen(helper, app) + title: appName, + home: new SplashScreen(helper, app) ); } } diff --git a/lib/screens/currencies.dart b/lib/screens/currencies.dart index 2efe4db..3b0feea 100644 --- a/lib/screens/currencies.dart +++ b/lib/screens/currencies.dart @@ -50,4 +50,4 @@ class _CurrenciesState extends SettingsBaseState { saveOption() async { await helper.saveCurrency(currencies[selectedItem]); } -} \ No newline at end of file +} diff --git a/lib/screens/finish_registration.dart b/lib/screens/finish_registration.dart index a0e8832..ea2a5bd 100644 --- a/lib/screens/finish_registration.dart +++ b/lib/screens/finish_registration.dart @@ -79,9 +79,10 @@ class RegistrationScreenState extends BaseState { setState(() { _tokenActive = JSON.decode(response.body)['active']; }); - }).catchError((error) { - print(error.toString()); - return false; + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}).then((_) { + return false; + }); }); }); } diff --git a/lib/screens/registration.dart b/lib/screens/registration.dart index 300c177..8bc2fe1 100644 --- a/lib/screens/registration.dart +++ b/lib/screens/registration.dart @@ -123,8 +123,8 @@ class RegistrationScreenState extends BaseState { error = parsedMap['errors'][0]; }); } - }).catchError((error) { - print(error.toString()); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); } } diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 3491441..aaf2785 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -191,9 +191,10 @@ class SettingsState extends BaseState { helper.clear().then((result) { Navigator.of(context).pop(''); }); - }).catchError((error) { - print(error.toString()); - Navigator.of(context).pop(''); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}).then((_) { + Navigator.of(context).pop(''); + }); }); }); } diff --git a/lib/screens/splash.dart b/lib/screens/splash.dart index a099884..3ac36bb 100644 --- a/lib/screens/splash.dart +++ b/lib/screens/splash.dart @@ -83,9 +83,10 @@ class _SplashScreenState extends BaseState { } else if (token != null) { _initAndStartScanner(context, app, token, helper); } else { - print('Произошла непредусмотренная ошибка в логике приложения'); - helper.getToken().then((token) { - _initAndStartScanner(context, app, token, helper); + platform.invokeMethod('logError', {"message":"Token is null"}).then((_) { + helper.getToken().then((token) { + _initAndStartScanner(context, app, token, helper); + }); }); } }); @@ -103,8 +104,8 @@ class _SplashScreenState extends BaseState { if (await platform.invokeMethod('isOnline')) { getCheckTokenStatusRequest(token).then((statusResponse) { handleStatusResponse(statusResponse, helper); - }).catchError((error) { - print(error.toString()); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); } } @@ -153,8 +154,8 @@ class _SplashScreenState extends BaseState { } else if (response.statusCode == 201) { clearToken(response, helper); } - }).catchError((error) { - print(error.toString()); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); } @@ -164,9 +165,11 @@ class _SplashScreenState extends BaseState { Map parsedMap = JSON.decode(response.body); getDeleteTokenRequest(parsedMap['token']).then((_) { showNextScreen(new RegistrationScreen(helper, app)); - }).catchError((error) { - print(error.toString()); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); } @@ -257,7 +260,11 @@ class _SplashScreenState extends BaseState { .value .toString(); platform.invokeMethod('startScanner', args); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); + }, onError: (e) { + platform.invokeMethod('logError', {"message":e.toString()}); }); } }