@saltcorn/mobile-app 0.8.0-beta.3 → 0.8.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.8.0-beta.3",
4
+ "version": "0.8.0",
5
5
  "description": "Apache Cordova application with @saltcorn/markup",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -1,3 +1,5 @@
1
+ /*global i18next, saltcorn*/
2
+
1
3
  function MobileRequest({ xhr = false, files = undefined, query = undefined }) {
2
4
  const roleId = saltcorn.data.state.getState().mobileConfig.role_id
3
5
  ? saltcorn.data.state.getState().mobileConfig.role_id
@@ -10,7 +12,14 @@ function MobileRequest({ xhr = false, files = undefined, query = undefined }) {
10
12
  postProcess: "sprintf",
11
13
  sprintf: params,
12
14
  }),
13
- getLocale: () => "en",
15
+ isAuthenticated: () => {
16
+ const mobileCfg = saltcorn.data.state.getState().mobileConfig;
17
+ return mobileCfg && mobileCfg.jwt && !mobileCfg.isPublicUser;
18
+ },
19
+ getLocale: () => {
20
+ const mobileCfg = saltcorn.data.state.getState().mobileConfig;
21
+ return mobileCfg?.language ? mobileCfg.language : "en";
22
+ },
14
23
  user: {
15
24
  role_id: roleId,
16
25
  },
@@ -1,3 +1,5 @@
1
+ /*global sbAdmin2Layout, apiCall, removeJwt, saltcorn*/
2
+
1
3
  const prepareAuthForm = () => {
2
4
  return new saltcorn.data.models.Form({
3
5
  class: "login",
@@ -1,3 +1,5 @@
1
+ /*global saltcorn*/
2
+
1
3
  const getHeaders = () => {
2
4
  const config = saltcorn.data.state.getState().mobileConfig;
3
5
  const versionTag = config.version_tag;
@@ -1,3 +1,5 @@
1
+ /*global i18next, apiCall, saltcorn*/
2
+
1
3
  // post/delete/:name/:id
2
4
  const deleteRows = async (context) => {
3
5
  const { name, id } = context.params;
@@ -1,3 +1,5 @@
1
+ /*global i18next, apiCall, saltcorn*/
2
+
1
3
  // /toggle/:name/:id/:field_name
2
4
  const postToggleField = async (context) => {
3
5
  const { name, id, field_name } = context.params;
@@ -1,3 +1,5 @@
1
+ /*global layout, getHeaders, saltcorn*/
2
+
1
3
  const getErrorView = async (context) => {
2
4
  const state = saltcorn.data.state.getState();
3
5
  const wrappedContent = layout().wrap({
@@ -1,3 +1,5 @@
1
+ /*global postView, postViewRoute, getView, postToggleField, deleteRows, postPageAction, getPage, getLoginView, logoutAction, getSignupView, getErrorView, window*/
2
+
1
3
  const initRoutes = async () => {
2
4
  const routes = [
3
5
  {
@@ -43,7 +45,7 @@ const initRoutes = async () => {
43
45
  {
44
46
  path: "get/error_page",
45
47
  action: getErrorView,
46
- }
48
+ },
47
49
  ];
48
50
  window.router = new window.UniversalRouter(routes);
49
51
  };
@@ -1,3 +1,5 @@
1
+ /*global MobileRequest, parseQuery, MobileResponse, wrapContents, saltcorn*/
2
+
1
3
  // post/page/:pagename/action/:rndid
2
4
  const postPageAction = async (context) => {
3
5
  const state = saltcorn.data.state.getState();
@@ -1,3 +1,5 @@
1
+ /*global MobileRequest, MobileResponse, parseQuery, wrapContents, saltcorn*/
2
+
1
3
  /**
2
4
  *
3
5
  * @param {*} context
@@ -1,3 +1,5 @@
1
+ /*global window, FileReader*/
2
+
1
3
  async function fileExists(path) {
2
4
  try {
3
5
  await getDirEntry(path);
@@ -1,3 +1,5 @@
1
+ /*global axios, write, cordova, router, getDirEntry, saltcorn, document, FileReader, navigator*/
2
+
1
3
  let routingHistory = [];
2
4
 
3
5
  function currentLocation() {
@@ -1,3 +1,6 @@
1
+ /*eslint-env browser*/
2
+ /*global $, submitWithEmptyAction, is_paging_param, bootstrap, common_done, unique_field_from_rows*/
3
+
1
4
  function combineFormAndQuery(form, query) {
2
5
  let paramsList = [];
3
6
  const formData = new FormData(form[0]);
@@ -1,3 +1,5 @@
1
+ /*global readJSON, cordova, fileExists, writeJSON, saltcorn*/
2
+
1
3
  const historyFile = "update_history";
2
4
  const jwtTableName = "jwt_table";
3
5