-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathHelpType.swift
107 lines (99 loc) · 2.66 KB
/
HelpType.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import UIKit
public enum HelpType: SettingsCellTypeProtocol, CaseIterable, Equatable {
case helpCenter
case community
case contact
case howItWorks
case terms
case privacy
case cookie
case trust
case accessibility
case environment
case aiDisclosure
case prohibitedItems
public static func helpType(from url: URL) -> HelpType? {
let helpType = HelpType.allCases.filter { helpType in
url.absoluteString == helpType.url(
withBaseUrl: AppEnvironment.current.apiService.serverConfig.webBaseUrl
)?.absoluteString
}
.first
return helpType
}
public var accessibilityTraits: UIAccessibilityTraits {
switch self {
case .contact:
return .button
default:
return .link
}
}
public var title: String {
switch self {
case .helpCenter:
return Strings.Help_center()
case .community:
return ""
case .contact:
return Strings.profile_settings_about_contact()
case .howItWorks:
return Strings.profile_settings_about_how_it_works()
case .terms:
return Strings.profile_settings_about_terms()
case .privacy:
return Strings.profile_settings_about_privacy()
case .cookie:
return Strings.profile_settings_about_cookie()
case .trust:
return ""
case .accessibility:
return Strings.Accessibility_statement()
case .environment:
return ""
case .aiDisclosure:
return ""
case .prohibitedItems:
return ""
}
}
public var showArrowImageView: Bool {
switch self {
case .contact:
return false
default:
return true
}
}
public var textColor: UIColor {
return .ksr_support_700
}
public func url(withBaseUrl baseUrl: URL) -> URL? {
switch self {
case .community:
return baseUrl.appendingPathComponent("help/community")
case .cookie:
return baseUrl.appendingPathComponent("cookies")
case .contact:
return nil
case .helpCenter:
return baseUrl.appendingPathComponent("help")
case .howItWorks:
return baseUrl.appendingPathComponent("about")
case .privacy:
return baseUrl.appendingPathComponent("privacy")
case .terms:
return baseUrl.appendingPathComponent("terms-of-use")
case .trust:
return baseUrl.appendingPathComponent("trust")
case .accessibility:
return baseUrl.appendingPathComponent("accessibility")
case .environment:
return baseUrl.appendingPathComponent("environment")
case .aiDisclosure:
return baseUrl.appendingPathComponent("hc/en-us/articles/16848396410267")
case .prohibitedItems:
return baseUrl.appendingPathComponent("rules/prohibited")
}
}
}