diff --git a/dydx/dydxPresenters/dydxPresenters.xcodeproj/project.pbxproj b/dydx/dydxPresenters/dydxPresenters.xcodeproj/project.pbxproj index c9e9d7d93..46d556b9c 100644 --- a/dydx/dydxPresenters/dydxPresenters.xcodeproj/project.pbxproj +++ b/dydx/dydxPresenters/dydxPresenters.xcodeproj/project.pbxproj @@ -134,6 +134,7 @@ 277E90192B1EA3C3005CCBCB /* dydxRewardsSummaryPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277E90182B1EA3C3005CCBCB /* dydxRewardsSummaryPresenter.swift */; }; 277E90332B1FAE9A005CCBCB /* dydxRewardsHelpViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277E90322B1FAE9A005CCBCB /* dydxRewardsHelpViewPresenter.swift */; }; 277E908B2B2118AE005CCBCB /* dydxRewardsHistoryViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277E908A2B2118AE005CCBCB /* dydxRewardsHistoryViewPresenter.swift */; }; + 278A4D1E2B8EA95A003898EB /* dydxCollectFeedbackActionBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 278A4D1D2B8EA95A003898EB /* dydxCollectFeedbackActionBuilder.swift */; }; 27C027532AFD761300E92CCB /* dydxSettingsHelpRowViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27C027522AFD761300E92CCB /* dydxSettingsHelpRowViewPresenter.swift */; }; 27DB2EA32AC1E7B20047BC39 /* dydxTradeRestrictedViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27DB2EA22AC1E7B20047BC39 /* dydxTradeRestrictedViewPresenter.swift */; }; 314BBDE9F332ECA910BC414E /* Pods_iOS_dydxPresenters.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1551C00FFF41C29CFC5BD94 /* Pods_iOS_dydxPresenters.framework */; }; @@ -476,6 +477,7 @@ 277E90182B1EA3C3005CCBCB /* dydxRewardsSummaryPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dydxRewardsSummaryPresenter.swift; sourceTree = ""; }; 277E90322B1FAE9A005CCBCB /* dydxRewardsHelpViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dydxRewardsHelpViewPresenter.swift; sourceTree = ""; }; 277E908A2B2118AE005CCBCB /* dydxRewardsHistoryViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dydxRewardsHistoryViewPresenter.swift; sourceTree = ""; }; + 278A4D1D2B8EA95A003898EB /* dydxCollectFeedbackActionBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dydxCollectFeedbackActionBuilder.swift; sourceTree = ""; }; 27C027522AFD761300E92CCB /* dydxSettingsHelpRowViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dydxSettingsHelpRowViewPresenter.swift; sourceTree = ""; }; 27DB2EA22AC1E7B20047BC39 /* dydxTradeRestrictedViewPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dydxTradeRestrictedViewPresenter.swift; sourceTree = ""; }; 64487FFE2AA248340068DD87 /* dydxAlertsWorker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = dydxAlertsWorker.swift; sourceTree = ""; }; @@ -733,6 +735,7 @@ children = ( 0243A76029BE572C00A083FE /* dydxCancelOrderActionBuilder.swift */, 0262F2D429DB4891009889E2 /* WalletAction.swift */, + 278A4D1D2B8EA95A003898EB /* dydxCollectFeedbackActionBuilder.swift */, ); path = Actions; sourceTree = ""; @@ -1786,6 +1789,7 @@ 02A565B22A5E32790035469F /* dydxSystemAlertsProvider.swift in Sources */, 024FEB412ACB60690087A55E /* dydxMarketOrderbookPresenter.swift in Sources */, 270E7E242A5F6B1B00136793 /* dydxTradeInputSideViewPresenter.swift in Sources */, + 278A4D1E2B8EA95A003898EB /* dydxCollectFeedbackActionBuilder.swift in Sources */, 2741E3732A689740000FA190 /* dydxDirectionColorPreferenceViewBuilder.swift in Sources */, 0236F12D296B91BD00EB995F /* dydxPortfolioOrdersViewPresenter.swift in Sources */, 0280B3A629CB63E10017D64A /* dydxOnboardWelcomeViewBuilder.swift in Sources */, diff --git a/dydx/dydxPresenters/dydxPresenters/_Features/routing_swiftui.json b/dydx/dydxPresenters/dydxPresenters/_Features/routing_swiftui.json index a220fe73e..576165262 100644 --- a/dydx/dydxPresenters/dydxPresenters/_Features/routing_swiftui.json +++ b/dydx/dydxPresenters/dydxPresenters/_Features/routing_swiftui.json @@ -66,6 +66,9 @@ "/action/share": { "destination":"PlatformRouting.ShareActionBuilder" }, + "/action/collect_feedback": { + "destination":"dydxPresenters.dydxCollectFeedbackActionBuilder" + }, "/action/wallet/connect": { "destination":"dydxPresenters.WalletActionBuilder" }, diff --git a/dydx/dydxPresenters/dydxPresenters/_Features/settings.json b/dydx/dydxPresenters/dydxPresenters/_Features/settings.json index 6cc33a4f7..b9c3cb45f 100644 --- a/dydx/dydxPresenters/dydxPresenters/_Features/settings.json +++ b/dydx/dydxPresenters/dydxPresenters/_Features/settings.json @@ -32,6 +32,14 @@ "link" : { "text" : "{APP_SCHEME}:///settings/direction_color_preference" } + }, + { + "title" : { + "text" : "APP.HELP_MODAL.PROVIDE_FEEDBACK" + }, + "link" : { + "text" : "{APP_SCHEME}:///action/collect_feedback?context=settings" + } } ] } diff --git a/dydx/dydxPresenters/dydxPresenters/_Features/settings_debug.json b/dydx/dydxPresenters/dydxPresenters/_Features/settings_debug.json index 5b1affe4a..7183a002a 100644 --- a/dydx/dydxPresenters/dydxPresenters/_Features/settings_debug.json +++ b/dydx/dydxPresenters/dydxPresenters/_Features/settings_debug.json @@ -64,6 +64,14 @@ "link" : { "text" : "{APP_SCHEME}:///settings/debug_theme_viewer" } + }, + { + "title" : { + "text" : "APP.HELP_MODAL.PROVIDE_FEEDBACK" + }, + "link" : { + "text" : "{APP_SCHEME}:///action/collect_feedback?context=settings" + } } ] } diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/Actions/dydxCollectFeedbackActionBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/Actions/dydxCollectFeedbackActionBuilder.swift new file mode 100644 index 000000000..4d04c9c34 --- /dev/null +++ b/dydx/dydxPresenters/dydxPresenters/_v4/Actions/dydxCollectFeedbackActionBuilder.swift @@ -0,0 +1,44 @@ +// +// dydxCollectFeedbackActionBuilder.swift +// dydxPresenters +// +// Created by Michael Maguire on 2/27/24. +// + +import RoutingKit +import Utilities +import UIToolkits +import dydxStateManager + +public class dydxCollectFeedbackActionBuilder: NSObject, ObjectBuilderProtocol { + public func build() -> T? { + let action = dydxCollectFeedbackAction() + return action as? T + } +} + +open class dydxCollectFeedbackAction: NSObject, NavigableProtocol { + private var completion: RoutingCompletionBlock? + open func navigate(to request: RoutingRequest?, animated: Bool, completion: RoutingCompletionBlock?) { + switch request?.path { + case "/action/collect_feedback": + if let feedbackUrl = URL(string: AbacusStateManager.shared.environment?.links?.feedback ?? "") { + let data: [String: String]? + if let shareSource = request?.params?["context"] as? String { + data = ["source_context": shareSource] + } else { + data = nil + } + Router.shared?.navigate(to: feedbackUrl, completion: { _, success in + completion?(nil, success) + }) + Tracking.shared?.log(event: "CollectFeedbackDisplayed", data: data) + completion?(nil, true) + } else { + completion?(nil, false) + } + default: + completion?(nil, false) + } + } +}