fixed bugs in ios version
This commit is contained in:
@@ -101,7 +101,7 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
||||
|
||||
if (call.method == 'logout') {
|
||||
forceLogout(token, context);
|
||||
} else if (call.method == 'findUserAndPurchase') {
|
||||
} else if (call.method == 'findUser') {
|
||||
|
||||
var userResponse;
|
||||
String cardPhone = call.arguments[0];
|
||||
@@ -129,25 +129,10 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
||||
print(error);
|
||||
}
|
||||
|
||||
print(users.length);
|
||||
|
||||
if (users.length > 0) {
|
||||
String userString = '${users[0]['first_name']} ${users[0]['last_name']}';
|
||||
|
||||
print(userString);
|
||||
print(cardPhone);
|
||||
// pushRoute(context, new PurchaseScreen(helper, app, JSON.encode(users[0]), cardPhone));
|
||||
|
||||
var route = new MaterialPageRoute<Null>(
|
||||
builder: (BuildContext context) =>
|
||||
new PurchaseScreen(helper, app, JSON.encode(users[0]), cardPhone)
|
||||
);
|
||||
while (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
Navigator.of(context).pushReplacement(route);
|
||||
|
||||
return users[0];
|
||||
} else {
|
||||
startScanner(context, app, helper);
|
||||
throw new FlutterError("Users not found");
|
||||
}
|
||||
|
||||
@@ -157,8 +142,16 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
||||
} else if (call.method == 'settings') {
|
||||
pushRoute(context, new SettingsScreen(helper, app, true));
|
||||
} else {
|
||||
String userString = call.arguments[0];
|
||||
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');
|
||||
var route = new MaterialPageRoute<Null>(
|
||||
|
||||
Reference in New Issue
Block a user