Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Merge branch 'main' into feat/implement-keyboard-shortcuts-for-copying-codes

Jude Cooray5d3eb9c23127
diff --cc mobile/apps/auth/lib/ui/code_widget.dart
index 51b7ebcd9e,7e03a248bf..aa1891cbb8
--- a/mobile/apps/auth/lib/ui/code_widget.dart
+++ b/mobile/apps/auth/lib/ui/code_widget.dart
@@@ -237,74 -237,50 +239,74 @@@ class _CodeWidgetState extends State<Co
return Stack(
children: [
- AnimatedContainer(
- duration: const Duration(milliseconds: 180),
- curve: Curves.easeInOut,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: isSelected
- ? colorScheme.primary400.withValues(alpha: 0.10)
- : Theme.of(context).colorScheme.codeCardBackgroundColor,
- boxShadow: (widget.code.isPinned && !isSelected)
- ? colorScheme.pinnedCardBoxShadow
- : [],
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(8),
- child: Material(
- color: Colors.transparent,
- child: InkWell(
- focusNode: widget.focusNode,
- customBorder: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10),
+ Actions(
+ actions: {
+ CopyIntent: CallbackAction<CopyIntent>(
+ onInvoke: (intent) => _copyCurrentOTPToClipboard(),
+ ),
+ CopyNextIntent: CallbackAction<CopyNextIntent>(
+ onInvoke: (intent) {
+ if (!widget.code.type.isTOTPCompatible) {
+ showToast(context, context.l10n.notSupportedForHOTP);
+ return;
+ }
+ _copyNextToClipboard();
+ },
+ ),
+ },
+ child: AnimatedContainer(
+ duration: const Duration(milliseconds: 180),
+ curve: Curves.easeInOut,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8),
+ color: isSelected
+ ? colorScheme.primary400.withValues(alpha: 0.10)
+ : Theme.of(context).colorScheme.codeCardBackgroundColor,
+ boxShadow: (widget.code.isPinned && !isSelected)
+ ? colorScheme.pinnedCardBoxShadow
+ : [],
+ ),
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(8),
+ child: Material(
+ color: Colors.transparent,
+ child: InkWell(
- customBorder: RoundedRectangleBorder(
++ focusNode: widget.focusNode,customBorder: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ // InkWell handles focus natively.
+ canRequestFocus: true,
+ onFocusChange: (hasFocus) {
+ if (_isFocused != hasFocus) {
+ setState(() {
+ _isFocused = hasFocus;
+ });
+ }
+ },
+ onTap: () {
+ final store = CodeDisplayStore.instance;
+ if (store.isSelectionModeActive.value) {
+ store.toggleSelection(widget.code.selectionKey);
+ } else {
+ _copyCurrentOTPToClipboard();
+ }
+ },
+ onDoubleTap: isMaskingEnabled
+ ? () {
+ setState(() {
+ _hideCode = !_hideCode;
+ });
+ }
+ : null,
+ onLongPress: widget.isReordering
+ ? null
+ : () {
+ CodeDisplayStore.instance.toggleSelection(
+ widget.code.selectionKey,
+ );
+ },
+ child: getCardContents(l10n, isSelected: isSelected),
),
- onTap: () {
- final store = CodeDisplayStore.instance;
- if (store.isSelectionModeActive.value) {
- store.toggleSelection(widget.code.selectionKey);
- } else {
- _copyCurrentOTPToClipboard();
- }
- },
- onDoubleTap: isMaskingEnabled
- ? () {
- setState(() {
- _hideCode = !_hideCode;
- });
- }
- : null,
- onLongPress: widget.isReordering
- ? null
- : () {
- CodeDisplayStore.instance.toggleSelection(
- widget.code.selectionKey,
- );
- },
- child: getCardContents(l10n, isSelected: isSelected),
),
),
),