@saltcorn/mobile-app 0.9.0-beta.1 → 0.9.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saltcorn/mobile-app",
3
3
  "displayName": "Saltcorn mobile app",
4
- "version": "0.9.0-beta.1",
4
+ "version": "0.9.0-beta.3",
5
5
  "description": "Apache Cordova application with @saltcorn/markup",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -16,17 +16,22 @@ function combineFormAndQuery(form, query) {
16
16
  }
17
17
 
18
18
  /**
19
- *
20
- * @param {*} url
19
+ * Pass View or Page source into the app internal router,
20
+ * links with an URL source are opened in the system browser.
21
+ * @param {string} url
22
+ * @param {string} linkSrc - URL, View or Page
21
23
  */
22
- async function execLink(url) {
23
- try {
24
- showLoadSpinner();
25
- const { path, query } = parent.splitPathQuery(url);
26
- await parent.handleRoute(`get${path}`, query);
27
- } finally {
28
- removeLoadSpinner();
29
- }
24
+ async function execLink(url, linkSrc) {
25
+ if (linkSrc === "URL") {
26
+ parent.cordova.InAppBrowser.open(url, "_system");
27
+ } else
28
+ try {
29
+ showLoadSpinner();
30
+ const { path, query } = parent.splitPathQuery(url);
31
+ await parent.handleRoute(`get${path}`, query);
32
+ } finally {
33
+ removeLoadSpinner();
34
+ }
30
35
  }
31
36
 
32
37
  async function execNavbarLink(url) {
@@ -248,7 +253,13 @@ async function publicLogin(entryPoint) {
248
253
  alerts: [
249
254
  {
250
255
  type: "success",
251
- msg: parent.i18next.t("Welcome to Saltcorn!"),
256
+ msg: parent.i18next.t("Welcome to %s!", {
257
+ postProcess: "sprintf",
258
+ sprintf: [
259
+ parent.saltcorn.data.state.getState().getConfig("site_name") ||
260
+ "Saltcorn",
261
+ ],
262
+ }),
252
263
  },
253
264
  ],
254
265
  });
@@ -260,6 +271,12 @@ async function publicLogin(entryPoint) {
260
271
  }
261
272
  } catch (error) {
262
273
  console.log(error);
274
+ parent.showAlerts([
275
+ {
276
+ type: "error",
277
+ msg: error.message ? error.message : "An error occured.",
278
+ },
279
+ ]);
263
280
  throw error;
264
281
  } finally {
265
282
  removeLoadSpinner();