@saltcorn/mobile-app 0.8.6-beta.17 → 0.8.6-beta.18

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/config.xml CHANGED
@@ -3,6 +3,7 @@
3
3
  <name>SaltcornMobileApp</name>
4
4
  <description>Apache Cordova application with @saltcorn/markup</description>
5
5
  <platform name="android">
6
+ <icon density="ldpi" foreground="res/icon/android/icon.png" background="res/icon/android/icon.png" />
6
7
  <edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application" mode="merge">
7
8
  <application android:usesCleartextTraffic="true"/>
8
9
  </edit-config>
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.8.6-beta.17",
4
+ "version": "0.8.6-beta.18",
5
5
  "description": "Apache Cordova application with @saltcorn/markup",
6
6
  "main": "index.js",
7
7
  "scripts": {
Binary file
package/www/index.html CHANGED
@@ -179,7 +179,7 @@
179
179
 
180
180
  // the app comes back from background
181
181
  const onResume = async () => {
182
- if (!saltcorn?.data?.state) return;
182
+ if (typeof saltcorn === "undefined") return;
183
183
  const state = saltcorn.data.state.getState();
184
184
  const mobileConfig = state.mobileConfig;
185
185
  if (mobileConfig?.allowOfflineMode) {
@@ -368,6 +368,7 @@
368
368
  overflow: hidden;
369
369
  z-index: 999999;
370
370
  "
371
+ src="splash_page.html"
371
372
  >
372
373
  <p>Your browser does not support iframes.</p>
373
374
  </iframe>
@@ -1,4 +1,4 @@
1
- /*global window, offlineHelper, axios, write, cordova, router, getDirEntry, saltcorn, document, FileReader, navigator*/
1
+ /*global window, offlineHelper, axios, write, cordova, router, getDirEntry, saltcorn, document, FileReader, navigator, splashConfig*/
2
2
 
3
3
  let routingHistory = [];
4
4
 
@@ -25,7 +25,10 @@ function popRoute() {
25
25
  }
26
26
 
27
27
  async function apiCall({ method, path, params, body, responseType, timeout }) {
28
- const config = saltcorn.data.state.getState().mobileConfig;
28
+ const config =
29
+ typeof saltcorn !== "undefined"
30
+ ? saltcorn.data.state.getState().mobileConfig
31
+ : splashConfig;
29
32
  const serverPath = config.server_path;
30
33
  const url = `${serverPath}${path}`;
31
34
  const headers = {
@@ -60,12 +63,17 @@ function clearAlerts() {
60
63
  }
61
64
 
62
65
  function showAlerts(alerts) {
63
- const iframe = document.getElementById("content-iframe");
64
- const alertsArea =
65
- iframe.contentWindow.document.getElementById("alerts-area");
66
- alertsArea.innerHTML = "";
67
- for (const { type, msg } of alerts) {
68
- alertsArea.innerHTML += saltcorn.markup.alert(type, msg);
66
+ if (typeof saltcorn === "undefined") {
67
+ console.log("Not yet initalized.");
68
+ console.log(alerts);
69
+ } else {
70
+ const iframe = document.getElementById("content-iframe");
71
+ const alertsArea =
72
+ iframe.contentWindow.document.getElementById("alerts-area");
73
+ alertsArea.innerHTML = "";
74
+ for (const { type, msg } of alerts) {
75
+ alertsArea.innerHTML += saltcorn.markup.alert(type, msg);
76
+ }
69
77
  }
70
78
  }
71
79
 
@@ -0,0 +1,3 @@
1
+ <html>
2
+ <body></body>
3
+ </html>