Skip to content

Commit 25b259e

Browse files
committed
docs: expand install instructions
1 parent d72313a commit 25b259e

1 file changed

Lines changed: 37 additions & 50 deletions

File tree

README.md

Lines changed: 37 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,29 @@ The pure [Capacitor](https://capacitorjs.com/) plugin for [OneSignal](https://on
44

55
## Install
66

7+
Install with your package manager of choice:
8+
79
```bash
10+
# with vp
11+
vp add @onesignal/capacitor-plugin
12+
13+
# with bun
14+
bun add @onesignal/capacitor-plugin
15+
16+
# with npm
817
npm install @onesignal/capacitor-plugin
18+
```
19+
20+
Then sync Capacitor:
21+
22+
```bash
23+
# with vp
24+
vpx cap sync
25+
26+
# with bun
27+
bunx cap sync
28+
29+
# with npm
930
npx cap sync
1031
```
1132

@@ -24,13 +45,13 @@ See the `examples/demo` directory for a full working example.
2445

2546
<docgen-index>
2647

27-
* [`initialize(...)`](#initialize)
28-
* [`login(...)`](#login)
29-
* [`logout()`](#logout)
30-
* [`setConsentRequired(...)`](#setconsentrequired)
31-
* [`setConsentGiven(...)`](#setconsentgiven)
32-
* [Interfaces](#interfaces)
33-
* [Type Aliases](#type-aliases)
48+
- [`initialize(...)`](#initialize)
49+
- [`login(...)`](#login)
50+
- [`logout()`](#logout)
51+
- [`setConsentRequired(...)`](#setconsentrequired)
52+
- [`setConsentGiven(...)`](#setconsentgiven)
53+
- [Interfaces](#interfaces)
54+
- [Type Aliases](#type-aliases)
3455

3556
</docgen-index>
3657

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

54-
--------------------
55-
75+
---
5676

5777
### login(...)
5878

@@ -66,8 +86,7 @@ Log in to OneSignal as the user identified by `externalId`, switching the user c
6686
| ---------------- | ------------------- |
6787
| **`externalId`** | <code>string</code> |
6888

69-
--------------------
70-
89+
---
7190

7291
### logout()
7392

@@ -77,8 +96,7 @@ logout() => Promise<void>
7796

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

80-
--------------------
81-
99+
---
82100

83101
### setConsentRequired(...)
84102

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

95-
--------------------
96-
113+
---
97114

98115
### setConsentGiven(...)
99116

@@ -107,12 +124,10 @@ Indicate whether the user has granted privacy consent.
107124
| ------------- | -------------------- |
108125
| **`granted`** | <code>boolean</code> |
109126

110-
--------------------
111-
127+
---
112128

113129
### Interfaces
114130

115-
116131
#### OneSignalDebugAPI
117132

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

125-
126140
#### OneSignalUserAPI
127141

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

156-
157170
#### UserChangedState
158171

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

163-
164176
#### UserState
165177

166178
| Prop | Type |
167179
| ----------------- | ------------------- |
168180
| **`onesignalId`** | <code>string</code> |
169181
| **`externalId`** | <code>string</code> |
170182

171-
172183
#### OneSignalPushSubscriptionAPI
173184

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

186-
187197
#### PushSubscriptionChangedState
188198

189199
| Prop | Type |
190200
| -------------- | ----------------------------------------------------------------------- |
191201
| **`previous`** | <code><a href="#pushsubscriptionstate">PushSubscriptionState</a></code> |
192202
| **`current`** | <code><a href="#pushsubscriptionstate">PushSubscriptionState</a></code> |
193203

194-
195204
#### PushSubscriptionState
196205

197206
| Prop | Type |
@@ -200,7 +209,6 @@ Push subscription state and controls exposed via `OneSignal.User.pushSubscriptio
200209
| **`token`** | <code>string</code> |
201210
| **`optedIn`** | <code>boolean</code> |
202211

203-
204212
#### OneSignalNotificationsAPI
205213

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

221-
222229
#### NotificationClickEvent
223230

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

229-
230236
#### NotificationClickResult
231237

232238
| Prop | Type |
233239
| -------------- | ------------------- |
234240
| **`actionId`** | <code>string</code> |
235241
| **`url`** | <code>string</code> |
236242

237-
238243
#### OneSignalInAppMessagesAPI
239244

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

254-
255259
#### InAppMessageClickEvent
256260

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

262-
263266
#### OSInAppMessage
264267

265268
| Prop | Type |
266269
| --------------- | ------------------- |
267270
| **`messageId`** | <code>string</code> |
268271

269-
270272
#### InAppMessageClickResult
271273

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

279-
280281
#### InAppMessageWillDisplayEvent
281282

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

286-
287287
#### InAppMessageDidDisplayEvent
288288

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

293-
294293
#### InAppMessageWillDismissEvent
295294

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

300-
301299
#### InAppMessageDidDismissEvent
302300

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

307-
308305
#### OneSignalSessionAPI
309306

310307
Outcome reporting exposed via `OneSignal.Session`.
@@ -315,7 +312,6 @@ Outcome reporting exposed via `OneSignal.Session`.
315312
| **addUniqueOutcome** | (name: string) =&gt; Promise&lt;void&gt; | <a href="#record">Record</a> a unique outcome with the given name against the current session. |
316313
| **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. |
317314

318-
319315
#### OneSignalLocationAPI
320316

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

329-
330325
#### OneSignalLiveActivitiesAPI
331326

332327
Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless noted.
@@ -340,56 +335,48 @@ Live activity controls exposed via `OneSignal.LiveActivities`. iOS only unless n
340335
| **setupDefault** | (options?: <a href="#liveactivitysetupoptions">LiveActivitySetupOptions</a> \| undefined) =&gt; Promise&lt;void&gt; | Set up the OneSignal default live activity, optionally enabling pushToStart/pushToUpdate. |
341336
| **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. |
342337

343-
344338
### Type Aliases
345339

346-
347340
#### LogLevel
348341

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

351-
352344
#### Record
353345

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

356-
<code>{ [P in K]: T; }</code>
357-
348+
<code>{
349+
[P in K]: T;
350+
}</code>
358351

359352
#### OSNotificationPermission
360353

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

363-
364356
#### NotificationEventName
365357

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

368-
369360
#### NotificationEventTypeMap
370361

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

373-
374364
#### InAppMessageEventName
375365

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

378-
379368
#### InAppMessageEventTypeMap
380369

381370
<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>
382371

383-
384372
#### InAppMessageActionUrlType
385373

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

388-
389376
#### LiveActivitySetupOptions
390377

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

393-
<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>
380+
<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>
394381

395382
</docgen-api>

0 commit comments

Comments
 (0)