Skip to content

Commit 0cedfe8

Browse files
updated
1 parent 5150bf8 commit 0cedfe8

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed

tutorials/cp-mobile-dev-kit-deep-link/cp-mobile-dev-kit-deep-link.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,31 @@ The Storyboard provides a graphical view of the application's runtime resources,
161161

162162
```JavaScript
163163
/**
164-
* Describe this function...
165164
* @param {IClientAPI} context
166165
*/
166+
import { Application, Utils } from "@nativescript/core";
167+
168+
function openUrl(location) {
169+
if (Application.ios) {
170+
const url = NSURL.URLWithString(location.trim());
171+
if (UIApplication.sharedApplication.canOpenURL(url)) {
172+
return UIApplication.sharedApplication.openURLOptionsCompletionHandler(url, null, null);
173+
} else {
174+
return false;
175+
}
176+
} else {
177+
return Utils.openUrl(location);
178+
}
179+
}
180+
167181
export default function OpenSAPMobileStart(context) {
168-
// Get the Nativescript Utils Module
169-
const utilsModule = context.nativescript.utilsModule;
170-
// Get the Nativescript Platform Module
171-
const platformModule = context.nativescript.platformModule;
172182
return context.executeAction('/mdkdeeplink/Actions/Confirmation.action').then((result) => {
173183
if (result.data) {
174-
//This will open SAP Mobile Start app
175-
if (platformModule.isIOS) {
176-
return utilsModule.openUrl("com.sap.mobile.start://");
177-
} else if (platformModule.isAndroid) {
178-
return utilsModule.openUrl("com.sap.mobile.apps.sapstart://");
179-
}
184+
// This will open the SAP Mobile Start app
185+
const url = Application.ios
186+
? "com.sap.mobile.start://"
187+
: "com.sap.mobile.apps.sapstart://";
188+
return openUrl(url);
180189
} else {
181190
return Promise.reject('User Deferred');
182191
}
@@ -209,16 +218,27 @@ The Storyboard provides a graphical view of the application's runtime resources,
209218
210219
```JavaScript
211220
/**
212-
* Describe this function...
221+
* Describe this function...
213222
* @param {IClientAPI} context
214223
*/
224+
import { Application, Utils } from "@nativescript/core";
225+
function openUrl(location) {
226+
if (Application.ios) {
227+
const url = NSURL.URLWithString(location.trim());
228+
if (UIApplication.sharedApplication.canOpenURL(url)) {
229+
return UIApplication.sharedApplication.openURLOptionsCompletionHandler(url, null, null);
230+
} else {
231+
return false;
232+
}
233+
} else {
234+
return Utils.openUrl(location);
235+
}
236+
}
215237
export default function OpenSAPcom(context) {
216-
// Get the Nativescript Utils Module
217-
const utilsModule = context.nativescript.utilsModule;
218238
return context.executeAction('/mdkdeeplink/Actions/Confirmation.action').then((result) => {
219239
if (result.data) {
220240
//This will open SAP.com website
221-
return utilsModule.openUrl("https://www.sap.com");
241+
openUrl("https://www.sap.com");
222242
} else {
223243
return Promise.reject('User Deferred');
224244
}
-325 KB
Loading

tutorials/cp-mobile-dev-kit-link-entity/cp-mobile-dev-kit-link-entity.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ In this step, you will create a Section page with a Form Cell Section to contain
4343

4444
<!-- border -->![MDK](img-1.1.png)
4545

46-
4746
2. In the **Base Information** step, enter the Page Name as `SalesOrderHeaders_Create` and click **Finish** to complete the page creation process.
4847

4948
<!-- border -->![MDK](img-1.2.png)
@@ -142,8 +141,6 @@ In this step, you will create a Section page with a Form Cell Section to contain
142141

143142
### Add cancel button on create Sales Order page
144143

145-
146-
147144
Now, you will add a button on the Create Order page and set its `onPress` to `CloseModalPage_Cancel.action`.
148145

149146
1. Drag and drop an **Action Bar Item** to the upper left corner of the action bar.
@@ -277,7 +274,6 @@ The next step is to store newly created record locally for an offline applicatio
277274

278275
### Navigate to the Customer Create page
279276

280-
281277
You will open the `SalesOrderHeaders_Create.page` from the Customer Detail page. For this, you will add a ToolBar item on the Customer Details page and will link it to a navigation action. When the ToolBar item is pressed by the end-user that will open the `SalesOrderHeaders_Create.page`.
282278

283279
1. In `Customers_Detail.page`, drag and drop a **Toolbar Item** on the page area.

0 commit comments

Comments
 (0)