fix: iOS build
This commit is contained in:
parent
9bea5311ce
commit
272641e016
10 changed files with 186 additions and 224 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:android_path_provider/android_path_provider.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
|
@ -7,7 +8,6 @@ import 'package:open_file/open_file.dart';
|
|||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:universal_html/prefer_universal/html.dart' as html;
|
||||
import 'package:mime_type/mime_type.dart';
|
||||
import 'package:downloads_path_provider_28/downloads_path_provider_28.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
extension MatrixFileExtension on MatrixFile {
|
||||
|
|
@ -29,12 +29,12 @@ extension MatrixFileExtension on MatrixFile {
|
|||
} else {
|
||||
if (!(await Permission.storage.request()).isGranted) return;
|
||||
final downloadsDir = PlatformInfos.isDesktop
|
||||
? (await getDownloadsDirectory())
|
||||
? (await getDownloadsDirectory()).path
|
||||
: Platform.isAndroid
|
||||
? (await DownloadsPathProvider.downloadsDirectory)
|
||||
: (await getApplicationDocumentsDirectory());
|
||||
? (await AndroidPathProvider.downloadsPath)
|
||||
: (await getApplicationDocumentsDirectory()).path;
|
||||
|
||||
final file = File(downloadsDir.path + '/' + name.split('/').last);
|
||||
final file = File(downloadsDir + '/' + name.split('/').last);
|
||||
file.writeAsBytesSync(bytes);
|
||||
await OpenFile.open(file.path);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue