Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0fe2021
remove HybridApp code from SessionExpiredPage & cleanup closeReactNat…
war-in Aug 1, 2025
f703298
revert unrelated changes
war-in Aug 4, 2025
bc97f82
fix prettier
war-in Aug 4, 2025
088dd8c
Revert "[CP Staging] Revert "Bring back new SignInPage""
war-in Aug 6, 2025
7e65b7e
create custom isAnonymousUser function
war-in Aug 5, 2025
9977819
trigger OldDot sign in as soon as possible
war-in Aug 5, 2025
7e6fcf2
fix public room flow
war-in Aug 6, 2025
3ac1368
fix `Sign out` button flashes
war-in Aug 6, 2025
5f5e645
Merge branch 'war-in/simplify-close-react-native-app-method' into mig…
war-in Aug 6, 2025
72b8eb6
Merge branch 'main' into migrate-hybrid-app-to-new-dot-sign-in-page
mateuuszzzzz Aug 8, 2025
cd51f3d
Enable partner name migration to prevent sign-out (#242)
mateuuszzzzz Aug 11, 2025
a23c18e
Merge branch 'main' into migrate-hybrid-app-to-new-dot-sign-in-page
mateuuszzzzz Aug 12, 2025
29d8784
Add canBeMissing
mateuuszzzzz Aug 12, 2025
21af8b5
Fix spellcheck
mateuuszzzzz Aug 12, 2025
12da3a0
Merge branch 'main' into migrate-hybrid-app-to-new-dot-sign-in-page
mateuuszzzzz Aug 13, 2025
5222266
Apply prettier
mateuuszzzzz Aug 13, 2025
5de36cf
Fix issue with insets
mateuuszzzzz Aug 14, 2025
c0cf815
Fix infinite sign-out
mateuuszzzzz Aug 18, 2025
5cdfe9a
Remove debug methods
mateuuszzzzz Aug 18, 2025
7007f68
Address review comments
mateuuszzzzz Aug 18, 2025
0d07a54
Format code
mateuuszzzzz Aug 18, 2025
49be00c
Handle migration scenario
mateuuszzzzz Aug 19, 2025
c307958
Fix BootSplash flicker on sign-out
mateuuszzzzz Aug 19, 2025
95070e8
Merge branch 'main' into migrate-hybrid-app-to-new-dot-sign-in-page
mateuuszzzzz Aug 20, 2025
9fdda10
Merge branch 'main' into migrate-hybrid-app-to-new-dot-sign-in-page
war-in Aug 21, 2025
6643843
clean outdated comments & rename some functions
war-in Aug 21, 2025
028ace1
rename & describe `signInToOldDotAndChooseExperience`
war-in Aug 21, 2025
df29f9b
Merge branch 'main' into migrate-hybrid-app-to-new-dot-sign-in-page
war-in Aug 25, 2025
1bf2548
post-merge fixes
war-in Aug 25, 2025
9fb76b0
remove persisted ACCOUNT on sign-out
war-in Aug 25, 2025
54d9c96
Revert "remove persisted ACCOUNT on sign-out"
war-in Aug 25, 2025
fbee71b
add logs for better hybridApp sign-in debugability
war-in Aug 25, 2025
0166738
Merge branch 'main' into migrate-hybrid-app-to-new-dot-sign-in-page
war-in Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion __mocks__/@ua/react-native-airship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ enum EventType {
PushReceived = 'com.airship.push_received',
}

// eslint-disable-next-line no-restricted-syntax
enum PermissionStatus {
Granted = 'granted',
Denied = 'denied',
NotDetermined = 'not_determined',
}

// eslint-disable-next-line @typescript-eslint/no-namespace
namespace iOS {
/**
Expand Down Expand Up @@ -71,4 +78,4 @@ const Airship: Partial<AirshipRoot> = {

export default Airship;

export {EventType, iOS};
export {EventType, iOS, PermissionStatus};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ReactNativeHybridApp(reactContext: ReactApplicationContext) :
Log.d(NAME, "`shouldUseStaging` should never be called in standalone `New Expensify` app")
}

override fun closeReactNativeApp(shouldSignOut: Boolean, shouldSetNVP: Boolean) {
override fun closeReactNativeApp(shouldSetNVP: Boolean) {
Log.d(NAME, "`closeReactNativeApp` should never be called in standalone `New Expensify` app")
}

Expand Down Expand Up @@ -51,4 +51,22 @@ class ReactNativeHybridApp(reactContext: ReactApplicationContext) :
override fun onURLListenerAdded() {
Log.d(NAME, "`onURLListenerAdded` should never be called in standalone `New Expensify` app")
}

override fun signInToOldDot(
autoGeneratedLogin: String,
autoGeneratedPassword: String,
authToken: String,
email: String,
policyID: String
) {
Log.d(NAME, "`signInToOldDot` should never be called in standalone `New Expensify` app")
}

override fun signOutFromOldDot() {
Log.d(NAME, "`signOutFromOldDot` should never be called in standalone `New Expensify` app")
}

override fun clearOldDotAfterSignOut() {
Log.d(NAME, "`clearOldDotAfterSignOut` should never be called in standalone `New Expensify` app")
}
}
14 changes: 13 additions & 1 deletion modules/hybrid-app/ios/ReactNativeHybridApp.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ - (void)shouldUseStaging:(BOOL)isStaging {
NSLog(@"[ReactNativeHybridApp] `shouldUseStaging` should never be called in standalone `New Expensify` app");
}

- (void)closeReactNativeApp:(BOOL)shouldSignOut shouldSetNVP:(BOOL)shouldSetNVP {
- (void)closeReactNativeApp:(BOOL)shouldSetNVP {
NSLog(@"[ReactNativeHybridApp] `closeReactNativeApp` should never be called in standalone `New Expensify` app");
}

Expand Down Expand Up @@ -43,6 +43,18 @@ - (void)onURLListenerAdded {
NSLog(@"[ReactNativeHybridApp] `onURLListenerAdded` should never be called in standalone `New Expensify` app");
}

- (void)signInToOldDot:(NSString *)autoGeneratedLogin autoGeneratedPassword:(NSString *)autoGeneratedPassword authToken:(NSString *)authToken email:(NSString *)email policyID:(NSString *)policyID {
NSLog(@"[ReactNativeHybridApp] `signInToOldDot` should never be called in standalone `New Expensify` app");
}

- (void)signOutFromOldDot {
NSLog(@"[ReactNativeHybridApp] `signOutFromOldDot` should never be called in standalone `New Expensify` app");
}

- (void)clearOldDotAfterSignOut {
NSLog(@"[ReactNativeHybridApp] `clearOldDotAfterSignOut` should never be called in standalone `New Expensify` app");
}

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
Expand Down
5 changes: 4 additions & 1 deletion modules/hybrid-app/src/NativeReactNativeHybridApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import {TurboModuleRegistry} from 'react-native';
export interface Spec extends TurboModule {
isHybridApp: () => boolean;
shouldUseStaging: (isStaging: boolean) => void;
closeReactNativeApp: (shouldSignOut: boolean, shouldSetNVP: boolean) => void;
closeReactNativeApp: (shouldSetNVP: boolean) => void;
completeOnboarding: (status: boolean) => void;
switchAccount: (newDotCurrentAccountEmail: string, authToken: string, policyID: string, accountID: string) => void;
sendAuthToken: (authToken: string) => void;
getHybridAppSettings: () => Promise<string | null>;
getInitialURL(): Promise<string | null>;
onURLListenerAdded: () => void;
signInToOldDot: (autoGeneratedLogin: string, autoGeneratedPassword: string, authToken: string, email: string, policyID: string) => void;
signOutFromOldDot: () => void;
clearOldDotAfterSignOut: () => void;
}

export default TurboModuleRegistry.getEnforcing<Spec>('ReactNativeHybridApp');
13 changes: 11 additions & 2 deletions modules/hybrid-app/src/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const HybridAppModule: HybridAppModuleType = {
shouldUseStaging(isStaging) {
ReactNativeHybridApp.shouldUseStaging(isStaging);
},
closeReactNativeApp({shouldSignOut, shouldSetNVP}) {
ReactNativeHybridApp.closeReactNativeApp(shouldSignOut, shouldSetNVP);
closeReactNativeApp({shouldSetNVP}) {
ReactNativeHybridApp.closeReactNativeApp(shouldSetNVP);
},
completeOnboarding({status}) {
ReactNativeHybridApp.completeOnboarding(status);
Expand All @@ -29,6 +29,15 @@ const HybridAppModule: HybridAppModuleType = {
onURLListenerAdded() {
ReactNativeHybridApp.onURLListenerAdded();
},
signInToOldDot({autoGeneratedLogin, autoGeneratedPassword, authToken, email, policyID}) {
ReactNativeHybridApp.signInToOldDot(autoGeneratedLogin, autoGeneratedPassword, authToken, email, policyID);
},
signOutFromOldDot() {
ReactNativeHybridApp.signOutFromOldDot();
},
clearOldDotAfterSignOut() {
ReactNativeHybridApp.clearOldDotAfterSignOut();
},
};

export default HybridAppModule;
12 changes: 12 additions & 0 deletions modules/hybrid-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ const HybridAppModule: HybridAppModuleType = {
// eslint-disable-next-line no-console
console.warn('HybridAppModule: `onURLListenerAdded` should never be called on web');
},
signInToOldDot() {
// eslint-disable-next-line no-console
console.warn('HybridAppModule: `signInToOldDot` should never be called on web');
},
signOutFromOldDot() {
// eslint-disable-next-line no-console
console.warn('HybridAppModule: `signOutFromOldDot` should never be called on web');
},
clearOldDotAfterSignOut() {
// eslint-disable-next-line no-console
console.warn('HybridAppModule: `clearOldDotAfterSignOut` should never be called on web');
},
};

export default HybridAppModule;
5 changes: 4 additions & 1 deletion modules/hybrid-app/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
type HybridAppModuleType = {
isHybridApp: () => boolean;
shouldUseStaging: (isStaging: boolean) => void;
closeReactNativeApp: (args: {shouldSignOut: boolean; shouldSetNVP: boolean}) => void;
closeReactNativeApp: (args: {shouldSetNVP: boolean}) => void;
completeOnboarding: (args: {status: boolean}) => void;
switchAccount: (args: {newDotCurrentAccountEmail: string; authToken: string; policyID: string; accountID: string}) => void;
sendAuthToken: (args: {authToken: string}) => void;
getHybridAppSettings: () => Promise<string | null>;
getInitialURL(): Promise<string | null>;
onURLListenerAdded: () => void;
signInToOldDot: (args: {autoGeneratedLogin: string; autoGeneratedPassword: string; authToken: string; email: string; policyID: string}) => void;
signOutFromOldDot: () => void;
clearOldDotAfterSignOut: () => void;
};

export default HybridAppModuleType;
106 changes: 59 additions & 47 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {CurrentReportIDContextProvider} from './hooks/useCurrentReportID';
import useDefaultDragAndDrop from './hooks/useDefaultDragAndDrop';
import HybridAppHandler from './HybridAppHandler';
import OnyxUpdateManager from './libs/actions/OnyxUpdateManager';
import './libs/HybridApp';
import {AttachmentModalContextProvider} from './pages/media/AttachmentModalScreen/AttachmentModalContext';
import './setup/backgroundTask';
import './setup/hybridApp';
Expand All @@ -67,54 +68,65 @@ function App() {
<SplashScreenStateContextProvider>
<InitialURLContextProvider>
<HybridAppHandler />
<View
style={fill}
fsClass={CONST.FULLSTORY.CLASS.UNMASK}
>
<GestureHandlerRootView style={fill}>
<ComposeProviders
components={[
OnyxListItemProvider,
ThemeProvider,
ThemeStylesProvider,
ThemeIllustrationsProvider,
SafeAreaProvider,
HTMLEngineProvider,
PortalProvider,
SafeArea,
LocaleContextProvider,
PopoverContextProvider,
CurrentReportIDContextProvider,
ScrollOffsetContextProvider,
AttachmentModalContextProvider,
PickerStateProvider,
EnvironmentProvider,
CustomStatusBarAndBackgroundContextProvider,
ActiveElementRoleProvider,
ActionSheetAwareScrollViewProvider,
PlaybackContextProvider,
FullScreenContextProvider,
VolumeContextProvider,
VideoPopoverMenuContextProvider,
KeyboardProvider,
KeyboardStateProvider,
SearchRouterContextProvider,
ProductTrainingContextProvider,
InputBlurContextProvider,
FullScreenBlockingViewContextProvider,
FullScreenLoaderContextProvider,
]}

<GestureHandlerRootView style={fill}>
{/* Initialize metrics early to ensure the UI renders even when NewDot is hidden.
This is necessary for iOS HybridApp's SignInPage to appear correctly without the bootsplash.
See: https://github.com/Expensify/App/pull/65178#issuecomment-3139026551
*/}
<SafeAreaProvider
initialMetrics={{
insets: {top: 0, right: 0, bottom: 0, left: 0},
frame: {x: 0, y: 0, width: 0, height: 0},
}}
>
<View
style={fill}
fsClass={CONST.FULLSTORY.CLASS.UNMASK}
>
<CustomStatusBarAndBackground />
<ErrorBoundary errorMessage="NewExpensify crash caught by error boundary">
<ColorSchemeWrapper>
<Expensify />
</ColorSchemeWrapper>
</ErrorBoundary>
<NavigationBar />
</ComposeProviders>
</GestureHandlerRootView>
</View>
<ComposeProviders
components={[
OnyxListItemProvider,
ThemeProvider,
ThemeStylesProvider,
ThemeIllustrationsProvider,
HTMLEngineProvider,
PortalProvider,
SafeArea,
LocaleContextProvider,
PopoverContextProvider,
CurrentReportIDContextProvider,
ScrollOffsetContextProvider,
AttachmentModalContextProvider,
PickerStateProvider,
EnvironmentProvider,
CustomStatusBarAndBackgroundContextProvider,
ActiveElementRoleProvider,
ActionSheetAwareScrollViewProvider,
PlaybackContextProvider,
FullScreenContextProvider,
VolumeContextProvider,
VideoPopoverMenuContextProvider,
KeyboardProvider,
KeyboardStateProvider,
SearchRouterContextProvider,
ProductTrainingContextProvider,
InputBlurContextProvider,
FullScreenBlockingViewContextProvider,
FullScreenLoaderContextProvider,
]}
>
<CustomStatusBarAndBackground />
<ErrorBoundary errorMessage="NewExpensify crash caught by error boundary">
<ColorSchemeWrapper>
<Expensify />
</ColorSchemeWrapper>
</ErrorBoundary>
<NavigationBar />
</ComposeProviders>
</View>
</SafeAreaProvider>
</GestureHandlerRootView>
</InitialURLContextProvider>
</SplashScreenStateContextProvider>
</StrictModeWrapper>
Expand Down
33 changes: 33 additions & 0 deletions src/CONFIG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ import * as Url from './libs/Url';
// add a trim() call to prevent headaches
const get = (config: NativeConfig, key: string, defaultValue: string): string => (config?.[key] ?? defaultValue).trim();

const getDefaultLegacyPartnerConfig = () => {
// eslint-disable-next-line no-restricted-properties
if (!HybridAppModule.isHybridApp()) {
return {name: '', password: ''};
}

if (Platform.OS === 'ios') {
return {
name: 'iphone',
password: 'e88ed31140a66c73b36a',
Comment thread
Julesssss marked this conversation as resolved.
Resolved
};
}

// Android partner config
return {
name: 'android',
password: 'c3a9ac418ea3f152aae2',
};
};

// Set default values to contributor friendly values to make development work out of the box without an .env file
const ENVIRONMENT = get(Config, 'ENVIRONMENT', CONST.ENVIRONMENT.DEV);
const newExpensifyURL = Url.addTrailingForwardSlash(get(Config, 'NEW_EXPENSIFY_URL', 'https://new.expensify.com/'));
Expand Down Expand Up @@ -61,6 +81,8 @@ export default {
DEFAULT_SECURE_API_ROOT: secureURLRoot,
STAGING_API_ROOT: stagingExpensifyURL,
STAGING_SECURE_API_ROOT: stagingSecureExpensifyUrl,
LEGACY_PARTNER_NAME: get(Config, 'LEGACY_EXPENSIFY_PARTNER_NAME', getDefaultLegacyPartnerConfig().name),
LEGACY_PARTNER_PASSWORD: get(Config, 'LEGACY_EXPENSIFY_PARTNER_PASSWORD', getDefaultLegacyPartnerConfig().password),
PARTNER_NAME: get(Config, 'EXPENSIFY_PARTNER_NAME', 'chat-expensify-com'),
PARTNER_PASSWORD: get(Config, 'EXPENSIFY_PARTNER_PASSWORD', 'e21965746fd75f82bb66'),
EXPENSIFY_CASH_REFERER: 'ecash',
Expand Down Expand Up @@ -95,7 +117,18 @@ export default {
GOOGLE_SIGN_IN: {
// cspell:disable-next-line
WEB_CLIENT_ID: '921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com',
// cspell:disable-next-line
IOS_CLIENT_ID: '921154746561-s3uqn2oe4m85tufi6mqflbfbuajrm2i3.apps.googleusercontent.com',
HYBRID_APP: {
// cspell:disable-next-line
IOS_CLIENT_ID: '1008697809946-sh04nqq0hea396s1qdqqbj6ia649odb2.apps.googleusercontent.com',
WEB_CLIENT_ID: {
// cspell:disable-next-line
IOS: '1008697809946-5e095eqem3o6ugtpc2rjf7v880tcp28p.apps.googleusercontent.com',
// cspell:disable-next-line
ANDROID: '240677659774-86pov3adub93cv4b8uj13g7varolmk2l.apps.googleusercontent.com',
},
},
},
GCP_GEOLOCATION_API_KEY: googleGeolocationAPIKey,
FIREBASE_WEB_CONFIG: {
Expand Down
17 changes: 14 additions & 3 deletions src/Expensify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,21 @@ function Expensify() {
const isAuthenticated = useIsAuthenticated();
const autoAuthState = useMemo(() => session?.autoAuthState ?? '', [session]);

const shouldInit = isNavigationReady && hasAttemptedToOpenPublicRoom && !!preferredLocale;
const isSplashReadyToBeHidden = splashScreenState === CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN;
const isSplashVisible = splashScreenState === CONST.BOOT_SPLASH_STATE.VISIBLE;
const isHybridAppReady = splashScreenState === CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN && isAuthenticated;
const shouldHideSplash = shouldInit && (CONFIG.IS_HYBRID_APP ? isHybridAppReady : isSplashVisible);

const shouldInit = isNavigationReady && hasAttemptedToOpenPublicRoom && !!preferredLocale;
const shouldHideSplash = shouldInit && (CONFIG.IS_HYBRID_APP ? isSplashReadyToBeHidden : isSplashVisible);

useEffect(() => {
if (!shouldInit || splashScreenState !== CONST.BOOT_SPLASH_STATE.HIDDEN) {
return;
}

// Clears OldDot UI after sign-out, if there's no OldDot UI left it has no effect.
HybridAppModule.clearOldDotAfterSignOut();
}, [shouldInit, splashScreenState]);

const initializeClient = () => {
if (!Visibility.isVisible()) {
return;
Expand Down
Loading