From 6ef314446bf1cf7ac9fbb182e9ec03f50113af00 Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Tue, 3 Dec 2024 18:31:51 +0100 Subject: [PATCH] update CustomerCenterSurveyOptionChosenEvent to accept path and url --- .../ViewModels/FeedbackSurveyViewModel.swift | 3 ++- .../CustomerCenter/CustomerCenterConfigData.swift | 2 ++ .../Events/CustomerCenterEvent.swift | 13 +++++++++---- .../Events/EventsRequest+CustomerCenter.swift | 15 ++++++++++----- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/RevenueCatUI/CustomerCenter/ViewModels/FeedbackSurveyViewModel.swift b/RevenueCatUI/CustomerCenter/ViewModels/FeedbackSurveyViewModel.swift index a9d3f043f3..dbb44e462f 100644 --- a/RevenueCatUI/CustomerCenter/ViewModels/FeedbackSurveyViewModel.swift +++ b/RevenueCatUI/CustomerCenter/ViewModels/FeedbackSurveyViewModel.swift @@ -123,7 +123,8 @@ private extension FeedbackSurveyViewModel { darkMode: darkMode, isSandbox: isSandbox, displayMode: displayMode, - pathID: feedbackSurveyData.path.id, + path: feedbackSurveyData.path.type, + url: feedbackSurveyData.path.url, surveyOptionID: option.id, surveyOptionTitleKey: option.title, additionalContext: nil, diff --git a/Sources/CustomerCenter/CustomerCenterConfigData.swift b/Sources/CustomerCenter/CustomerCenterConfigData.swift index f9508aaabe..70193af705 100644 --- a/Sources/CustomerCenter/CustomerCenterConfigData.swift +++ b/Sources/CustomerCenter/CustomerCenterConfigData.swift @@ -553,3 +553,5 @@ extension CustomerCenterConfigData.Support { } } + +extension CustomerCenterConfigData.HelpPath.PathType: Sendable, Codable {} diff --git a/Sources/CustomerCenter/Events/CustomerCenterEvent.swift b/Sources/CustomerCenter/Events/CustomerCenterEvent.swift index 4a56a292ae..4c84f5d212 100644 --- a/Sources/CustomerCenter/Events/CustomerCenterEvent.swift +++ b/Sources/CustomerCenter/Events/CustomerCenterEvent.swift @@ -101,7 +101,8 @@ extension CustomerCenterSurveyOptionChosenEvent { public var darkMode: Bool { base.darkMode } public var isSandbox: Bool { base.isSandbox } public var displayMode: CustomerCenterPresentationMode { base.displayMode } - public let pathID: String + public let path: CustomerCenterConfigData.HelpPath.PathType + public let url: URL? public let surveyOptionID: String public let surveyOptionTitleKey: String public let additionalContext: String? @@ -114,7 +115,8 @@ extension CustomerCenterSurveyOptionChosenEvent { darkMode: Bool, isSandbox: Bool, displayMode: CustomerCenterPresentationMode, - pathID: String, + path: CustomerCenterConfigData.HelpPath.PathType, + url: URL?, surveyOptionID: String, surveyOptionTitleKey: String, additionalContext: String? = nil, @@ -126,7 +128,8 @@ extension CustomerCenterSurveyOptionChosenEvent { isSandbox: isSandbox, displayMode: displayMode ) - self.pathID = pathID + self.path = path + self.url = url self.surveyOptionID = surveyOptionID self.surveyOptionTitleKey = surveyOptionTitleKey self.additionalContext = additionalContext @@ -210,7 +213,8 @@ extension CustomerCenterSurveyOptionChosenEvent.Data: Equatable, Codable, Sendab private enum CodingKeys: String, CodingKey { case base - case pathID = "pathId" + case path + case url case surveyOptionID = "surveyOptionId" case surveyOptionTitleKey = "surveyOptionTitleKey" case additionalContext = "additionalContext" @@ -219,4 +223,5 @@ extension CustomerCenterSurveyOptionChosenEvent.Data: Equatable, Codable, Sendab } } + extension CustomerCenterSurveyOptionChosenEvent: Equatable, Codable, Sendable {} diff --git a/Sources/CustomerCenter/Events/EventsRequest+CustomerCenter.swift b/Sources/CustomerCenter/Events/EventsRequest+CustomerCenter.swift index fc3ff22f49..767f9e9d88 100644 --- a/Sources/CustomerCenter/Events/EventsRequest+CustomerCenter.swift +++ b/Sources/CustomerCenter/Events/EventsRequest+CustomerCenter.swift @@ -112,7 +112,8 @@ extension EventsRequest { var locale: String var isSandbox: Bool var displayMode: CustomerCenterPresentationMode - var pathID: String + var path: String + var url: String? var surveyOptionID: String var surveyOptionTitleKey: String var additionalContext: String? @@ -127,7 +128,8 @@ extension EventsRequest { locale: String, isSandbox: Bool, displayMode: CustomerCenterPresentationMode, - pathID: String, + path: CustomerCenterConfigData.HelpPath.PathType, + url: URL?, surveyOptionID: String, surveyOptionTitleKey: String, additionalContext: String?, @@ -142,7 +144,8 @@ extension EventsRequest { self.locale = locale self.isSandbox = isSandbox self.displayMode = displayMode - self.pathID = pathID + self.path = path.rawValue + self.url = url?.absoluteString self.surveyOptionID = surveyOptionID self.surveyOptionTitleKey = surveyOptionTitleKey self.additionalContext = additionalContext @@ -179,7 +182,8 @@ extension EventsRequest { locale: data.localeIdentifier, isSandbox: data.isSandbox, displayMode: data.displayMode, - pathID: data.pathID, + path: data.path, + url: data.url, surveyOptionID: data.surveyOptionID, surveyOptionTitleKey: data.surveyOptionTitleKey, additionalContext: data.additionalContext, @@ -241,7 +245,8 @@ extension EventsRequest.CustomerCenterEventSurveyOptionChosen: Encodable { case locale case isSandbox = "isSandbox" case displayMode = "displayMode" - case pathID = "pathId" + case path + case url case surveyOptionID = "surveyOptionId" case surveyOptionTitleKey = "surveyOptionTitleKey" case additionalContext = "additionalContext"