@saltcorn/mobile-app 1.1.0-beta.11 → 1.1.0-beta.13
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/.babelrc +3 -0
- package/build_scripts/modify_android_manifest.js +47 -0
- package/build_scripts/modify_gradle_cfg.js +34 -0
- package/package.json +20 -11
- package/src/.eslintrc +21 -0
- package/src/helpers/api.js +41 -0
- package/src/helpers/auth.js +191 -0
- package/src/helpers/common.js +175 -0
- package/{www/js/utils/table_utils.js → src/helpers/db_schema.js} +18 -40
- package/src/helpers/file_system.js +102 -0
- package/{www/js/utils/global_utils.js → src/helpers/navigation.js} +169 -335
- package/src/helpers/offline_mode.js +645 -0
- package/src/index.js +20 -0
- package/src/init.js +424 -0
- package/src/routing/index.js +98 -0
- package/{www/js → src/routing}/mocks/request.js +5 -5
- package/{www/js → src/routing}/mocks/response.js +1 -1
- package/{www/js → src/routing}/routes/api.js +10 -15
- package/{www/js → src/routing}/routes/auth.js +12 -6
- package/{www/js → src/routing}/routes/delete.js +9 -6
- package/{www/js → src/routing}/routes/edit.js +9 -6
- package/src/routing/routes/error.js +6 -0
- package/{www/js → src/routing}/routes/fields.js +7 -2
- package/{www/js → src/routing}/routes/page.js +14 -9
- package/{www/js → src/routing}/routes/sync.js +9 -5
- package/{www/js → src/routing}/routes/view.js +16 -11
- package/{www/js/routes/common.js → src/routing/utils.js} +15 -13
- package/webpack.config.js +31 -0
- package/www/data/encoded_site_logo.js +1 -0
- package/www/index.html +23 -491
- package/www/js/{utils/iframe_view_utils.js → iframe_view_utils.js} +137 -269
- package/config.xml +0 -27
- package/res/icon/android/icon.png +0 -0
- package/res/screen/android/splash-icon.png +0 -0
- package/res/screen/ios/Default@2x~universal~anyany.png +0 -0
- package/www/js/routes/error.js +0 -5
- package/www/js/routes/init.js +0 -76
- package/www/js/utils/file_helpers.js +0 -108
- package/www/js/utils/offline_mode_helper.js +0 -625
package/config.xml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
-
<widget id="saltcorn.mobile.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
-
<name>SaltcornMobileApp</name>
|
|
4
|
-
<description>Apache Cordova application with @saltcorn/markup</description>
|
|
5
|
-
<platform name="android">
|
|
6
|
-
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/screen/android/splash-icon.png"/>
|
|
7
|
-
<icon density="ldpi" foreground="res/icon/android/icon.png" background="res/icon/android/icon.png" />
|
|
8
|
-
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/application" mode="merge">
|
|
9
|
-
<application android:usesCleartextTraffic="true"/>
|
|
10
|
-
</edit-config>
|
|
11
|
-
<config-file parent="/manifest" target="AndroidManifest.xml">
|
|
12
|
-
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
13
|
-
</config-file>
|
|
14
|
-
<preference name="Scheme" value="http"/>
|
|
15
|
-
<preference name="MixedContentMode" value="2"/>
|
|
16
|
-
<preference name="minSdkVersion" value="34"/>
|
|
17
|
-
<preference name="targetSdkVersion" value="34"/>
|
|
18
|
-
</platform>
|
|
19
|
-
<platform name="ios">
|
|
20
|
-
<preference name="deployment-target" value="12.0"/>
|
|
21
|
-
<splash src="res/screen/ios/Default@2x~universal~anyany.png" />
|
|
22
|
-
</platform>
|
|
23
|
-
<content src="index.html"/>
|
|
24
|
-
<access origin="*"/>
|
|
25
|
-
<allow-navigation href="*" />
|
|
26
|
-
<allow-navigation href="http://localhost/__cdvfile_files__/*" />
|
|
27
|
-
</widget>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/www/js/routes/error.js
DELETED
package/www/js/routes/init.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*global postView, postViewRoute, getView, postToggleField, deleteRows, postPageAction, getPage, getLoginView, logoutAction, getSignupView, getErrorView, window, getSyncSettingsView, getAskDeleteOfflineData, getAskUploadNotEnded, updateTableRow, insertTableRow, postShowCalculated */
|
|
2
|
-
// TODO module namespacese
|
|
3
|
-
|
|
4
|
-
const initRoutes = async () => {
|
|
5
|
-
const routes = [
|
|
6
|
-
{
|
|
7
|
-
path: "post/view/:viewname",
|
|
8
|
-
action: postView,
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
path: "post/view/:viewname/:route",
|
|
12
|
-
action: postViewRoute,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
path: "get/view/:viewname",
|
|
16
|
-
action: getView,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
path: "post/api/:tableName/:id",
|
|
20
|
-
action: updateTableRow,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
path: "post/api/:tableName/",
|
|
24
|
-
action: insertTableRow,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
path: "post/edit/toggle/:name/:id/:field_name",
|
|
28
|
-
action: postToggleField,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
path: "post/delete/:name/:id",
|
|
32
|
-
action: deleteRows,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
path: "post/page/:page_name/action/:rndid",
|
|
36
|
-
action: postPageAction,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
path: "get/page/:page_name",
|
|
40
|
-
action: getPage,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
path: "get/auth/login",
|
|
44
|
-
action: getLoginView,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
path: "get/auth/logout",
|
|
48
|
-
action: logoutAction,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
path: "get/auth/signup",
|
|
52
|
-
action: getSignupView,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
path: "get/error_page",
|
|
56
|
-
action: getErrorView,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
path: "get/sync/sync_settings",
|
|
60
|
-
action: getSyncSettingsView,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
path: "get/sync/ask_upload_not_ended",
|
|
64
|
-
action: getAskUploadNotEnded,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
path: "get/sync/ask_delete_offline_data",
|
|
68
|
-
action: getAskDeleteOfflineData,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
path: "post/field/show-calculated/:tableName/:fieldName/:fieldview",
|
|
72
|
-
action: postShowCalculated,
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
|
-
window.router = new window.UniversalRouter(routes);
|
|
76
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/*global window, FileReader*/
|
|
2
|
-
|
|
3
|
-
async function fileExists(path) {
|
|
4
|
-
try {
|
|
5
|
-
await getDirEntry(path);
|
|
6
|
-
return true;
|
|
7
|
-
} catch (error) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function getDirEntry(directory) {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
window.resolveLocalFileSystemURL(
|
|
15
|
-
directory,
|
|
16
|
-
function (fs) {
|
|
17
|
-
resolve(fs);
|
|
18
|
-
},
|
|
19
|
-
function (error) {
|
|
20
|
-
reject(error);
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function readJSON(fileName, dirName) {
|
|
27
|
-
const text = await readText(fileName, dirName);
|
|
28
|
-
return JSON.parse(text);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async function readText(fileName, dirName) {
|
|
32
|
-
const dirEntry = await getDirEntry(dirName);
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
dirEntry.getFile(
|
|
35
|
-
fileName,
|
|
36
|
-
{ create: false, exclusive: false },
|
|
37
|
-
function (fileEntry) {
|
|
38
|
-
fileEntry.file(function (file) {
|
|
39
|
-
let reader = new FileReader();
|
|
40
|
-
reader.onloadend = function (e) {
|
|
41
|
-
resolve(this.result);
|
|
42
|
-
};
|
|
43
|
-
reader.readAsText(file);
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
function (err) {
|
|
47
|
-
console.log(`unable to read ${fileName}`);
|
|
48
|
-
console.log(err);
|
|
49
|
-
reject(err);
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async function readBinary(fileName, dirName) {
|
|
56
|
-
const dirEntry = await getDirEntry(dirName);
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
dirEntry.getFile(
|
|
59
|
-
fileName,
|
|
60
|
-
{ create: false, exclusive: false },
|
|
61
|
-
function (fileEntry) {
|
|
62
|
-
fileEntry.file(function (file) {
|
|
63
|
-
let reader = new FileReader();
|
|
64
|
-
reader.onloadend = function (e) {
|
|
65
|
-
resolve(this.result);
|
|
66
|
-
};
|
|
67
|
-
reader.readAsArrayBuffer(file);
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
function (err) {
|
|
71
|
-
console.log(`unable to read ${fileName}`);
|
|
72
|
-
console.log(err);
|
|
73
|
-
reject(err);
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function write(fileName, dirName, content) {
|
|
80
|
-
const dirEntry = await getDirEntry(dirName);
|
|
81
|
-
return new Promise((resolve, reject) => {
|
|
82
|
-
dirEntry.getFile(
|
|
83
|
-
fileName,
|
|
84
|
-
{ create: true, exclusive: false },
|
|
85
|
-
function (fileEntry) {
|
|
86
|
-
fileEntry.createWriter(function (fileWriter) {
|
|
87
|
-
fileWriter.onwriteend = function () {
|
|
88
|
-
resolve();
|
|
89
|
-
};
|
|
90
|
-
fileWriter.onerror = function (e) {
|
|
91
|
-
console.log("Failed file write: " + e.toString());
|
|
92
|
-
reject(e);
|
|
93
|
-
};
|
|
94
|
-
fileWriter.write(content);
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
function (err) {
|
|
98
|
-
console.log(`unable to get ${fileName}`);
|
|
99
|
-
console.log(err);
|
|
100
|
-
reject(err);
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async function writeJSON(fileName, dirName, content) {
|
|
107
|
-
await write(fileName, dirName, JSON.stringify(content));
|
|
108
|
-
}
|