Skip to content

Commit

Permalink
Merge pull request #103 from mendix/release/7.1.0
Browse files Browse the repository at this point in the history
Update module and test project to v7.1.0
  • Loading branch information
pratikgoyal9 authored Jan 17, 2023
2 parents da1d146 + d1fdb5f commit 921e2a8
Show file tree
Hide file tree
Showing 141 changed files with 4,516 additions and 2,193 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'com.github.ben-manes.versions'

project.ext {
PNC_VERSION = '7.0.0'
PNC_VERSION = '7.1.0'
MXBUILD_VERSION = '9.18.0.53394'
MODULE_NAME = 'PushNotifications'
}
Expand Down Expand Up @@ -67,19 +67,19 @@ dependencies {

implementation('io.netty:netty-codec-http2') {
version {
strictly '4.1.78.Final'
strictly '4.1.86.Final'
}
}

implementation('io.netty:netty-handler-proxy') {
version {
strictly '4.1.78.Final'
strictly '4.1.86.Final'
}
}

implementation('io.netty:netty-resolver-dns') {
version {
strictly '4.1.78.Final'
strictly '4.1.86.Final'
}
}

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.0.0",
"version": "7.1.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.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.2",
"@react-native-community/push-notification-ios": "1.8.0"
"react-native-push-notification": "6.1.3",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.2",
"@react-native-community/push-notification-ios": "1.8.0"
"react-native-push-notification": "6.1.3",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.2",
"@react-native-community/push-notification-ios": "1.8.0"
"react-native-push-notification": "6.1.3",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.2",
"@react-native-community/push-notification-ios": "1.8.0"
"react-native-push-notification": "6.1.3",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// 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 { Platform } from 'react-native';
import RNBlobUtil from 'react-native-blob-util';
import FileViewer from 'react-native-file-viewer';
import mimeTypes from 'mime';

// BEGIN EXTRA CODE
function formatPath(...pathArgs) {
return pathArgs.filter(arg => !!arg).join("/");
}
function sanitizeFileName(name) {
/* eslint-disable-next-line no-control-regex */
return name.replace(/[<>"?:|*/\\\u0000-\u001F\u007F]/g, "_");
}
async function getUniqueFilePath(path, fileName) {
const insertionIndex = fileName.lastIndexOf(".");
const fileNameWithoutExtension = fileName.substring(0, insertionIndex);
const extension = fileName.substring(insertionIndex);
let uniqueFilePath = formatPath(path, fileName);
let version = 0;
while (await RNBlobUtil.fs.exists(uniqueFilePath)) {
uniqueFilePath = formatPath(path, `${fileNameWithoutExtension} (${++version})${extension}`);
}
return uniqueFilePath;
}
// END EXTRA CODE

/**
* @param {MxObject} file
* @param {boolean} openWithOS - Set to True to let the OS open the file and ask the user with which applciation.
Set to False if the file only needs to be saved to the device storage.
* @returns {Promise.<void>}
*/
export async function DownloadFile(file, openWithOS) {
// BEGIN USER CODE
if (!file) {
return Promise.reject(new Error("Input parameter 'file' is required"));
}
const dirs = RNBlobUtil.fs.dirs;
const fileName = file.get("Name");
const mimeType = mimeTypes.getType(fileName);
const sanitizedFileName = sanitizeFileName(fileName);
const baseDir = Platform.OS === "ios" ? dirs.DocumentDir : dirs.DownloadDir;
const filePath = mx.data.getDocumentUrl(file.getGuid(), Number(file.get("changedDate")));
let accessiblePath;
if (Platform.OS === "ios") {
accessiblePath = await getUniqueFilePath(baseDir, sanitizedFileName);
await RNBlobUtil.fs.cp(filePath, accessiblePath);
}
else {
accessiblePath = await RNBlobUtil.MediaCollection.copyToMediaStore({
name: sanitizedFileName,
mimeType: mimeType !== null && mimeType !== void 0 ? mimeType : "*",
parentFolder: ""
}, "Download", filePath);
}
if (openWithOS) {
await FileViewer.open(accessiblePath, {
showOpenWithDialog: true,
showAppsSuggestions: true
});
}
// END USER CODE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"nativeDependencies": {
"react-native-blob-util": "0.16.2",
"react-native-file-viewer": "2.1.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"nativeDependencies": {
"react-native-localize": "1.3.4",
"react-native-device-info": "8.0.1"
"react-native-localize": "1.3.4"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"nativeDependencies": {
"@react-native-firebase/messaging": "10.5.1",
"@react-native-firebase/app": "10.1.0"
"@react-native-firebase/messaging": "15.7.0",
"@react-native-firebase/app": "15.7.0",
"@expo/config-plugins": "5.0.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ 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 */];
if (NativeModules && !NativeModules.RNFBMessagingModule) {
return Promise.reject(new Error("Firebase module is not available in your app"));
}
return NativeModules.RNFBMessagingModule.hasPermission().then((authStatus) => {
if (authStatus) {
if (allowedAuthorizationStatuses.includes(authStatus)) {
return Promise.resolve(true);
}
else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// 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 { Alert, Platform } from 'react-native';
import { check, RESULTS, request, openSettings, PERMISSIONS } from 'react-native-permissions';

// BEGIN EXTRA CODE
function handleBlockedPermission(permission) {
const permissionName = permission.replace(/_IOS|_ANDROID/, "");
Alert.alert("", `Please allow ${permissionName} access`, [
{ text: "go to settings", onPress: () => openSettings() },
{ text: "cancel" }
]);
}
function mapPermissionName(permissionName) {
if (Platform.OS === "ios") {
const nameWithoutSuffix = permissionName.replace("_IOS", "");
return PERMISSIONS.IOS[nameWithoutSuffix];
}
else if (Platform.OS === "android") {
const nameWithoutSuffix = permissionName.replace("_ANDROID", "");
return PERMISSIONS.ANDROID[nameWithoutSuffix];
}
}
// END EXTRA CODE

/**
* @param {"NativeMobileResources.Enum_Permissions.APP_TRACKING_TRANSPARENCY_IOS"|"NativeMobileResources.Enum_Permissions.BLUETOOTH_PERIPHERAL_IOS"|"NativeMobileResources.Enum_Permissions.CAMERA_IOS"|"NativeMobileResources.Enum_Permissions.CALENDARS_IOS"|"NativeMobileResources.Enum_Permissions.CONTACTS_IOS"|"NativeMobileResources.Enum_Permissions.FACE_ID_IOS"|"NativeMobileResources.Enum_Permissions.LOCATION_ALWAYS_IOS"|"NativeMobileResources.Enum_Permissions.LOCATION_WHEN_IN_USE_IOS"|"NativeMobileResources.Enum_Permissions.MEDIA_LIBRARY_IOS"|"NativeMobileResources.Enum_Permissions.MICROPHONE_IOS"|"NativeMobileResources.Enum_Permissions.MOTION_IOS"|"NativeMobileResources.Enum_Permissions.PHOTO_LIBRARY_IOS"|"NativeMobileResources.Enum_Permissions.PHOTO_LIBRARY_ADD_ONLY_IOS"|"NativeMobileResources.Enum_Permissions.REMINDERS_IOS"|"NativeMobileResources.Enum_Permissions.SIRI_IOS"|"NativeMobileResources.Enum_Permissions.SPEECH_RECOGNITION_IOS"|"NativeMobileResources.Enum_Permissions.STOREKIT_IOS"|"NativeMobileResources.Enum_Permissions.ACCEPT_HANDOVER_ANDROID"|"NativeMobileResources.Enum_Permissions.ACCESS_BACKGROUND_LOCATION_ANDROID"|"NativeMobileResources.Enum_Permissions.ACCESS_COARSE_LOCATION_ANDROID"|"NativeMobileResources.Enum_Permissions.ACCESS_FINE_LOCATION_ANDROID"|"NativeMobileResources.Enum_Permissions.ACCESS_MEDIA_LOCATION_ANDROID"|"NativeMobileResources.Enum_Permissions.ACTIVITY_RECOGNITION_ANDROID"|"NativeMobileResources.Enum_Permissions.ADD_VOICEMAIL_ANDROID"|"NativeMobileResources.Enum_Permissions.ANSWER_PHONE_CALLS_ANDROID"|"NativeMobileResources.Enum_Permissions.BLUETOOTH_ADVERTISE_ANDROID"|"NativeMobileResources.Enum_Permissions.BLUETOOTH_CONNECT_ANDROID"|"NativeMobileResources.Enum_Permissions.BLUETOOTH_SCAN_ANDROID"|"NativeMobileResources.Enum_Permissions.BODY_SENSORS_ANDROID"|"NativeMobileResources.Enum_Permissions.CALL_PHONE_ANDROID"|"NativeMobileResources.Enum_Permissions.CAMERA_ANDROID"|"NativeMobileResources.Enum_Permissions.GET_ACCOUNTS_ANDROID"|"NativeMobileResources.Enum_Permissions.PROCESS_OUTGOING_CALLS_ANDROID"|"NativeMobileResources.Enum_Permissions.READ_CALENDAR_ANDROID"|"NativeMobileResources.Enum_Permissions.READ_CALL_LOG_ANDROID"|"NativeMobileResources.Enum_Permissions.READ_CONTACTS_ANDROID"|"NativeMobileResources.Enum_Permissions.READ_EXTERNAL_STORAGE_ANDROID"|"NativeMobileResources.Enum_Permissions.READ_PHONE_NUMBERS_ANDROID"|"NativeMobileResources.Enum_Permissions.READ_PHONE_STATE_ANDROID"|"NativeMobileResources.Enum_Permissions.READ_SMS_ANDROID"|"NativeMobileResources.Enum_Permissions.RECEIVE_MMS_ANDROID"|"NativeMobileResources.Enum_Permissions.RECEIVE_SMS_ANDROID"|"NativeMobileResources.Enum_Permissions.RECEIVE_WAP_PUSH_ANDROID"|"NativeMobileResources.Enum_Permissions.RECORD_AUDIO_ANDROID"|"NativeMobileResources.Enum_Permissions.SEND_SMS_ANDROID"|"NativeMobileResources.Enum_Permissions.USE_SIP_ANDROID"|"NativeMobileResources.Enum_Permissions.WRITE_CALENDAR_ANDROID"|"NativeMobileResources.Enum_Permissions.WRITE_CALL_LOG_ANDROID"|"NativeMobileResources.Enum_Permissions.WRITE_CONTACTS_ANDROID"|"NativeMobileResources.Enum_Permissions.WRITE_EXTERNAL_STORAGE_ANDROID"} permission - This field is required.
* @returns {Promise.<"NativeMobileResources.Enum_PermissionStatus.unavailable"|"NativeMobileResources.Enum_PermissionStatus.denied"|"NativeMobileResources.Enum_PermissionStatus.limited"|"NativeMobileResources.Enum_PermissionStatus.granted"|"NativeMobileResources.Enum_PermissionStatus.blocked">}
*/
export async function RequestGenericPermission(permission) {
// BEGIN USER CODE
if (!permission) {
return Promise.reject(new Error("Input parameter 'permission' is required"));
}
const mappedPermissionName = mapPermissionName(permission);
if (!mappedPermissionName) {
console.error(`${permission} permission is not found`);
return Promise.resolve("unavailable");
}
const permissionStatus = await check(mappedPermissionName);
switch (permissionStatus) {
case RESULTS.GRANTED:
case RESULTS.UNAVAILABLE:
case RESULTS.LIMITED:
return permissionStatus;
case RESULTS.BLOCKED:
handleBlockedPermission(permission);
return RESULTS.BLOCKED;
case RESULTS.DENIED:
return request(mappedPermissionName);
}
// END USER CODE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"nativeDependencies": {
"react-native-permissions": "3.3.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"nativeDependencies": {
"@react-native-firebase/messaging": "10.5.1",
"@react-native-firebase/app": "10.1.0"
"@react-native-firebase/messaging": "15.7.0",
"@react-native-firebase/app": "15.7.0",
"@expo/config-plugins": "5.0.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.2",
"@react-native-community/push-notification-ios": "1.8.0"
"react-native-push-notification": "6.1.3",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nativeDependencies": {
"react-native-push-notification": "6.1.2",
"@react-native-community/push-notification-ios": "1.8.0"
"react-native-push-notification": "6.1.3",
"@react-native-community/push-notification-ios": "1.10.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function TakePicture(picture, pictureSource, pictureQuality, maximu
}
// V3 dropped the feature of providing an action sheet so users can decide on which action to take, camera or library.
const nativeVersionMajor = NativeModules.ImagePickerManager.showImagePicker ? 2 : 4;
const RNPermissions = nativeVersionMajor === 4 ? require("react-native-permissions") : null;
const RNPermissions = nativeVersionMajor === 4 ? (await import('react-native-permissions')).default : null;
try {
const uri = await takePicture();
if (!uri) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"nativeDependencies": {
"react-native-image-picker": "4.0.3",
"react-native-localize": "1.3.4"
"react-native-localize": "1.3.4",
"react-native-permissions": "3.3.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function TakePictureAdvanced(picture, pictureSource, pictureQuality
}
// V3 dropped the feature of providing an action sheet so users can decide on which action to take, camera or library.
const nativeVersionMajor = NativeModules.ImagePickerManager.showImagePicker ? 2 : 4;
const RNPermissions = nativeVersionMajor === 4 ? require("react-native-permissions") : null;
const RNPermissions = nativeVersionMajor === 4 ? (await import('react-native-permissions')).default : null;
const resultObject = await createMxObject("NativeMobileResources.ImageMetaData");
try {
let response = await takePicture();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"nativeDependencies": {
"react-native-image-picker": "4.0.3",
"react-native-localize": "1.3.4"
"react-native-localize": "1.3.4",
"react-native-permissions": "3.3.1"
}
}
Loading

0 comments on commit 921e2a8

Please sign in to comment.