Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
paths:
- src
- android/src/main/java
- .github/actions

paths-ignore:
- 'examples/**/android/**'
- 'examples/**'
11 changes: 3 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ jobs:
- language: javascript-typescript
build-mode: none
dependency-caching: true
- language: java
build-mode: none
dependency-caching: true
# Not analyzing .m (Objective-C) & .h (Objective-C header) files for now unless CodeQL supports it in the future
# Not analyzing Java/Kotlin (Android) or .m/.h (Objective-C) here.
# The native plugin code is a thin bridge; the underlying native SDKs
# are scanned in their own repos.

steps:
- name: Checkout repository
Expand All @@ -56,10 +55,6 @@ jobs:
build-mode: ${{ matrix.build-mode }}
config-file: ./.github/codeql-config.yml

- name: Autobuild
if: matrix.build-mode == 'autobuild'
uses: github/codeql-action/autobuild@v4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ The pure [Capacitor](https://capacitorjs.com/) plugin for [OneSignal](https://on
## Install

```bash
npm install onesignal-capacitor-plugin
npm install @onesignal/capacitor-plugin
npx cap sync
```

## Usage

```ts
import OneSignal from 'onesignal-capacitor-plugin';
import OneSignal from '@onesignal/capacitor-plugin';

await OneSignal.initialize({ appId: 'YOUR_ONESIGNAL_APP_ID' });
await OneSignal.Notifications.requestPermission(true);
Expand Down
54 changes: 23 additions & 31 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bunx cap add android
- Reference the OneSignal Capacitor plugin via local tarball:

```json
"onesignal-capacitor-plugin": "file:../../onesignal-capacitor-plugin.tgz"
"@onesignal/capacitor-plugin": "file:../../onesignal-capacitor-plugin.tgz"
```

### App icons
Expand Down Expand Up @@ -179,7 +179,7 @@ The demo uses SPM instead of CocoaPods. Capacitor manages App-target plugin depe

`ios/debug.xcconfig` is wired up as the App target's Debug base configuration so Capacitor's debug-only behaviors stay enabled.

The plugin's SPM product is named `OnesignalCapacitorPlugin` to match Capacitor's derived package name (`fixName` converts `onesignal-capacitor-plugin` → `OnesignalCapacitorPlugin`).
The plugin's SPM product is named `OnesignalCapacitorPlugin` to match Capacitor's derived package name (`fixName` converts `@onesignal/capacitor-plugin` → `OnesignalCapacitorPlugin`).

To migrate an existing CocoaPods-based project to SPM, run `bunx cap spm-migration-assistant` and add the local `CapApp-SPM` package and any extension dependencies through Xcode's Package Dependencies tab.

Expand Down
2 changes: 1 addition & 1 deletion examples/demo/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')

include ':onesignal-capacitor-plugin'
project(':onesignal-capacitor-plugin').projectDir = new File('../node_modules/onesignal-capacitor-plugin/android')
project(':onesignal-capacitor-plugin').projectDir = new File('../node_modules/@onesignal/capacitor-plugin/android')
2 changes: 1 addition & 1 deletion examples/demo/ios/App/CapApp-SPM/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
.package(name: "CapacitorKeyboard", path: "../../../node_modules/@capacitor/keyboard"),
.package(name: "CapacitorSplashScreen", path: "../../../node_modules/@capacitor/splash-screen"),
.package(name: "CapacitorStatusBar", path: "../../../node_modules/@capacitor/status-bar"),
.package(name: "OnesignalCapacitorPlugin", path: "../../../node_modules/onesignal-capacitor-plugin")
.package(name: "OnesignalCapacitorPlugin", path: "../../../node_modules/@onesignal/capacitor-plugin")
],
targets: [
.target(
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"@capacitor/status-bar": "^8.0.2",
"@ionic/react": "^8.8.3",
"@ionic/react-router": "^8.8.3",
"@onesignal/capacitor-plugin": "file:../../onesignal-capacitor-plugin.tgz",
"ionicons": "^7.4.0",
"onesignal-capacitor-plugin": "file:../../onesignal-capacitor-plugin.tgz",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"react-icons": "^5.6.0",
Expand All @@ -40,5 +40,5 @@
"@vitejs/plugin-react": "^6.0.1",
"typescript": "^6.0.2"
},
"packageManager": "bun@1.3.11"
"packageManager": "bun@1.3.13"
}
2 changes: 1 addition & 1 deletion examples/demo/src/hooks/useOneSignal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import OneSignal, {
type NotificationClickEvent,
type NotificationWillDisplayEvent,
type UserChangedState,
} from 'onesignal-capacitor-plugin';
} from '@onesignal/capacitor-plugin';
import { useCallback, useEffect, useRef, useState } from 'react';

import { NotificationType } from '../models/NotificationType';
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_pods/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')

include ':onesignal-capacitor-plugin'
project(':onesignal-capacitor-plugin').projectDir = new File('../node_modules/onesignal-capacitor-plugin/android')
project(':onesignal-capacitor-plugin').projectDir = new File('../node_modules/@onesignal/capacitor-plugin/android')
2 changes: 1 addition & 1 deletion examples/demo_pods/ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def capacitor_pods
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'OnesignalCapacitorPlugin', :path => '../../node_modules/onesignal-capacitor-plugin'
pod 'OnesignalCapacitorPlugin', :path => '../../node_modules/@onesignal/capacitor-plugin'
end

target 'App' do
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_pods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@capacitor/status-bar": "^8.0.2",
"@ionic/react": "^8.8.3",
"@ionic/react-router": "^8.8.3",
"@onesignal/capacitor-plugin": "file:../../onesignal-capacitor-plugin.tgz",
"ionicons": "^7.4.0",
"onesignal-capacitor-plugin": "file:../../onesignal-capacitor-plugin.tgz",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"react-icons": "^5.6.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_pods/src/hooks/useOneSignal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import OneSignal, {
type NotificationClickEvent,
type NotificationWillDisplayEvent,
type UserChangedState,
} from 'onesignal-capacitor-plugin';
} from '@onesignal/capacitor-plugin';
import { useCallback, useEffect, useRef, useState } from 'react';

import { NotificationType } from '../models/NotificationType';
Expand Down
4 changes: 2 additions & 2 deletions examples/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ info() { echo -e "\033[0;32m[setup]\033[0m $*"; }
# ── Plugin tarball cache ─────────────────────────────────────────────────────
# Skip rebuild/repack/`vp add` when plugin sources haven't changed.
SDK_STAMP="$SDK_ROOT/.capacitor-sdk-source.stamp"
INSTALLED_DIR="$ORIGINAL_DIR/node_modules/onesignal-capacitor-plugin"
INSTALLED_DIR="$ORIGINAL_DIR/node_modules/@onesignal/capacitor-plugin"

SDK_SRC_HASH=$(find "$SDK_ROOT/src" "$SDK_ROOT/android" "$SDK_ROOT/ios" \
"$SDK_ROOT/package.json" \
Expand All @@ -34,7 +34,7 @@ else
# tarball; otherwise `vp add` hits a dependency-loop error under bun 1.3+.
# Keep the relative `file:../../...` path to match package.json's spec.
info "Registering tarball with vp (refreshes bun.lock integrity hash)..."
vp remove onesignal-capacitor-plugin 2>/dev/null || true
vp remove @onesignal/capacitor-plugin 2>/dev/null || true
vp add file:../../onesignal-capacitor-plugin.tgz

echo "$SDK_SRC_HASH" > "$SDK_STAMP"
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "onesignal-capacitor-plugin",
"name": "@onesignal/capacitor-plugin",
"version": "1.0.0",
"description": "OneSignal is a high volume Push Notification service for mobile apps. This is the pure Capacitor plugin for OneSignal, providing push notifications, in-app messaging, and more.",
"keywords": [
Expand All @@ -10,9 +10,7 @@
"notification",
"onesignal",
"plugin",
"push",
"push notification",
"push notifications"
"push notification"
],
"homepage": "https://github.com/OneSignal/OneSignal-Capacitor-SDK#readme",
"bugs": {
Expand All @@ -25,8 +23,10 @@
},
"files": [
"dist",
"ios",
"android",
"ios/Sources",
"android/src",
"android/build.gradle.kts",
"android/gradle",
"Package.swift",
"OneSignalCapacitorPlugin.podspec"
],
Expand All @@ -40,6 +40,9 @@
"import": "./dist/index.js"
}
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "vp pack",
"docgen": "docgen --api OneSignalAPI --project tsconfig.docgen.json --output-readme README.md --output-json dist/docs.json",
Expand Down Expand Up @@ -69,7 +72,7 @@
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
},
"packageManager": "bun@1.3.11",
"packageManager": "bun@1.3.13",
"capacitor": {
"ios": {
"src": "ios"
Expand Down
Loading