Android all done.
This commit is contained in:
@@ -166,7 +166,7 @@ public abstract class AbstractScannerActivity extends AppCompatActivity impleme
|
|||||||
// для удобства, чтоб не вводить постоянно руками при разработке
|
// для удобства, чтоб не вводить постоянно руками при разработке
|
||||||
|
|
||||||
// manualInput.setText("9990010009012057060904229");
|
// manualInput.setText("9990010009012057060904229");
|
||||||
manualInput.setText("4620011139016337050236302");
|
// manualInput.setText("4620011139016337050236302");
|
||||||
manualInput.setHint(getIntent().getStringExtra("enter_manual"));
|
manualInput.setHint(getIntent().getStringExtra("enter_manual"));
|
||||||
|
|
||||||
manualInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
manualInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ import io.flutter.plugin.common.MethodChannel;
|
|||||||
import io.flutter.plugin.common.MethodChannel.Result;
|
import io.flutter.plugin.common.MethodChannel.Result;
|
||||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||||
import android.support.v4.app.Fragment;
|
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 java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -127,7 +131,11 @@ public class MainActivity extends FlutterActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startScannerActivity() {
|
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]);
|
Intent cameraIntent = new Intent(MainActivity.this, SCANNER_BACKEND[idx]);
|
||||||
|
|
||||||
for (Object key : mScannerArgs.keySet()) {
|
for (Object key : mScannerArgs.keySet()) {
|
||||||
@@ -141,6 +149,18 @@ public class MainActivity extends FlutterActivity {
|
|||||||
setLocale((String) mScannerArgs.get("localeCode"));
|
setLocale((String) mScannerArgs.get("localeCode"));
|
||||||
startActivityForResult(cameraIntent, START_SCANNER_REQUEST_CODE);
|
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
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "0920"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Dinect-INT.app"
|
|
||||||
BlueprintName = "Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
language = ""
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
</Testables>
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Dinect-INT.app"
|
|
||||||
BlueprintName = "Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
language = ""
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<BuildableProductRunnable
|
|
||||||
runnableDebuggingMode = "0">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Dinect-INT.app"
|
|
||||||
BlueprintName = "Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildableProductRunnable>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<BuildableProductRunnable
|
|
||||||
runnableDebuggingMode = "0">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Dinect-INT.app"
|
|
||||||
BlueprintName = "Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildableProductRunnable>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "0920"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Debug-Dinect-INT.app"
|
|
||||||
BlueprintName = "Debug-Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
language = ""
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
</Testables>
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Debug-Dinect-INT.app"
|
|
||||||
BlueprintName = "Debug-Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
language = ""
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<BuildableProductRunnable
|
|
||||||
runnableDebuggingMode = "0">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Debug-Dinect-INT.app"
|
|
||||||
BlueprintName = "Debug-Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildableProductRunnable>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<BuildableProductRunnable
|
|
||||||
runnableDebuggingMode = "0">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "FB8CCC12204C8249002BBFDA"
|
|
||||||
BuildableName = "Debug-Dinect-INT.app"
|
|
||||||
BlueprintName = "Debug-Dinect-INT"
|
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildableProductRunnable>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
||||||
@@ -101,13 +101,18 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
|
|||||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||||
var route = new MaterialPageRoute<String>(builder: (BuildContext context) => new SettingsScreen(helper, app, false), fullscreenDialog: true);
|
var route = new MaterialPageRoute<String>(builder: (BuildContext context) => new SettingsScreen(helper, app, false), fullscreenDialog: true);
|
||||||
Navigator.of(context).push(route).then((token) {
|
Navigator.of(context).push(route).then((token) {
|
||||||
|
if (token != null) {
|
||||||
Navigator.of(context).pop(token);
|
Navigator.of(context).pop(token);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
pushRoute(context, new FAQScreen(helper, app, false));
|
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||||
|
var route = new MaterialPageRoute<String>(builder: (BuildContext context) => new FAQScreen(helper, app), fullscreenDialog: true);
|
||||||
|
Navigator.of(context).push(route);
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
|||||||
import 'package:checker/screens/faq.dart';
|
import 'package:checker/screens/faq.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
|
||||||
import 'db.dart';
|
import 'db.dart';
|
||||||
import 'strings.dart';
|
import 'strings.dart';
|
||||||
@@ -10,6 +11,8 @@ import 'strings.dart';
|
|||||||
// Канал для взаимодействия с кодом платформы.
|
// Канал для взаимодействия с кодом платформы.
|
||||||
const platform = const MethodChannel('com.dinect.checker/instance_id');
|
const platform = const MethodChannel('com.dinect.checker/instance_id');
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Избавиться от следующих двух методов
|
||||||
pushRoute(BuildContext context, Widget widget) {
|
pushRoute(BuildContext context, Widget widget) {
|
||||||
var route =
|
var route =
|
||||||
new MaterialPageRoute<Null>(builder: (BuildContext context) => widget, fullscreenDialog: true);
|
new MaterialPageRoute<Null>(builder: (BuildContext context) => widget, fullscreenDialog: true);
|
||||||
@@ -19,12 +22,6 @@ pushRoute(BuildContext context, Widget widget) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Добавление route, с возможностью вернуться к предыдущему экрану.
|
|
||||||
faq(SqliteHelper helper, String app, BuildContext context,
|
|
||||||
bool returnToScanner) {
|
|
||||||
pushRoute(context, new FAQScreen(helper, app, returnToScanner));
|
|
||||||
}
|
|
||||||
|
|
||||||
getCurrencyTitle(int code) {
|
getCurrencyTitle(int code) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 643:
|
case 643:
|
||||||
@@ -52,3 +49,8 @@ getLocaleTitle(String code) {
|
|||||||
return 'Español';
|
return 'Español';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Добавил вызов, что-бы AOT компилер не выкинул либу.
|
||||||
|
getImage() async {
|
||||||
|
return await ImagePicker.pickImage();
|
||||||
|
}
|
||||||
|
|||||||
@@ -68,19 +68,14 @@ class EntryItem extends StatelessWidget {
|
|||||||
|
|
||||||
class FAQScreen extends BaseScreen {
|
class FAQScreen extends BaseScreen {
|
||||||
|
|
||||||
FAQScreen(SqliteHelper helper, String app,
|
FAQScreen(SqliteHelper helper, String app) : super(helper, app);
|
||||||
this.returnToScanner) : super(helper, app);
|
|
||||||
|
|
||||||
final bool returnToScanner;
|
@override State createState() => new FAQScreenState<FAQScreen>(helper, app);
|
||||||
|
|
||||||
@override State createState() => new FAQScreenState<FAQScreen>(returnToScanner, helper, app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FAQScreenState<T> extends BaseState<FAQScreen> {
|
class FAQScreenState<T> extends BaseState<FAQScreen> {
|
||||||
|
|
||||||
FAQScreenState(this.returnToScanner, SqliteHelper helper, String app) : super(helper, app);
|
FAQScreenState(SqliteHelper helper, String app) : super(helper, app);
|
||||||
|
|
||||||
bool returnToScanner;
|
|
||||||
|
|
||||||
List<Entry> data;
|
List<Entry> data;
|
||||||
|
|
||||||
@@ -92,16 +87,14 @@ class FAQScreenState<T> extends BaseState<FAQScreen> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override
|
||||||
if (data == null) {
|
void initState() {
|
||||||
platform.invokeMethod('getFlavor').then((flavor) {
|
|
||||||
initPhoneAndUrl().then((_) {
|
initPhoneAndUrl().then((_) {
|
||||||
setState(() {
|
super.initState();
|
||||||
app = flavor;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override Widget build(BuildContext context) {
|
||||||
return new Scaffold(appBar: getAppBar(), body: getScreenContent());
|
return new Scaffold(appBar: getAppBar(), body: getScreenContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
));
|
));
|
||||||
widgetList.add(getValueWithDescription(StringsLocalization.card(), card));
|
widgetList.add(getValueWithDescription(StringsLocalization.card(), card));
|
||||||
|
|
||||||
if (app != 'crypto') { // FIXME Заменить на crypto
|
if (app != 'crypto') {
|
||||||
widgetList.add(getValueWithDescription(StringsLocalization.reward(), loyalty));
|
widgetList.add(getValueWithDescription(StringsLocalization.reward(), loyalty));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
height: buttonHeight,
|
height: buttonHeight,
|
||||||
child: new FlatButton(
|
child: new FlatButton(
|
||||||
child: new Text(title, style: new TextStyle(color: textColor)),
|
child: new Text(title, style: new TextStyle(color: textColor)),
|
||||||
onPressed: () => Navigator.of(context).pop()),
|
onPressed: () => restartScanner()),
|
||||||
decoration: new BoxDecoration(
|
decoration: new BoxDecoration(
|
||||||
border: new Border.all(
|
border: new Border.all(
|
||||||
color: Resources.getButtonColor(app), width: 1.0),
|
color: Resources.getButtonColor(app), width: 1.0),
|
||||||
@@ -437,4 +437,10 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
print('kifio ' + this.loyalty);
|
print('kifio ' + this.loyalty);
|
||||||
print('bonus ' + this.bonus);
|
print('bonus ' + this.bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restartScanner() {
|
||||||
|
helper.getToken().then((token) {
|
||||||
|
Navigator.of(context).pop(token);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
|||||||
int bonusPlus = 0;
|
int bonusPlus = 0;
|
||||||
int bonusMinus = 0;
|
int bonusMinus = 0;
|
||||||
int currency;
|
int currency;
|
||||||
|
String token;
|
||||||
bool showBonus;
|
bool showBonus;
|
||||||
|
|
||||||
bool isAutomaticallyImplyLeading() => false;
|
bool isAutomaticallyImplyLeading() => false;
|
||||||
@@ -51,16 +52,19 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override
|
||||||
|
void initState() {
|
||||||
if (currency == null) {
|
|
||||||
helper.getCurrency().then((currency) {
|
helper.getCurrency().then((currency) {
|
||||||
setState(() {
|
helper.getToken().then((token) {
|
||||||
this.currency = currency;
|
this.currency = currency;
|
||||||
|
this.token = token;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override Widget build(BuildContext context) {
|
||||||
|
|
||||||
if (this.details['sum_bonus'] is String) {
|
if (this.details['sum_bonus'] is String) {
|
||||||
String regexString = r'(\d+) начислено, (\d+).*';
|
String regexString = r'(\d+) начислено, (\d+).*';
|
||||||
RegExp regExp = new RegExp(regexString);
|
RegExp regExp = new RegExp(regexString);
|
||||||
@@ -122,9 +126,8 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
|||||||
return new EdgeInsets.only(bottom: bottom, left: side, right: side);
|
return new EdgeInsets.only(bottom: bottom, left: side, right: side);
|
||||||
}
|
}
|
||||||
|
|
||||||
getScanButton() async {
|
getScanButton() {
|
||||||
String title = StringsLocalization.scan();
|
String title = StringsLocalization.scan();
|
||||||
String token = await helper.getToken();
|
|
||||||
return buildRaisedButton(title, () => Navigator.of(context).pop(token));
|
return buildRaisedButton(title, () => Navigator.of(context).pop(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class RegistrationScreenState extends BaseState<RegistrationScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext ctx) {
|
Widget build(BuildContext ctx) {
|
||||||
return getMainWidget();
|
return new WillPopScope(onWillPop: () => onWillPop(), child: getMainWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -130,4 +130,10 @@ class RegistrationScreenState extends BaseState<RegistrationScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onWillPop() {
|
||||||
|
if (Theme.of(context).platform != TargetPlatform.iOS) {
|
||||||
|
platform.invokeMethod('finish');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ class SettingsState extends BaseState<SettingsScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
print('init state!');
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override Widget build(BuildContext ctx) {
|
@override Widget build(BuildContext ctx) {
|
||||||
|
// TODO: Перенести в initStater
|
||||||
helper.getSettings(true).then((info) {
|
helper.getSettings(true).then((info) {
|
||||||
setState(() {
|
setState(() {
|
||||||
menuItems[0].title = StringsLocalization.currency();
|
menuItems[0].title = StringsLocalization.currency();
|
||||||
@@ -93,7 +93,6 @@ class SettingsState extends BaseState<SettingsScreen> {
|
|||||||
List<Widget> widgets = new List();
|
List<Widget> widgets = new List();
|
||||||
for (int i = 0; i < menuItems.length; i++) {
|
for (int i = 0; i < menuItems.length; i++) {
|
||||||
if (menuItems[i].selectedValue.toString() != '') {
|
if (menuItems[i].selectedValue.toString() != '') {
|
||||||
print('title : ${menuItems[i].title}');
|
|
||||||
widgets.add(
|
widgets.add(
|
||||||
getSettingsItem(() => onPressed(menuItems.indexOf(menuItems[i])),
|
getSettingsItem(() => onPressed(menuItems.indexOf(menuItems[i])),
|
||||||
menuItems[i].title,
|
menuItems[i].title,
|
||||||
@@ -108,7 +107,6 @@ class SettingsState extends BaseState<SettingsScreen> {
|
|||||||
case 0 :
|
case 0 :
|
||||||
return getCurrencyTitle(int.parse(menuItems[position].selectedValue));
|
return getCurrencyTitle(int.parse(menuItems[position].selectedValue));
|
||||||
case 1 :
|
case 1 :
|
||||||
print('val : ${menuItems[position].selectedValue}');
|
|
||||||
return getLocaleTitle(menuItems[position].selectedValue);
|
return getLocaleTitle(menuItems[position].selectedValue);
|
||||||
default :
|
default :
|
||||||
return null;
|
return null;
|
||||||
@@ -188,11 +186,11 @@ class SettingsState extends BaseState<SettingsScreen> {
|
|||||||
helper.getToken().then((token) {
|
helper.getToken().then((token) {
|
||||||
getDeleteTokenRequest(token).then((response) {
|
getDeleteTokenRequest(token).then((response) {
|
||||||
helper.clear().then((result) {
|
helper.clear().then((result) {
|
||||||
Navigator.of(context).pop(null);
|
Navigator.of(context).pop('');
|
||||||
});
|
});
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
print(error.toString());
|
print(error.toString());
|
||||||
Navigator.of(context).pop(null);
|
Navigator.of(context).pop('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:checker/consts.dart';
|
|||||||
import 'package:checker/db.dart';
|
import 'package:checker/db.dart';
|
||||||
import 'package:checker/network.dart';
|
import 'package:checker/network.dart';
|
||||||
import 'package:checker/resources.dart';
|
import 'package:checker/resources.dart';
|
||||||
|
import 'package:checker/screens/faq.dart';
|
||||||
import 'package:checker/screens/finish_registration.dart';
|
import 'package:checker/screens/finish_registration.dart';
|
||||||
import 'package:checker/screens/purchase.dart';
|
import 'package:checker/screens/purchase.dart';
|
||||||
import 'package:checker/screens/registration.dart';
|
import 'package:checker/screens/registration.dart';
|
||||||
@@ -17,6 +18,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
|
|
||||||
|
// FIXME: Сделать запуск всех экранов из одной точки через метод showNextScreen()
|
||||||
class SplashScreen extends BaseScreen {
|
class SplashScreen extends BaseScreen {
|
||||||
|
|
||||||
SplashScreen(SqliteHelper helper, String app) : super(helper, app);
|
SplashScreen(SqliteHelper helper, String app) : super(helper, app);
|
||||||
@@ -40,7 +42,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext ctx) {
|
Widget build(BuildContext ctx) {
|
||||||
return a ? new Container(
|
return !a ? new Container(
|
||||||
decoration: new BoxDecoration(
|
decoration: new BoxDecoration(
|
||||||
image: new DecorationImage(
|
image: new DecorationImage(
|
||||||
image: new ExactAssetImage(Resources.getSplash(null)),
|
image: new ExactAssetImage(Resources.getSplash(null)),
|
||||||
@@ -76,10 +78,15 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
var route = new MaterialPageRoute<String>(
|
var route = new MaterialPageRoute<String>(
|
||||||
builder: (BuildContext context) => screen, fullscreenDialog: true);
|
builder: (BuildContext context) => screen, fullscreenDialog: true);
|
||||||
Navigator.of(context).push(route).then((token) {
|
Navigator.of(context).push(route).then((token) {
|
||||||
if (token != null) {
|
if (token == '') {
|
||||||
|
showNextScreen(new RegistrationScreen(helper, app));
|
||||||
|
} else if (token != null) {
|
||||||
_initAndStartScanner(context, app, token, helper);
|
_initAndStartScanner(context, app, token, helper);
|
||||||
} else {
|
} else {
|
||||||
showNextScreen(new RegistrationScreen(helper, app));
|
print('Произошла непредусмотренная ошибка в логике приложения');
|
||||||
|
helper.getToken().then((token) {
|
||||||
|
_initAndStartScanner(context, app, token, helper);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -209,15 +216,25 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (call.method == 'faq') {
|
} else if (call.method == 'faq') {
|
||||||
faq(helper, app, context, true);
|
|
||||||
} else if (call.method == 'settings') {
|
|
||||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||||
var route = new MaterialPageRoute<Null>(
|
var route = new MaterialPageRoute<Null>(
|
||||||
builder: (BuildContext context) => new SettingsScreen(helper, app, true), fullscreenDialog: true);
|
builder: (BuildContext context) => new FAQScreen(helper, app), fullscreenDialog: true);
|
||||||
Navigator.of(context).push(route).then((_) {
|
Navigator.of(context).push(route).then((_) {
|
||||||
_initAndStartScanner(context, app, token, helper);
|
_initAndStartScanner(context, app, token, helper);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else if (call.method == 'settings') {
|
||||||
|
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||||
|
var route = new MaterialPageRoute<String>(
|
||||||
|
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 {
|
} else {
|
||||||
String userString = call.arguments[0] is String
|
String userString = call.arguments[0] is String
|
||||||
? call.arguments[0]
|
? call.arguments[0]
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
|
image_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: image_picker
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.5"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ dependencies:
|
|||||||
sprintf: "^3.0.2"
|
sprintf: "^3.0.2"
|
||||||
path_provider: "^0.2.1+1"
|
path_provider: "^0.2.1+1"
|
||||||
sqflite: any
|
sqflite: any
|
||||||
|
image_picker: '^0.1.3' # use for ask permissions @ iOS
|
||||||
xml: "^2.6.0"
|
xml: "^2.6.0"
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|||||||
Reference in New Issue
Block a user