onesignal-expo-plugin 2.7.1 → 2.7.2
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/README.md +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +23 -23
- package/dist/plugin.d.ts +1 -2
- package/dist/{types-A2mAFlHd.d.ts → types-CCAtwmH-.d.ts} +1 -1
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ You can pass props to the plugin config object to configure:
|
|
|
81
81
|
| ------------------------ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
82
82
|
| `mode` | **required** | Used to configure [APNs environment](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) entitlement. `"development"` or `"production"` |
|
|
83
83
|
| `devTeam` | **deprecated** | Use [`ios.appleTeamId`](https://docs.expo.dev/versions/latest/config/app/#appleteamid) in your Expo config instead. Falls back to this value if `appleTeamId` is not set. e.g: `"91SW8A37CR"` |
|
|
84
|
-
| `iPhoneDeploymentTarget` | optional | Target `IPHONEOS_DEPLOYMENT_TARGET` value to be used when adding the iOS [NSE](https://documentation.onesignal.com/docs/service-extensions). A deployment target is nothing more than the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: `"
|
|
84
|
+
| `iPhoneDeploymentTarget` | optional | Target `IPHONEOS_DEPLOYMENT_TARGET` value to be used when adding the iOS [NSE](https://documentation.onesignal.com/docs/service-extensions). A deployment target is nothing more than the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: `"15.0"`. |
|
|
85
85
|
| `smallIcons` | optional | An array of local paths to small notification icons for Android. Image should be white, transparent, and 96x96 in size. Input images will be automatically scaled down and placed in the appropriate resource folders. e.g: `["./assets/ic_stat_onesignal_default.png"]`. See https://documentation.onesignal.com/docs/customize-notification-icons#small-notification-icons. |
|
|
86
86
|
| `largeIcons` | optional | An array of local paths to large notification icons for Android. Image should be white, transparent, and 256x256 in size. e.g: `["./assets/ic_onesignal_large_icon_default.png"]`. See https://documentation.onesignal.com/docs/customize-notification-icons#large-notification-icons. |
|
|
87
87
|
| `smallIconAccentColor` | optional | The accent color to use for notification icons on Android. Must be a valid hex value, e.g: `"#FF0000"` |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as OneSignalPluginProps } from "./types-
|
|
2
|
-
import { ConfigPlugin } from "expo/config-plugins
|
|
3
|
-
|
|
1
|
+
import { t as OneSignalPluginProps } from "./types-CCAtwmH-.js";
|
|
2
|
+
import { ConfigPlugin } from "expo/config-plugins";
|
|
4
3
|
//#region src/onesignal/withOneSignal.d.ts
|
|
5
4
|
declare const withOneSignal: ConfigPlugin<OneSignalPluginProps>;
|
|
6
5
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
@@ -25,7 +25,7 @@ path = __toESM(path);
|
|
|
25
25
|
let fs = require("fs");
|
|
26
26
|
fs = __toESM(fs);
|
|
27
27
|
let _expo_image_utils = require("@expo/image-utils");
|
|
28
|
-
let
|
|
28
|
+
let expo_config_plugins = require("expo/config-plugins");
|
|
29
29
|
let fs_promises = require("fs/promises");
|
|
30
30
|
fs_promises = __toESM(fs_promises);
|
|
31
31
|
const TARGETED_DEVICE_FAMILY = `"1,2"`;
|
|
@@ -190,7 +190,7 @@ const SMALL_ICON_DEFAULT_NAME = "ic_stat_onesignal_default";
|
|
|
190
190
|
const withSmallIcons = (config, onesignalProps) => {
|
|
191
191
|
const expoConfig = config;
|
|
192
192
|
if (!onesignalProps.smallIcons && !expoConfig.notification?.icon) return config;
|
|
193
|
-
return (0,
|
|
193
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["android", async (config) => {
|
|
194
194
|
const modConfig = config;
|
|
195
195
|
if (modConfig.notification?.icon) await saveIconAsync(modConfig.notification.icon, config.modRequest.projectRoot, SMALL_ICON_DIRS_TO_SIZE, SMALL_ICON_DEFAULT_NAME);
|
|
196
196
|
if (onesignalProps.smallIcons) await saveIconsArrayAsync(config.modRequest.projectRoot, onesignalProps.smallIcons, SMALL_ICON_DIRS_TO_SIZE, SMALL_ICON_DEFAULT_NAME);
|
|
@@ -200,14 +200,14 @@ const withSmallIcons = (config, onesignalProps) => {
|
|
|
200
200
|
const LARGE_ICON_DEFAULT_NAME = "ic_onesignal_large_icon_default";
|
|
201
201
|
const withLargeIcons = (config, onesignalProps) => {
|
|
202
202
|
if (!onesignalProps.largeIcons) return config;
|
|
203
|
-
return (0,
|
|
203
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["android", async (config) => {
|
|
204
204
|
if (onesignalProps.largeIcons) await saveIconsArrayAsync(config.modRequest.projectRoot, onesignalProps.largeIcons, LARGE_ICON_DIRS_TO_SIZE, LARGE_ICON_DEFAULT_NAME);
|
|
205
205
|
return config;
|
|
206
206
|
}]);
|
|
207
207
|
};
|
|
208
208
|
const withSmallIconAccentColor = (config, onesignalProps) => {
|
|
209
209
|
if (!onesignalProps.smallIconAccentColor) return config;
|
|
210
|
-
return (0,
|
|
210
|
+
return (0, expo_config_plugins.withStringsXml)(config, (config) => {
|
|
211
211
|
const colorInARGB = parseColorToARGB(onesignalProps.smallIconAccentColor ?? "");
|
|
212
212
|
const strings = config.modResults.resources.string ?? [];
|
|
213
213
|
const existingIndex = strings.findIndex((stringEntry) => stringEntry.$?.name === "onesignal_notification_accent_color");
|
|
@@ -223,7 +223,7 @@ const withSmallIconAccentColor = (config, onesignalProps) => {
|
|
|
223
223
|
};
|
|
224
224
|
const withLocationModuleGradleProperty = (config, onesignalProps) => {
|
|
225
225
|
if (onesignalProps.disableLocation == null) return config;
|
|
226
|
-
return (0,
|
|
226
|
+
return (0, expo_config_plugins.withGradleProperties)(config, (config) => {
|
|
227
227
|
const properties = config.modResults;
|
|
228
228
|
const existingIndex = properties.findIndex((entry) => entry.type === "property" && entry.key === ONESIGNAL_DISABLE_LOCATION_GRADLE_PROPERTY);
|
|
229
229
|
const property = {
|
|
@@ -263,7 +263,7 @@ async function saveIconAsync(icon, projectRoot, dirsToSize, outputName) {
|
|
|
263
263
|
}
|
|
264
264
|
const withSoundFiles$1 = (config, onesignalProps) => {
|
|
265
265
|
if (!onesignalProps.sounds) return config;
|
|
266
|
-
return (0,
|
|
266
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["android", async (config) => {
|
|
267
267
|
const projectRoot = config.modRequest.projectRoot;
|
|
268
268
|
const rawDir = (0, path.resolve)(projectRoot, RESOURCE_ROOT_PATH, "raw");
|
|
269
269
|
if (!(0, fs.existsSync)(rawDir)) (0, fs.mkdirSync)(rawDir, { recursive: true });
|
|
@@ -452,14 +452,14 @@ function resolveLiveActivityDeploymentTarget(props) {
|
|
|
452
452
|
}
|
|
453
453
|
/** Add NSSupportsLiveActivities=true to the main target's Info.plist. */
|
|
454
454
|
const withLiveActivityInfoPlist = (config) => {
|
|
455
|
-
return (0,
|
|
455
|
+
return (0, expo_config_plugins.withInfoPlist)(config, (newConfig) => {
|
|
456
456
|
newConfig.modResults.NSSupportsLiveActivities = true;
|
|
457
457
|
return newConfig;
|
|
458
458
|
});
|
|
459
459
|
};
|
|
460
460
|
/** Append a Widget Extension target block to the Podfile (idempotent). */
|
|
461
461
|
const withLiveActivityPodfile = (config, props) => {
|
|
462
|
-
return (0,
|
|
462
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["ios", async (config) => {
|
|
463
463
|
const targetName = resolveLiveActivityTargetName(props);
|
|
464
464
|
const podfilePath = path.join(config.modRequest.projectRoot, "ios", "Podfile");
|
|
465
465
|
const podfile = await FileManager.readFile(podfilePath);
|
|
@@ -474,7 +474,7 @@ const withLiveActivityPodfile = (config, props) => {
|
|
|
474
474
|
};
|
|
475
475
|
/** Copy widget extension template files (or the user-supplied widget file) into the iOS project. */
|
|
476
476
|
const withLiveActivityFiles = (config, props) => {
|
|
477
|
-
return (0,
|
|
477
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["ios", async (config) => {
|
|
478
478
|
const targetName = resolveLiveActivityTargetName(props);
|
|
479
479
|
const pluginDir = require.resolve("onesignal-expo-plugin/package.json");
|
|
480
480
|
const sourceDir = path.join(pluginDir, "../widgetExtensionFiles/");
|
|
@@ -498,7 +498,7 @@ const withLiveActivityFiles = (config, props) => {
|
|
|
498
498
|
};
|
|
499
499
|
/** Register the widget extension target, group, build phases, and build settings in the Xcode project. */
|
|
500
500
|
const withLiveActivityXcodeProject = (config, props) => {
|
|
501
|
-
return (0,
|
|
501
|
+
return (0, expo_config_plugins.withXcodeProject)(config, (newConfig) => {
|
|
502
502
|
const xcodeProject = newConfig.modResults;
|
|
503
503
|
const targetName = resolveLiveActivityTargetName(props);
|
|
504
504
|
const widgetBundleId = resolveLiveActivityBundleId(config.ios?.bundleIdentifier ?? "", props);
|
|
@@ -561,7 +561,7 @@ const withOneSignalLiveActivity = (config, props) => {
|
|
|
561
561
|
* @see https://documentation.onesignal.com/docs/react-native-sdk-setup#step-4-install-for-ios-using-cocoapods-for-ios-apps
|
|
562
562
|
*/
|
|
563
563
|
const withAppEnvironment = (config, onesignalProps) => {
|
|
564
|
-
return (0,
|
|
564
|
+
return (0, expo_config_plugins.withEntitlementsPlist)(config, (newConfig) => {
|
|
565
565
|
if (onesignalProps?.mode == null) throw new Error(`
|
|
566
566
|
Missing required "mode" key in your app.json or app.config.js file for "onesignal-expo-plugin".
|
|
567
567
|
"mode" can be either "development" or "production".
|
|
@@ -576,7 +576,7 @@ const withAppEnvironment = (config, onesignalProps) => {
|
|
|
576
576
|
*/
|
|
577
577
|
const withRemoteNotificationsPermissions = (config) => {
|
|
578
578
|
const BACKGROUND_MODE_KEYS = ["remote-notification"];
|
|
579
|
-
return (0,
|
|
579
|
+
return (0, expo_config_plugins.withInfoPlist)(config, (newConfig) => {
|
|
580
580
|
if (!Array.isArray(newConfig.modResults.UIBackgroundModes)) newConfig.modResults.UIBackgroundModes = [];
|
|
581
581
|
for (const key of BACKGROUND_MODE_KEYS) if (!newConfig.modResults.UIBackgroundModes.includes(key)) newConfig.modResults.UIBackgroundModes.push(key);
|
|
582
582
|
return newConfig;
|
|
@@ -588,7 +588,7 @@ const withRemoteNotificationsPermissions = (config) => {
|
|
|
588
588
|
*/
|
|
589
589
|
const withAppGroupPermissions = (config, props) => {
|
|
590
590
|
const APP_GROUP_KEY = "com.apple.security.application-groups";
|
|
591
|
-
return (0,
|
|
591
|
+
return (0, expo_config_plugins.withEntitlementsPlist)(config, (newConfig) => {
|
|
592
592
|
if (!Array.isArray(newConfig.modResults[APP_GROUP_KEY])) newConfig.modResults[APP_GROUP_KEY] = [];
|
|
593
593
|
const modResultsArray = newConfig.modResults[APP_GROUP_KEY];
|
|
594
594
|
const entitlement = getAppGroupIdentifier(newConfig?.ios?.bundleIdentifier || "", props?.appGroupName);
|
|
@@ -602,7 +602,7 @@ const withAppGroupPermissions = (config, props) => {
|
|
|
602
602
|
* @see https://documentation.onesignal.com/docs/ios-sdk-setup#step-3-create-an-app-group
|
|
603
603
|
*/
|
|
604
604
|
const withCustomAppGroupsKey = (config, props) => {
|
|
605
|
-
return (0,
|
|
605
|
+
return (0, expo_config_plugins.withInfoPlist)(config, (newConfig) => {
|
|
606
606
|
if (props?.appGroupName) newConfig.modResults.OneSignal_app_groups_key = props.appGroupName;
|
|
607
607
|
return newConfig;
|
|
608
608
|
});
|
|
@@ -613,7 +613,7 @@ const withEasManagedCredentials = (config, props) => {
|
|
|
613
613
|
return config;
|
|
614
614
|
};
|
|
615
615
|
const withOneSignalPodfile = (config, props) => {
|
|
616
|
-
return (0,
|
|
616
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["ios", async (config) => {
|
|
617
617
|
await updatePodfile(path.join(config.modRequest.projectRoot, "ios"), props.disableLocation === true);
|
|
618
618
|
return config;
|
|
619
619
|
}]);
|
|
@@ -621,13 +621,13 @@ const withOneSignalPodfile = (config, props) => {
|
|
|
621
621
|
const withLocationModulePodfile = (config, props) => {
|
|
622
622
|
const disableLocation = props.disableLocation;
|
|
623
623
|
if (disableLocation == null) return config;
|
|
624
|
-
return (0,
|
|
624
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["ios", async (config) => {
|
|
625
625
|
await updatePodfileLocationModule(path.join(config.modRequest.projectRoot, "ios"), disableLocation);
|
|
626
626
|
return config;
|
|
627
627
|
}]);
|
|
628
628
|
};
|
|
629
629
|
const withOneSignalNSE = (config, props) => {
|
|
630
|
-
return (0,
|
|
630
|
+
return (0, expo_config_plugins.withDangerousMod)(config, ["ios", async (config) => {
|
|
631
631
|
const pluginDir = require.resolve("onesignal-expo-plugin/package.json");
|
|
632
632
|
const sourceDir = path.join(pluginDir, "../serviceExtensionFiles/");
|
|
633
633
|
const iosPath = path.join(config.modRequest.projectRoot, "ios");
|
|
@@ -657,7 +657,7 @@ const withOneSignalNSE = (config, props) => {
|
|
|
657
657
|
}]);
|
|
658
658
|
};
|
|
659
659
|
const withOneSignalXcodeProject = (config, props) => {
|
|
660
|
-
return (0,
|
|
660
|
+
return (0, expo_config_plugins.withXcodeProject)(config, (newConfig) => {
|
|
661
661
|
const xcodeProject = newConfig.modResults;
|
|
662
662
|
const nseBundleId = `${config.ios?.bundleIdentifier}.${props.nseBundleIdentifier ?? "OneSignalNotificationServiceExtension"}`;
|
|
663
663
|
const devTeam = resolveDevTeam(config, props);
|
|
@@ -687,7 +687,7 @@ const withOneSignalXcodeProject = (config, props) => {
|
|
|
687
687
|
for (const key in configurations) if (typeof configurations[key].buildSettings !== "undefined" && configurations[key].buildSettings.PRODUCT_NAME == `"OneSignalNotificationServiceExtension"`) {
|
|
688
688
|
const buildSettingsObj = configurations[key].buildSettings;
|
|
689
689
|
buildSettingsObj.DEVELOPMENT_TEAM = devTeam;
|
|
690
|
-
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = props?.iPhoneDeploymentTarget ?? "
|
|
690
|
+
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = props?.iPhoneDeploymentTarget ?? "15.0";
|
|
691
691
|
buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
|
|
692
692
|
buildSettingsObj.SWIFT_VERSION = "5.0";
|
|
693
693
|
buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${NSE_TARGET_NAME}/${NSE_TARGET_NAME}.entitlements`;
|
|
@@ -700,10 +700,10 @@ const withOneSignalXcodeProject = (config, props) => {
|
|
|
700
700
|
};
|
|
701
701
|
const withSoundFiles = (config, onesignalProps) => {
|
|
702
702
|
if (!onesignalProps.sounds) return config;
|
|
703
|
-
return (0,
|
|
703
|
+
return (0, expo_config_plugins.withXcodeProject)(config, (config) => {
|
|
704
704
|
const projectRoot = config.modRequest.projectRoot;
|
|
705
705
|
const projectName = config.modRequest.projectName;
|
|
706
|
-
const sourceRoot =
|
|
706
|
+
const sourceRoot = expo_config_plugins.IOSConfig.Paths.getSourceRoot(projectRoot);
|
|
707
707
|
let project = config.modResults;
|
|
708
708
|
for (const soundFile of onesignalProps.sounds) {
|
|
709
709
|
const fileName = path.basename(soundFile);
|
|
@@ -711,7 +711,7 @@ const withSoundFiles = (config, onesignalProps) => {
|
|
|
711
711
|
const destPath = path.resolve(sourceRoot, fileName);
|
|
712
712
|
OneSignalLog.log(`Copying sound file ${soundFile} to iOS project`);
|
|
713
713
|
fs.copyFileSync(sourcePath, destPath);
|
|
714
|
-
if (!project.hasFile(`${projectName}/${fileName}`)) project =
|
|
714
|
+
if (!project.hasFile(`${projectName}/${fileName}`)) project = expo_config_plugins.IOSConfig.XcodeUtils.addResourceFileToGroup({
|
|
715
715
|
filepath: `${projectName}/${fileName}`,
|
|
716
716
|
groupName: projectName,
|
|
717
717
|
project,
|
package/dist/plugin.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ type OneSignalPluginProps = {
|
|
|
38
38
|
devTeam?: string;
|
|
39
39
|
/**
|
|
40
40
|
* (optional) Target IPHONEOS_DEPLOYMENT_TARGET value to be used when adding the iOS NSE. A deployment target is nothing more than
|
|
41
|
-
* the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: "
|
|
41
|
+
* the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: "15.0".
|
|
42
42
|
*/
|
|
43
43
|
iPhoneDeploymentTarget?: string;
|
|
44
44
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onesignal-expo-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "OneSignal Expo config plugin for adding iOS and Android push notification support to managed Expo apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"EAS",
|
|
@@ -51,13 +51,19 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "^22.19.3",
|
|
54
|
-
"@vitest/coverage-v8": "
|
|
54
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
55
55
|
"typescript": "^6.0.3",
|
|
56
|
-
"vite
|
|
56
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
|
|
57
|
+
"vite-plus": "1.0.0",
|
|
58
|
+
"vitest": "5.0.1"
|
|
57
59
|
},
|
|
58
60
|
"peerDependencies": {
|
|
59
61
|
"expo": ">=53.0.0",
|
|
60
62
|
"react-native-onesignal": ">=5.0.0"
|
|
61
63
|
},
|
|
62
|
-
"
|
|
64
|
+
"overrides": {
|
|
65
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
|
|
66
|
+
"vitest": "5.0.1"
|
|
67
|
+
},
|
|
68
|
+
"packageManager": "bun@1.4.2"
|
|
63
69
|
}
|