Skip to content

Commit d3789bf

Browse files
committed
Update migration guide
1 parent dcc1c21 commit d3789bf

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

MIGRATION_GUIDE_v3_to_v5.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The OneSignal SDK has been updated to be more modular in nature. The SDK has be
4848
Initialization of the OneSignal SDK, although similar to past versions, has changed. The target OneSignal application (`appId`) is now provided as part of initialization and cannot be changed post-initialization. A typical initialization now looks similar to below
4949

5050
OneSignal.Default.Initialize(ONESIGNAL_APP_ID);
51-
// requestPermission will show the native platform notification permission prompt.
51+
// RequestPermissionAsync will show the native platform notification permission prompt.
5252
// We recommend removing the following code and instead using an In-App Message to prompt for notification permission.
5353
var result = await OneSignal.Default.Notifications.RequestPermissionAsync(true);
5454

@@ -115,7 +115,7 @@ The SDK is still accessible via a `OneSignal.Default` static class, it provides
115115
| `bool ConsentGiven` | *Indicates whether privacy consent has been granted. This field is only relevant when the application has opted into data privacy protections. See [ConsentRequired].* |
116116
| `void Initialize(string appId)` | *Initialize the OneSignal SDK. This should be called during startup of the application.* |
117117
| `void Login(string externalId, string jwtBearerToken = null)` | *Login to OneSignal under the user identified by the [externalId] provided. The act of logging a user into the OneSignal SDK will switch the [user] context to that specific user.*<br><br>- *If the [externalId] exists the user will be retrieved and the context set from that user information. If operations have already been performed under a guest user, they* ***will not*** *be applied to the now logged in user (they will be lost).*<br>- *If the [externalId] does not exist the user will be created and the context set from the current local state. If operations have already been performed under a guest user those operations* ***will*** *be applied to the newly created user.*<br><br>***Push Notifications and In App Messaging***<br>*Logging in a new user will automatically transfer push notification and in app messaging subscriptions from the current user (if there is one) to the newly logged in user. This is because both Push and IAM are owned by the device.* |
118-
| `void Logout()` | *Logout the user previously logged in via [login]. The [user] property now references a new device-scoped user. A device-scoped user has no user identity that can later be retrieved, except through this device as long as the app remains installed and the app data is not cleared.* |
118+
| `void Logout()` | *Logout the user previously logged in via [login]. The [user] property now references a new device-scoped user. A device-scoped user has no user identity that can later be retrieved, except through this device as long as the app remains installed and the app data is not cleared.* |
119119
| `void SetLaunchURLsInApp(bool launchInApp)` | ***Note:*** *This method is for iOS only<br>This method can be used to set if launch URLs should be opened in Safari or within the application. Set to true to launch all notifications with a URL in the app instead of the default web browser. Make sure to call SetLaunchURLsInApp before the initialize call.* |
120120

121121

@@ -126,7 +126,7 @@ The user name space is accessible via `OneSignal.Default.User` and provides acce
126126
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
127127
| `IPushSubscription PushSubscription` | *The push subscription associated to the current user.* |
128128
| `string Language` | *Set the 2-character language either as a detected language or explicitly set for this user.* |
129-
| `PushSubsription.Changed` <br><br> `event EventHandler<PushSubscriptionChangedEventArgs> Changed` <br><br> `PushSubscriptionChangedEventArgs { PushSubscriptionChangedState State }` | *Adds a change event that will run whenever the push subscription has been changed.* |
129+
| `PushSubsription.Changed` <br><br> `event EventHandler<PushSubscriptionChangedEventArgs> Changed` <br><br> `PushSubscriptionChangedEventArgs { PushSubscriptionChangedState State }` | *Adds a change event that will run whenever the push subscription has been changed.* |
130130
| `void AddAlias(string label, string id)` | *Set an alias for the current user. If this alias already exists it will be overwritten.* |
131131
| `void AddAliases(Dictionary<string, string> aliases)` | S*et aliases for the current user. If any alias already exists it will be overwritten.* |
132132
| `void RemoveAlias(string label)` | *Remove an alias from the current user.* |
@@ -154,14 +154,15 @@ The session namespace is accessible via `OneSignal.Default.Session` and provides
154154
**Notifications Namespace**
155155
The notification namespace is accessible via `OneSignal.Default.Notifications` and provides access to notification-scoped functionality.
156156

