Skip to content

Commit b35765b

Browse files
authored
Merge pull request #157 from emartech/MV-1175
feat: ios silent push
2 parents 1448d5a + f75ac62 commit b35765b

5 files changed

Lines changed: 16 additions & 3 deletions

File tree

.github/workflows/sync-wiki.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
paths:
99
- 'docs/**'
1010

11+
permissions:
12+
contents: write
13+
1114
jobs:
1215
sync-wiki:
1316
runs-on: ubuntu-latest

docs/Home.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ objective-c
307307

308308
swift
309309
```swift
310-
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
310+
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
311311
Emarsys.push.handleMessage(userInfo: userInfo)
312312
completionHandler(.newData)
313313
}

docs/New-Architecture-and-Expo-framework.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ objective-c
406406

407407
swift
408408
```swift
409-
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
409+
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
410410
Emarsys.push.handleMessage(userInfo: userInfo)
411411
completionHandler(.newData)
412412
}

example/react-native/ios/reactnativeemarsyssdkexample/AppDelegate.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4747
return true
4848
}
4949

50-
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
50+
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
5151
// Emarsys - push token
5252
Emarsys.push.setPushToken(deviceToken)
5353
}
5454

55+
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
56+
Emarsys.push.handleMessage(userInfo: userInfo)
57+
completionHandler(.newData)
58+
}
59+
5560
}
5661

5762
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {

ios/expo/EmarsysAppDelegateSubscriber.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public class EmarsysAppDelegateSubscriber: ExpoAppDelegateSubscriber {
1919
Emarsys.push.setPushToken(deviceToken)
2020
}
2121

22+
public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
23+
Emarsys.push.handleMessage(userInfo: userInfo)
24+
completionHandler(.newData)
25+
}
26+
2227
}
2328

2429
// Expo plugin - END */

0 commit comments

Comments
 (0)