Skip to content

Commit 09f2ef8

Browse files
authored
[create-pull-request] automated change
1 parent 148d4d2 commit 09f2ef8

11 files changed

+197
-72
lines changed

src/01/00/03/z2ui6_cl_util.clas.abap

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ CLASS z2ui6_cl_util IMPLEMENTATION.
11541154

11551155
lv_search = shift_left( val = lv_search
11561156
sub = `?` ).
1157-
lv_search = c_trim_lower( lv_search ).
1157+
* lv_search = c_trim_lower( lv_search ).
11581158

11591159
DATA(lv_search2) = substring_after( val = lv_search
11601160
sub = `&sap-startup-params=` ).
@@ -1170,8 +1170,10 @@ CLASS z2ui6_cl_util IMPLEMENTATION.
11701170

11711171
LOOP AT lt_param REFERENCE INTO DATA(lr_param).
11721172
SPLIT lr_param->* AT `=` INTO DATA(lv_name) DATA(lv_value).
1173-
INSERT VALUE #( n = c_trim_lower( lv_name )
1174-
v = c_trim_lower( lv_value ) ) INTO TABLE rt_params.
1173+
* INSERT VALUE #( n = c_trim_lower( lv_name )
1174+
* v = c_trim_lower( lv_value ) ) INTO TABLE rt_params.
1175+
INSERT VALUE #( n = lv_name
1176+
v = lv_value ) INTO TABLE rt_params.
11751177
ENDLOOP.
11761178

11771179
ENDMETHOD.

src/01/02/z2ui6_cl_core_action.clas.abap

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,36 @@ CLASS z2ui6_cl_core_action IMPLEMENTATION.
8080

8181
TRY.
8282
result = NEW #( mo_http_post ).
83+
84+
IF mo_http_post->ms_request-s_control-app_start_draft IS NOT INITIAL.
85+
TRY.
86+
87+
DATA(lo_app) = z2ui6_cl_core_app=>db_load( mo_http_post->ms_request-s_control-app_start_draft ).
88+
result->mo_app = lo_app.
89+
result->ms_actual-check_on_navigated = abap_true.
90+
result->ms_next-s_set-set_app_state_active = abap_true.
91+
result->mo_app->ms_draft-id_prev_app_stack = ''.
92+
" check for new app?
93+
* TRY.
94+
* DATA(lo_draft) = NEW z2ui5_cl_core_srv_draft( ).
95+
* DATA(ls_draft) = lo_draft->read_info( ms_next-o_app_leave->id_draft ).
96+
* result->mo_app->ms_draft-id = z2ui5_cl_util=>uuid_get_c32( ).
97+
* CATCH cx_root.
98+
* result->mo_app->ms_draft-id_prev_app_stack = mo_app->ms_draft-id_prev_app_stack.
99+
* RETURN.
100+
* ENDTRY.
101+
102+
* " check for already existing app?
103+
* IF mo_app->ms_draft-id_prev_app_stack IS NOT INITIAL.
104+
* ls_draft = lo_draft->read_info( mo_app->ms_draft-id_prev_app_stack ).
105+
* result->mo_app->ms_draft-id_prev_app_stack = ls_draft-id_prev_app_stack.
106+
* ENDIF.
107+
108+
RETURN.
109+
CATCH cx_root.
110+
ENDTRY.
111+
ENDIF.
112+
83113
result->mo_app->ms_draft-id = z2ui6_cl_util=>uuid_get_c32( ).
84114

85115
CREATE OBJECT result->mo_app->mo_app TYPE (mo_http_post->ms_request-s_control-app_start).

src/01/02/z2ui6_cl_core_client.clas.abap

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,34 @@ CLASS z2ui6_cl_core_client IMPLEMENTATION.
367367

368368
ENDMETHOD.
369369

