milestone fd-940
This commit is contained in:
parent
0933fb885c
commit
aeb1a07f24
|
@ -1,10 +1,13 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage_helper.dart';
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
import 'package:hub/shared/utils/validator_util.dart';
|
||||
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
|
@ -665,7 +668,15 @@ class LoginCall {
|
|||
(await StorageHelper().get(SecureStorageKey.deviceType.value, Storage.SecureStorage)) ?? '';
|
||||
final String description =
|
||||
(await StorageHelper().get(SecureStorageKey.deviceDescription.value, Storage.SecureStorage)) ?? '';
|
||||
final String token = await FirebaseMessagingService.getToken();
|
||||
late final String token;
|
||||
try {
|
||||
token = await FirebaseMessagingService.getToken();
|
||||
if(token == null || token.isEmpty) throw Exception('Token is empty'); }
|
||||
catch (e, s) {
|
||||
token = '';
|
||||
log('Error getting token', error: e, stackTrace: s);
|
||||
LogUtil.requestAPIFailed('login.php', email, "Login", e, s);
|
||||
}
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
callName: 'login',
|
||||
|
@ -803,10 +814,8 @@ class GetLocalsCall {
|
|||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID =
|
||||
(await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String userUUID =
|
||||
(await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String devUUID = await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage) ?? '';
|
||||
final String userUUID = await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage) ?? '';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
callName: 'getLocals',
|
||||
|
|
|
@ -44,8 +44,7 @@ class AuthenticationService {
|
|||
final ApiCallResponse? response;
|
||||
final LoginCall callback = PhpGroup.loginCall;
|
||||
String deviceDescription = randomString(10, 10, true, false, false);
|
||||
await StorageHelper()
|
||||
.set(SecureStorageKey.deviceDescription.value, deviceDescription, Storage.SecureStorage);
|
||||
await StorageHelper().set(SecureStorageKey.deviceDescription.value, deviceDescription, Storage.SecureStorage);
|
||||
|
||||
final String? devUUID;
|
||||
final String userUUID;
|
||||
|
@ -85,9 +84,7 @@ class AuthenticationService {
|
|||
DialogUtil.error(context, response.jsonBody['error_msg'].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
} return;
|
||||
} catch (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed('login.php', emailAdress.toString(), "Login", e, s);
|
||||
|
|
|
@ -213,11 +213,17 @@ class LocalizationService {
|
|||
// await DialogUtil.error(context, errorMsg).whenComplete(() async => await AuthenticationService.signOut(context));
|
||||
}
|
||||
else if (isAuthenticated && !isDevLinked) {
|
||||
final String log = '''
|
||||
|
||||
devUUID: $devUUID
|
||||
userUUID: $userUUID
|
||||
|
||||
''';
|
||||
errorMsg = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Não foi possível vincular o dispositivo, tente novamente',
|
||||
ptText: 'Não foi possível vincular o dispositivo, tente novamente.',
|
||||
enText: 'Unable to link device, try again',
|
||||
);
|
||||
await DialogUtil.warning(context, errorMsg);
|
||||
await DialogUtil.warning(context, errorMsg+log);
|
||||
}
|
||||
else if (isAuthenticated && isDevLinked) await DialogUtil.error(context, errorMsg).whenComplete(() async => await selectLocal(context));
|
||||
|
||||
|
|
Loading…
Reference in New Issue