react-native-acoustic-connect-beta 18.0.34 → 18.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +117 -2
- package/android/src/main/assets/ConnectBasicConfig.properties +1 -1
- package/app.plugin.js +15 -0
- package/package.json +15 -1
- package/plugin/build/index.d.ts +25 -0
- package/plugin/build/index.d.ts.map +1 -0
- package/plugin/build/index.js +44 -0
- package/plugin/build/index.js.map +1 -0
- package/plugin/build/withConnectNCE.d.ts +88 -0
- package/plugin/build/withConnectNCE.d.ts.map +1 -0
- package/plugin/build/withConnectNCE.js +366 -0
- package/plugin/build/withConnectNCE.js.map +1 -0
- package/plugin/build/withConnectNSE.d.ts +120 -0
- package/plugin/build/withConnectNSE.d.ts.map +1 -0
- package/plugin/build/withConnectNSE.js +512 -0
- package/plugin/build/withConnectNSE.js.map +1 -0
- package/plugin/src/index.ts +50 -0
- package/plugin/src/withConnectNCE.ts +487 -0
- package/plugin/src/withConnectNSE.ts +689 -0
- package/plugin/swift/NotificationService.swift +34 -0
- package/plugin/swift/NotificationViewController.swift +34 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (C) 2026 Acoustic, L.P. All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
// Acoustic, L.P. and/or other developers. No license is granted under any
|
|
6
|
+
// intellectual or industrial property rights of Acoustic, L.P. except as may
|
|
7
|
+
// be provided in an agreement with Acoustic, L.P. Any unauthorized copying or
|
|
8
|
+
// distribution of content from this file is prohibited.
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.withConnectNCE = exports.withNCEPodfile = exports.withNCEXcodeProject = exports.injectPodfileBlock = exports.buildPodfileBlock = exports.buildNCEEntitlements = exports.buildNCEInfoPlist = void 0;
|
|
34
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
35
|
+
const fs = __importStar(require("fs"));
|
|
36
|
+
const path = __importStar(require("path"));
|
|
37
|
+
const withConnectNSE_1 = require("./withConnectNSE");
|
|
38
|
+
// ─── Target / config constants ─────────────────────────────────────────────
|
|
39
|
+
const NSE_TARGET_NAME = 'ConnectNSE';
|
|
40
|
+
const NCE_TARGET_NAME = 'ConnectNCE';
|
|
41
|
+
// Configs belonging to either extension target must be skipped when mirroring
|
|
42
|
+
// host build settings. The NCE mod runs AFTER the NSE mod in the composition,
|
|
43
|
+
// so by the time this executes the pbxproj already carries ConnectNSE configs;
|
|
44
|
+
// without skipping both, the NCE could mirror the NSE target's settings rather
|
|
45
|
+
// than the host app's.
|
|
46
|
+
const EXTENSION_TARGET_NAMES = [NSE_TARGET_NAME, NCE_TARGET_NAME];
|
|
47
|
+
// ─── Plist helpers ────────────────────────────────────────────────────────────
|
|
48
|
+
/**
|
|
49
|
+
* Generates the Info.plist content for the ConnectNCE target.
|
|
50
|
+
*
|
|
51
|
+
* The NSExtensionAttributes mirror the canonical bare-workflow reference
|
|
52
|
+
* (Examples/bare-workflow/ios/ConnectNCE/Info.plist), which itself mirrors the
|
|
53
|
+
* iOS-SDK NCE 1:1:
|
|
54
|
+
* - UNNotificationExtensionCategory: the category identifiers the Connect
|
|
55
|
+
* APNs payload routes rich-media notifications through. Must match the
|
|
56
|
+
* category the SDK/Collector sets — keep in sync with the iOS-SDK NCE.
|
|
57
|
+
* - UNNotificationExtensionDefaultContentHidden=false: keep the default
|
|
58
|
+
* system body alongside the custom content view.
|
|
59
|
+
* - UNNotificationExtensionInitialContentSizeRatio=1.0: start full-height;
|
|
60
|
+
* the SDK content controller resizes to fit the rendered media.
|
|
61
|
+
*
|
|
62
|
+
* RCTNewArchEnabled is intentionally omitted: the NCE links the Connect SDK
|
|
63
|
+
* only — no React Native runtime is present in the extension process. (The
|
|
64
|
+
* bare-workflow reference carries it as an Xcode-template leftover; the
|
|
65
|
+
* plugin-generated target drops it, consistent with the NSE template.)
|
|
66
|
+
*/
|
|
67
|
+
function buildNCEInfoPlist() {
|
|
68
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
69
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
70
|
+
<plist version="1.0">
|
|
71
|
+
<dict>
|
|
72
|
+
\t<key>CFBundleDevelopmentRegion</key>
|
|
73
|
+
\t<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
74
|
+
\t<key>CFBundleDisplayName</key>
|
|
75
|
+
\t<string>ConnectNCE</string>
|
|
76
|
+
\t<key>CFBundleExecutable</key>
|
|
77
|
+
\t<string>$(EXECUTABLE_NAME)</string>
|
|
78
|
+
\t<key>CFBundleIdentifier</key>
|
|
79
|
+
\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
80
|
+
\t<key>CFBundleInfoDictionaryVersion</key>
|
|
81
|
+
\t<string>6.0</string>
|
|
82
|
+
\t<key>CFBundleName</key>
|
|
83
|
+
\t<string>$(PRODUCT_NAME)</string>
|
|
84
|
+
\t<key>CFBundlePackageType</key>
|
|
85
|
+
\t<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
|
86
|
+
\t<key>CFBundleShortVersionString</key>
|
|
87
|
+
\t<string>$(MARKETING_VERSION)</string>
|
|
88
|
+
\t<key>CFBundleVersion</key>
|
|
89
|
+
\t<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
90
|
+
\t<key>NSExtension</key>
|
|
91
|
+
\t<dict>
|
|
92
|
+
\t\t<key>NSExtensionAttributes</key>
|
|
93
|
+
\t\t<dict>
|
|
94
|
+
\t\t\t<key>UNNotificationExtensionCategory</key>
|
|
95
|
+
\t\t\t<array>
|
|
96
|
+
\t\t\t\t<string>ACOUSTIC_RICH_NOTIFICATION</string>
|
|
97
|
+
\t\t\t\t<string>ACTIONABLE_NOTIFICATION</string>
|
|
98
|
+
\t\t\t</array>
|
|
99
|
+
\t\t\t<key>UNNotificationExtensionDefaultContentHidden</key>
|
|
100
|
+
\t\t\t<false/>
|
|
101
|
+
\t\t\t<key>UNNotificationExtensionInitialContentSizeRatio</key>
|
|
102
|
+
\t\t\t<real>1.0</real>
|
|
103
|
+
\t\t</dict>
|
|
104
|
+
\t\t<key>NSExtensionPointIdentifier</key>
|
|
105
|
+
\t\t<string>com.apple.usernotifications.content-extension</string>
|
|
106
|
+
\t\t<key>NSExtensionPrincipalClass</key>
|
|
107
|
+
\t\t<string>$(PRODUCT_MODULE_NAME).NotificationViewController</string>
|
|
108
|
+
\t</dict>
|
|
109
|
+
</dict>
|
|
110
|
+
</plist>
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
exports.buildNCEInfoPlist = buildNCEInfoPlist;
|
|
114
|
+
/** Generates the entitlements plist content for the ConnectNCE target. */
|
|
115
|
+
function buildNCEEntitlements(appGroupIdentifier) {
|
|
116
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
117
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
118
|
+
<plist version="1.0">
|
|
119
|
+
<dict>
|
|
120
|
+
\t<key>com.apple.security.application-groups</key>
|
|
121
|
+
\t<array>
|
|
122
|
+
\t\t<string>${appGroupIdentifier}</string>
|
|
123
|
+
\t</array>
|
|
124
|
+
</dict>
|
|
125
|
+
</plist>
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
exports.buildNCEEntitlements = buildNCEEntitlements;
|
|
129
|
+
// ─── Podfile injection ────────────────────────────────────────────────────────
|
|
130
|
+
const PODFILE_MARKER = '# @generated ConnectNCE target (react-native-acoustic-connect-beta)';
|
|
131
|
+
/**
|
|
132
|
+
* Returns the Ruby snippet to inject into the Expo-generated Podfile for the
|
|
133
|
+
* ConnectNCE target. Thin wrapper over the shared
|
|
134
|
+
* {@link buildConnectPodTargetBlock} (single source of truth for the
|
|
135
|
+
* AcousticConnect pod-resolution helper), parameterised with the NCE marker,
|
|
136
|
+
* helper name, and target name.
|
|
137
|
+
*/
|
|
138
|
+
function buildPodfileBlock() {
|
|
139
|
+
return (0, withConnectNSE_1.buildConnectPodTargetBlock)(PODFILE_MARKER, 'acoustic_connect_pod_nce', NCE_TARGET_NAME);
|
|
140
|
+
}
|
|
141
|
+
exports.buildPodfileBlock = buildPodfileBlock;
|
|
142
|
+
/**
|
|
143
|
+
* Injects the ConnectNCE Podfile block into `podfileContent` if not already
|
|
144
|
+
* present (idempotent, guarded by PODFILE_MARKER).
|
|
145
|
+
*/
|
|
146
|
+
function injectPodfileBlock(podfileContent) {
|
|
147
|
+
if (podfileContent.includes(PODFILE_MARKER)) {
|
|
148
|
+
return podfileContent;
|
|
149
|
+
}
|
|
150
|
+
return podfileContent + buildPodfileBlock();
|
|
151
|
+
}
|
|
152
|
+
exports.injectPodfileBlock = injectPodfileBlock;
|
|
153
|
+
// ─── Xcode project mod ───────────────────────────────────────────────────────
|
|
154
|
+
/**
|
|
155
|
+
* Adds the ConnectNCE Xcode target (app_extension) to the project.
|
|
156
|
+
*
|
|
157
|
+
* Sibling to withNSEXcodeProject; the only differences are the target name,
|
|
158
|
+
* the Swift source file (NotificationViewController.swift), the NCE Info.plist
|
|
159
|
+
* (content-extension NSExtension keys), and skipping BOTH extension targets'
|
|
160
|
+
* configs when mirroring host build settings.
|
|
161
|
+
*
|
|
162
|
+
* Idempotent: if a target named ConnectNCE already exists, skips target
|
|
163
|
+
* creation but still (re)writes the source files.
|
|
164
|
+
*/
|
|
165
|
+
function withNCEXcodeProject(config, appGroupIdentifier, swiftContent) {
|
|
166
|
+
return (0, config_plugins_1.withXcodeProject)(config, (c) => {
|
|
167
|
+
var _a, _b, _c, _d;
|
|
168
|
+
const xcodeProject = c.modResults;
|
|
169
|
+
// ios/ directory — modRequest.platformProjectRoot is the canonical
|
|
170
|
+
// native project root. (xcodeProject.filepath points INSIDE the
|
|
171
|
+
// .xcodeproj bundle, so deriving from it misplaces the files.)
|
|
172
|
+
const iosDir = c.modRequest.platformProjectRoot;
|
|
173
|
+
const nceDir = path.join(iosDir, NCE_TARGET_NAME);
|
|
174
|
+
// Always write / overwrite the source files (idempotent)
|
|
175
|
+
fs.mkdirSync(nceDir, { recursive: true });
|
|
176
|
+
fs.writeFileSync(path.join(nceDir, 'NotificationViewController.swift'), swiftContent, 'utf8');
|
|
177
|
+
fs.writeFileSync(path.join(nceDir, 'Info.plist'), buildNCEInfoPlist(), 'utf8');
|
|
178
|
+
fs.writeFileSync(path.join(nceDir, `${NCE_TARGET_NAME}.entitlements`), buildNCEEntitlements(appGroupIdentifier), 'utf8');
|
|
179
|
+
// Idempotency check — skip if target already registered in the pbxproj.
|
|
180
|
+
// Note: pbxTargetByName misses targets on a REPARSED project because the
|
|
181
|
+
// xcode lib stores written names with literal quotes ('"ConnectNCE"'),
|
|
182
|
+
// so compare quote-stripped names across the native-target section.
|
|
183
|
+
const nativeTargets = xcodeProject.pbxNativeTargetSection();
|
|
184
|
+
const targetExists = Object.values(nativeTargets).some((t) => typeof t === 'object' &&
|
|
185
|
+
typeof t.name === 'string' &&
|
|
186
|
+
t.name.replace(/"/g, '') === NCE_TARGET_NAME);
|
|
187
|
+
if (targetExists) {
|
|
188
|
+
return c;
|
|
189
|
+
}
|
|
190
|
+
// Derive the host bundle id — the NCE bundle id must be
|
|
191
|
+
// `<hostBundleId>.ConnectNCE`. Fail fast rather than emit a placeholder
|
|
192
|
+
// (a wrong bundle id breaks App Group pairing and App Store submission).
|
|
193
|
+
const hostBundleId = (_a = c.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier;
|
|
194
|
+
if (!hostBundleId) {
|
|
195
|
+
throw new Error(`[react-native-acoustic-connect-beta] ios.bundleIdentifier is not set.\n\n` +
|
|
196
|
+
`The ConnectNCE extension bundle id is derived as ` +
|
|
197
|
+
`"<ios.bundleIdentifier>.ConnectNCE", so the host bundle id must be ` +
|
|
198
|
+
`defined in app.json before prebuild:\n` +
|
|
199
|
+
` { "expo": { "ios": { "bundleIdentifier": "com.example.app" } } }`);
|
|
200
|
+
}
|
|
201
|
+
// Add the native target (app_extension)
|
|
202
|
+
const nceTarget = xcodeProject.addTarget(NCE_TARGET_NAME, 'app_extension', NCE_TARGET_NAME, `${hostBundleId}.ConnectNCE`);
|
|
203
|
+
if (!nceTarget) {
|
|
204
|
+
throw new Error(`[react-native-acoustic-connect-beta] Failed to add ConnectNCE Xcode target.`);
|
|
205
|
+
}
|
|
206
|
+
// Add the build phase for Swift sources
|
|
207
|
+
xcodeProject.addBuildPhase(['NotificationViewController.swift'], 'PBXSourcesBuildPhase', 'Sources', nceTarget.uuid);
|
|
208
|
+
// Add Resources build phase (empty, but required by Xcode)
|
|
209
|
+
xcodeProject.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', nceTarget.uuid);
|
|
210
|
+
// Add Frameworks build phase (empty — CocoaPods populates it)
|
|
211
|
+
xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', nceTarget.uuid);
|
|
212
|
+
// Make the host app target depend on ConnectNCE. CocoaPods resolves an
|
|
213
|
+
// extension's host target through PBXTargetDependency
|
|
214
|
+
// (xcodeproj's host_targets_for_embedded_target), NOT through the embed
|
|
215
|
+
// copy phase — without this edge `pod install` fails with "Unable to find
|
|
216
|
+
// host target(s) for ConnectNCE".
|
|
217
|
+
// The xcode lib SILENTLY no-ops addTargetDependency when these sections
|
|
218
|
+
// are absent from the parsed project — create them first. (The NSE mod
|
|
219
|
+
// already creates them when it runs before this; guarding here keeps the
|
|
220
|
+
// NCE mod correct if it ever runs first.)
|
|
221
|
+
const objects = xcodeProject.hash.project.objects;
|
|
222
|
+
objects['PBXTargetDependency'] = (_b = objects['PBXTargetDependency']) !== null && _b !== void 0 ? _b : {};
|
|
223
|
+
objects['PBXContainerItemProxy'] = (_c = objects['PBXContainerItemProxy']) !== null && _c !== void 0 ? _c : {};
|
|
224
|
+
const hostTargetUuid = xcodeProject.getFirstTarget().uuid;
|
|
225
|
+
xcodeProject.addTargetDependency(hostTargetUuid, [nceTarget.uuid]);
|
|
226
|
+
// Create a PBXGroup for ConnectNCE source files
|
|
227
|
+
const nceGroup = xcodeProject.addPbxGroup([
|
|
228
|
+
'NotificationViewController.swift',
|
|
229
|
+
'Info.plist',
|
|
230
|
+
`${NCE_TARGET_NAME}.entitlements`,
|
|
231
|
+
], NCE_TARGET_NAME, NCE_TARGET_NAME);
|
|
232
|
+
// Add the group to the main project group
|
|
233
|
+
const mainGroup = xcodeProject.getFirstProject().firstProject.mainGroup;
|
|
234
|
+
xcodeProject.addToPbxGroup(nceGroup.uuid, mainGroup);
|
|
235
|
+
// Set per-configuration build settings — mirror each host configuration
|
|
236
|
+
// individually so Debug gets Debug values and Release gets Release values.
|
|
237
|
+
const buildConfigurations = xcodeProject.pbxXCConfigurationList();
|
|
238
|
+
const nceConfigListUuid = nceTarget.pbxNativeTarget.buildConfigurationList;
|
|
239
|
+
if (nceConfigListUuid) {
|
|
240
|
+
const configList = buildConfigurations[nceConfigListUuid];
|
|
241
|
+
if (configList &&
|
|
242
|
+
Array.isArray(configList
|
|
243
|
+
.buildConfigurations)) {
|
|
244
|
+
const configs = xcodeProject.pbxXCBuildConfigurationSection();
|
|
245
|
+
for (const entry of configList.buildConfigurations) {
|
|
246
|
+
const buildConfig = configs[entry.value];
|
|
247
|
+
if (buildConfig && buildConfig.buildSettings) {
|
|
248
|
+
// Determine which host config name to mirror (Debug → Debug, etc.)
|
|
249
|
+
const configName = (_d = buildConfig.name) !== null && _d !== void 0 ? _d : 'Debug';
|
|
250
|
+
// Mirror per-configuration values; fall back to the other config's
|
|
251
|
+
// value only when the matching one is absent. Skip BOTH extension
|
|
252
|
+
// targets so the NCE never mirrors the NSE target's settings.
|
|
253
|
+
const deploymentTarget = (0, withConnectNSE_1.getHostBuildSettingForConfig)(xcodeProject, 'IPHONEOS_DEPLOYMENT_TARGET', configName,
|
|
254
|
+
// Matches the AcousticConnect podspec floor (iOS >= 15.1) so the
|
|
255
|
+
// NCE never demands a higher minimum than the host app.
|
|
256
|
+
'15.1', EXTENSION_TARGET_NAMES);
|
|
257
|
+
const swiftVersion = (0, withConnectNSE_1.getHostBuildSettingForConfig)(xcodeProject, 'SWIFT_VERSION', configName, '5.0', EXTENSION_TARGET_NAMES);
|
|
258
|
+
const marketingVersion = (0, withConnectNSE_1.getHostBuildSettingForConfig)(xcodeProject, 'MARKETING_VERSION', configName, '1.0', EXTENSION_TARGET_NAMES);
|
|
259
|
+
const currentProjectVersion = (0, withConnectNSE_1.getHostBuildSettingForConfig)(xcodeProject, 'CURRENT_PROJECT_VERSION', configName, '1', EXTENSION_TARGET_NAMES);
|
|
260
|
+
Object.assign(buildConfig.buildSettings, {
|
|
261
|
+
// Prevent Xcode from synthesising a second Info.plist that would
|
|
262
|
+
// shadow the NSExtension dictionary in ours.
|
|
263
|
+
GENERATE_INFOPLIST_FILE: 'NO',
|
|
264
|
+
INFOPLIST_FILE: `${NCE_TARGET_NAME}/Info.plist`,
|
|
265
|
+
// Extension must target the device SDK and restrict to
|
|
266
|
+
// extension-safe APIs (mirrors bare-workflow reference target).
|
|
267
|
+
SDKROOT: 'iphoneos',
|
|
268
|
+
APPLICATION_EXTENSION_API_ONLY: 'YES',
|
|
269
|
+
IPHONEOS_DEPLOYMENT_TARGET: deploymentTarget,
|
|
270
|
+
SWIFT_VERSION: swiftVersion,
|
|
271
|
+
MARKETING_VERSION: marketingVersion,
|
|
272
|
+
CURRENT_PROJECT_VERSION: currentProjectVersion,
|
|
273
|
+
CODE_SIGN_ENTITLEMENTS: `${NCE_TARGET_NAME}/${NCE_TARGET_NAME}.entitlements`,
|
|
274
|
+
PRODUCT_NAME: NCE_TARGET_NAME,
|
|
275
|
+
PRODUCT_BUNDLE_IDENTIFIER: `${hostBundleId}.ConnectNCE`,
|
|
276
|
+
TARGETED_DEVICE_FAMILY: '"1,2"',
|
|
277
|
+
CODE_SIGN_STYLE: 'Automatic',
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return c;
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
exports.withNCEXcodeProject = withNCEXcodeProject;
|
|
287
|
+
// ─── Podfile mod ─────────────────────────────────────────────────────────────
|
|
288
|
+
/**
|
|
289
|
+
* Injects the ConnectNCE Podfile target block via withDangerousMod.
|
|
290
|
+
* Guarded by a marker comment — re-runs are no-ops.
|
|
291
|
+
*
|
|
292
|
+
* Throws a clear, actionable error when the Podfile does not exist at
|
|
293
|
+
* mod-execution time, instead of silently returning — a silent skip would
|
|
294
|
+
* ship an NCE whose `import Connect` cannot resolve.
|
|
295
|
+
*/
|
|
296
|
+
function withNCEPodfile(config) {
|
|
297
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
298
|
+
'ios',
|
|
299
|
+
async (c) => {
|
|
300
|
+
const podfilePath = path.join(c.modRequest.platformProjectRoot, 'Podfile');
|
|
301
|
+
if (!fs.existsSync(podfilePath)) {
|
|
302
|
+
throw new Error(`[react-native-acoustic-connect-beta] ios/Podfile not found at ${podfilePath}.\n\n` +
|
|
303
|
+
`This mod runs after prebuild generates the ios/ directory. ` +
|
|
304
|
+
`If you are running this plugin outside of \`expo prebuild\`, ` +
|
|
305
|
+
`ensure the Podfile exists before the dangerous mod phase executes.\n` +
|
|
306
|
+
`Check prebuild ordering: withDangerousMod('ios') runs after ` +
|
|
307
|
+
`withXcodeProject, so the ios/ directory should already be present.`);
|
|
308
|
+
}
|
|
309
|
+
const current = fs.readFileSync(podfilePath, 'utf8');
|
|
310
|
+
const updated = injectPodfileBlock(current);
|
|
311
|
+
if (updated !== current) {
|
|
312
|
+
fs.writeFileSync(podfilePath, updated, 'utf8');
|
|
313
|
+
}
|
|
314
|
+
return c;
|
|
315
|
+
},
|
|
316
|
+
]);
|
|
317
|
+
}
|
|
318
|
+
exports.withNCEPodfile = withNCEPodfile;
|
|
319
|
+
// ─── Composed mod ─────────────────────────────────────────────────────────────
|
|
320
|
+
/**
|
|
321
|
+
* Expo Config Plugin mod that provisions a Notification Content Extension
|
|
322
|
+
* (NCE) Xcode target named `ConnectNCE`.
|
|
323
|
+
*
|
|
324
|
+
* Applies three mutations — all idempotent:
|
|
325
|
+
* 1. Host app entitlements: merges App Group into
|
|
326
|
+
* `com.apple.security.application-groups` (reuses the NSE host-entitlements
|
|
327
|
+
* mod — the host shares one App Group across app + NSE + NCE; the merge is
|
|
328
|
+
* a no-op when the NSE mod already added it).
|
|
329
|
+
* 2. Xcode project: adds ConnectNCE target + files (skips if already present).
|
|
330
|
+
* 3. Podfile: injects `target 'ConnectNCE'` block (guarded by marker comment).
|
|
331
|
+
*
|
|
332
|
+
* `config._internal.projectRoot` is required (injected by Expo CLI during
|
|
333
|
+
* `expo prebuild`); an actionable error is thrown if absent rather than
|
|
334
|
+
* silently falling back to `process.cwd()`.
|
|
335
|
+
*
|
|
336
|
+
* NSE coupling (intentional, tracked for refactor): this mod deliberately
|
|
337
|
+
* reuses three pieces of withConnectNSE — `withNSEEntitlements` (the host App
|
|
338
|
+
* Group is shared across app + NSE + NCE), `buildConnectPodTargetBlock` (one
|
|
339
|
+
* source for the pod-resolution helper), and `getHostBuildSettingForConfig`
|
|
340
|
+
* (the per-config mirroring logic). The composition always runs withConnectNSE
|
|
341
|
+
* before withConnectNCE, so the shared host entitlement and the
|
|
342
|
+
* PBXTargetDependency/PBXContainerItemProxy sections already exist when this
|
|
343
|
+
* runs. Extracting a shared `withConnectExtension` base for NSE + NCE is
|
|
344
|
+
* tracked as a follow-up refactor (see PR description) rather than done here,
|
|
345
|
+
* to keep the already-landed NSE mod stable.
|
|
346
|
+
*/
|
|
347
|
+
const withConnectNCE = (config, props = {}) => {
|
|
348
|
+
var _a;
|
|
349
|
+
const projectRoot = (_a = config._internal) === null || _a === void 0 ? void 0 : _a.projectRoot;
|
|
350
|
+
if (!projectRoot) {
|
|
351
|
+
throw new Error(`[react-native-acoustic-connect-beta] config._internal.projectRoot is not set.\n\n` +
|
|
352
|
+
`This value is injected by Expo CLI during \`expo prebuild\`. ` +
|
|
353
|
+
`If you are calling this plugin outside of Expo CLI (e.g. in a test or ` +
|
|
354
|
+
`custom script), set config._internal = { projectRoot: '/abs/path/to/project' } ` +
|
|
355
|
+
`before invoking the plugin.`);
|
|
356
|
+
}
|
|
357
|
+
const appGroupIdentifier = (0, withConnectNSE_1.resolveAppGroupIdentifier)(projectRoot, props);
|
|
358
|
+
const swiftTemplatePath = path.join(__dirname, '..', 'swift', 'NotificationViewController.swift');
|
|
359
|
+
const swiftContent = (0, withConnectNSE_1.substituteSwiftTemplate)(swiftTemplatePath, appGroupIdentifier);
|
|
360
|
+
let result = (0, withConnectNSE_1.withNSEEntitlements)(config, appGroupIdentifier);
|
|
361
|
+
result = withNCEXcodeProject(result, appGroupIdentifier, swiftContent);
|
|
362
|
+
result = withNCEPodfile(result);
|
|
363
|
+
return result;
|
|
364
|
+
};
|
|
365
|
+
exports.withConnectNCE = withConnectNCE;
|
|
366
|
+
//# sourceMappingURL=withConnectNCE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withConnectNCE.js","sourceRoot":"","sources":["../src/withConnectNCE.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,6EAA6E;AAC7E,8EAA8E;AAC9E,wDAAwD;;;;;;;;;;;;;;;;;;;;;;;;;;AAExD,yDAI6B;AAE7B,uCAAwB;AACxB,2CAA4B;AAC5B,qDAOyB;AASzB,8EAA8E;AAE9E,MAAM,eAAe,GAAG,YAAY,CAAA;AACpC,MAAM,eAAe,GAAG,YAAY,CAAA;AAEpC,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,uBAAuB;AACvB,MAAM,sBAAsB,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAA;AAEjE,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,iBAAiB;IAC/B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CR,CAAA;AACD,CAAC;AA7CD,8CA6CC;AAED,0EAA0E;AAC1E,SAAgB,oBAAoB,CAAC,kBAA0B;IAC7D,OAAO;;;;;;cAMK,kBAAkB;;;;CAI/B,CAAA;AACD,CAAC;AAZD,oDAYC;AAED,iFAAiF;AAEjF,MAAM,cAAc,GAClB,qEAAqE,CAAA;AAEvE;;;;;;GAMG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,IAAA,2CAA0B,EAC/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DAA+D;YAC/D,wEAAwE;YACxE,iFAAiF;YACjF,6BAA6B,CAChC,CAAA;KACF;IAED,MAAM,kBAAkB,GAAG,IAAA,0CAAyB,EAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAExE,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CACjC,SAAS,EACT,IAAI,EACJ,OAAO,EACP,kCAAkC,CACnC,CAAA;IACD,MAAM,YAAY,GAAG,IAAA,wCAAuB,EAC1C,iBAAiB,EACjB,kBAAkB,CACnB,CAAA;IAED,IAAI,MAAM,GAAG,IAAA,oCAAmB,EAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC5D,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAAA;IACtE,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAhCY,QAAA,cAAc,kBAgC1B"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { withXcodeProject, type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import type { ExpoConfig } from '@expo/config-types';
|
|
3
|
+
type XcodeProject = Parameters<Parameters<typeof withXcodeProject>[1]>[0]['modResults'];
|
|
4
|
+
export interface ConnectPluginProps {
|
|
5
|
+
/** Explicit App Group override. Wins over ConnectConfig.json when set. */
|
|
6
|
+
iosAppGroupIdentifier?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Validates an App Group identifier against Apple's format and returns it.
|
|
10
|
+
* Throws an actionable error otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertValidAppGroup(value: string, source: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the iOS App Group identifier used by ConnectNSE.
|
|
15
|
+
*
|
|
16
|
+
* Priority:
|
|
17
|
+
* 1. `iosAppGroupIdentifier` plugin prop in app.json (explicit override)
|
|
18
|
+
* 2. `Connect.iOSAppGroupIdentifier` in `<projectRoot>/ConnectConfig.json`
|
|
19
|
+
*
|
|
20
|
+
* The resolved value is validated against Apple's App Group format. Throws a
|
|
21
|
+
* clear, actionable error if neither source provides the value, or if the
|
|
22
|
+
* provided value is malformed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveAppGroupIdentifier(projectRoot: string, props: ConnectPluginProps): string;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the content of `plugin/swift/NotificationService.swift` with the
|
|
27
|
+
* placeholder replaced by the resolved App Group identifier and a generated
|
|
28
|
+
* header prepended.
|
|
29
|
+
*/
|
|
30
|
+
export declare function substituteSwiftTemplate(templatePath: string, appGroupIdentifier: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Generates the Info.plist content for the ConnectNSE target.
|
|
33
|
+
*
|
|
34
|
+
* RCTNewArchEnabled is intentionally omitted: the NSE links the Connect SDK
|
|
35
|
+
* only — no React Native runtime is present in the extension process.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildNSEInfoPlist(): string;
|
|
38
|
+
/** Generates the entitlements plist content for the ConnectNSE target. */
|
|
39
|
+
export declare function buildNSEEntitlements(appGroupIdentifier: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Builds the Ruby Podfile snippet shared by the NSE and NCE mods: a helper
|
|
42
|
+
* that resolves the AcousticConnect pod (name + version requirements) from
|
|
43
|
+
* ConnectConfig.json, plus an extension `target` that links it. Centralised
|
|
44
|
+
* here so the NSE and NCE blocks have a single source of truth for the
|
|
45
|
+
* resolution logic — they differ only in marker, helper name, and target name.
|
|
46
|
+
*
|
|
47
|
+
* Tolerates a missing ConnectConfig.json or a missing `Connect` key: when
|
|
48
|
+
* the file or key is absent the block defaults to AcousticConnectDebug with
|
|
49
|
+
* floor '>= 2.1.12' and no version pin, so prop-only setups (no
|
|
50
|
+
* ConnectConfig.json) keep working. If the file exists but contains invalid
|
|
51
|
+
* JSON, `pod install` will print a warning and use the same defaults rather
|
|
52
|
+
* than crashing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildConnectPodTargetBlock(marker: string, helperName: string, targetName: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the Ruby snippet to inject into the Expo-generated Podfile for the
|
|
57
|
+
* ConnectNSE target. Thin wrapper over {@link buildConnectPodTargetBlock}.
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildPodfileBlock(): string;
|
|
60
|
+
/**
|
|
61
|
+
* Injects the ConnectNSE Podfile block into `podfileContent` if not already
|
|
62
|
+
* present (idempotent, guarded by PODFILE_MARKER).
|
|
63
|
+
*/
|
|
64
|
+
export declare function injectPodfileBlock(podfileContent: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Adds the App Group to the HOST app's entitlements. Merges idempotently
|
|
67
|
+
* — never clobbers an existing `com.apple.security.application-groups` array.
|
|
68
|
+
*/
|
|
69
|
+
export declare function withNSEEntitlements(config: ExpoConfig, appGroupIdentifier: string): ExpoConfig;
|
|
70
|
+
/**
|
|
71
|
+
* Extracts a build setting value scoped to the host native target's
|
|
72
|
+
* configuration list for the given `configName` (e.g. "Debug" or "Release").
|
|
73
|
+
* Falls back to the other host config if the named one is absent, then to the
|
|
74
|
+
* hardcoded `fallback`.
|
|
75
|
+
*
|
|
76
|
+
* Scoped to host configs only: configs whose CODE_SIGN_ENTITLEMENTS references
|
|
77
|
+
* one of `skipTargetNames` (the extension targets this plugin generates) are
|
|
78
|
+
* skipped, so values are never mirrored from a previously generated extension
|
|
79
|
+
* target. Defaults to `[NSE_TARGET_NAME]`; the NCE mod (withConnectNCE) passes
|
|
80
|
+
* both ConnectNSE and ConnectNCE so a re-run that already wrote the NSE target
|
|
81
|
+
* never mirrors the sibling extension's settings.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getHostBuildSettingForConfig(xcodeProject: XcodeProject, setting: string, configName: string, fallback: string, skipTargetNames?: string[]): string;
|
|
84
|
+
/**
|
|
85
|
+
* Adds the ConnectNSE Xcode target (app_extension) to the project.
|
|
86
|
+
*
|
|
87
|
+
* Follows the OneSignal plugin pattern (withOneSignalNSE.ts) using the
|
|
88
|
+
* `xcode` API exposed via `config.modResults`.
|
|
89
|
+
*
|
|
90
|
+
* Idempotent: if a target named ConnectNSE already exists, skips target
|
|
91
|
+
* creation but still (re)writes the source files.
|
|
92
|
+
*/
|
|
93
|
+
export declare function withNSEXcodeProject(config: ExpoConfig, appGroupIdentifier: string, swiftContent: string): ExpoConfig;
|
|
94
|
+
/**
|
|
95
|
+
* Injects the ConnectNSE Podfile target block via withDangerousMod.
|
|
96
|
+
* Guarded by a marker comment — re-runs are no-ops.
|
|
97
|
+
*
|
|
98
|
+
* M5: throws a clear, actionable error when the Podfile does not exist at
|
|
99
|
+
* mod-execution time, instead of silently returning — a silent skip would
|
|
100
|
+
* ship an NSE whose `import Connect` cannot resolve.
|
|
101
|
+
*/
|
|
102
|
+
export declare function withNSEPodfile(config: ExpoConfig): ExpoConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Expo Config Plugin mod that provisions a Notification Service Extension
|
|
105
|
+
* (NSE) Xcode target named `ConnectNSE`.
|
|
106
|
+
*
|
|
107
|
+
* Applies three mutations — all idempotent:
|
|
108
|
+
* 1. Host app entitlements: merges App Group into
|
|
109
|
+
* `com.apple.security.application-groups`.
|
|
110
|
+
* 2. Xcode project: adds ConnectNSE target + files (skips if already present).
|
|
111
|
+
* 3. Podfile: injects `target 'ConnectNSE'` block (guarded by marker comment).
|
|
112
|
+
*
|
|
113
|
+
* M4: `config._internal.projectRoot` is required. If absent (i.e. invoked
|
|
114
|
+
* outside Expo CLI), an actionable error is thrown rather than silently
|
|
115
|
+
* falling back to `process.cwd()`, which would misresolve ConnectConfig.json
|
|
116
|
+
* in monorepo setups.
|
|
117
|
+
*/
|
|
118
|
+
export declare const withConnectNSE: ConfigPlugin<ConnectPluginProps>;
|
|
119
|
+
export {};
|
|
120
|
+
//# sourceMappingURL=withConnectNSE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withCon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