chore: Ask for storage persistence

pull/444/head
Krille 2 years ago
parent ccfcaf9373
commit ad93f71d05

@ -8,6 +8,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:universal_html/html.dart' as html;
class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase { class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
FlutterHiveCollectionsDatabase( FlutterHiveCollectionsDatabase(
@ -29,7 +30,11 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
HiveAesCipher? hiverCipher; HiveAesCipher? hiverCipher;
try { try {
// Workaround for secure storage is calling Platform.operatingSystem on web // Workaround for secure storage is calling Platform.operatingSystem on web
if (kIsWeb) throw MissingPluginException(); if (kIsWeb) {
// ignore: unawaited_futures
html.window.navigator.storage?.persist();
throw MissingPluginException();
}
const secureStorage = FlutterSecureStorage(); const secureStorage = FlutterSecureStorage();
final containsEncryptionKey = final containsEncryptionKey =

Loading…
Cancel
Save