|
|
@@ -26,15 +26,21 @@ class LoginControllerImp extends LoginController {
|
|
|
@override
|
|
|
Future<(String, String)> getQrCode() async {
|
|
|
final r = await _api.stub.toGetSignInQrCode(DefaultRequest());
|
|
|
- final json = const JsonEncoder()
|
|
|
- .convert({'KeyType': 'BusinessLogin', 'code': r.qrCode});
|
|
|
+ final json = const JsonEncoder().convert({'KeyType': 2, 'code': r.qrCode});
|
|
|
return (json, r.qrCode);
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Future<bool> isQrCodeOk(String codeValue) async {
|
|
|
+ if (codeValue.isEmpty) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
final r =
|
|
|
await _api.stub.toQrCodeSignIn(pb.QrCodeInfo()..qrCode = qrCodeValue);
|
|
|
+ final token = r.token.replaceAll("\"", "").trim();
|
|
|
+ if (token.isEmpty) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
_api.token = r.token;
|
|
|
return true;
|
|
|
}
|