diff --git a/android/app/build.gradle b/android/app/build.gradle index c1623e1..63be40d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -15,15 +15,15 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 25 - buildToolsVersion '25.0.0' + compileSdkVersion 27 + buildToolsVersion '27.0.3' lintOptions { disable 'InvalidPackage' } defaultConfig { - targetSdkVersion 21 + targetSdkVersion 27 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" applicationId "com.dinect.checker" } @@ -38,6 +38,8 @@ android { } } + flavorDimensions "checker" + // Не смог разобраться, как коомбинировать flavors в flutter при запуске productFlavors { @@ -53,7 +55,6 @@ android { buildConfigField "String", "appToken", "\"bdea0f3ba9034b688019a7cac753d1209e2b227f\"" buildConfigField "String", "appTitle", "\"Dinect\"" buildConfigField "boolean", "showBonus", "true" - } dinect_INT { @@ -67,7 +68,6 @@ android { buildConfigField "String", "appToken", "\"9fec83cdca38c357e6b65dbb17514cdd36bf2a08\"" buildConfigField "String", "appTitle", "\"Dinect (INT)\"" buildConfigField "boolean", "showBonus", "true" - } dinect_OTE { @@ -81,7 +81,6 @@ android { buildConfigField "String", "appToken", "\"9fec83cdca38c357e6b65dbb17514cdd36bf2a08\"" buildConfigField "String", "appTitle", "\"Dinect (OTE)\"" buildConfigField "boolean", "showBonus", "true" - } dinect_TESTING { @@ -95,7 +94,6 @@ android { buildConfigField "String", "appToken", "\"9fec83cdca38c357e6b65dbb17514cdd36bf2a08\"" buildConfigField "String", "appTitle", "\"Dinect (TESTING)\"" buildConfigField "boolean", "showBonus", "true" - } dinect_STAGING { @@ -109,7 +107,6 @@ android { buildConfigField "String", "appToken", "\"9fec83cdca38c357e6b65dbb17514cdd36bf2a08\"" buildConfigField "String", "appTitle", "\"Dinect (STAGING)\"" buildConfigField "boolean", "showBonus", "true" - } autobonus { @@ -149,7 +146,6 @@ android { buildConfigField "String", "appToken", "\"bdea0f3ba9034b688019a7cac753d1209e2b227f\"" buildConfigField "String", "appTitle", "\"Crypto Joys\"" buildConfigField "boolean", "showBonus", "true" - } develop { @@ -164,7 +160,6 @@ android { buildConfigField "String", "appTitle", "\"dinect (develop)\"" buildConfigField "boolean", "showBonus", "true" } - } sourceSets { @@ -185,7 +180,7 @@ flutter { dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:appcompat-v7:25.3.1' + 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' diff --git a/android/app/src/crypto/ic_launcher-web.png b/android/app/src/crypto/ic_launcher-web.png new file mode 100644 index 0000000..f6c630e Binary files /dev/null and b/android/app/src/crypto/ic_launcher-web.png differ diff --git a/android/app/src/crypto/res/drawable-v24/ic_launcher_foreground.xml b/android/app/src/crypto/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..54dfc49 --- /dev/null +++ b/android/app/src/crypto/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/android/app/src/crypto/res/drawable/ic_launcher_background.xml b/android/app/src/crypto/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/android/app/src/crypto/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/crypto/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/crypto/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..036d09b --- /dev/null +++ b/android/app/src/crypto/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/crypto/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/crypto/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..036d09b --- /dev/null +++ b/android/app/src/crypto/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/crypto/res/mipmap-hdpi/ic_launcher.png b/android/app/src/crypto/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..ef65a7d Binary files /dev/null and b/android/app/src/crypto/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/crypto/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/crypto/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..e1393bb Binary files /dev/null and b/android/app/src/crypto/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/crypto/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/crypto/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..276aa28 Binary files /dev/null and b/android/app/src/crypto/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/android/app/src/crypto/res/mipmap-mdpi/ic_launcher.png b/android/app/src/crypto/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..fd6e4ce Binary files /dev/null and b/android/app/src/crypto/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/crypto/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/crypto/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..e8c3cc4 Binary files /dev/null and b/android/app/src/crypto/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/crypto/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/crypto/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..e8c0743 Binary files /dev/null and b/android/app/src/crypto/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6302c3b Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..a27553e Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..edade61 Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..13ce90a Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..79378fb Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..ed79c54 Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..a70bcee Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..a9e7fae Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..73c080d Binary files /dev/null and b/android/app/src/crypto/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/crypto/res/values/ic_launcher_background.xml b/android/app/src/crypto/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..c5d5899 --- /dev/null +++ b/android/app/src/crypto/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/android/app/src/main/java/com/dinect/checker/AbstractScannerActivity.java b/android/app/src/main/java/com/dinect/checker/AbstractScannerActivity.java index be198ec..f8b5cc8 100644 --- a/android/app/src/main/java/com/dinect/checker/AbstractScannerActivity.java +++ b/android/app/src/main/java/com/dinect/checker/AbstractScannerActivity.java @@ -164,7 +164,9 @@ public abstract class AbstractScannerActivity extends AppCompatActivity impleme EditText manualInput = (EditText) findViewById(R.id.manual_input); // для удобства, чтоб не вводить постоянно руками при разработке -// manualInput.setText("4620011139016337050236302"); + +// manualInput.setText("9990010009012057060904229"); +// manualInput.setText("4620011139016337050236302"); manualInput.setHint(getIntent().getStringExtra("enter_manual")); manualInput.setOnEditorActionListener(new TextView.OnEditorActionListener() { diff --git a/android/app/src/main/java/com/dinect/checker/MainActivity.java b/android/app/src/main/java/com/dinect/checker/MainActivity.java index 3788dd6..9c48946 100644 --- a/android/app/src/main/java/com/dinect/checker/MainActivity.java +++ b/android/app/src/main/java/com/dinect/checker/MainActivity.java @@ -14,6 +14,12 @@ import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.plugins.GeneratedPluginRegistrant; +import android.support.v4.app.Fragment; +import android.Manifest; +import android.content.pm.PackageManager; +import android.support.v4.content.ContextCompat; +import android.support.v4.app.ActivityCompat; +import android.content.pm.PackageInfo; import java.util.*; @@ -94,12 +100,25 @@ public class MainActivity extends FlutterActivity { Log.d("kifio", call.method); finish(); break; + case "getVersionName": + result.success(getVersion()); + break; default: result.notImplemented(); break; } } + private String getVersion() { + try { + PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0); + return pInfo.versionName; + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + return ""; + } + } + private String getLanguage() { List availableLanguages = Arrays.asList("ru", "en"); if (availableLanguages.contains(Locale.getDefault().getLanguage())) { @@ -126,7 +145,11 @@ public class MainActivity extends FlutterActivity { } private void startScannerActivity() { - final int idx = getSharedPreferences("scanner", Context.MODE_PRIVATE).getInt(SCANNER_BACKEND_KEY, 0); + if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.CAMERA}, 101); + } else { + final int idx = getSharedPreferences("scanner", Context.MODE_PRIVATE).getInt( + SCANNER_BACKEND_KEY, 0); Intent cameraIntent = new Intent(MainActivity.this, SCANNER_BACKEND[idx]); for (Object key : mScannerArgs.keySet()) { @@ -139,6 +162,18 @@ public class MainActivity extends FlutterActivity { setLocale((String) mScannerArgs.get("localeCode")); startActivityForResult(cameraIntent, START_SCANNER_REQUEST_CODE); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, + String permissions[], int[] grantResults) { + if (requestCode == 101) { + if (grantResults.length > 0 + && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + startScannerActivity(); + } + } } @Override @@ -212,6 +247,10 @@ public class MainActivity extends FlutterActivity { } + public void getVersionName() { + + } + public void setStrings() { } diff --git a/android/app/src/main/java/com/kifio/checker/checker/MainActivity.java b/android/app/src/main/java/com/kifio/checker/checker/MainActivity.java deleted file mode 100644 index d9e165b..0000000 --- a/android/app/src/main/java/com/kifio/checker/checker/MainActivity.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.kifio.checker.checker; - -import android.os.Bundle; - -import io.flutter.app.FlutterActivity; -import io.flutter.plugins.GeneratedPluginRegistrant; - -public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); - } -} diff --git a/android/app/src/main/res/layout/a_zbar.xml b/android/app/src/main/res/layout/a_zbar.xml index 0fb2abb..f544a72 100644 --- a/android/app/src/main/res/layout/a_zbar.xml +++ b/android/app/src/main/res/layout/a_zbar.xml @@ -15,15 +15,13 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginBottom="56dp" - android:layout_weight="0.5" - android:background="#с0000000" /> + android:layout_weight="0.5"/> + android:layout_weight="0.5" /> diff --git a/android/build.gradle b/android/build.gradle index ebe4957..6331892 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,16 +1,18 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.0.1' } } allprojects { repositories { jcenter() + google() maven { url "https://maven.google.com" } diff --git a/assets/crypto_logo.png b/assets/crypto_logo.png new file mode 100644 index 0000000..a09666a Binary files /dev/null and b/assets/crypto_logo.png differ diff --git a/ios/Debug-Dinect-INT copy-Info.plist b/ios/Debug-Dinect-INT copy-Info.plist new file mode 100644 index 0000000..a73ac19 --- /dev/null +++ b/ios/Debug-Dinect-INT copy-Info.plist @@ -0,0 +1,53 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Dinect Crypto + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + checker + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0.11 + CFBundleSignature + ???? + CFBundleVersion + 16 + LSRequiresIPhoneOS + + NSCameraUsageDescription + Для работы сканнера штрихкодов + NSPhotoLibraryUsageDescription + Для работы сканнера штрихкодов + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/ios/Flutter/App.framework/App b/ios/Flutter/App.framework/App index a9577f0..9ad365c 100755 Binary files a/ios/Flutter/App.framework/App and b/ios/Flutter/App.framework/App differ diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee..e8efba1 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Flutter.framework/Flutter b/ios/Flutter/Flutter.framework/Flutter index 4f15f1b..4920183 100755 Binary files a/ios/Flutter/Flutter.framework/Flutter and b/ios/Flutter/Flutter.framework/Flutter differ diff --git a/ios/Flutter/Flutter.framework/Headers/Flutter.h b/ios/Flutter/Flutter.framework/Headers/Flutter.h index 5ce388d..939040c 100644 --- a/ios/Flutter/Flutter.framework/Headers/Flutter.h +++ b/ios/Flutter/Flutter.framework/Headers/Flutter.h @@ -8,6 +8,9 @@ /** BREAKING CHANGES: + February 28, 2018: Removed "initWithFLXArchive" and + "initWithFLXArchiveWithScriptSnapshot". + January 15, 2018: Marked "initWithFLXArchive" and "initWithFLXArchiveWithScriptSnapshot" as unavailable following the deprecation from December 11, 2017. Scheduled to be removed on February diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterDartProject.h b/ios/Flutter/Flutter.framework/Headers/FlutterDartProject.h index 7752ab9..65c8662 100644 --- a/ios/Flutter/Flutter.framework/Headers/FlutterDartProject.h +++ b/ios/Flutter/Flutter.framework/Headers/FlutterDartProject.h @@ -14,18 +14,6 @@ FLUTTER_EXPORT - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithFLXArchive:(NSURL*)archiveURL - dartMain:(NSURL*)dartMainURL - packages:(NSURL*)dartPackages NS_DESIGNATED_INITIALIZER - FLUTTER_UNAVAILABLE( - "This initializer is no longer available. See the deprecation message from " - "December 11, 2017 in Flutter.h. Instead, use [initWithFlutterAssets]."); - -- (instancetype)initWithFLXArchiveWithScriptSnapshot:(NSURL*)archiveURL NS_DESIGNATED_INITIALIZER - FLUTTER_UNAVAILABLE( - "This initializer is no longer available. See the deprecation message from " - "December 11, 2017 in Flutter.h. Instead, use [initWithFlutterAssetsWithScriptSnapshot]."); - - (instancetype)initWithFlutterAssets:(NSURL*)flutterAssetsURL dartMain:(NSURL*)dartMainURL packages:(NSURL*)dartPackages NS_DESIGNATED_INITIALIZER; diff --git a/ios/Flutter/Generated.xcconfig b/ios/Flutter/Generated.xcconfig index 9bd4244..fc9557a 100644 --- a/ios/Flutter/Generated.xcconfig +++ b/ios/Flutter/Generated.xcconfig @@ -1,9 +1,8 @@ // This is a generated file; do not edit or check into version control. -FLUTTER_ROOT=/Users/dinect/projects/flutter -FLUTTER_APPLICATION_PATH=/Users/dinect/projects/checker +FLUTTER_ROOT=/Users/kifio/flutter +FLUTTER_APPLICATION_PATH=/Users/kifio/Desktop/FlutterProjects/checker FLUTTER_TARGET=lib/main.dart -FLUTTER_BUILD_MODE=release +FLUTTER_BUILD_MODE=debug FLUTTER_BUILD_DIR=build SYMROOT=${SOURCE_ROOT}/../build/ios -FLUTTER_FRAMEWORK_DIR=/Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +FLUTTER_FRAMEWORK_DIR=/Users/kifio/flutter/bin/cache/artifacts/engine/ios diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee..399e934 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/app.flx b/ios/Flutter/app.flx index 44f86dd..4605962 100644 Binary files a/ios/Flutter/app.flx and b/ios/Flutter/app.flx differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index bbca80f..a099549 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -15,24 +15,24 @@ PODS: - ZXingObjC/All (3.2.2) DEPENDENCIES: - - Flutter (from `/Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release`) - - image_picker (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios`) - - path_provider (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios`) - - sqflite (from `/Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.6.2+2/ios`) + - Flutter (from `/Users/kifio/flutter/bin/cache/artifacts/engine/ios`) + - image_picker (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios`) + - path_provider (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios`) + - sqflite (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.2/ios`) - ZXingObjC (~> 3.2.2) EXTERNAL SOURCES: Flutter: - :path: /Users/dinect/projects/flutter/bin/cache/artifacts/engine/ios-release + :path: /Users/kifio/flutter/bin/cache/artifacts/engine/ios image_picker: - :path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios + :path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.5/ios path_provider: - :path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios + :path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.2/ios sqflite: - :path: /Users/dinect/.pub-cache/hosted/pub.dartlang.org/sqflite-0.6.2+2/ios + :path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/sqflite-0.8.2/ios SPEC CHECKSUMS: - Flutter: 7eb41cd1fd524b90d7f22bceb20da2c39338b089 + Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296 FMDB: 6198a90e7b6900cfc046e6bc0ef6ebb7be9236aa image_picker: ee00aab0487cedc80a304085219503cc6d0f2e22 path_provider: 09407919825bfe3c2deae39453b7a5b44f467873 diff --git a/ios/Runner copy-Info.plist b/ios/Runner copy-Info.plist new file mode 100644 index 0000000..f14d921 --- /dev/null +++ b/ios/Runner copy-Info.plist @@ -0,0 +1,53 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Autobonus + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + checker + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0.11 + CFBundleSignature + ???? + CFBundleVersion + 16 + LSRequiresIPhoneOS + + NSCameraUsageDescription + Для работы сканнера штрихкодов + NSPhotoLibraryUsageDescription + Для работы сканнера штрихкодов + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index bde9eac..5026e56 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0A215136DF169E20663D3326 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AC45BF661F9E3F97009713E2 /* libPods-Runner.a */; }; 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; ACE8612B1F9F745B006FEF38 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; ACE8612C1F9F745B006FEF38 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -30,6 +31,48 @@ ACE861441F9F745B006FEF38 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; ACE861461F9F745B006FEF38 /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; ACE861471F9F745B006FEF38 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + FB862E6620548D6C00C04986 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + FB862E6720548D6C00C04986 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + FB862E6820548D6C00C04986 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + FB862E6920548D6C00C04986 /* ScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA9BAFE1F176DD10053B6EA /* ScannerViewController.swift */; }; + FB862E6B20548D6C00C04986 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB601F179D270053B6EA /* libiconv.tbd */; }; + FB862E6C20548D6C00C04986 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB3B1F1792A90053B6EA /* QuartzCore.framework */; }; + FB862E6D20548D6C00C04986 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB391F17927C0053B6EA /* CoreVideo.framework */; }; + FB862E6E20548D6C00C04986 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB371F1792730053B6EA /* CoreAudio.framework */; }; + FB862E6F20548D6C00C04986 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB351F1792690053B6EA /* CoreMedia.framework */; }; + FB862E7020548D6C00C04986 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB331F17925F0053B6EA /* CoreGraphics.framework */; }; + FB862E7120548D6C00C04986 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB311F1792570053B6EA /* AVFoundation.framework */; }; + FB862E7220548D6C00C04986 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + FB862E7320548D6C00C04986 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + FB862E7520548D6C00C04986 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; + FB862E7620548D6C00C04986 /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; }; + FB862E7720548D6C00C04986 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + FB862E7820548D6C00C04986 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + FB862E7920548D6C00C04986 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + FB862E7A20548D6C00C04986 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + FB862E7C20548D6C00C04986 /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + FB862E7D20548D6C00C04986 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + FB8CCC16204C8249002BBFDA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + FB8CCC17204C8249002BBFDA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + FB8CCC18204C8249002BBFDA /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + FB8CCC19204C8249002BBFDA /* ScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA9BAFE1F176DD10053B6EA /* ScannerViewController.swift */; }; + FB8CCC1B204C8249002BBFDA /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB601F179D270053B6EA /* libiconv.tbd */; }; + FB8CCC1C204C8249002BBFDA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB3B1F1792A90053B6EA /* QuartzCore.framework */; }; + FB8CCC1D204C8249002BBFDA /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB391F17927C0053B6EA /* CoreVideo.framework */; }; + FB8CCC1E204C8249002BBFDA /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB371F1792730053B6EA /* CoreAudio.framework */; }; + FB8CCC1F204C8249002BBFDA /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB351F1792690053B6EA /* CoreMedia.framework */; }; + FB8CCC20204C8249002BBFDA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB331F17925F0053B6EA /* CoreGraphics.framework */; }; + FB8CCC21204C8249002BBFDA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB311F1792570053B6EA /* AVFoundation.framework */; }; + FB8CCC22204C8249002BBFDA /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + FB8CCC23204C8249002BBFDA /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + FB8CCC27204C8249002BBFDA /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; + FB8CCC28204C8249002BBFDA /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; }; + FB8CCC29204C8249002BBFDA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + FB8CCC2A204C8249002BBFDA /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + FB8CCC2B204C8249002BBFDA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + FB8CCC2C204C8249002BBFDA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + FB8CCC2E204C8249002BBFDA /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + FB8CCC2F204C8249002BBFDA /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -55,6 +98,50 @@ name = "Embed App Extensions"; runOnlyForDeploymentPostprocessing = 0; }; + FB862E7B20548D6C00C04986 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + FB862E7C20548D6C00C04986 /* App.framework in Embed Frameworks */, + FB862E7D20548D6C00C04986 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + FB862E7F20548D6C00C04986 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; + FB8CCC2D204C8249002BBFDA /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + FB8CCC2E204C8249002BBFDA /* App.framework in Embed Frameworks */, + FB8CCC2F204C8249002BBFDA /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + FB8CCC33204C8249002BBFDA /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -89,6 +176,10 @@ BBA9BB391F17927C0053B6EA /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; BBA9BB3B1F1792A90053B6EA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; BBA9BB601F179D270053B6EA /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; + FB862E8320548D6C00C04986 /* Dinect-Crypto.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Dinect-Crypto.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FB862E8420548D6C00C04986 /* Debug-Dinect-INT copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Debug-Dinect-INT copy-Info.plist"; path = "/Users/kifio/Desktop/FlutterProjects/checker/ios/Debug-Dinect-INT copy-Info.plist"; sourceTree = ""; }; + FB8CCC37204C824A002BBFDA /* Dinect-INT.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Dinect-INT.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FB8CCC38204C824A002BBFDA /* Runner copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Runner copy-Info.plist"; path = "/Users/kifio/Desktop/FlutterProjects/checker/ios/Runner copy-Info.plist"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -107,6 +198,39 @@ ACE861381F9F745B006FEF38 /* App.framework in Frameworks */, ACE8613A1F9F745B006FEF38 /* libPods-Runner.a in Frameworks */, ACE8613B1F9F745B006FEF38 /* libPods-Runner.a in Frameworks */, + 0A215136DF169E20663D3326 /* libPods-Runner.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FB862E6A20548D6C00C04986 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FB862E6B20548D6C00C04986 /* libiconv.tbd in Frameworks */, + FB862E6C20548D6C00C04986 /* QuartzCore.framework in Frameworks */, + FB862E6D20548D6C00C04986 /* CoreVideo.framework in Frameworks */, + FB862E6E20548D6C00C04986 /* CoreAudio.framework in Frameworks */, + FB862E6F20548D6C00C04986 /* CoreMedia.framework in Frameworks */, + FB862E7020548D6C00C04986 /* CoreGraphics.framework in Frameworks */, + FB862E7120548D6C00C04986 /* AVFoundation.framework in Frameworks */, + FB862E7220548D6C00C04986 /* Flutter.framework in Frameworks */, + FB862E7320548D6C00C04986 /* App.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FB8CCC1A204C8249002BBFDA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FB8CCC1B204C8249002BBFDA /* libiconv.tbd in Frameworks */, + FB8CCC1C204C8249002BBFDA /* QuartzCore.framework in Frameworks */, + FB8CCC1D204C8249002BBFDA /* CoreVideo.framework in Frameworks */, + FB8CCC1E204C8249002BBFDA /* CoreAudio.framework in Frameworks */, + FB8CCC1F204C8249002BBFDA /* CoreMedia.framework in Frameworks */, + FB8CCC20204C8249002BBFDA /* CoreGraphics.framework in Frameworks */, + FB8CCC21204C8249002BBFDA /* AVFoundation.framework in Frameworks */, + FB8CCC22204C8249002BBFDA /* Flutter.framework in Frameworks */, + FB8CCC23204C8249002BBFDA /* App.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -143,6 +267,8 @@ 97C146EF1CF9000F007C117D /* Products */, BBA9BB001F1786510053B6EA /* Frameworks */, 578B8FA7D56ACA2E56C02128 /* Pods */, + FB8CCC38204C824A002BBFDA /* Runner copy-Info.plist */, + FB862E8420548D6C00C04986 /* Debug-Dinect-INT copy-Info.plist */, ); sourceTree = ""; }; @@ -150,6 +276,8 @@ isa = PBXGroup; children = ( ACE861531F9F745B006FEF38 /* Runner.app */, + FB8CCC37204C824A002BBFDA /* Dinect-INT.app */, + FB862E8320548D6C00C04986 /* Dinect-Crypto.app */, ); name = Products; sourceTree = ""; @@ -225,6 +353,48 @@ productReference = ACE861531F9F745B006FEF38 /* Runner.app */; productType = "com.apple.product-type.application"; }; + FB862E6320548D6C00C04986 /* Dinect-Crypto */ = { + isa = PBXNativeTarget; + buildConfigurationList = FB862E8020548D6C00C04986 /* Build configuration list for PBXNativeTarget "Dinect-Crypto" */; + buildPhases = ( + FB862E6420548D6C00C04986 /* Run Script */, + FB862E6520548D6C00C04986 /* Sources */, + FB862E6A20548D6C00C04986 /* Frameworks */, + FB862E7420548D6C00C04986 /* Resources */, + FB862E7B20548D6C00C04986 /* Embed Frameworks */, + FB862E7E20548D6C00C04986 /* Thin Binary */, + FB862E7F20548D6C00C04986 /* Embed App Extensions */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Dinect-Crypto"; + productName = Runner; + productReference = FB862E8320548D6C00C04986 /* Dinect-Crypto.app */; + productType = "com.apple.product-type.application"; + }; + FB8CCC12204C8249002BBFDA /* Dinect-INT */ = { + isa = PBXNativeTarget; + buildConfigurationList = FB8CCC34204C8249002BBFDA /* Build configuration list for PBXNativeTarget "Dinect-INT" */; + buildPhases = ( + FB8CCC14204C8249002BBFDA /* Run Script */, + FB8CCC15204C8249002BBFDA /* Sources */, + FB8CCC1A204C8249002BBFDA /* Frameworks */, + FB8CCC26204C8249002BBFDA /* Resources */, + FB8CCC2D204C8249002BBFDA /* Embed Frameworks */, + FB8CCC30204C8249002BBFDA /* Thin Binary */, + FB8CCC33204C8249002BBFDA /* Embed App Extensions */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Dinect-INT"; + productName = Runner; + productReference = FB8CCC37204C824A002BBFDA /* Dinect-INT.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -244,6 +414,13 @@ }; }; }; + FB862E6320548D6C00C04986 = { + DevelopmentTeam = 926V94K5Q8; + ProvisioningStyle = Automatic; + }; + FB8CCC12204C8249002BBFDA = { + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; @@ -260,6 +437,8 @@ projectRoot = ""; targets = ( ACE861271F9F745B006FEF38 /* Runner */, + FB8CCC12204C8249002BBFDA /* Dinect-INT */, + FB862E6320548D6C00C04986 /* Dinect-Crypto */, ); }; /* End PBXProject section */ @@ -278,6 +457,32 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FB862E7420548D6C00C04986 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FB862E7520548D6C00C04986 /* flutter_assets in Resources */, + FB862E7620548D6C00C04986 /* app.flx in Resources */, + FB862E7720548D6C00C04986 /* LaunchScreen.storyboard in Resources */, + FB862E7820548D6C00C04986 /* AppFrameworkInfo.plist in Resources */, + FB862E7920548D6C00C04986 /* Assets.xcassets in Resources */, + FB862E7A20548D6C00C04986 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FB8CCC26204C8249002BBFDA /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FB8CCC27204C8249002BBFDA /* flutter_assets in Resources */, + FB8CCC28204C8249002BBFDA /* app.flx in Resources */, + FB8CCC29204C8249002BBFDA /* LaunchScreen.storyboard in Resources */, + FB8CCC2A204C8249002BBFDA /* AppFrameworkInfo.plist in Resources */, + FB8CCC2B204C8249002BBFDA /* Assets.xcassets in Resources */, + FB8CCC2C204C8249002BBFDA /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -334,7 +539,7 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../../../flutter/bin/cache/artifacts/engine/ios-release/Flutter.framework", + "${PODS_ROOT}/../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( @@ -360,6 +565,62 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; showEnvVarsInLog = 0; }; + FB862E6420548D6C00C04986 /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + FB862E7E20548D6C00C04986 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + FB8CCC14204C8249002BBFDA /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + FB8CCC30204C8249002BBFDA /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -374,6 +635,28 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + FB862E6520548D6C00C04986 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FB862E6620548D6C00C04986 /* AppDelegate.m in Sources */, + FB862E6720548D6C00C04986 /* main.m in Sources */, + FB862E6820548D6C00C04986 /* GeneratedPluginRegistrant.m in Sources */, + FB862E6920548D6C00C04986 /* ScannerViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FB8CCC15204C8249002BBFDA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FB8CCC16204C8249002BBFDA /* AppDelegate.m in Sources */, + FB8CCC17204C8249002BBFDA /* main.m in Sources */, + FB8CCC18204C8249002BBFDA /* GeneratedPluginRegistrant.m in Sources */, + FB8CCC19204C8249002BBFDA /* ScannerViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ @@ -572,6 +855,152 @@ }; name = Release; }; + FB862E8120548D6C00C04986 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = crypto; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 926V94K5Q8; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = "Debug-Dinect-INT copy-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.dinect.checker.crypto; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "Autobonus-Swift.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + FB862E8220548D6C00C04986 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = crypto; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 926V94K5Q8; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = "Debug-Dinect-INT copy-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.dinect.checker.crypto; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "Autobonus-Swift.h"; + SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = 1; + VALID_ARCHS = "arm64 arm7 armv7s"; + }; + name = Release; + }; + FB8CCC35204C8249002BBFDA /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Checker-INT"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = "Runner copy-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.dinect.develop-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "Autobonus-Swift.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + FB8CCC36204C8249002BBFDA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Checker-INT"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = "Runner copy-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.dinect.develop-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "Autobonus-Swift.h"; + SWIFT_VERSION = 3.0; + TARGETED_DEVICE_FAMILY = 1; + VALID_ARCHS = "arm64 arm7 armv7s"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -593,6 +1022,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FB862E8020548D6C00C04986 /* Build configuration list for PBXNativeTarget "Dinect-Crypto" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FB862E8120548D6C00C04986 /* Debug */, + FB862E8220548D6C00C04986 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FB8CCC34204C8249002BBFDA /* Build configuration list for PBXNativeTarget "Dinect-INT" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FB8CCC35204C8249002BBFDA /* Debug */, + FB8CCC36204C8249002BBFDA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Dinect INT.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Dinect INT.xcscheme new file mode 100644 index 0000000..e49ac52 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Dinect INT.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Dinect-Crypto.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Dinect-Crypto.xcscheme new file mode 100644 index 0000000..d8c6997 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Dinect-Crypto.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcodeproj/xcuserdata/kifio.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/Runner.xcodeproj/xcuserdata/kifio.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..9649f80 --- /dev/null +++ b/ios/Runner.xcodeproj/xcuserdata/kifio.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,37 @@ + + + + + SchemeUserState + + Dinect INT.xcscheme_^#shared#^_ + + orderHint + 1 + + Dinect-Crypto.xcscheme_^#shared#^_ + + orderHint + 8 + + Runner.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + FB862E6320548D6C00C04986 + + primary + + + FB8CCC12204C8249002BBFDA + + primary + + + + + diff --git a/ios/Runner.xcworkspace/xcuserdata/kifio.xcuserdatad/UserInterfaceState.xcuserstate b/ios/Runner.xcworkspace/xcuserdata/kifio.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..d053612 Binary files /dev/null and b/ios/Runner.xcworkspace/xcuserdata/kifio.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m index 9cd89dd..51fa019 100644 --- a/ios/Runner/AppDelegate.m +++ b/ios/Runner/AppDelegate.m @@ -15,9 +15,9 @@ binaryMessenger:controller]; __weak FlutterMethodChannel* weekPlatformChannel = platformChannel; - + NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; - + NSDictionary *settings = @{ @"com.dinect.checker.dinect" : @{ @"locale" : @"ru", @@ -32,13 +32,13 @@ }, @"com.dinect.develop-iOS" : @{ @"locale" : @"ru", - @"flavor" : @"autobonus", + @"flavor" : @"dinect", @"currency" : @643, @"supportPhone" : @"support@dinect.com", @"supportUrl" : @"http://yandex.ru", @"endPoint" : @"https://pos-api-int.dinect.com/20130701/", @"appToken" : @"9fec83cdca38c357e6b65dbb17514cdd36bf2a08", - @"appTitle" : @"Autobonus (develop)", + @"appTitle" : @"Dinect (INT)", @"showBonus" : @YES, }, @"com.dinect.checker.autoclub.app" : @{ @@ -74,23 +74,28 @@ @"appTitle" : @"PIP", @"showBonus" : @YES, }, - + @"com.dinect.checker.crypto" : @{ + @"locale" : @"ru", + @"flavor" : @"crypto", + @"currency" : @643, + @"supportPhone" : @"8-800-77-55-032", + @"supportUrl" : @"http://www.dinect.com", + @"endPoint" : @"https://pos-api-int.dinect.com/20130701/", + @"appToken" : @"9fec83cdca38c357e6b65dbb17514cdd36bf2a08", + @"appTitle" : @"Dinect Crypto", + @"showBonus" : @NO, + }, }; - + NSDictionary *buildSettings = settings[bundleIdentifier]; - - NSLog(@"%@", bundleIdentifier); - + if (!buildSettings) { NSLog(@"Settings for this bunndle id not defined (%@)", bundleIdentifier); abort(); } - [platformChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { NSLog(@"%@", call.method); - - NSLog(@"%@", buildSettings[@"supportPhone"]); if ([@"getLocale" isEqualToString:call.method]) { result(buildSettings[@"locale"]); @@ -104,19 +109,21 @@ [controller presentViewController:modalViewController animated:YES completion:nil]; } else if ([@"isOnline" isEqualToString:call.method]) { result(@YES); - } else if ([@"getSupportPhone" isEqualToString:call.method]) { + } else if ([@"getSupportPhone" isEqualToString:call.method]) { result(buildSettings[@"supportPhone"]); } else if ([@"getSupportUrl" isEqualToString:call.method]) { result(buildSettings[@"supportUrl"]); - } else if ([@"getEndpoint" isEqualToString:call.method]) { + } else if ([@"getEndpoint" isEqualToString:call.method]) { result(buildSettings[@"endPoint"]); - } else if ([@"getAppToken" isEqualToString:call.method]) { + } else if ([@"getAppToken" isEqualToString:call.method]) { result(buildSettings[@"appToken"]); - } else if ([@"getAppTitle" isEqualToString:call.method]) { + } else if ([@"getAppTitle" isEqualToString:call.method]) { result(buildSettings[@"appTitle"]); - } else if ([@"showBonus" isEqualToString:call.method]) { + } else if ([@"showBonus" isEqualToString:call.method]) { result(buildSettings[@"showBonus"]); - } else { + } else if ([@"getVersionName" isEqualToString:call.method]) { + result([[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"]); + } else { result(FlutterMethodNotImplemented); } diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/Contents.json new file mode 100644 index 0000000..bf3132b --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/Contents.json @@ -0,0 +1,90 @@ +{ + "author" : "Iconizer", + "version" : "1.0", + "images" : [ + { + "size" : "1024x1024", + "filename" : "ios-marketing.png", + "expected-size" : "1024", + "idiom" : "ios-marketing", + "scale" : "1x" + }, + { + "size" : "60x60", + "filename" : "iphone-appicon@3x.png", + "expected-size" : "180", + "idiom" : "iphone", + "scale" : "3x" + }, + { + "size" : "40x40", + "filename" : "iphone-spotlight@2x.png", + "expected-size" : "80", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "40x40", + "filename" : "iphone-spotlight@3x.png", + "expected-size" : "120", + "idiom" : "iphone", + "scale" : "3x" + }, + { + "size" : "60x60", + "filename" : "iphone-appicon@2x.png", + "expected-size" : "120", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "57x57", + "filename" : "iphone-oldAppicon@1x.png", + "expected-size" : "57", + "idiom" : "iphone", + "scale" : "1x" + }, + { + "size" : "29x29", + "filename" : "iphone-settings@2x.png", + "expected-size" : "58", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "29x29", + "filename" : "iphone-settings@1x.png", + "expected-size" : "29", + "idiom" : "iphone", + "scale" : "1x" + }, + { + "size" : "29x29", + "filename" : "iphone-settings@3x.png", + "expected-size" : "87", + "idiom" : "iphone", + "scale" : "3x" + }, + { + "size" : "57x57", + "filename" : "iphone-oldAppicon@2x.png", + "expected-size" : "114", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "20x20", + "filename" : "iphone-notification@2x.png", + "expected-size" : "40", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "20x20", + "filename" : "iphone-notification@3x.png", + "expected-size" : "60", + "idiom" : "iphone", + "scale" : "3x" + } + ] +} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/ios-marketing.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/ios-marketing.png new file mode 100644 index 0000000..15eb92a Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/ios-marketing.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-appicon@2x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-appicon@2x.png new file mode 100644 index 0000000..730ec25 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-appicon@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-appicon@3x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-appicon@3x.png new file mode 100644 index 0000000..3df68a1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-appicon@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-notification@2x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-notification@2x.png new file mode 100644 index 0000000..5154e60 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-notification@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-notification@3x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-notification@3x.png new file mode 100644 index 0000000..50942dc Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-notification@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-oldAppicon@1x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-oldAppicon@1x.png new file mode 100644 index 0000000..f668eea Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-oldAppicon@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-oldAppicon@2x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-oldAppicon@2x.png new file mode 100644 index 0000000..d8cb671 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-oldAppicon@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@1x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@1x.png new file mode 100644 index 0000000..7469fe2 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@2x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@2x.png new file mode 100644 index 0000000..6b13427 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@3x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@3x.png new file mode 100644 index 0000000..ad0fe9d Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-settings@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-spotlight@2x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-spotlight@2x.png new file mode 100644 index 0000000..a26cdd9 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-spotlight@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-spotlight@3x.png b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-spotlight@3x.png new file mode 100644 index 0000000..730ec25 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon-Checker-INT.appiconset/iphone-spotlight@3x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/Contents.json b/ios/Runner/Assets.xcassets/crypto.appiconset/Contents.json new file mode 100644 index 0000000..bf3132b --- /dev/null +++ b/ios/Runner/Assets.xcassets/crypto.appiconset/Contents.json @@ -0,0 +1,90 @@ +{ + "author" : "Iconizer", + "version" : "1.0", + "images" : [ + { + "size" : "1024x1024", + "filename" : "ios-marketing.png", + "expected-size" : "1024", + "idiom" : "ios-marketing", + "scale" : "1x" + }, + { + "size" : "60x60", + "filename" : "iphone-appicon@3x.png", + "expected-size" : "180", + "idiom" : "iphone", + "scale" : "3x" + }, + { + "size" : "40x40", + "filename" : "iphone-spotlight@2x.png", + "expected-size" : "80", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "40x40", + "filename" : "iphone-spotlight@3x.png", + "expected-size" : "120", + "idiom" : "iphone", + "scale" : "3x" + }, + { + "size" : "60x60", + "filename" : "iphone-appicon@2x.png", + "expected-size" : "120", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "57x57", + "filename" : "iphone-oldAppicon@1x.png", + "expected-size" : "57", + "idiom" : "iphone", + "scale" : "1x" + }, + { + "size" : "29x29", + "filename" : "iphone-settings@2x.png", + "expected-size" : "58", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "29x29", + "filename" : "iphone-settings@1x.png", + "expected-size" : "29", + "idiom" : "iphone", + "scale" : "1x" + }, + { + "size" : "29x29", + "filename" : "iphone-settings@3x.png", + "expected-size" : "87", + "idiom" : "iphone", + "scale" : "3x" + }, + { + "size" : "57x57", + "filename" : "iphone-oldAppicon@2x.png", + "expected-size" : "114", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "20x20", + "filename" : "iphone-notification@2x.png", + "expected-size" : "40", + "idiom" : "iphone", + "scale" : "2x" + }, + { + "size" : "20x20", + "filename" : "iphone-notification@3x.png", + "expected-size" : "60", + "idiom" : "iphone", + "scale" : "3x" + } + ] +} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/ios-marketing.png b/ios/Runner/Assets.xcassets/crypto.appiconset/ios-marketing.png new file mode 100644 index 0000000..cc4c7c4 Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/ios-marketing.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-appicon@2x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-appicon@2x.png new file mode 100644 index 0000000..caa913e Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-appicon@2x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-appicon@3x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-appicon@3x.png new file mode 100644 index 0000000..2fd2200 Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-appicon@3x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-notification@2x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-notification@2x.png new file mode 100644 index 0000000..8f4a506 Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-notification@2x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-notification@3x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-notification@3x.png new file mode 100644 index 0000000..1a965ab Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-notification@3x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-oldAppicon@1x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-oldAppicon@1x.png new file mode 100644 index 0000000..f4da0aa Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-oldAppicon@1x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-oldAppicon@2x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-oldAppicon@2x.png new file mode 100644 index 0000000..13e4220 Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-oldAppicon@2x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@1x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@1x.png new file mode 100644 index 0000000..1078ade Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@1x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@2x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@2x.png new file mode 100644 index 0000000..4470b72 Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@2x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@3x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@3x.png new file mode 100644 index 0000000..63868c8 Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-settings@3x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-spotlight@2x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-spotlight@2x.png new file mode 100644 index 0000000..ae4caad Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-spotlight@2x.png differ diff --git a/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-spotlight@3x.png b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-spotlight@3x.png new file mode 100644 index 0000000..caa913e Binary files /dev/null and b/ios/Runner/Assets.xcassets/crypto.appiconset/iphone-spotlight@3x.png differ diff --git a/ios/Runner/ScannerViewController.swift b/ios/Runner/ScannerViewController.swift index fd381fc..f1aba55 100644 --- a/ios/Runner/ScannerViewController.swift +++ b/ios/Runner/ScannerViewController.swift @@ -61,15 +61,22 @@ import Flutter func getInputHint() -> String { switch self.buttonState { - case .card: return strings["enter_manual"]! - case .phone: return strings["enter_phone"]! + case .card: return strings["enter_manual"]! + case .phone: return strings["enter_phone"]! } } func getErrorText() -> String { switch self.buttonState { - case .card: return strings["user_card_not_found"]! - case .phone: return strings["user_phone_not_found"]! + case .card: return strings["user_card_not_found"]! + case .phone: return strings["user_phone_not_found"]! + } + } + + func setButtonState() { + switch self.buttonState { + case .card: self.buttonState = .phone + case .phone: self.buttonState = .card } } @@ -97,7 +104,7 @@ import Flutter settingButton.setImage(self.buttonState.icon, for: .normal) textField.placeholder = self.getInputHint() - + textField.text = "79087654321" } override func viewWillAppear(_ animated: Bool) { @@ -121,35 +128,29 @@ import Flutter } func buttonTouch(){ - - switch self.buttonState { - case .card: self.buttonState = .phone - case .phone: self.buttonState = .card - } + setButtonState() settingButton.setImage(self.buttonState.icon, for: .normal) textField.placeholder = self.getInputHint() } func textFieldShouldReturn(_ textField: UITextField) -> Bool { - + print("User from manual input: \(textField.text)") sendResult(textField.text!) - return true } func sendResult(_ str: String) { platformChannel?.invokeMethod("findUser", arguments: [str, buttonState.searchType], result: { (result: Any?) in if result is FlutterError { + print("Result is nil (ios code)"); self.showErrorAlert(str) } else { - + print("Result is not nil (ios code)"); self.dismiss(animated: true) { self.platformChannel?.invokeMethod("purchase", arguments: [result, str]) } } - print("result: \(result.debugDescription )") }) - } func showErrorAlert(_ str: String) { @@ -296,8 +297,7 @@ import Flutter location = "\(location) (\(transformedPoint.x), \(transformedPoint.y))" points.append(windowPointValue) } - // We got a result. Display information about the result onscreen. - let formatString: String = barcodeFormat(toString: result.barcodeFormat) + print("User from scanner: \(result.text)") sendResult(result.text) print(result.text) self.capture.stop() diff --git a/lib/base/base_state.dart b/lib/base/base_state.dart index 827d7eb..33573c7 100644 --- a/lib/base/base_state.dart +++ b/lib/base/base_state.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:checker/resources.dart'; import 'package:flutter/material.dart'; @@ -7,6 +9,8 @@ import 'package:checker/screens/settings.dart'; import 'package:checker/screens/faq.dart'; import 'package:checker/strings.dart'; import 'package:checker/db.dart'; +import 'package:flutter/rendering.dart'; +import 'package:meta/meta.dart'; abstract class BaseState extends State { @@ -25,8 +29,10 @@ abstract class BaseState extends State { /// Введенное пользователем значение. String merchantID = ''; + BaseState(this.helper, this.app); + Widget getMainWidget() { - return app == null ? getBackground() : new Scaffold(appBar: getAppBar(), + return new Scaffold(appBar: getAppBar(), body: new Stack(children: [ getScreenContent(), new Center(child: loading ? new CircularProgressIndicator() : null) @@ -44,6 +50,8 @@ abstract class BaseState extends State { /// Возвращает контейнер с всеми виджетами экрана. Widget getScreenContent(); + bool isAutomaticallyImplyLeading(); + /// Возвращает заголовок для AppBar String getTitle() { return null; @@ -53,6 +61,7 @@ abstract class BaseState extends State { return new AppBar(title: new Container( margin: new EdgeInsets.only(left: 16.0), child: new Text(getTitle(), style: new TextStyle(fontSize: 18.0))), + automaticallyImplyLeading: isAutomaticallyImplyLeading(), backgroundColor: Resources.getPrimaryColor(app), actions: getMenuButtons()); } @@ -89,11 +98,21 @@ abstract class BaseState extends State { void onOptionsItemClick(int index) { switch (index) { case 0: { - pushRoute(context, new SettingsScreen(helper, app, false)); + new Future.delayed(const Duration(milliseconds: 200), () { + var route = new MaterialPageRoute(builder: (BuildContext context) => new SettingsScreen(helper, app, false), fullscreenDialog: true); + Navigator.of(context).push(route).then((token) { + if (token != null) { + Navigator.of(context).pop(token); + } + }); + }); break; } case 1: { - pushRoute(context, new FAQScreen(helper, app, false)); + new Future.delayed(const Duration(milliseconds: 200), () { + var route = new MaterialPageRoute(builder: (BuildContext context) => new FAQScreen(helper, app), fullscreenDialog: true); + Navigator.of(context).push(route); + }); break; } case 2: { @@ -275,8 +294,6 @@ abstract class BaseState extends State { return new Container(height: containerHeight, child: new Image.asset(Resources.getLogo(app), width: imageWidth)); } - - /// Возвращает текстовое поле, с однострочным пояснением над ним. Widget getValueWithDescription(String title, String value) { return new Container(padding: new EdgeInsets.only(left: verticalMargin, right: verticalMargin, top: 18.0), @@ -301,3 +318,84 @@ abstract class BaseState extends State { return new Container(margin: margin, height: buttonHeight, child: new Row(children: [new Expanded(child: widget)])); } } + +class EnsureVisibleWhenFocused extends StatefulWidget { + const EnsureVisibleWhenFocused({ + Key key, + @required this.child, + @required this.focusNode, + this.curve: Curves.ease, + this.duration: const Duration(milliseconds: 100), + }) : super(key: key); + + /// The node we will monitor to determine if the child is focused + final FocusNode focusNode; + + /// The child widget that we are wrapping + final Widget child; + + /// The curve we will use to scroll ourselves into view. + /// + /// Defaults to Curves.ease. + final Curve curve; + + /// The duration we will use to scroll ourselves into view + /// + /// Defaults to 100 milliseconds. + final Duration duration; + + EnsureVisibleWhenFocusedState createState() => new EnsureVisibleWhenFocusedState(); +} + +class EnsureVisibleWhenFocusedState extends State { + @override + void initState() { + super.initState(); + widget.focusNode.addListener(_ensureVisible); + } + + @override + void dispose() { + super.dispose(); + widget.focusNode.removeListener(_ensureVisible); + } + + Future _ensureVisible() async { + // Wait for the keyboard to come into view + // TODO: position doesn't seem to notify listeners when metrics change, + // perhaps a NotificationListener around the scrollable could avoid + // the need insert a delay here. + await new Future.delayed(const Duration(milliseconds: 100)); + + if (!widget.focusNode.hasFocus) + return; + + final RenderObject object = context.findRenderObject(); + final RenderAbstractViewport viewport = RenderAbstractViewport.of(object); + assert(viewport != null); + + ScrollableState scrollableState = Scrollable.of(context); + assert(scrollableState != null); + + ScrollPosition position = scrollableState.position; + double alignment; + if (position.pixels > viewport.getOffsetToReveal(object, 0.0)) { + // Move down to the top of the viewport + alignment = 0.0; + } else if (position.pixels < viewport.getOffsetToReveal(object, 1.0)) { + // Move up to the bottom of the viewport + alignment = 1.0; + } else { + // No scrolling is necessary to reveal the child + return; + } + position.ensureVisible( + object, + alignment: alignment, + duration: widget.duration, + curve: widget.curve, + ); + } + + Widget build(BuildContext context) => widget.child; +} diff --git a/lib/base/settings_base_state.dart b/lib/base/settings_base_state.dart index 33f9274..95ef24f 100644 --- a/lib/base/settings_base_state.dart +++ b/lib/base/settings_base_state.dart @@ -4,13 +4,9 @@ import 'package:checker/db.dart'; import 'package:checker/strings.dart'; import 'package:flutter/material.dart'; -abstract class SettingsBaseState - extends BaseState { +abstract class SettingsBaseState extends BaseState { - SettingsBaseState(SqliteHelper helper, String app) { - this.helper = helper; - this.app = app; - } + SettingsBaseState(SqliteHelper helper, String app) : super(helper, app); int selectedItem; diff --git a/lib/common.dart b/lib/common.dart index cb9e2ff..d6d71a2 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -1,31 +1,18 @@ import 'dart:async'; import 'package:checker/screens/faq.dart'; -import 'package:checker/screens/purchase.dart'; -import 'package:checker/screens/registration.dart'; -import 'package:checker/screens/settings.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:image_picker/image_picker.dart'; import 'db.dart'; -import 'dart:convert'; -import 'network.dart'; -import 'resources.dart'; import 'strings.dart'; // Канал для взаимодействия с кодом платформы. const platform = const MethodChannel('com.dinect.checker/instance_id'); -// Метод обеспечивает замену текущего объекта route новым. -pushRouteReplacement(BuildContext context, Widget widget) { - var route = - new MaterialPageRoute(builder: (BuildContext context) => widget); - new Future.delayed(const Duration(milliseconds: 200), () { - Navigator.of(context).pushReplacement(route); - }); -} +// TODO: Избавиться от следующих двух методов pushRoute(BuildContext context, Widget widget) { var route = new MaterialPageRoute(builder: (BuildContext context) => widget, fullscreenDialog: true); @@ -35,137 +22,6 @@ pushRoute(BuildContext context, Widget widget) { }); } -// Добавление route, с возможностью вернуться к предыдущему экрану. -faq(SqliteHelper helper, String app, BuildContext context, - bool returnToScanner) { - pushRoute(context, new FAQScreen(helper, app, returnToScanner)); -} - -// В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения. -logout(BuildContext context, SqliteHelper helper) async { - String token = await helper.getToken(); - VoidCallback positiveCallback = () { - if (token != null) { - getDeleteTokenRequest(token).then((response) { - helper.clear().then((result) { - platform.invokeMethod('getFlavor').then((flavor) { - while (Navigator.of(context).canPop()) { - Navigator.of(context).pop(); - } - pushRouteReplacement(context, new RegistrationScreen(helper, flavor)); - }); - }); - }).catchError((error) { - print(error.toString()); - }); - } else { - while (Navigator.of(context).canPop()) { - Navigator.of(context).pop(); - } - } - }; - - showYesNoDialog(context, StringsLocalization.confirmation(), - StringsLocalization.askChangeStore(), positiveCallback); -} - -/// Запуск спецефичной для каждой платформы части приложения - сканера. -/// Может производиться с нескольких экранов (splash, finish_registration). -startScanner(BuildContext context, String app, SqliteHelper helper) async { - String token = await helper.getToken(); - // Канал ловит вызовы методов из "нативной" части приложения. - // Могут быть вызваны либо exit либо faq, либо purchase. - if (token != null) { - platform.setMethodCallHandler((MethodCall call) async { - if (call.method == 'findUser') { - var userResponse; - String cardPhone = call.arguments[0]; - - try { - switch (call.arguments[1]) { - case 'card': - userResponse = await getUserByCard(cardPhone, token); - break; - case 'phone': - userResponse = await getUserByPhone(cardPhone, token); - break; - } - } catch (error) { - print(error.toString()); - } - - List users; - - - try { - users = JSON.decode(userResponse.body); - } catch (error) { - print(error); - } - - if (users.length > 0) { - return users[0]; - } else { - startScanner(context, app, helper); - throw new FlutterError("Users not found"); - } - } else if (call.method == 'faq') { - faq(helper, app, context, true); - } else if (call.method == 'settings') { - pushRoute(context, new SettingsScreen(helper, app, true)); - } else { - String userString; - - if (call.arguments[0] is String) { - userString = call.arguments[0]; - } else { - userString = JSON.encode(call.arguments[0]); - } - - print(userString); - - String card = call.arguments[1]; - print('$userString, $card'); - pushRouteReplacement(context, new PurchaseScreen(helper, app, userString, card)); - } - }); - - Map args = StringsLocalization.strings; - args.addAll({ - 'token': token, - 'url': await platform.invokeMethod('getEndpoint'), - 'appToken': await platform.invokeMethod('getAppToken'), - 'localeCode': StringsLocalization.localeCode, - 'color': Resources - .getPrimaryColor(app) - .value - .toString() - }); - - platform.invokeMethod('startScanner', args); - } -} - -// Запуск диалога с двумя кнопками -showYesNoDialog(BuildContext context, String title, String content, - VoidCallback positiveCallback) { - showDialog( - context: context, - child: new AlertDialog( - title: new Text(title), - content: new Text(content), - actions: [ - new FlatButton( - child: new Text(StringsLocalization.no()), - onPressed: () { - Navigator.of(context).pop(); - }), - new FlatButton( - child: new Text(StringsLocalization.yes()), - onPressed: positiveCallback) - ])); -} - getCurrencyTitle(int code) { switch (code) { case 643: diff --git a/lib/db.dart b/lib/db.dart index 704cca3..66711c7 100644 --- a/lib/db.dart +++ b/lib/db.dart @@ -64,28 +64,35 @@ class SqliteHelper { } /// Создается запись в таблице, содержащая данные, которые не зависят от сессии. - Future createAppInfo(int currency) async { + Future createAppInfo(int currency, String locale) async { List appInfo = await db.query(tableSettings); if (appInfo.length > 0) { return null; } else { return db.insert(tableSettings, { - columnCurrency: currency + columnCurrency: currency, + columnLocale: locale }); } } Future getSettings(bool withSession) async { + + Map results = new Map(); Map settings = await selectAll(tableSettings); + if (settings != null && settings.isNotEmpty) { + results.addAll(settings); + } + if (withSession) { Map session = await selectAll(tableSession); - if (settings != null && session != null) { - settings.addAll(session); + if (session != null && session.isNotEmpty) { + results.addAll(session); } } - return settings; + return results; } Future getToken() async { diff --git a/lib/main.dart b/lib/main.dart index c0dd821..0c5ab5f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,23 +1,88 @@ +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'); -void main() { - platform.invokeMethod('getAppTitle').then((title) { - runApp(new Checker(appName: title)); +main() { + + platform.invokeMethod('getFlavor').then((flavor) { + platform.invokeMethod('getAppTitle').then((title) { + + 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) { + initWithSystemValue(app, appName, locale, helper); + } else { + start(app, appName, locale, helper); + } + }); + }); + }); }); } -class Checker extends StatelessWidget { - Checker({this.appName}); +initWithSystemValue(String app, String name, String locale, SqliteHelper helper) { + helper.getSettings(false).then((settings) { + if (settings.isEmpty) { + createSettingsTable(app, name, helper); + } else { + start(app, name, locale, helper); + } + }); +} + +createSettingsTable(String app, String name, SqliteHelper helper) { + platform.invokeMethod('getLocale').then((locale) { + platform.invokeMethod('getCurrency').then((currency) { + helper.createAppInfo(currency, locale).then((_) { + start(app, name, locale, helper); + }); + }); + }); +} + +start(String app, String name, String locale, SqliteHelper helper) { + StringsLocalization.load(locale).then((_) { + runApp(new Checker(app, name, helper)); + }); +} + +class Checker extends StatefulWidget { + + final SqliteHelper helper; + final String app; final String appName; - @override Widget build (BuildContext context) { + Checker(this.app, this.appName, this.helper); + + @override + State createState() => new CheckerState( + this.app, + this.appName, + this.helper); +} + +class CheckerState extends State { + + SqliteHelper helper; + String app; + String appName; + + CheckerState(this.app, this.appName, this.helper); + + @override + Widget build(BuildContext context) { return new MaterialApp( title: appName, - home: new SplashScreen() + home: new SplashScreen(helper, app) ); } } diff --git a/lib/resources.dart b/lib/resources.dart index 027731e..799cee5 100644 --- a/lib/resources.dart +++ b/lib/resources.dart @@ -2,9 +2,7 @@ import 'package:flutter/material.dart'; class Resources { - static String getLogo(String app) { - return app == null ? null : 'assets/${app}_logo.png'; - } + static String getLogo(String app) => 'assets/${app}_logo.png'; static String getSplash(String app) { if (app == 'autobonus') { @@ -19,7 +17,7 @@ class Resources { case 'pip': return new Color(0xff008794); case 'autobonus': return new Color(0xffeb0004); case 'dinect': return new Color(0xff3daee3); - case 'crypto': return new Color(0xff0f3d87); + case 'crypto': return new Color(0xff0f3d87); default: return new Color(0xffffffff); } } @@ -29,7 +27,7 @@ class Resources { case 'pip': return new Color(0xfff49935); case 'autobonus': return new Color(0xffeb0004); case 'dinect': return new Color(0xff33cc99); - case 'crypto': return new Color(0xffffc34d); + case 'crypto': return new Color(0xffffc34d); default: return new Color(0xffffffff); } diff --git a/lib/screens/currencies.dart b/lib/screens/currencies.dart index d450702..634a32c 100644 --- a/lib/screens/currencies.dart +++ b/lib/screens/currencies.dart @@ -17,6 +17,7 @@ class _CurrenciesState extends SettingsBaseState { _CurrenciesState(SqliteHelper helper, String app) : super(helper, app); + bool isAutomaticallyImplyLeading() => true; @override List getOptions() { diff --git a/lib/screens/faq.dart b/lib/screens/faq.dart index ede3a0f..ff821aa 100644 --- a/lib/screens/faq.dart +++ b/lib/screens/faq.dart @@ -22,6 +22,8 @@ class EntryItem extends StatelessWidget { const EntryItem(this.entry); final Entry entry; + bool isAutomaticallyImplyLeading() => true; + Widget _buildTiles(BuildContext context, Entry root) { EdgeInsets margin = new EdgeInsets.only(left: 20.0, right: 20.0); TextStyle titleStyle = Theme.of(context).textTheme.button.copyWith( @@ -66,22 +68,14 @@ class EntryItem extends StatelessWidget { class FAQScreen extends BaseScreen { - FAQScreen(SqliteHelper helper, String app, - this.returnToScanner) : super(helper, app); + FAQScreen(SqliteHelper helper, String app) : super(helper, app); - final bool returnToScanner; - - @override State createState() => new FAQScreenState(returnToScanner, helper, app); + @override State createState() => new FAQScreenState(helper, app); } class FAQScreenState extends BaseState { - FAQScreenState(this.returnToScanner, SqliteHelper helper, String app) { - this.helper = helper; - this.app = app; - } - - bool returnToScanner; + FAQScreenState(SqliteHelper helper, String app) : super(helper, app); List data; @@ -93,16 +87,14 @@ class FAQScreenState extends BaseState { return null; } + @override + void initState() { + initPhoneAndUrl().then((_) { + super.initState(); + }); + } + @override Widget build(BuildContext context) { - if (data == null) { - platform.invokeMethod('getFlavor').then((flavor) { - initPhoneAndUrl().then((_) { - setState(() { - app = flavor; - }); - }); - }); - } return new Scaffold(appBar: getAppBar(), body: getScreenContent()); } @@ -129,18 +121,14 @@ class FAQScreenState extends BaseState { if (data == null) { return getBackground(); } else { - return new WillPopScope(onWillPop: onWillPop, child: new ListView.builder( + return new ListView.builder( itemBuilder: (BuildContext context, int index) => new EntryItem(data[index]), - itemCount: data.length)); + itemCount: data.length); } } - onWillPop() { - if(returnToScanner) { - return startScanner(context, app, helper); - } else { - return true; - } + @override bool isAutomaticallyImplyLeading() { + return true; } } diff --git a/lib/screens/finish_registration.dart b/lib/screens/finish_registration.dart index a7da747..a0e8832 100644 --- a/lib/screens/finish_registration.dart +++ b/lib/screens/finish_registration.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:async'; import 'package:checker/base/base_screen.dart'; import 'package:checker/base/base_state.dart'; @@ -18,14 +19,13 @@ class FinishRegistrationScreen extends BaseScreen { class RegistrationScreenState extends BaseState { - RegistrationScreenState(SqliteHelper helper, String app) { - this.helper = helper; - this.app = app; - } + RegistrationScreenState(SqliteHelper helper, String app) : super(helper, app); bool _tokenActive = false; String _merchantID = ''; + bool isAutomaticallyImplyLeading() => false; + @override Widget build(BuildContext context) { if (_merchantID == '') { helper.getMerchantID().then((result) { @@ -34,7 +34,13 @@ class RegistrationScreenState extends BaseState { }); }); } - return getMainWidget(); + return new WillPopScope(onWillPop: () => onWillPop(), child: getMainWidget()); + } + + onWillPop() { + if (Theme.of(context).platform != TargetPlatform.iOS) { + platform.invokeMethod('finish'); + } } @override String getTitle() { @@ -59,26 +65,27 @@ class RegistrationScreenState extends BaseState { // Если токен активирован, то открывается экран со сканером, // Если нет, то отправляется запрос на проверку статуса токена. - handleTap() async { + handleTap() { + print('tokenActive: $_tokenActive'); if (_tokenActive) { - Navigator.of(context).pop(); - startScanner(context, app, helper); + helper.getToken().then((token) { + Navigator.of(context).pop(token); + }); } else { - if (await platform.invokeMethod('isOnline')) { - String token = await helper.getToken(); - getCheckTokenStatusRequest(token).then((response) { - Map parsedMap = JSON.decode(response.body); - - // Обновить экран, заменить сообщение о необходимости активации токена, на сообщние о том, что токен активен. - setState(() { - _tokenActive = parsedMap['active']; + platform.invokeMethod('isOnline').then((isOnline) { + if (isOnline ) { + helper.getToken().then((token) { + getCheckTokenStatusRequest(token).then((response) { + setState(() { + _tokenActive = JSON.decode(response.body)['active']; + }); + }).catchError((error) { + print(error.toString()); + return false; + }); }); - - }).catchError((error) { - print(error.toString()); - return false; - }); - } + } + }); } } diff --git a/lib/screens/languages.dart b/lib/screens/languages.dart index e7d90c1..330b357 100644 --- a/lib/screens/languages.dart +++ b/lib/screens/languages.dart @@ -18,6 +18,8 @@ class LanguagesState extends SettingsBaseState { List languages = const ['ru', 'en', 'ua', 'es']; + bool isAutomaticallyImplyLeading() => true; + @override List getOptions() { diff --git a/lib/screens/purchase.dart b/lib/screens/purchase.dart index 7afd0ed..3c40b6c 100644 --- a/lib/screens/purchase.dart +++ b/lib/screens/purchase.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'dart:convert'; import 'dart:core'; +import 'dart:async'; import 'package:checker/resources.dart'; import 'package:checker/strings.dart'; @@ -33,30 +34,35 @@ class PurchaseScreenState extends BaseState { TextEditingController bonusController = new TextEditingController(); - PurchaseScreenState(SqliteHelper helper, String app, String userString, String card) { + FocusNode _focusNodeSum = new FocusNode(); + FocusNode _focusNodeBonus = new FocusNode(); + + bool isAutomaticallyImplyLeading() => false; + + PurchaseScreenState(SqliteHelper helper, String app, String userString, String card) : super(helper, app) { this.user = JSON.decode(userString); this.card = card; - this.helper = helper; - this.app = app; + } + + @override + void initState() { + loading = true; + requestAsyncData(user); + super.initState(); } @override Widget build(BuildContext ctx) { - setState(() { - requestAsyncData(user); - }); - return new WillPopScope(onWillPop: onWillPop, child: getMainWidget()); + return getMainWidget(); } bool purchaseInProgress = false; Map user; String card = ''; - String flavor = ''; String loyalityType = ''; String loyalty = ''; String bonus = ''; List coupons = []; - bool dataRequested = false; @override Widget getScreenContent() { @@ -67,17 +73,19 @@ class PurchaseScreenState extends BaseState { )); widgetList.add(getValueWithDescription(StringsLocalization.card(), card)); - widgetList.add(getValueWithDescription(StringsLocalization.reward(), loyalty)); + if (app != 'crypto') { + widgetList.add(getValueWithDescription(StringsLocalization.reward(), loyalty)); + } if (bonus.length > 0) { widgetList.add(getValueWithDescription(StringsLocalization.bonus(), bonus)); } widgetList.add(getHintLabel()); - widgetList.add(getInputField()); // Нельзя добавить еще одно поле таким же способом - if (this.flavor != 'autobonus') { + if (app != 'autobonus') { + if (this.loyalityType == 'bonus') { widgetList.add(getBonusInputField()); } @@ -109,6 +117,7 @@ class PurchaseScreenState extends BaseState { Resources.getPrimaryColor(app) ) )); + return new Column(children: [ new Expanded( child: new ListView(children: widgetList)) @@ -116,7 +125,11 @@ class PurchaseScreenState extends BaseState { } getBonusInputField() { - TextField bonusTextField = new TextField( + + var bonusTextField = new EnsureVisibleWhenFocused( + focusNode: _focusNodeBonus, + child: new TextField( + focusNode: _focusNodeBonus, keyboardType: TextInputType.number, decoration: new InputDecoration.collapsed( hintText: StringsLocalization.bonusHint(), @@ -129,7 +142,7 @@ class PurchaseScreenState extends BaseState { }); }, textAlign: TextAlign.center, - ); + )); return new Column( children: [ @@ -173,15 +186,13 @@ class PurchaseScreenState extends BaseState { height: buttonHeight, child: new FlatButton( child: new Text(title, style: new TextStyle(color: textColor)), - onPressed: () => startScanner(context, app, helper)), + onPressed: () => restartScanner()), decoration: new BoxDecoration( border: new Border.all( color: Resources.getButtonColor(app), width: 1.0), borderRadius: new BorderRadius.all(new Radius.circular(4.0)))); } - - @override String getTitle() { return StringsLocalization.carryingPurchase(); @@ -195,7 +206,10 @@ class PurchaseScreenState extends BaseState { @override getTextWidget() { // ?? TODO переделать, т.к. позволяет иметь только одно поле ввода на странице - return new TextField( + return new EnsureVisibleWhenFocused( + focusNode: _focusNodeSum, + child: new TextField( + focusNode: _focusNodeSum, keyboardType: TextInputType.number, decoration: new InputDecoration.collapsed( hintText: getHintString(), @@ -208,14 +222,12 @@ class PurchaseScreenState extends BaseState { }, textAlign: TextAlign.center, autofocus: true - ); + )); } requestAsyncData(Map user) async { bool showBonus = await platform.invokeMethod('showBonus'); - String flavor = await platform.invokeMethod('getFlavor'); - if (await platform.invokeMethod('isOnline') && !this.dataRequested) { - this.dataRequested = true; + if (await platform.invokeMethod('isOnline')) { var response, couponResponse; print(user['coupons_url']); try { @@ -234,14 +246,12 @@ class PurchaseScreenState extends BaseState { coupons['results'].forEach((couponItem) { couponItem['isSet'] = false; }); - setState(() { - this.flavor = flavor; + loading = false; this.coupons = coupons['results']; this.loyalityType = loyality['type']; setBonuses(loyality, showBonus); }); - } } @@ -317,7 +327,6 @@ class PurchaseScreenState extends BaseState { showDialog( context: context, child: new AlertDialog( - //title: new Text(StringsLocalization.()), content: new Text(errorText), actions: [ new FlatButton( @@ -332,6 +341,9 @@ class PurchaseScreenState extends BaseState { } purchase(String sumTotal) async { + setState(() { + loading = true; + }); if (await platform.invokeMethod('isOnline')) { if (!purchaseInProgress) { purchaseInProgress = true; @@ -352,7 +364,6 @@ class PurchaseScreenState extends BaseState { 'curr_iso_code': currency.toString(), 'commit': 'true', 'sum_total': sumTotal, -// 'coupons': [] }; if (bonusController.text.length > 0) { @@ -375,6 +386,9 @@ class PurchaseScreenState extends BaseState { } if (purchase.containsKey('errors')) { + setState(() { + loading = false; + }); List errors = purchase['errors']; purchaseInProgress = false; apiErrorAlert(errors[0]); @@ -391,17 +405,20 @@ class PurchaseScreenState extends BaseState { Map coupons = JSON.decode(couponsResponse.body); - pushRouteReplacement( - context, - new PurchaseSuccessScreen( + new Future.delayed(const Duration(milliseconds: 200), () { + print('show purchase success!'); + var route = new MaterialPageRoute(builder: (BuildContext context) => new PurchaseSuccessScreen( sumTotal, user['first_name'] == null ? '' : user['first_name'], helper, app, purchase, coupons['results'] - ) - ); + ), fullscreenDialog: true); + Navigator.of(context).push(route).then((token) { + Navigator.of(context).pop(token); + }); + }); } } } @@ -424,7 +441,9 @@ class PurchaseScreenState extends BaseState { print('bonus ' + this.bonus); } - onWillPop() { - return startScanner(context, app, helper); + restartScanner() { + helper.getToken().then((token) { + Navigator.of(context).pop(token); + }); } } diff --git a/lib/screens/purchase_success.dart b/lib/screens/purchase_success.dart index 0cc46a5..96e0701 100644 --- a/lib/screens/purchase_success.dart +++ b/lib/screens/purchase_success.dart @@ -26,11 +26,9 @@ class PurchaseSuccessScreenState extends BaseState { PurchaseSuccessScreenState( String sum, String username, SqliteHelper helper, String app, Map details, List coupons - ){ + ) : super(helper, app) { this.sum = sum; this.username = username; - this.helper = helper; - this.app = app; this.details = details; this.coupons = coupons; } @@ -41,8 +39,10 @@ class PurchaseSuccessScreenState extends BaseState { int bonusPlus = 0; int bonusMinus = 0; int currency; + String token; bool showBonus; - String flavor; + + bool isAutomaticallyImplyLeading() => false; @override String getTitle() { return StringsLocalization.carryingPurchase(); @@ -52,35 +52,32 @@ class PurchaseSuccessScreenState extends BaseState { return null; } + @override + void initState() { + helper.getCurrency().then((currency) { + helper.getToken().then((token) { + this.currency = currency; + this.token = token; + }); + }); + super.initState(); + } + @override Widget build(BuildContext context) { - if (currency == null) { - helper.getCurrency().then((currency) { - setState(() { - this.currency = currency; - }); - }); + + if (this.details['sum_bonus'] is String) { + String regexString = r'(\d+) начислено, (\d+).*'; + RegExp regExp = new RegExp(regexString); + var matches = regExp.allMatches(this.details['sum_bonus']); + if(matches.length != 0) { + var match = matches.elementAt(0); // => extract the first (and only) match + this.bonusPlus = int.parse(match.group(1)); + this.bonusMinus = int.parse(match.group(2)); + } } - if (this.flavor == null) { - platform.invokeMethod('getFlavor').then((flavor) { - setState(() { - this.flavor = flavor; - if (this.details['sum_bonus'] is String) { - String regexString = r'(\d+) начислено, (\d+).*'; - RegExp regExp = new RegExp(regexString); - var matches = regExp.allMatches(this.details['sum_bonus']); - if(matches.length != 0) { - var match = matches.elementAt(0); // => extract the first (and only) match - this.bonusPlus = int.parse(match.group(1)); - this.bonusMinus = int.parse(match.group(2)); - } - } - - if (this.details['sum_bonus'] is int) { - this.bonusPlus = this.details['sum_bonus']; - } - }); - }); + if (this.details['sum_bonus'] is int) { + this.bonusPlus = this.details['sum_bonus']; } return getMainWidget(); @@ -99,13 +96,13 @@ class PurchaseSuccessScreenState extends BaseState { widgetList.add(getValueWithDescription(StringsLocalization.bonusMinus(), bonusMinus.toString())); } - if (this.flavor != 'autobonus') { + if (app != 'autobonus') { widgetList.add(getValueWithDescription(StringsLocalization.discountRate(), '${details['discount']}%')); - widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}')); + if (app != 'crypto') { + widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}')); + } } - -// widgetList.add( new Expanded(child: new Center())); - if (this.coupons.length > 0) { + if (app != 'crypto' && this.coupons.length > 0) { widgetList.add(getItemTitle(StringsLocalization.couponsUsed())); this.coupons.forEach((couponItem) { widgetList.add(getItemToggle( @@ -131,7 +128,7 @@ class PurchaseSuccessScreenState extends BaseState { getScanButton() { String title = StringsLocalization.scan(); - return buildRaisedButton(title, () => startScanner(context, app, helper)); + return buildRaisedButton(title, () => Navigator.of(context).pop(token)); } @@ -141,8 +138,6 @@ class PurchaseSuccessScreenState extends BaseState { }; } - - getSuccessMessage() { return new Row( children: [ @@ -159,7 +154,8 @@ class PurchaseSuccessScreenState extends BaseState { ) ) )) - ]); + ] + ); } getMessageTitle() { diff --git a/lib/screens/registration.dart b/lib/screens/registration.dart index cf395f6..f7a3705 100644 --- a/lib/screens/registration.dart +++ b/lib/screens/registration.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:async'; import 'package:checker/base/base_screen.dart'; import 'package:checker/base/base_state.dart'; @@ -20,14 +21,15 @@ class RegistrationScreen extends BaseScreen { } class RegistrationScreenState extends BaseState { - RegistrationScreenState(SqliteHelper helper, String app) { - this.helper = helper; - this.app = app; - } + + RegistrationScreenState(SqliteHelper helper, String app) : super(helper, app); + FocusNode _focusNode = new FocusNode(); + + bool isAutomaticallyImplyLeading() => false; @override Widget build(BuildContext ctx) { - return getMainWidget(); + return new WillPopScope(onWillPop: () => onWillPop(), child: getMainWidget()); } @override @@ -43,8 +45,7 @@ class RegistrationScreenState extends BaseState { /// Список виджетов, автоматически прокручиваемый вверх при открытии клавиатуры. @override Widget getScreenContent() { - return new Container( - child: new ListView(children: [ + return new Container(child: new ListView(children: [ new Column(children: [ getLogo(), getHintLabel(), @@ -56,12 +57,15 @@ class RegistrationScreenState extends BaseState { @override getTextWidget() { - return new TextField( + return new EnsureVisibleWhenFocused( + focusNode: _focusNode, + child: new TextField( + focusNode: _focusNode, keyboardType: TextInputType.number, decoration: new InputDecoration.collapsed( hintText: getHintString(), hintStyle: new TextStyle(color: greyTextColor, fontSize: 16.0)), - onChanged: (text) => handleUserInput(text)); + onChanged: (text) => handleUserInput(text))); } /// Возвращает кнопку регистрации. @@ -86,12 +90,12 @@ class RegistrationScreenState extends BaseState { _registerShop() { setState(() { loading = true; - _register(); + register(); }); } /// Получение от платформы id установки, формирование запроса на получение токена, сохранение токена. - _register() async { + register() async { if (await platform.invokeMethod('isOnline')) { String posID = await helper.getPosID(); @@ -108,8 +112,13 @@ class RegistrationScreenState extends BaseState { if (response.statusCode == 201) { helper.createSession(merchantID, posID, parsedMap['token']).then((_) { - pushRouteReplacement( - context, new FinishRegistrationScreen(helper, app)); + new Future.delayed(const Duration(milliseconds: 200), () { + print('start finish registration!'); + var route = new MaterialPageRoute(builder: (BuildContext context) => new FinishRegistrationScreen(helper, app), fullscreenDialog: true); + Navigator.of(context).push(route).then((token) { + Navigator.of(context).pop(token); + }); + }); }); } else { setState(() { @@ -121,4 +130,10 @@ class RegistrationScreenState extends BaseState { }); } } + + onWillPop() { + if (Theme.of(context).platform != TargetPlatform.iOS) { + platform.invokeMethod('finish'); + } + } } diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index bf966af..3491441 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -1,10 +1,14 @@ +import 'dart:async'; + import 'package:checker/base/base_screen.dart'; import 'package:checker/base/base_state.dart'; import 'package:checker/common.dart'; import 'package:checker/consts.dart'; import 'package:checker/db.dart'; +import 'package:checker/network.dart'; import 'package:checker/screens/currencies.dart'; import 'package:checker/screens/languages.dart'; +import 'package:checker/screens/splash.dart'; import 'package:checker/strings.dart'; import 'package:flutter/material.dart'; @@ -35,14 +39,23 @@ class SettingsState extends BaseState { ]; bool returnToScanner; + String versionName = ""; - SettingsState(SqliteHelper helper, String app, bool returnToScanner) { - this.helper = helper; - this.app = app; + bool isAutomaticallyImplyLeading() => true; + + SettingsState(SqliteHelper helper, String app, bool returnToScanner) : super(helper, app) { this.returnToScanner = returnToScanner; } @override Widget build(BuildContext ctx) { + if (this.versionName == "") { + platform.invokeMethod('getVersionName').then((versionName) { + setState(() { + this.versionName = versionName; + }); + }); + } + // TODO: Перенести в initStater helper.getSettings(true).then((info) { setState(() { menuItems[0].title = StringsLocalization.currency(); @@ -55,7 +68,7 @@ class SettingsState extends BaseState { info['token'] == null ? '' : getTokenSuffix(info['token']); }); }); - return new WillPopScope(onWillPop: onWillPop, child: getMainWidget()); + return getMainWidget(); } String getTokenSuffix(String token) { @@ -83,7 +96,6 @@ class SettingsState extends BaseState { List widgets = new List(); for (int i = 0; i < menuItems.length; i++) { if (menuItems[i].selectedValue.toString() != '') { - print('title : ${menuItems[i].title}'); widgets.add( getSettingsItem(() => onPressed(menuItems.indexOf(menuItems[i])), menuItems[i].title, @@ -98,7 +110,6 @@ class SettingsState extends BaseState { case 0 : return getCurrencyTitle(int.parse(menuItems[position].selectedValue)); case 1 : - print('val : ${menuItems[position].selectedValue}'); return getLocaleTitle(menuItems[position].selectedValue); default : return null; @@ -149,6 +160,46 @@ class SettingsState extends BaseState { } } + // В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения. + logout(BuildContext context, SqliteHelper helper) { + showYesNoDialog(context, StringsLocalization.confirmation(), + StringsLocalization.askChangeStore()); + } + +// Запуск диалога с двумя кнопками + showYesNoDialog(BuildContext context, String title, String content) { + showDialog( + context: context, + child: new AlertDialog( + title: new Text(title), + content: new Text(content), + actions: [ + new FlatButton( + child: new Text(StringsLocalization.no()), + onPressed: () { + Navigator.of(context).pop(false); + }), + new FlatButton( + child: new Text(StringsLocalization.yes()), + onPressed: () { + Navigator.of(context).pop(true); + }) + ])).then((b) { + if (b) { + helper.getToken().then((token) { + getDeleteTokenRequest(token).then((response) { + helper.clear().then((result) { + Navigator.of(context).pop(''); + }); + }).catchError((error) { + print(error.toString()); + Navigator.of(context).pop(''); + }); + }); + } + }); + } + Widget getArrow() { return new Container(margin: new EdgeInsets.only(left: 8.0), child: new Image.asset(settings_arrow_png, height: 42.0)); @@ -156,14 +207,6 @@ class SettingsState extends BaseState { @override String getTitle() { - return StringsLocalization.settings(); - } - - onWillPop() { - if (returnToScanner) { - return startScanner(context, app, helper); - } else { - return true; - } + return StringsLocalization.settings() + " ($versionName)"; } } diff --git a/lib/screens/splash.dart b/lib/screens/splash.dart index 41ced61..a099884 100644 --- a/lib/screens/splash.dart +++ b/lib/screens/splash.dart @@ -1,98 +1,57 @@ import 'dart:async'; import 'dart:convert'; +import 'package:checker/base/base_screen.dart'; import 'package:checker/base/base_state.dart'; import 'package:checker/common.dart'; import 'package:checker/consts.dart'; import 'package:checker/db.dart'; import 'package:checker/network.dart'; import 'package:checker/resources.dart'; +import 'package:checker/screens/faq.dart'; import 'package:checker/screens/finish_registration.dart'; +import 'package:checker/screens/purchase.dart'; import 'package:checker/screens/registration.dart'; +import 'package:checker/screens/settings.dart'; import 'package:checker/strings.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:http/http.dart'; -class SplashScreen extends StatefulWidget { +// FIXME: Сделать запуск всех экранов из одной точки через метод showNextScreen() +class SplashScreen extends BaseScreen { + + SplashScreen(SqliteHelper helper, String app) : super(helper, app); + @override - State createState() => new _SplashScreenState(); + State createState() => new _SplashScreenState(helper, app); } class _SplashScreenState extends BaseState { + + _SplashScreenState(SqliteHelper helper, String app) : super(helper, app); + bool a = true; + + bool isAutomaticallyImplyLeading() => false; + + @override + void initState() { + init(); + super.initState(); + } + @override Widget build(BuildContext ctx) { - if (helper == null) { - helper = new SqliteHelper(); - helper.open().then((_) { - if (app == null) { - platform.invokeMethod('getFlavor').then((flavor) { - app = flavor; - setState(() { - onStart(); - }); - }); - } - }); - } - return getScreenContent(); - } - - void onStart() { - helper.getLocale().then((locale) { - if (locale == null) { - initWithSystemValue(); - } else { - initWithSavedValue(locale); - } - }); - } - - void initWithSystemValue() { - platform.invokeMethod('getLocale').then((locale) { - helper.getSettings(false).then((settings) { - if (settings == null) { - createSettingsTable(locale); - } else { - initLocale(locale, () { - showNext(); - }); - } - }); - }); - } - - void initWithSavedValue(String locale) { - initLocale(locale, () { - showNext(); - }); - } - - void createSettingsTable(String locale) { - platform.invokeMethod('getCurrency').then((currency) { - helper.createAppInfo(currency); - initLocale(locale, () { - showNext(); - }); - }); - } - - void initLocale(String locale, Future onValue()) { - StringsLocalization.load(locale).then((_) { - onValue(); - }); - } - - void showNext() { - new Future.delayed(const Duration(milliseconds: 1000), () { - showNextScreen(); - }); + return !a ? new Container( + decoration: new BoxDecoration( + image: new DecorationImage( + image: new ExactAssetImage(Resources.getSplash(null)), + fit: BoxFit.cover))) : getScreenContent(); } @override Widget getScreenContent() { - return app == null - ? getBackground() - : new Stack(children: [ + return new Stack(children: [ getBackground(), getLogo(), new Align( @@ -114,14 +73,32 @@ class _SplashScreenState extends BaseState { ])); } - /// Запуск следующего экрана приложения. - showNextScreen() async { - String token = await helper.getToken(); + showNextScreen(Widget screen) { + new Future.delayed(const Duration(milliseconds: 200), () { + var route = new MaterialPageRoute( + builder: (BuildContext context) => screen, fullscreenDialog: true); + Navigator.of(context).push(route).then((token) { + if (token == '') { + showNextScreen(new RegistrationScreen(helper, app)); + } else if (token != null) { + _initAndStartScanner(context, app, token, helper); + } else { + print('Произошла непредусмотренная ошибка в логике приложения'); + helper.getToken().then((token) { + _initAndStartScanner(context, app, token, helper); + }); + } + }); + }); + } + /// Запуск следующего экрана приложения. + init() async { + String token = await helper.getToken(); // В случае, если в приложении отсутствует токен, // необходимо запустить регистрацию кассы. if (token == null) { - pushRouteReplacement(context, new RegistrationScreen(helper, app)); + showNextScreen(new RegistrationScreen(helper, app)); } else { if (await platform.invokeMethod('isOnline')) { getCheckTokenStatusRequest(token).then((statusResponse) { @@ -138,17 +115,18 @@ class _SplashScreenState extends BaseState { /// Если токен не активен, попробовать создать его еще раз. handleStatusResponse(var statusResponse, SqliteHelper helper) async { int code = statusResponse.statusCode; - if (code == 404) { helper.clear().then((result) { - pushRouteReplacement(context, new RegistrationScreen(helper, app)); + showNextScreen(new RegistrationScreen(helper, app)); }); } else { Map status = JSON.decode(statusResponse.body); bool active = status['active'] == null ? false : status['active']; if (active) { - startScanner(context, app, helper); + helper.getToken().then((token) { + _initAndStartScanner(context, app, token, helper); + }); } else { if (await platform.invokeMethod('isOnline')) { _createToken(helper); @@ -171,8 +149,7 @@ class _SplashScreenState extends BaseState { getCreateTokenRequest({'merchant_shop': merchantID, 'pos': posID}) .then((response) { if (response.statusCode == 409) { - pushRouteReplacement( - context, new FinishRegistrationScreen(helper, app)); + showNextScreen(new FinishRegistrationScreen(helper, app)); } else if (response.statusCode == 201) { clearToken(response, helper); } @@ -186,11 +163,101 @@ class _SplashScreenState extends BaseState { helper.clear().then((_) { Map parsedMap = JSON.decode(response.body); getDeleteTokenRequest(parsedMap['token']).then((_) { - Navigator.of(context).pop(); - pushRouteReplacement(context, new RegistrationScreen(helper, app)); + showNextScreen(new RegistrationScreen(helper, app)); }).catchError((error) { print(error.toString()); }); }); } + + + /// Запуск спецефичной для каждой платформы части приложения - сканера. + /// Может производиться с нескольких экранов (splash, finish_registration). + _initAndStartScanner(BuildContext context, String app, String token, + SqliteHelper helper) { + // Канал ловит вызовы методов из "нативной" части приложения. + // Могут быть вызваны либо exit либо faq, либо purchase. + + setState(() { + a = false; + }); + + platform.setMethodCallHandler((MethodCall call) async { + print(this.toString()); + if (call.method == 'findUser') { + + try { + + Response userResponse; + + switch (call.arguments[1]) { + case 'card': + userResponse = await getUserByCard(call.arguments[0], token); + break; + case 'phone': + userResponse = await getUserByPhone(call.arguments[0], token); + break; + } + + if (userResponse != null) { + print('I have user in method handler!'); + List users = JSON.decode(userResponse.body); + if (users.length > 0) { + return users[0]; + } else { + throw new FlutterError("Users not found"); + } + } else { + throw new FlutterError("Users not found"); + } + } catch (error) { + print(error.toString()); + throw new FlutterError("Users not found"); + } + + } else if (call.method == 'faq') { + new Future.delayed(const Duration(milliseconds: 200), () { + var route = new MaterialPageRoute( + builder: (BuildContext context) => new FAQScreen(helper, app), fullscreenDialog: true); + Navigator.of(context).push(route).then((_) { + _initAndStartScanner(context, app, token, helper); + }); + }); + } else if (call.method == 'settings') { + new Future.delayed(const Duration(milliseconds: 200), () { + var route = new MaterialPageRoute( + builder: (BuildContext context) => new SettingsScreen(helper, app, true), fullscreenDialog: true); + Navigator.of(context).push(route).then((result) { + if (result != null) { + showNextScreen(new RegistrationScreen(helper, app)); + } else { + _initAndStartScanner(context, app, token, helper); + } + }); + }); + } else { + String userString = call.arguments[0] is String + ? call.arguments[0] + : JSON.encode(call.arguments[0]); + print(userString); + String card = call.arguments[1]; + showNextScreen(new PurchaseScreen(helper, app, userString, card)); + } + }); + + platform.invokeMethod('getEndpoint').then((url) { + platform.invokeMethod('getAppToken').then((appToken) { + Map args = StringsLocalization.strings; + args['token'] = token; + args['url'] = url; + args['appToken'] = appToken; + args['localeCode'] = StringsLocalization.localeCode; + args['color'] = Resources + .getPrimaryColor(app) + .value + .toString(); + platform.invokeMethod('startScanner', args); + }); + }); + } } diff --git a/pubspec.lock b/pubspec.lock index 81e2909..c8590db 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -82,7 +82,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.7.5" sky_engine: dependency: transitive description: flutter