Skip to content

Commit 6a1c2e9

Browse files
1 parent 47e86c9 commit 6a1c2e9

File tree

3 files changed

+48
-32
lines changed

3 files changed

+48
-32
lines changed

app/webapp/Component.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models","z2ui5/cc/Server"
1616
z2ui5.oConfig.ComponentData = this.getComponentData();
1717

1818
try {
19-
z2ui5.oLaunchpadService = await this.getService("ShellUIService");
20-
} catch (e) {}
21-
19+
z2ui5.oLaunchpadService = await this.getService("ShellUIService");
20+
} catch (e) {}
21+
2222
let oVersionInfo = await VersionInfo.load();
2323
z2ui5.oConfig.UI5VersionInfo = {
2424
version : oVersionInfo.version,

app/webapp/controller/App.controller.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap
639639
let table = z2ui5.oView.byId(this.getProperty("MultiInputId"));
640640
if (!table) {
641641
try {
642-
table = Core.byId(Element.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', ''));
642+
// table = Core.byId(Element.getElementsByName(this.getProperty("MultiInputName"))[0].id.replace('-inner', ''));
643643
} catch (e) {
644644
return;
645645
}
@@ -667,8 +667,10 @@ sap.ui.define("z2ui5/MultiInputExt", ["sap/ui/core/Control", "sap/m/Token", "sap
667667
);
668668

669669
sap.ui.define("z2ui5/CameraPicture" , [
670-
"sap/ui/core/Control"
671-
], function (Control) {
670+
"sap/ui/core/Control",
671+
"sap/m/Dialog",
672+
"sap/m/Button"
673+
], function (Control, Dialog, Button) {
672674
"use strict";
673675
return Control.extend("z2ui5.CameraPicture", {
674676
metadata: {
@@ -708,30 +710,30 @@ sap.ui.define("z2ui5/CameraPicture" , [
708710
onPicture: function (oEvent) {
709711

710712
if (!this._oScanDialog) {
711-
this._oScanDialog = new sap.m.Dialog({
713+
this._oScanDialog = new Dialog({
712714
title: "Device Photo Function",
713715
contentWidth: "640px",
714716
contentHeight: "480px",
715717
horizontalScrolling: false,
716718
verticalScrolling: false,
717-
stretchOnPhone: true,
719+
stretch: true,
718720
content: [
719-
new sap.ui.core.HTML({
721+
new HTML({
720722
id: this.getId() + 'PictureContainer',
721723
content: '<video width="600px" height="400px" autoplay="true" id="zvideo">'
722724
}),
723-
new sap.m.Button({
725+
new Button({
724726
text: "Capture",
725727
press: function (oEvent) {
726728
this.capture();
727729
this._oScanDialog.close();
728730
}.bind(this)
729731
}),
730-
new sap.ui.core.HTML({
732+
new HTML({
731733
content: '<canvas hidden id="zcanvas" style="overflow:auto"></canvas>'
732734
}),
733735
],
734-
endButton: new sap.m.Button({
736+
endButton: new Button({
735737
text: "Cancel",
736738
press: function (oEvent) {
737739
this._oScanDialog.close();
@@ -759,7 +761,7 @@ sap.ui.define("z2ui5/CameraPicture" , [
759761

760762
renderer: function (oRM, oControl) {
761763

762-
var oButton = new sap.m.Button({
764+
var oButton = new Button({
763765
icon: "sap-icon://camera",
764766
text: "Camera",
765767
press: oControl.onPicture.bind(oControl),
@@ -817,7 +819,7 @@ sap.ui.define("z2ui5/Util", [], () => {
817819
"use strict";
818820
return {
819821
DateCreateObject: (s) => new Date(s),
820-
DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp),
822+
// DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp), commented for UI5 2.x compatibility
821823
DateAbapDateToDateObject: (d) => new Date(d.slice(0, 4), parseInt(d.slice(4, 6)) - 1, d.slice(6, 8)),
822824
DateAbapDateTimeToDateObject: (d, t = '000000') => new Date(d.slice(0, 4), parseInt(d.slice(4, 6)) - 1, d.slice(6, 8), t.slice(0, 2), t.slice(2, 4), t.slice(4, 6)),
823825
};

app/webapp/controller/View1.controller.js

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -248,26 +248,40 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
248248
a.click();
249249
break;
250250
case 'CROSS_APP_NAV_TO_PREV_APP':
251-
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
252-
oCrossAppNavigator.backToPreviousApp();
251+
sap.ui.require([
252+
"sap/ushell/Container"
253+
], async (ushellContainer) => {
254+
// z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
255+
z2ui5.oCrossAppNavigator = ushellContainer.getService("CrossApplicationNavigation");
256+
z2ui5.oCrossAppNavigator.backToPreviousApp();
257+
});
258+
259+
//oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
260+
253261
break;
254262
case 'CROSS_APP_NAV_TO_EXT':
255-
oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
256-
const hash = (oCrossAppNavigator.hrefForExternal({
257-
target: args[1],
258-
params: args[2]
259-
})) || "";
260-
if (args[3] === 'EXT') {
261-
let url = window.location.href.split('#')[0] + hash;
262-
//todo
263-
//URLHelper.redirect(url, true);
264-
} else {
265-
oCrossAppNavigator.toExternal({
266-
target: {
267-
shellHash: hash
268-
}
269-
});
270-
}
263+
z2ui5.args = args;
264+
sap.ui.require([
265+
"sap/ushell/Container"
266+
], async (ushellContainer) => {
267+
// z2ui5.oCrossAppNavigator = await ushellContainer.getServiceAsync("CrossApplicationNavigation");
268+
z2ui5.oCrossAppNavigator = ushellContainer.getService("CrossApplicationNavigation");
269+
const hash = (z2ui5.oCrossAppNavigator.hrefForExternal({
270+
target: z2ui5.args[1],
271+
params: z2ui5.args[2]
272+
})) || "";
273+
if (z2ui5.args[3] === 'EXT') {
274+
let url = window.location.href.split('#')[0] + hash;
275+
//todo
276+
//URLHelper.redirect(url, true);
277+
} else {
278+
z2ui5.oCrossAppNavigator.toExternal({
279+
target: {
280+
shellHash: hash
281+
}
282+
});
283+
}
284+
});
271285
break;
272286
case 'LOCATION_RELOAD':
273287
window.location = args[1];

0 commit comments

Comments
 (0)