Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/e2e/native_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"react-native-file-viewer-turbo": "0.6.0",
"react-native-localize": "3.2.1",
"react-native-image-picker": "7.2.3",
"react-native-permissions": "4.1.5",
"react-native-permissions": "5.4.2",
"react-native-webview": "13.13.2"
}
42 changes: 31 additions & 11 deletions configs/jsactions/rollup-plugin-collect-dependencies.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import fg from "fast-glob";
import fsExtra from "fs-extra";
import { existsSync, readFileSync, writeFileSync } from "fs";
import { existsSync, readFileSync, writeFileSync, cpSync, lstatSync, realpathSync } from "fs";
import { dirname, join, parse } from "path";
import copy from "recursive-copy";
import { promisify } from "util";
import resolve from "resolve";
import _ from "lodash";
Expand Down Expand Up @@ -172,15 +171,36 @@ export async function copyJsModule(moduleSourcePath, to) {
if (existsSync(to)) {
return;
}
return promisify(copy)(moduleSourcePath, to, {
filter: [
"**/*.*",
LICENSE_GLOB,
"!**/{android,ios,windows,mac,jest,github,gradle,__*__,docs,jest,example*}/**/*",
"!**/*.{config,setup}.*",
"!**/*.{podspec,flow}"
],
overwrite: true

// Check if the source is a symlink and resolve it to the actual path
let actualSourcePath = moduleSourcePath;
if (lstatSync(moduleSourcePath).isSymbolicLink()) {
actualSourcePath = realpathSync(moduleSourcePath);
}

cpSync(actualSourcePath, to, {
recursive: true,
dereference: true, // Follow symlinks and copy the actual files
filter: (src, dest) => {
const relativePath = src.replace(actualSourcePath, "").replace(/^[\\/]/, "");

// Skip certain directories
if (relativePath.match(/[\\/](android|ios|windows|mac|jest|github|gradle|__.*__|docs|example.*)[\\/]/)) {
return false;
}

// Skip certain file types
if (relativePath.match(/\.(config|setup)\.|\.podspec$|\.flow$/)) {
return false;
}

// Include LICENSE files
if (relativePath.match(/license/i)) {
return true;
}

return true;
}
});
}

Expand Down
11 changes: 0 additions & 11 deletions configs/jsactions/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ export default async args => {
}
);

// We dynamically import react-native-schedule-exact-alarm-permission as it works only on Android
// so we need to copy it here as collectDependencies won't detect it.
await copyJsModule(
// require returns a path to commonjs index.js file
join(
dirname(require.resolve("react-native-schedule-exact-alarm-permission")),
"../",
"../"
),
join(outDir, "node_modules", "react-native-schedule-exact-alarm-permission")
);
} else if (args.configProject === "nanoflowcommons") {
// `invariant` is being used silently by @react-native-community/geolocation; it is not listed as a dependency nor peerDependency.
// https://github.dev/react-native-geolocation/react-native-geolocation/blob/1786929f2be581da91082ff857c2393da5e597b3/js/implementation.native.js#L13
Expand Down
6 changes: 6 additions & 0 deletions packages/jsActions/mobile-resources-native/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]


- We updated react-native-permissions to 5.4.2.

- We removed react-native-schedule-exact-alarm-permission since it's no longer required.

- Updated react-native from version 0.75.4 to 0.77.3.
- We migrated from react-native-file-viewer to react-native-file-viewer-turbo for new architecture compatibility
- File viewer now uses modal to display content


## [10.0.0] Native Mobile Resources - 2025-3-31

- We migrated from react-native-inappbrowser-reborn to @swan-io/react-native-browser to prevent issues for next rn upgrade.
Expand Down
3 changes: 1 addition & 2 deletions packages/jsActions/mobile-resources-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"react-native-file-viewer-turbo": "0.6.0",
"react-native-image-picker": "7.2.3",
"react-native-localize": "3.2.1",
"react-native-permissions": "4.1.5",
"react-native-schedule-exact-alarm-permission": "^0.1.3",
"react-native-permissions": "5.4.2",
"react-native-sound": "0.11.0",
"url-parse": "^1.4.7"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
RESULTS,
openSettings,
Permission,
PERMISSIONS as RNPermissions
PERMISSIONS as RNPermissions,
canScheduleExactAlarms
} from "react-native-permissions";
import { ANDROIDPermissionName, IOSPermissionName } from "../../typings/RequestGenericPermission";

Expand All @@ -30,18 +31,26 @@ function handleBlockedPermission(permission: string): void {
const permissionName = permission.replace(/_IOS|_ANDROID/, "");

if (permissionName === "SCHEDULE_EXACT_ALARM") {
const RNExactAlarmPermission = require("react-native-schedule-exact-alarm-permission");

Alert.alert("", "Please allow setting alarms and reminders", [
{ text: "Go to alarm settings", onPress: () => RNExactAlarmPermission.getPermission(), isPreferred: true },
{ text: "Cancel", style: "cancel" }
]);
} else {
Alert.alert("", `Please allow ${permissionName} access`, [
{ text: "Go to settings", onPress: () => openSettings(), isPreferred: true },
return Alert.alert("", "Please allow setting alarms and reminders", [
{
text: "Go to alarm settings",
onPress: async () => {
const canSchedule = await canScheduleExactAlarms();
if (!canSchedule) {
// Check if permission is already granted
return openSettings("alarms");
}
return openSettings();
},
isPreferred: true
},
{ text: "Cancel", style: "cancel" }
]);
}
return Alert.alert("", `Please allow ${permissionName} access`, [
{ text: "Go to settings", onPress: () => openSettings(), isPreferred: true },
{ text: "Cancel", style: "cancel" }
]);
}

function mapPermissionName(permissionName: string): Permission | "android.permission.SCHEDULE_EXACT_ALARM" | undefined {
Expand Down
24 changes: 5 additions & 19 deletions pnpm-lock.yaml

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

Loading