Integrate RoundedButton where needed.

This commit is contained in:
SBiOSoftWhare
2020-04-28 16:34:39 +02:00
parent c832c2e47c
commit 60c8fd528f
4 changed files with 21 additions and 40 deletions
@@ -61,7 +61,7 @@
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="8Ou-Xh-0rC">
<rect key="frame" x="0.0" y="48" width="374" height="40"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kBt-2D-25V">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kBt-2D-25V" customClass="RoundedButton" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="182" height="40"/>
<inset key="contentEdgeInsets" minX="10" minY="0.0" maxX="10" maxY="0.0"/>
<state key="normal" title="No">
@@ -71,7 +71,7 @@
<action selector="rejectButtonAction:" destination="V8j-Lb-PgC" eventType="touchUpInside" id="qCV-Oh-YAG"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="03A-fe-h3s">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="03A-fe-h3s" customClass="RoundedButton" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="192" y="0.0" width="182" height="40"/>
<inset key="contentEdgeInsets" minX="10" minY="0.0" maxX="10" maxY="0.0"/>
<state key="normal" title="Yes">
@@ -22,11 +22,6 @@ final class KeyVerificationScanConfirmationViewController: UIViewController {
// MARK: - Constants
private enum Constants {
static let buttonBackgroundColorAlpha: CGFloat = 0.2
static let buttonCornerRadius: CGFloat = 6.0
}
// MARK: - Properties
// MARK: Outlets
@@ -39,8 +34,8 @@ final class KeyVerificationScanConfirmationViewController: UIViewController {
@IBOutlet private weak var scannedContentView: UIView!
@IBOutlet private weak var scannedInformationLabel: UILabel!
@IBOutlet private weak var rejectButton: UIButton!
@IBOutlet private weak var confirmButton: UIButton!
@IBOutlet private weak var rejectButton: RoundedButton!
@IBOutlet private weak var confirmButton: RoundedButton!
// MARK: Private
@@ -76,15 +71,6 @@ final class KeyVerificationScanConfirmationViewController: UIViewController {
self.viewModel.process(viewAction: .loadData)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if self.scannedContentView.isHidden == false {
self.confirmButton.layer.cornerRadius = Constants.buttonCornerRadius
self.rejectButton.layer.cornerRadius = Constants.buttonCornerRadius
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
@@ -111,8 +97,8 @@ final class KeyVerificationScanConfirmationViewController: UIViewController {
self.titleLabel.textColor = theme.textPrimaryColor
self.waitingLabel.textColor = theme.textSecondaryColor
self.scannedInformationLabel.textColor = theme.textPrimaryColor
self.confirmButton.vc_setBackgroundColor(theme.tintColor.withAlphaComponent(Constants.buttonBackgroundColorAlpha), for: .normal)
self.rejectButton.vc_setBackgroundColor(theme.noticeColor.withAlphaComponent(Constants.buttonBackgroundColorAlpha), for: .normal)
self.confirmButton.update(theme: theme)
self.rejectButton.update(theme: theme)
}
private func registerThemeServiceDidChangeThemeNotification() {
@@ -130,10 +116,12 @@ final class KeyVerificationScanConfirmationViewController: UIViewController {
self.navigationItem.rightBarButtonItem = cancelBarButtonItem
self.title = VectorL10n.keyVerificationVerifyQrCodeTitle
self.confirmButton.layer.masksToBounds = true
self.rejectButton.layer.masksToBounds = true
self.confirmButton.setTitle(Bundle.mxk_localizedString(forKey: "yes"), for: .normal)
self.rejectButton.setTitle(Bundle.mxk_localizedString(forKey: "no"), for: .normal)
self.rejectButton.actionStyle = .cancel
}
private func render(viewState: KeyVerificationScanConfirmationViewState) {