WIP
This commit is contained in:
parent
f115f767fe
commit
0661db5fcd
|
@ -1,5 +1,6 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||
|
||||
class LogUtil {
|
||||
|
@ -11,11 +12,11 @@ class LogUtil {
|
|||
log("Error: ${error.toString()}");
|
||||
log("Stack: ${stack.toString()}");
|
||||
|
||||
// FirebaseCrashlytics.instance
|
||||
// .setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url");
|
||||
// FirebaseCrashlytics.instance.setCustomKey('Body', body);
|
||||
//
|
||||
// await FirebaseCrashlytics.instance
|
||||
// .recordError(error, stack, reason: reason);
|
||||
FirebaseCrashlytics.instance
|
||||
.setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url");
|
||||
FirebaseCrashlytics.instance.setCustomKey('Body', body);
|
||||
|
||||
await FirebaseCrashlytics.instance
|
||||
.recordError(error, stack, reason: reason);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import 'package:hub/shared/helpers/secure_storage_helper.dart';
|
|||
import 'package:hub/shared/helpers/shared_preferences_storage_helper.dart';
|
||||
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||
import 'package:hub/shared/utils/cache_util.dart';
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
enum StorageType { secureStorage, sharedPreferences, dbSQLite3 }
|
||||
|
@ -124,14 +126,20 @@ class StorageUtil {
|
|||
}
|
||||
|
||||
Future<void> initSharedPreferences() async {
|
||||
_sharedPreferences.prefs ??= await SharedPreferences.getInstance();
|
||||
final bool milestone =
|
||||
_sharedPreferences.prefs?.getBool('milestone') ?? true;
|
||||
if (milestone) {
|
||||
isFirstRun = false;
|
||||
await _sharedPreferences.prefs?.setBool('milestone', false);
|
||||
_secureStorage.purge();
|
||||
_sqliteStorage.purge();
|
||||
try {
|
||||
_sharedPreferences.prefs ??= await SharedPreferences.getInstance();
|
||||
final bool milestone =
|
||||
_sharedPreferences.prefs?.getBool('milestone') ?? true;
|
||||
if (milestone) {
|
||||
isFirstRun = false;
|
||||
await _sharedPreferences.prefs?.setBool('milestone', false);
|
||||
_secureStorage.purge();
|
||||
_sqliteStorage.purge();
|
||||
}
|
||||
} catch (e, s) {
|
||||
log('SharedPreferencesStorageHelper: Error during initialization');
|
||||
LogUtil.requestAPIFailed(
|
||||
'$UniqueKey', '$UniqueKey', 'SharedPreferencesStorageHelper', e, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,8 +156,9 @@ class StorageUtil {
|
|||
_fingerprintPass = await _secureStorage.getString('fingerprintPass');
|
||||
_haveLocal = await _secureStorage.getBool('ff_have_local') ?? false;
|
||||
_deviceDescription = await _secureStorage.getString('deviceDescription');
|
||||
} catch (e) {
|
||||
} catch (e, s) {
|
||||
log('SecureStorageHelper: Error during initialization: $e');
|
||||
LogUtil.requestAPIFailed('$UniqueKey', '$UniqueKey', 'SecureStorageHelper', e, s);
|
||||
}
|
||||
log('SecureStorageHelper: Initialization complete');
|
||||
}
|
||||
|
@ -178,8 +187,9 @@ class StorageUtil {
|
|||
_person = await _sqliteStorage.getBoolean('person');
|
||||
_requestOSnotification =
|
||||
await _sqliteStorage.getBoolean('requestOSnotification');
|
||||
} catch (e) {
|
||||
} catch (e, s) {
|
||||
log('SQLiteStorageHelper: Error during initialization: $e');
|
||||
LogUtil.requestAPIFailed('$UniqueKey', '$UniqueKey', 'SQLiteStorageHelper', e, s);
|
||||
}
|
||||
log('SQLiteStorageHelper: Initialization complete');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue