Newer
Older
import Shared
import Combine
import DrawerFeature
import DependencyInjection
final class SearchUsernameController: UIViewController {
@Dependency private var coordinator: SearchCoordinating
lazy private var screenView = SearchUsernameView()
private var cancellables = Set<AnyCancellable>()
private var drawerCancellables = Set<AnyCancellable>()
override func loadView() {
view = screenView
}
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
override func viewDidLoad() {
super.viewDidLoad()
setupBindings()
}
private func setupBindings() {
screenView.placeholderView
.infoPublisher
.receive(on: DispatchQueue.main)
.sink { [unowned self] in presentSearchDisclaimer() }
.store(in: &cancellables)
}
private func presentSearchDisclaimer() {
let actionButton = CapsuleButton()
actionButton.set(
style: .seeThrough,
title: Localized.Ud.Placeholder.Drawer.action
)
let drawer = DrawerController(with: [
DrawerText(
font: Fonts.Mulish.bold.font(size: 26.0),
text: Localized.Ud.Placeholder.Drawer.title,
color: Asset.neutralActive.color,
alignment: .left,
spacingAfter: 19
),
DrawerLinkText(
text: Localized.Ud.Placeholder.Drawer.subtitle,
urlString: "https://links.xx.network/adrp",
spacingAfter: 37
),
DrawerStack(views: [
actionButton,
FlexibleSpace()
])
])
actionButton.publisher(for: .touchUpInside)
.receive(on: DispatchQueue.main)
.sink {
drawer.dismiss(animated: true) { [weak self] in
guard let self = self else { return }
self.drawerCancellables.removeAll()
}
}.store(in: &self.drawerCancellables)
coordinator.toDrawer(drawer, from: self)
}