diff --git a/README.md b/README.md index e0fb0dc..fad6873 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,13 @@ See the `examples/demo` directory for a full working example. -- [`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) @@ -51,7 +51,8 @@ Initialize the SDK with your OneSignal app ID. Call during app startup. | ----------- | ------------------- | | **`appId`** | string | ---- +-------------------- + ### login(...) @@ -65,7 +66,8 @@ Log in to OneSignal as the user identified by `externalId`, switching the user c | ---------------- | ------------------- | | **`externalId`** | string | ---- +-------------------- + ### logout() @@ -75,7 +77,8 @@ logout() => Promise Log out the current user. The SDK will reference a new device-scoped user. ---- +-------------------- + ### setConsentRequired(...) @@ -89,7 +92,8 @@ Set whether user privacy consent is required before sending data to OneSignal. C | -------------- | -------------------- | | **`required`** | boolean | ---- +-------------------- + ### setConsentGiven(...) @@ -103,10 +107,12 @@ Indicate whether the user has granted privacy consent. | ------------- | -------------------- | | **`granted`** | boolean | ---- +-------------------- + ### Interfaces + #### OneSignalDebugAPI Debug helpers exposed via `OneSignal.Debug`. @@ -116,6 +122,7 @@ Debug helpers exposed via `OneSignal.Debug`. | **setLogLevel** | (logLevel: LogLevel) => void | Set the log level printed to LogCat (Android) or the Xcode console (iOS). | | **setAlertLevel** | (visualLogLevel: LogLevel) => void | Set the log level shown to the user as alert dialogs. | + #### OneSignalUserAPI Current-user operations exposed via `OneSignal.User`. @@ -146,12 +153,14 @@ Current-user operations exposed via `OneSignal.User`. | **getExternalId** | () => Promise<string \| null> | Get the external ID set via `login`, or null if the user is anonymous. | | **trackEvent** | (name: string, properties?: object \| undefined) => Promise<void> | Track a custom event with an optional set of JSON-serializable properties. | + #### UserChangedState | Prop | Type | | ------------- | ----------------------------------------------- | | **`current`** | UserState | + #### UserState | Prop | Type | @@ -159,6 +168,7 @@ Current-user operations exposed via `OneSignal.User`. | **`onesignalId`** | string | | **`externalId`** | string | + #### OneSignalPushSubscriptionAPI Push subscription state and controls exposed via `OneSignal.User.pushSubscription`. @@ -173,6 +183,7 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio | **optIn** | () => Promise<void> | Opt the user in to push notifications. Prompts for permission if needed. | | **optOut** | () => Promise<void> | Opt the user out of push notifications on this device. | + #### PushSubscriptionChangedState | Prop | Type | @@ -180,6 +191,7 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio | **`previous`** | PushSubscriptionState | | **`current`** | PushSubscriptionState | + #### PushSubscriptionState | Prop | Type | @@ -188,6 +200,7 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio | **`token`** | string | | **`optedIn`** | boolean | + #### OneSignalNotificationsAPI Notification permission and event handling exposed via `OneSignal.Notifications`. @@ -205,6 +218,7 @@ Notification permission and event handling exposed via `OneSignal.Notifications` | **removeNotification** | (id: number) => Promise<void> | Android only. Cancel a single notification by its Android notification ID. | | **removeGroupedNotifications** | (id: string) => Promise<void> | Android only. Cancel a group of notifications by group key. | + #### NotificationClickEvent | Prop | Type | @@ -212,6 +226,7 @@ Notification permission and event handling exposed via `OneSignal.Notifications` | **`result`** | NotificationClickResult | | **`notification`** | OSNotification | + #### NotificationClickResult | Prop | Type | @@ -219,6 +234,7 @@ Notification permission and event handling exposed via `OneSignal.Notifications` | **`actionId`** | string | | **`url`** | string | + #### OneSignalInAppMessagesAPI In-app message triggers and event handling exposed via `OneSignal.InAppMessages`. @@ -235,6 +251,7 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages` | **setPaused** | (pause: boolean) => void | Pause or resume the display of in-app messages. | | **getPaused** | () => Promise<boolean> | Whether in-app messaging is currently paused. | + #### InAppMessageClickEvent | Prop | Type | @@ -242,12 +259,14 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages` | **`message`** | OSInAppMessage | | **`result`** | InAppMessageClickResult | + #### OSInAppMessage | Prop | Type | | --------------- | ------------------- | | **`messageId`** | string | + #### InAppMessageClickResult | Prop | Type | @@ -257,30 +276,35 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages` | **`url`** | string | | **`urlTarget`** | InAppMessageActionUrlType | + #### InAppMessageWillDisplayEvent | Prop | Type | | ------------- | --------------------------------------------------------- | | **`message`** | OSInAppMessage | + #### InAppMessageDidDisplayEvent | Prop | Type | | ------------- | --------------------------------------------------------- | | **`message`** | OSInAppMessage | + #### InAppMessageWillDismissEvent | Prop | Type | | ------------- | --------------------------------------------------------- | | **`message`** | OSInAppMessage | + #### InAppMessageDidDismissEvent | Prop | Type | | ------------- | --------------------------------------------------------- | | **`message`** | OSInAppMessage | + #### OneSignalSessionAPI Outcome reporting exposed via `OneSignal.Session`. @@ -291,6 +315,7 @@ Outcome reporting exposed via `OneSignal.Session`. | **addUniqueOutcome** | (name: string) => Promise<void> | Record a unique outcome with the given name against the current session. | | **addOutcomeWithValue** | (name: string, value: number) => Promise<void> | Record an outcome with the given name and value against the current session. | + #### OneSignalLocationAPI Location permission and sharing exposed via `OneSignal.Location`. @@ -301,6 +326,7 @@ Location permission and sharing exposed via `OneSignal.Location`. | **setShared** | (shared: boolean) => void | Enable or disable sharing the device location with OneSignal. | | **isShared** | () => Promise<boolean> | Whether the device location is currently shared with OneSignal. | + #### OneSignalLiveActivitiesAPI Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless noted. @@ -314,48 +340,56 @@ Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless n | **setupDefault** | (options?: LiveActivitySetupOptions \| undefined) => Promise<void> | Set up the OneSignal default live activity, optionally enabling pushToStart/pushToUpdate. | | **startDefault** | (activityId: string, attributes: Record<string, unknown>, content: Record<string, unknown>) => Promise<void> | Start a live activity backed by the OneSignal default attributes type. | + ### Type Aliases + #### LogLevel (typeof LogLevel)[keyof typeof LogLevel] + #### Record Construct a type with a set of properties K of type T -{ -[P in K]: T; -} +{ [P in K]: T; } + #### OSNotificationPermission (typeof OSNotificationPermission)[keyof typeof OSNotificationPermission] + #### NotificationEventName 'click' | 'foregroundWillDisplay' | 'permissionChange' + #### NotificationEventTypeMap { click: NotificationClickEvent; foregroundWillDisplay: NotificationWillDisplayEvent; permissionChange: boolean; } + #### InAppMessageEventName 'click' | 'willDisplay' | 'didDisplay' | 'willDismiss' | 'didDismiss' + #### InAppMessageEventTypeMap { click: InAppMessageClickEvent; willDisplay: InAppMessageWillDisplayEvent; didDisplay: InAppMessageDidDisplayEvent; willDismiss: InAppMessageWillDismissEvent; didDismiss: InAppMessageDidDismissEvent; } + #### InAppMessageActionUrlType 'browser' | 'webview' | 'replacement' + #### LiveActivitySetupOptions The setup options for `OneSignal.LiveActivities.setupDefault`. -{ /** _ 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; } +{ /** * 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; } diff --git a/android/src/main/kotlin/com/onesignal/capacitor/OneSignalCapacitorPlugin.kt b/android/src/main/kotlin/com/onesignal/capacitor/OneSignalCapacitorPlugin.kt index ca6f701..928c98a 100644 --- a/android/src/main/kotlin/com/onesignal/capacitor/OneSignalCapacitorPlugin.kt +++ b/android/src/main/kotlin/com/onesignal/capacitor/OneSignalCapacitorPlugin.kt @@ -134,7 +134,7 @@ class OneSignalCapacitorPlugin : Plugin(), initialized = true OneSignalWrapper.sdkType = "capacitor" - OneSignalWrapper.sdkVersion = "010003" + OneSignalWrapper.sdkVersion = "010004" OneSignal.initWithContext(context, appId) // If the SDK was initialized from a non-Activity context (FCM/work diff --git a/ios/Sources/OneSignalCapacitorPlugin/OneSignalCapacitorPlugin.swift b/ios/Sources/OneSignalCapacitorPlugin/OneSignalCapacitorPlugin.swift index 4b0f9f0..d11e855 100644 --- a/ios/Sources/OneSignalCapacitorPlugin/OneSignalCapacitorPlugin.swift +++ b/ios/Sources/OneSignalCapacitorPlugin/OneSignalCapacitorPlugin.swift @@ -110,7 +110,7 @@ public class OneSignalCapacitorPlugin: CAPPlugin, CAPBridgedPlugin { initialized = true OneSignalWrapper.sdkType = "capacitor" - OneSignalWrapper.sdkVersion = "010003" + OneSignalWrapper.sdkVersion = "010004" // OSCapacitorLaunchOptions's +load captures the dictionary from // UIApplicationDidFinishLaunchingNotification at process start (before // main()), so cold-start notification taps that arrive via launchOptions diff --git a/package.json b/package.json index 412f7c7..cc663bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onesignal/capacitor-plugin", - "version": "1.0.3", + "version": "1.0.4", "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": [ "apns",