diff --git a/lib/src/database/hive_collections_database.dart b/lib/src/database/hive_collections_database.dart index 67ed8e69..6bfb8b04 100644 --- a/lib/src/database/hive_collections_database.dart +++ b/lib/src/database/hive_collections_database.dart @@ -38,6 +38,12 @@ class HiveCollectionsDatabase extends DatabaseApi { final String name; final String? path; final HiveCipher? key; + final Future Function( + String name, + Set boxNames, { + String? path, + HiveCipher? key, + }) collectionFactory; late BoxCollection _collection; late CollectionBox _clientBox; late CollectionBox _accountDataBox; @@ -118,13 +124,18 @@ class HiveCollectionsDatabase extends DatabaseApi { String get _seenDeviceKeysBoxName => 'box_seen_device_keys'; - HiveCollectionsDatabase(this.name, this.path, {this.key}); + HiveCollectionsDatabase( + this.name, + this.path, { + this.key, + this.collectionFactory = BoxCollection.open, + }); @override int get maxFileSize => 0; Future open() async { - _collection = await BoxCollection.open( + _collection = await collectionFactory( name, { _clientBoxName,