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

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.19",
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
 
@@ -194,9 +202,10 @@ async function handleRoute(route, query, files) {
194
202
  await gotoEntryView();
195
203
  } else {
196
204
  if (route === "/") return await gotoEntryView();
197
- addRoute({ route, query });
205
+ const safeRoute = route ? route : currentLocation();
206
+ addRoute({ route: safeRoute, query });
198
207
  const page = await router.resolve({
199
- pathname: route,
208
+ pathname: safeRoute,
200
209
  query: query,
201
210
  files: files,
202
211
  alerts: mobileConfig.isOfflineMode
@@ -35,8 +35,8 @@ async function execNavbarLink(url) {
35
35
  * @param {*} urlSuffix
36
36
  * @returns
37
37
  */
38
- async function formSubmit(e, urlSuffix, viewname) {
39
- e.submit();
38
+ async function formSubmit(e, urlSuffix, viewname, noSubmitCb) {
39
+ if (!noSubmitCb) e.submit();
40
40
  const files = {};
41
41
  const urlParams = new URLSearchParams();
42
42
  for (const entry of new FormData(e).entries()) {
@@ -0,0 +1,3 @@
1
+ <html>
2
+ <body></body>
3
+ </html>