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