11sap . ui . define ( [ "sap/ui/core/mvc/Controller" , "sap/ui/core/mvc/XMLView" , "sap/ui/model/json/JSONModel" ,
22 "sap/ui/core/BusyIndicator" , "sap/m/MessageBox" , "sap/m/MessageToast" , "sap/ui/core/Fragment" , "sap/m/BusyDialog" ,
3- "sap/ui/VersionInfo" , "z2ui5/cc/Server" , "sap/ui/model/odata/v2/ODataModel" , "sap/m/library"
3+ "sap/ui/VersionInfo" , "z2ui5/cc/Server" , "sap/ui/model/odata/v2/ODataModel" , "sap/m/library" , "sap/ui/core/routing/HashChanger"
44] ,
55 function ( Controller , XMLView , JSONModel , BusyIndicator , MessageBox , MessageToast , Fragment , mBusyDialog , VersionInfo ,
6- Server , ODataModel , mobileLibrary ) {
6+ Server , ODataModel , mobileLibrary , HashChanger ) {
77 "use strict" ;
88 return Controller . extend ( "z2ui5.controller.View1" , {
99
@@ -57,23 +57,34 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
5757 }
5858
5959 let oState = JSON . parse ( JSON . stringify ( { view : z2ui5 . oView . mProperties . viewContent , model : z2ui5 . oView . getModel ( ) . getData ( ) , response : z2ui5 . oResponse } ) ) ;
60- if ( SET_PUSH_STATE ) {
61- history . pushState ( oState , "" , window . location . href ) ;
62- } else {
60+ if ( SET_PUSH_STATE ) {
61+ // sap.ui.core.routing.HashChanger.getInstance().setHash("423143124");
62+ // sap.ui.core.routing.HashChanger.getInstance().replaceHash("423143124");
63+ //history.go(-1);
64+ let urlObj = new URL ( window . location . href ) ;
65+ let hash = HashChanger . getInstance ( ) . getHash ( ) ;
66+ if ( ! hash ) {
67+ hash = '#' ;
68+ }
69+ history . pushState ( oState , "" , urlObj . pathname + urlObj . search + hash + SET_PUSH_STATE ) ;
70+ } else {
71+ // debugger;
6372 history . replaceState ( oState , "" , window . location . href ) ;
6473 }
65-
74+
6675 if ( SET_APP_STATE_ACTIVE ) {
67- let urlObj = new URL ( window . location . href ) ;
68- urlObj . searchParams . set ( "z2ui5-xapp-state" , z2ui5 . oResponse . ID ) ;
69- history . replaceState ( oState , null , urlObj . pathname + urlObj . search + urlObj . hash ) ;
76+ HashChanger . getInstance ( ) . replaceHash ( "z2ui5-xapp-state=" + z2ui5 . oResponse . ID ) ;
77+ // let urlObj = new URL(window.location.href);
78+ // urlObj.searchParams.set("z2ui5-xapp-state", z2ui5.oResponse.ID);
79+ // history.replaceState(oState, null, urlObj.pathname + urlObj.search + urlObj.hash);
7080 } else {
71- let urlObj = new URL ( window . location . href ) ;
72- urlObj . searchParams . delete ( "z2ui5-xapp-state" ) ;
73- history . replaceState ( oState , null , urlObj . pathname + urlObj . search + urlObj . hash ) ;
81+ HashChanger . getInstance ( ) . replaceHash ( "" ) ;
82+ // let urlObj = new URL(window.location.href);
83+ // urlObj.searchParams.delete("z2ui5-xapp-state");
84+ // history.replaceState(oState, null, urlObj.pathname + urlObj.search + urlObj.hash);
7485 }
7586
76-
87+
7788
7889 if ( SET_NAV_BACK ) {
7990 history . back ( ) ;
@@ -282,7 +293,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
282293 sap . ui . require ( [
283294 "sap/ushell/Container"
284295 ] , async ( ushellContainer ) => {
285- // z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
296+ // z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
286297 z2ui5 . oCrossAppNavigator = ushellContainer . getService ( "CrossApplicationNavigation" ) ;
287298 z2ui5 . oCrossAppNavigator . backToPreviousApp ( ) ;
288299 } ) ;
@@ -292,7 +303,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
292303 sap . ui . require ( [
293304 "sap/ushell/Container"
294305 ] , async ( ushellContainer ) => {
295- // z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
306+ // z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
296307 z2ui5 . oCrossAppNavigator = ushellContainer . getService ( "CrossApplicationNavigation" ) ;
297308 const hash = ( z2ui5 . oCrossAppNavigator . hrefForExternal ( {
298309 target : z2ui5 . args [ 1 ] ,
@@ -528,4 +539,4 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
528539 z2ui5 . oApp . insertPage ( z2ui5 . oView ) ;
529540 } ,
530541 } )
531- } ) ;
542+ } ) ;
0 commit comments