Skip to content

Commit

Permalink
Fix invalid mapping for connection info in CourierEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
alfianlosari committed Dec 20, 2023
1 parent 94b33ba commit cdf13df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions courier_dart_sdk/ios/Classes/EventHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,17 @@ final class EventHandler: ICourierEventHandler {
}

private func injectConnectionInfoAndSendEvent(eventMap: [String: Any], event: CourierEvent) {
if var props = eventMap["properties"] as? [String: Any],
let connectionInfo =
if let connectionInfo =
event.connectionInfo {
props["connectionInfo"] = [
var _eventMap = eventMap
_eventMap["connectionInfo"] = [
"host": connectionInfo.host,
"port": Int(connectionInfo.port),
"keepAlive": Int(connectionInfo.keepAlive),
"clientId": connectionInfo.clientId,
"username": connectionInfo.username
]
var eventMap = eventMap
eventMap["properties"] = props
handler(eventMap)
handler(_eventMap)
} else {
handler(eventMap)
}
Expand Down
2 changes: 1 addition & 1 deletion courier_dart_sdk/lib/event/courier_event_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CourierEventHandler implements ICourierEventHandler {
}
log('Event received: $eventName with properties: $eventProps');

final connectionInfoMap = eventProps["connectionInfo"];
final connectionInfoMap = arguments["connectionInfo"];
ConnectionInfo? connectionInfo;
if (connectionInfoMap != null) {
connectionInfo = ConnectionInfo(
Expand Down

0 comments on commit cdf13df

Please sign in to comment.