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
1 change: 0 additions & 1 deletion .github/actions/setup-demo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ runs:
echo "VITE_ONESIGNAL_APP_ID=${{ inputs.onesignal-app-id }}" > .env
echo "VITE_ONESIGNAL_API_KEY=${{ inputs.onesignal-api-key }}" >> .env
echo "VITE_ONESIGNAL_ANDROID_CHANNEL_ID=7ec2ece9-c538-4656-9516-1316f48a005c" >> .env
echo "VITE_E2E_MODE=true" >> .env

- name: Install and set up demo
shell: bash
Expand Down
66 changes: 16 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ See the `examples/demo` directory for a full working example.

<docgen-index>

* [`initialize(...)`](#initialize)
* [`login(...)`](#login)
* [`logout()`](#logout)
* [`setConsentRequired(...)`](#setconsentrequired)
* [`setConsentGiven(...)`](#setconsentgiven)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
- [`initialize(...)`](#initialize)
- [`login(...)`](#login)
- [`logout()`](#logout)
- [`setConsentRequired(...)`](#setconsentrequired)
- [`setConsentGiven(...)`](#setconsentgiven)
- [Interfaces](#interfaces)
- [Type Aliases](#type-aliases)

</docgen-index>

Expand All @@ -51,8 +51,7 @@ Initialize the SDK with your OneSignal app ID. Call during app startup.
| ----------- | ------------------- |
| **`appId`** | <code>string</code> |

--------------------

---

### login(...)

Expand All @@ -66,8 +65,7 @@ Log in to OneSignal as the user identified by `externalId`, switching the user c
| ---------------- | ------------------- |
| **`externalId`** | <code>string</code> |

--------------------

---

### logout()

Expand All @@ -77,8 +75,7 @@ logout() => Promise<void>

Log out the current user. The SDK will reference a new device-scoped user.

--------------------

---

### setConsentRequired(...)

Expand All @@ -92,8 +89,7 @@ Set whether user privacy consent is required before sending data to OneSignal. C
| -------------- | -------------------- |
| **`required`** | <code>boolean</code> |

--------------------

---

### setConsentGiven(...)

Expand All @@ -107,12 +103,10 @@ Indicate whether the user has granted privacy consent.
| ------------- | -------------------- |
| **`granted`** | <code>boolean</code> |

--------------------

---

### Interfaces


#### OneSignalDebugAPI

Debug helpers exposed via `OneSignal.Debug`.
Expand All @@ -122,7 +116,6 @@ Debug helpers exposed via `OneSignal.Debug`.
| **setLogLevel** | (logLevel: <a href="#loglevel">LogLevel</a>) =&gt; void | Set the log level printed to LogCat (Android) or the Xcode console (iOS). |
| **setAlertLevel** | (visualLogLevel: <a href="#loglevel">LogLevel</a>) =&gt; void | Set the log level shown to the user as alert dialogs. |


#### OneSignalUserAPI

Current-user operations exposed via `OneSignal.User`.
Expand Down Expand Up @@ -153,22 +146,19 @@ Current-user operations exposed via `OneSignal.User`.
| **getExternalId** | () =&gt; Promise&lt;string \| null&gt; | Get the external ID set via `login`, or null if the user is anonymous. |
| **trackEvent** | (name: string, properties?: object \| undefined) =&gt; Promise&lt;void&gt; | Track a custom event with an optional set of JSON-serializable properties. |


#### UserChangedState

| Prop | Type |
| ------------- | ----------------------------------------------- |
| **`current`** | <code><a href="#userstate">UserState</a></code> |


#### UserState

| Prop | Type |
| ----------------- | ------------------- |
| **`onesignalId`** | <code>string</code> |
| **`externalId`** | <code>string</code> |


#### OneSignalPushSubscriptionAPI

Push subscription state and controls exposed via `OneSignal.User.pushSubscription`.
Expand All @@ -183,15 +173,13 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio
| **optIn** | () =&gt; Promise&lt;void&gt; | Opt the user in to push notifications. Prompts for permission if needed. |
| **optOut** | () =&gt; Promise&lt;void&gt; | Opt the user out of push notifications on this device. |


#### PushSubscriptionChangedState

| Prop | Type |
| -------------- | ----------------------------------------------------------------------- |
| **`previous`** | <code><a href="#pushsubscriptionstate">PushSubscriptionState</a></code> |
| **`current`** | <code><a href="#pushsubscriptionstate">PushSubscriptionState</a></code> |


#### PushSubscriptionState

| Prop | Type |
Expand All @@ -200,7 +188,6 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio
| **`token`** | <code>string</code> |
| **`optedIn`** | <code>boolean</code> |


#### OneSignalNotificationsAPI

Notification permission and event handling exposed via `OneSignal.Notifications`.
Expand All @@ -218,23 +205,20 @@ Notification permission and event handling exposed via `OneSignal.Notifications`
| **removeNotification** | (id: number) =&gt; Promise&lt;void&gt; | Android only. Cancel a single notification by its Android notification ID. |
| **removeGroupedNotifications** | (id: string) =&gt; Promise&lt;void&gt; | Android only. Cancel a group of notifications by group key. |


#### NotificationClickEvent

| Prop | Type |
| ------------------ | --------------------------------------------------------------------------- |
| **`result`** | <code><a href="#notificationclickresult">NotificationClickResult</a></code> |
| **`notification`** | <code>OSNotification</code> |


#### NotificationClickResult

| Prop | Type |
| -------------- | ------------------- |
| **`actionId`** | <code>string</code> |
| **`url`** | <code>string</code> |


#### OneSignalInAppMessagesAPI

In-app message triggers and event handling exposed via `OneSignal.InAppMessages`.
Expand All @@ -251,22 +235,19 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages`
| **setPaused** | (pause: boolean) =&gt; void | Pause or resume the display of in-app messages. |
| **getPaused** | () =&gt; Promise&lt;boolean&gt; | Whether in-app messaging is currently paused. |


#### InAppMessageClickEvent

| Prop | Type |
| ------------- | --------------------------------------------------------------------------- |
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |
| **`result`** | <code><a href="#inappmessageclickresult">InAppMessageClickResult</a></code> |


#### OSInAppMessage

| Prop | Type |
| --------------- | ------------------- |
| **`messageId`** | <code>string</code> |


#### InAppMessageClickResult

| Prop | Type |
Expand All @@ -276,35 +257,30 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages`
| **`url`** | <code>string</code> |
| **`urlTarget`** | <code><a href="#inappmessageactionurltype">InAppMessageActionUrlType</a></code> |


#### InAppMessageWillDisplayEvent

| Prop | Type |
| ------------- | --------------------------------------------------------- |
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |


#### InAppMessageDidDisplayEvent

| Prop | Type |
| ------------- | --------------------------------------------------------- |
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |


#### InAppMessageWillDismissEvent

| Prop | Type |
| ------------- | --------------------------------------------------------- |
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |


#### InAppMessageDidDismissEvent

| Prop | Type |
| ------------- | --------------------------------------------------------- |
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |


#### OneSignalSessionAPI

Outcome reporting exposed via `OneSignal.Session`.
Expand All @@ -315,7 +291,6 @@ Outcome reporting exposed via `OneSignal.Session`.
| **addUniqueOutcome** | (name: string) =&gt; Promise&lt;void&gt; | <a href="#record">Record</a> a unique outcome with the given name against the current session. |
| **addOutcomeWithValue** | (name: string, value: number) =&gt; Promise&lt;void&gt; | <a href="#record">Record</a> an outcome with the given name and value against the current session. |


#### OneSignalLocationAPI

Location permission and sharing exposed via `OneSignal.Location`.
Expand All @@ -326,7 +301,6 @@ Location permission and sharing exposed via `OneSignal.Location`.
| **setShared** | (shared: boolean) =&gt; void | Enable or disable sharing the device location with OneSignal. |
| **isShared** | () =&gt; Promise&lt;boolean&gt; | Whether the device location is currently shared with OneSignal. |


#### OneSignalLiveActivitiesAPI

Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless noted.
Expand All @@ -340,56 +314,48 @@ Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless n
| **setupDefault** | (options?: <a href="#liveactivitysetupoptions">LiveActivitySetupOptions</a> \| undefined) =&gt; Promise&lt;void&gt; | Set up the OneSignal default live activity, optionally enabling pushToStart/pushToUpdate. |
| **startDefault** | (activityId: string, attributes: <a href="#record">Record</a>&lt;string, unknown&gt;, content: <a href="#record">Record</a>&lt;string, unknown&gt;) =&gt; Promise&lt;void&gt; | Start a live activity backed by the OneSignal default attributes type. |


### Type Aliases


#### LogLevel

<code>(typeof <a href="#loglevel">LogLevel</a>)[keyof typeof LogLevel]</code>


#### Record

Construct a type with a set of properties K of type T

<code>{ [P in K]: T; }</code>

<code>{
[P in K]: T;
}</code>

#### OSNotificationPermission

<code>(typeof <a href="#osnotificationpermission">OSNotificationPermission</a>)[keyof typeof OSNotificationPermission]</code>


#### NotificationEventName

<code>'click' | 'foregroundWillDisplay' | 'permissionChange'</code>


#### NotificationEventTypeMap

<code>{ click: <a href="#notificationclickevent">NotificationClickEvent</a>; foregroundWillDisplay: NotificationWillDisplayEvent; permissionChange: boolean; }</code>


#### InAppMessageEventName

<code>'click' | 'willDisplay' | 'didDisplay' | 'willDismiss' | 'didDismiss'</code>


#### InAppMessageEventTypeMap

<code>{ click: <a href="#inappmessageclickevent">InAppMessageClickEvent</a>; willDisplay: <a href="#inappmessagewilldisplayevent">InAppMessageWillDisplayEvent</a>; didDisplay: <a href="#inappmessagediddisplayevent">InAppMessageDidDisplayEvent</a>; willDismiss: <a href="#inappmessagewilldismissevent">InAppMessageWillDismissEvent</a>; didDismiss: <a href="#inappmessagediddismissevent">InAppMessageDidDismissEvent</a>; }</code>


#### InAppMessageActionUrlType

<code>'browser' | 'webview' | 'replacement'</code>


#### LiveActivitySetupOptions

The setup options for `OneSignal.LiveActivities.setupDefault`.

<code>{ /** * When true, OneSignal will listen for pushToStart tokens for the `OneSignalLiveActivityAttributes` structure. */ enablePushToStart: boolean; /** * When true, OneSignal will listen for pushToUpdate tokens for each start live activity that uses the * `OneSignalLiveActivityAttributes` structure. */ enablePushToUpdate: boolean; }</code>
<code>{ /** _ When true, OneSignal will listen for pushToStart tokens for the `OneSignalLiveActivityAttributes` structure. _/ enablePushToStart: boolean; /** _ When true, OneSignal will listen for pushToUpdate tokens for each start live activity that uses the _ `OneSignalLiveActivityAttributes` structure. \*/ enablePushToUpdate: boolean; }</code>

</docgen-api>
2 changes: 1 addition & 1 deletion android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ compileSdk = "36"
junit = "4.13.2"
kotlin = "2.2.20"
minSdk = "24"
onesignal = "5.9.1"
onesignal = "5.9.2"
targetSdk = "36"

[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class OneSignalCapacitorPlugin : Plugin(),
initialized = true

OneSignalWrapper.sdkType = "capacitor"
OneSignalWrapper.sdkVersion = "010004"
OneSignalWrapper.sdkVersion = "010005"
OneSignal.initWithContext(context, appId)

// If the SDK was initialized from a non-Activity context (FCM/work
Expand Down
15 changes: 0 additions & 15 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions examples/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ examples/
β”‚ β”‚ β”œβ”€β”€ CustomEventsSection.tsx
β”‚ β”‚ β”œβ”€β”€ LocationSection.tsx
β”‚ β”‚ └── LiveActivitySection.tsx
β”‚ β”œβ”€β”€ theme/
β”‚ β”‚ └── variables.css
β”‚ └── utils/
β”‚ └── maskValue.ts # E2E_MODE bullet masking helper
β”‚ └── theme/
β”‚ └── variables.css
β”œβ”€β”€ android/ # Capacitor Android project
└── ios/
└── App/
Expand Down
3 changes: 1 addition & 2 deletions examples/demo/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
VITE_ONESIGNAL_APP_ID=your_onesignal_app_id
VITE_ONESIGNAL_API_KEY=your_rest_api_key
VITE_ONESIGNAL_ANDROID_CHANNEL_ID=
VITE_E2E_MODE=false
VITE_ONESIGNAL_ANDROID_CHANNEL_ID=
Loading
Loading