chore: defaultly save files on Android
- defaultly save files on Android instead of share - add dedicated share button for files and images on Android - use ListTile instead of row to display file event - update file_picker_cross Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
14a6047fef
commit
49caad00c0
9 changed files with 137 additions and 68 deletions
|
|
@ -8,18 +8,28 @@ import 'package:matrix/matrix.dart';
|
|||
import 'matrix_file_extension.dart';
|
||||
|
||||
extension LocalizedBody on Event {
|
||||
Future<LoadingDialogResult<MatrixFile?>> _getFile(BuildContext context) =>
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => downloadAndDecryptAttachmentCached(),
|
||||
);
|
||||
|
||||
void saveFile(BuildContext context) async {
|
||||
final matrixFile = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => downloadAndDecryptAttachmentCached(),
|
||||
);
|
||||
final matrixFile = await _getFile(context);
|
||||
|
||||
matrixFile.result?.save(context);
|
||||
}
|
||||
|
||||
void shareFile(BuildContext context) async {
|
||||
final matrixFile = await _getFile(context);
|
||||
|
||||
matrixFile.result?.share(context);
|
||||
}
|
||||
|
||||
bool get isAttachmentSmallEnough =>
|
||||
infoMap['size'] is int &&
|
||||
infoMap['size'] < room.client.database!.maxFileSize;
|
||||
|
||||
bool get isThumbnailSmallEnough =>
|
||||
thumbnailInfoMap['size'] is int &&
|
||||
thumbnailInfoMap['size'] < room.client.database!.maxFileSize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue