mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-23 22:12:34 +01:00
chore: Migrate back to collection
This commit is contained in:
parent
703cc1109f
commit
06ee00464a
@ -104,8 +104,8 @@ abstract class ClientManager {
|
||||
EventTypes.RoomPowerLevels,
|
||||
},
|
||||
logLevel: kReleaseMode ? Level.warning : Level.verbose,
|
||||
databaseBuilder: FlutterFluffyBoxDatabase.databaseBuilder,
|
||||
legacyDatabaseBuilder: FlutterHiveCollectionsDatabase.databaseBuilder,
|
||||
databaseBuilder: FlutterHiveCollectionsDatabase.databaseBuilder,
|
||||
legacyDatabaseBuilder: FlutterFluffyBoxDatabase.databaseBuilder,
|
||||
supportedLoginTypes: {
|
||||
AuthenticationTypes.password,
|
||||
if (PlatformInfos.isMobile ||
|
||||
|
@ -21,7 +21,7 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
||||
key: key,
|
||||
);
|
||||
|
||||
static const String _cipherStorageKey = 'database_encryption_key';
|
||||
static const String _cipherStorageKey = 'hive_encryption_key';
|
||||
|
||||
static Future<FlutterHiveCollectionsDatabase> databaseBuilder(
|
||||
Client client) async {
|
||||
@ -71,7 +71,8 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
||||
} catch (e, s) {
|
||||
Logs().w('Unable to open Hive. Delete database and storage key...', e, s);
|
||||
const FlutterSecureStorage().delete(key: _cipherStorageKey);
|
||||
await db.clear();
|
||||
await db.clear().catchError((_) {});
|
||||
await Hive.deleteFromDisk();
|
||||
rethrow;
|
||||
}
|
||||
Logs().d('Hive is ready');
|
||||
@ -96,10 +97,10 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
||||
}
|
||||
}
|
||||
// do not destroy your stable FluffyChat in debug mode
|
||||
if (kDebugMode) {
|
||||
directory = Directory(directory.uri.resolve('debug').toFilePath());
|
||||
directory.create(recursive: true);
|
||||
}
|
||||
directory = Directory(directory.uri
|
||||
.resolve(kDebugMode ? 'hive_debug' : 'hive')
|
||||
.toFilePath());
|
||||
directory.create(recursive: true);
|
||||
path = directory.path;
|
||||
}
|
||||
return path;
|
||||
|
@ -839,7 +839,7 @@ packages:
|
||||
name: hive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
version: "2.2.3"
|
||||
hive_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -52,7 +52,7 @@ dependencies:
|
||||
future_loading_dialog: ^0.2.3
|
||||
geolocator: ^7.6.2
|
||||
handy_window: ^0.1.6
|
||||
hive: 2.2.1 # Newer version will break migration from hive collections
|
||||
hive: ^2.2.3
|
||||
hive_flutter: ^1.1.0
|
||||
http: ^0.13.4
|
||||
image: ^3.1.1
|
||||
|
Loading…
Reference in New Issue
Block a user