Skip to content

Commit

Permalink
Merge pull request #75 from srikanth716/ui-revamp
Browse files Browse the repository at this point in the history
Issues Fixed : 
1. App crash on logout.
2. Hiding the kebab menu in VC Sharing Screen, while sharing vc.
3. Fixing the Environment Credential Registry Multiple Clicks Issue.
  • Loading branch information
vijay151096 authored Jul 10, 2023
2 parents 9b10d25 + 830e92b commit 582178f
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 179 deletions.
11 changes: 9 additions & 2 deletions components/EditableListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ export const EditableListItem: React.FC<EditableListItemProps> = (props) => {
closePopup()}
<Row>
<Button fill type="clear" title={t('cancel')} onPress={dismiss} />
<Button fill title={t('save')} onPress={edit} />
<Button
fill
title={t('save')}
onPress={edit}
loading={props.progress}
/>
</Row>
</Column>
</Overlay>
Expand All @@ -81,7 +86,7 @@ export const EditableListItem: React.FC<EditableListItemProps> = (props) => {
function dismiss() {
setNewValue(props.value);
setIsEditing(false);
props.credentialRegistryResponse = '';
props.onCancel();
}

function closePopup() {
Expand All @@ -98,4 +103,6 @@ interface EditableListItemProps {
onEdit: (newValue: string) => void;
display?: 'none' | 'flex';
credentialRegistryResponse: string;
onCancel: () => void;
progress?: boolean;
}
3 changes: 2 additions & 1 deletion locales/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
"aboutInji": "حول إنجي",
"credentialRegistry": "سجل الاعتماد",
"injiTourGuide": "مرشد إنجي السياحي",
"logout": "تسجيل خروج"
"logout": "تسجيل خروج",
"resetInjiProps": "إعادة تعيين دعائم إنجي ..."
},
"AboutInji": {
"aboutInji": "حول إنجي",
Expand Down
19 changes: 10 additions & 9 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"WALLET_BINDING_SUCCESSFULL": "Activation successful",
"WALLET_BINDING_FAILURE": "Activation failed"
},
"DeviceInfoList": {
"requestedBy": "Requested by",
"sentBy": "Sent by",
"deviceRefNumber": "Device reference number",
"name": "Name",
"Verifier": "Verifier",
"Wallet": "Wallet"
},
"DeviceInfoList": {
"requestedBy": "Requested by",
"sentBy": "Sent by",
"deviceRefNumber": "Device reference number",
"name": "Name",
"Verifier": "Verifier",
"Wallet": "Wallet"
},
"FaceScanner": {},
"OIDcAuth": {
"title": "OIDC Authentication",
Expand Down Expand Up @@ -135,7 +135,8 @@
"aboutInji": "About Inji",
"credentialRegistry": "Credential Registry",
"injiTourGuide": "Inji Tour Guide",
"logout": "Logout"
"logout": "Logout",
"resetInjiProps": "Resetting Inji Props..."
},
"AboutInji": {
"aboutInji": "About Inji",
Expand Down
3 changes: 2 additions & 1 deletion locales/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
"aboutInji": "About Inji",
"credentialRegistry": "Credential Registry",
"injiTourGuide": "Inji Tour Guide",
"logout": "Mag-logout"
"logout": "Mag-logout",
"resetInjiProps": "Nire-reset ang Inji Props..."
},
"AboutInji": {
"aboutInji": "Tungkol kay Inji",
Expand Down
209 changes: 105 additions & 104 deletions locales/hin.json

Large diffs are not rendered by default.

19 changes: 2 additions & 17 deletions locales/kan.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"aboutInji": "ಇಂಜಿ ಬಗ್ಗೆ",
"credentialRegistry": "ರುಜುವಾತು ನೋಂದಣಿ",
"injiTourGuide": "ಇಂಜಿ ಪ್ರವಾಸ ಮಾರ್ಗದರ್ಶಿ",
"logout": "ಲಾಗ್ ಔಟ್"
"logout": "ಲಾಗ್ ಔಟ್",
"resetInjiProps": "ಇಂಜಿ ಪ್ರಾಪ್ಸ್ ಅನ್ನು ಮರುಹೊಂದಿಸಲಾಗುತ್ತಿದೆ..."
},
"AboutInji": {
"aboutInji": "ಇಂಜಿ ಬಗ್ಗೆ",
Expand Down Expand Up @@ -300,22 +301,6 @@
"version": "ಆವೃತ್ತಿ",
"useBle": "BLE ನಿಂದ ನಡೆಸಲ್ಪಡುತ್ತಿದೆ"
},
"ProfileScreen": {
"name": "ಹೆಸರು",
"vcLabel": "VC ಲೇಬಲ್",
"language": "ಭಾಷೆ",
"credentialRegistry": "ರುಜುವಾತುಗಳ ನೋಂದಣಿ",
"bioUnlock": "ಬಯೋಮೆಟ್ರಿಕ್‌ಗಳೊಂದಿಗೆ ಅನ್‌ಲಾಕ್ ಮಾಡಿ",
"authFactorUnlock": "ಅನ್ಲಾಕ್ ದೃಢೀಕರಣ ಅಂಶ",
"AppMetaData": "ಇಂಜಿ ಬಗ್ಗೆ",
"logout": "ಲಾಗ್ ಔಟ್",
"revokeLabel": "ರದ್ದು VID",
"revokeHeader": "ರದ್ದು VID",
"revokingVids": "ನೀವು ಹಿಂತೆಗೆದುಕೊಳ್ಳಲಿದ್ದೀರಿ ({{count}}) VIDs.",
"revokingVidsAfter": "ಇದರರ್ಥ ನೀವು ಇನ್ನು ಮುಂದೆ ಅವುಗಳಿಗೆ ಲಿಂಕ್ ಮಾಡಲಾದ ಯಾವುದೇ ID ಗಳನ್ನು ಬಳಸಲು ಅಥವಾ ವೀಕ್ಷಿಸಲು ಸಾಧ್ಯವಾಗುವುದಿಲ್ಲ VID(s). \nನೀವು ಮುಂದುವರೆಯಲು ಖಚಿತವಾಗಿ ಬಯಸುವಿರಾ?",
"empty": "ಖಾಲಿ",
"revokeSuccessful": "VID ಯಶಸ್ವಿಯಾಗಿ ಹಿಂಪಡೆಯಲಾಗಿದೆ"
},
"QrScreen": {
"title": "QR ಲಾಗಿನ್",
"alignQr": "ಸ್ಕ್ಯಾನ್ ಮಾಡಲು ಚೌಕಟ್ಟಿನೊಳಗೆ QR ಕೋಡ್ ಅನ್ನು ಹೊಂದಿಸಿ",
Expand Down
27 changes: 12 additions & 15 deletions locales/spa.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,18 @@
"version": "Versión",
"useBle": "Impulsado por BLE"
},
"ProfileScreen": {
"name": "Nombre",
"vcLabel": "Etiqueta de VC",
"language": "Idioma",
"bioUnlock": "Desbloquear con biometría",
"authFactorUnlock": "Desbloquear factor de autenticación",
"AppMetaData": "Acerca de Inji",
"logout": "Cerrar sesión",
"revokeLabel": "Revocar VID",
"revokeHeader": "REVOCAR VID",
"revokingVids": "Estás a punto de revocar ({{count}}) VIDs.",
"revokingVidsAfter": "Esto significa que ya no podrás usar ni ver ninguna de las identificaciones vinculadas a esos VID(s).\n¿Estás seguro de que deseas continuar?",
"empty": "Vacío",
"revokeSuccessful": "VID revocado exitosamente"
},
"SettingScreen": {
"header": "Ajustes",
"injiAsVerifierApp": "Inji como aplicación verificadora",
"basicSettings": "Ajustes básicos",
"bioUnlock": "Desbloquear con biométrico",
"language": "Idioma",
"aboutInji": "Acerca de Inji",
"credentialRegistry": "Registro de Credenciales",
"injiTourGuide": "Guía turístico Inji",
"logout": "Cerrar sesión",
"resetInjiProps": "Restableciendo accesorios Inji..."
},
"QrScreen": {
"title": "Inicio de sesión con código QR",
"alignQr": "Alinea el código QR dentro del marco para escanearlo",
Expand Down
3 changes: 2 additions & 1 deletion locales/tam.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"aboutInji": "இன்ஜி பற்றி",
"credentialRegistry": "நற்சான்றிதழ் பதிவு",
"injiTourGuide": "இன்ஜி சுற்றுலா வழிகாட்டி",
"logout": "வெளியேறு"
"logout": "வெளியேறு",
"resetInjiProps": "இன்ஜி ப்ராப்ஸை மீட்டமைக்கிறது..."
},
"AboutInji": {
"aboutInji": "இன்ஜி பற்றி",
Expand Down
2 changes: 1 addition & 1 deletion machines/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const authMachine = model.createMachine(
}),

setLanguage: assign({
selectLanguage: (context) => !context.selectLanguage,
selectLanguage: (context) => true,
}),
},

