diff --git a/lib/features/dapps/subfeatures/open_dapp/open_dapp_page.dart b/lib/features/dapps/subfeatures/open_dapp/open_dapp_page.dart index da8b3d10..7d45f9ae 100644 --- a/lib/features/dapps/subfeatures/open_dapp/open_dapp_page.dart +++ b/lib/features/dapps/subfeatures/open_dapp/open_dapp_page.dart @@ -38,6 +38,8 @@ class OpenAppPage extends HookConsumerWidget { AllowMultipleHorizontalDrag>( () => AllowMultipleHorizontalDrag(), (AllowMultipleHorizontalDrag instance) { + instance.onDown = + (details) => presenter.detectDoubleTap(); instance.onEnd = (details) async { final webViewController = state.webviewController!; if (details.primaryVelocity! < @@ -64,14 +66,6 @@ class OpenAppPage extends HookConsumerWidget { }; }, ), - AllowMultipleDoubleTap: GestureRecognizerFactoryWithHandlers< - AllowMultipleDoubleTap>( - () => AllowMultipleDoubleTap(), - (AllowMultipleDoubleTap instance) { - instance.onDoubleTap = - () => state.webviewController!.reload(); - }, - ) }, child: DragDownPanel( child: InAppWebViewEIP1193( @@ -169,12 +163,15 @@ class OpenAppPage extends HookConsumerWidget { }, initialOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( - useShouldOverrideUrlLoading: true, - mediaPlaybackRequiresUserGesture: false), + useShouldOverrideUrlLoading: true, + mediaPlaybackRequiresUserGesture: false, + ), android: AndroidInAppWebViewOptions( useWideViewPort: true, geolocationEnabled: true, useHybridComposition: true, + overScrollMode: AndroidOverScrollMode + .OVER_SCROLL_IF_CONTENT_SCROLLS, ), ios: IOSInAppWebViewOptions( allowsInlineMediaPlayback: true, diff --git a/lib/features/dapps/subfeatures/open_dapp/open_dapp_presenter.dart b/lib/features/dapps/subfeatures/open_dapp/open_dapp_presenter.dart index d26dd6dc..be655924 100644 --- a/lib/features/dapps/subfeatures/open_dapp/open_dapp_presenter.dart +++ b/lib/features/dapps/subfeatures/open_dapp/open_dapp_presenter.dart @@ -546,7 +546,7 @@ class OpenDAppPresenter extends CompletePresenter { final double maxPanelHeight = 100.0; - final cancelDuration = const Duration(milliseconds: 300); + final cancelDuration = const Duration(milliseconds: 400); final settleDuration = const Duration(milliseconds: 400); void handleScroll(double scroll) { @@ -569,10 +569,6 @@ class OpenDAppPresenter extends CompletePresenter { 1.0, duration: settleDuration, ); - // await Future.delayed( - // const Duration(seconds: 5), - // () => hidePanel(), - // ); } } @@ -583,7 +579,7 @@ class OpenDAppPresenter extends CompletePresenter { await state.animationController!.animateTo( 0.0, duration: cancelDuration, - curve: Curves.ease, + curve: Curves.easeInExpo, ); } } @@ -602,4 +598,17 @@ class OpenDAppPresenter extends CompletePresenter { void showNetworkDetailsBottomSheet() { showNetworkDetailsDialog(context!, network: state.network!); } + + void detectDoubleTap() { + final now = DateTime.now(); + final difference = now.difference(doubleTapTime); + + if (difference.inMilliseconds > Config.dAppDoubleTapLowerBound && + difference.inMilliseconds < Config.dAppDoubleTapUpperBound) { + state.webviewController!.reload(); + resetDoubleTapTime(); + } else { + resetDoubleTapTime(); + } + } } diff --git a/packages/shared b/packages/shared index 5e2d41e7..41088715 160000 --- a/packages/shared +++ b/packages/shared @@ -1 +1 @@ -Subproject commit 5e2d41e711cd6a87d4d4f6f9cf15853304c4045b +Subproject commit 41088715a930855754b70315335e6946524081cb