@saltcorn/mobile-app 0.9.0-beta.9 → 0.9.0

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.9",
4
+ "version": "0.9.0",
5
5
  "description": "Apache Cordova application with @saltcorn/markup",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -292,22 +292,37 @@ async function reload() {
292
292
  async function goBack(steps = 1, exitOnFirstPage = false) {
293
293
  const { inLoadState } = saltcorn.data.state.getState().mobileConfig;
294
294
  if (inLoadState) return;
295
+ const iframe = document.getElementById("content-iframe");
295
296
  if (
296
297
  routingHistory.length === 0 ||
297
298
  (exitOnFirstPage && routingHistory.length === 1)
298
299
  ) {
299
300
  navigator.app.exitApp();
300
301
  } else if (routingHistory.length <= steps) {
301
- routingHistory = [];
302
- await handleRoute("/");
302
+ try {
303
+ if (iframe?.contentWindow?.showLoadSpinner)
304
+ iframe.contentWindow.showLoadSpinner();
305
+ routingHistory = [];
306
+ await handleRoute("/");
307
+ } finally {
308
+ if (iframe?.contentWindow?.removeLoadSpinner)
309
+ iframe.contentWindow.removeLoadSpinner();
310
+ }
303
311
  } else {
304
- routingHistory = routingHistory.slice(0, routingHistory.length - steps);
305
- // don't repeat a post
306
- if (routingHistory[routingHistory.length - 1].route.startsWith("post/")) {
307
- routingHistory.pop();
312
+ try {
313
+ if (iframe?.contentWindow?.showLoadSpinner)
314
+ iframe.contentWindow.showLoadSpinner();
315
+ routingHistory = routingHistory.slice(0, routingHistory.length - steps);
316
+ // don't repeat a post
317
+ if (routingHistory[routingHistory.length - 1].route.startsWith("post/")) {
318
+ routingHistory.pop();
319
+ }
320
+ const newCurrent = routingHistory.pop();
321
+ await handleRoute(newCurrent.route, newCurrent.query);
322
+ } finally {
323
+ if (iframe?.contentWindow?.removeLoadSpinner)
324
+ iframe.contentWindow.removeLoadSpinner();
308
325
  }
309
- const newCurrent = routingHistory.pop();
310
- await handleRoute(newCurrent.route, newCurrent.query);
311
326
  }
312
327
  }
313
328