Expand Down
28 changes: 19 additions & 9 deletions machines/settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ContextFrom, EventFrom, send, StateFrom } from 'xstate';
import { assign, ContextFrom, EventFrom, send, StateFrom } from 'xstate';
import { createModel } from 'xstate/lib/model';
import { AppServices } from '../shared/GlobalContext';
import { HOST, SETTINGS_STORE_KEY } from '../shared/constants';
Expand All @@ -19,7 +19,7 @@ const model = createModel(
} as VCLabel,
isBiometricUnlockEnabled: false,
credentialRegistry: HOST,
credentialRegistryResponse: '',
credentialRegistryResponse: '' as string,
},
{
events: {
Expand All @@ -36,6 +36,7 @@ const model = createModel(
) => ({
credentialRegistryResponse: credentialRegistryResponse,
}),
CANCEL: () => ({}),
},
}
);
Expand Down Expand Up @@ -84,6 +85,9 @@ export const settingsMachine = model.createMachine(
actions: ['resetCredentialRegistry'],
target: 'resetInjiProps',
},
CANCEL: {
actions: ['resetCredentialRegistry'],
},
},
},
resetInjiProps: {
Expand All @@ -101,6 +105,12 @@ export const settingsMachine = model.createMachine(
target: 'idle',
},
},
on: {
CANCEL: {
actions: ['resetCredentialRegistry'],
target: 'idle',
},
},
},
},
},
Expand Down Expand Up @@ -136,23 +146,20 @@ export const settingsMachine = model.createMachine(
plural: event.label + 's',
}),
}),
updateCredentialRegistry: model.assign({
updateCredentialRegistry: assign({
credentialRegistry: (_context, event) => event.data.warningDomainName,
}),

updateCredentialRegistryResponse: model.assign({
updateCredentialRegistryResponse: assign({
credentialRegistryResponse: () => 'error',
}),

updateCredentialRegistrySuccess: model.assign({
updateCredentialRegistrySuccess: assign({
credentialRegistryResponse: () => 'success',
}),

resetCredentialRegistry: model.assign({
credentialRegistryResponse: () => {
console.log('resetCredentialRegistry : called');
return '';
},
credentialRegistryResponse: () => '',
}),

toggleBiometricUnlock: model.assign({
Expand Down Expand Up @@ -205,3 +212,6 @@ export function selectCredentialRegistryResponse(state: State) {
export function selectBiometricUnlockEnabled(state: State) {
return state.context.isBiometricUnlockEnabled;
}
export function selectIsResetInjiProps(state: State) {
return state.matches('resetInjiProps');
}
2 changes: 1 addition & 1 deletion machines/settings.typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface Typegen0 {
};
'eventsCausingActions': {
requestStoredContext: 'xstate.init';
resetCredentialRegistry: 'UPDATE_CREDENTIAL_REGISTRY';
resetCredentialRegistry: 'CANCEL' | 'UPDATE_CREDENTIAL_REGISTRY';
setContext: 'STORE_RESPONSE';
storeContext:
| 'STORE_RESPONSE'
Expand Down
4 changes: 2 additions & 2 deletions screens/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { HelpScreen } from '../components/HelpScreen';

const { Navigator, Screen } = createBottomTabNavigator();

export const MainLayout: React.FC<RootRouteProps> = () => {
export const MainLayout: React.FC<RootRouteProps> = (props) => {
const { t } = useTranslation('MainLayout');

const options: BottomTabNavigationOptions = {
Expand All @@ -42,7 +42,7 @@ export const MainLayout: React.FC<RootRouteProps> = () => {
color={Theme.Colors.Icon}
/>
}
navigation={undefined}
navigation={props.navigation}
route={undefined}
/>
</Row>
Expand Down
10 changes: 2 additions & 8 deletions screens/Scan/SendVcScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useContext, useEffect, useRef } from 'react';
import { CheckBox, Input } from 'react-native-elements';
import { Input } from 'react-native-elements';
import { useTranslation } from 'react-i18next';
import { Button, Column, Row, Text } from '../../components/ui';
import { Theme } from '../../components/ui/styleUtils';
Expand Down Expand Up @@ -68,13 +68,6 @@ export const SendVcScreen: React.FC = () => {
containerStyle={{ marginBottom: 6 }}
inputStyle={{ textAlign: I18nManager.isRTL ? 'right' : 'left' }}
/>

<CheckBox
containerStyle={Theme.SelectVcOverlayStyles.consentCheckContainer}
title={t('consentToPhotoVerification')}
checked={controller.selectedVc.shouldVerifyPresence}
onPress={controller.TOGGLE_USER_CONSENT}
/>
</Column>
<Text
margin="15 0 13 24"
Expand All @@ -93,6 +86,7 @@ export const SendVcScreen: React.FC = () => {
onPress={controller.SELECT_VC_ITEM(index)}
selectable
selected={index === controller.selectedIndex}
isSharingVc={true}
/>
))}
<Button
Expand Down
11 changes: 6 additions & 5 deletions screens/Settings/SettingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Platform, Pressable, View } from 'react-native';
import { Icon, ListItem, Switch } from 'react-native-elements';
import { Column, Text } from '../../components/ui';
import { Theme } from '../../components/ui/styleUtils';
import { MainRouteProps } from '../../routes/main';
import { MessageOverlay } from '../../components/MessageOverlay';

import { useSettingsScreen } from './SettingScreenController';
Expand All @@ -14,6 +13,7 @@ import { Modal } from '../../components/ui/Modal';
import { CREDENTIAL_REGISTRY_EDIT } from 'react-native-dotenv';
import { AboutInji } from './AboutInji';
import { EditableListItem } from '../../components/EditableListItem';
import { RootRouteProps } from '../../routes';

const LanguageSetting: React.FC = () => {
const { t } = useTranslation('SettingScreen');
Expand Down Expand Up @@ -46,7 +46,7 @@ const LanguageSetting: React.FC = () => {
);
};

export const SettingScreen: React.FC<SettingProps & MainRouteProps> = (
export const SettingScreen: React.FC<SettingProps & RootRouteProps> = (
props
) => {
const { t } = useTranslation('SettingScreen');
Expand All @@ -63,8 +63,8 @@ export const SettingScreen: React.FC<SettingProps & MainRouteProps> = (
headerTitle={t('header')}
headerElevation={2}
onDismiss={controller.TOGGLE_SETTINGS}>
<ScrollView backgroundColor={Theme.Colors.lightGreyBackgroundColor}>
<Column fill>
<ScrollView>
<Column fill backgroundColor={Theme.Colors.lightGreyBackgroundColor}>
<MessageOverlay
isVisible={controller.alertMsg != ''}
onBackdropPress={controller.hideAlert}
Expand Down Expand Up @@ -111,11 +111,12 @@ export const SettingScreen: React.FC<SettingProps & MainRouteProps> = (
credentialRegistryResponse={
controller.credentialRegistryResponse
}
onCancel={controller.CANCEL}
onEdit={controller.UPDATE_CREDENTIAL_REGISTRY}
Icon="star"
progress={controller.isResetInjiProps}
/>
)}

{/*
<ListItem
topDivider
Expand Down
12 changes: 9 additions & 3 deletions screens/Settings/SettingScreenController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
selectVcLabel,
selectCredentialRegistry,
SettingsEvents,
selectIsResetInjiProps,
} from '../../machines/settings';

import {
Expand All @@ -22,11 +23,11 @@ import {
selectIsSuccess,
selectUnenrolledNotice,
} from '../../machines/biometrics';
import { MainRouteProps } from '../../routes/main';
import { GlobalContext } from '../../shared/GlobalContext';
import { useTranslation } from 'react-i18next';
import { RootRouteProps } from '../../routes';

export function useSettingsScreen({ navigation }: MainRouteProps) {
export function useSettingsScreen(props: RootRouteProps) {
const { appService } = useContext(GlobalContext);
const authService = appService.children.get('auth');
const settingsService = appService.children.get('settings');
Expand Down Expand Up @@ -110,6 +111,7 @@ export function useSettingsScreen({ navigation }: MainRouteProps) {
settingsService,
selectBiometricUnlockEnabled
),
isResetInjiProps: useSelector(settingsService, selectIsResetInjiProps),
canUseBiometrics: useSelector(authService, selectCanUseBiometrics),
useBiometrics,

Expand Down Expand Up @@ -138,7 +140,11 @@ export function useSettingsScreen({ navigation }: MainRouteProps) {

LOGOUT: () => {
authService.send(AuthEvents.LOGOUT());
navigation.navigate('Welcome');
props.navigation.navigate('Welcome');
},

CANCEL: () => {
settingsService.send(SettingsEvents.CANCEL());
},
};
}

0 comments on commit 582178f

Please sign in to comment.