Skip to content

Commit

Permalink
TW-731: support copy/paste in windows, linux platform
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlockvn committed Oct 11, 2023
1 parent f967080 commit e429999
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/pages/chat/input_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,10 @@ class InputBar extends StatelessWidget with PasteImageMixin {
},
child: CallbackShortcuts(
bindings: {
const SingleActivator(
SingleActivator(
flutter.LogicalKeyboardKey.keyV,
meta: true,
meta: PlatformInfos.isMacKeyboardPlatform,
control: !PlatformInfos.isMacKeyboardPlatform,
): () async {
if (await Clipboard.instance.isReadableImageFormat()) {
await pasteImage(context, room!);
Expand Down
7 changes: 7 additions & 0 deletions lib/utils/platform_infos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:universal_html/html.dart' as html;
import '../config/app_config.dart';

abstract class PlatformInfos {
Expand All @@ -28,6 +29,12 @@ abstract class PlatformInfos {

static bool get platformCanRecord => (isMobile || isMacOS);

static bool get isMacKeyboardPlatform =>
isMacOS &&
(kIsWeb &&
html.window.navigator.platform != null &&
html.window.navigator.platform!.contains('mac'));

static String get clientName =>
'${AppConfig.applicationName} ${isWeb ? 'web' : Platform.operatingSystem}${kReleaseMode ? '' : 'Debug'}';

Expand Down

0 comments on commit e429999

Please sign in to comment.