Skip to content

Commit

Permalink
fix(INJI-558): fix sharing screen progress modal in ios
Browse files Browse the repository at this point in the history
Signed-off-by: adityankannan-tw <[email protected]>
Co-authored-by: Vijay <[email protected]>
  • Loading branch information
adityankannan-tw and vijay151096 committed Nov 14, 2023
1 parent 2152c98 commit 5435845
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 41 deletions.
32 changes: 31 additions & 1 deletion components/ui/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,33 @@ export const Loader: React.FC<LoaderProps> = props => {
/>
</View>
</Column>
{(props.isHintVisible || props.isBleErrorVisible) && (
<Column style={Theme.SelectVcOverlayStyles.timeoutHintContainer}>
<Text
align="center"
margin="10"
color={Theme.Colors.TimoutHintText}
size="small"
style={Theme.TextStyles.bold}>
{props.hint}
</Text>
{props.onStayInProgress && (
<Button
type="clear"
title={t('status.stayOnTheScreen')}
onPress={props.onStayInProgress}
/>
)}

{props.onRetry && (
<Button
type="clear"
title={t('status.retry')}
onPress={props.onRetry}
/>
)}
</Column>
)}
<Column style={{display: props.hint ? 'flex' : 'none'}}>
<Column style={Theme.SelectVcOverlayStyles.timeoutHintContainer}>
<Text
Expand All @@ -89,11 +115,15 @@ export const Loader: React.FC<LoaderProps> = props => {

export interface LoaderProps {
isVisible: boolean;
title: string;
title?: string;
subTitle?: string;
label?: string;
hint?: string;
onStayInProgress?: () => void;
isHintVisible: boolean;
isBleErrorVisible?: boolean;
onCancel?: () => void;
onRetry?: () => void;
requester?: boolean;
progress?: boolean | number;
onBackdropPress?: () => void;
Expand Down
6 changes: 3 additions & 3 deletions locales/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@
"sent": "تم إرسال بطاقة ...",
"sentHint": "في انتظار أن يحفظ المستلم بطاقة أو يتجاهلها",
"sharing": {
"title": "جاري المشاركة",
"title": "جاري المشاركة...",
"timeoutHint": "تأخرت المشاركة، ربما بسبب مشكلة في الاتصال.",
"hint": "يرجى الانتظار حتى نشارك البطاقة المختارة."
"hint": "يرجى الانتظار حتى نشارك البطاقة المختارة..."
},
"accepted": {
"title": "تمت مشاركة المعرف بنجاح",
"title": "تمت مشاركة المعرف بنجاح!",
"message": "تمت مشاركة هويتك بنجاح مع",
"gotohome": "اذهب الى المنزل"
},
Expand Down
6 changes: 3 additions & 3 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,12 @@
"sent": "Card has been sent...",
"sentHint": "Waiting for receiver to save or discard your Card",
"sharing": {
"title": "Sharing in progress",
"hint": "Please wait while we share the chosen card.",
"title": "Sharing in progress...",
"hint": "Please wait while we share the chosen card...",
"timeoutHint": "Sharing is delayed, possibly due to a connection issue."
},
"accepted": {
"title": "ID shared successfully",
"title": "ID shared successfully!",
"message": "Your ID has been successfully shared with",
"gotohome": "Go to Home"
},
Expand Down
6 changes: 3 additions & 3 deletions locales/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,12 @@
"sent": "Naipadala na ang card...",
"sentHint": "Naghihintay para sa receiver na i-save o itapon ang iyong card",
"sharing": {
"title": "Isinasagawa ang pagbabahagi",
"title": "Isinasagawa ang pagbabahagi...",
"timeoutHint": "Naantala ang pagbabahagi, posibleng dahil sa isang isyu sa koneksyon.",
"hint": "Mangyaring maghintay habang ibinabahagi namin ang napiling card."
"hint": "Mangyaring maghintay habang ibinabahagi namin ang napiling card..."
},
"accepted": {
"title": "Matagumpay na naibahagi ang ID",
"title": "Matagumpay na naibahagi ang ID!",
"message": "Ang iyong ID ay matagumpay na naibahagi sa",
"gotohome": "Pumunta sa bahay"
},
Expand Down
6 changes: 3 additions & 3 deletions locales/hin.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@
"sent": "कार्ड भेज दिया गया है...",
"sentHint": "आपके {{vcLabel }} को सहेजने या छोड़ने के लिए रिसीवर की प्रतीक्षा की जा रही है",
"sharing": {
"title": "साझाकरण प्रगति पर है",
"title": "साझाकरण प्रगति पर है...",
"timeoutHint": "संभवतः किसी कनेक्शन समस्या के कारण साझाकरण में देरी हो रही है।",
"hint": "कृपया तब तक प्रतीक्षा करें जब तक हम चयनित कार्ड साझा नहीं करते।"
"hint": "कृपया तब तक प्रतीक्षा करें जब तक हम चयनित कार्ड साझा नहीं करते।..."
},
"accepted": {
"title": "आईडी सफलतापूर्वक साझा की गई",
"title": "आईडी सफलतापूर्वक साझा की गई!",
"message": "आपकी आईडी सफलतापूर्वक साझा कर दी गई है",
"gotohome": "घर जाओ"
},
Expand Down
6 changes: 3 additions & 3 deletions locales/kan.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,12 @@
"sent": "ಕಾರ್ಡ್ ಅನ್ನು ಕಳುಹಿಸಲಾಗಿದೆ...",
"sentHint": "ನಿಮ್ಮ ಕಾರ್ಡ್ ಅನ್ನು ಉಳಿಸಲು ಅಥವಾ ತ್ಯಜಿಸಲು ರಿಸೀವರ್‌ಗಾಗಿ ನಿರೀಕ್ಷಿಸಲಾಗುತ್ತಿದೆ",
"sharing": {
"title": "ಹಂಚಿಕೆ ಪ್ರಗತಿಯಲ್ಲಿದೆ",
"title": "ಹಂಚಿಕೆ ಪ್ರಗತಿಯಲ್ಲಿದೆ...",
"timeoutHint": "ಬಹುಶಃ ಸಂಪರ್ಕದ ಸಮಸ್ಯೆಯಿಂದಾಗಿ ಹಂಚಿಕೆ ವಿಳಂಬವಾಗಿದೆ.",
"hint": "ನಾವು ಆಯ್ಕೆಮಾಡಿದ ಕಾರ್ಡ್ ಅನ್ನು ಹಂಚಿಕೊಳ್ಳುವವರೆಗೆ ದಯವಿಟ್ಟು ನಿರೀಕ್ಷಿಸಿ."
"hint": "ನಾವು ಆಯ್ಕೆಮಾಡಿದ ಕಾರ್ಡ್ ಅನ್ನು ಹಂಚಿಕೊಳ್ಳುವವರೆಗೆ ದಯವಿಟ್ಟು ನಿರೀಕ್ಷಿಸಿ..."
},
"accepted": {
"title": "ಐಡಿಯನ್ನು ಯಶಸ್ವಿಯಾಗಿ ಹಂಚಿಕೊಳ್ಳಲಾಗಿದೆ",
"title": "ಐಡಿಯನ್ನು ಯಶಸ್ವಿಯಾಗಿ ಹಂಚಿಕೊಳ್ಳಲಾಗಿದೆ!",
"message": "ನಿಮ್ಮ ಐಡಿಯನ್ನು ಯಶಸ್ವಿಯಾಗಿ ಹಂಚಿಕೊಳ್ಳಲಾಗಿದೆ",
"gotohome": "ಮನೆಗೆ ಹೋಗು"
},
Expand Down
6 changes: 3 additions & 3 deletions locales/tam.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,12 @@
"sent": "அட்டை அனுப்பப்பட்டது...",
"sentHint": "ரிசீவர் உங்கள் அட்டை ஐ சேமிக்க அல்லது நிராகரிக்க காத்திருக்கிறது",
"sharing": {
"title": "பகிர்தல் செயல்பாட்டில் உள்ளது",
"title": "பகிர்தல் செயல்பாட்டில் உள்ளது...",
"timeoutHint": "இணைப்புச் சிக்கல் காரணமாகப் பகிர்தல் தாமதமாகலாம்.",
"hint": "தேர்ந்தெடுத்த கார்டைப் பகிரும் வரை காத்திருக்கவும்."
"hint": "தேர்ந்தெடுத்த கார்டைப் பகிரும் வரை காத்திருக்கவும்..."
},
"accepted": {
"title": "ஐடி வெற்றிகரமாகப் பகிரப்பட்டது",
"title": "ஐடி வெற்றிகரமாகப் பகிரப்பட்டது!",
"message": "உங்கள் ஐடி வெற்றிகரமாகப் பகிரப்பட்டது",
"gotohome": "வீட்டிற்கு போ"
},
Expand Down
31 changes: 18 additions & 13 deletions screens/Scan/ScanLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,31 @@ import {SCAN_ROUTES} from '../../routes/routesConstants';
import {SharingSuccessModal} from './SuccessfullySharedModal';
import {Theme} from '../../components/ui/styleUtils';
import {Icon} from 'react-native-elements';
import {Loader} from '../../components/ui/Loader';

const ScanStack = createNativeStackNavigator();

export const ScanLayout: React.FC = () => {
const {t} = useTranslation('ScanScreen');
const controller = useScanLayout();

if (controller.statusOverlay != null && !controller.isAccepted) {
return (
<Loader
isVisible={controller.statusOverlay != null && !controller.isAccepted}
title={controller.statusOverlay?.title}
hint={controller.statusOverlay?.hint}
onCancel={controller.statusOverlay?.onButtonPress}
onStayInProgress={controller.statusOverlay?.onStayInProgress}
isHintVisible={controller.isStayInProgress}
isBleErrorVisible={controller.isBleError}
onRetry={controller.statusOverlay?.onRetry}
progress={controller.statusOverlay?.progress}
requester={controller.statusOverlay?.requester}
/>
);
}

return (
<React.Fragment>
<ScanStack.Navigator initialRouteName="ScanScreen">
Expand Down Expand Up @@ -46,19 +64,6 @@ export const ScanLayout: React.FC = () => {
/>
</ScanStack.Navigator>

<ProgressingModal
isVisible={controller.statusOverlay != null && !controller.isAccepted}
title={controller.statusOverlay?.title}
hint={controller.statusOverlay?.hint}
onCancel={controller.statusOverlay?.onButtonPress}
onStayInProgress={controller.statusOverlay?.onStayInProgress}
isHintVisible={controller.isStayInProgress}
isBleErrorVisible={controller.isBleError}
onRetry={controller.statusOverlay?.onRetry}
progress={controller.statusOverlay?.progress}
requester={controller.statusOverlay?.requester}
/>

<SharingSuccessModal
isVisible={controller.isAccepted}
testId={'sharingSuccessModal'}
Expand Down
10 changes: 1 addition & 9 deletions screens/Scan/ScanLayoutController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,11 @@ export function useScanLayout() {
onButtonPress: CANCEL,
progress: true,
};
} else if (isSent) {
statusOverlay = {
message: t('status.sent'),
hint: t('status.sentHint'),
progress: false,
onButtonPress: CANCEL,
};
} else if (isSendingVc) {
} else if (isSendingVc || isSent) {
statusOverlay = {
title: t('status.sharing.title'),
hint: t('status.sharing.hint'),
progress: true,
onButtonPress: CANCEL,
};
} else if (isSendingVcTimeout) {
statusOverlay = {
Expand Down

0 comments on commit 5435845

Please sign in to comment.