Skip to content

Commit 0145e22

Browse files
Use Step and Flow types of Authenticator library instead of String.
1 parent dbb87ac commit 0145e22

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

WooCommerce/Classes/Model/CustomHelpCenterContent.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import WordPressAuthenticator
23

34
/// For holding the custom help center content URL
45
/// and analytics tracking values
@@ -14,20 +15,26 @@ struct CustomHelpCenterContent {
1415
}
1516

1617
extension CustomHelpCenterContent {
18+
enum Key: String {
19+
case step = "source_step"
20+
case flow = "source_flow"
21+
case url = "help_content_url"
22+
}
23+
1724
/// Initializes a `CustomHelpCenterContent` instance using `Step` and `Flow` from `AuthenticatorAnalyticsTracker`
1825
///
19-
init?(step: String, flow: String) {
26+
init?(step: AuthenticatorAnalyticsTracker.Step, flow: AuthenticatorAnalyticsTracker.Flow) {
2027
switch step {
21-
case "start" where flow == "login_site_address":
28+
case .start where flow == .loginWithSiteAddress:
2229
helpCenterContentURL = WooConstants.URLs.helpCenterForEnterStoreAddress.asURL()
2330
default:
2431
return nil
2532
}
2633

2734
trackingProperties = [
28-
"source_step": step,
29-
"source_flow": flow,
30-
"help_content_url": helpCenterContentURL.absoluteString
35+
Key.step.rawValue: step.rawValue,
36+
Key.flow.rawValue: flow.rawValue,
37+
Key.url.rawValue: helpCenterContentURL.absoluteString
3138
]
3239
}
3340
}

0 commit comments

Comments
 (0)