Название приложения в шапке не null, необходимо проверить исправление падений при возвращении на экран сканнера с экрана настроек

This commit is contained in:
Ivan Murashov
2017-09-25 19:16:26 +03:00
parent 8c07485061
commit 9f2bf14199
3 changed files with 26 additions and 16 deletions

View File

@@ -86,7 +86,6 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
});
} else {
String token = await helper.getToken();
helper.close();
// Канал ловит вызовы методов из "нативной" части приложения.
// Могут быть вызваны либо logout либо faq, либо purchase.
if (token != null) {
@@ -96,10 +95,14 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
} else if (call.method == 'faq') {
faq(context, true);
} else if(call.method == 'settings') {
helper = new SqliteHelper();
helper.open().then((_) {
if (helper == null) {
helper = new SqliteHelper();
helper.open().then((_) {
pushRoute(context, new SettingsScreen(helper, app, true));
});
} else {
pushRoute(context, new SettingsScreen(helper, app, true));
});
}
} else {
String userString = call.arguments[0];
String card = call.arguments[1];
@@ -114,20 +117,22 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
}
});
platform.invokeMethod('getEndpoint').then((endpoint) {
platform.invokeMethod('getAppToken').then((appToken) async {
platform.invokeMethod('startScanner', {
'token': token,
'url': endpoint,
'appToken': appToken,
'locale': Intl.defaultLocale,
'color': Resources
.getPrimaryColor(app)
.value
helper.close().then((_){
helper = null;
platform.invokeMethod('getEndpoint').then((endpoint) {
platform.invokeMethod('getAppToken').then((appToken) async {
platform.invokeMethod('startScanner', {
'token': token,
'url': endpoint,
'appToken': appToken,
'locale': Intl.defaultLocale,
'color': Resources
.getPrimaryColor(app)
.value
});
});
});
});
}
}
}