370+
METHOD z2ui6_if_client~set_nav_back.
371+
372+
mo_action->ms_next-s_set-set_nav_back = val.
373+
374+
ENDMETHOD.
375+
376+
METHOD z2ui6_if_client~set_push_state.
377+
378+
mo_action->ms_next-s_set-set_push_state = val.
379+
380+
ENDMETHOD.
381+
382+
383+
METHOD z2ui6_if_client~set_app_state_active.
384+
385+
mo_action->ms_next-s_set-set_app_state_active = val.
386+
387+
ENDMETHOD.
388+
370389
METHOD z2ui6_if_client~set_session_stateful.
371390

372391
DATA(lv_check_sticky) = CAST z2ui6_if_app( mo_action->mo_app->mo_app )->check_sticky.
373-
IF lv_check_sticky = abap_true AND stateful = abap_true.
392+
IF lv_check_sticky = abap_true AND val = abap_true.
374393
RAISE EXCEPTION TYPE z2ui6_cx_util_error
375394
EXPORTING
376395
val = `STATEFUL_ALREADY_ACTIVATED_ERROR`.
377396
ENDIF.
378-
IF stateful = abap_true.
397+
IF val = abap_true.
379398
mo_action->ms_next-s_set-s_stateful-active = 1.
380399
CAST z2ui6_if_app( mo_action->mo_app->mo_app )->check_sticky = abap_true.
381400
ELSE.

src/01/02/z2ui6_cl_core_srv_json.clas.abap

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.
163163
CATCH cx_root.
164164
ENDTRY.
165165

166+
result-s_control-app_start_draft = z2ui6_cl_util=>c_trim_upper(
167+
z2ui6_cl_util=>url_param_get( val = `z2ui5-xapp-state`
168+
url = result-s_front-search ) ).
169+
166170
IF result-s_control-app_start IS NOT INITIAL.
167171
IF result-s_control-app_start(1) = `-`.
168172
REPLACE FIRST OCCURRENCE OF `-` IN result-s_control-app_start WITH `/`.
@@ -175,9 +179,11 @@ CLASS z2ui6_cl_core_srv_json IMPLEMENTATION.
175179
z2ui6_cl_util=>url_param_get( val = `app_start`
176180
url = result-s_front-search ) ).
177181

182+
178183
CATCH cx_root INTO DATA(x).
179184
RAISE EXCEPTION TYPE z2ui6_cx_util_error
180-
EXPORTING val = x.
185+
EXPORTING
186+
val = x.
181187
ENDTRY.
182188
ENDMETHOD.
183189

src/01/02/z2ui6_if_core_types.intf.abap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ INTERFACE z2ui6_if_core_types
136136
custom_js TYPE string_table,
137137
END OF s_follow_up_action,
138138
* handler_attrs TYPE ty_s_http_handler_attributes,
139-
s_stateful TYPE ty_s_http_res-s_stateful,
139+
set_app_state_active TYPE abap_bool,
140+
set_push_state TYPE abap_bool,
141+
set_nav_back TYPE abap_bool,
142+
s_stateful TYPE ty_s_http_res-s_stateful,
140143
END OF ty_s_next_frontend.
141144

142145
TYPES:
@@ -175,6 +178,7 @@ INTERFACE z2ui6_if_core_types
175178
BEGIN OF s_control,
176179
check_launchpad TYPE abap_bool,
177180
app_start TYPE string,
181+
app_start_draft TYPE string,
178182
END OF s_control,
179183
END OF ty_s_request.
180184

src/01/03/z2ui6_cl_app_component_js.clas.abap

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ CLASS z2ui6_cl_app_component_js IMPLEMENTATION.
1818

1919
METHOD get.
2020

