feat: Make possible to overwrite boxcollection opener in Hive Collections Database
This commit is contained in:
parent
6ab9483d73
commit
efe8e7e5ac
|
|
@ -38,6 +38,12 @@ class HiveCollectionsDatabase extends DatabaseApi {
|
|||
final String name;
|
||||
final String? path;
|
||||
final HiveCipher? key;
|
||||
final Future<BoxCollection> Function(
|
||||
String name,
|
||||
Set<String> boxNames, {
|
||||
String? path,
|
||||
HiveCipher? key,
|
||||
}) collectionFactory;
|
||||
late BoxCollection _collection;
|
||||
late CollectionBox<String> _clientBox;
|
||||
late CollectionBox<Map> _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<void> open() async {
|
||||
_collection = await BoxCollection.open(
|
||||
_collection = await collectionFactory(
|
||||
name,
|
||||
{
|
||||
_clientBoxName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue