Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

onesignal-expo-plugin

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onesignal-expo-plugin - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.github/ISSUE_TEMPLATE/ask-question.yml

7

build/onesignal/withOneSignalIos.js

@@ -39,3 +39,3 @@ "use strict";

/**
* Add 'app-environment' record with current environment to '<project-name>.entitlements' file
* Add 'aps-environment' record with current environment to '<project-name>.entitlements' file
* @see https://documentation.onesignal.com/docs/react-native-sdk-setup#step-4-install-for-ios-using-cocoapods-for-ios-apps

@@ -102,2 +102,3 @@ */

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

@@ -118,3 +119,3 @@ };

function xcodeProjectAddNse(appName, options, sourceDir) {
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options;
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, mode } = options;
// not awaiting in order to not block main thread

@@ -144,3 +145,3 @@ (0, updatePodfile_1.updatePodfile)(iosPath).catch(err => { OneSignalLog_1.OneSignalLog.error(err); });

const nseUpdater = new NseUpdaterManager_1.default(iosPath);
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`);
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`, mode);
await nseUpdater.updateNSEBundleVersion(bundleVersion !== null && bundleVersion !== void 0 ? bundleVersion : iosConstants_1.DEFAULT_BUNDLE_VERSION);

@@ -147,0 +148,0 @@ await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion !== null && bundleShortVersion !== void 0 ? bundleShortVersion : iosConstants_1.DEFAULT_BUNDLE_SHORT_VERSION);

"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_TARGET_NAME = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.DEFAULT_BUNDLE_VERSION = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = exports.APS_ENVIRONMENT_MODE = 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";

@@ -12,2 +12,3 @@ exports.TARGETED_DEVICE_FAMILY = `"1,2"`;

exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
exports.APS_ENVIRONMENT_MODE = /{{APS_ENVIRONMENT_MODE}}/gm;
exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;

@@ -14,0 +15,0 @@ exports.BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;

@@ -13,5 +13,6 @@ "use strict";

}
async updateNSEEntitlements(groupIdentifier) {
async updateNSEEntitlements(groupIdentifier, mode) {
const entitlementsFilePath = `${this.nsePath}/${entitlementsFileName}`;
let entitlementsFile = await FileManager_1.FileManager.readFile(entitlementsFilePath);
entitlementsFile = entitlementsFile.replace(iosConstants_1.APS_ENVIRONMENT_MODE, mode);
entitlementsFile = entitlementsFile.replace(iosConstants_1.GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier);

@@ -18,0 +19,0 @@ await FileManager_1.FileManager.writeFile(entitlementsFilePath, entitlementsFile);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const withOneSignalIos_1 = require("./onesignal/withOneSignalIos");
const types_1 = require("./types/types");
// Quick testing on any Xcode project

@@ -16,2 +17,3 @@ // 1. Update values for your project

iosPath: '.',
mode: types_1.Mode.Dev,
bundleIdentifier: "com.onesignal.XcodeTestProj",

@@ -18,0 +20,0 @@ devTeam: "99SW8E36CT",

# Changelog
All notable changes to this project will be documented in this file.
## April 2022
### `1.0.1` - 04/11/22
#### Changes
- Add more info regarding the `expo prebuild` command to README.
#### Fixes
- Upstream EAS workaround for "Missing Push Capability on iOS" issue. Adds `aps-environment` entitlement to NSE template. Although it is **not** required in normal builds, there is an upstream limitation from EAS that is resolved by including the push entitlement in both target entitlement files. As of 4/8/22, EAS builds will randomly pick an entitlement file if there are multiple in a project without differentiating among targets. This is resulting in flaky builds where half the time they work and half the time they don't. This can be seen as a temporary fix. Note it carries no side-effects / repercussions (i.e: the entitlement is superfluous but not critical to remove in the future).
## March 2022
### `1.0.0` - 03/28/22
#### Fixes
- Upgrade dependencies (via dependabot)
#### Changes
- Add credentials guide and update README
- Advance to General Availability
## February 2022
### `1.0.0-beta11` - 02/18/2022
#### Added
- Linting
- Instead of creating a "WriterManager", we repurpose the ReaderManager class by renaming it to FileManager and adding a synchronized write helper function (synchronous in the sense that it block further execution until complete).
- iOS constants file
#### Fixes
- Import cleanups
- Linting errors
- Write safety issu. NSE updater helper functions were previously writing to the entitlements & plist files asynchronously. We should await on each to ensure we don't have multiple writes to the same file at once (which is unsafe).
## January 2022

@@ -5,0 +34,0 @@

@@ -7,14 +7,6 @@ /**

import { ConfigPlugin } from '@expo/config-plugins';
import { OneSignalPluginProps } from '../types/types';
import { withOneSignalAndroid } from './withOneSignalAndroid';
import { withOneSignalIos } from './withOneSignalIos';
export type OneSignalPluginProps = {
/**
* (iOS only) Environment name and bundle identifier
*/
mode: string;
devTeam: string;
iPhoneDeploymentTarget: string;
};
const withOneSignal: ConfigPlugin<OneSignalPluginProps> = (config, props) => {

@@ -21,0 +13,0 @@ config = withOneSignalIos(config, props);

@@ -9,3 +9,3 @@ /**

import { OneSignalLog } from '../support/OneSignalLog';
import { OneSignalPluginProps } from './withOneSignal';
import { OneSignalPluginProps } from '../types/types';

@@ -12,0 +12,0 @@ const withGradleBuildConfig: ConfigPlugin<OneSignalPluginProps> = (config) => {

@@ -12,3 +12,2 @@ /**

} from "@expo/config-plugins";
import { OneSignalPluginProps } from "./withOneSignal";
import * as fs from 'fs';

@@ -27,15 +26,6 @@ import xcode from 'xcode';

import { FileManager } from "../support/FileManager";
import { OneSignalPluginProps, PluginOptions } from "../types/types";
/* I N T E R F A C E S */
interface PluginOptions {
iosPath: string,
devTeam?: string,
bundleVersion?: string,
bundleShortVersion?: string,
bundleIdentifier?: string,
iPhoneDeploymentTarget?: string
}
/**
* Add 'app-environment' record with current environment to '<project-name>.entitlements' file
* Add 'aps-environment' record with current environment to '<project-name>.entitlements' file
* @see https://documentation.onesignal.com/docs/react-native-sdk-setup#step-4-install-for-ios-using-cocoapods-for-ios-apps

@@ -113,2 +103,3 @@ */

bundleShortVersion: props?.version,
mode: onesignalProps?.mode,
iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget

@@ -143,3 +134,3 @@ };

): void {
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options;
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, mode } = options;

