@onesignal/capacitor-plugin 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -24,13 +24,13 @@ See the `examples/demo` directory for a full working example.
|
|
|
24
24
|
|
|
25
25
|
<docgen-index>
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
- [`initialize(...)`](#initialize)
|
|
28
|
+
- [`login(...)`](#login)
|
|
29
|
+
- [`logout()`](#logout)
|
|
30
|
+
- [`setConsentRequired(...)`](#setconsentrequired)
|
|
31
|
+
- [`setConsentGiven(...)`](#setconsentgiven)
|
|
32
|
+
- [Interfaces](#interfaces)
|
|
33
|
+
- [Type Aliases](#type-aliases)
|
|
34
34
|
|
|
35
35
|
</docgen-index>
|
|
36
36
|
|
|
@@ -51,8 +51,7 @@ Initialize the SDK with your OneSignal app ID. Call during app startup.
|
|
|
51
51
|
| ----------- | ------------------- |
|
|
52
52
|
| **`appId`** | <code>string</code> |
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
---
|
|
56
55
|
|
|
57
56
|
### login(...)
|
|
58
57
|
|
|
@@ -66,8 +65,7 @@ Log in to OneSignal as the user identified by `externalId`, switching the user c
|
|
|
66
65
|
| ---------------- | ------------------- |
|
|
67
66
|
| **`externalId`** | <code>string</code> |
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
---
|
|
71
69
|
|
|
72
70
|
### logout()
|
|
73
71
|
|
|
@@ -77,8 +75,7 @@ logout() => Promise<void>
|
|
|
77
75
|
|
|
78
76
|
Log out the current user. The SDK will reference a new device-scoped user.
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
---
|
|
82
79
|
|
|
83
80
|
### setConsentRequired(...)
|
|
84
81
|
|
|
@@ -92,8 +89,7 @@ Set whether user privacy consent is required before sending data to OneSignal. C
|
|
|
92
89
|
| -------------- | -------------------- |
|
|
93
90
|
| **`required`** | <code>boolean</code> |
|
|
94
91
|
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
---
|
|
97
93
|
|
|
98
94
|
### setConsentGiven(...)
|
|
99
95
|
|
|
@@ -107,12 +103,10 @@ Indicate whether the user has granted privacy consent.
|
|
|
107
103
|
| ------------- | -------------------- |
|
|
108
104
|
| **`granted`** | <code>boolean</code> |
|
|
109
105
|
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
---
|
|
112
107
|
|
|
113
108
|
### Interfaces
|
|
114
109
|
|
|
115
|
-
|
|
116
110
|
#### OneSignalDebugAPI
|
|
117
111
|
|
|
118
112
|
Debug helpers exposed via `OneSignal.Debug`.
|
|
@@ -122,7 +116,6 @@ Debug helpers exposed via `OneSignal.Debug`.
|
|
|
122
116
|
| **setLogLevel** | (logLevel: <a href="#loglevel">LogLevel</a>) => void | Set the log level printed to LogCat (Android) or the Xcode console (iOS). |
|
|
123
117
|
| **setAlertLevel** | (visualLogLevel: <a href="#loglevel">LogLevel</a>) => void | Set the log level shown to the user as alert dialogs. |
|
|
124
118
|
|
|
125
|
-
|
|
126
119
|
#### OneSignalUserAPI
|
|
127
120
|
|
|
128
121
|
Current-user operations exposed via `OneSignal.User`.
|
|
@@ -153,14 +146,12 @@ Current-user operations exposed via `OneSignal.User`.
|
|
|
153
146
|
| **getExternalId** | () => Promise<string \| null> | Get the external ID set via `login`, or null if the user is anonymous. |
|
|
154
147
|
| **trackEvent** | (name: string, properties?: object \| undefined) => Promise<void> | Track a custom event with an optional set of JSON-serializable properties. |
|
|
155
148
|
|
|
156
|
-
|
|
157
149
|
#### UserChangedState
|
|
158
150
|
|
|
159
151
|
| Prop | Type |
|
|
160
152
|
| ------------- | ----------------------------------------------- |
|
|
161
153
|
| **`current`** | <code><a href="#userstate">UserState</a></code> |
|
|
162
154
|
|
|
163
|
-
|
|
164
155
|
#### UserState
|
|
165
156
|
|
|
166
157
|
| Prop | Type |
|
|
@@ -168,7 +159,6 @@ Current-user operations exposed via `OneSignal.User`.
|
|
|
168
159
|
| **`onesignalId`** | <code>string</code> |
|
|
169
160
|
| **`externalId`** | <code>string</code> |
|
|
170
161
|
|
|
171
|
-
|
|
172
162
|
#### OneSignalPushSubscriptionAPI
|
|
173
163
|
|
|
174
164
|
Push subscription state and controls exposed via `OneSignal.User.pushSubscription`.
|
|
@@ -183,7 +173,6 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio
|
|
|
183
173
|
| **optIn** | () => Promise<void> | Opt the user in to push notifications. Prompts for permission if needed. |
|
|
184
174
|
| **optOut** | () => Promise<void> | Opt the user out of push notifications on this device. |
|
|
185
175
|
|
|
186
|
-
|
|
187
176
|
#### PushSubscriptionChangedState
|
|
188
177
|
|
|
189
178
|
| Prop | Type |
|
|
@@ -191,7 +180,6 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio
|
|
|
191
180
|
| **`previous`** | <code><a href="#pushsubscriptionstate">PushSubscriptionState</a></code> |
|
|
192
181
|
| **`current`** | <code><a href="#pushsubscriptionstate">PushSubscriptionState</a></code> |
|
|
193
182
|
|
|
194
|
-
|
|
195
183
|
#### PushSubscriptionState
|
|
196
184
|
|
|
197
185
|
| Prop | Type |
|
|
@@ -200,7 +188,6 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio
|
|
|
200
188
|
| **`token`** | <code>string</code> |
|
|
201
189
|
| **`optedIn`** | <code>boolean</code> |
|
|
202
190
|
|
|
203
|
-
|
|
204
191
|
#### OneSignalNotificationsAPI
|
|
205
192
|
|
|
206
193
|
Notification permission and event handling exposed via `OneSignal.Notifications`.
|
|
@@ -218,7 +205,6 @@ Notification permission and event handling exposed via `OneSignal.Notifications`
|
|
|
218
205
|
| **removeNotification** | (id: number) => Promise<void> | Android only. Cancel a single notification by its Android notification ID. |
|
|
219
206
|
| **removeGroupedNotifications** | (id: string) => Promise<void> | Android only. Cancel a group of notifications by group key. |
|
|
220
207
|
|
|
221
|
-
|
|
222
208
|
#### NotificationClickEvent
|
|
223
209
|
|
|
224
210
|
| Prop | Type |
|
|
@@ -226,7 +212,6 @@ Notification permission and event handling exposed via `OneSignal.Notifications`
|
|
|
226
212
|
| **`result`** | <code><a href="#notificationclickresult">NotificationClickResult</a></code> |
|
|
227
213
|
| **`notification`** | <code>OSNotification</code> |
|
|
228
214
|
|
|
229
|
-
|
|
230
215
|
#### NotificationClickResult
|
|
231
216
|
|
|
232
217
|
| Prop | Type |
|
|
@@ -234,7 +219,6 @@ Notification permission and event handling exposed via `OneSignal.Notifications`
|
|
|
234
219
|
| **`actionId`** | <code>string</code> |
|
|
235
220
|
| **`url`** | <code>string</code> |
|
|
236
221
|
|
|
237
|
-
|
|
238
222
|
#### OneSignalInAppMessagesAPI
|
|
239
223
|
|
|
240
224
|
In-app message triggers and event handling exposed via `OneSignal.InAppMessages`.
|
|
@@ -251,7 +235,6 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages`
|
|
|
251
235
|
| **setPaused** | (pause: boolean) => void | Pause or resume the display of in-app messages. |
|
|
252
236
|
| **getPaused** | () => Promise<boolean> | Whether in-app messaging is currently paused. |
|
|
253
237
|
|
|
254
|
-
|
|
255
238
|
#### InAppMessageClickEvent
|
|
256
239
|
|
|
257
240
|
| Prop | Type |
|
|
@@ -259,14 +242,12 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages`
|
|
|
259
242
|
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |
|
|
260
243
|
| **`result`** | <code><a href="#inappmessageclickresult">InAppMessageClickResult</a></code> |
|
|
261
244
|
|
|
262
|
-
|
|
263
245
|
#### OSInAppMessage
|
|
264
246
|
|
|
265
247
|
| Prop | Type |
|
|
266
248
|
| --------------- | ------------------- |
|
|
267
249
|
| **`messageId`** | <code>string</code> |
|
|
268
250
|
|
|
269
|
-
|
|
270
251
|
#### InAppMessageClickResult
|
|
271
252
|
|
|
272
253
|
| Prop | Type |
|
|
@@ -276,35 +257,30 @@ In-app message triggers and event handling exposed via `OneSignal.InAppMessages`
|
|
|
276
257
|
| **`url`** | <code>string</code> |
|
|
277
258
|
| **`urlTarget`** | <code><a href="#inappmessageactionurltype">InAppMessageActionUrlType</a></code> |
|
|
278
259
|
|
|
279
|
-
|
|
280
260
|
#### InAppMessageWillDisplayEvent
|
|
281
261
|
|
|
282
262
|
| Prop | Type |
|
|
283
263
|
| ------------- | --------------------------------------------------------- |
|
|
284
264
|
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |
|
|
285
265
|
|
|
286
|
-
|
|
287
266
|
#### InAppMessageDidDisplayEvent
|
|
288
267
|
|
|
289
268
|
| Prop | Type |
|
|
290
269
|
| ------------- | --------------------------------------------------------- |
|
|
291
270
|
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |
|
|
292
271
|
|
|
293
|
-
|
|
294
272
|
#### InAppMessageWillDismissEvent
|
|
295
273
|
|
|
296
274
|
| Prop | Type |
|
|
297
275
|
| ------------- | --------------------------------------------------------- |
|
|
298
276
|
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |
|
|
299
277
|
|
|
300
|
-
|
|
301
278
|
#### InAppMessageDidDismissEvent
|
|
302
279
|
|
|
303
280
|
| Prop | Type |
|
|
304
281
|
| ------------- | --------------------------------------------------------- |
|
|
305
282
|
| **`message`** | <code><a href="#osinappmessage">OSInAppMessage</a></code> |
|
|
306
283
|
|
|
307
|
-
|
|
308
284
|
#### OneSignalSessionAPI
|
|
309
285
|
|
|
310
286
|
Outcome reporting exposed via `OneSignal.Session`.
|
|
@@ -315,7 +291,6 @@ Outcome reporting exposed via `OneSignal.Session`.
|
|
|
315
291
|
| **addUniqueOutcome** | (name: string) => Promise<void> | <a href="#record">Record</a> a unique outcome with the given name against the current session. |
|
|
316
292
|
| **addOutcomeWithValue** | (name: string, value: number) => Promise<void> | <a href="#record">Record</a> an outcome with the given name and value against the current session. |
|
|
317
293
|
|
|
318
|
-
|
|
319
294
|
#### OneSignalLocationAPI
|
|
320
295
|
|
|
321
296
|
Location permission and sharing exposed via `OneSignal.Location`.
|
|
@@ -326,7 +301,6 @@ Location permission and sharing exposed via `OneSignal.Location`.
|
|
|
326
301
|
| **setShared** | (shared: boolean) => void | Enable or disable sharing the device location with OneSignal. |
|
|
327
302
|
| **isShared** | () => Promise<boolean> | Whether the device location is currently shared with OneSignal. |
|
|
328
303
|
|
|
329
|
-
|
|
330
304
|
#### OneSignalLiveActivitiesAPI
|
|
331
305
|
|
|
332
306
|
Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless noted.
|
|
@@ -340,56 +314,48 @@ Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless n
|
|
|
340
314
|
| **setupDefault** | (options?: <a href="#liveactivitysetupoptions">LiveActivitySetupOptions</a> \| undefined) => Promise<void> | Set up the OneSignal default live activity, optionally enabling pushToStart/pushToUpdate. |
|
|
341
315
|
| **startDefault** | (activityId: string, attributes: <a href="#record">Record</a><string, unknown>, content: <a href="#record">Record</a><string, unknown>) => Promise<void> | Start a live activity backed by the OneSignal default attributes type. |
|
|
342
316
|
|
|
343
|
-
|
|
344
317
|
### Type Aliases
|
|
345
318
|
|
|
346
|
-
|
|
347
319
|
#### LogLevel
|
|
348
320
|
|
|
349
321
|
<code>(typeof <a href="#loglevel">LogLevel</a>)[keyof typeof LogLevel]</code>
|
|
350
322
|
|
|
351
|
-
|
|
352
323
|
#### Record
|
|
353
324
|
|
|
354
325
|
Construct a type with a set of properties K of type T
|
|
355
326
|
|
|
356
|
-
<code>{
|
|
357
327
|
[P in K]: T;
|
|
358
328
|
}</code>
|
|
359
|
-
|
|
329
|
+
<code>{
|
|
330
|
+
[P in K]: T;
|
|
331
|
+
}</code>
|
|
360
332
|
|
|
361
333
|
#### OSNotificationPermission
|
|
362
334
|
|
|
363
335
|
<code>(typeof <a href="#osnotificationpermission">OSNotificationPermission</a>)[keyof typeof OSNotificationPermission]</code>
|
|
364
336
|
|
|
365
|
-
|
|
366
337
|
#### NotificationEventName
|
|
367
338
|
|
|
368
339
|
<code>'click' | 'foregroundWillDisplay' | 'permissionChange'</code>
|
|
369
340
|
|
|
370
|
-
|
|
371
341
|
#### NotificationEventTypeMap
|
|
372
342
|
|
|
373
343
|
<code>{ click: <a href="#notificationclickevent">NotificationClickEvent</a>; foregroundWillDisplay: NotificationWillDisplayEvent; permissionChange: boolean; }</code>
|
|
374
344
|
|
|
375
|
-
|
|
376
345
|
#### InAppMessageEventName
|
|
377
346
|
|
|
378
347
|
<code>'click' | 'willDisplay' | 'didDisplay' | 'willDismiss' | 'didDismiss'</code>
|
|
379
348
|
|
|
380
|
-
|
|
381
349
|
#### InAppMessageEventTypeMap
|
|
382
350
|
|
|
383
351
|
<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>
|
|
384
352
|
|
|
385
|
-
|
|
386
353
|
#### InAppMessageActionUrlType
|
|
387
354
|
|
|
388
355
|
<code>'browser' | 'webview' | 'replacement'</code>
|
|
389
356
|
|
|
390
|
-
|
|
391
357
|
#### LiveActivitySetupOptions
|
|
392
358
|
|
|
393
359
|
The setup options for `OneSignal.LiveActivities.setupDefault`.
|
|
394
360
|
|
|
395
|
-
<code>{ /**
|
|
361
|
+
<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>
|
|
396
362
|
|
|
397
363
|
</docgen-api>
|
|
@@ -134,7 +134,7 @@ class OneSignalCapacitorPlugin : Plugin(),
|
|
|
134
134
|
initialized = true
|
|
135
135
|
|
|
136
136
|
OneSignalWrapper.sdkType = "capacitor"
|
|
137
|
-
OneSignalWrapper.sdkVersion = "
|
|
137
|
+
OneSignalWrapper.sdkVersion = "010005"
|
|
138
138
|
OneSignal.initWithContext(context, appId)
|
|
139
139
|
|
|
140
140
|
// If the SDK was initialized from a non-Activity context (FCM/work
|
|
@@ -110,7 +110,7 @@ public class OneSignalCapacitorPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
110
110
|
initialized = true
|
|
111
111
|
|
|
112
112
|
OneSignalWrapper.sdkType = "capacitor"
|
|
113
|
-
OneSignalWrapper.sdkVersion = "
|
|
113
|
+
OneSignalWrapper.sdkVersion = "010005"
|
|
114
114
|
// OSCapacitorLaunchOptions's +load captures the dictionary from
|
|
115
115
|
// UIApplicationDidFinishLaunchingNotification at process start (before
|
|
116
116
|
// main()), so cold-start notification taps that arrive via launchOptions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onesignal/capacitor-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apns",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"@capacitor/docgen": "^0.2.2",
|
|
61
61
|
"@types/bun": "latest",
|
|
62
62
|
"@vitest/coverage-v8": "^4.1.2",
|
|
63
|
-
"happy-dom": "^20.9.0",
|
|
64
63
|
"typescript": "^5.9.3",
|
|
65
64
|
"vite-plus": "0.1.20"
|
|
66
65
|
},
|