Almost all done, need fix logout.

This commit is contained in:
Ivan Murashov
2018-03-11 12:48:45 +03:00
parent 47b45eecbf
commit 0c5645c059
4 changed files with 12 additions and 14 deletions

Binary file not shown.

View File

@@ -46,6 +46,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
@override @override
void initState() { void initState() {
loading = true;
requestAsyncData(user); requestAsyncData(user);
super.initState(); super.initState();
} }
@@ -225,9 +226,6 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
} }
requestAsyncData(Map user) async { requestAsyncData(Map user) async {
setState(() {
loading = true;
});
bool showBonus = await platform.invokeMethod('showBonus'); bool showBonus = await platform.invokeMethod('showBonus');
if (await platform.invokeMethod('isOnline')) { if (await platform.invokeMethod('isOnline')) {
var response, couponResponse; var response, couponResponse;
@@ -248,8 +246,8 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
coupons['results'].forEach((couponItem) { coupons['results'].forEach((couponItem) {
couponItem['isSet'] = false; couponItem['isSet'] = false;
}); });
setState(() { setState(() {
loading = false;
this.coupons = coupons['results']; this.coupons = coupons['results'];
this.loyalityType = loyality['type']; this.loyalityType = loyality['type'];
setBonuses(loyality, showBonus); setBonuses(loyality, showBonus);
@@ -343,6 +341,9 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
} }
purchase(String sumTotal) async { purchase(String sumTotal) async {
setState(() {
loading = true;
});
if (await platform.invokeMethod('isOnline')) { if (await platform.invokeMethod('isOnline')) {
if (!purchaseInProgress) { if (!purchaseInProgress) {
purchaseInProgress = true; purchaseInProgress = true;
@@ -363,7 +364,6 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
'curr_iso_code': currency.toString(), 'curr_iso_code': currency.toString(),
'commit': 'true', 'commit': 'true',
'sum_total': sumTotal, 'sum_total': sumTotal,
// 'coupons': []
}; };
if (bonusController.text.length > 0) { if (bonusController.text.length > 0) {

View File

@@ -28,20 +28,13 @@ class SplashScreen extends BaseScreen {
class _SplashScreenState extends BaseState<SplashScreen> { class _SplashScreenState extends BaseState<SplashScreen> {
_SplashScreenState(SqliteHelper helper, String app) : super(helper, app); _SplashScreenState(SqliteHelper helper, String app) : super(helper, app);
bool a = false; bool a = true;
bool isAutomaticallyImplyLeading() => false; bool isAutomaticallyImplyLeading() => false;
@override @override
void initState() { void initState() {
showNextScreen();
print('init state!');
new Future.delayed(const Duration(milliseconds: 1000), () {
showNextScreen();
a = true;
});
super.initState(); super.initState();
} }
@@ -173,6 +166,11 @@ class _SplashScreenState extends BaseState<SplashScreen> {
SqliteHelper helper) { SqliteHelper helper) {
// Канал ловит вызовы методов из "нативной" части приложения. // Канал ловит вызовы методов из "нативной" части приложения.
// Могут быть вызваны либо exit либо faq, либо purchase. // Могут быть вызваны либо exit либо faq, либо purchase.
setState(() {
a = false;
});
platform.setMethodCallHandler((MethodCall call) async { platform.setMethodCallHandler((MethodCall call) async {
print(this.toString()); print(this.toString());
if (call.method == 'findUser') { if (call.method == 'findUser') {