8000 feat: support xdp selector for linux by Decodetalkers · Pull Request #1981 · krille-chan/fluffychat · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: support xdp selector for linux #1981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 10 additions & 24 deletions lib/utils/file_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter/widgets.dart';
import 'package:file_picker/file_picker.dart';
import 'package:file_selector/file_selector.dart';

import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/app_lock.dart';
import 'package:fluffychat/widgets/future_loading_dialog.dart';

Expand All @@ -13,31 +12,18 @@ Future<List<XFile>> selectFiles(
FileSelectorType type = FileSelectorType.any,
bool allowMultiple = false,
}) async {
if (!PlatformInfos.isLinux) {
final result = await AppLock.of(context).pauseWhile(
showFutureLoadingDialog(
context: context,
future: () => FilePicker.platform.pickFiles(
compressionQuality: 0,
allowMultiple: allowMultiple,
type: type.filePickerType,
allowedExtensions: type.extensions,
),
final result = await AppLock.of(context).pauseWhile(
showFutureLoadingDialog(
context: context,
future: () => FilePicker.platform.pickFiles(
compressionQuality: 0,
allowMultiple: allowMultiple,
type: type.filePickerType,
allowedExtensions: type.extensions,
),
);
return result.result?.xFiles ?? [];
}

if (allowMultiple) {
return await AppLock.of(context).pauseWhile(
openFiles(confirmButtonText: title, acceptedTypeGroups: type.groups),
);
}
final file = await AppLock.of(context).pauseWhile(
openFile(confirmButtonText: title, acceptedTypeGroups: type.groups),
),
);
if (file == null) return [];
return [file];
return result.result?.xFiles ?? [];
}

enum FileSelectorType {
Expand Down
19 changes: 6 additions & 13 deletions lib/utils/matrix_sdk_extensions/matrix_file_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/material.dart';

import 'package:file_picker/file_picker.dart';
import 'package:file_selector/file_selector.dart';
import 'package:matrix/matrix.dart';
import 'package:share_plus/share_plus.dart';
import 'package:universal_html/html.dart' as html;
Expand All @@ -20,18 +19,12 @@ extension MatrixFileExtension on MatrixFile {
return;
}

final downloadPath = !PlatformInfos.isMobile
? (await getSaveLocation(
suggestedName: name,
confirmButtonText: L10n.of(context).saveFile,
))
?.path
: await FilePicker.platform.saveFile(
dialogTitle: L10n.of(context).saveFile,
fileName: name,
type: filePickerFileType,
bytes: bytes,
);
final downloadPath = await FilePicker.platform.saveFile(
dialogTitle: L10n.of(context).saveFile,
fileName: name,
type: filePickerFileType,
bytes: bytes,
);
if (downloadPath == null) return;

if (PlatformInfos.isDesktop) {
Expand Down
11 changes: 6 additions & 5 deletions pubspec.lock
< 8000 td class="blob-code blob-code-context js-file-line"> description:
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,12 @@ packages:
file_picker:
dependency: "direct main"
description:
name: file_picker
sha256: ab13ae8ef5580a411c458d6207b6774a6c237d77ac37011b13994879f68a8810
url: "https://pub.dev"
source: hosted
version: "8.3.7"
path: "."
ref: xdppicker
resolved-ref: "9be4a01935a27d426a6c43407a5dbbea44e12085"
url: "https://github.com/Decodetalkers/flutter_file_picker"
source: git
version: "10.2.0"
file_selector:
dependency: "direct main"
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ dependencies:
emoji_picker_flutter: ^3.1.0
emojis: ^0.9.9
#fcm_shared_isolate: ^0.2.0
file_picker: ^8.1.2
file_picker:
git:
url: https://github.com/Decodetalkers/flutter_file_picker
ref: xdppicker
file_selector: ^1.0.3
flutter:
sdk: flutter
Expand Down
Loading
0