From c7642b03842ef7d6cf581262ba811a66c9d0a59e Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Wed, 3 Jul 2024 11:53:53 -0500 Subject: [PATCH] Add filename and recommendation_source to warning action data --- ...ImageRecommendationsBottomSheetViewController.swift | 6 +++++- .../WKImageRecommendationsViewController.swift | 2 +- Wikipedia/Code/ExploreViewController.swift | 4 ++-- Wikipedia/Code/ImageRecommendationsFunnel.swift | 10 ++++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsBottomSheetViewController.swift b/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsBottomSheetViewController.swift index ab2806bafe8..b9803d38c06 100644 --- a/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsBottomSheetViewController.swift +++ b/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsBottomSheetViewController.swift @@ -90,7 +90,11 @@ extension WKImageRecommendationsBottomSheetViewController: WKImageRecommendation let timeInterval = currentTime.timeIntervalSince(startTime) if timeInterval <= 5 { delegate?.imageRecommendationsDidTriggerTimeWarning() - loggingDelegate?.logDialogWarningMessageDidDisplay() + + if let currentRecommendation = viewModel.currentRecommendation { + loggingDelegate?.logDialogWarningMessageDidDisplay(fileName: currentRecommendation.imageData.filename, recommendationSource: currentRecommendation.imageData.source) + } + return } diff --git a/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsViewController.swift b/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsViewController.swift index 98adab6ec5b..85ae674e474 100644 --- a/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsViewController.swift +++ b/Components/Sources/Components/Components/Suggested Edits/Image Recommendations/WKImageRecommendationsViewController.swift @@ -33,7 +33,7 @@ public protocol WKImageRecommendationsLoggingDelegate: AnyObject { func logRejectSurveyDidTapSubmit(rejectionReasons: [String], otherReason: String?, fileName: String, recommendationSource: String) func logEmptyStateDidAppear() func logEmptyStateDidTapBack() - func logDialogWarningMessageDidDisplay() + func logDialogWarningMessageDidDisplay(fileName: String, recommendationSource: String) } fileprivate final class WKImageRecommendationsHostingViewController: WKComponentHostingController { diff --git a/Wikipedia/Code/ExploreViewController.swift b/Wikipedia/Code/ExploreViewController.swift index 76e08a24296..15fa04b915a 100644 --- a/Wikipedia/Code/ExploreViewController.swift +++ b/Wikipedia/Code/ExploreViewController.swift @@ -1430,8 +1430,8 @@ extension ExploreViewController: WKImageRecommendationsLoggingDelegate { ImageRecommendationsFunnel.shared.logBottomSheetDidAppear() } - func logDialogWarningMessageDidDisplay() { - ImageRecommendationsFunnel.shared.logDialogWarningMessageDidDisplay() + func logDialogWarningMessageDidDisplay(fileName: String, recommendationSource: String) { + ImageRecommendationsFunnel.shared.logDialogWarningMessageDidDisplay(fileName: fileName, recommendationSource: recommendationSource) } func logBottomSheetDidTapYes() { diff --git a/Wikipedia/Code/ImageRecommendationsFunnel.swift b/Wikipedia/Code/ImageRecommendationsFunnel.swift index 6cb988e59e2..2967803d236 100644 --- a/Wikipedia/Code/ImageRecommendationsFunnel.swift +++ b/Wikipedia/Code/ImageRecommendationsFunnel.swift @@ -284,7 +284,13 @@ final class ImageRecommendationsFunnel: NSObject { logEvent(activeInterface: .editSummaryDialog, action: .saveFailure, actionData: actionData, project: project) } - func logDialogWarningMessageDidDisplay() { - logEvent(activeInterface: .recommendedImageToolbar, action: .warning, project: project) + func logDialogWarningMessageDidDisplay(fileName: String, recommendationSource: String) { + + let actionData: [String: String] = [ + "filename": "\(fileName)", + "recommendation_source": "\(recommendationSource)" + ] + + logEvent(activeInterface: .recommendedImageToolbar, action: .warning, actionData: actionData, project: project) } }