Skip to content

Commit 7f5fe05

Browse files
chore: get packageDir with require.resolve
chore: add NotificationService CFBundleDisplayName MV-1173
1 parent 6f61b29 commit 7f5fe05

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

ios/expo/NotificationService/NotificationService-Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<dict>
55
<key>CFBundleDevelopmentRegion</key>
66
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>$(PRODUCT_NAME)</string>
79
<key>CFBundleExecutable</key>
810
<string>$(EXECUTABLE_NAME)</string>
911
<key>CFBundleIdentifier</key>

src/expo/ios/withEmarsysDangerousMod.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ export const withEmarsysDangerousMod: ConfigPlugin<EMSOptions> = (config, _optio
1717

1818
// Notification Service Extension
1919
// Copy files
20-
// TODO - get packageDir with require.resolve
21-
const packageDir = `${projectRoot}/node_modules/react-native-emarsys-sdk`;
20+
let packageDir;
21+
try {
22+
packageDir = path.dirname(require.resolve('react-native-emarsys-sdk/package.json'));
23+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
24+
} catch (error) {
25+
// Fallback when require.resolve failed, e.g. in example project
26+
packageDir = `${projectRoot}/node_modules/react-native-emarsys-sdk`;
27+
}
2228
const sourceDir = path.join(packageDir, 'ios', 'expo', NOTIFICATION_SERVICE_TARGET);
2329
const destDir = path.join(projectRoot, 'ios', NOTIFICATION_SERVICE_TARGET);
2430
if (!fs.existsSync(`${destDir}`)) {

0 commit comments

Comments
 (0)