Skip to content

Commit 4422beb

Browse files
authored
Merge pull request #52 from AdaSupport/ap/chatx-1326-hook-up-set-device-token
chatx-1326: adding set device token
2 parents 8c2ec0e + ed262aa commit 4422beb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

EmbedFramework/AdaWebHost.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public class AdaWebHost: NSObject {
8181
zdChatterAuthCallback: (((@escaping (_ token: String) -> Void)) -> Void)? = nil,
8282
webViewLoadingErrorCallback: ((Error) -> Void)? = nil,
8383
eventCallbacks: [String: (_ event: [String: Any]) -> Void]? = nil,
84-
webViewTimeout: Double = 30.0
84+
webViewTimeout: Double = 30.0,
85+
deviceToken: String = ""
8586
) {
8687
self.handle = handle
8788
self.cluster = cluster
@@ -141,11 +142,18 @@ public class AdaWebHost: NSObject {
141142
print("Unable to start reachability notifier.")
142143
}
143144

145+
setDeviceToken(deviceToken: deviceToken)
144146
setupWebView()
145147
}
146148

147149
// MARK: - Public Methods
148150

151+
public func setDeviceToken(deviceToken : String) {
152+
let toRun = "adaEmbed.setDeviceToken(\(deviceToken));"
153+
154+
self.evalJS(toRun)
155+
}
156+
149157
/// Push a dictionary of fields to the server
150158
@available(*, deprecated, message: "This method will be deprecated in the future, please upgrade to MetaFields.Builder.", renamed: "setMetaFields(builder:)")
151159
public func setMetaFields(_ fields: [String: Any]) {

0 commit comments

Comments
 (0)