onesignal-expo-plugin
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -33,7 +33,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.xcodeProjectAddNse = exports.withOneSignalIos = void 0; | ||
exports.withOneSignalIos = void 0; | ||
const config_plugins_1 = require("@expo/config-plugins"); | ||
const fs = __importStar(require("fs")); | ||
const path = __importStar(require("path")); | ||
const xcode_1 = __importDefault(require("xcode")); | ||
const iosConstants_1 = require("../support/iosConstants"); | ||
@@ -100,21 +99,2 @@ const updatePodfile_1 = require("../support/updatePodfile"); | ||
}; | ||
const withOneSignalNSE = (config, onesignalProps) => { | ||
return (0, config_plugins_1.withXcodeProject)(config, async (props) => { | ||
var _a, _b; | ||
const options = { | ||
iosPath: props.modRequest.platformProjectRoot, | ||
bundleIdentifier: (_a = props.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier, | ||
devTeam: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.devTeam, | ||
bundleVersion: (_b = props.ios) === null || _b === void 0 ? void 0 : _b.buildNumber, | ||
bundleShortVersion: props === null || props === void 0 ? void 0 : props.version, | ||
mode: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.mode, | ||
iPhoneDeploymentTarget: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.iPhoneDeploymentTarget, | ||
iosNSEFilePath: onesignalProps.iosNSEFilePath | ||
}; | ||
// support for monorepos where node_modules can be above the project directory. | ||
const pluginDir = require.resolve("onesignal-expo-plugin/package.json"); | ||
xcodeProjectAddNse(props.modRequest.projectName || "", options, path.join(pluginDir, "../build/support/serviceExtensionFiles/")); | ||
return props; | ||
}); | ||
}; | ||
const withEasManagedCredentials = (config) => { | ||
@@ -126,46 +106,48 @@ var _a; | ||
}; | ||
const withOneSignalIos = (config, props) => { | ||
withAppEnvironment(config, props); | ||
withRemoteNotificationsPermissions(config, props); | ||
withAppGroupPermissions(config, props); | ||
withOneSignalNSE(config, props); | ||
withEasManagedCredentials(config, props); | ||
return config; | ||
const withOneSignalPodfile = (config) => { | ||
return (0, config_plugins_1.withDangerousMod)(config, [ | ||
'ios', | ||
async (config) => { | ||
// not awaiting in order to not block main thread | ||
const iosRoot = path.join(config.modRequest.projectRoot, "ios"); | ||
(0, updatePodfile_1.updatePodfile)(iosRoot).catch(err => { OneSignalLog_1.OneSignalLog.error(err); }); | ||
return config; | ||
}, | ||
]); | ||
}; | ||
exports.withOneSignalIos = withOneSignalIos; | ||
function xcodeProjectAddNse(appName, options, sourceDir) { | ||
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, iosNSEFilePath } = options; | ||
// not awaiting in order to not block main thread | ||
(0, updatePodfile_1.updatePodfile)(iosPath).catch(err => { OneSignalLog_1.OneSignalLog.error(err); }); | ||
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`; | ||
const sourceFile = "NotificationService.m"; | ||
const extFiles = [ | ||
"NotificationService.h", | ||
`${iosConstants_1.NSE_TARGET_NAME}.entitlements`, | ||
`${iosConstants_1.NSE_TARGET_NAME}-Info.plist` | ||
]; | ||
const xcodeProject = xcode_1.default.project(projPath); | ||
xcodeProject.parse(async function (err) { | ||
if (err) { | ||
OneSignalLog_1.OneSignalLog.log(`Error parsing iOS project: ${JSON.stringify(err)}`); | ||
return; | ||
} | ||
/* COPY OVER EXTENSION FILES */ | ||
fs.mkdirSync(`${iosPath}/${iosConstants_1.NSE_TARGET_NAME}`, { recursive: true }); | ||
for (let i = 0; i < extFiles.length; i++) { | ||
const extFile = extFiles[i]; | ||
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${extFile}`; | ||
await FileManager_1.FileManager.copyFile(`${sourceDir}${extFile}`, targetFile); | ||
} | ||
// Copy NSE source file either from configuration-provided location, falling back to the default one. | ||
const sourcePath = iosNSEFilePath !== null && iosNSEFilePath !== void 0 ? iosNSEFilePath : `${sourceDir}${sourceFile}`; | ||
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${sourceFile}`; | ||
await FileManager_1.FileManager.copyFile(`${sourcePath}`, targetFile); | ||
/* MODIFY COPIED EXTENSION FILES */ | ||
const nseUpdater = new NseUpdaterManager_1.default(iosPath); | ||
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`); | ||
await nseUpdater.updateNSEBundleVersion(bundleVersion !== null && bundleVersion !== void 0 ? bundleVersion : iosConstants_1.DEFAULT_BUNDLE_VERSION); | ||
await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion !== null && bundleShortVersion !== void 0 ? bundleShortVersion : iosConstants_1.DEFAULT_BUNDLE_SHORT_VERSION); | ||
const withOneSignalNSE = (config, props) => { | ||
// support for monorepos where node_modules can be above the project directory. | ||
const pluginDir = require.resolve("onesignal-expo-plugin/package.json"); | ||
const sourceDir = path.join(pluginDir, "../build/support/serviceExtensionFiles/"); | ||
return (0, config_plugins_1.withDangerousMod)(config, [ | ||
'ios', | ||
async (config) => { | ||
var _a, _b, _c, _d, _e; | ||
const iosPath = path.join(config.modRequest.projectRoot, "ios"); | ||
/* COPY OVER EXTENSION FILES */ | ||
fs.mkdirSync(`${iosPath}/${iosConstants_1.NSE_TARGET_NAME}`, { recursive: true }); | ||
for (let i = 0; i < iosConstants_1.NSE_EXT_FILES.length; i++) { | ||
const extFile = iosConstants_1.NSE_EXT_FILES[i]; | ||
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${extFile}`; | ||
await FileManager_1.FileManager.copyFile(`${sourceDir}${extFile}`, targetFile); | ||
} | ||
// Copy NSE source file either from configuration-provided location, falling back to the default one. | ||
const sourcePath = (_a = props.iosNSEFilePath) !== null && _a !== void 0 ? _a : `${sourceDir}${iosConstants_1.NSE_SOURCE_FILE}`; | ||
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${iosConstants_1.NSE_SOURCE_FILE}`; | ||
await FileManager_1.FileManager.copyFile(`${sourcePath}`, targetFile); | ||
/* MODIFY COPIED EXTENSION FILES */ | ||
const nseUpdater = new NseUpdaterManager_1.default(iosPath); | ||
await nseUpdater.updateNSEEntitlements(`group.${(_b = config.ios) === null || _b === void 0 ? void 0 : _b.bundleIdentifier}.onesignal`); | ||
await nseUpdater.updateNSEBundleVersion((_d = (_c = config.ios) === null || _c === void 0 ? void 0 : _c.buildNumber) !== null && _d !== void 0 ? _d : iosConstants_1.DEFAULT_BUNDLE_VERSION); | ||
await nseUpdater.updateNSEBundleShortVersion((_e = config === null || config === void 0 ? void 0 : config.version) !== null && _e !== void 0 ? _e : iosConstants_1.DEFAULT_BUNDLE_SHORT_VERSION); | ||
return config; | ||
}, | ||
]); | ||
}; | ||
const withOneSignalXcodeProject = (config, props) => { | ||
return (0, config_plugins_1.withXcodeProject)(config, newConfig => { | ||
var _a, _b; | ||
const xcodeProject = newConfig.modResults; | ||
// Create new PBXGroup for the extension | ||
const extGroup = xcodeProject.addPbxGroup([...extFiles, sourceFile], iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME); | ||
const extGroup = xcodeProject.addPbxGroup([...iosConstants_1.NSE_EXT_FILES, iosConstants_1.NSE_SOURCE_FILE], iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME); | ||
// Add the new PBXGroup to the top level group. This makes the | ||
@@ -188,7 +170,7 @@ // files / folder appear in the file explorer in Xcode. | ||
OneSignalLog_1.OneSignalLog.log(`${iosConstants_1.NSE_TARGET_NAME} already exists in project. Skipping...`); | ||
return; | ||
return newConfig; | ||
} | ||
// Add the NSE target | ||
// This adds PBXTargetDependency and PBXContainerItemProxy for you | ||
const nseTarget = xcodeProject.addTarget(iosConstants_1.NSE_TARGET_NAME, "app_extension", iosConstants_1.NSE_TARGET_NAME, `${bundleIdentifier}.${iosConstants_1.NSE_TARGET_NAME}`); | ||
const nseTarget = xcodeProject.addTarget(iosConstants_1.NSE_TARGET_NAME, "app_extension", iosConstants_1.NSE_TARGET_NAME, `${(_a = config.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier}.${iosConstants_1.NSE_TARGET_NAME}`); | ||
// Add build phases to the new target | ||
@@ -205,4 +187,4 @@ xcodeProject.addBuildPhase(["NotificationService.m"], "PBXSourcesBuildPhase", "Sources", nseTarget.uuid); | ||
const buildSettingsObj = configurations[key].buildSettings; | ||
buildSettingsObj.DEVELOPMENT_TEAM = devTeam; | ||
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iPhoneDeploymentTarget !== null && iPhoneDeploymentTarget !== void 0 ? iPhoneDeploymentTarget : iosConstants_1.IPHONEOS_DEPLOYMENT_TARGET; | ||
buildSettingsObj.DEVELOPMENT_TEAM = props === null || props === void 0 ? void 0 : props.devTeam; | ||
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = (_b = props === null || props === void 0 ? void 0 : props.iPhoneDeploymentTarget) !== null && _b !== void 0 ? _b : iosConstants_1.IPHONEOS_DEPLOYMENT_TARGET; | ||
buildSettingsObj.TARGETED_DEVICE_FAMILY = iosConstants_1.TARGETED_DEVICE_FAMILY; | ||
@@ -214,7 +196,17 @@ buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${iosConstants_1.NSE_TARGET_NAME}/${iosConstants_1.NSE_TARGET_NAME}.entitlements`; | ||
// Add development teams to both your target and the original project | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", devTeam, nseTarget); | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", devTeam); | ||
fs.writeFileSync(projPath, xcodeProject.writeSync()); | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", props === null || props === void 0 ? void 0 : props.devTeam, nseTarget); | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", props === null || props === void 0 ? void 0 : props.devTeam); | ||
return newConfig; | ||
}); | ||
} | ||
exports.xcodeProjectAddNse = xcodeProjectAddNse; | ||
}; | ||
const withOneSignalIos = (config, props) => { | ||
config = withAppEnvironment(config, props); | ||
config = withRemoteNotificationsPermissions(config, props); | ||
config = withAppGroupPermissions(config, props); | ||
config = withOneSignalPodfile(config, props); | ||
config = withOneSignalNSE(config, props); | ||
config = withOneSignalXcodeProject(config, props); | ||
config = withEasManagedCredentials(config, props); | ||
return config; | ||
}; | ||
exports.withOneSignalIos = withOneSignalIos; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NSE_TARGET_NAME = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.DEFAULT_BUNDLE_VERSION = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.NSE_PODFILE_REGEX = exports.NSE_PODFILE_SNIPPET = exports.TARGETED_DEVICE_FAMILY = exports.IPHONEOS_DEPLOYMENT_TARGET = void 0; | ||
exports.NSE_EXT_FILES = exports.NSE_SOURCE_FILE = exports.NSE_TARGET_NAME = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.DEFAULT_BUNDLE_VERSION = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.NSE_PODFILE_REGEX = exports.NSE_PODFILE_SNIPPET = exports.TARGETED_DEVICE_FAMILY = exports.IPHONEOS_DEPLOYMENT_TARGET = void 0; | ||
exports.IPHONEOS_DEPLOYMENT_TARGET = "11.0"; | ||
@@ -18,1 +18,7 @@ exports.TARGETED_DEVICE_FAMILY = `"1,2"`; | ||
exports.NSE_TARGET_NAME = "OneSignalNotificationServiceExtension"; | ||
exports.NSE_SOURCE_FILE = "NotificationService.m"; | ||
exports.NSE_EXT_FILES = [ | ||
"NotificationService.h", | ||
`${exports.NSE_TARGET_NAME}.entitlements`, | ||
`${exports.NSE_TARGET_NAME}-Info.plist` | ||
]; |
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
## April 2023 | ||
### `1.3.2` - 04/18/23 | ||
#### Changes | ||
- Update iOS generation to write xcode project via expo mod rather than directly to file system. | ||
- Bump qs from 6.5.2 to 6.5.3 | ||
- Bump decode-uri-component from 0.2.0 to 0.2.2 | ||
- Bump @xmldom/xmldom from 0.7.5 to 0.7.10 | ||
- Bump multiple dependency versions in OneSignal Example App (ua-parser-js, decode-uri-component, @sideway/formula, @xmldom/xmldom) | ||
## March 2023 | ||
@@ -5,0 +14,0 @@ ### `1.3.1` - 03/03/23 |
@@ -11,6 +11,6 @@ /** | ||
withXcodeProject, | ||
withDangerousMod | ||
} from "@expo/config-plugins"; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import xcode from 'xcode'; | ||
import { | ||
@@ -21,2 +21,4 @@ DEFAULT_BUNDLE_SHORT_VERSION, | ||
NSE_TARGET_NAME, | ||
NSE_SOURCE_FILE, | ||
NSE_EXT_FILES, | ||
TARGETED_DEVICE_FAMILY | ||
@@ -28,3 +30,3 @@ } from "../support/iosConstants"; | ||
import { FileManager } from "../support/FileManager"; | ||
import { OneSignalPluginProps, PluginOptions } from "../types/types"; | ||
import { OneSignalPluginProps } from "../types/types"; | ||
import assert from 'assert'; | ||
@@ -100,28 +102,2 @@ import getEasManagedCredentialsConfigExtra from "../support/eas/getEasManagedCredentialsConfigExtra"; | ||
const withOneSignalNSE: ConfigPlugin<OneSignalPluginProps> = (config, onesignalProps) => { | ||
return withXcodeProject(config, async props => { | ||
const options: PluginOptions = { | ||
iosPath: props.modRequest.platformProjectRoot, | ||
bundleIdentifier: props.ios?.bundleIdentifier, | ||
devTeam: onesignalProps?.devTeam, | ||
bundleVersion: props.ios?.buildNumber, | ||
bundleShortVersion: props?.version, | ||
mode: onesignalProps?.mode, | ||
iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget, | ||
iosNSEFilePath: onesignalProps.iosNSEFilePath | ||
}; | ||
// support for monorepos where node_modules can be above the project directory. | ||
const pluginDir = require.resolve("onesignal-expo-plugin/package.json") | ||
xcodeProjectAddNse( | ||
props.modRequest.projectName || "", | ||
options, | ||
path.join(pluginDir, "../build/support/serviceExtensionFiles/") | ||
); | ||
return props; | ||
}); | ||
} | ||
const withEasManagedCredentials: ConfigPlugin<OneSignalPluginProps> = (config) => { | ||
@@ -133,64 +109,57 @@ assert(config.ios?.bundleIdentifier, "Missing 'ios.bundleIdentifier' in app config.") | ||
export const withOneSignalIos: ConfigPlugin<OneSignalPluginProps> = ( | ||
config, | ||
props | ||
) => { | ||
withAppEnvironment(config, props); | ||
withRemoteNotificationsPermissions(config, props); | ||
withAppGroupPermissions(config, props); | ||
withOneSignalNSE(config, props); | ||
withEasManagedCredentials(config, props); | ||
return config; | ||
}; | ||
const withOneSignalPodfile: ConfigPlugin<OneSignalPluginProps> = (config) => { | ||
return withDangerousMod(config, [ | ||
'ios', | ||
async config => { | ||
// not awaiting in order to not block main thread | ||
const iosRoot = path.join(config.modRequest.projectRoot, "ios") | ||
updatePodfile(iosRoot).catch(err => { OneSignalLog.error(err) }); | ||
export function xcodeProjectAddNse( | ||
appName: string, | ||
options: PluginOptions, | ||
sourceDir: string | ||
): void { | ||
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, iosNSEFilePath } = options; | ||
return config; | ||
}, | ||
]); | ||
} | ||
// not awaiting in order to not block main thread | ||
updatePodfile(iosPath).catch(err => { OneSignalLog.error(err) }); | ||
const withOneSignalNSE: ConfigPlugin<OneSignalPluginProps> = (config, props) => { | ||
// support for monorepos where node_modules can be above the project directory. | ||
const pluginDir = require.resolve("onesignal-expo-plugin/package.json") | ||
const sourceDir = path.join(pluginDir, "../build/support/serviceExtensionFiles/") | ||
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`; | ||
return withDangerousMod(config, [ | ||
'ios', | ||
async config => { | ||
const iosPath = path.join(config.modRequest.projectRoot, "ios") | ||
const sourceFile = "NotificationService.m" | ||
const extFiles = [ | ||
"NotificationService.h", | ||
`${NSE_TARGET_NAME}.entitlements`, | ||
`${NSE_TARGET_NAME}-Info.plist` | ||
]; | ||
/* COPY OVER EXTENSION FILES */ | ||
fs.mkdirSync(`${iosPath}/${NSE_TARGET_NAME}`, { recursive: true }); | ||
const xcodeProject = xcode.project(projPath); | ||
for (let i = 0; i < NSE_EXT_FILES.length; i++) { | ||
const extFile = NSE_EXT_FILES[i]; | ||
const targetFile = `${iosPath}/${NSE_TARGET_NAME}/${extFile}`; | ||
await FileManager.copyFile(`${sourceDir}${extFile}`, targetFile); | ||
} | ||
xcodeProject.parse(async function(err: Error) { | ||
if (err) { | ||
OneSignalLog.log(`Error parsing iOS project: ${JSON.stringify(err)}`); | ||
return; | ||
} | ||
// Copy NSE source file either from configuration-provided location, falling back to the default one. | ||
const sourcePath = props.iosNSEFilePath ?? `${sourceDir}${NSE_SOURCE_FILE}` | ||
const targetFile = `${iosPath}/${NSE_TARGET_NAME}/${NSE_SOURCE_FILE}`; | ||
await FileManager.copyFile(`${sourcePath}`, targetFile); | ||
/* COPY OVER EXTENSION FILES */ | ||
fs.mkdirSync(`${iosPath}/${NSE_TARGET_NAME}`, { recursive: true }); | ||
/* MODIFY COPIED EXTENSION FILES */ | ||
const nseUpdater = new NseUpdaterManager(iosPath); | ||
await nseUpdater.updateNSEEntitlements(`group.${config.ios?.bundleIdentifier}.onesignal`) | ||
await nseUpdater.updateNSEBundleVersion(config.ios?.buildNumber ?? DEFAULT_BUNDLE_VERSION); | ||
await nseUpdater.updateNSEBundleShortVersion(config?.version ?? DEFAULT_BUNDLE_SHORT_VERSION); | ||
for (let i = 0; i < extFiles.length; i++) { | ||
const extFile = extFiles[i]; | ||
const targetFile = `${iosPath}/${NSE_TARGET_NAME}/${extFile}`; | ||
await FileManager.copyFile(`${sourceDir}${extFile}`, targetFile); | ||
} | ||
return config; | ||
}, | ||
]); | ||
} | ||
// Copy NSE source file either from configuration-provided location, falling back to the default one. | ||
const sourcePath = iosNSEFilePath ?? `${sourceDir}${sourceFile}` | ||
const targetFile = `${iosPath}/${NSE_TARGET_NAME}/${sourceFile}`; | ||
await FileManager.copyFile(`${sourcePath}`, targetFile); | ||
const withOneSignalXcodeProject: ConfigPlugin<OneSignalPluginProps> = (config, props) => { | ||
return withXcodeProject(config, newConfig => { | ||
const xcodeProject = newConfig.modResults | ||
/* MODIFY COPIED EXTENSION FILES */ | ||
const nseUpdater = new NseUpdaterManager(iosPath); | ||
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`) | ||
await nseUpdater.updateNSEBundleVersion(bundleVersion ?? DEFAULT_BUNDLE_VERSION); | ||
await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion ?? DEFAULT_BUNDLE_SHORT_VERSION); | ||
// Create new PBXGroup for the extension | ||
const extGroup = xcodeProject.addPbxGroup([...extFiles, sourceFile], NSE_TARGET_NAME, NSE_TARGET_NAME); | ||
const extGroup = xcodeProject.addPbxGroup([...NSE_EXT_FILES, NSE_SOURCE_FILE], NSE_TARGET_NAME, NSE_TARGET_NAME); | ||
// Add the new PBXGroup to the top level group. This makes the | ||
@@ -215,3 +184,3 @@ // files / folder appear in the file explorer in Xcode. | ||
OneSignalLog.log(`${NSE_TARGET_NAME} already exists in project. Skipping...`); | ||
return; | ||
return newConfig; | ||
} | ||
@@ -221,3 +190,3 @@ | ||
// This adds PBXTargetDependency and PBXContainerItemProxy for you | ||
const nseTarget = xcodeProject.addTarget(NSE_TARGET_NAME, "app_extension", NSE_TARGET_NAME, `${bundleIdentifier}.${NSE_TARGET_NAME}`); | ||
const nseTarget = xcodeProject.addTarget(NSE_TARGET_NAME, "app_extension", NSE_TARGET_NAME, `${config.ios?.bundleIdentifier}.${NSE_TARGET_NAME}`); | ||
@@ -249,4 +218,4 @@ // Add build phases to the new target | ||
const buildSettingsObj = configurations[key].buildSettings; | ||
buildSettingsObj.DEVELOPMENT_TEAM = devTeam; | ||
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iPhoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET; | ||
buildSettingsObj.DEVELOPMENT_TEAM = props?.devTeam; | ||
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = props?.iPhoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET; | ||
buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY; | ||
@@ -259,7 +228,17 @@ buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${NSE_TARGET_NAME}/${NSE_TARGET_NAME}.entitlements`; | ||
// Add development teams to both your target and the original project | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", devTeam, nseTarget); | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", devTeam); | ||
fs.writeFileSync(projPath, xcodeProject.writeSync()); | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", props?.devTeam, nseTarget); | ||
xcodeProject.addTargetAttribute("DevelopmentTeam", props?.devTeam); | ||
return newConfig; | ||
}) | ||
} | ||
export const withOneSignalIos: ConfigPlugin<OneSignalPluginProps> = (config, props) => { | ||
config = withAppEnvironment(config, props); | ||
config = withRemoteNotificationsPermissions(config, props); | ||
config = withAppGroupPermissions(config, props); | ||
config = withOneSignalPodfile(config, props) | ||
config = withOneSignalNSE(config, props) | ||
config = withOneSignalXcodeProject(config, props) | ||
config = withEasManagedCredentials(config, props); | ||
return config; | ||
}; |
{ | ||
"name": "onesignal-expo-plugin", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.", | ||
@@ -44,5 +44,4 @@ "main": "./app.plugin.js", | ||
"dependencies": { | ||
"xcode": "^3.0.1", | ||
"@expo/image-utils": "^0.3.22" | ||
} | ||
} |
@@ -20,1 +20,7 @@ export const IPHONEOS_DEPLOYMENT_TARGET = "11.0"; | ||
export const NSE_TARGET_NAME = "OneSignalNotificationServiceExtension"; | ||
export const NSE_SOURCE_FILE = "NotificationService.m" | ||
export const NSE_EXT_FILES = [ | ||
"NotificationService.h", | ||
`${NSE_TARGET_NAME}.entitlements`, | ||
`${NSE_TARGET_NAME}-Info.plist` | ||
]; |
@@ -40,17 +40,2 @@ /** | ||
/** | ||
* Not to be confused with OneSignalPluginProps, PluginOptions are the *internal* properties used by the config plugin | ||
* These include a combination of user-defined properties (from OneSignalPluginProps) and other data to pass between functions | ||
*/ | ||
export type PluginOptions = { | ||
iosPath: string, | ||
mode: Mode, | ||
devTeam?: string, | ||
bundleVersion?: string, | ||
bundleShortVersion?: string, | ||
bundleIdentifier?: string, | ||
iPhoneDeploymentTarget?: string, | ||
iosNSEFilePath?: string | ||
} | ||
export enum Mode { | ||
@@ -57,0 +42,0 @@ Dev = "development", |
Sorry, the diff of this file is not supported yet
1
90160
45
1050
- Removedxcode@^3.0.1
- Removed@xmldom/xmldom@0.8.10(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbig-integer@1.6.52(transitive)
- Removedbplist-creator@0.1.1(transitive)
- Removedbplist-parser@0.3.2(transitive)
- Removedplist@3.1.0(transitive)
- Removedsimple-plist@1.4.0(transitive)
- Removedstream-buffers@2.2.0(transitive)
- Removeduuid@7.0.3(transitive)
- Removedxcode@3.0.1(transitive)
- Removedxmlbuilder@15.1.1(transitive)