@@ -177,3 +168,3 @@ // not awaiting in order to not block main thread

const nseUpdater = new NseUpdaterManager(iosPath);
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`)
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`, mode)
await nseUpdater.updateNSEBundleVersion(bundleVersion ?? DEFAULT_BUNDLE_VERSION);

@@ -180,0 +171,0 @@ await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion ?? DEFAULT_BUNDLE_SHORT_VERSION);

{
"name": "onesignal-expo-plugin",
"version": "1.0.0",
"version": "1.0.1",
"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.0-blue.svg?cacheSeconds=2592000" />
<img alt="Version" src="https://img.shields.io/badge/version-1.0.1-blue.svg?cacheSeconds=2592000" />
<a href="https://github.com/OneSignal/onesignal-expo-plugin#readme" target="_blank">

@@ -128,7 +128,11 @@ <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />

## Prebuild
Since we are using custom native code (via the OneSignal plugin), we need to generate the native runtime code for the project. By prebuilding, we automatically link and configure the native modules that have implemented CocoaPods, autolinking, and other config plugins. You can think of prebuild like a native code bundler.
## Prebuild (optional)
Prebuilding in Expo will result in the generation of the native runtime code for the project (and `ios` and `android` directories being built). By prebuilding, we automatically link and configure the native modules that have implemented CocoaPods, autolinking, and other config plugins. You can think of prebuild like a native code bundler.
When you run `expo prebuild` we enter into a custom managed workflow which provides most of the benefits of bare workflows and managed workflows at the same time.
#### Why should I prebuild?
It may make sense to prebuild locally to inspect config plugin changes and help in debugging issues.
#### Run
```sh

@@ -143,2 +147,4 @@ expo prebuild

**EAS Note:** if you choose to stay in a fully managed workflow by not prebuilding, EAS will still run `expo prebuild` at build time. You can also prebuild locally but remain in a fully managed workflow by adding the `android` and `ios` directories to your .gitignore.
## Run

@@ -145,0 +151,0 @@ The following commands will prebuild *and* run your application. Note that for iOS, push notifications will **not** work in the Simulator.

@@ -12,2 +12,3 @@ export const IPHONEOS_DEPLOYMENT_TARGET = "11.0";

export const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
export const APS_ENVIRONMENT_MODE = /{{APS_ENVIRONMENT_MODE}}/gm;
export const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;

@@ -14,0 +15,0 @@ export const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;

@@ -0,3 +1,5 @@

import { Mode } from '../types/types';
import { FileManager } from './FileManager';
import {
APS_ENVIRONMENT_MODE,
BUNDLE_SHORT_VERSION_TEMPLATE_REGEX,

@@ -19,5 +21,7 @@ BUNDLE_VERSION_TEMPLATE_REGEX,

async updateNSEEntitlements(groupIdentifier: string): Promise<void> {
async updateNSEEntitlements(groupIdentifier: string, mode: Mode): Promise<void> {
const entitlementsFilePath = `${this.nsePath}/${entitlementsFileName}`;
let entitlementsFile = await FileManager.readFile(entitlementsFilePath);
entitlementsFile = entitlementsFile.replace(APS_ENVIRONMENT_MODE, mode);
entitlementsFile = entitlementsFile.replace(GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier);

@@ -24,0 +28,0 @@ await FileManager.writeFile(entitlementsFilePath, entitlementsFile);

import { xcodeProjectAddNse } from "./onesignal/withOneSignalIos";
import { Mode } from "./types/types";

@@ -17,2 +18,3 @@ // Quick testing on any Xcode project

iosPath: '.',
mode: Mode.Dev,
bundleIdentifier: "com.onesignal.XcodeTestProj",

@@ -19,0 +21,0 @@ devTeam: "99SW8E36CT",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc