@saltcorn/mobile-app 0.9.0-beta.3 → 0.9.0-beta.4
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
|
@@ -853,16 +853,25 @@ function showLoadSpinner() {
|
|
|
853
853
|
z-index: 9999;"
|
|
854
854
|
>
|
|
855
855
|
<div
|
|
856
|
-
class="spinner-border"
|
|
857
|
-
role="status"
|
|
858
856
|
style="position: absolute;
|
|
859
857
|
left: 50%;
|
|
860
858
|
top: 50%;
|
|
861
|
-
height:60px;
|
|
862
|
-
width:
|
|
863
|
-
margin:0px auto;"
|
|
859
|
+
height: 60px;
|
|
860
|
+
width: 250px;
|
|
861
|
+
margin: 0px auto;"
|
|
864
862
|
>
|
|
865
|
-
<span
|
|
863
|
+
<span
|
|
864
|
+
class="spinner-border d-block"
|
|
865
|
+
role="status"
|
|
866
|
+
>
|
|
867
|
+
<span class="visually-hidden">Loading...</span>
|
|
868
|
+
</span>
|
|
869
|
+
<span
|
|
870
|
+
style="margin-left: -125px"
|
|
871
|
+
id="scspinner-text-id"
|
|
872
|
+
class="d-none fs-5 fw-bold bg-secondary text-white p-1 rounded"
|
|
873
|
+
>
|
|
874
|
+
</span>
|
|
866
875
|
</div>
|
|
867
876
|
</div>`);
|
|
868
877
|
}
|
|
@@ -400,8 +400,21 @@ var offlineHelper = (() => {
|
|
|
400
400
|
return resp.data.syncTimestamp;
|
|
401
401
|
};
|
|
402
402
|
|
|
403
|
+
const setSpinnerText = () => {
|
|
404
|
+
const iframeWindow = $("#content-iframe")[0].contentWindow;
|
|
405
|
+
if (iframeWindow) {
|
|
406
|
+
const spinnerText =
|
|
407
|
+
iframeWindow.document.getElementById("scspinner-text-id");
|
|
408
|
+
if (spinnerText) {
|
|
409
|
+
spinnerText.innerHTML = "Syncing, please don't turn off";
|
|
410
|
+
spinnerText.classList.remove("d-none");
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
403
415
|
return {
|
|
404
416
|
sync: async () => {
|
|
417
|
+
setSpinnerText();
|
|
405
418
|
const state = saltcorn.data.state.getState();
|
|
406
419
|
const mobileConfig = state.mobileConfig;
|
|
407
420
|
const { offlineUser, hasOfflineData, uploadStarted, uploadStartTime } =
|
|
@@ -425,10 +438,17 @@ var offlineHelper = (() => {
|
|
|
425
438
|
await setUploadStarted(true, syncTimestamp);
|
|
426
439
|
let lock = null;
|
|
427
440
|
try {
|
|
428
|
-
if (window.navigator
|
|
441
|
+
if (window.navigator?.wakeLock?.request)
|
|
429
442
|
lock = await window.navigator.wakeLock.request();
|
|
443
|
+
} catch (error) {
|
|
444
|
+
console.log("wakeLock not available");
|
|
445
|
+
console.log(error);
|
|
446
|
+
}
|
|
447
|
+
let transactionOpen = false;
|
|
448
|
+
try {
|
|
430
449
|
await saltcorn.data.db.query("PRAGMA foreign_keys = OFF;");
|
|
431
450
|
await saltcorn.data.db.query("BEGIN");
|
|
451
|
+
transactionOpen = true;
|
|
432
452
|
if (cleanSync) await offlineHelper.clearLocalData(true);
|
|
433
453
|
const { synchedTables, syncInfos } = await prepare();
|
|
434
454
|
await syncRemoteDeletes(syncInfos, syncTimestamp);
|
|
@@ -437,9 +457,10 @@ var offlineHelper = (() => {
|
|
|
437
457
|
await offlineHelper.endOfflineMode(true);
|
|
438
458
|
await setUploadStarted(false);
|
|
439
459
|
await saltcorn.data.db.query("COMMIT");
|
|
460
|
+
transactionOpen = false;
|
|
440
461
|
await saltcorn.data.db.query("PRAGMA foreign_keys = ON;");
|
|
441
462
|
} catch (error) {
|
|
442
|
-
await saltcorn.data.db.query("ROLLBACK");
|
|
463
|
+
if (transactionOpen) await saltcorn.data.db.query("ROLLBACK");
|
|
443
464
|
await saltcorn.data.db.query("PRAGMA foreign_keys = ON;");
|
|
444
465
|
console.log(error);
|
|
445
466
|
throw error;
|