diff --git a/lib/config/go_routes/go_router.dart b/lib/config/go_routes/go_router.dart index c030f8f853..980c5f4ba1 100644 --- a/lib/config/go_routes/go_router.dart +++ b/lib/config/go_routes/go_router.dart @@ -78,7 +78,7 @@ abstract class AppRoutes { path: '/home', pageBuilder: (context, state) => defaultPageBuilder( context, - PlatformInfos.isMobile || PlatformInfos.isLinux + PlatformInfos.isMobile || PlatformInfos.isDesktop ? const TwakeWelcome() : AutoHomeserverPicker( loggedOut: state.extra is bool ? state.extra as bool? : null, diff --git a/lib/domain/model/extensions/xfile_extension.dart b/lib/domain/model/extensions/xfile_extension.dart index 684045c614..1729c12664 100644 --- a/lib/domain/model/extensions/xfile_extension.dart +++ b/lib/domain/model/extensions/xfile_extension.dart @@ -10,6 +10,7 @@ extension XFileExtension on XFile { name: name, filePath: path, sizeInBytes: await length(), + readStream: readAsBytes().asStream(), ); } @@ -19,6 +20,7 @@ extension XFileExtension on XFile { 'path': path, 'bytes': await readAsBytes(), 'size': await length(), + 'readStream': readAsBytes().asStream(), }); } } diff --git a/lib/pages/image_viewer/image_viewer.dart b/lib/pages/image_viewer/image_viewer.dart index 0dececb5a4..2f8577f63b 100644 --- a/lib/pages/image_viewer/image_viewer.dart +++ b/lib/pages/image_viewer/image_viewer.dart @@ -45,7 +45,7 @@ class ImageViewerController extends State { @override void initState() { super.initState(); - if (!PlatformInfos.isWebOrDesktop && widget.event != null) { + if (PlatformInfos.isMobile && widget.event != null) { handleDownloadFile(widget.event!); } } diff --git a/lib/pages/settings_dashboard/settings_profile/settings_profile.dart b/lib/pages/settings_dashboard/settings_profile/settings_profile.dart index e1b20ba300..3957b7de50 100644 --- a/lib/pages/settings_dashboard/settings_profile/settings_profile.dart +++ b/lib/pages/settings_dashboard/settings_profile/settings_profile.dart @@ -25,6 +25,7 @@ import 'package:fluffychat/utils/dialog/twake_dialog.dart'; import 'package:fluffychat/utils/extension/value_notifier_extension.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/twake_snackbar.dart'; +import 'package:fluffychat/utils/xfile_groups.dart'; import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/mixins/popup_context_menu_action_mixin.dart'; import 'package:fluffychat/widgets/mixins/popup_menu_widget_mixin.dart'; @@ -191,16 +192,12 @@ class SettingsProfileController extends State void _getImageOnDesktop( BuildContext context, ) async { - const XTypeGroup typeGroup = XTypeGroup( - label: 'images', - extensions: ['jpg', 'png'], - ); final String initialDirectory = (await getApplicationDocumentsDirectory()).path; final XFile? result = await openFile( initialDirectory: initialDirectory, - acceptedTypeGroups: [typeGroup], + acceptedTypeGroups: [XFileGroups.images], ); Logs().d( diff --git a/lib/presentation/mixins/connect_page_mixin.dart b/lib/presentation/mixins/connect_page_mixin.dart index ea93279ce9..071aa3ce27 100644 --- a/lib/presentation/mixins/connect_page_mixin.dart +++ b/lib/presentation/mixins/connect_page_mixin.dart @@ -113,7 +113,7 @@ mixin ConnectPageMixin { ); final urlScheme = _getRedirectUrlScheme(redirectUrl); - return FlutterWebAuth2.authenticate( + return await FlutterWebAuth2.authenticate( url: url, callbackUrlScheme: urlScheme, options: const FlutterWebAuth2Options( diff --git a/lib/utils/xfile_groups.dart b/lib/utils/xfile_groups.dart new file mode 100644 index 0000000000..ba18224227 --- /dev/null +++ b/lib/utils/xfile_groups.dart @@ -0,0 +1,8 @@ +import 'package:file_selector/file_selector.dart'; + +class XFileGroups { + static const XTypeGroup images = XTypeGroup( + label: 'images', + extensions: ['jpg', 'png'], + ); +}