-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 07008f3
Showing
508 changed files
with
75,938 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/*.launch | ||
/deployment/ | ||
/packages/ | ||
/releases/ | ||
/.mendix-cache/ | ||
/.classpath | ||
/.project | ||
/exploring10.mpr.bak | ||
/exploring10.mpr.lock | ||
/modeler-merge-marker | ||
/project-settings.user.json | ||
/javasource/*/proxies/ | ||
/javasource/system/ | ||
/**/node_modules/ | ||
!/javascriptsource/**/node_modules/ | ||
/nativemobile/builds/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Base64 } from 'js-base64'; | ||
|
||
// This file was generated by Mendix Studio Pro. | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* @param {string} base64 | ||
* @returns {Promise.<string>} | ||
*/ | ||
async function Base64Decode(base64) { | ||
// BEGIN USER CODE | ||
return Base64.decode(base64); | ||
// END USER CODE | ||
} | ||
|
||
export { Base64Decode }; |
27 changes: 27 additions & 0 deletions
27
javascriptsource/nanoflowcommons/actions/Base64DecodeToImage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Base64 } from 'js-base64'; | ||
|
||
// This file was generated by Mendix Studio Pro. | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* This JS Action takes a base64 String and a System.Image, decodes the base64 String and stores the resulting image in the System.Image object | ||
* @param {string} base64 | ||
* @param {MxObject} image | ||
* @returns {Promise.<boolean>} | ||
*/ | ||
function Base64DecodeToImage(base64, image) { | ||
// BEGIN USER CODE | ||
if (!base64) { | ||
throw new Error("base64 String should not be empty"); | ||
} | ||
if (!image) { | ||
throw new Error("image should not be null"); | ||
} | ||
const blob = new Blob([Base64.toUint8Array(base64)], { type: "image/png" }); | ||
return new Promise((resolve, reject) => { | ||
mx.data.saveDocument(image.getGuid(), "camera image", {}, blob, () => resolve(true), reject); | ||
}); | ||
// END USER CODE | ||
} | ||
|
||
export { Base64DecodeToImage }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Base64 } from 'js-base64'; | ||
|
||
// This file was generated by Mendix Studio Pro. | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* @param {string} string | ||
* @returns {Promise.<string>} | ||
*/ | ||
async function Base64Encode(string) { | ||
// BEGIN USER CODE | ||
return Base64.encode(string); | ||
// END USER CODE | ||
} | ||
|
||
export { Base64Encode }; |
37 changes: 37 additions & 0 deletions
37
javascriptsource/nanoflowcommons/actions/CallPhoneNumber.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* @param {string} phoneNumber - This field is required. | ||
* @returns {Promise.<boolean>} | ||
*/ | ||
async function CallPhoneNumber(phoneNumber) { | ||
// BEGIN USER CODE | ||
if (!phoneNumber) { | ||
return Promise.reject(new Error("Input parameter 'Phone number' is required")); | ||
} | ||
const url = `tel:${encodeURI(phoneNumber)}`; | ||
// Native platform | ||
if (navigator && navigator.product === "ReactNative") { | ||
const Linking = require("react-native").Linking; | ||
return Linking.canOpenURL(url).then(supported => { | ||
if (!supported) { | ||
return false; | ||
} | ||
return Linking.openURL(url).then(() => true); | ||
}); | ||
} | ||
// Hybrid platform | ||
if (window && window.cordova) { | ||
window.open(url, "_system"); | ||
return Promise.resolve(true); | ||
} | ||
// Web platform | ||
if (window) { | ||
window.location.href = url; | ||
return Promise.resolve(true); | ||
} | ||
return Promise.resolve(false); | ||
// END USER CODE | ||
} | ||
|
||
export { CallPhoneNumber }; |
22 changes: 22 additions & 0 deletions
22
javascriptsource/nanoflowcommons/actions/ClearCachedSessionData.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// This file was generated by Mendix Studio Pro. | ||
// | ||
// WARNING: Only the following code will be retained when actions are regenerated: | ||
// - the import list | ||
// - the code between BEGIN USER CODE and END USER CODE | ||
// - the code between BEGIN EXTRA CODE and END EXTRA CODE | ||
// Other code you write will be lost the next time you deploy the project. | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* @returns {Promise.<void>} | ||
*/ | ||
async function ClearCachedSessionData() { | ||
// BEGIN USER CODE | ||
if (mx.session && mx.session.clearCachedSessionData === undefined) { | ||
return Promise.reject(new Error("JS action 'Clear cached session data' is not supported prior to Mendix client v9.14")); | ||
} | ||
await mx.session.clearCachedSessionData(); | ||
// END USER CODE | ||
} | ||
|
||
export { ClearCachedSessionData }; |
26 changes: 26 additions & 0 deletions
26
javascriptsource/nanoflowcommons/actions/ClearLocalStorage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// This file was generated by Mendix Studio Pro. | ||
// | ||
// WARNING: Only the following code will be retained when actions are regenerated: | ||
// - the import list | ||
// - the code between BEGIN USER CODE and END USER CODE | ||
// - the code between BEGIN EXTRA CODE and END EXTRA CODE | ||
// Other code you write will be lost the next time you deploy the project. | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* @returns {Promise.<boolean>} | ||
*/ | ||
async function ClearLocalStorage() { | ||
// BEGIN USER CODE | ||
try { | ||
localStorage.clear(); | ||
return true; | ||
} | ||
catch (e) { | ||
console.error(e); | ||
return false; | ||
} | ||
// END USER CODE | ||
} | ||
|
||
export { ClearLocalStorage }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* Start drafting an email in the platform specified email client. This might work differently for each user depending on their platform and local configuration. | ||
* @param {string} recipient - The recipient, or recipients, separated by comma's. | ||
* @param {string} cc - The Carbon Copy recipient, or recipients, separated by comma's. | ||
* @param {string} bcc - The Blind Carbon Copy recipient, or recipients, separated by comma's. | ||
* @param {string} subject | ||
* @param {string} body | ||
* @returns {Promise.<boolean>} | ||
*/ | ||
async function DraftEmail(recipient, cc, bcc, subject, body) { | ||
// BEGIN USER CODE | ||
let url = "mailto:"; | ||
if (recipient) { | ||
url += `${encodeURI(recipient)}?`; | ||
} | ||
if (cc) { | ||
url += `cc=${encodeURIComponent(cc)}&`; | ||
} | ||
if (bcc) { | ||
url += `bcc=${encodeURIComponent(bcc)}&`; | ||
} | ||
if (subject) { | ||
url += `subject=${encodeURIComponent(subject)}&`; | ||
} | ||
if (body) { | ||
url += `body=${encodeURIComponent(body)}&`; | ||
} | ||
// Remove the last '?' or '&' | ||
url = url.slice(0, -1); | ||
// Native platform | ||
if (navigator && navigator.product === "ReactNative") { | ||
const Linking = require("react-native").Linking; | ||
return Linking.canOpenURL(url).then(supported => { | ||
if (!supported) { | ||
return false; | ||
} | ||
return Linking.openURL(url).then(() => true); | ||
}); | ||
} | ||
// Hybrid platform | ||
if (window && window.cordova) { | ||
window.open(url, "_system"); | ||
return Promise.resolve(true); | ||
} | ||
// Web platform | ||
if (window) { | ||
window.location.href = url; | ||
return Promise.resolve(true); | ||
} | ||
return Promise.resolve(false); | ||
// END USER CODE | ||
} | ||
|
||
export { DraftEmail }; |
21 changes: 21 additions & 0 deletions
21
javascriptsource/nanoflowcommons/actions/FindObjectWithGUID.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// This file was generated by Mendix Studio Pro. | ||
// | ||
// WARNING: Only the following code will be retained when actions are regenerated: | ||
// - the import list | ||
// - the code between BEGIN USER CODE and END USER CODE | ||
// - the code between BEGIN EXTRA CODE and END EXTRA CODE | ||
// Other code you write will be lost the next time you deploy the project. | ||
// BEGIN EXTRA CODE | ||
// END EXTRA CODE | ||
/** | ||
* @param {MxObject[]} list | ||
* @param {string} objectGUID | ||
* @returns {Promise.<MxObject>} | ||
*/ | ||
async function FindObjectWithGUID(list, objectGUID) { | ||
// BEGIN USER CODE | ||
return list.find(element => element.getGuid() === objectGUID); | ||
// END USER CODE | ||
} | ||
|
||
export { FindObjectWithGUID }; |
61 changes: 61 additions & 0 deletions
61
javascriptsource/nanoflowcommons/actions/GenerateUniqueID.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// This file was generated by Mendix Studio Pro. | ||
// | ||
// WARNING: Only the following code will be retained when actions are regenerated: | ||
// - the import list | ||
// - the code between BEGIN USER CODE and END USER CODE | ||
// - the code between BEGIN EXTRA CODE and END EXTRA CODE | ||
// Other code you write will be lost the next time you deploy the project. | ||
// BEGIN EXTRA CODE | ||
const COUNTER_STORE = "idCounter"; | ||
let locked = false; | ||
let currentCounter; | ||
function sleep(time) { | ||
return new Promise(resolve => setTimeout(resolve, time)); | ||
} | ||
async function initializeCounter() { | ||
currentCounter = JSON.parse((await getItem(COUNTER_STORE)) || "-1"); | ||
} | ||
async function getItem(key) { | ||
if (navigator && navigator.product === "ReactNative") { | ||
const AsyncStorage = (await import('@react-native-community/async-storage')).default; | ||
return AsyncStorage.getItem(key); | ||
} | ||
if (window) { | ||
return window.localStorage.getItem(key); | ||
} | ||
throw new Error("No storage API available"); | ||
} | ||
async function setItem(key, value) { | ||
if (navigator && navigator.product === "ReactNative") { | ||
const AsyncStorage = (await import('@react-native-community/async-storage')).default; | ||
return AsyncStorage.setItem(key, value); | ||
} | ||
if (window) { | ||
return window.localStorage.setItem(key, value); | ||
} | ||
throw new Error("No storage API available"); | ||
} | ||
// END EXTRA CODE | ||
/** | ||
* Generates a unique ID based on the current session. | ||
* @returns {Promise.<string>} | ||
*/ | ||
async function GenerateUniqueID() { | ||
// BEGIN USER CODE | ||
const sessionId = mx.session.getConfig("sessionObjectId"); | ||
const rnd = Math.round(Math.random() * 10000); | ||
// eslint-disable-next-line no-unmodified-loop-condition | ||
while (locked) { | ||
await sleep(10); | ||
} | ||
locked = true; | ||
if (typeof currentCounter === "undefined") { | ||
await initializeCounter(); | ||
} | ||
await setItem(COUNTER_STORE, JSON.stringify(++currentCounter)); | ||
locked = false; | ||
return `${sessionId}:${currentCounter}:${rnd}`; | ||
// END USER CODE | ||
} | ||
|
||
export { GenerateUniqueID }; |
5 changes: 5 additions & 0 deletions
5
javascriptsource/nanoflowcommons/actions/GenerateUniqueID.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"nativeDependencies": { | ||
"@react-native-community/async-storage": "1.12.1" | ||
} | ||
} |
Oops, something went wrong.