Skip to content

Commit 0c2f7f8

Browse files
authored
Merge pull request #1212 from OneSignal/5.0.0_alpha_02_migration_guide
Update migration guide for `5.0.0-alpha-02`
2 parents ad07ec9 + c81822a commit 0c2f7f8

File tree

1 file changed

+63
-7
lines changed

1 file changed

+63
-7
lines changed

MIGRATION_GUIDE.md

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 align="center">OneSignal iOS SDK v5.0.0-alpha-01 Migration Guide</h1>
1+
<h1 align="center">OneSignal iOS SDK v5.0.0-alpha-02 Migration Guide</h1>
22

33
![OneSignal Omni Channel Banner](https://user-images.githubusercontent.com/11739227/208625336-d28c8d01-a7cf-4f8e-9643-ac8d1948e9ae.png)
44

@@ -8,7 +8,7 @@ In this release, we are making a significant shift from a device-centered model
88

99
To facilitate this change, the `externalId` approach for identifying users is being replaced by the `login` and `logout` methods. In addition, the SDK now makes use of namespaces such as `User`, `Notifications`, and `InAppMessages` to better separate code.
1010

11-
The iOS SDK is making the jump from `v3` to `v5`, in order to align across OneSignal’s suite of client SDKs. This guide will walk you through the iOS SDK `5.0.0-alpha-01` changes as a result of this shift.
11+
The iOS SDK is making the jump from `v3` to `v5`, in order to align across OneSignal’s suite of client SDKs. This guide will walk you through the iOS SDK `5.0.0-alpha-02` changes as a result of this shift.
1212

1313
# Overview
1414

@@ -60,10 +60,10 @@ As mentioned above, the iOS SDK is making the jump from `v3` to `v5`, in order t
6060
```
6161

6262
### Option 1. Swift Package Manager
63-
Update the version of the OneSignal-XCFramework your application uses to `5.0.0-alpha-01`. In addition, the Package Product name has been changed from `OneSignal` to `OneSignalFramework`. See [the existing installation instructions](https://documentation.onesignal.com/docs/swift-package-manager-setup).
63+
Update the version of the OneSignal-XCFramework your application uses to `5.0.0-alpha-02`. In addition, the Package Product name has been changed from `OneSignal` to `OneSignalFramework`. See [the existing installation instructions](https://documentation.onesignal.com/docs/swift-package-manager-setup).
6464

6565
### Option 2. CocoaPods
66-
Update the version of the OneSignalXCFramework your application uses to `5.0.0-alpha-01`. Other than updating the import statement above, there are no additional changes needed to import the OneSignal SDK in your Xcode project. See [the existing installation instructions](https://documentation.onesignal.com/docs/ios-sdk-setup#step-3-import-the-onesignal-sdk-into-your-xcode-project).
66+
Update the version of the OneSignalXCFramework your application uses to `5.0.0-alpha-02`. Other than updating the import statement above, there are no additional changes needed to import the OneSignal SDK in your Xcode project. See [the existing installation instructions](https://documentation.onesignal.com/docs/ios-sdk-setup#step-3-import-the-onesignal-sdk-into-your-xcode-project).
6767

6868
# API Changes
6969
## Namespaces
@@ -209,7 +209,7 @@ Email and/or SMS subscriptions can be added or removed via the following methods
209209

210210
# API Reference
211211

212-
Below is a comprehensive reference to the `5.0.0-alpha-01` OneSignal SDK.
212+
Below is a comprehensive reference to the `5.0.0-alpha-02` OneSignal SDK.
213213

214214
## OneSignal
215215

@@ -222,10 +222,66 @@ The SDK is still accessible via a `OneSignal` static class. It provides access t
222222
| `OneSignal.logout()` | `[OneSignal 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.* |
223223
| `let granted: Bool = OneSignal.privacyConsent`<br><br>`OneSignal.privacyConsent = true` | `BOOL granted = OneSignal.getPrivacyConsent`<br><br>`[OneSignal setPrivacyConsent:true]` | *Indicates whether privacy consent has been granted. This field is only relevant when the application has opted into data privacy protections. See [requiresPrivacyConsent].* |
224224
| `let required: Bool = OneSignal.requiresPrivacyConsent`<br><br>`OneSignal.requiresPrivacyConsent = true` | `BOOL required = [OneSignal requiresPrivacyConsent]`<br><br>`[OneSignal setRequiresPrivacyConsent:true]` | *Determines whether a user must consent to privacy prior to their user data being sent up to OneSignal. This should be set to `true` prior to the invocation of `initialize` to ensure compliance.* |
225-
| `OneSignal.setLaunchURLsInApp(true)` | `[OneSignal setLaunchURLsInApp:true]` | *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.* |
226-
225+
| `OneSignal.setLaunchURLsInApp(true)` | `[OneSignal setLaunchURLsInApp:true]` | *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.* |
226+
| `OneSignal.enterLiveActivity("ACTIVITY_ID", withToken: "TOKEN")`<br><br>***See below for usage of callbacks***<br><br>`enterLiveActivity(activityId: String, withToken token: String, withSuccess successBlock: OSResultSuccessBlock?, withFailure failureBlock: OSFailureBlock? = nil)` | `[OneSignal enterLiveActivity:@"ACTIVITY_ID" withToken:@"TOKEN"]`<br><br>***See below for usage of callbacks***<br><br>`(void)enterLiveActivity:(NSString *)activityId withToken:(NSString *)token withSuccess:(OSResultSuccessBlock _Nullable)successBlock withFailure:(OSFailureBlock _Nullable)failureBlock`<br><br>|*Entering a Live Activity associates an `activityId` with a live activity temporary push `token` on OneSignal's server. The activityId is then used with the OneSignal REST API to update one or multiple Live Activities at one time.* |
227+
| `OneSignal.exitLiveActivity("ACTIVITY_ID")`<br><br>***See below for usage of callbacks***<br><br>`exitLiveActivity(activityId: String, withSuccess successBlock: OSResultSuccessBlock?, withFailure failureBlock: OSFailureBlock? = nil)` | `[OneSignal exitLiveActivity:@"ACTIVITY_ID"]`<br><br>***See below for usage of callbacks***<br><br>`(void)exitLiveActivity:(NSString *)activityId withSuccess:(OSResultSuccessBlock _Nullable)successBlock withFailure:(OSFailureBlock _Nullable)failureBlock`<br><br> |*Exiting a Live activity deletes the association between a customer defined `activityId` with a Live Activity temporary push `token` on OneSignal's server.* |
228+
229+
230+
231+
## Live Activities
227232

233+
Live Activities are a type of interactive push notification. Apple introduced them in October 2022 to enable iOS apps to provide real-time updates to their users that are visible from the lock screen and the dynamic island.
228234

235+
Please refer to OneSignal’s guide on [Live Activities](https://documentation.onesignal.com/docs/live-activities), the [Live Activities Quickstart](https://documentation.onesignal.com/docs/live-activities-quickstart) tutorial, and the [existing SDK reference](https://documentation.onesignal.com/docs/sdk-reference#live-activities) on Live Activities.
236+
237+
**Objective-C**
238+
```objc
239+
// Enter a Live Activity
240+
[OneSignal enterLiveActivity:@"ACTIVITY_ID" withToken:@"TOKEN" withSuccess:^(NSDictionary *result) {
241+
NSLog(@"enterLiveActivity success with result: %@", result);
242+
} withFailure:^(NSError *error) {
243+
NSLog(@"enterLiveActivity error: %@", error);
244+
}];
245+
246+
// Exit a Live Activity
247+
[OneSignal exitLiveActivity:@"ACTIVITY_ID" withSuccess:^(NSDictionary *result) {
248+
NSLog(@"exitLiveActivity success with result: %@", result);
249+
} withFailure:^(NSError *error) {
250+
NSLog(@"exitLiveActivity error: %@", error);
251+
// handle failure case
252+
}];
253+
254+
// Success Output Example:
255+
/*
256+
{
257+
success = 1
258+
}
259+
*/
260+
```
261+
**Swift**
262+
```swift
263+
// Enter a Live Activity
264+
OneSignal.enterLiveActivity("ACTIVITY_ID", withToken: "TOKEN") { result in
265+
print("enterLiveActivity success with result: \(result ?? [:])")
266+
} withFailure: { error in
267+
print("enterLiveActivity error: \(String(describing: error))")
268+
}
269+
270+
// Exit a Live Activity
271+
OneSignal.exitLiveActivity("ACTIVITY_ID") { result in
272+
print("exitLiveActivity success with result: \(result ?? [:])")
273+
} withFailure: { error in
274+
print("exitLiveActivity error: \(String(describing: error))")
275+
// handle failure case
276+
}
277+
278+
// Success Output Example:
279+
/*
280+
{
281+
success = 1
282+
}
283+
*/
284+
```
229285

230286
## User Namespace
231287

0 commit comments

Comments
 (0)