157-
| **C#** | **Description** |
158-
| -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
157+
| **C#** | **Description** |
158+
| -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
159159
| `bool Permission` | *Whether this app has push notification permission.* |
160+
| `NotificationPermission PermissionNative` | *Native permission of the device. The enum NotificationPermission can be NotDetermined, Denied, Authorized, Provisional, or Ephemeral.* |
160161
| `Task<bool> RequestPermissionAsync(bool fallbackToSettings)` | *Prompt the user for permission to push notifications. This will display the native OS prompt to request push notification permission. If the user enables, a push subscription to this device will be automatically added to the user.* |
161162
| `void ClearAllNotifications()` | *Removes all OneSignal notifications.* |
162163
| `event EventHandler<NotificationPermissionChangedEventArgs> PermissionChanged` <br><br> `NotificationPermissionChangedEventArgs { bool Permission }` | *The [PermissionChanged] event will be fired when a notification permission setting changes. This happens when the user enables or disables notifications for your app from the system settings outside of your app.* |
163-
| `event EventHandler<NotificationWillDisplayEventArgs> ForegroundWillDisplay` <br><br> `NotificationWillDisplayEventArgs { IDisplayableNotification Notification, void PreventDefault() }` | *Set an event to fire before displaying a notification while the app is in focus. Use this event to read notification data or decide if the notification should show or not.* |
164-
| `event EventHandler<NotificationClickEventArgs> Clicked` <br><br> `NotificationClickEventArgs { INotification Notification, INotificationClickResult Result }` | *Set an event that will fire whenever a notification is clicked on by the user.* |
164+
| `event EventHandler<NotificationWillDisplayEventArgs> ForegroundWillDisplay` <br><br> `NotificationWillDisplayEventArgs { IDisplayableNotification Notification, void PreventDefault() }` | *Set an event to fire before displaying a notification while the app is in focus. Use this event to read notification data or decide if the notification should show or not.* |
165+
| `event EventHandler<NotificationClickEventArgs> Clicked` <br><br> `NotificationClickEventArgs { INotification Notification, INotificationClickResult Result }` | *Set an event that will fire whenever a notification is clicked on by the user.* |
165166

166167

167168
**Location Namespace**
@@ -184,8 +185,8 @@ The In App Messages namespace is accessible via `OneSignal.Default.InAppMessages
184185
| `void RemoveTrigger(string key)` | *Remove the trigger with the provided key from the current user.* |
185186
| `void RemoveTriggers(params string[] keys)` | *Remove multiple triggers from the current user.* |
186187
| `void ClearTriggers()` | *Clear all triggers from the current user.* |
187-
| `event EventHandler<InAppMessageWillDisplayEventArgs> WillDisplay` <br><br> `event EventHandler<InAppMessageDidDisplayEventArgs> DidDisplay` <br><br> `event EventHandler<InAppMessageWillDismissEventArgs> WillDismiss` <br><br> `event EventHandler<InAppMessageDidDismissEventArgs> DidDismiss` <br><br><br> `InAppMessageWillDisplayEventArgs { IInAppMessage Message }` <br><br> `InAppMessageDidDisplayEventArgs { IInAppMessage Message }` <br><br> `InAppMessageWillDismissEventArgs { IInAppMessage Message }` <br><br> `InAppMessageDidDismissEventArgs { IInAppMessage Message }`| *Set the IAM lifecycle events.* |
188-
| `event EventHandler<InAppMessageClickEventArgs> Clicked` <br><br> `InAppMessageClickEventArgs { IInAppMessage Message, IInAppMessageClickResult Result }` | *Set the IAM click events.* |
188+
| `event EventHandler<InAppMessageWillDisplayEventArgs> WillDisplay` <br><br> `event EventHandler<InAppMessageDidDisplayEventArgs> DidDisplay` <br><br> `event EventHandler<InAppMessageWillDismissEventArgs> WillDismiss` <br><br> `event EventHandler<InAppMessageDidDismissEventArgs> DidDismiss` <br><br><br> `InAppMessageWillDisplayEventArgs { IInAppMessage Message }` <br><br> `InAppMessageDidDisplayEventArgs { IInAppMessage Message }` <br><br> `InAppMessageWillDismissEventArgs { IInAppMessage Message }` <br><br> `InAppMessageDidDismissEventArgs { IInAppMessage Message }`| *Set the IAM lifecycle events.* |
189+
| `event EventHandler<InAppMessageClickEventArgs> Clicked` <br><br> `InAppMessageClickEventArgs { IInAppMessage Message, IInAppMessageClickResult Result }` | *Set the IAM click events.* |
189190

190191

191192
**LiveActivities Namespace**
@@ -215,5 +216,5 @@ The debug namespace is accessible via `OneSignal.Default.Debug` and provides acc
215216
- We will be introducing JWT in follow up Beta release
216217

217218
# Troubleshooting
218-
- `Assets/OneSignal/Example/OneSignalExampleBehaviou.cs error : The type or namespace name '...`
219-
- Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
219+
`Assets/OneSignal/Example/OneSignalExampleBehaviou.cs: error CS0246: The type or namespace name '...' cound not be found (are you missing a using directive or an assembly reference?)`
220+
- Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`

0 commit comments

Comments
 (0)