Skip to content

Commit

Permalink
[UIA-811] Update module and test project to v7.3.0 for React client s…
Browse files Browse the repository at this point in the history
…upport (#115)

* [UIA-811] Support for React client

* [UIA-811] Support for React client

* [UIA-811] Support for React client
  • Loading branch information
MxMurshed authored Jun 11, 2024
1 parent e400864 commit cf8e116
Show file tree
Hide file tree
Showing 252 changed files with 18,948 additions and 12,726 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'com.github.ben-manes.versions'

project.ext {
PNC_VERSION = '7.2.4'
MXBUILD_VERSION = '9.18.0.53394'
PNC_VERSION = '7.3.0'
MXBUILD_VERSION = '9.24.0.2965'
MODULE_NAME = 'PushNotifications'
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MxPushNotifications",
"version": "7.2.4",
"version": "7.3.0",
"description": "Phonegap widget for notifications",
"license": "Apache 2.0",
"author": "Mendix Technology B.V.",
Expand Down
Binary file modified test/PushNotfications.mpr
Binary file not shown.
79 changes: 79 additions & 0 deletions test/javascriptsource/datawidgets/actions/Export_To_Excel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// 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 "mx-global";
import { Big } from "big.js";
import { utils, writeFileXLSX } from './xlsx-export-tools.js';

// BEGIN EXTRA CODE
// END EXTRA CODE

/**
* @param {string} datagridName
* @param {string} fileName
* @param {string} sheetName
* @param {boolean} includeColumnHeaders
* @param {Big} chunkSize - The number of items fetched and exported per request.
* @returns {Promise.<boolean>}
*/
export async function Export_To_Excel(datagridName, fileName, sheetName, includeColumnHeaders, chunkSize) {
// BEGIN USER CODE
if (!fileName || !datagridName || !sheetName) {
return false;
}

return new Promise((resolve, reject) => {
const stream =
window[window.DATAGRID_DATA_EXPORT][datagridName].create();

let worksheet;
let headers;
const streamOptions = { limit: chunkSize };
stream.process((msg) => {
if (!msg) {
return;
}

switch (msg.type) {
case "columns":
headers = msg.payload.map(column => column.name);
if (includeColumnHeaders) {
worksheet = utils.aoa_to_sheet([headers]);
}
break;
case "data":
if (worksheet === undefined) {
worksheet = utils.aoa_to_sheet(msg.payload)
} else {
utils.sheet_add_aoa(worksheet, msg.payload, { origin: -1 });
}
break;
case "end":
if (worksheet) {
// Set character width for each column
// https://docs.sheetjs.com/docs/csf/sheet#worksheet-object
worksheet["!cols"] = headers.map(header => ({
wch: header.length + 10
}));
const workbook = utils.book_new();
utils.book_append_sheet(workbook, worksheet, sheetName === "" ? "Data" : sheetName);
writeFileXLSX(workbook, `${fileName}.xlsx`);
resolve(true);
} else {
resolve(false);
}
break;
case "aborted":
resolve(false);
break;
}
}, streamOptions);

stream.start();
});
// END USER CODE
}
25 changes: 25 additions & 0 deletions test/javascriptsource/datawidgets/actions/Reset_All_Filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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";
import "mx-global";

// BEGIN EXTRA CODE
// END EXTRA CODE

/**
* @param {string} targetName - Name of the widget for which filters should be reset. Valid targets are: Data grid 2, Gallery. You can find filter name in widget settings in the "Common" group (Properties>Common>Name).
* @returns {Promise.<void>}
*/
export async function Reset_All_Filters(targetName) {
// BEGIN USER CODE
const plugin = window["com.mendix.widgets.web.plugin.externalEvents"];
if (plugin) {
plugin.emit(targetName, "reset.filters");
}
// END USER CODE
}
25 changes: 25 additions & 0 deletions test/javascriptsource/datawidgets/actions/Reset_Filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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 "mx-global";
import { Big } from "big.js";

// BEGIN EXTRA CODE
// END EXTRA CODE

/**
* @param {string} targetName - Name of the filter to reset. Valid targets are: Number filter, Date filter, Text filter, Drop-down filter. You can find filter name in widget settings in the "Common" group (Properties>Common>Name).
* @returns {Promise.<void>}
*/
export async function Reset_Filter(targetName) {
// BEGIN USER CODE
const plugin = window["com.mendix.widgets.web.plugin.externalEvents"];
if (plugin) {
plugin.emit(targetName, "reset.value");
}
// END USER CODE
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export async function CancelAllScheduledNotifications() {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules &&
((isIOS && !NativeModules.RNCPushNotificationIOS) || (!isIOS && !NativeModules.RNPushNotification))) {
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
}
PushNotification.cancelAllLocalNotifications();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.3",
"react-native-push-notification": "8.1.1",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ export async function CancelScheduledNotification(notificationId) {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules &&
((isIOS && !NativeModules.RNCPushNotificationIOS) || (!isIOS && !NativeModules.RNPushNotification))) {
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
}
if (!notificationId) {
return Promise.reject(new Error("Input parameter 'Notification id' is required"));
}
PushNotification.cancelLocalNotifications({ id: notificationId });
PushNotification.cancelLocalNotification(notificationId);
return Promise.resolve();
// END USER CODE
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.3",
"react-native-push-notification": "8.1.1",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export async function ClearAllDeliveredNotifications() {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules &&
((isIOS && !NativeModules.RNCPushNotificationIOS) || (!isIOS && !NativeModules.RNPushNotification))) {
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
}
PushNotification.removeAllDeliveredNotifications();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.3",
"react-native-push-notification": "8.1.1",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export async function DisplayNotification(body, title, subtitle, playSound, acti
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules &&
((isIOS && !NativeModules.RNCPushNotificationIOS) || (!isIOS && !NativeModules.RNPushNotification))) {
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
}
if (!body) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.3",
"react-native-push-notification": "8.1.1",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ export async function GetDeviceInfo() {
DeviceInfo.getTotalMemory(),
DeviceInfo.getCarrier(),
DeviceInfo.getManufacturer(),
DeviceInfo.getUserAgent()
]).then(async ([mxObject, batteryLevel, fontScale, freeDiskStorage, totalDiskCapacity, totalMemory, carrier, manufacturer, userAgent]) => {
DeviceInfo.getUserAgent(),
DeviceInfo.getUniqueId(),
DeviceInfo.isEmulator(),
DeviceInfo.isLandscape()
]).then(async ([mxObject, batteryLevel, fontScale, freeDiskStorage, totalDiskCapacity, totalMemory, carrier, manufacturer, userAgent, uniqueId, isEmulator, isLandscape]) => {
const locales = getLocales();
mxObject.set("ApplicationName", DeviceInfo.getApplicationName());
mxObject.set("BatteryLevel", new Big(batteryLevel.toFixed(2)));
Expand All @@ -48,13 +51,13 @@ export async function GetDeviceInfo() {
mxObject.set("Timezone", getTimeZone());
mxObject.set("TotalDiskCapacity", new Big(totalDiskCapacity));
mxObject.set("TotalMemory", new Big(totalMemory));
mxObject.set("UniqueId", DeviceInfo.getUniqueId());
mxObject.set("UniqueId", uniqueId);
mxObject.set("UserAgent", userAgent);
mxObject.set("Version", DeviceInfo.getVersion());
mxObject.set("Is24Hour", uses24HourClock());
mxObject.set("IsEmulator", DeviceInfo.isEmulator());
mxObject.set("IsEmulator", isEmulator);
mxObject.set("IsTablet", DeviceInfo.isTablet());
mxObject.set("IsLandscape", DeviceInfo.isLandscape());
mxObject.set("IsLandscape", isLandscape);
mxObject.set("HasNotch", DeviceInfo.hasNotch());
return mxObject;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"nativeDependencies": {
"react-native-localize": "1.3.4"
"react-native-localize": "1.4.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"nativeDependencies": {
"@react-native-firebase/messaging": "15.7.0",
"@react-native-firebase/app": "15.7.0",
"@expo/config-plugins": "5.0.3"
"@react-native-firebase/messaging": "17.3.0",
"@react-native-firebase/app": "17.3.0",
"@expo/config-plugins": "5.0.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { NativeModules } from 'react-native';
export async function HasNotificationPermission() {
// BEGIN USER CODE
// Documentation https://rnfirebase.io/docs/v5.x.x/notifications/receiving-notifications
const allowedAuthorizationStatuses = [1 /* Authorized */, 2 /* Provisional */];
const allowedAuthorizationStatuses = [1 /* permissionStatus.Authorized */, 2 /* permissionStatus.Provisional */];
if (NativeModules && !NativeModules.RNFBMessagingModule) {
return Promise.reject(new Error("Firebase module is not available in your app"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"nativeDependencies": {
"@react-native-firebase/messaging": "15.7.0",
"@react-native-firebase/app": "15.7.0",
"@expo/config-plugins": "5.0.3"
"@react-native-firebase/messaging": "17.3.0",
"@react-native-firebase/app": "17.3.0",
"@expo/config-plugins": "5.0.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export async function ScheduleNotification(date, body, title, subtitle, playSoun
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules &&
((isIOS && !NativeModules.RNCPushNotificationIOS) || (!isIOS && !NativeModules.RNPushNotification))) {
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
}
if (!body) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.3",
"react-native-push-notification": "8.1.1",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export async function SetBadgeNumber(badgeNumber) {
// BEGIN USER CODE
// Documentation https://github.com/zo0r/react-native-push-notification
const isIOS = Platform.OS === "ios";
if (NativeModules &&
((isIOS && !NativeModules.RNCPushNotificationIOS) || (!isIOS && !NativeModules.RNPushNotification))) {
if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) {
return Promise.reject(new Error("Notifications module is not available in your app"));
}
if (!badgeNumber) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.3",
"react-native-push-notification": "8.1.1",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,27 @@ export async function TakePicture(picture, pictureSource, pictureQuality, maximu
const options = nativeVersionMajor === 2 ? getOptionsV2() : getOptionsV4();
getPictureMethod()
.then(method => method(options, (response) => {
var _a;
if (response.didCancel) {
return resolve(undefined);
}
if (nativeVersionMajor === 2) {
response = response;
if (response.error) {
const unhandledError = handleImagePickerV2Error(response.error);
const responseV2 = response;
if (responseV2.error) {
const unhandledError = handleImagePickerV2Error(responseV2.error);
if (!unhandledError) {
return resolve(undefined);
}
return reject(new Error(response.error));
return reject(new Error(responseV2.error));
}
return resolve(response.uri);
return resolve(responseV2.uri);
}
response = response;
if (response.errorCode) {
handleImagePickerV4Error(response.errorCode, response.errorMessage);
return resolve(undefined);
}
return resolve(response.assets[0].uri);
return resolve((_a = response === null || response === void 0 ? void 0 : response.assets) === null || _a === void 0 ? void 0 : _a[0].uri);
}))
.catch(error => reject(error));
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"nativeDependencies": {
"react-native-image-picker": "4.0.3",
"react-native-localize": "1.3.4",
"react-native-image-picker": "5.0.1",
"react-native-localize": "1.4.2",
"react-native-permissions": "3.3.1"
}
}
Loading

0 comments on commit cf8e116

Please sign in to comment.