Skip to content

Commit

Permalink
Merge pull request #91 from mendix/release/6.0.0
Browse files Browse the repository at this point in the history
[UIA-33] Update module and test project to 6.0.0
  • Loading branch information
allard-mx authored Dec 16, 2021
2 parents d25432b + 924181f commit 07500e8
Show file tree
Hide file tree
Showing 518 changed files with 22,166 additions and 15,899 deletions.
Binary file modified test/PushNotfications.mpr
Binary file not shown.
64 changes: 64 additions & 0 deletions test/javascriptsource/nanoflowcommons/actions/GenerateUniqueID.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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.
import { Big } from "big.js";

// 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");
}
function getItem(key) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.getItem(key);
}
if (window) {
const value = window.localStorage.getItem(key);
return Promise.resolve(value);
}
return Promise.reject(new Error("No storage API available"));
}
function setItem(key, value) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.setItem(key, value);
}
if (window) {
window.localStorage.setItem(key, value);
return Promise.resolve();
}
return Promise.reject(new Error("No storage API available"));
}
// END EXTRA CODE

/**
* Generates a unique ID based on the current session.
* @returns {Promise.<string>}
*/
export 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
}
4 changes: 2 additions & 2 deletions test/javascriptsource/nanoflowcommons/actions/Geocode.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import Geodecoder from 'react-native-geocoder';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -31,8 +32,7 @@ export async function Geocode(address, geocodingProvider, providerApiKey) {
return Promise.reject(new Error("Input parameter 'Address' is required"));
}
if (navigator && navigator.product === "ReactNative") {
const Geocoder = require("react-native-geocoder").default;
return Geocoder.geocodeAddress(address).then(results => {
return Geodecoder.geocodeAddress(address).then(results => {
if (results.length === 0) {
return Promise.reject(new Error("No results found"));
}
Expand Down
5 changes: 5 additions & 0 deletions test/javascriptsource/nanoflowcommons/actions/Geocode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"react-native-geocoder": "0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import Geolocation from "@react-native-community/geolocation";

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -19,15 +20,15 @@ import { Big } from "big.js";
*
* Best practices:
* https://developers.google.com/web/fundamentals/native-hardware/user-location/
* @param {Big} timeout - The maximum length of time (in milliseconds) the device is allowed to take in order to return a location. If empty, there is no timeout.
* @param {Big} timeout - The maximum length of time (in milliseconds) the device is allowed to take in order to return a location. If set as empty, default value will be 30 second timeout.
* @param {Big} maximumAge - The maximum age (in milliseconds) of a possible cached position that is acceptable to return. If set to 0, it means that the device cannot use a cached position and must attempt to retrieve the real current position. By default the device will always return a cached position regardless of its age.
* @param {boolean} highAccuracy - Use a higher accuracy method to determine the current location. Setting this to false saves battery life.
* @returns {Promise.<MxObject>}
*/
export async function GetCurrentLocation(timeout, maximumAge, highAccuracy) {
// BEGIN USER CODE
if (navigator && navigator.product === "ReactNative" && !navigator.geolocation) {
navigator.geolocation = require("@react-native-community/geolocation");
navigator.geolocation = Geolocation;
}
return new Promise((resolve, reject) => {
const options = getOptions();
Expand All @@ -39,7 +40,8 @@ export async function GetCurrentLocation(timeout, maximumAge, highAccuracy) {
const geolocation = mapPositionToMxObject(mxObject, position);
resolve(geolocation);
},
error: () => reject(new Error("Could not create 'NanoflowCommons.Geolocation' object to store location"))
error: () =>
reject(new Error("Could not create 'NanoflowCommons.Geolocation' object to store location"))
});
}
function onError(error) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"@react-native-community/geolocation": "2.0.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import AsyncStorage from '@react-native-community/async-storage';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand Down Expand Up @@ -36,7 +37,6 @@ export async function GetStorageItemObject(key, entity) {
});
function getItem(key) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.getItem(key);
}
if (window) {
Expand All @@ -47,7 +47,6 @@ export async function GetStorageItemObject(key, entity) {
}
function setItem(key, value) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.setItem(key, value);
}
if (window) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"@react-native-community/async-storage": "1.12.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import AsyncStorage from '@react-native-community/async-storage';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand Down Expand Up @@ -36,7 +37,6 @@ export async function GetStorageItemObjectList(key, entity) {
});
function getItem(key) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.getItem(key);
}
if (window) {
Expand All @@ -47,7 +47,6 @@ export async function GetStorageItemObjectList(key, entity) {
}
function setItem(key, value) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.setItem(key, value);
}
if (window) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"@react-native-community/async-storage": "1.12.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import AsyncStorage from '@react-native-community/async-storage';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -29,7 +30,6 @@ export async function GetStorageItemString(key) {
});
async function getItem(key) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.getItem(key);
}
if (window) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"@react-native-community/async-storage": "1.12.1"
}
}
30 changes: 30 additions & 0 deletions test/javascriptsource/nanoflowcommons/actions/RefreshEntity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.
import { Big } from "big.js";

