-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
collect feedback from settings menu (#99)
- Loading branch information
Showing
5 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
dydx/dydxPresenters/dydxPresenters/_v4/Actions/dydxCollectFeedbackActionBuilder.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>() -> 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) | ||
} | ||
} | ||
} |