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