Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix QR overlay gesture arena and UPI launch check

Amrithesh Kakkoth Ente7757c69d41b9
diff --git a/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart b/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart
index 3c7850648e..0cb6739889 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/qr_code_content_sheet.dart
@@ -114,7 +114,13 @@ class _QrContentEntry extends StatelessWidget {
labelText: l10n.pay,
onTap: () async {
try {
- await launchUrl(uri, mode: LaunchMode.externalApplication);
+ final launched = await launchUrl(
+ uri,
+ mode: LaunchMode.externalApplication,
+ );
+ if (!launched && context.mounted) {
+ showShortToast(context, "No payment app found");
+ }
} catch (_) {
if (context.mounted) {
showShortToast(context, "No payment app found");
diff --git a/mobile/apps/photos/lib/ui/viewer/file/qr_code_highlight_overlay.dart b/mobile/apps/photos/lib/ui/viewer/file/qr_code_highlight_overlay.dart
index f6962d934e..c2dea530aa 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/qr_code_highlight_overlay.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/qr_code_highlight_overlay.dart
@@ -1,5 +1,3 @@
-import "dart:async";
-
import "package:ente_qr/ente_qr.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
@@ -92,17 +90,6 @@ class _QrTapRegion extends StatefulWidget {
}
class _QrTapRegionState extends State<_QrTapRegion> {
- static const _longPressDuration = Duration(milliseconds: 500);
- static const _moveThreshold = 20.0;
- Timer? _timer;
- Offset? _downPosition;
-
- @override
- void dispose() {
- _timer?.cancel();
- super.dispose();
- }
-
Future<void> _onLongPress() async {
await HapticFeedback.lightImpact();
final uri = Uri.tryParse(widget.detection.content);
@@ -151,21 +138,10 @@ class _QrTapRegionState extends State<_QrTapRegion> {
top: centerY - screenH / 2,
width: screenW,
height: screenH,
- child: Listener(
+ child: GestureDetector(
behavior: HitTestBehavior.opaque,
- onPointerDown: (event) {
- _downPosition = event.position;
- _timer?.cancel();
- _timer = Timer(_longPressDuration, _onLongPress);
- },
- onPointerMove: (event) {
- if (_downPosition != null &&
- (event.position - _downPosition!).distance > _moveThreshold) {
- _timer?.cancel();
- }
- },
- onPointerUp: (_) => _timer?.cancel(),
- onPointerCancel: (_) => _timer?.cancel(),
+ onTap: () {},
+ onLongPress: _onLongPress,
child: const SizedBox.expand(),
),
);