mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
refactor(#INJI-131): [Kiruthika] removed unused vclabel controller function and interpolation vcLabel passed for translation
Issue Link: https://mosip.atlassian.net/browse/INJI-131
This commit is contained in:
committed by
KiruthikaJeyashankar
parent
c81878aede
commit
c25acb8a72
@@ -5,7 +5,6 @@ import { Dimensions } from 'react-native';
|
||||
import { Overlay, LinearProgress } from 'react-native-elements';
|
||||
import { Button, Column, Text } from './ui';
|
||||
import { Theme } from './ui/styleUtils';
|
||||
import { VCLabel } from '../types/vc';
|
||||
|
||||
export const MessageOverlay: React.FC<MessageOverlayProps> = (props) => {
|
||||
const { t } = useTranslation('common');
|
||||
@@ -50,7 +49,6 @@ export const ErrorMessageOverlay: React.FC<ErrorMessageOverlayProps> = ({
|
||||
isVisible,
|
||||
error,
|
||||
onDismiss,
|
||||
vcLabel,
|
||||
translationPath,
|
||||
}) => {
|
||||
const { t } = useTranslation(translationPath);
|
||||
@@ -58,14 +56,8 @@ export const ErrorMessageOverlay: React.FC<ErrorMessageOverlayProps> = ({
|
||||
return (
|
||||
<MessageOverlay
|
||||
isVisible={isVisible}
|
||||
title={t(error + '.title', {
|
||||
vcLabelSingular: vcLabel.singular,
|
||||
vcLabelPlural: vcLabel.plural,
|
||||
})}
|
||||
message={t(error + '.message', {
|
||||
vcLabelSingular: vcLabel.singular,
|
||||
vcLabelPlural: vcLabel.plural,
|
||||
})}
|
||||
title={t(error + '.title')}
|
||||
message={t(error + '.message')}
|
||||
onBackdropPress={onDismiss}
|
||||
/>
|
||||
);
|
||||
@@ -75,7 +67,6 @@ export interface ErrorMessageOverlayProps {
|
||||
isVisible: boolean;
|
||||
error?: string;
|
||||
onDismiss?: () => void;
|
||||
vcLabel: VCLabel;
|
||||
translationPath: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import { VcItemEvents } from '../machines/vcItem';
|
||||
import { ErrorMessageOverlay } from '../components/MessageOverlay';
|
||||
import { Theme } from './ui/styleUtils';
|
||||
import { GlobalContext } from '../shared/GlobalContext';
|
||||
import { selectVcLabel } from '../machines/settings';
|
||||
import { VcItemContent } from './VcItemContent';
|
||||
import { VcItemActivationStatus } from './VcItemActivationStatus';
|
||||
|
||||
@@ -34,10 +33,8 @@ export const VcItem: React.FC<VcItemProps> = (props) => {
|
||||
const context = useSelector(service, selectContext);
|
||||
const verifiableCredential = useSelector(service, selectVerifiableCredential);
|
||||
const emptyWalletBindingId = useSelector(service, selectEmptyWalletBindingId);
|
||||
const settingsService = appService.children.get('settings');
|
||||
const storeError = useSelector(service, selectStoreError);
|
||||
const isSavingFailedInIdle = useSelector(service, selectIsSavingFailedInIdle);
|
||||
const vcLabel = useSelector(settingsService, selectVcLabel);
|
||||
const DISMISS = () => service.send(VcItemEvents.DISMISS());
|
||||
|
||||
let storeErrorTranslationPath = 'errors.savingFailed';
|
||||
@@ -81,7 +78,6 @@ export const VcItem: React.FC<VcItemProps> = (props) => {
|
||||
isVisible={isSavingFailedInIdle}
|
||||
error={storeErrorTranslationPath}
|
||||
onDismiss={DISMISS}
|
||||
vcLabel={vcLabel}
|
||||
translationPath={'VcDetails'}
|
||||
/>
|
||||
</React.Fragment>
|
||||
|
||||
@@ -24,8 +24,8 @@ export const HomeScreen: React.FC<HomeRouteProps> = (props) => {
|
||||
value={controller.activeTab}
|
||||
onChange={controller.SELECT_TAB}
|
||||
indicatorStyle={Theme.Styles.tabIndicator}>
|
||||
{TabItem(t('myVcsTab', { vcLabel: controller.vcLabel.plural }))}
|
||||
{TabItem(t('receivedVcsTab', { vcLabel: controller.vcLabel.plural }))}
|
||||
{TabItem(t('myVcsTab'))}
|
||||
{TabItem(t('receivedVcsTab'))}
|
||||
{TabItem(t('historyTab'))}
|
||||
</Tab>
|
||||
{controller.haveTabsLoaded && (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useInterpret, useSelector } from '@xstate/react';
|
||||
import { useContext, useEffect, useRef } from 'react';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { HomeRouteProps } from '../../routes/main';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import {
|
||||
@@ -23,7 +22,6 @@ export function useHomeScreen(props: HomeRouteProps) {
|
||||
})
|
||||
);
|
||||
const service = useInterpret(machine.current);
|
||||
const settingsService = appService.children.get('settings');
|
||||
const vcService = appService.children.get('vc');
|
||||
|
||||
useEffect(() => {
|
||||
@@ -36,7 +34,6 @@ export function useHomeScreen(props: HomeRouteProps) {
|
||||
service,
|
||||
|
||||
activeTab: useSelector(service, selectActiveTab),
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
selectedVc: useSelector(service, selectSelectedVc),
|
||||
tabRefs: useSelector(service, selectTabRefs),
|
||||
|
||||
|
||||
@@ -2,11 +2,9 @@ import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Column, Text } from '../../../components/ui';
|
||||
import { Modal, ModalProps } from '../../../components/ui/Modal';
|
||||
import { useDownloadingVcModal } from './DownloadingVcModalController';
|
||||
|
||||
export const DownloadingVcModal: React.FC<ModalProps> = (props) => {
|
||||
const { t } = useTranslation('DownloadingVcModal');
|
||||
const controller = useDownloadingVcModal();
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@@ -16,11 +14,9 @@ export const DownloadingVcModal: React.FC<ModalProps> = (props) => {
|
||||
<Column fill pY={32} pX={24} align="space-between">
|
||||
<Column fill>
|
||||
<Text weight="semibold" align="center">
|
||||
{t('header', { vcLabel: controller.vcLabel.singular })}
|
||||
</Text>
|
||||
<Text align="center">
|
||||
{t('bodyText', { vcLabel: controller.vcLabel.singular })}
|
||||
{t('header')}
|
||||
</Text>
|
||||
<Text align="center">{t('bodyText')}</Text>
|
||||
</Column>
|
||||
<Column fill align="flex-end">
|
||||
<Button title={t('backButton')} onPress={props.onDismiss} />
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
import { useSelector } from '@xstate/react';
|
||||
import { useContext } from 'react';
|
||||
import { selectVcLabel } from '../../../machines/settings';
|
||||
import { GlobalContext } from '../../../shared/GlobalContext';
|
||||
|
||||
export function useDownloadingVcModal() {
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
|
||||
return {
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
};
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@ export const GetIdInputModal: React.FC<GetIdInputModalProps> = (props) => {
|
||||
const { t } = useTranslation('GetIdInputModal');
|
||||
const controller = useGetIdInputModal(props);
|
||||
|
||||
const inputLabel = t('applicationId', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
});
|
||||
const inputLabel = t('applicationId');
|
||||
|
||||
return (
|
||||
<Modal onDismiss={props.onDismiss} isVisible={props.isVisible}>
|
||||
@@ -27,9 +25,7 @@ export const GetIdInputModal: React.FC<GetIdInputModalProps> = (props) => {
|
||||
style={{ flex: 1 }}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
|
||||
<Column fill align="space-between" padding="32 24">
|
||||
<Text align="center">
|
||||
{t('header', { vcLabel: controller.vcLabel.singular })}
|
||||
</Text>
|
||||
<Text align="center">{t('header')}</Text>
|
||||
<Column>
|
||||
<Row crossAlign="flex-end">
|
||||
<Column fill>
|
||||
@@ -51,13 +47,7 @@ export const GetIdInputModal: React.FC<GetIdInputModalProps> = (props) => {
|
||||
keyboardType="number-pad"
|
||||
rightIcon={
|
||||
<Tooltip
|
||||
popover={
|
||||
<Text>
|
||||
{t('qstnMarkToolTip', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
})}
|
||||
</Text>
|
||||
}
|
||||
popover={<Text>{t('qstnMarkToolTip')}</Text>}
|
||||
width={Dimensions.get('screen').width * 0.8}
|
||||
height={Dimensions.get('screen').height * 0.2}
|
||||
backgroundColor={'lightgray'}
|
||||
@@ -98,7 +88,7 @@ export const GetIdInputModal: React.FC<GetIdInputModalProps> = (props) => {
|
||||
</Column>
|
||||
</Row>
|
||||
<Button
|
||||
title={t('getUIN', { vcLabel: controller.vcLabel.singular })}
|
||||
title={t('getUIN')}
|
||||
margin="24 0 0 0"
|
||||
onPress={controller.VALIDATE_INPUT}
|
||||
loading={controller.isRequestingOtp}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { useContext } from 'react';
|
||||
import { useSelector } from '@xstate/react';
|
||||
import { selectVcLabel } from '../../../machines/settings';
|
||||
import { GlobalContext } from '../../../shared/GlobalContext';
|
||||
import { ActorRefFrom } from 'xstate';
|
||||
import { TextInput } from 'react-native';
|
||||
import { ModalProps } from '../../../components/ui/Modal';
|
||||
@@ -19,13 +16,9 @@ import {
|
||||
} from './GetVcModalMachine';
|
||||
|
||||
export function useGetIdInputModal({ service }: GetIdInputModalProps) {
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
|
||||
return {
|
||||
id: useSelector(service, selectId),
|
||||
idInputRef: useSelector(service, selectIdInputRef),
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
idError: useSelector(service, selectIdError),
|
||||
otpError: useSelector(service, selectOtpError),
|
||||
iconColor: useSelector(service, selectIconColor),
|
||||
|
||||
@@ -44,9 +44,7 @@ export const IdInputModal: React.FC<IdInputModalProps> = (props) => {
|
||||
style={{ flex: 1 }}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
|
||||
<Column fill align="space-between" pY={32} pX={24}>
|
||||
<Text align="center">
|
||||
{t('header', { vcLabel: controller.vcLabel.singular })}
|
||||
</Text>
|
||||
<Text align="center">{t('header')}</Text>
|
||||
<Column>
|
||||
<Row crossAlign="flex-end">
|
||||
<Column
|
||||
@@ -100,7 +98,7 @@ export const IdInputModal: React.FC<IdInputModalProps> = (props) => {
|
||||
</Column>
|
||||
</Row>
|
||||
<Button
|
||||
title={t('generateVc', { vcLabel: controller.vcLabel.singular })}
|
||||
title={t('generateVc')}
|
||||
margin="24 0 0 0"
|
||||
onPress={controller.VALIDATE_INPUT}
|
||||
loading={controller.isRequestingOtp}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { useContext } from 'react';
|
||||
import { useSelector } from '@xstate/react';
|
||||
import { selectVcLabel } from '../../../machines/settings';
|
||||
import { GlobalContext } from '../../../shared/GlobalContext';
|
||||
import { ActorRefFrom } from 'xstate';
|
||||
import { TextInput } from 'react-native';
|
||||
import { ModalProps } from '../../../components/ui/Modal';
|
||||
@@ -20,14 +17,10 @@ import {
|
||||
import { VcIdType } from '../../../types/vc';
|
||||
|
||||
export function useIdInputModal({ service }: IdInputModalProps) {
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
|
||||
return {
|
||||
id: useSelector(service, selectId),
|
||||
idType: useSelector(service, selectIdType),
|
||||
idInputRef: useSelector(service, selectIdInputRef),
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
idError: useSelector(service, selectIdError),
|
||||
otpError: useSelector(service, selectOtpError),
|
||||
|
||||
|
||||
@@ -64,9 +64,7 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = (props) => {
|
||||
<Button
|
||||
type="clear"
|
||||
disabled={controller.isRefreshingVcs}
|
||||
title={t('addVcButton', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
})}
|
||||
title={t('addVcButton')}
|
||||
onPress={controller.ADD_VC}
|
||||
/>
|
||||
</Column>
|
||||
@@ -76,12 +74,10 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = (props) => {
|
||||
<React.Fragment>
|
||||
<Centered fill>
|
||||
<Text weight="semibold" margin="0 0 8 0">
|
||||
{t('generateVc', { vcLabel: controller.vcLabel.plural })}
|
||||
{t('generateVc')}
|
||||
</Text>
|
||||
<Text color={Theme.Colors.textLabel} align="center">
|
||||
{t('generateVcDescription', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
})}
|
||||
{t('generateVcDescription')}
|
||||
</Text>
|
||||
<Icon
|
||||
name="arrow-downward"
|
||||
@@ -93,9 +89,7 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = (props) => {
|
||||
<Button
|
||||
type="addId"
|
||||
disabled={controller.isRefreshingVcs}
|
||||
title={t('addVcButton', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
})}
|
||||
title={t('addVcButton')}
|
||||
onPress={controller.ADD_VC}
|
||||
/>
|
||||
</React.Fragment>
|
||||
@@ -129,7 +123,6 @@ export const MyVcsTab: React.FC<HomeScreenTabProps> = (props) => {
|
||||
isVisible={controller.isSavingFailedInIdle}
|
||||
error={storeErrorTranslationPath}
|
||||
onDismiss={controller.DISMISS}
|
||||
vcLabel={controller.vcLabel}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useSelector } from '@xstate/react';
|
||||
import { useContext } from 'react';
|
||||
import { ActorRefFrom } from 'xstate';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import {
|
||||
selectIsRefreshingMyVcs,
|
||||
selectMyVcs,
|
||||
@@ -24,7 +23,6 @@ import {
|
||||
export function useMyVcsTab(props: HomeScreenTabProps) {
|
||||
const service = props.service as ActorRefFrom<typeof MyVcsTabMachine>;
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
const vcService = appService.children.get('vc');
|
||||
|
||||
return {
|
||||
@@ -33,7 +31,6 @@ export function useMyVcsTab(props: HomeScreenTabProps) {
|
||||
GetVcModalService: useSelector(service, selectGetVcModal),
|
||||
|
||||
vcKeys: useSelector(vcService, selectMyVcs),
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
|
||||
isRefreshingVcs: useSelector(vcService, selectIsRefreshingMyVcs),
|
||||
isRequestSuccessful: useSelector(service, selectIsRequestSuccessful),
|
||||
|
||||
@@ -1,43 +1,37 @@
|
||||
import React, { useRef, useContext } from 'react';
|
||||
import React, { useRef } from 'react';
|
||||
import AppIntroSlider from 'react-native-app-intro-slider';
|
||||
import { SafeAreaView, ScrollView, View } from 'react-native';
|
||||
import { Icon, Overlay } from 'react-native-elements';
|
||||
import { Button, Column, Text } from '../../components/ui';
|
||||
import { Theme } from '../../components/ui/styleUtils';
|
||||
import { useSelector } from '@xstate/react';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const OnboardingOverlay: React.FC<OnboardingProps> = (props) => {
|
||||
const slider = useRef<AppIntroSlider>();
|
||||
|
||||
const { t } = useTranslation('OnboardingOverlay');
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
const vcLabel = useSelector(settingsService, selectVcLabel);
|
||||
|
||||
const slides = [
|
||||
{
|
||||
key: 'one',
|
||||
title: t('stepOneTitle'),
|
||||
text: t('stepOneText', { vcLabel: vcLabel.plural }),
|
||||
text: t('stepOneText'),
|
||||
},
|
||||
{
|
||||
key: 'two',
|
||||
title: t('stepTwoTitle', { vcLabel: vcLabel.singular }),
|
||||
text: t('stepTwoText', { vcLabel: vcLabel.plural }),
|
||||
title: t('stepTwoTitle'),
|
||||
text: t('stepTwoText'),
|
||||
},
|
||||
{
|
||||
key: 'three',
|
||||
title: t('stepThreeTitle'),
|
||||
text: t('stepThreeText', { vcLabel: vcLabel.plural }),
|
||||
text: t('stepThreeText'),
|
||||
footer: (
|
||||
<Button
|
||||
margin="24 0 0 0"
|
||||
raised
|
||||
type="outline"
|
||||
title={t('stepThreeButton', { vcLabel: vcLabel.singular })}
|
||||
title={t('stepThreeButton')}
|
||||
onPress={props.onAddVc}
|
||||
/>
|
||||
),
|
||||
|
||||
@@ -41,14 +41,10 @@ export const ReceivedVcsTab: React.FC<HomeScreenTabProps> = (props) => {
|
||||
name="sentiment-dissatisfied"
|
||||
/>
|
||||
<Text align="center" weight="semibold" margin="0 0 4 0">
|
||||
{t('noReceivedVcsTitle', {
|
||||
vcLabel: controller.vcLabel.plural,
|
||||
})}
|
||||
{t('noReceivedVcsTitle')}
|
||||
</Text>
|
||||
<Text align="center" color={Theme.Colors.textLabel}>
|
||||
{t('noReceivedVcsText', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
})}
|
||||
{t('noReceivedVcsText')}
|
||||
</Text>
|
||||
</Centered>
|
||||
</React.Fragment>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { useSelector } from '@xstate/react';
|
||||
import { useContext } from 'react';
|
||||
import { ActorRefFrom } from 'xstate';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import {
|
||||
selectIsRefreshingReceivedVcs,
|
||||
selectReceivedVcs,
|
||||
} from '../../machines/vc';
|
||||
import { vcItemMachine } from '../../machines/vcItem';
|
||||
import { vcItemMachine } from '../../machines/vcItem';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import { HomeScreenTabProps } from './HomeScreen';
|
||||
import {
|
||||
@@ -17,16 +16,14 @@ import {
|
||||
export function useReceivedVcsTab(props: HomeScreenTabProps) {
|
||||
const service = props.service as ActorRefFrom<typeof ReceivedVcsTabMachine>;
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
const vcService = appService.children.get('vc');
|
||||
|
||||
return {
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
vcKeys: useSelector(vcService, selectReceivedVcs),
|
||||
|
||||
isRefreshingVcs: useSelector(vcService, selectIsRefreshingReceivedVcs),
|
||||
|
||||
VIEW_VC: (vcItemActor: ActorRefFrom<typeof vcItemMachine>) =>
|
||||
VIEW_VC: (vcItemActor: ActorRefFrom<typeof vcItemMachine>) =>
|
||||
service.send(ReceivedVcsTabEvents.VIEW_VC(vcItemActor)),
|
||||
REFRESH: () => service.send(ReceivedVcsTabEvents.REFRESH()),
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
} from '../../machines/vcItem';
|
||||
import { selectPasscode } from '../../machines/auth';
|
||||
import { biometricsMachine, selectIsSuccess } from '../../machines/biometrics';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
|
||||
export function useViewVcModal({
|
||||
vcItemActor,
|
||||
@@ -41,11 +40,9 @@ export function useViewVcModal({
|
||||
const [error, setError] = useState('');
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const authService = appService.children.get('auth');
|
||||
const settingsService = appService.children.get('settings');
|
||||
const [, bioSend, bioService] = useMachine(biometricsMachine);
|
||||
|
||||
const isSuccessBio = useSelector(bioService, selectIsSuccess);
|
||||
const vcLabel = useSelector(settingsService, selectVcLabel);
|
||||
const isLockingVc = useSelector(vcItemActor, selectIsLockingVc);
|
||||
const isRevokingVc = useSelector(vcItemActor, selectIsRevokingVc);
|
||||
const isLoggingRevoke = useSelector(vcItemActor, selectIsLoggingRevoke);
|
||||
@@ -84,11 +81,7 @@ export function useViewVcModal({
|
||||
|
||||
useEffect(() => {
|
||||
if (isLockingVc) {
|
||||
showToast(
|
||||
vc.locked
|
||||
? t('success.locked', { vcLabel: vcLabel.singular })
|
||||
: t('success.unlocked', { vcLabel: vcLabel.singular })
|
||||
);
|
||||
showToast(vc.locked ? t('success.locked') : t('success.unlocked'));
|
||||
}
|
||||
if (isRevokingVc) {
|
||||
showToast(t('success.revoked', { vid: vc.id }));
|
||||
|
||||
@@ -68,7 +68,7 @@ export const MyBindedVcs: React.FC<MyBindedVcsProps> = (props) => {
|
||||
<React.Fragment>
|
||||
<Centered fill>
|
||||
<Text weight="semibold" margin="0 0 8 0">
|
||||
{t('noBindedVc', { vcLabel: controller.vcLabel.plural })}
|
||||
{t('noBindedVc')}
|
||||
</Text>
|
||||
</Centered>
|
||||
<Button
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
selectIsSendingAuthenticate,
|
||||
selectEssentialClaims,
|
||||
} from '../../machines/QrLoginMachine';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { selectBindedVcs } from '../../machines/vc';
|
||||
import { vcItemMachine } from '../../machines/vcItem';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
@@ -33,7 +32,6 @@ import { QrLoginProps } from './QrLogin';
|
||||
|
||||
export function useQrLogin({ service }: QrLoginProps) {
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
|
||||
const vcService = appService.children.get('vc');
|
||||
const [selectedIndex, setSelectedIndex] = useState<number>(null);
|
||||
@@ -82,7 +80,6 @@ export function useQrLogin({ service }: QrLoginProps) {
|
||||
isVerifyingIdentity: useSelector(service, selectIsisVerifyingIdentity),
|
||||
isInvalidIdentity: useSelector(service, selectIsInvalidIdentity),
|
||||
isVerifyingSuccesful: useSelector(service, selectIsVerifyingSuccesful),
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
|
||||
DISMISS: () => service.send(QrLoginEvents.DISMISS()),
|
||||
SCANNING_DONE: (qrCode: string) =>
|
||||
|
||||
@@ -39,7 +39,7 @@ export const ReceiveVcScreen: React.FC = () => {
|
||||
<Column>
|
||||
<DeviceInfoList of="sender" deviceInfo={controller.senderInfo} />
|
||||
<Text weight="semibold" margin="24 24 0 24">
|
||||
{t('header', { vcLabel: controller.vcLabel.singular })}
|
||||
{t('header')}
|
||||
</Text>
|
||||
<VcDetails
|
||||
vc={controller.incomingVc}
|
||||
@@ -60,9 +60,7 @@ export const ReceiveVcScreen: React.FC = () => {
|
||||
/>
|
||||
) : (
|
||||
<Button
|
||||
title={t('save', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
})}
|
||||
title={t('save')}
|
||||
margin="12 0 12 0"
|
||||
onPress={controller.ACCEPT}
|
||||
disabled={!controller.isReviewingInIdle}
|
||||
@@ -78,9 +76,7 @@ export const ReceiveVcScreen: React.FC = () => {
|
||||
</>
|
||||
) : (
|
||||
<Button
|
||||
title={t('goToReceivedVCTab', {
|
||||
vcLabel: controller.vcLabel.plural,
|
||||
})}
|
||||
title={t('goToReceivedVCTab')}
|
||||
margin="0 0 12 0"
|
||||
onPress={controller.GO_TO_RECEIVED_VC_TAB}
|
||||
/>
|
||||
@@ -121,9 +117,7 @@ export const ReceiveVcScreen: React.FC = () => {
|
||||
|
||||
<MessageOverlay
|
||||
isVisible={savingOverlayVisible}
|
||||
message={t('saving', {
|
||||
vcLabel: controller.vcLabel.plural,
|
||||
})}
|
||||
message={t('saving')}
|
||||
progress={true}
|
||||
/>
|
||||
<ErrorMessageOverlay
|
||||
@@ -131,7 +125,6 @@ export const ReceiveVcScreen: React.FC = () => {
|
||||
error={storeErrorTranslationPath}
|
||||
translationPath={'ReceiveVcScreen'}
|
||||
onDismiss={controller.DISMISS}
|
||||
vcLabel={controller.vcLabel}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
selectIsVerifyingIdentity,
|
||||
selectSenderInfo,
|
||||
} from '../../machines/request';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import {
|
||||
selectIsAccepting,
|
||||
@@ -20,12 +19,10 @@ import {
|
||||
export function useReceiveVcScreen() {
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const requestService = appService.children.get('request');
|
||||
const settingsService = appService.children.get('settings');
|
||||
|
||||
return {
|
||||
senderInfo: useSelector(requestService, selectSenderInfo),
|
||||
incomingVc: useSelector(requestService, selectIncomingVc),
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
|
||||
isIncomingVp: useSelector(requestService, selectIsIncomingVp),
|
||||
isReviewingInIdle: useSelector(requestService, selectIsReviewingInIdle),
|
||||
|
||||
@@ -38,9 +38,7 @@ export const RequestLayout: React.FC = () => {
|
||||
name="ReceiveVcScreen"
|
||||
component={ReceiveVcScreen}
|
||||
options={{
|
||||
title: t('incomingVc', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
}),
|
||||
title: t('incomingVc'),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -57,7 +55,6 @@ export const RequestLayout: React.FC = () => {
|
||||
<Message
|
||||
title={t('status.accepted.title')}
|
||||
message={t('status.accepted.message', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
sender: controller.senderInfo.deviceName,
|
||||
})}
|
||||
onBackdropPress={controller.DISMISS}
|
||||
@@ -68,7 +65,6 @@ export const RequestLayout: React.FC = () => {
|
||||
<Message
|
||||
title={t('status.rejected.title')}
|
||||
message={t('status.rejected.message', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
sender: controller.senderInfo.deviceName,
|
||||
})}
|
||||
onBackdropPress={controller.DISMISS}
|
||||
@@ -87,9 +83,7 @@ export const RequestLayout: React.FC = () => {
|
||||
<MessageOverlay
|
||||
isVisible={controller.isBleError}
|
||||
title={t('status.bleError.title')}
|
||||
message={t('status.bleError.message', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
})}
|
||||
message={t('status.bleError.message')}
|
||||
hint={
|
||||
controller.bleError.code &&
|
||||
t('status.bleError.hint', {
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
selectIsWaitingForConnection,
|
||||
selectSenderInfo,
|
||||
} from '../../machines/request';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { MainBottomTabParamList } from '../../routes/main';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import { selectIsHandlingBleError } from '../../machines/openIdBle/scan';
|
||||
@@ -31,7 +30,6 @@ type RequestLayoutNavigation = NavigationProp<
|
||||
|
||||
export function useRequestLayout() {
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
const requestService = appService.children.get('request');
|
||||
const navigation = useNavigation<RequestLayoutNavigation>();
|
||||
|
||||
@@ -67,7 +65,6 @@ export function useRequestLayout() {
|
||||
}, [isDone, isReviewing, isWaitingForConnection]);
|
||||
|
||||
return {
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
senderInfo: useSelector(requestService, selectSenderInfo),
|
||||
|
||||
isAccepted: useSelector(requestService, selectIsAccepted),
|
||||
|
||||
@@ -36,7 +36,7 @@ const BluetoothPrompt: React.FC<RequestScreenProps> = ({ t, controller }) => {
|
||||
return (
|
||||
<Centered fill>
|
||||
<Text color={Theme.Colors.errorMessage} align="center">
|
||||
{t('bluetoothDenied', { vcLabel: controller.vcLabel.singular })}
|
||||
{t('bluetoothDenied')}
|
||||
</Text>
|
||||
<Button
|
||||
margin={[32, 0, 0, 0]}
|
||||
@@ -50,9 +50,7 @@ const BluetoothPrompt: React.FC<RequestScreenProps> = ({ t, controller }) => {
|
||||
const SharingQR: React.FC<RequestScreenProps> = ({ t, controller }) => {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Text align="center">
|
||||
{t('showQrCode', { vcLabel: controller.vcLabel.singular })}
|
||||
</Text>
|
||||
<Text align="center">{t('showQrCode')}</Text>
|
||||
|
||||
<Centered fill>
|
||||
{controller.connectionParams !== '' ? (
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
selectIsCancelling,
|
||||
selectIsOffline,
|
||||
} from '../../machines/request';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import BluetoothStateManager from 'react-native-bluetooth-state-manager';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -25,8 +24,6 @@ import { useTranslation } from 'react-i18next';
|
||||
export function useRequestScreen() {
|
||||
const { t } = useTranslation('RequestScreen');
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
const vcLabel = useSelector(settingsService, selectVcLabel);
|
||||
|
||||
const requestService = appService.children.get('request');
|
||||
const isActive = useSelector(appService, selectIsActive);
|
||||
@@ -68,13 +65,9 @@ export function useRequestScreen() {
|
||||
statusHint = t('status.exchangingDeviceInfo.timeoutHint');
|
||||
isStatusCancellable = true;
|
||||
} else if (isWaitingForVc) {
|
||||
statusMessage = t('status.connected.message', {
|
||||
vcLabel: vcLabel.singular,
|
||||
});
|
||||
statusMessage = t('status.connected.message');
|
||||
} else if (isWaitingForVcTimeout) {
|
||||
statusMessage = t('status.connected.message', {
|
||||
vcLabel: vcLabel.singular,
|
||||
});
|
||||
statusMessage = t('status.connected.message');
|
||||
statusHint = t('status.connected.timeoutHint');
|
||||
isStatusCancellable = true;
|
||||
}
|
||||
@@ -88,7 +81,6 @@ export function useRequestScreen() {
|
||||
}, [isFocused, isActive]);
|
||||
|
||||
return {
|
||||
vcLabel,
|
||||
statusMessage,
|
||||
statusHint,
|
||||
sharingProtocol: useSelector(requestService, selectSharingProtocol),
|
||||
|
||||
@@ -29,9 +29,7 @@ export const ScanLayout: React.FC = () => {
|
||||
name="SendVcScreen"
|
||||
component={SendVcScreen}
|
||||
options={{
|
||||
title: t('sharingVc', {
|
||||
vcLabel: controller.vcLabel.singular,
|
||||
}),
|
||||
title: t('sharingVc'),
|
||||
headerBackVisible: false,
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -25,7 +25,6 @@ import {
|
||||
selectIsSendingVcTimeout,
|
||||
selectReceiverInfo,
|
||||
} from '../../machines/scan';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { MainBottomTabParamList } from '../../routes/main';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import { selectIsHandlingBleError } from '../../machines/openIdBle/scan';
|
||||
@@ -46,7 +45,6 @@ export function useScanLayout() {
|
||||
const { t } = useTranslation('ScanScreen');
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const scanService = appService.children.get('scan');
|
||||
const settingsService = appService.children.get('settings');
|
||||
const navigation = useNavigation<ScanLayoutNavigation>();
|
||||
|
||||
const isLocationDisabled = useSelector(scanService, selectIsLocationDisabled);
|
||||
@@ -90,8 +88,6 @@ export function useScanLayout() {
|
||||
const isSendingVc = useSelector(scanService, selectIsSendingVc);
|
||||
const isSendingVcTimeout = useSelector(scanService, selectIsSendingVcTimeout);
|
||||
|
||||
const vcLabel = useSelector(settingsService, selectVcLabel);
|
||||
|
||||
const onCancel = () => scanService.send(ScanEvents.CANCEL());
|
||||
let statusOverlay: Pick<
|
||||
MessageOverlayProps,
|
||||
@@ -123,8 +119,8 @@ export function useScanLayout() {
|
||||
};
|
||||
} else if (isSent) {
|
||||
statusOverlay = {
|
||||
message: t('status.sent', { vcLabel: vcLabel.singular }),
|
||||
hint: t('status.sentHint', { vcLabel: vcLabel.singular }),
|
||||
message: t('status.sent'),
|
||||
hint: t('status.sentHint'),
|
||||
};
|
||||
} else if (isSendingVc) {
|
||||
statusOverlay = {
|
||||
@@ -143,7 +139,6 @@ export function useScanLayout() {
|
||||
statusOverlay = {
|
||||
title: t('status.accepted.title'),
|
||||
message: t('status.accepted.message', {
|
||||
vcLabel: vcLabel.singular,
|
||||
receiver: receiverInfo.deviceName,
|
||||
}),
|
||||
onBackdropPress: DISMISS,
|
||||
@@ -152,7 +147,6 @@ export function useScanLayout() {
|
||||
statusOverlay = {
|
||||
title: t('status.rejected.title'),
|
||||
message: t('status.rejected.message', {
|
||||
vcLabel: vcLabel.singular,
|
||||
receiver: receiverInfo.deviceName,
|
||||
}),
|
||||
onBackdropPress: DISMISS,
|
||||
@@ -170,9 +164,7 @@ export function useScanLayout() {
|
||||
} else if (isBleError) {
|
||||
statusOverlay = {
|
||||
title: t('status.bleError.title'),
|
||||
message: t('status.bleError.message', {
|
||||
vcLabel: vcLabel.singular,
|
||||
}),
|
||||
message: t('status.bleError.message'),
|
||||
hint:
|
||||
bleError.code &&
|
||||
t('status.bleError.hint', {
|
||||
@@ -215,8 +207,6 @@ export function useScanLayout() {
|
||||
}, [isDone, isReviewing, isScanning, isQrLoginDone, isBleError]);
|
||||
|
||||
return {
|
||||
vcLabel,
|
||||
|
||||
isInvalid,
|
||||
isDone,
|
||||
isDisconnected: useSelector(scanService, selectIsDisconnected),
|
||||
|
||||
@@ -33,7 +33,7 @@ export const ScanScreen: React.FC = () => {
|
||||
function noShareableVcText() {
|
||||
return (
|
||||
<Text align="center" color={Theme.Colors.errorMessage} margin="0 10">
|
||||
{t('noShareableVcs', { vcLabel: controller.vcLabel.plural })}
|
||||
{t('noShareableVcs')}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
selectQrLoginRef,
|
||||
selectIsQrLoginStoring,
|
||||
} from '../../machines/scan';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { selectShareableVcs } from '../../machines/vc';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import { selectIsBluetoothDenied } from '../../machines/openIdBle/scan';
|
||||
@@ -20,7 +19,6 @@ export function useScanScreen() {
|
||||
const { t } = useTranslation('ScanScreen');
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const scanService = appService.children.get('scan');
|
||||
const settingsService = appService.children.get('settings');
|
||||
const vcService = appService.children.get('vc');
|
||||
|
||||
const shareableVcs = useSelector(vcService, selectShareableVcs);
|
||||
@@ -43,7 +41,6 @@ export function useScanScreen() {
|
||||
|
||||
return {
|
||||
locationError,
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
|
||||
isEmpty: !shareableVcs.length,
|
||||
isBluetoothPermissionDenied,
|
||||
|
||||
@@ -23,11 +23,10 @@ export const SelectVcOverlay: React.FC<SelectVcOverlayProps> = (props) => {
|
||||
width={Dimensions.get('screen').width * 0.9}
|
||||
style={{ maxHeight: Dimensions.get('screen').height * 0.9 }}>
|
||||
<Text weight="semibold" margin="0 0 16 0">
|
||||
{t('header', { vcLabel: controller.vcLabel.singular })}
|
||||
{t('header')}
|
||||
</Text>
|
||||
<Text margin="0 0 16 0">
|
||||
{t('chooseVc', { vcLabel: controller.vcLabel.singular })}{' '}
|
||||
<Text weight="semibold">{props.receiverName}</Text>
|
||||
{t('chooseVc')} <Text weight="semibold">{props.receiverName}</Text>
|
||||
</Text>
|
||||
<Column margin="0 0 32 0" scroll>
|
||||
{props.vcKeys.map((vcKey, index) => (
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { useSelector } from '@xstate/react';
|
||||
import { useContext, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { ActorRefFrom } from 'xstate';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { vcItemMachine } from '../../machines/vcItem';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
import { VC } from '../../types/vc';
|
||||
|
||||
export function useSelectVcOverlay(props: SelectVcOverlayProps) {
|
||||
@@ -11,13 +8,9 @@ export function useSelectVcOverlay(props: SelectVcOverlayProps) {
|
||||
const [selectedVcRef, setSelectedVcRef] =
|
||||
useState<ActorRefFrom<typeof vcItemMachine>>(null);
|
||||
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const settingsService = appService.children.get('settings');
|
||||
|
||||
return {
|
||||
selectVcItem,
|
||||
selectedIndex,
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
|
||||
onSelect: () => {
|
||||
const { serviceRefs, ...vc } = selectedVcRef.getSnapshot().context;
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
selectSelectedVc,
|
||||
selectIsCancelling,
|
||||
} from '../../machines/scan';
|
||||
import { selectVcLabel } from '../../machines/settings';
|
||||
import { selectShareableVcs } from '../../machines/vc';
|
||||
import { vcItemMachine } from '../../machines/vcItem';
|
||||
import { GlobalContext } from '../../shared/GlobalContext';
|
||||
@@ -20,7 +19,6 @@ import { GlobalContext } from '../../shared/GlobalContext';
|
||||
export function useSendVcScreen() {
|
||||
const { appService } = useContext(GlobalContext);
|
||||
const scanService = appService.children.get('scan');
|
||||
const settingsService = appService.children.get('settings');
|
||||
const vcService = appService.children.get('vc');
|
||||
|
||||
const CANCEL = () => scanService.send(ScanEvents.CANCEL());
|
||||
@@ -41,7 +39,6 @@ export function useSendVcScreen() {
|
||||
receiverInfo: useSelector(scanService, selectReceiverInfo),
|
||||
reason: useSelector(scanService, selectReason),
|
||||
vcName: useSelector(scanService, selectVcName),
|
||||
vcLabel: useSelector(settingsService, selectVcLabel),
|
||||
vcKeys: useSelector(vcService, selectShareableVcs),
|
||||
selectedVc: useSelector(scanService, selectSelectedVc),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user