21-
result = `sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models","z2ui5/cc/Server", "sap/ui/VersionInfo", "z2ui5/cc/DebugTool"` && |\n| &&
22-
` ], function (UIComponent, Models, Server, VersionInfo, DebugTool) {` && |\n| &&
21+
result = `sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models", "z2ui5/cc/Server", "sap/ui/VersionInfo", "z2ui5/cc/DebugTool"` && |\n| &&
22+
`], function (UIComponent, Models, Server, VersionInfo, DebugTool) {` && |\n| &&
2323
` return UIComponent.extend("z2ui5.Component", {` && |\n| &&
2424
` metadata: {` && |\n| &&
2525
` manifest: "json"` && |\n| &&
2626
` },` && |\n| &&
2727
` async init() {` && |\n| &&
2828
` UIComponent.prototype.init.apply(this, arguments);` && |\n| &&
2929
`` && |\n| &&
30-
` if (typeof z2ui5 == 'undefined'){` && |\n| &&
31-
` z2ui5 = {};` && |\n| &&
30+
` if (typeof z2ui5 == 'undefined') {` && |\n| &&
31+
` z2ui5 = {};` && |\n| &&
3232
` }` && |\n| &&
3333
` this.getRouter().initialize();` && |\n| &&
3434
` z2ui5.oRouter = this.getRouter();` && |\n| &&
@@ -40,13 +40,13 @@ CLASS z2ui6_cl_app_component_js IMPLEMENTATION.
4040
`` && |\n| &&
4141
` try {` && |\n| &&
4242
` z2ui5.oLaunchpadService = await this.getService("ShellUIService");` && |\n| &&
43-
` } catch (e) {}` && |\n| &&
43+
` } catch (e) { }` && |\n| &&
4444
`` && |\n| &&
4545
` let oVersionInfo = await VersionInfo.load();` && |\n| &&
4646
` z2ui5.oConfig.UI5VersionInfo = {` && |\n| &&
47-
` version : oVersionInfo.version,` && |\n| &&
48-
` buildTimestamp : oVersionInfo.buildTimestamp,` && |\n| &&
49-
` gav : oVersionInfo.gav,` && |\n| &&
47+
` version: oVersionInfo.version,` && |\n| &&
48+
` buildTimestamp: oVersionInfo.buildTimestamp,` && |\n| &&
49+
` gav: oVersionInfo.gav,` && |\n| &&
5050
` }` && |\n| &&
5151
`` && |\n| &&
5252
` if (/iPad|iPhone/.test(navigator.platform)) {` && |\n| &&
@@ -57,13 +57,25 @@ CLASS z2ui6_cl_app_component_js IMPLEMENTATION.
5757
`` && |\n| &&
5858
` document.addEventListener("keydown", function (zEvent) {` && |\n| &&
5959
` if (zEvent?.ctrlKey && zEvent?.key === "F12") {` && |\n| &&
60-
` if (!z2ui5.debugTool){` && |\n| &&
61-
` z2ui5.debugTool = new DebugTool();` && |\n| &&
62-
` z2ui5.debugTool.show();` && |\n| &&
63-
` } else {` && |\n| &&
64-
` z2ui5.debugTool.close();` && |\n| &&
65-
` z2ui5.debugTool = null;` && |\n| &&
66-
` }` && |\n| &&
60+
` if (!z2ui5.debugTool) {` && |\n| &&
61+
` z2ui5.debugTool = new DebugTool();` && |\n| &&
62+
` }` && |\n| &&
63+
` z2ui5.debugTool.toggle();` && |\n| &&
64+
` }` && |\n| &&
65+
` });` && |\n| &&
66+
`` && |\n| &&
67+
` // Handle forward/back buttons` && |\n| &&
68+
` window.addEventListener("popstate", (event) => {` && |\n| &&
69+
` delete event?.state?.response?.PARAMS?.SET_PUSH_STATE;` && |\n| &&
70+
` delete event?.state?.response?.PARAMS?.SET_APP_STATE_ACTIVE;` && |\n| &&
71+
` if (event?.state?.view) {` && |\n| &&
72+
` z2ui5.oController.ViewDestroy();` && |\n| &&
73+
` z2ui5.oResponse = event.state.response;` && |\n| &&
74+
` z2ui5.oController.displayView(event.state.view, event.state.model);` && |\n| &&
75+
` }else{` && |\n| &&
76+
` let urlObj = new URL(window.location.href);` && |\n| &&
77+
` urlObj.searchParams.delete("z2ui5-xapp-state");` && |\n| &&
78+
` history.replaceState(null, null, urlObj.pathname + urlObj.search + urlObj.hash);` && |\n| &&
6779
` }` && |\n| &&
6880
` });` && |\n| &&
6981
` },` && |\n| &&

