Skip to content

Commit 2a62402

Browse files
committed
Fill Support form meta data types
1 parent 6e7f01d commit 2a62402

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

WooCommerce/Classes/Tools/Zendesk/ZendeskManager.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ protocol ZendeskManagerProtocol: SupportManagerAdapter {
5858
/// To Refactor: These methods would end-up living outside this class. Exposing them here temporarily.
5959
/// https://github.com/woocommerce/woocommerce-ios/issues/8795
6060
///
61+
func formID() -> Int64
62+
func wcPayFormID() -> Int64
63+
6164
func generalTags() -> [String]
6265
func wcPayTags() -> [String]
6366

@@ -138,6 +141,14 @@ struct NoZendeskManager: ZendeskManagerProtocol {
138141
/// https://github.com/woocommerce/woocommerce-ios/issues/8795
139142
///
140143
extension NoZendeskManager {
144+
func formID() -> Int64 {
145+
.zero
146+
}
147+
148+
func wcPayFormID() -> Int64 {
149+
.zero
150+
}
151+
141152
func generalTags() -> [String] {
142153
[]
143154
}
@@ -528,6 +539,14 @@ final class ZendeskManager: NSObject, ZendeskManagerProtocol {
528539
/// https://github.com/woocommerce/woocommerce-ios/issues/8795
529540
///
530541
extension ZendeskManager {
542+
func formID() -> Int64 {
543+
createRequest(supportSourceTag: nil).ticketFormID?.int64Value ?? .zero
544+
}
545+
546+
func wcPayFormID() -> Int64 {
547+
createWCPayRequest(supportSourceTag: nil).ticketFormID?.int64Value ?? .zero
548+
}
549+
531550
func generalTags() -> [String] {
532551
getTags(supportSourceTag: nil)
533552
}

WooCommerce/Classes/ViewRelated/Dashboard/Settings/Help/SupportForm/SupportFormViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public protocol SupportFormMetaDataSource {
1313

1414
/// Zendesk Custom Fields
1515
///
16-
var customFields: [[AnyHashable: String]] { get }
16+
var customFields: [[Int64: String]] { get }
1717
}
1818

1919

WooCommerce/Classes/ViewRelated/Dashboard/Settings/Help/SupportForm/SupportFormsDataSources.swift

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,32 @@ import Foundation
22

33
/// Provides general Zendesk metadata.
44
///
5-
struct GeneralSupportDataSource {
5+
struct GeneralSupportDataSource: SupportFormMetaDataSource {
6+
var formID: Int64 {
7+
ZendeskProvider.shared.formID()
8+
}
69

10+
var tags: [String] {
11+
ZendeskProvider.shared.generalTags()
12+
}
13+
14+
var customFields: [[Int64: String]] {
15+
ZendeskProvider.shared.generalCustomFields()
16+
}
717
}
818

919
/// Provides WCPay Zendesk metadata.
1020
///
11-
struct WCPaySupportDataSource {
21+
struct WCPaySupportDataSource: SupportFormMetaDataSource {
22+
var formID: Int64 {
23+
ZendeskProvider.shared.wcPayFormID()
24+
}
25+
26+
var tags: [String] {
27+
ZendeskProvider.shared.wcPayTags()
28+
}
1229

30+
var customFields: [[Int64: String]] {
31+
ZendeskProvider.shared.wcPayCustomFields()
32+
}
1333
}

0 commit comments

Comments
 (0)