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
|
//
// DAITAInfoView.swift
// MullvadVPN
//
// Created by Jon Petersson on 2024-10-10.
// Copyright © 2025 Mullvad VPN AB. All rights reserved.
//
import UIKit
class DAITAInfoView: UIView {
let infoLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
let infoTextParagraphStyle = NSMutableParagraphStyle()
infoTextParagraphStyle.lineSpacing = 1.3
infoTextParagraphStyle.alignment = .center
label.attributedText = NSAttributedString(
string: NSLocalizedString(
String(
format: NSLocalizedString(
"The entry server for %@ is currently overridden by %@. To select an entry server, "
+ "please first enable “%@” or disable “%@“ in the settings.",
comment: ""
),
NSLocalizedString("multihop", comment: ""),
NSLocalizedString("DAITA", comment: ""),
NSLocalizedString("Direct only", comment: ""),
NSLocalizedString("DAITA", comment: "")
),
comment: ""
),
attributes: [
.font: UIFont.mullvadSmall,
.foregroundColor: UIColor.white,
.paragraphStyle: infoTextParagraphStyle,
]
)
label.adjustsFontForContentSizeCategory = true
return label
}()
let settingsButton: UIButton = {
let settingsButton = AppButton(style: .default)
settingsButton.setTitle(
String(format: NSLocalizedString("Open %@ settings", comment: ""), NSLocalizedString("DAITA", comment: "")),
for: .normal
)
return settingsButton
}()
var didPressDaitaSettingsButton: (() -> Void)?
init() {
super.init(frame: .zero)
backgroundColor = .secondaryColor
layoutMargins = UIMetrics.contentInsets
settingsButton.addTarget(self, action: #selector(didPressButton), for: .touchUpInside)
addConstrainedSubviews([infoLabel, settingsButton]) {
infoLabel.pinEdgesToSuperviewMargins(.init([.leading(24), .trailing(24), .top(8)]))
settingsButton.pinEdgesToSuperviewMargins(.init([.leading(0), .trailing(0)]))
settingsButton.topAnchor.constraint(equalTo: infoLabel.bottomAnchor, constant: 32)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc private func didPressButton() {
didPressDaitaSettingsButton?()
}
}
|