Skip to content

Commit d352b82

Browse files
authored
Merge pull request #87948 from bernhardoj/feat/86580-device-management
Add device management feature
2 parents 52e58d4 + cca172d commit d352b82

29 files changed

Lines changed: 407 additions & 5 deletions

File tree

src/CONST/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8547,6 +8547,7 @@ const CONST = {
85478547
HAS_POLICY_ADMIN_CARD_FEED_ERRORS: 'hasPolicyAdminCardFeedErrors',
85488548
HAS_DOMAIN_ERRORS: 'hasDomainErrors',
85498549
HAS_LOCKED_BANK_ACCOUNT: 'hasLockedBankAccount',
8550+
HAS_DEVICE_MANAGEMENT_ERROR: 'hasDeviceManagementError',
85508551
},
85518552

85528553
DEBUG: {
@@ -9560,6 +9561,7 @@ const CONST = {
95609561
REVOKE_MFA: 'SettingsSecurity-RevokeMFA',
95619562
MERGE_ACCOUNTS: 'SettingsSecurity-MergeAccounts',
95629563
LOCK_UNLOCK_ACCOUNT: 'SettingsSecurity-LockUnlockAccount',
9564+
DEVICE_MANAGEMENT: 'SettingsSecurity-DeviceManagement',
95639565
CLOSE_ACCOUNT: 'SettingsSecurity-CloseAccount',
95649566
ADD_COPILOT: 'SettingsSecurity-AddCopilot',
95659567
DELEGATE_ITEM: 'SettingsSecurity-DelegateItem',
@@ -9691,6 +9693,12 @@ const CONST = {
96919693
ROUTE_SOURCE: 'route-source',
96929694
ROUTE_FILL: 'route-fill',
96939695
},
9696+
9697+
PARTNER_ID: {
9698+
IPHONE: 14,
9699+
ANDROID: 16,
9700+
NEWDOT: 83,
9701+
},
96949702
} as const;
96959703

96969704
const CONTINUATION_DETECTION_SEARCH_FILTER_KEYS = [

src/ONYXKEYS.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ const ONYXKEYS = {
111111
/** Contains latitude and longitude of user's last known location */
112112
USER_LOCATION: 'userLocation',
113113

114+
/** Contains metadata (partner, login, validation date) for all of the user's logins */
115+
LOGINS: 'logins',
116+
114117
/** Contains metadata (partner, login, validation date) for all of the user's logins */
115118
LOGIN_LIST: 'loginList',
116119

@@ -1370,6 +1373,7 @@ type OnyxValuesMapping = {
13701373
[ONYXKEYS.COUNTRY_CODE]: number;
13711374
[ONYXKEYS.COUNTRY]: string;
13721375
[ONYXKEYS.USER_LOCATION]: OnyxTypes.UserLocation;
1376+
[ONYXKEYS.LOGINS]: OnyxTypes.Logins;
13731377
[ONYXKEYS.LOGIN_LIST]: OnyxTypes.LoginList;
13741378
[ONYXKEYS.PENDING_CONTACT_ACTION]: OnyxTypes.PendingContactAction;
13751379
[ONYXKEYS.VALIDATE_ACTION_CODE]: OnyxTypes.ValidateMagicCodeAction;

src/ROUTES.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ const ROUTES = {
660660
SETTINGS_PAYMENT_CURRENCY: 'setting/preferences/payment-currency',
661661
SETTINGS_THEME: 'settings/preferences/theme',
662662
SETTINGS_SECURITY: 'settings/security',
663+
SETTINGS_DEVICE_MANAGEMENT: 'settings/security/device-management',
663664
SETTINGS_CLOSE: 'settings/security/closeAccount',
664665
SETTINGS_MERGE_ACCOUNTS: {
665666
route: 'settings/security/merge-accounts',

src/SCREENS.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ const SCREENS = {
125125
UPDATE_PERSONAL_BANK_ACCOUNT: 'Settings_Update_Personal_Bank_Account',
126126
ADD_BANK_ACCOUNT_SELECT_COUNTRY_VERIFY_ACCOUNT: 'Settings_Add_Bank_Account_Select_Country_Verify_Account',
127127
BANK_ACCOUNT_PURPOSE: 'Settings_Bank_Account_Purpose',
128+
DEVICE_MANAGEMENT: 'Settings_Device_Management',
128129
CLOSE: 'Settings_Close',
129130
REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged',
130131
REPORT_CARD_LOST_OR_DAMAGED_CONFIRM_MAGIC_CODE: 'Settings_ReportCardLostOrDamaged_ConfirmMagicCode',

src/hooks/useAccountIndicatorChecks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {hasPaymentMethodError} from '@libs/actions/PaymentMethods';
22
import {hasPartiallySetupBankAccount, hasPersonalBankAccountMissingInfo} from '@libs/BankAccountUtils';
33
import {hasPendingExpensifyCardAction} from '@libs/CardUtils';
44
import {hasSubscriptionGreenDotInfo, hasSubscriptionRedDotError} from '@libs/SubscriptionUtils';
5-
import {hasLoginListError, hasLoginListInfo} from '@libs/UserUtils';
5+
import {hasDeviceManagementError, hasLoginListError, hasLoginListInfo} from '@libs/UserUtils';
66
import CONST from '@src/CONST';
77
import ONYXKEYS from '@src/ONYXKEYS';
88
import type IndicatorStatus from '@src/types/utils/IndicatorStatus';
@@ -33,6 +33,7 @@ function useAccountIndicatorChecks(): AccountIndicatorChecksResult {
3333
const [session] = useOnyx(ONYXKEYS.SESSION);
3434
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
3535
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
36+
const [hasDeviceManagementErrorValue] = useOnyx(ONYXKEYS.LOGINS, {selector: hasDeviceManagementError});
3637

3738
const {
3839
companyCards: {shouldShowRBR: hasCompanyCardFeedErrors},
@@ -59,6 +60,7 @@ function useAccountIndicatorChecks(): AccountIndicatorChecksResult {
5960
[CONST.INDICATOR_STATUS.HAS_PHONE_NUMBER_ERROR]: !!privatePersonalDetails?.errorFields?.phoneNumber,
6061
[CONST.INDICATOR_STATUS.HAS_EMPLOYEE_CARD_FEED_ERRORS]: !isPolicyAdmin ? hasCompanyCardFeedErrors : false,
6162
[CONST.INDICATOR_STATUS.HAS_LOCKED_BANK_ACCOUNT]: Object.values(bankAccountList ?? {}).some((bankAccount) => bankAccount?.accountData?.state === CONST.BANK_ACCOUNT.STATE.LOCKED),
63+
[CONST.INDICATOR_STATUS.HAS_DEVICE_MANAGEMENT_ERROR]: hasDeviceManagementErrorValue,
6264
};
6365

6466
const infoChecks: Partial<Record<IndicatorStatus, boolean>> = {

src/languages/de.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,12 @@ const translations: TranslationDeepObject<typeof en> = {
22042204
chatToConciergeToUnlock: 'Chatte mit Concierge, um Sicherheitsbedenken zu klären und dein Konto zu entsperren.',
22052205
chatWithConcierge: 'Mit Concierge chatten',
22062206
},
2207+
deviceManagementPage: {
2208+
title: 'Geräteverwaltung',
2209+
description: 'Verwalten Sie alle Geräte, auf denen Sie sich mit Ihrem Expensify-Konto angemeldet haben.',
2210+
revoke: 'Widerrufen',
2211+
unknownDevice: 'Unbekanntes Gerät',
2212+
},
22072213
twoFactorAuth: {
22082214
headerTitle: 'Zwei-Faktor-Authentifizierung',
22092215
twoFactorAuthEnabled: 'Zwei-Faktor-Authentifizierung aktiviert',

src/languages/en.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,6 +2274,12 @@ const translations = {
22742274
chatToConciergeToUnlock: 'Chat with Concierge to resolve security concerns and unlock your account.',
22752275
chatWithConcierge: 'Chat with Concierge',
22762276
},
2277+
deviceManagementPage: {
2278+
title: 'Device management',
2279+
description: 'Manage all the devices that you have logged into with your Expensify Account.',
2280+
revoke: 'Revoke',
2281+
unknownDevice: 'Unknown Device',
2282+
},
22772283
twoFactorAuth: {
22782284
headerTitle: 'Two-factor authentication',
22792285
twoFactorAuthEnabled: 'Two-factor authentication enabled',

src/languages/es.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,12 @@ const translations: TranslationDeepObject<typeof en> = {
21082108
chatToConciergeToUnlock: 'Chatea con Concierge para resolver los problemas de seguridad y desbloquear tu cuenta.',
21092109
chatWithConcierge: 'Chatear con Concierge',
21102110
},
2111+
deviceManagementPage: {
2112+
title: 'Gestión de dispositivos',
2113+
description: 'Gestiona todos los dispositivos en los que has iniciado sesión con tu cuenta de Expensify.',
2114+
revoke: 'Revocar',
2115+
unknownDevice: 'Dispositivo Desconocido',
2116+
},
21112117
twoFactorAuth: {
21122118
headerTitle: 'Autenticación de dos factores',
21132119
twoFactorAuthEnabled: 'Autenticación de dos factores habilitada',

src/languages/fr.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,6 +2209,12 @@ const translations: TranslationDeepObject<typeof en> = {
22092209
chatToConciergeToUnlock: 'Discutez avec Concierge pour résoudre vos problèmes de sécurité et déverrouiller votre compte.',
22102210
chatWithConcierge: 'Discuter avec Concierge',
22112211
},
2212+
deviceManagementPage: {
2213+
title: 'Gestion des appareils',
2214+
description: 'Gérez tous les appareils sur lesquels vous vous êtes connecté avec votre compte Expensify.',
2215+
revoke: 'Révoquer',
2216+
unknownDevice: 'Appareil Inconnu',
2217+
},
22122218
twoFactorAuth: {
22132219
headerTitle: 'Authentification à deux facteurs',
22142220
twoFactorAuthEnabled: 'Authentification à deux facteurs activée',

src/languages/it.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,12 @@ const translations: TranslationDeepObject<typeof en> = {
22022202
chatToConciergeToUnlock: 'Chatta con Concierge per risolvere i problemi di sicurezza e sbloccare il tuo account.',
22032203
chatWithConcierge: 'Chatta con Concierge',
22042204
},
2205+
deviceManagementPage: {
2206+
title: 'Gestione dei dispositivi',
2207+
description: `Gestisci tutti i dispositivi su cui hai effettuato l'accesso con il tuo account Expensify.`,
2208+
revoke: 'Revoca',
2209+
unknownDevice: 'Dispositivo Sconosciuto',
2210+
},
22052211
twoFactorAuth: {
22062212
headerTitle: 'Autenticazione a due fattori',
22072213
twoFactorAuthEnabled: 'Autenticazione a due fattori abilitata',

0 commit comments

Comments
 (0)