From 4f26617e5017a62731e1d15ead5493f278b284dd Mon Sep 17 00:00:00 2001 From: Caroline Lucas Calheirani <97122568+CarolineLCa@users.noreply.github.com> Date: Thu, 28 Dec 2023 15:42:35 -0300 Subject: [PATCH 1/7] fix:disabling going back function on connectionless proof flow (#1051) Signed-off-by: Caroline Lucas Calheirani --- packages/legacy/core/App/navigators/RootStack.tsx | 2 +- packages/legacy/core/App/screens/Connection.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/legacy/core/App/navigators/RootStack.tsx b/packages/legacy/core/App/navigators/RootStack.tsx index 1dc61a8590..a5779e2a5f 100644 --- a/packages/legacy/core/App/navigators/RootStack.tsx +++ b/packages/legacy/core/App/navigators/RootStack.tsx @@ -273,7 +273,7 @@ const RootStack: React.FC = () => { /> - + ) diff --git a/packages/legacy/core/App/screens/Connection.tsx b/packages/legacy/core/App/screens/Connection.tsx index 6351958f4a..75a69eced6 100644 --- a/packages/legacy/core/App/screens/Connection.tsx +++ b/packages/legacy/core/App/screens/Connection.tsx @@ -3,7 +3,7 @@ import { CommonActions, useFocusEffect } from '@react-navigation/native' import { StackScreenProps } from '@react-navigation/stack' import React, { useCallback, useEffect, useMemo, useReducer, useRef } from 'react' import { useTranslation } from 'react-i18next' -import { AccessibilityInfo, Modal, ScrollView, StyleSheet, Text, View } from 'react-native' +import { AccessibilityInfo, BackHandler, Modal, ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import Button, { ButtonType } from '../components/buttons/Button' @@ -119,6 +119,11 @@ const Connection: React.FC = ({ navigation, route }) => { navigation.getParent()?.navigate(TabStacks.HomeStack, { screen: Screens.Home }) } + useEffect(() => { + const backHandler = BackHandler.addEventListener('hardwareBackPress', () => true) + return () => backHandler.remove() + }, []) + useEffect(() => { if (state.shouldShowDelayMessage && !state.notificationRecord) { if (autoRedirectConnectionToHome) { From 79c1e535257f8800c7e81d5fde7d461116310082 Mon Sep 17 00:00:00 2001 From: Bryce McMath <32586431+bryce-mcmath@users.noreply.github.com> Date: Wed, 3 Jan 2024 07:02:08 -0800 Subject: [PATCH 2/7] fix: in app guides orientation on ipad (#1055) Signed-off-by: Bryce McMath --- .../App/components/tour/AttachTourStep.tsx | 6 ++-- .../core/App/components/tour/TourBox.tsx | 7 ++-- .../core/App/components/tour/TourOverlay.tsx | 35 +++++++++++++------ .../__snapshots__/TourBox.test.tsx.snap | 2 +- .../__snapshots__/TourOverlay.test.tsx.snap | 34 +++++++++--------- 5 files changed, 48 insertions(+), 36 deletions(-) diff --git a/packages/legacy/core/App/components/tour/AttachTourStep.tsx b/packages/legacy/core/App/components/tour/AttachTourStep.tsx index 52e3d395f5..a80d21061d 100644 --- a/packages/legacy/core/App/components/tour/AttachTourStep.tsx +++ b/packages/legacy/core/App/components/tour/AttachTourStep.tsx @@ -1,5 +1,5 @@ import React, { cloneElement, ReactElement, ReactNode, RefObject, useContext, useEffect, useRef } from 'react' -import { StyleProp, View } from 'react-native' +import { StyleProp, useWindowDimensions, View } from 'react-native' import { TourContext } from '../../contexts/tour/tour-context' import { TourID } from '../../types/tour' @@ -46,7 +46,7 @@ export interface AttachTourStepProps { */ export function AttachTourStep({ children, fill = false, index, tourID }: AttachTourStepProps): ReactElement { const { currentStep, currentTour, changeSpot } = useContext(TourContext) - + const { width: windowWidth, height: windowHeight } = useWindowDimensions() const childRef = useRef(null) useEffect(() => { @@ -55,7 +55,7 @@ export function AttachTourStep({ children, fill = false, index, tourID }: Att changeSpot({ height, width, x, y }) }) } - }, [changeSpot, currentTour, currentStep, index]) + }, [windowWidth, windowHeight, changeSpot, currentTour, currentStep, index]) const { style, ...rest } = children.props const childStyle = style ?? {} diff --git a/packages/legacy/core/App/components/tour/TourBox.tsx b/packages/legacy/core/App/components/tour/TourBox.tsx index 6d567c93ca..adfe7c7429 100644 --- a/packages/legacy/core/App/components/tour/TourBox.tsx +++ b/packages/legacy/core/App/components/tour/TourBox.tsx @@ -1,9 +1,9 @@ import React, { ReactElement, ReactNode, useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from 'react-native' +import { StyleSheet, Text, TouchableOpacity, View } from 'react-native' import Icon from 'react-native-vector-icons/MaterialIcons' -import { tourMargin, hitSlop } from '../../constants' +import { hitSlop } from '../../constants' import { useTheme } from '../../contexts/theme' import { RenderProps } from '../../contexts/tour/tour-context' import { testIdWithKey } from '../../utils/testable' @@ -74,7 +74,6 @@ export function TourBox(props: TourBoxProps): ReactElement { stepsOutOf, } = props const { TextTheme, ColorPallet, OnboardingTheme } = useTheme() - const { width } = useWindowDimensions() const iconSize = 30 const dismissIconName = 'clear' const iconColor = ColorPallet.notification.infoIcon @@ -89,7 +88,7 @@ export function TourBox(props: TourBoxProps): ReactElement { borderRadius: 5, borderWidth: 1, padding: 20, - width: width - tourMargin * 2, + flex: 1, margin: 'auto', }, headerContainer: { diff --git a/packages/legacy/core/App/components/tour/TourOverlay.tsx b/packages/legacy/core/App/components/tour/TourOverlay.tsx index 77981532e9..22f8dfa066 100644 --- a/packages/legacy/core/App/components/tour/TourOverlay.tsx +++ b/packages/legacy/core/App/components/tour/TourOverlay.tsx @@ -24,7 +24,7 @@ interface TourOverlayProps { export const TourOverlay = (props: TourOverlayProps) => { const { width: windowWidth, height: windowHeight } = useWindowDimensions() const { color, currentTour, currentStep, onBackdropPress, backdropOpacity, changeSpot, spot, tourStep } = props - + const [viewBox, setViewBox] = useState(`0 0 ${windowWidth} ${windowHeight}`) const { next, previous, start, stop } = useContext(TourContext) const [tooltipStyle, setTooltipStyle] = useState({}) @@ -52,11 +52,12 @@ export const TourOverlay = (props: TourOverlayProps) => { const gapBetweenSpotAndTooltip = 50 // if origin spot (ie. no spotlight) if (spot.x === 0 && spot.y === 0) { - const top = windowHeight / 5 + // a relative margin so that the tooltip doesn't start at the very top of the screen + const oneSixthOfScreenHeight = windowHeight / 6 setTooltipStyle({ left: tourMargin, right: tourMargin, - top, + top: oneSixthOfScreenHeight, }) // if spot is in the lower half of the screen } else if (spot.y >= windowHeight / 2) { @@ -75,7 +76,13 @@ export const TourOverlay = (props: TourOverlayProps) => { top, }) } - }, [spot.height, spot.width, spot.x, spot.y]) + }, [windowWidth, windowHeight, spot.width, spot.height, spot.x, spot.y]) + + useEffect(() => { + // + 1 pixel to account for an svg size rounding issue that would cause + // a tiny gap around the overlay + setViewBox(`0 0 ${windowWidth + 1} ${windowHeight + 1}`) + }, [windowWidth, windowHeight]) return ( { transparent={true} visible={currentStep !== undefined} > - + - - + + - + diff --git a/packages/legacy/core/__tests__/components/__snapshots__/TourOverlay.test.tsx.snap b/packages/legacy/core/__tests__/components/__snapshots__/TourOverlay.test.tsx.snap index 6309515cca..10acb8e6d7 100644 --- a/packages/legacy/core/__tests__/components/__snapshots__/TourOverlay.test.tsx.snap +++ b/packages/legacy/core/__tests__/components/__snapshots__/TourOverlay.test.tsx.snap @@ -12,18 +12,18 @@ Array [ @@ -92,7 +92,7 @@ Array [ @@ -113,7 +113,7 @@ Array [ "opacity": 1, "position": "absolute", "right": 25, - "top": 266.8, + "top": 222.33333333333334, } } testID="com.ariesbifold:id/SpotTooltip" From 13172460186914601ceb4fc6a373dec178d0c5c6 Mon Sep 17 00:00:00 2001 From: Bryce McMath <32586431+bryce-mcmath@users.noreply.github.com> Date: Wed, 3 Jan 2024 15:25:10 -0800 Subject: [PATCH 3/7] fix: adjust safeareaview and remove unneeded styles (#1056) Signed-off-by: Bryce McMath --- .../core/App/screens/ProofRequesting.tsx | 23 +- .../ProofRequesting.test.tsx.snap | 353 ++++++++---------- 2 files changed, 175 insertions(+), 201 deletions(-) diff --git a/packages/legacy/core/App/screens/ProofRequesting.tsx b/packages/legacy/core/App/screens/ProofRequesting.tsx index f9fa5ed476..cfc8259ed0 100644 --- a/packages/legacy/core/App/screens/ProofRequesting.tsx +++ b/packages/legacy/core/App/screens/ProofRequesting.tsx @@ -118,9 +118,6 @@ const ProofRequesting: React.FC = ({ route, navigation }) marginTop: 'auto', marginHorizontal: 20, }, - footerButton: { - marginBottom: 10, - }, }) const createProofRequest = useCallback(async () => { @@ -192,7 +189,7 @@ const ProofRequesting: React.FC = ({ route, navigation }) }, [proofRecord]) return ( - + {generating && } @@ -204,16 +201,14 @@ const ProofRequesting: React.FC = ({ route, navigation }) - -