Merge branch 'krille/updatesdk' into 'main'

chore: Update SDK and remove boxes on corruption

See merge request famedly/fluffychat!562
This commit is contained in:
Krille Fear 2021-11-21 11:19:18 +00:00
commit 623d851645
2 changed files with 14 additions and 3 deletions

View File

@ -12,6 +12,9 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import '../client_manager.dart';
import '../famedlysdk_store.dart';
class FlutterFluffyBoxDatabase extends FluffyBoxDatabase { class FlutterFluffyBoxDatabase extends FluffyBoxDatabase {
FlutterFluffyBoxDatabase( FlutterFluffyBoxDatabase(
String name, String name,
@ -60,7 +63,15 @@ class FlutterFluffyBoxDatabase extends FluffyBoxDatabase {
await _findDatabasePath(client), await _findDatabasePath(client),
key: hiverCipher, key: hiverCipher,
); );
try {
await db.open(); await db.open();
} catch (_) {
Logs().w('Unable to open FluffyBox. Delete database and storage key...');
await Store().deleteItem(ClientManager.clientNamespace);
const FlutterSecureStorage().delete(key: _cipherStorageKey);
await db.clear();
rethrow;
}
Logs().d('FluffyBox is ready'); Logs().d('FluffyBox is ready');
return db; return db;
} }

View File

@ -364,7 +364,7 @@ packages:
name: fluffybox name: fluffybox
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.6" version: "0.3.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -782,7 +782,7 @@ packages:
description: description:
path: "." path: "."
ref: "krille/idb" ref: "krille/idb"
resolved-ref: "74037fb8ae0f4c4e1ac946d7c2057bf6e2da7aaf" resolved-ref: e4d9ee12a84d804d3de190db6fe597eea72bd094
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git" url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
source: git source: git
version: "0.7.0-nullsafety.6" version: "0.7.0-nullsafety.6"