forked from simonmartyr/MxPushNotifications
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from mendix/release/7.1.0
Update module and test project to v7.1.0
- Loading branch information
Showing
141 changed files
with
4,516 additions
and
2,193 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file not shown.
4 changes: 2 additions & 2 deletions
4
test/javascriptsource/nativemobileresources/actions/CancelAllScheduledNotifications.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
test/javascriptsource/nativemobileresources/actions/CancelScheduledNotification.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
test/javascriptsource/nativemobileresources/actions/ClearAllDeliveredNotifications.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
test/javascriptsource/nativemobileresources/actions/DisplayNotification.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
test/javascriptsource/nativemobileresources/actions/DownloadFile.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,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 | ||
} |
6 changes: 6 additions & 0 deletions
6
test/javascriptsource/nativemobileresources/actions/DownloadFile.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,6 @@ | ||
{ | ||
"nativeDependencies": { | ||
"react-native-blob-util": "0.16.2", | ||
"react-native-file-viewer": "2.1.5" | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
test/javascriptsource/nativemobileresources/actions/GetDeviceInfo.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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"nativeDependencies": { | ||
"react-native-localize": "1.3.4", | ||
"react-native-device-info": "8.0.1" | ||
"react-native-localize": "1.3.4" | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
test/javascriptsource/nativemobileresources/actions/GetPushNotificationToken.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
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
59 changes: 59 additions & 0 deletions
59
test/javascriptsource/nativemobileresources/actions/RequestGenericPermission.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,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 | ||
} |
5 changes: 5 additions & 0 deletions
5
test/javascriptsource/nativemobileresources/actions/RequestGenericPermission.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-permissions": "3.3.1" | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
test/javascriptsource/nativemobileresources/actions/RequestNotificationPermission.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
test/javascriptsource/nativemobileresources/actions/ScheduleNotification.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
test/javascriptsource/nativemobileresources/actions/SetBadgeNumber.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
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
3 changes: 2 additions & 1 deletion
3
test/javascriptsource/nativemobileresources/actions/TakePicture.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
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
3 changes: 2 additions & 1 deletion
3
test/javascriptsource/nativemobileresources/actions/TakePictureAdvanced.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 |
---|---|---|
@@ -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" | ||
} | ||
} |
Oops, something went wrong.