Skip to content

Commit

Permalink
GH-3418 add tracking data
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBespalov committed Jun 7, 2024
1 parent 9c87319 commit a27a958
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Multisig/Cross-layer/Analytics/TrackingEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,14 @@ enum TrackingEvent: String, Trackable {
case screenStartCreatePassword = "screen_set_pw_start"
case screenCreatePassword = "screen_set_pw_create"
case screenCreatePasswordSuccess = "screen_set_pw_sucess"

// Export and Import Data
case screenExportInstructions = "screen_export_instructions"
case screenExportSuccess = "screen_exportdata_success"

case screenImportInstructions = "screen_import_instructions"
case screenImportSuccess = "screen_importdata_success"

}

extension TrackingEvent {
Expand Down
13 changes: 12 additions & 1 deletion Multisig/Features/Data Export/ExportDataFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ExportDataFlow: UIFlow {
let vc = CommonInstructionsViewController()
vc.title = "Export Data"

vc.trackingEvent = .screenExportInstructions

vc.steps = [
.header,
.step(number: "1", title: "Create a file password", description: "Enter a strong password for locking the export file."),
Expand Down Expand Up @@ -84,6 +86,7 @@ class ExportDataFlow: UIFlow {
secondaryAction: "Done"
)
vc.reenablesNavBar = false
vc.setTrackingData(trackingEvent: .screenExportSuccess)

vc.onDone = { [weak self, unowned vc] isPrimary in
if isPrimary {
Expand Down Expand Up @@ -115,12 +118,20 @@ class ExportDataFlow: UIFlow {

class CommonInstructionsViewController: InstructionsViewController {
var onStart: (() -> Void)?

var trackingEvent: TrackingEvent?

convenience init() {
self.init(namedClass: InstructionsViewController.self)
}

override func didTapButton(_ sender: Any) {
onStart?()
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if let trackingEvent = trackingEvent {
Tracker.trackEvent(trackingEvent)
}
}
}
2 changes: 2 additions & 0 deletions Multisig/Features/Data Export/ImportDataFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ImportDataFlow: UIFlow {
func instructions() {
let vc = CommonInstructionsViewController()
vc.title = "Import Data"
vc.trackingEvent = .screenImportInstructions

vc.steps = [
.header,
Expand Down Expand Up @@ -79,6 +80,7 @@ class ImportDataFlow: UIFlow {
secondaryAction: nil
)
vc.reenablesNavBar = false
vc.setTrackingData(trackingEvent: .screenImportSuccess)

vc.onDone = { [weak self] _ in
self?.stop(success: true)
Expand Down

0 comments on commit a27a958

Please sign in to comment.