@@ -19,7 +19,7 @@ type HybridAppModuleWithClose = {
1919} ;
2020
2121type HybridAppActionsModule = {
22- closeReactNativeApp : ( params : { shouldSetNVP : boolean ; isTrackingGPS : boolean } ) => void ;
22+ closeReactNativeApp : ( params : { shouldSetNVP : boolean ; isTrackingGPS : boolean ; shouldIgnoreTryNewDotLoading ?: boolean } ) => void ;
2323} ;
2424
2525describe ( 'HybridApp actions' , ( ) => {
@@ -62,6 +62,26 @@ describe('HybridApp actions', () => {
6262 expect ( closeNativeAppSpy ) . not . toHaveBeenCalled ( ) ;
6363 } ) ;
6464
65+ it ( 'opens the GPS OldApp handoff modal while tryNewDot is loading' , async ( ) => {
66+ await Onyx . set ( ONYXKEYS . IS_LOADING_APP , true ) ;
67+ await waitForBatchedUpdatesWithAct ( ) ;
68+
69+ closeReactNativeApp ( { shouldSetNVP : true , isTrackingGPS : true } ) ;
70+
71+ expect ( setIsGPSInProgressModalOpen ) . toHaveBeenCalledWith ( true ) ;
72+ expect ( closeNativeAppSpy ) . not . toHaveBeenCalled ( ) ;
73+ } ) ;
74+
75+ it ( 'opens the GPS OldApp handoff modal once switching to OldApp is allowed' , async ( ) => {
76+ await Onyx . set ( ONYXKEYS . IS_LOADING_APP , false ) ;
77+ await waitForBatchedUpdatesWithAct ( ) ;
78+
79+ closeReactNativeApp ( { shouldSetNVP : true , isTrackingGPS : true } ) ;
80+
81+ expect ( setIsGPSInProgressModalOpen ) . toHaveBeenCalledWith ( true ) ;
82+ expect ( closeNativeAppSpy ) . not . toHaveBeenCalled ( ) ;
83+ } ) ;
84+
6585 it ( 'allows shouldSetNVP exits once tryNewDot resolves without a mobile lock' , async ( ) => {
6686 await Onyx . set ( ONYXKEYS . IS_LOADING_APP , false ) ;
6787 await waitForBatchedUpdatesWithAct ( ) ;
@@ -72,6 +92,28 @@ describe('HybridApp actions', () => {
7292 expect ( closeNativeAppSpy ) . toHaveBeenCalledWith ( { shouldSetNVP : true } ) ;
7393 } ) ;
7494
95+ it ( 'allows the GPS modal confirmation to switch after tryNewDot loading blocked the original action' , async ( ) => {
96+ await Onyx . set ( ONYXKEYS . IS_LOADING_APP , true ) ;
97+ await waitForBatchedUpdatesWithAct ( ) ;
98+
99+ closeReactNativeApp ( { shouldSetNVP : true , isTrackingGPS : false , shouldIgnoreTryNewDotLoading : true } ) ;
100+
101+ expect ( Navigation . clearPreloadedRoutes ) . toHaveBeenCalled ( ) ;
102+ expect ( closeNativeAppSpy ) . toHaveBeenCalledWith ( { shouldSetNVP : true } ) ;
103+ } ) ;
104+
105+ it ( 'keeps the GPS modal confirmation blocked when the user is locked to NewApp' , async ( ) => {
106+ await Onyx . set ( ONYXKEYS . NVP_TRY_NEW_DOT , {
107+ isLockedToNewApp : true ,
108+ } ) ;
109+ await waitForBatchedUpdatesWithAct ( ) ;
110+
111+ closeReactNativeApp ( { shouldSetNVP : true , isTrackingGPS : false , shouldIgnoreTryNewDotLoading : true } ) ;
112+
113+ expect ( Navigation . clearPreloadedRoutes ) . not . toHaveBeenCalled ( ) ;
114+ expect ( closeNativeAppSpy ) . not . toHaveBeenCalled ( ) ;
115+ } ) ;
116+
75117 it ( 'blocks shouldSetNVP false exits when the user is locked to NewApp' , async ( ) => {
76118 await Onyx . set ( ONYXKEYS . NVP_TRY_NEW_DOT , {
77119 isLockedToNewApp : true ,
0 commit comments