src/01/03/z2ui6_cl_app_debugtool_js.clas.abap

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ CLASS z2ui6_cl_app_debugtool_js IMPLEMENTATION.
7676
` displayEditor(oEvent, JSON.stringify(z2ui5.oViewPopup.getModel().getData(), null, 3), 'json');` && |\n| &&
7777
` break;` && |\n| &&
7878
` case 'POPOVER':` && |\n| &&
79-
` displayEditor(oEvent, oResponse?.PARAMS?.S_POPOVER?.XML, 'xml');` && |\n| &&
79+
` displayEditor(oEvent, this.prettifyXml(oResponse?.PARAMS?.S_POPOVER?.XML), 'xml');` && |\n| &&
8080
` break;` && |\n| &&
8181
` case 'POPOVER_MODEL':` && |\n| &&
8282
` displayEditor(oEvent, JSON.stringify(z2ui5?.oViewPopover?.getModel()?.getData(), null, 3), 'json');` && |\n| &&
@@ -126,7 +126,7 @@ CLASS z2ui6_cl_app_debugtool_js IMPLEMENTATION.
126126
` },` && |\n| &&
127127
`` && |\n| &&
128128
` onClose: function () {` && |\n| &&
129-
` this.oDialog.close();` && |\n| &&
129+
` this.close();` && |\n| &&
130130
` },` && |\n| &&
131131
`` && |\n| &&
132132
` async show() {` && |\n| &&
@@ -163,8 +163,18 @@ CLASS z2ui6_cl_app_debugtool_js IMPLEMENTATION.
163163
` if (this.oDialog){` && |\n| &&
164164
` this.oDialog.close();` && |\n| &&
165165
` this.oDialog.destroy();` && |\n| &&
166+
` this.oDialog = null;` && |\n| &&
166167
` }` && |\n| &&
167168
` },` && |\n| &&
169+
`` && |\n| &&
170+
` async toggle(){` && |\n| &&
171+
` if (this.oDialog){` && |\n| &&
172+
` this.close()` && |\n| &&
173+
` } else {` && |\n| &&
174+
` this.show()` && |\n| &&
175+
` }` && |\n| &&
176+
` },` && |\n| &&
177+
`` && |\n| &&
168178
` renderer(){` && |\n| &&
169179
` }` && |\n| &&
170180
` });` && |\n| &&

src/01/03/z2ui6_cl_app_server_js.clas.abap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ CLASS z2ui6_cl_app_server_js IMPLEMENTATION.
5151
` }` && |\n| &&
5252
` };` && |\n| &&
5353
`` && |\n| &&
54+
` try{` && |\n| &&
55+
` let oState = JSON.parse(JSON.stringify({ view: z2ui5.oView.mProperties.viewContent, model: z2ui5.oView.getModel().getData(), response: z2ui5.oResponse }));` && |\n| &&
56+
` history.replaceState(oState, "", window.location.href );` && |\n| &&
57+
` }catch(e){}` && |\n| &&
58+
`` && |\n| &&
5459
` z2ui5.oBody ??= {};` && |\n| &&
5560
` z2ui5.oBody.S_FRONT = {` && |\n| &&
5661
` ID: z2ui5?.oBody?.ID,` && |\n| &&

0 commit comments

Comments
 (0)