From fbe164ec4a44e3eb2349a40b63d18c6c0580aced Mon Sep 17 00:00:00 2001 From: Abhishek Pandey Date: Fri, 20 Jan 2023 15:39:52 +0530 Subject: [PATCH] fix: improper way of handling customContext --- Podfile.lock | 4 ++-- Sources/Classes/Client/Plugins/RSContextPlugin.swift | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 9ed56f3e..e3730673 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Rudder (2.2.4) + - Rudder (2.2.5) DEPENDENCIES: - Rudder (from `.`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "." SPEC CHECKSUMS: - Rudder: 5fb72ab3d09de72cab0a949aa7b1aad2f24947f9 + Rudder: decdbd805872e80089665333f9752c8ed317c99d PODFILE CHECKSUM: ee379229e6a0b60bc98226700ace2de002171547 diff --git a/Sources/Classes/Client/Plugins/RSContextPlugin.swift b/Sources/Classes/Client/Plugins/RSContextPlugin.swift index 6c02a19f..84ac58cf 100644 --- a/Sources/Classes/Client/Plugins/RSContextPlugin.swift +++ b/Sources/Classes/Client/Plugins/RSContextPlugin.swift @@ -118,18 +118,19 @@ class RSContextPlugin: RSPlatformPlugin { } func insertDynamicOptionData(message: RSMessage, context: inout [String: Any]) { + /// First priority will given to the `option` passed along with the event if let option = message.option { if let externalIds = option.externalIds { context["externalId"] = externalIds } if let customContexts = option.customContexts { - for key in customContexts.keys { - context[key] = [key: customContexts] + for (key, value) in customContexts { + context[key] = value } } } + // TODO: Fetch `customContexts` set using setOption API. } - } extension RSClient {