Skip to content

Commit

Permalink
TW-1926: remove the permission when paste in iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlockvn committed Aug 8, 2024
1 parent b4fc235 commit a188f7e
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 7 deletions.
3 changes: 3 additions & 0 deletions lib/pages/bootstrap/bootstrap_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:fluffychat/pages/bootstrap/tom_bootstrap_dialog.dart';
import 'package:fluffychat/utils/dialog/twake_dialog.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/adaptive_flat_button.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
Expand Down Expand Up @@ -136,6 +137,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
maxLines: 4,
readOnly: true,
style: GoogleFonts.robotoMono(),
contextMenuBuilder: mobileTwakeContextMenuBuilder,
controller: TextEditingController(text: key),
decoration: const InputDecoration(
contentPadding: EdgeInsets.all(16),
Expand Down Expand Up @@ -261,6 +263,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
maxLines: 2,
autocorrect: false,
readOnly: _recoveryKeyInputLoading,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
autofillHints: _recoveryKeyInputLoading
? null
: [AutofillHints.password],
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/bootstrap/tom_bootstrap_dialog_mobile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fluffychat/pages/bootstrap/tom_bootstrap_dialog_style.dart';
import 'package:fluffychat/pages/chat_list/chat_list_header_style.dart';
import 'package:fluffychat/pages/chat_list/chat_list_skeletonizer_widget.dart';
import 'package:fluffychat/resource/image_paths.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:skeletonizer/skeletonizer.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
Expand Down Expand Up @@ -55,6 +56,7 @@ class TomBootstrapDialogMobileView extends StatelessWidget {
child: TextField(
textInputAction: TextInputAction.search,
enabled: false,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
decoration: ChatListHeaderStyle.searchInputDecoration(
context,
hintText: '',
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/chat/add_widget_tile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AddWidgetTileView extends StatelessWidget {
),
),
),
ButtonBar(
OverflowBar(
children: [
TextButton(
onPressed: controller.addWidget,
Expand Down
9 changes: 3 additions & 6 deletions lib/pages/chat/input_bar/input_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:fluffychat/presentation/mixins/paste_image_mixin.dart';
import 'package:fluffychat/utils/clipboard.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/avatar/avatar.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:fluffychat/widgets/mxc_image.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -445,12 +446,8 @@ class _InputBarState extends State<InputBar> with PasteImageMixin {
widget.onChanged!(text);
}
},
contextMenuBuilder: PlatformInfos.isWeb
? null
: (_, editableTextState) =>
AdaptiveTextSelectionToolbar.editableText(
editableTextState: editableTextState,
),
contextMenuBuilder:
PlatformInfos.isWeb ? null : mobileTwakeContextMenuBuilder,
onTap: () async {
await Future.delayed(InputBar.debounceDurationTap);
FocusScope.of(context).requestFocus(focusNode);
Expand Down
3 changes: 3 additions & 0 deletions lib/pages/chat_details/chat_details_edit_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:fluffychat/pages/chat_details/chat_details_edit_view_style.dart'
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/avatar/avatar.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:linagora_design_flutter/colors/linagora_sys_colors.dart';
Expand Down Expand Up @@ -319,6 +320,7 @@ class _GroupNameField extends StatelessWidget {
child: TextField(
style: ChatDetailEditViewStyle.textFieldStyle(context),
controller: controller.groupNameTextEditingController,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
focusNode: controller.groupNameFocusNode,
decoration: InputDecoration(
border: OutlineInputBorder(
Expand Down Expand Up @@ -370,6 +372,7 @@ class _DescriptionField extends StatelessWidget {
TextField(
style: ChatDetailEditViewStyle.textFieldStyle(context),
controller: controller.descriptionTextEditingController,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
focusNode: controller.descriptionFocusNode,
decoration: InputDecoration(
border: OutlineInputBorder(
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/chat_list/chat_list_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fluffychat/pages/chat_list/chat_list.dart';
import 'package:fluffychat/pages/chat_list/chat_list_header_style.dart';
import 'package:fluffychat/pages/search/search.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/swipe_to_dismiss_wrap.dart';
import 'package:fluffychat/widgets/twake_components/twake_header.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -83,6 +84,7 @@ class ChatListHeader extends StatelessWidget {
builder: (context, value, _) {
return TextField(
textInputAction: TextInputAction.search,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
enabled: false,
decoration: ChatListHeaderStyle.searchInputDecoration(
context,
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/chat_search/chat_search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:fluffychat/utils/matrix_sdk_extensions/result_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/string_extension.dart';
import 'package:fluffychat/widgets/avatar/avatar.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/highlight_text.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:fluffychat/widgets/search/empty_search_widget.dart';
Expand Down Expand Up @@ -343,6 +344,7 @@ class _ChatSearchAppBar extends StatelessWidget {
padding: ChatSearchStyle.inputPadding,
child: TextField(
controller: controller.textEditingController,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
focusNode: controller.inputFocus,
textInputAction: TextInputAction.search,
autofocus: true,
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/homeserver_picker/homeserver_app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:flutter/material.dart';

import 'package:flutter_gen/gen_l10n/l10n.dart';
Expand All @@ -15,6 +16,7 @@ class HomeserverAppBar extends StatelessWidget {
return TextField(
focusNode: controller.homeserverFocusNode,
controller: controller.homeserverController,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
onChanged: controller.onChanged,
decoration: InputDecoration(
prefixIcon: Navigator.of(context).canPop()
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/homeserver_picker/homeserver_picker_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/homeserver_picker/homeserver_state.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -155,6 +156,7 @@ class HomeserverTextField extends StatelessWidget {
autocorrect: false,
enabled: true,
controller: controller.homeserverController,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide:
Expand Down
3 changes: 3 additions & 0 deletions lib/pages/login/login_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:flutter/material.dart';

import 'package:flutter_gen/gen_l10n/l10n.dart';
Expand Down Expand Up @@ -40,6 +41,7 @@ class LoginView extends StatelessWidget {
autocorrect: false,
autofocus: true,
onChanged: controller.checkWellKnownWithCoolDown,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
controller: controller.usernameController,
textInputAction: TextInputAction.next,
keyboardType: TextInputType.emailAddress,
Expand All @@ -60,6 +62,7 @@ class LoginView extends StatelessWidget {
autocorrect: false,
autofillHints:
controller.loading ? null : [AutofillHints.password],
contextMenuBuilder: mobileTwakeContextMenuBuilder,
controller: controller.passwordController,
textInputAction: TextInputAction.go,
obscureText: !controller.showPassword,
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/new_group/new_group_chat_info_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:fluffychat/pages/new_group/new_group_chat_info_style.dart';
import 'package:fluffychat/pages/new_group/new_group_info_controller.dart';
import 'package:fluffychat/pages/new_group/widget/expansion_participants_list.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/int_extension.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/twake_components/twake_fab.dart';
import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -228,6 +229,7 @@ class NewGroupChatInfoView extends StatelessWidget {
),
contentPadding: NewGroupChatInfoStyle.contentPadding,
),
contextMenuBuilder: mobileTwakeContextMenuBuilder,
);
},
),
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/search/search_text_field.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:fluffychat/pages/search/search_view_style.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart';
import 'package:flutter/material.dart';
import 'package:fluffychat/pages/dialer/pip/dismiss_keyboard.dart';
Expand Down Expand Up @@ -28,6 +29,7 @@ class SearchTextField extends StatelessWidget {
},
controller: textEditingController,
textInputAction: TextInputAction.search,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
enabled: true,
focusNode: focusNode,
autofocus: autofocus,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:fluffychat/pages/settings_dashboard/settings/settings_app_bar.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -52,6 +53,7 @@ class EmotesSettingsView extends StatelessWidget {
),
child: TextField(
controller: controller.newImageCodeController,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
autocorrect: false,
minLines: 1,
maxLines: 1,
Expand Down Expand Up @@ -158,6 +160,8 @@ class EmotesSettingsView extends StatelessWidget {
child: TextField(
readOnly: controller.readonly,
controller: textEditingController,
contextMenuBuilder:
mobileTwakeContextMenuBuilder,
autocorrect: false,
minLines: 1,
maxLines: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fluffychat/pages/settings_dashboard/settings/settings_app_bar.dart';
import 'package:fluffychat/utils/dialog/twake_dialog.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -36,6 +37,7 @@ class SettingsIgnoreListView extends StatelessWidget {
children: [
TextField(
controller: controller.controller,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
autocorrect: false,
textInputAction: TextInputAction.done,
onSubmitted: (_) => controller.ignoreUser(context),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:fluffychat/app_state/success.dart';
import 'package:fluffychat/pages/settings_dashboard/settings_profile/settings_profile_item_style.dart';
import 'package:fluffychat/presentation/enum/settings/settings_profile_enum.dart';
import 'package:fluffychat/presentation/model/settings/settings_profile_presentation.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:flutter/material.dart';
import 'package:linagora_design_flutter/linagora_design_flutter.dart';

Expand Down Expand Up @@ -70,6 +71,7 @@ class SettingsProfileItemBuilder extends StatelessWidget {
onChange!(value, settingsProfileEnum),
readOnly: !settingsProfilePresentation.isEditable,
autofocus: false,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
focusNode: focusNode,
controller: textEditingController,
decoration: InputDecoration(
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/story/story_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

Expand Down Expand Up @@ -355,6 +356,7 @@ class StoryView extends StatelessWidget {
onSubmitted: controller.replyAction,
textInputAction: TextInputAction.send,
readOnly: controller.replyLoading,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
decoration: InputDecoration(
contentPadding:
const EdgeInsets.fromLTRB(0, 16, 0, 16),
Expand Down
2 changes: 2 additions & 0 deletions lib/widgets/app_bars/searchable_app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fluffychat/config/first_column_inner_routes.dart';
import 'package:fluffychat/pages/dialer/pip/dismiss_keyboard.dart';
import 'package:fluffychat/widgets/context_menu_builder_ios_paste_without_permission.dart';
import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart';
import 'package:fluffychat/widgets/app_bars/searchable_app_bar_style.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -185,6 +186,7 @@ class SearchableAppBar extends StatelessWidget {
focusNode: focusNode,
autofocus: true,
maxLines: SearchableAppBarStyle.textFieldMaxLines,
contextMenuBuilder: mobileTwakeContextMenuBuilder,
buildCounter: (
BuildContext context, {
required int currentLength,
Expand Down
15 changes: 15 additions & 0 deletions lib/widgets/context_menu_builder_ios_paste_without_permission.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

Widget mobileTwakeContextMenuBuilder(
BuildContext context,
EditableTextState editableTextState,
) {
if (SystemContextMenu.isSupported(context)) {
return SystemContextMenu.editableText(
editableTextState: editableTextState,
);
}
return AdaptiveTextSelectionToolbar.editableText(
editableTextState: editableTextState,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class AppAdaptiveScaffoldBodyView extends StatelessWidget {
builder: (context, activeNavigationBar, __) {
return PopScope(
canPop: activeNavigationBar == AdaptiveDestinationEnum.rooms,
// ignore: deprecated_member_use
onPopInvoked: onPopInvoked,
child: Row(
children: [
Expand Down

0 comments on commit a188f7e

Please sign in to comment.