diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-10-13 14:59:10 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-11-04 10:46:08 +0100 |
| commit | 4e5d980abbc399d16079a114902005b6b5eb36f6 (patch) | |
| tree | 1d7e3e4e6f480fa4f428cc7ae85f0caf327b2f12 | |
| parent | 8627de5000f74fb702d4ea4a535833de69d9a1c4 (diff) | |
| download | mullvadvpn-4e5d980abbc399d16079a114902005b6b5eb36f6.tar.xz mullvadvpn-4e5d980abbc399d16079a114902005b6b5eb36f6.zip | |
Flip images in RTL
| -rw-r--r-- | ios/MullvadVPN/AppButton.swift | 4 | ||||
| -rw-r--r-- | ios/MullvadVPN/DisconnectSplitButton.swift | 14 | ||||
| -rw-r--r-- | ios/MullvadVPN/SettingsCell.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadVPN/TranslucentButtonBlurView.swift | 10 |
4 files changed, 19 insertions, 10 deletions
diff --git a/ios/MullvadVPN/AppButton.swift b/ios/MullvadVPN/AppButton.swift index 162a71b261..815d100095 100644 --- a/ios/MullvadVPN/AppButton.swift +++ b/ios/MullvadVPN/AppButton.swift @@ -132,9 +132,9 @@ class AppButton: CustomButton { case .translucentNeutral: return UIImage(named: "TranslucentNeutralButton") case .translucentDangerSplitLeft: - return UIImage(named: "TranslucentDangerSplitLeftButton") + return UIImage(named: "TranslucentDangerSplitLeftButton")?.imageFlippedForRightToLeftLayoutDirection() case .translucentDangerSplitRight: - return UIImage(named: "TranslucentDangerSplitRightButton") + return UIImage(named: "TranslucentDangerSplitRightButton")?.imageFlippedForRightToLeftLayoutDirection() } } } diff --git a/ios/MullvadVPN/DisconnectSplitButton.swift b/ios/MullvadVPN/DisconnectSplitButton.swift index 6f7c399c42..4a7f18a369 100644 --- a/ios/MullvadVPN/DisconnectSplitButton.swift +++ b/ios/MullvadVPN/DisconnectSplitButton.swift @@ -42,7 +42,7 @@ class DisconnectSplitButton: UIView { stackView.alignment = .fill stackView.spacing = 1 - secondaryButton.setImage(UIImage(named: "IconReload"), for: .normal) + secondaryButton.setImage(UIImage(named: "IconReload")?.imageFlippedForRightToLeftLayoutDirection(), for: .normal) primaryButton.overrideContentEdgeInsets = true secondaryButtonWidthConstraint = secondaryButton.widthAnchor.constraint(equalToConstant: 0) @@ -86,8 +86,16 @@ class DisconnectSplitButton: UIView { private func adjustTitleLabelPosition() { var contentInsets = primaryButton.defaultContentInsets - contentInsets.left = stackView.spacing + self.secondaryButtonSize.width - contentInsets.right = 0 + + let offset = stackView.spacing + self.secondaryButtonSize.width + + if case .leftToRight = effectiveUserInterfaceLayoutDirection { + contentInsets.left = offset + contentInsets.right = 0 + } else { + contentInsets.left = 0 + contentInsets.right = offset + } primaryButton.contentEdgeInsets = contentInsets } diff --git a/ios/MullvadVPN/SettingsCell.swift b/ios/MullvadVPN/SettingsCell.swift index 8e25b9c387..e1ee83f99e 100644 --- a/ios/MullvadVPN/SettingsCell.swift +++ b/ios/MullvadVPN/SettingsCell.swift @@ -104,6 +104,7 @@ class SettingsCell: UITableViewCell { let configuration = UIImage.SymbolConfiguration(pointSize: 11, weight: .bold) let chevron = UIImage(systemName: "chevron.right", withConfiguration: configuration)? .withTintColor(.white, renderingMode: .alwaysOriginal) + .imageFlippedForRightToLeftLayoutDirection() button.setImage(chevron, for: .normal) } else { diff --git a/ios/MullvadVPN/TranslucentButtonBlurView.swift b/ios/MullvadVPN/TranslucentButtonBlurView.swift index 8146acd9a4..982e6f86dc 100644 --- a/ios/MullvadVPN/TranslucentButtonBlurView.swift +++ b/ios/MullvadVPN/TranslucentButtonBlurView.swift @@ -28,7 +28,7 @@ class TranslucentButtonBlurView: UIVisualEffectView { ]) layer.cornerRadius = kButtonCornerRadius - layer.maskedCorners = button.style.cornerMask + layer.maskedCorners = button.style.cornerMask(effectiveUserInterfaceLayoutDirection) layer.masksToBounds = true } @@ -38,11 +38,11 @@ class TranslucentButtonBlurView: UIVisualEffectView { } private extension AppButton.Style { - var cornerMask: CACornerMask { - switch self { - case .translucentDangerSplitLeft: + func cornerMask(_ userInterfaceLayoutDirection: UIUserInterfaceLayoutDirection) -> CACornerMask { + switch (self, userInterfaceLayoutDirection) { + case (.translucentDangerSplitLeft, .leftToRight), (.translucentDangerSplitRight, .rightToLeft): return [.layerMinXMinYCorner, .layerMinXMaxYCorner] - case .translucentDangerSplitRight: + case (.translucentDangerSplitRight, .leftToRight), (.translucentDangerSplitLeft, .rightToLeft): return [.layerMaxXMinYCorner, .layerMaxXMaxYCorner] default: return [ |
