Skip to content

Commit 8115cf3

Browse files
authored
Merge pull request #70 from FluorescentHallucinogen/separate-push-receive-and-click-events
Separate push notification receive and click events
2 parents d9f5270 + 9e29693 commit 8115cf3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Microsoft.PWABuilder.IOS.Web/Resources/ios-project-src/pwa-shell/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
121121
// Messaging.messaging().appDidReceiveMessage(userInfo)
122122
// Print full message.
123123
print("push userInfo 4:", userInfo)
124-
sendPushToWebView(userInfo: userInfo)
124+
sendPushClickToWebView(userInfo: userInfo)
125125

126126
completionHandler()
127127
}

Microsoft.PWABuilder.IOS.Web/Resources/ios-project-src/pwa-shell/PushNotifications.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,15 @@ func sendPushToWebView(userInfo: [AnyHashable: Any]){
171171
}
172172
checkViewAndEvaluate(event: "push-notification", detail: json)
173173
}
174+
175+
func sendPushClickToWebView(userInfo: [AnyHashable: Any]){
176+
var json = "";
177+
do {
178+
let jsonData = try JSONSerialization.data(withJSONObject: userInfo)
179+
json = String(data: jsonData, encoding: .utf8)!
180+
} catch {
181+
print("ERROR: userInfo parsing problem")
182+
return
183+
}
184+
checkViewAndEvaluate(event: "push-notification-click", detail: json)
185+
}

0 commit comments

Comments
 (0)