mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-24 14:32:37 +01:00
fix: Init hive
This commit is contained in:
parent
0dc819f5a6
commit
feb66d6de4
@ -2,8 +2,10 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:matrix/encryption/utils/key_verification.dart';
|
import 'package:matrix/encryption/utils/key_verification.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
import 'famedlysdk_store.dart';
|
import 'famedlysdk_store.dart';
|
||||||
import 'matrix_sdk_extensions.dart/flutter_matrix_hive_database.dart';
|
import 'matrix_sdk_extensions.dart/flutter_matrix_hive_database.dart';
|
||||||
@ -11,6 +13,11 @@ import 'matrix_sdk_extensions.dart/flutter_matrix_hive_database.dart';
|
|||||||
abstract class ClientManager {
|
abstract class ClientManager {
|
||||||
static const String clientNamespace = 'im.fluffychat.store.clients';
|
static const String clientNamespace = 'im.fluffychat.store.clients';
|
||||||
static Future<List<Client>> getClients() async {
|
static Future<List<Client>> getClients() async {
|
||||||
|
if (PlatformInfos.isLinux) {
|
||||||
|
Hive.init((await getApplicationSupportDirectory()).path);
|
||||||
|
} else {
|
||||||
|
await Hive.initFlutter();
|
||||||
|
}
|
||||||
final clientNames = <String>{};
|
final clientNames = <String>{};
|
||||||
try {
|
try {
|
||||||
final rawClientNames = await Store().getItem(clientNamespace);
|
final rawClientNames = await Store().getItem(clientNamespace);
|
||||||
|
@ -49,11 +49,6 @@ class FlutterMatrixHiveStore extends FamedlySdkHiveDatabase {
|
|||||||
Client client) async {
|
Client client) async {
|
||||||
if (!kIsWeb && !_hiveInitialized) {
|
if (!kIsWeb && !_hiveInitialized) {
|
||||||
Logs().i('Init Hive database...');
|
Logs().i('Init Hive database...');
|
||||||
if (PlatformInfos.isLinux) {
|
|
||||||
Hive.init((await getApplicationSupportDirectory()).path);
|
|
||||||
} else {
|
|
||||||
await Hive.initFlutter();
|
|
||||||
}
|
|
||||||
_hiveInitialized = true;
|
_hiveInitialized = true;
|
||||||
}
|
}
|
||||||
HiveCipher hiverCipher;
|
HiveCipher hiverCipher;
|
||||||
|
Loading…
Reference in New Issue
Block a user