@saltcorn/mobile-app 1.5.0-beta.6 → 1.5.0-beta.8

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": "1.5.0-beta.6",
4
+ "version": "1.5.0-beta.8",
5
5
  "description": "Saltcorn mobile app for Android and iOS",
6
6
  "main": "index.js",
7
7
  "scripts": {
package/src/init.js CHANGED
@@ -171,7 +171,7 @@ const initI18Next = async () => {
171
171
  for (const key of Object.keys(
172
172
  saltcorn.data.models.config.available_languages
173
173
  )) {
174
- if (Capacitor.platform !== "web") {
174
+ if (Capacitor.getPlatform() !== "web") {
175
175
  const localeFile = await readJSONCordova(
176
176
  `${key}.json`,
177
177
  `${cordova.file.applicationDirectory}public/data/locales`
@@ -306,7 +306,7 @@ const postShare = async (shareData) => {
306
306
  };
307
307
 
308
308
  const readSchemaIfNeeded = async () => {
309
- if (Capacitor.platform !== "web") {
309
+ if (Capacitor.getPlatform() !== "web") {
310
310
  let tablesJSON = null;
311
311
  const { created_at } = await readJSONCordova(
312
312
  "tables_created_at.json",
@@ -327,7 +327,7 @@ const readSchemaIfNeeded = async () => {
327
327
  };
328
328
 
329
329
  const readSiteLogo = async () => {
330
- if (Capacitor.platform === "web") return "";
330
+ if (Capacitor.getPlatform() === "web") return "";
331
331
  try {
332
332
  const base64 = await readTextCordova(
333
333
  "encoded_site_logo.txt",
@@ -358,7 +358,7 @@ const getEntryPoint = (roleId, state, mobileConfig) => {
358
358
  // device is ready
359
359
  export async function init(mobileConfig) {
360
360
  try {
361
- if (Capacitor.platform === "web") {
361
+ if (Capacitor.getPlatform() === "web") {
362
362
  defineCustomElements(window);
363
363
  await customElements.whenDefined("jeep-sqlite");
364
364
  const jeepSqlite = document.createElement("jeep-sqlite");
@@ -428,10 +428,10 @@ export async function init(mobileConfig) {
428
428
  state.mobileConfig.networkState = (
429
429
  await Network.getStatus()
430
430
  ).connectionType;
431
- if (Capacitor.platform === "android") {
431
+ if (Capacitor.getPlatform() === "android") {
432
432
  const shareData = await checkSendIntentReceived();
433
433
  if (shareData) return await postShare(shareData);
434
- } else if (Capacitor.platform === "ios") {
434
+ } else if (Capacitor.getPlatform() === "ios") {
435
435
  window.addEventListener("sendIntentReceived", async () => {
436
436
  const shareData = await checkSendIntentReceived();
437
437
  if (shareData && notEmpty(shareData)) return await postShare(shareData);
@@ -486,7 +486,7 @@ export async function init(mobileConfig) {
486
486
  }
487
487
  }
488
488
 
489
- if (Capacitor.platform === "ios") {
489
+ if (Capacitor.getPlatform() === "ios") {
490
490
  const shareData = await checkSendIntentReceived();
491
491
  if (shareData && notEmpty(shareData)) return await postShare(shareData);
492
492
  }
@@ -33,10 +33,11 @@ const prepareAuthForm = () => {
33
33
  const getAuthLinks = (current, entryPoint) => {
34
34
  const links = { methods: [] };
35
35
  const state = saltcorn.data.state.getState();
36
+ const mobileConfig = state.mobileConfig;
36
37
  if (current !== "login") links.login = "javascript:execLink('/auth/login')";
37
38
  if (current !== "signup" && state.getConfig("allow_signup"))
38
39
  links.signup = "javascript:execLink('/auth/signup')";
39
- if (state.getConfig("public_user_link"))
40
+ if (mobileConfig.showContinueAsPublicUser)
40
41
  links.publicUser = `javascript:publicLogin('${entryPoint}')`;
41
42
  for (const [name, auth] of Object.entries(state.auth_methods)) {
42
43
  links.methods.push({
@@ -46,7 +46,7 @@ export const postShare = async (context) => {
46
46
  saltcorn.markup.tags.script(`
47
47
  setTimeout(() => {
48
48
  ${
49
- Capacitor.platform === "android"
49
+ Capacitor.getPlatform() === "android"
50
50
  ? "parent.saltcorn.mobileApp.common.finishShareIntent();"
51
51
  : "parent.saltcorn.mobileApp.navigation.gotoEntryView();"
52
52
  }
package/www/index.html CHANGED
@@ -16,7 +16,7 @@
16
16
  if (window.saltcorn) window.saltcorn.mobileApp = mobileApp;
17
17
  else window.saltcorn = { mobileApp };
18
18
 
19
- if (Capacitor.platform !== "web") {
19
+ if (Capacitor.getPlatform() !== "web") {
20
20
  document.addEventListener("deviceready", () => {
21
21
  saltcorn.mobileApp.init(_sc_mobile_config);
22
22
  });