// BEGIN EXTRA CODE
// END EXTRA CODE

/**
* Updates an entity without needing to refresh the whole page via passing an entity.
* @param {string} entityToRefresh - Entity which will be refreshed.
* @returns {Promise.<void>}
*/
export async function RefreshEntity(entityToRefresh) {
// BEGIN USER CODE
if (!entityToRefresh) {
return Promise.reject(new Error("EntityToRefresh parameter is required"));
}
return new Promise(resolve => {
mx.data.update({
entity: entityToRefresh,
callback: () => resolve(true)
});
});
// END USER CODE
}
30 changes: 30 additions & 0 deletions test/javascriptsource/nanoflowcommons/actions/RefreshObject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.
import { Big } from "big.js";

// BEGIN EXTRA CODE
// END EXTRA CODE

/**
* Updates an entity object without needing to refresh the whole page via passing an entity object.
* @param {MxObject} objectToRefresh - Object which will be refreshed.
* @returns {Promise.<void>}
*/
export async function RefreshObject(objectToRefresh) {
// BEGIN USER CODE
if (!objectToRefresh) {
return Promise.reject(new Error("ObjectToRefresh parameter is required"));
}
return new Promise(resolve => {
mx.data.update({
guid: objectToRefresh.getGuid(),
callback: () => resolve(true)
});
});
// END USER CODE
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import AsyncStorage from '@react-native-community/async-storage';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -23,7 +24,6 @@ export async function RemoveStorageItem(key) {
return removeItem(key).then(() => true);
function removeItem(key) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.removeItem(key);
}
if (window) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"@react-native-community/async-storage": "1.12.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import { Platform, PermissionsAndroid } from 'react-native';
import Geolocation from '@react-native-community/geolocation';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -17,16 +19,14 @@ import { Big } from "big.js";
export async function RequestLocationPermission() {
// BEGIN USER CODE
if (navigator && navigator.product === "ReactNative") {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const RN = require("react-native");
if (!navigator.geolocation) {
navigator.geolocation = require("@react-native-community/geolocation");
navigator.geolocation = Geolocation;
}
if (RN.Platform.OS === "android") {
const locationPermission = RN.PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION;
return RN.PermissionsAndroid.check(locationPermission).then(hasPermission => hasPermission
if (Platform.OS === "android") {
const locationPermission = PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION;
return PermissionsAndroid.check(locationPermission).then(hasPermission => hasPermission
? true
: RN.PermissionsAndroid.request(locationPermission).then(status => status === RN.PermissionsAndroid.RESULTS.GRANTED));
: PermissionsAndroid.request(locationPermission).then(status => status === PermissionsAndroid.RESULTS.GRANTED));
}
else if (navigator.geolocation && navigator.geolocation.requestAuthorization) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"@react-native-community/geolocation": "2.0.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import Geodecoder from 'react-native-geocoder';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand Down Expand Up @@ -35,9 +36,8 @@ export async function ReverseGeocode(latitude, longitude, geocodingProvider, pro
return Promise.reject(new Error("Input parameter 'Longitude' is required"));
}
if (navigator && navigator.product === "ReactNative") {
const Geocoder = require("react-native-geocoder").default;
const position = { lat: Number(latitude), lng: Number(longitude) };
return Geocoder.geocodePosition(position).then(results => {
return Geodecoder.geocodePosition(position).then(results => {
if (results.length === 0) {
return Promise.reject(new Error("No results found"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"react-native-geocoder": "0.5.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import AsyncStorage from '@react-native-community/async-storage';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -28,7 +29,6 @@ export async function SetStorageItemObject(key, value) {
return setItem(key, JSON.stringify(serializedObject));
function setItem(key, value) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.setItem(key, value);
}
if (window) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"@react-native-community/async-storage": "1.12.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
import { Big } from "big.js";
import AsyncStorage from '@react-native-community/async-storage';

// BEGIN EXTRA CODE
// END EXTRA CODE
Expand All @@ -28,7 +29,6 @@ export async function SetStorageItemObjectList(key, value) {
return setItem(key, JSON.stringify(serializedObjects));
function setItem(key, value) {
if (navigator && navigator.product === "ReactNative") {
const AsyncStorage = require("@react-native-community/async-storage").default;
return AsyncStorage.setItem(key, value);
}
if (window) {
Expand Down
Loading

0 comments on commit 07500e8

Please sign in to comment.