onesignal-expo-plugin
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -8,23 +8,7 @@ "use strict"; | ||
exports.withOneSignalAndroid = void 0; | ||
const config_plugins_1 = require("@expo/config-plugins"); | ||
const androidConstants_1 = require("../support/androidConstants"); | ||
const OneSignalLog_1 = require("../support/OneSignalLog"); | ||
const withGradleBuildConfig = (config) => { | ||
return (0, config_plugins_1.withAppBuildGradle)(config, (newConfig) => { | ||
let { contents } = newConfig.modResults; | ||
// make sure we haven't previously added dependencies | ||
if (!contents.includes(androidConstants_1.ONESIGNAL_GRADLE)) { | ||
contents = `${androidConstants_1.ONESIGNAL_GRADLE}\n${contents}`; | ||
} | ||
else { | ||
OneSignalLog_1.OneSignalLog.log("OneSignal dependencies already added to build.gradle. Skipping..."); | ||
} | ||
newConfig.modResults.contents = contents; | ||
return newConfig; | ||
}); | ||
}; | ||
const withOneSignalAndroid = (config, props) => { | ||
withGradleBuildConfig(config, props); | ||
OneSignalLog_1.OneSignalLog.log("No specific actions required for OneSignal on Android..."); | ||
return config; | ||
}; | ||
exports.withOneSignalAndroid = withOneSignalAndroid; |
@@ -106,3 +106,9 @@ "use strict"; | ||
}; | ||
xcodeProjectAddNse(props.modRequest.projectName || "", options, "node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/"); | ||
// support for monorepos where node_modules can be up to 5 parents | ||
// above the project directory. | ||
let dir = "node_modules"; | ||
for (let x = 0; x < 5 && !FileManager_1.FileManager.dirExists(dir); x++) { | ||
dir = "../" + dir; | ||
} | ||
xcodeProjectAddNse(props.modRequest.projectName || "", options, dir + "/onesignal-expo-plugin/build/support/serviceExtensionFiles/"); | ||
return props; | ||
@@ -109,0 +115,0 @@ }); |
@@ -57,3 +57,6 @@ "use strict"; | ||
} | ||
static dirExists(path) { | ||
return fs.existsSync(path); | ||
} | ||
} | ||
exports.FileManager = FileManager; |
@@ -6,23 +6,6 @@ /** | ||
import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins'; | ||
import { ONESIGNAL_GRADLE } from '../support/androidConstants'; | ||
import { ConfigPlugin } from '@expo/config-plugins'; | ||
import { OneSignalLog } from '../support/OneSignalLog'; | ||
import { OneSignalPluginProps } from '../types/types'; | ||
const withGradleBuildConfig: ConfigPlugin<OneSignalPluginProps> = (config) => { | ||
return withAppBuildGradle(config, (newConfig) => { | ||
let { contents } = newConfig.modResults; | ||
// make sure we haven't previously added dependencies | ||
if (!contents.includes(ONESIGNAL_GRADLE)) { | ||
contents = `${ONESIGNAL_GRADLE}\n${contents}`; | ||
} else { | ||
OneSignalLog.log("OneSignal dependencies already added to build.gradle. Skipping..."); | ||
} | ||
newConfig.modResults.contents = contents; | ||
return newConfig; | ||
}); | ||
}; | ||
export const withOneSignalAndroid: ConfigPlugin<OneSignalPluginProps> = ( | ||
@@ -32,5 +15,5 @@ config, | ||
) => { | ||
withGradleBuildConfig(config, props); | ||
OneSignalLog.log("No specific actions required for OneSignal on Android..."); | ||
return config; | ||
}; |
@@ -108,6 +108,13 @@ /** | ||
// support for monorepos where node_modules can be up to 5 parents | ||
// above the project directory. | ||
let dir = "node_modules" | ||
for(let x=0; x < 5 && !FileManager.dirExists(dir); x++) { | ||
dir = "../" + dir | ||
} | ||
xcodeProjectAddNse( | ||
props.modRequest.projectName || "", | ||
options, | ||
"node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/" | ||
dir + "/onesignal-expo-plugin/build/support/serviceExtensionFiles/" | ||
); | ||
@@ -114,0 +121,0 @@ |
{ | ||
"name": "onesignal-expo-plugin", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.", | ||
@@ -5,0 +5,0 @@ "main": "./app.plugin.js", |
<h1 align="center">Welcome to onesignal-expo-plugin 👋</h1> | ||
<p> | ||
<img alt="Version" src="https://img.shields.io/badge/version-1.0.1-blue.svg?cacheSeconds=2592000" /> | ||
<a href="https://www.npmjs.com/package/onesignal-expo-plugin" target="_blank"> | ||
<img alt="Version" src="https://img.shields.io/npm/v/onesignal-expo-plugin.svg"> | ||
</a> | ||
<a href="https://github.com/OneSignal/onesignal-expo-plugin#readme" target="_blank"> | ||
@@ -44,3 +46,3 @@ <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> | ||
### Plugin | ||
Add the plugin to the [plugin array](https://docs.expo.dev/versions/latest/config/app/): | ||
Add the plugin to the **front** of the [plugin array](https://docs.expo.dev/versions/latest/config/app/). It should be added automatically if you ran `expo install`. Just make sure it is the first plugin in the array and to configure any desired plugin props: | ||
@@ -178,3 +180,3 @@ **app.json** | ||
Copyright © 2021 [OneSignal](https://github.com/OneSignal).<br /> | ||
Copyright © 2022 [OneSignal](https://github.com/OneSignal).<br /> | ||
This project is [MIT](https://github.com/OneSignal/onesignal-expo-plugin/blob/main/LICENSE) licensed. |
@@ -38,2 +38,6 @@ import * as fs from 'fs'; | ||
} | ||
static dirExists(path: string): boolean { | ||
return fs.existsSync(path) | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181
75841
44
933