diff --git a/configs/e2e/native_dependencies.json b/configs/e2e/native_dependencies.json index e2f04ed89..fd61c93fc 100644 --- a/configs/e2e/native_dependencies.json +++ b/configs/e2e/native_dependencies.json @@ -1,10 +1,10 @@ { "react-native-maps": "1.14.0", "react-native-geocoder": "0.5.0", - "react-native-device-info": "13.0.0", + "react-native-device-info": "14.0.4", "react-native-action-button": "2.8.5", "react-native-material-menu": "1.2.0", - "react-native-linear-gradient": "2.5.6", + "react-native-linear-gradient": "2.8.3", "@react-native-community/netinfo": "11.4.1", "react-native-svg": "15.11.1", "react-native-system-navigation-bar": "2.6.3", diff --git a/packages/jsActions/mobile-resources-native/package.json b/packages/jsActions/mobile-resources-native/package.json index c003ad8ab..dfe794f57 100644 --- a/packages/jsActions/mobile-resources-native/package.json +++ b/packages/jsActions/mobile-resources-native/package.json @@ -26,32 +26,30 @@ "release:marketplace": "node ../../../scripts/release/marketplaceRelease.js" }, "dependencies": { + "@notifee/react-native": "9.1.8", "@react-native-camera-roll/camera-roll": "7.4.0", - "@react-native-community/push-notification-ios": "1.10.1", "@react-native-firebase/messaging": "17.3.0", - "@swan-io/react-native-browser": "^0.4.1", + "@swan-io/react-native-browser": "0.4.1", "fbjs": "3.0.4", "mime": "3.0.0", + "react-native-biometrics": "3.0.1", "react-native-blob-util": "0.21.2", - "react-native-device-info": "13.0.0", + "react-native-device-info": "14.0.4", "react-native-file-viewer": "2.1.5", "react-native-image-picker": "7.2.3", "react-native-localize": "3.2.1", "react-native-permissions": "4.1.5", - "react-native-push-notification": "8.1.1", "react-native-schedule-exact-alarm-permission": "^0.1.3", "react-native-sound": "0.11.0", - "react-native-touch-id": "4.4.1", "url-parse": "^1.4.7" }, "devDependencies": { "@mendix/pluggable-widgets-tools": "^10.0.1", "@types/querystringify": "^2.0.0", - "@types/react-native-push-notification": "8.1.1", "@types/url-parse": "^1.4.3", "eslint": "^7.32.0", "mendix": "~10.0.9976", "rimraf": "^4.4.1", "rollup": "^2.79.2" } -} \ No newline at end of file +} diff --git a/packages/jsActions/mobile-resources-native/src/authentication/BiometricAuthentication.ts b/packages/jsActions/mobile-resources-native/src/authentication/BiometricAuthentication.ts index c9b62e70e..d44e79e70 100644 --- a/packages/jsActions/mobile-resources-native/src/authentication/BiometricAuthentication.ts +++ b/packages/jsActions/mobile-resources-native/src/authentication/BiometricAuthentication.ts @@ -5,7 +5,7 @@ // - 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 TouchID from "react-native-touch-id"; +import ReactNativeBiometrics from "react-native-biometrics"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -16,9 +16,12 @@ import TouchID from "react-native-touch-id"; */ export async function BiometricAuthentication(reason?: string): Promise { // BEGIN USER CODE - // Documentation https://github.com/naoufal/react-native-touch-id + // Documentation https://github.com/smallcase/react-native-simple-biometrics - return TouchID.authenticate(reason) + const rnBiometrics = new ReactNativeBiometrics(); + + return rnBiometrics + .simplePrompt({ promptMessage: reason ?? "" }) .then(() => true) .catch(() => false); diff --git a/packages/jsActions/mobile-resources-native/src/authentication/IsBiometricAuthenticationSupported.ts b/packages/jsActions/mobile-resources-native/src/authentication/IsBiometricAuthenticationSupported.ts index 3387850b4..99a1b8d48 100644 --- a/packages/jsActions/mobile-resources-native/src/authentication/IsBiometricAuthenticationSupported.ts +++ b/packages/jsActions/mobile-resources-native/src/authentication/IsBiometricAuthenticationSupported.ts @@ -5,7 +5,7 @@ // - 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 TouchID from "react-native-touch-id"; +import ReactNativeBiometrics from "react-native-biometrics"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -15,10 +15,13 @@ import TouchID from "react-native-touch-id"; */ export async function IsBiometricAuthenticationSupported(): Promise { // BEGIN USER CODE - // Documentation https://github.com/naoufal/react-native-touch-id + // Documentation https://github.com/smallcase/react-native-simple-biometrics - return TouchID.isSupported() - .then(() => true) + const rnBiometrics = new ReactNativeBiometrics(); + + return rnBiometrics + .isSensorAvailable() + .then(result => result.available) .catch(() => false); // END USER CODE diff --git a/packages/jsActions/mobile-resources-native/src/notifications/CancelAllScheduledNotifications.ts b/packages/jsActions/mobile-resources-native/src/notifications/CancelAllScheduledNotifications.ts index f47fde625..e3e547625 100644 --- a/packages/jsActions/mobile-resources-native/src/notifications/CancelAllScheduledNotifications.ts +++ b/packages/jsActions/mobile-resources-native/src/notifications/CancelAllScheduledNotifications.ts @@ -5,8 +5,8 @@ // - 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 { NativeModules, Platform } from "react-native"; -import PushNotification from "react-native-push-notification"; +import { NativeModules } from "react-native"; +import notifee from "@notifee/react-native"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -17,13 +17,12 @@ import PushNotification from "react-native-push-notification"; */ export async function CancelAllScheduledNotifications(): Promise { // BEGIN USER CODE - // Documentation https://github.com/zo0r/react-native-push-notification - const isIOS = Platform.OS === "ios"; - if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) { - return Promise.reject(new Error("Notifications module is not available in your app")); + // Documentation https://github.com/invertase/notifee + if (NativeModules && !NativeModules.NotifeeApiModule) { + return Promise.reject(new Error("Notifee native module is not available in your app")); } - PushNotification.cancelAllLocalNotifications(); + notifee.cancelAllNotifications(); return Promise.resolve(); // END USER CODE diff --git a/packages/jsActions/mobile-resources-native/src/notifications/CancelScheduledNotification.ts b/packages/jsActions/mobile-resources-native/src/notifications/CancelScheduledNotification.ts index 20b1ab7b8..d840fc9cd 100644 --- a/packages/jsActions/mobile-resources-native/src/notifications/CancelScheduledNotification.ts +++ b/packages/jsActions/mobile-resources-native/src/notifications/CancelScheduledNotification.ts @@ -5,8 +5,8 @@ // - 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 { NativeModules, Platform } from "react-native"; -import PushNotification from "react-native-push-notification"; +import { NativeModules } from "react-native"; +import notifee from "@notifee/react-native"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -17,17 +17,16 @@ import PushNotification from "react-native-push-notification"; */ export async function CancelScheduledNotification(notificationId?: string): Promise { // BEGIN USER CODE - // Documentation https://github.com/zo0r/react-native-push-notification - const isIOS = Platform.OS === "ios"; - if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) { - return Promise.reject(new Error("Notifications module is not available in your app")); + // Documentation Documentation https://github.com/invertase/notifee + if (NativeModules && !NativeModules.NotifeeApiModule) { + return Promise.reject(new Error("Notifee native module is not available in your app")); } if (!notificationId) { return Promise.reject(new Error("Input parameter 'Notification id' is required")); } - PushNotification.cancelLocalNotification(notificationId); + notifee.cancelNotification(notificationId); return Promise.resolve(); // END USER CODE diff --git a/packages/jsActions/mobile-resources-native/src/notifications/ClearAllDeliveredNotifications.ts b/packages/jsActions/mobile-resources-native/src/notifications/ClearAllDeliveredNotifications.ts index ba197fdfc..cd0debaed 100644 --- a/packages/jsActions/mobile-resources-native/src/notifications/ClearAllDeliveredNotifications.ts +++ b/packages/jsActions/mobile-resources-native/src/notifications/ClearAllDeliveredNotifications.ts @@ -5,8 +5,8 @@ // - 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 { NativeModules, Platform } from "react-native"; -import PushNotification from "react-native-push-notification"; +import { NativeModules } from "react-native"; +import notifee from "@notifee/react-native"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -17,13 +17,12 @@ import PushNotification from "react-native-push-notification"; */ export async function ClearAllDeliveredNotifications(): Promise { // BEGIN USER CODE - // Documentation https://github.com/zo0r/react-native-push-notification - const isIOS = Platform.OS === "ios"; - if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) { - return Promise.reject(new Error("Notifications module is not available in your app")); + // Documentation Documentation https://github.com/invertase/notifee + if (NativeModules && !NativeModules.NotifeeApiModule) { + return Promise.reject(new Error("Notifee native module is not available in your app")); } - PushNotification.removeAllDeliveredNotifications(); + notifee.cancelAllNotifications(); return Promise.resolve(); // END USER CODE diff --git a/packages/jsActions/mobile-resources-native/src/notifications/DisplayNotification.ts b/packages/jsActions/mobile-resources-native/src/notifications/DisplayNotification.ts index de1077f8e..bbfff2e5f 100644 --- a/packages/jsActions/mobile-resources-native/src/notifications/DisplayNotification.ts +++ b/packages/jsActions/mobile-resources-native/src/notifications/DisplayNotification.ts @@ -6,7 +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 { NativeModules, Platform } from "react-native"; -import PushNotification, { PushNotificationObject } from "react-native-push-notification"; +import notifee, { AndroidChannel, AndroidImportance, Notification } from "@notifee/react-native"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -32,59 +32,54 @@ export async function DisplayNotification( actionGuid?: string ): Promise { // BEGIN USER CODE - // Documentation https://github.com/zo0r/react-native-push-notification - - const isIOS = Platform.OS === "ios"; - if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) { - return Promise.reject(new Error("Notifications module is not available in your app")); + if (!body) { + throw new Error("Input parameter 'Body' is required"); } - if (!body) { - return Promise.reject(new Error("Input parameter 'Body' is required")); + // Documentation Documentation https://github.com/invertase/notifee + if (NativeModules && !NativeModules.NotifeeApiModule) { + return Promise.reject(new Error("Notifee native module is not available in your app")); } - const notification = { message: body } as PushNotificationObject; + const channelId = playSound ? "mendix-local-notifications-withsound" : "mendix-local-notifications"; + await createNotificationChannelIfNeeded(channelId); - if (!isIOS) { - const channelId = "mendix-local-notifications"; - const channelExists = await new Promise(resolve => - PushNotification.channelExists(channelId, (exists: boolean) => resolve(exists)) - ); - if (!channelExists) { - const channel = await new Promise(resolve => - PushNotification.createChannel( - { - channelId, - channelName: "Local notifications" - }, - created => resolve(created) - ) - ); - if (!channel) { - return Promise.reject(new Error("Could not create the local notifications channel")); - } - } - notification.channelId = channelId; - } + const notification: Notification = { + title: title || undefined, + body, + android: { channelId, sound: "default" }, + ios: playSound ? { sound: "default" } : {} + }; - if (title) { - notification.title = title; + if (subtitle && Platform.OS === "ios") { + notification.subtitle = subtitle; } - if (subtitle && !isIOS) { - notification.subText = subtitle; + if (actionName || actionGuid) { + notification.data = { + actionName: actionName ?? "", + guid: actionGuid ?? "" + }; } - notification.playSound = !!playSound; + await notifee.displayNotification(notification); - if (actionName || actionGuid) { - notification.userInfo = { - actionName, - guid: actionGuid + async function createNotificationChannelIfNeeded(channelId: string): Promise { + if (Platform.OS === "ios") { + return; + } + const existingChannel = await notifee.getChannel(channelId); + const channel: AndroidChannel = { + id: channelId, + name: "Local Notifications", + importance: AndroidImportance.HIGH, + ...(playSound ? { sound: "default" } : {}) }; + if (existingChannel === null) { + await notifee.createChannel(channel); + } } - PushNotification.localNotification(notification); return Promise.resolve(); // END USER CODE } diff --git a/packages/jsActions/mobile-resources-native/src/notifications/ScheduleNotification.ts b/packages/jsActions/mobile-resources-native/src/notifications/ScheduleNotification.ts index bf7e445ba..a0683e593 100644 --- a/packages/jsActions/mobile-resources-native/src/notifications/ScheduleNotification.ts +++ b/packages/jsActions/mobile-resources-native/src/notifications/ScheduleNotification.ts @@ -5,9 +5,15 @@ // - 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 { NativeModules, Platform } from "react-native"; -import PushNotification, { PushNotificationScheduleObject } from "react-native-push-notification"; - +import { Platform } from "react-native"; +import notifee, { + TimestampTrigger, + TriggerType, + AndroidChannel, + AndroidImportance, + Notification, + AlarmType +} from "@notifee/react-native"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -36,68 +42,59 @@ export async function ScheduleNotification( actionGuid?: string ): Promise { // BEGIN USER CODE - // Documentation https://github.com/zo0r/react-native-push-notification - - const isIOS = Platform.OS === "ios"; - if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) { - return Promise.reject(new Error("Notifications module is not available in your app")); - } + const channelId = playSound ? "mendix-local-notifications-withsound" : "mendix-local-notifications"; + await createNotificationChannelIfNeeded(channelId); if (!body) { - return Promise.reject(new Error("Input parameter 'Body' is required")); + throw new Error("Input parameter 'Body' is required"); } - const notification = { message: body } as PushNotificationScheduleObject; - const notificationIdNumber = Number(notificationId); - - if (!isIOS) { - const channelId = "mendix-local-notifications"; - const channelExists = await new Promise(resolve => - PushNotification.channelExists(channelId, (exists: boolean) => resolve(exists)) - ); - if (!channelExists) { - const channel = await new Promise(resolve => - PushNotification.createChannel( - { - channelId, - channelName: "Local notifications" - }, - created => resolve(created) - ) - ); - if (!channel) { - return Promise.reject(new Error("Could not create the local notifications channel")); - } - } - notification.channelId = channelId; + if (!date || !date.getTime()) { + throw new Error("Input parameter 'Date' is required and must be a valid Date object"); } - if (notificationIdNumber) { - notification.id = notificationIdNumber; - } + const trigger: TimestampTrigger = { + type: TriggerType.TIMESTAMP, + timestamp: date.getTime(), + alarmManager: { allowWhileIdle: true, type: AlarmType.SET_EXACT_AND_ALLOW_WHILE_IDLE } + }; - if (title) { - notification.title = title; - } + const notification: Notification = { + id: notificationId || undefined, + title: title || undefined, + body, + android: { + channelId + } + }; - if (subtitle && !isIOS) { - notification.subText = subtitle; + if (subtitle && Platform.OS === "ios") { + notification.subtitle = subtitle; } - notification.playSound = !!playSound; - if (actionName || actionGuid) { - notification.userInfo = { - actionName, - guid: actionGuid + notification.data = { + actionName: actionName ?? "", + guid: actionGuid ?? "" }; } - if (date && date.getTime()) { - notification.date = date; + async function createNotificationChannelIfNeeded(channelId: string): Promise { + if (Platform.OS === "ios") { + return; + } + const existingChannel = await notifee.getChannel(channelId); + const channel: AndroidChannel = { + id: channelId, + name: "Local Notifications", + importance: AndroidImportance.HIGH, + ...(playSound ? { sound: "default" } : {}) + }; + if (existingChannel === null) { + await notifee.createChannel(channel); + } } - PushNotification.localNotificationSchedule(notification); - return Promise.resolve(); + await notifee.createTriggerNotification(notification, trigger); // END USER CODE } diff --git a/packages/jsActions/mobile-resources-native/src/notifications/SetBadgeNumber.ts b/packages/jsActions/mobile-resources-native/src/notifications/SetBadgeNumber.ts index 30752a575..b59ad7989 100644 --- a/packages/jsActions/mobile-resources-native/src/notifications/SetBadgeNumber.ts +++ b/packages/jsActions/mobile-resources-native/src/notifications/SetBadgeNumber.ts @@ -6,8 +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 { NativeModules, Platform } from "react-native"; -import PushNotification from "react-native-push-notification"; +import { NativeModules } from "react-native"; +import notifee from "@notifee/react-native"; // BEGIN EXTRA CODE // END EXTRA CODE @@ -18,11 +18,10 @@ import PushNotification from "react-native-push-notification"; */ export async function SetBadgeNumber(badgeNumber?: Big): Promise { // BEGIN USER CODE - // Documentation https://github.com/zo0r/react-native-push-notification + // Documentation Documentation https://github.com/invertase/notifee - const isIOS = Platform.OS === "ios"; - if (NativeModules && isIOS && !NativeModules.RNCPushNotificationIOS) { - return Promise.reject(new Error("Notifications module is not available in your app")); + if (NativeModules && !NativeModules.NotifeeApiModule) { + return Promise.reject(new Error("Notifee native module is not available in your app")); } if (!badgeNumber) { @@ -33,7 +32,7 @@ export async function SetBadgeNumber(badgeNumber?: Big): Promise { return Promise.reject(new Error("Input parameter 'Badge number' should be zero or greater")); } - return PushNotification.setApplicationIconBadgeNumber(Number(badgeNumber)); + return notifee.setBadgeCount(badgeNumber as any as number); // END USER CODE } diff --git a/packages/jsActions/mobile-resources-native/typings/TouchID.d.ts b/packages/jsActions/mobile-resources-native/typings/TouchID.d.ts deleted file mode 100644 index 8aab38c7a..000000000 --- a/packages/jsActions/mobile-resources-native/typings/TouchID.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Source: https://github.com/naoufal/react-native-touch-id/blob/master/index.d.ts - * (Modified) - * - * Copyright (c) 2015, Naoufal Kadhom - * Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -declare module "react-native-touch-id" { - /** - * The supported biometry type - */ - type BiometryType = "FaceID" | "TouchID"; - - /** - * Base config to pass to `TouchID.isSupported` and `TouchID.authenticate` - */ - interface IsSupportedConfig { - /** - * Return unified error messages - */ - unifiedErrors?: boolean; - } - - /** - * Authentication config - */ - export interface AuthenticateConfig extends IsSupportedConfig { - /** - * **Android only** - Title of confirmation dialog - */ - title?: string; - /** - * **Android only** - Color of fingerprint image - */ - imageColor?: string; - /** - * **Android only** - Color of fingerprint image after failed attempt - */ - imageErrorColor?: string; - /** - * **Android only** - Text shown next to the fingerprint image - */ - sensorDescription?: string; - /** - * **Android only** - Text shown next to the fingerprint image after failed attempt - */ - sensorErrorDescription?: string; - /** - * **Android only** - Cancel button text - */ - cancelText?: string; - /** - * **iOS only** - By default specified 'Show Password' label. If set to empty string label is invisible. - */ - fallbackLabel?: string; - /** - * **iOS only** - By default set to false. If set to true, will allow use of keypad passcode. - */ - passcodeFallback?: boolean; - } - /** - * `isSupported` error code - */ - type IsSupportedErrorCode = "NOT_SUPPORTED" | "NOT_AVAILABLE" | "NOT_PRESENT" | "NOT_ENROLLED"; - - /** - * `authenticate` error code - */ - type AuthenticateErrorCode = - | IsSupportedErrorCode - | "AUTHENTICATION_FAILED" - | "USER_CANCELED" - | "SYSTEM_CANCELED" - | "TIMEOUT" - | "LOCKOUT" - | "LOCKOUT_PERMANENT" - | "PROCESSING_ERROR" - | "USER_FALLBACK" - | "UNKNOWN_ERROR"; - - /** - * Error returned from `authenticate` - */ - export interface AuthenticationError { - name: "TouchIDError"; - message: string; - code: AuthenticateErrorCode; - details: string; - } - /** - * Error returned from `isSupported` - */ - export interface IsSupportedError { - name: "TouchIDError"; - message: string; - code: IsSupportedErrorCode; - details: string; - } - - const TouchID: { - /** - * - * @param reason String that provides a clear reason for requesting authentication. - * @param config Configuration object for more detailed dialog setup - */ - authenticate(reason?: string, config?: AuthenticateConfig): Promise; - /** - * - * @param config - Returns a `Promise` that rejects if TouchID is not supported. On iOS resolves with a `biometryType` `String` of `FaceID` or `TouchID` - */ - isSupported(config?: IsSupportedConfig): Promise; - }; - export default TouchID; -} diff --git a/packages/pluggableWidgets/background-gradient-native/CHANGELOG.md b/packages/pluggableWidgets/background-gradient-native/CHANGELOG.md index c48f6cee3..1eb9cc7e1 100644 --- a/packages/pluggableWidgets/background-gradient-native/CHANGELOG.md +++ b/packages/pluggableWidgets/background-gradient-native/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +- Updated react-native-linear-gradient to latest version. + ## [2.1.0] - 2024-12-3 ### Changed diff --git a/packages/pluggableWidgets/background-gradient-native/package.json b/packages/pluggableWidgets/background-gradient-native/package.json index 533e4db62..74e6c6ecb 100644 --- a/packages/pluggableWidgets/background-gradient-native/package.json +++ b/packages/pluggableWidgets/background-gradient-native/package.json @@ -1,7 +1,7 @@ { "name": "background-gradient-native", "widgetName": "BackgroundGradient", - "version": "2.1.0", + "version": "2.2.0", "repository": { "type": "git", "url": "https://github.com/mendix/native-widgets.git" @@ -30,6 +30,6 @@ }, "dependencies": { "@mendix/piw-utils-internal": "*", - "react-native-linear-gradient": "2.5.6" + "react-native-linear-gradient": "2.8.3" } } diff --git a/packages/pluggableWidgets/background-gradient-native/src/package.xml b/packages/pluggableWidgets/background-gradient-native/src/package.xml index f8c80fdc7..7ae868b45 100644 --- a/packages/pluggableWidgets/background-gradient-native/src/package.xml +++ b/packages/pluggableWidgets/background-gradient-native/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/packages/pluggableWidgets/bottom-sheet-native/CHANGELOG.md b/packages/pluggableWidgets/bottom-sheet-native/CHANGELOG.md index 8bb1cfe2e..ab4e97380 100644 --- a/packages/pluggableWidgets/bottom-sheet-native/CHANGELOG.md +++ b/packages/pluggableWidgets/bottom-sheet-native/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +- Updated react-native-device-info to latest version. + ## [5.0.0] - 2025-3-31 ### Changed diff --git a/packages/pluggableWidgets/bottom-sheet-native/package.json b/packages/pluggableWidgets/bottom-sheet-native/package.json index 0483b66c8..b741239b7 100644 --- a/packages/pluggableWidgets/bottom-sheet-native/package.json +++ b/packages/pluggableWidgets/bottom-sheet-native/package.json @@ -1,7 +1,7 @@ { "name": "bottom-sheet-native", "widgetName": "BottomSheet", - "version": "5.0.0", + "version": "5.0.1", "license": "Apache-2.0", "repository": { "type": "git", @@ -23,7 +23,7 @@ "@mendix/piw-native-utils-internal": "*", "@mendix/piw-utils-internal": "*", "@shopify/flash-list": "1.7.3", - "react-native-device-info": "13.0.0", + "react-native-device-info": "14.0.4", "react-native-gesture-handler": "2.24.0", "react-native-reanimated": "3.16.1" }, diff --git a/packages/pluggableWidgets/bottom-sheet-native/src/package.xml b/packages/pluggableWidgets/bottom-sheet-native/src/package.xml index c92801bb3..c4f1be9f3 100644 --- a/packages/pluggableWidgets/bottom-sheet-native/src/package.xml +++ b/packages/pluggableWidgets/bottom-sheet-native/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/packages/pluggableWidgets/gallery-native/CHANGELOG.md b/packages/pluggableWidgets/gallery-native/CHANGELOG.md index a43eb8433..b02304cc2 100644 --- a/packages/pluggableWidgets/gallery-native/CHANGELOG.md +++ b/packages/pluggableWidgets/gallery-native/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [2.0.0] - 2024-12-3 +- Updated react-native-device-info to latest version. + ### Changed - Updated @mendix/pluggable-widgets-tools from version v9.0.0 to v10.15.0. diff --git a/packages/pluggableWidgets/gallery-native/package.json b/packages/pluggableWidgets/gallery-native/package.json index 9cde4741e..8da5bc9d7 100644 --- a/packages/pluggableWidgets/gallery-native/package.json +++ b/packages/pluggableWidgets/gallery-native/package.json @@ -1,7 +1,7 @@ { "name": "gallery-native", "widgetName": "Gallery", - "version": "2.0.0", + "version": "2.0.1", "description": "A flexible gallery widget that renders columns, rows and layouts.", "copyright": "© Mendix Technology BV 2022. All rights reserved.", "license": "Apache-2.0", @@ -29,7 +29,7 @@ }, "dependencies": { "@mendix/piw-utils-internal": "*", - "react-native-device-info": "13.0.0" + "react-native-device-info": "14.0.4" }, "devDependencies": { "@mendix/pluggable-widgets-tools": "~10.0.1", diff --git a/packages/pluggableWidgets/gallery-native/src/package.xml b/packages/pluggableWidgets/gallery-native/src/package.xml index eb13e1580..80b03d697 100644 --- a/packages/pluggableWidgets/gallery-native/src/package.xml +++ b/packages/pluggableWidgets/gallery-native/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/packages/pluggableWidgets/intro-screen-native/CHANGELOG.md b/packages/pluggableWidgets/intro-screen-native/CHANGELOG.md index fd233833f..7dacc5273 100644 --- a/packages/pluggableWidgets/intro-screen-native/CHANGELOG.md +++ b/packages/pluggableWidgets/intro-screen-native/CHANGELOG.md @@ -6,12 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +- Updated react-native-device-info to latest version. + ### Fixed - We have fixed defaultProps deprecation warning. ## [4.0.0] - 2024-12-3 +- Updated react-native-device-info to latest version. + ### Changed - Updated @mendix/pluggable-widgets-tools from version v9.0.0 to v10.15.0. diff --git a/packages/pluggableWidgets/intro-screen-native/package.json b/packages/pluggableWidgets/intro-screen-native/package.json index 767d90b26..bf3feb715 100644 --- a/packages/pluggableWidgets/intro-screen-native/package.json +++ b/packages/pluggableWidgets/intro-screen-native/package.json @@ -1,7 +1,7 @@ { "name": "intro-screen-native", "widgetName": "IntroScreen", - "version": "4.0.1", + "version": "4.1.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -28,7 +28,7 @@ "@mendix/piw-native-utils-internal": "*", "@mendix/piw-utils-internal": "*", "@react-native-async-storage/async-storage": "2.0.0", - "react-native-device-info": "13.0.0" + "react-native-device-info": "14.0.4" }, "devDependencies": { "@mendix/pluggable-widgets-tools": "~10.0.1", diff --git a/packages/pluggableWidgets/intro-screen-native/src/package.xml b/packages/pluggableWidgets/intro-screen-native/src/package.xml index e6a128883..34d0ef2ea 100644 --- a/packages/pluggableWidgets/intro-screen-native/src/package.xml +++ b/packages/pluggableWidgets/intro-screen-native/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/packages/pluggableWidgets/notifications-native/CHANGELOG.md b/packages/pluggableWidgets/notifications-native/CHANGELOG.md index eedb8ae3c..4d6cee63d 100644 --- a/packages/pluggableWidgets/notifications-native/CHANGELOG.md +++ b/packages/pluggableWidgets/notifications-native/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +- The widget has been migrated to notifee. + ## [4.1.0] - 2024-12-3 ### Changed diff --git a/packages/pluggableWidgets/notifications-native/package.json b/packages/pluggableWidgets/notifications-native/package.json index adc991592..4c4807592 100644 --- a/packages/pluggableWidgets/notifications-native/package.json +++ b/packages/pluggableWidgets/notifications-native/package.json @@ -1,7 +1,7 @@ { "name": "notifications-native", "widgetName": "Notifications", - "version": "4.1.0", + "version": "5.0.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -19,9 +19,9 @@ }, "dependencies": { "@mendix/piw-utils-internal": "*", + "@notifee/react-native": "9.1.8", "@react-native-firebase/app": "17.3.0", - "@react-native-firebase/messaging": "17.3.0", - "react-native-push-notification": "8.1.1" + "@react-native-firebase/messaging": "17.3.0" }, "devDependencies": { "@mendix/pluggable-widgets-tools": "~10.0.1", diff --git a/packages/pluggableWidgets/notifications-native/src/Notifications.tsx b/packages/pluggableWidgets/notifications-native/src/Notifications.tsx index 9518cfdf9..1d71686f0 100644 --- a/packages/pluggableWidgets/notifications-native/src/Notifications.tsx +++ b/packages/pluggableWidgets/notifications-native/src/Notifications.tsx @@ -1,19 +1,14 @@ import messaging, { FirebaseMessagingTypes } from "@react-native-firebase/messaging"; -import PushNotification, { ReceivedNotification } from "react-native-push-notification"; import { executeAction } from "@mendix/piw-utils-internal"; import { useCallback, useEffect, useRef, useState } from "react"; import { Platform } from "react-native"; import { ActionValue, ValueStatus, Option } from "mendix"; import "@react-native-firebase/app"; +import notifee, { EventType } from "@notifee/react-native"; import { ActionsType, NotificationsProps } from "../typings/NotificationsProps"; // re-declare the library's type because: 1) it doesn't match library version 2) the definition file exports two symbols with same name. -interface IPushNotification extends ReceivedNotification { - title: string; - message: string; -} - interface ActionData { actionName?: string; guid?: string; @@ -110,22 +105,27 @@ export function Notifications(props: NotificationsProps): null { // wait for all used DynamicValues are available before configuring, else handleNotification is invoked while // properties in scope are loading. if (loadNotifications) { - PushNotification.configure({ - // called when user taps local notification - onNotification(notification: IPushNotification) { - const messageId = notification.data[Platform.OS === "ios" ? "gcm.message_id" : "google.message_id"]; + // Handle notifications when the app is in the foreground + notifee.onForegroundEvent(({ type, detail }) => { + if (type === EventType.PRESS) { + const notification = detail.notification; + if (notification === undefined || notification.data === undefined) { + console.log("notificaiton is not exist"); + return; + } + const messageId = + notification.data?.[Platform.OS === "ios" ? "gcm.message_id" : "google.message_id"]; handleNotification( { data: notification.data, title: notification.title, - body: notification.message, - subTitle: notification.subText + body: notification.body, + subTitle: notification.subtitle }, action => action.onOpen, - messageId + messageId as any ); - }, - requestPermissions: Platform.OS === "ios" + } }); } }, [loadNotifications, handleNotification]); diff --git a/packages/pluggableWidgets/notifications-native/src/package.xml b/packages/pluggableWidgets/notifications-native/src/package.xml index 01942a958..f9b7fcb99 100644 --- a/packages/pluggableWidgets/notifications-native/src/package.xml +++ b/packages/pluggableWidgets/notifications-native/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/yarn.lock b/yarn.lock index 8797fc0b5..367a72640 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2587,6 +2587,15 @@ __metadata: languageName: node linkType: hard +"@notifee/react-native@npm:9.1.8": + version: 9.1.8 + resolution: "@notifee/react-native@npm:9.1.8" + peerDependencies: + react-native: "*" + checksum: 10/7c5237fba99906d8da02146afbfe8ff6de9f4047eecd806dea889bfd76b1cfe7ad3c181881bf2729aa348b83e035f4d02cfc3ac8eb8c4ba3a4415b445b439c38 + languageName: node + linkType: hard + "@npmcli/agent@npm:^3.0.0": version: 3.0.0 resolution: "@npmcli/agent@npm:3.0.0" @@ -2986,18 +2995,6 @@ __metadata: languageName: node linkType: hard -"@react-native-community/push-notification-ios@npm:1.10.1": - version: 1.10.1 - resolution: "@react-native-community/push-notification-ios@npm:1.10.1" - dependencies: - invariant: "npm:^2.2.4" - peerDependencies: - react: ">=16.6.3" - react-native: ">=0.58.4" - checksum: 10/5b02066ebad4200957bbb60634d42f4a2ea647d9d84d69adcf6fa71acf72063110d2f7b7b1e45d4153d94a3592806f5de9626fb33897707197c03a14ea299a55 - languageName: node - linkType: hard - "@react-native-firebase/app@npm:17.3.0": version: 17.3.0 resolution: "@react-native-firebase/app@npm:17.3.0" @@ -3421,7 +3418,7 @@ __metadata: languageName: node linkType: hard -"@swan-io/react-native-browser@npm:^0.4.1": +"@swan-io/react-native-browser@npm:0.4.1": version: 0.4.1 resolution: "@swan-io/react-native-browser@npm:0.4.1" peerDependencies: @@ -4016,13 +4013,6 @@ __metadata: languageName: node linkType: hard -"@types/react-native-push-notification@npm:8.1.1": - version: 8.1.1 - resolution: "@types/react-native-push-notification@npm:8.1.1" - checksum: 10/67606daf7cd38e1e8d7d82dee49741ebe8cf59cd2002579ba287ce9e98c461d11f84cf746f90cbbb7884701fe9bc758673ef2d9559cb0c73ca82307952558199 - languageName: node - linkType: hard - "@types/react-native-snap-carousel@npm:^3.7.4": version: 3.8.11 resolution: "@types/react-native-snap-carousel@npm:3.8.11" @@ -5147,7 +5137,7 @@ __metadata: "@mendix/piw-utils-internal": "npm:*" "@mendix/pluggable-widgets-tools": "npm:~10.0.1" eslint: "npm:^7.32.0" - react-native-linear-gradient: "npm:2.5.6" + react-native-linear-gradient: "npm:2.8.3" languageName: unknown linkType: soft @@ -5284,7 +5274,7 @@ __metadata: "@types/react-native-actionsheet": "npm:^2.4.1" "@types/react-native-modal": "npm:^4.1.1" eslint: "npm:^7.32.0" - react-native-device-info: "npm:13.0.0" + react-native-device-info: "npm:14.0.4" react-native-gesture-handler: "npm:2.24.0" react-native-reanimated: "npm:3.16.1" languageName: unknown @@ -8290,7 +8280,7 @@ __metadata: "@mendix/piw-utils-internal": "npm:*" "@mendix/pluggable-widgets-tools": "npm:~10.0.1" eslint: "npm:^7.32.0" - react-native-device-info: "npm:13.0.0" + react-native-device-info: "npm:14.0.4" languageName: unknown linkType: soft @@ -9111,7 +9101,7 @@ __metadata: "@mendix/pluggable-widgets-tools": "npm:~10.0.1" "@react-native-async-storage/async-storage": "npm:2.0.0" eslint: "npm:^7.32.0" - react-native-device-info: "npm:13.0.0" + react-native-device-info: "npm:14.0.4" languageName: unknown linkType: soft @@ -12128,27 +12118,25 @@ __metadata: resolution: "mobile-resources-native@workspace:packages/jsActions/mobile-resources-native" dependencies: "@mendix/pluggable-widgets-tools": "npm:^10.0.1" + "@notifee/react-native": "npm:9.1.8" "@react-native-camera-roll/camera-roll": "npm:7.4.0" - "@react-native-community/push-notification-ios": "npm:1.10.1" "@react-native-firebase/messaging": "npm:17.3.0" - "@swan-io/react-native-browser": "npm:^0.4.1" + "@swan-io/react-native-browser": "npm:0.4.1" "@types/querystringify": "npm:^2.0.0" - "@types/react-native-push-notification": "npm:8.1.1" "@types/url-parse": "npm:^1.4.3" eslint: "npm:^7.32.0" fbjs: "npm:3.0.4" mendix: "npm:~10.0.9976" mime: "npm:3.0.0" + react-native-biometrics: "npm:3.0.1" react-native-blob-util: "npm:0.21.2" - react-native-device-info: "npm:13.0.0" + react-native-device-info: "npm:14.0.4" react-native-file-viewer: "npm:2.1.5" react-native-image-picker: "npm:7.2.3" react-native-localize: "npm:3.2.1" react-native-permissions: "npm:4.1.5" - react-native-push-notification: "npm:8.1.1" react-native-schedule-exact-alarm-permission: "npm:^0.1.3" react-native-sound: "npm:0.11.0" - react-native-touch-id: "npm:4.4.1" rimraf: "npm:^4.4.1" rollup: "npm:^2.79.2" url-parse: "npm:^1.4.7" @@ -12500,10 +12488,10 @@ __metadata: dependencies: "@mendix/piw-utils-internal": "npm:*" "@mendix/pluggable-widgets-tools": "npm:~10.0.1" + "@notifee/react-native": "npm:9.1.8" "@react-native-firebase/app": "npm:17.3.0" "@react-native-firebase/messaging": "npm:17.3.0" eslint: "npm:^7.32.0" - react-native-push-notification: "npm:8.1.1" languageName: unknown linkType: soft @@ -14079,6 +14067,15 @@ __metadata: languageName: node linkType: hard +"react-native-biometrics@npm:3.0.1": + version: 3.0.1 + resolution: "react-native-biometrics@npm:3.0.1" + peerDependencies: + react-native: ">=0.60.0" + checksum: 10/abbbe0b4ba0470ae6b8acdc9f1914b8356349096c58abd3b195d832ae7f007b9876191d08dd88b27c1cc9b69a43f4cd3b320307cd7f066e4475da4dfd696e198 + languageName: node + linkType: hard + "react-native-blob-util@npm:0.21.2": version: 0.21.2 resolution: "react-native-blob-util@npm:0.21.2" @@ -14115,12 +14112,12 @@ __metadata: languageName: node linkType: hard -"react-native-device-info@npm:13.0.0": - version: 13.0.0 - resolution: "react-native-device-info@npm:13.0.0" +"react-native-device-info@npm:14.0.4": + version: 14.0.4 + resolution: "react-native-device-info@npm:14.0.4" peerDependencies: react-native: "*" - checksum: 10/56cf41aa1d533d81b182973939cc3663285c7a6a93e6465b88feedefc1a7809a5d937f3588e145a445a1e0a74eda8242a46e1e67b33753909ad71e3e1216aeb1 + checksum: 10/bf031048551597b1a9ab2965d498cbd073eacf50005dffa4e3496286578734a45854141d47654e7e58ef8531b8c2cd6d1670bfd75625271c91aab3b3b8d0a8d8 languageName: node linkType: hard @@ -14183,12 +14180,13 @@ __metadata: languageName: node linkType: hard -"react-native-linear-gradient@npm:2.5.6": - version: 2.5.6 - resolution: "react-native-linear-gradient@npm:2.5.6" +"react-native-linear-gradient@npm:2.8.3": + version: 2.8.3 + resolution: "react-native-linear-gradient@npm:2.8.3" peerDependencies: - react-native: ">=0.55" - checksum: 10/a3ab9806b99c68b697c1240a288117a48ea6e070f515fd17d39935d24fb046f0a99964158b995f3daecfbbcad16dfb63f13b3840fa830d36d7c47563aa563a08 + react: "*" + react-native: "*" + checksum: 10/db18c7ae4b68afe8b6f12c67defeeccda7a3cff4ee14a0b2d92ff2581d53bd2e65bf29837cf2828abb3d8d1f3cef3f808e8cc1c5d4c8da5dd6f1d09e2b9c2c55 languageName: node linkType: hard @@ -14270,16 +14268,6 @@ __metadata: languageName: node linkType: hard -"react-native-push-notification@npm:8.1.1": - version: 8.1.1 - resolution: "react-native-push-notification@npm:8.1.1" - peerDependencies: - "@react-native-community/push-notification-ios": ^1.10.1 - react-native: ">=0.33" - checksum: 10/c03b517743b1a5bf022e7c0c0ee2001bad9478d384c6e05ec926b81ca21125dd72ccdb28930386e8bb2b26701369921e764e8a196ed113f208d9ef37c5c6d9c7 - languageName: node - linkType: hard - "react-native-qrcode-svg@npm:6.0.6": version: 6.0.6 resolution: "react-native-qrcode-svg@npm:6.0.6" @@ -14398,13 +14386,6 @@ __metadata: languageName: node linkType: hard -"react-native-touch-id@npm:4.4.1": - version: 4.4.1 - resolution: "react-native-touch-id@npm:4.4.1" - checksum: 10/68973f838a42077fb3b7a7b5f1855f92d9aab82474f566c8f22a6354c9257fb489a221b2e4ff82d549bc2f2caa5335fbd196b23bdf0b197fa2eb27f1c90f6302 - languageName: node - linkType: hard - "react-native-vector-icons@npm:10.2.0": version: 10.2.0 resolution: "react-native-vector-icons@npm:10.2.0"