Merge branch 'soru/desktop-e2ee-files' into 'main'

fix: show thumbnails in timeline on desktop

See merge request famedly/fluffychat!438
This commit is contained in:
Krille Fear 2021-07-13 16:30:02 +00:00
commit b5b9a05511

View File

@ -10,6 +10,8 @@ import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import '../platform_infos.dart';
class FlutterFamedlySdkHiveDatabase extends FamedlySdkHiveDatabase { class FlutterFamedlySdkHiveDatabase extends FamedlySdkHiveDatabase {
FlutterFamedlySdkHiveDatabase(String name, {HiveCipher encryptionCipher}) FlutterFamedlySdkHiveDatabase(String name, {HiveCipher encryptionCipher})
: super( : super(
@ -24,7 +26,7 @@ class FlutterFamedlySdkHiveDatabase 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 (!kIsWeb && Platform.isLinux) { if (PlatformInfos.isLinux) {
Hive.init((await getApplicationSupportDirectory()).path); Hive.init((await getApplicationSupportDirectory()).path);
} else { } else {
await Hive.initFlutter(); await Hive.initFlutter();
@ -67,13 +69,18 @@ class FlutterFamedlySdkHiveDatabase extends FamedlySdkHiveDatabase {
@override @override
int get maxFileSize => supportsFileStoring ? 100 * 1024 * 1024 : 0; int get maxFileSize => supportsFileStoring ? 100 * 1024 * 1024 : 0;
@override @override
bool get supportsFileStoring => bool get supportsFileStoring => (PlatformInfos.isIOS ||
!kIsWeb && (Platform.isIOS || Platform.isAndroid); PlatformInfos.isAndroid ||
PlatformInfos.isDesktop);
Future<String> _getFileStoreDirectory() async { Future<String> _getFileStoreDirectory() async {
try { try {
return (await getApplicationDocumentsDirectory()).path; try {
} on MissingPlatformDirectoryException catch (_) { return (await getApplicationSupportDirectory()).path;
} on MissingPlatformDirectoryException {
return (await getApplicationDocumentsDirectory()).path;
}
} on MissingPlatformDirectoryException {
return (await getDownloadsDirectory()).path; return (await getDownloadsDirectory()).path;
} }
} }