Sincronizar dados remotos com as opções do sistema
This commit is contained in:
parent
d2e12b31f4
commit
926944b178
|
@ -37,10 +37,12 @@ class LocalsLocalDataSourceImpl implements LocalsLocalDataSource {
|
|||
|
||||
@override
|
||||
Future<void> set<T>(String key, T value) async {
|
||||
var date = DateTime.now().toIso8601String();
|
||||
final String? local =
|
||||
await StorageHelper().get(ProfileStorageKey.clientUUID.key);
|
||||
await DatabaseService.database.insert(
|
||||
try {
|
||||
var date = DateTime.now().toIso8601String();
|
||||
final String? local =
|
||||
await StorageHelper().get(ProfileStorageKey.clientUUID.key);
|
||||
|
||||
await DatabaseService.database.insert(
|
||||
LocalsConstants.tableLocalsKeychain,
|
||||
{
|
||||
'key': key,
|
||||
|
@ -49,9 +51,11 @@ class LocalsLocalDataSourceImpl implements LocalsLocalDataSource {
|
|||
'updateAt': date,
|
||||
'resolvedAt': date,
|
||||
'createdAt': date,
|
||||
'locals': local
|
||||
'local': local
|
||||
},
|
||||
conflictAlgorithm: ConflictAlgorithm.replace);
|
||||
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||
);
|
||||
} catch (e, s) {}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'package:hub/features/local/index.dart';
|
|||
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
import 'package:hub/shared/extensions/index.dart';
|
||||
|
||||
class LocalUtil {
|
||||
static void handleError(BuildContext context, String errorMsg) async {
|
||||
|
@ -121,14 +120,14 @@ class LocalUtil {
|
|||
jsonBody['visitado']['VDO_NOTTERCEIROS'],
|
||||
),
|
||||
);
|
||||
if (jsonBody['visitado']['VDO_SENHA'] == '') {
|
||||
if (jsonBody['visitado']['VDO_TEM_SENHA_ACESSO'] == '') {
|
||||
await StorageHelper().set(
|
||||
LocalsStorageKey.access.key,
|
||||
_processSystemOption(jsonBody['visitado']['VDO_SENHA']),
|
||||
_processSystemOption(jsonBody['visitado']['VDO_TEM_SENHA_ACESSO']),
|
||||
);
|
||||
await StorageHelper().set(
|
||||
LocalsStorageKey.panic.key,
|
||||
_processSystemOption(jsonBody['visitado']['VDO_SENHA_PANICO']),
|
||||
_processSystemOption(jsonBody['visitado']['VDO_TEM_SENHA_PANICO']),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ class LocalsConstants {
|
|||
updateAt TEXT,
|
||||
resolvedAt TEXT,
|
||||
createdAt TEXT,
|
||||
local TEXT
|
||||
local TEXT,
|
||||
UNIQUE (key, local)
|
||||
);
|
||||
''';
|
||||
static String get deleteLocalsTable =>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:hub/features/module/index.dart';
|
||||
import 'package:hub/features/storage/index.dart';
|
||||
import 'package:hub/shared/constants/index.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path/path.dart';
|
||||
|
||||
|
@ -57,6 +56,7 @@ class DatabaseService {
|
|||
Database database, int oldVersion, int newVersion) async {
|
||||
print('Upgrading database from version $oldVersion to $newVersion...');
|
||||
if (oldVersion < 2 && newVersion >= 2) {
|
||||
await database.execute(LicenseConstants.createLicenseTable);
|
||||
await database.execute(LicenseConstants.updatePetsHistoryTrigger);
|
||||
await database.execute(LicenseConstants.updateDisplayTrigger);
|
||||
await database.execute(LicenseConstants.insertDisplayTrigger);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
|
|
@ -24,6 +24,9 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
late bool isPanic = false;
|
||||
|
||||
Future<void> _initialize() async {
|
||||
log(
|
||||
'TESTE:' + '${await StorageHelper().get(LocalsStorageKey.notify.key)}',
|
||||
);
|
||||
isFingerprint =
|
||||
await StorageHelper().get(LocalsStorageKey.fingerprint.key) == 'true';
|
||||
isPerson = await StorageHelper().get(LocalsStorageKey.person.key) == 'true';
|
||||
|
@ -66,8 +69,7 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
.call(notifica: value)
|
||||
.then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
await StorageHelper().set(
|
||||
LocalsStorageKey.notify.key, isNotify ? 'false' : 'true');
|
||||
await StorageHelper().set(LocalsStorageKey.notify.key, !isNotify);
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Notification changed successfully',
|
||||
ptText: 'Notificação alterada com sucesso',
|
||||
|
@ -147,8 +149,8 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
.then((value) async {
|
||||
final String content;
|
||||
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
|
||||
await StorageHelper().set(
|
||||
LocalsStorageKey.access.key, isAccess ? 'false' : 'true');
|
||||
await StorageHelper()
|
||||
.set(LocalsStorageKey.access.key, isAccess ? false : true);
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Access pass changed successfully',
|
||||
|
|
Loading…
Reference in New Issue