diff --git a/Decred Wallet.xcodeproj/project.pbxproj b/Decred Wallet.xcodeproj/project.pbxproj index eeb4bae6..317f7589 100644 --- a/Decred Wallet.xcodeproj/project.pbxproj +++ b/Decred Wallet.xcodeproj/project.pbxproj @@ -108,7 +108,6 @@ B3B46A15228F0F2700A68EDD /* UIImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469CD228F0F2600A68EDD /* UIImageView.swift */; }; B3B46A17228F0F2700A68EDD /* ContouredButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469CF228F0F2600A68EDD /* ContouredButton.swift */; }; B3B46A18228F0F2700A68EDD /* DropDownSearchField.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469D0228F0F2600A68EDD /* DropDownSearchField.swift */; }; - B3B46A19228F0F2700A68EDD /* StartScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469D3228F0F2600A68EDD /* StartScreenViewController.swift */; }; B3B46A1B228F0F2700A68EDD /* SecurityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469D6228F0F2600A68EDD /* SecurityViewController.swift */; }; B3B46A1D228F0F2700A68EDD /* RequestPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469D8228F0F2600A68EDD /* RequestPasswordViewController.swift */; }; B3B46A1F228F0F2700A68EDD /* RequestPinViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469DA228F0F2600A68EDD /* RequestPinViewController.swift */; }; @@ -198,6 +197,8 @@ DDA8734E245F69C00029A13D /* CIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDA8734D245F69C00029A13D /* CIImage.swift */; }; DDAE91042435092200FEC016 /* ErrorMessageForLA.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAE91032435092200FEC016 /* ErrorMessageForLA.swift */; }; DDB660F52486BABB0060B0C5 /* Decred_WalletUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB660F42486BABB0060B0C5 /* Decred_WalletUITests.swift */; }; + DDB7755C27962DAD00F437E7 /* StartScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469D3228F0F2600A68EDD /* StartScreenViewController.swift */; }; + DDB7755D27962DAD00F437E7 /* StartScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B469D3228F0F2600A68EDD /* StartScreenViewController.swift */; }; DDCF259A22B8A347005FCBB9 /* Overview.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDCF259922B8A346005FCBB9 /* Overview.storyboard */; }; DDCF259C22B8A362005FCBB9 /* Send.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDCF259B22B8A361005FCBB9 /* Send.storyboard */; }; DDCF25A122B8A3D4005FCBB9 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDCF25A022B8A3D4005FCBB9 /* Settings.storyboard */; }; @@ -429,6 +430,8 @@ DDB660F22486BABB0060B0C5 /* Decred WalletUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Decred WalletUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; DDB660F42486BABB0060B0C5 /* Decred_WalletUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Decred_WalletUITests.swift; sourceTree = ""; }; DDB660F62486BABB0060B0C5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DDB775592796192E00F437E7 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/LaunchScreen.strings; sourceTree = ""; }; + DDB7755A2796192E00F437E7 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = ""; }; DDCF259922B8A346005FCBB9 /* Overview.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Overview.storyboard; sourceTree = ""; }; DDCF259B22B8A361005FCBB9 /* Send.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Send.storyboard; sourceTree = ""; }; DDCF25A022B8A3D4005FCBB9 /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = ""; }; @@ -1140,6 +1143,7 @@ "pt-BR", pl, fr, + ar, ); mainGroup = B3B46986228F0C2D00A68EDD; productRefGroup = B3B46990228F0C2D00A68EDD /* Products */; @@ -1277,7 +1281,6 @@ 60DFF5D124F75D4500624161 /* PoliteiaDetailController.swift in Sources */, 1034D5CF24113BF10009576C /* SimpleAlertDialog.swift in Sources */, B3B46A15228F0F2700A68EDD /* UIImageView.swift in Sources */, - B3B46A19228F0F2700A68EDD /* StartScreenViewController.swift in Sources */, B3B46A20228F0F2700A68EDD /* PinPasswordStrength.swift in Sources */, 2557E18B2355C9F000B6A1B7 /* CustomTabMenuView.swift in Sources */, B3D474E423E57DA200B6E305 /* CheckableListOptionTableViewCell.swift in Sources */, @@ -1332,6 +1335,7 @@ DD5AB14C23D36F7E00863362 /* AboutTableViewController.swift in Sources */, B3B46AB3228F0F7D00A68EDD /* ConfirmSeedViewCell.swift in Sources */, DDDF95D723C20AA70057AA7F /* SignMessageViewController.swift in Sources */, + DDB7755D27962DAD00F437E7 /* StartScreenViewController.swift in Sources */, DD81CBC523B39E6A009D3833 /* PaddedLabel.swift in Sources */, 60C7E54724ED88B8009E4569 /* PoliteiaTableViewCell.swift in Sources */, B3B46A88228F0F7D00A68EDD /* UIIMage.swift in Sources */, @@ -1425,6 +1429,7 @@ DD2E176E24A95BAC001AF94D /* RestoreExistingWalletUITest.swift in Sources */, DDB660F52486BABB0060B0C5 /* Decred_WalletUITests.swift in Sources */, DD2E177224A95CA4001AF94D /* SeedBackupUITest.swift in Sources */, + DDB7755C27962DAD00F437E7 /* StartScreenViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1443,6 +1448,7 @@ isa = PBXVariantGroup; children = ( B3B4699C228F0C2E00A68EDD /* Base */, + DDB775592796192E00F437E7 /* ar */, ); name = LaunchScreen.storyboard; sourceTree = ""; @@ -1458,6 +1464,7 @@ DDFB922722C8FF2D00F46FBE /* pt-BR */, DD36EE33247020C30011C335 /* pl */, 6091E9A8255000CE0028E67F /* fr */, + DDB7755A2796192E00F437E7 /* ar */, ); name = Localizable.strings; sourceTree = ""; diff --git a/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextField.swift b/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextField.swift index 98b940b5..5d46b002 100644 --- a/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextField.swift +++ b/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextField.swift @@ -17,7 +17,8 @@ class FloatingPlaceholderTextField: UITextField { return UIButton(type: .custom) }() - let textPadding = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 0) + var textPadding = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 0) + override var placeholder: String? { didSet { @@ -40,6 +41,12 @@ class FloatingPlaceholderTextField: UITextField { } private func initView() { + let attribute = self.semanticContentAttribute + let layoutDirection = UIView.userInterfaceLayoutDirection(for: attribute) + if layoutDirection == .rightToLeft { + textPadding = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 16) + self.textAlignment = .right + } self.layer.addSublayer(borderLayer) self.layer.masksToBounds = false @@ -84,7 +91,14 @@ class FloatingPlaceholderTextField: UITextField { func addTogglePasswordVisibilityButton() { self.pwdVisibilityToggleBtn.setImage(UIImage(named: "ic_reveal"), for: .normal) - self.pwdVisibilityToggleBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: -16, bottom: 0, right: 0) + let attribute = self.semanticContentAttribute + let layoutDirection = UIView.userInterfaceLayoutDirection(for: attribute) + if layoutDirection == .rightToLeft { + self.pwdVisibilityToggleBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -16) + } else { + self.pwdVisibilityToggleBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: -16, bottom: 0, right: 0) + } + self.pwdVisibilityToggleBtn.frame = CGRect(x: CGFloat(self.frame.size.width - 22), y: CGFloat(16), width: CGFloat(22), height: CGFloat(16)) self.rightView = self.pwdVisibilityToggleBtn self.rightViewMode = .always diff --git a/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextView.swift b/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextView.swift index f7919ebc..81694eaf 100644 --- a/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextView.swift +++ b/Decred Wallet/Custom Views/FloatingPlaceholderInputs/FloatingPlaceholderTextView.swift @@ -44,6 +44,14 @@ class FloatingPlaceholderTextView: UITextView { self.layer.addSublayer(borderLayer) self.layer.masksToBounds = false self.textContainerInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16) + let attribute = self.semanticContentAttribute + let layoutDirection = UIView.userInterfaceLayoutDirection(for: attribute) + if layoutDirection == .leftToRight { + self.textAlignment = .left + + } else { + self.textAlignment = .right + } self.addSubview(self.floatingPlaceholderLabel) } @@ -62,6 +70,15 @@ class FloatingPlaceholderTextView: UITextView { if let lastButton = self.subviews.last(where: { $0 is UIButton }) { trailingAnchor = lastButton.leadingAnchor trailingConstant = -16 + + } + + let attribute = self.semanticContentAttribute + let layoutDirection = UIView.userInterfaceLayoutDirection(for: attribute) + if layoutDirection == .leftToRight { + self.textContainerInset.right += button.frame.width + abs(trailingConstant) + } else { + self.textContainerInset.right += abs(trailingConstant) } self.addSubview(button) @@ -71,7 +88,6 @@ class FloatingPlaceholderTextView: UITextView { self.layoutIfNeeded() - self.textContainerInset.right += button.frame.width + abs(trailingConstant) } public func toggleButtonVisibility(_ button: UIButton) { diff --git a/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.swift b/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.swift index 3cdd10e1..73c1cf39 100644 --- a/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.swift +++ b/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.swift @@ -57,6 +57,12 @@ import Dcrlibwallet ]) self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.showAccountSelectorDialog))) + + let attribute = self.semanticContentAttribute + let layoutDirection = UIView.userInterfaceLayoutDirection(for: attribute) + if layoutDirection == .rightToLeft { + self.accountBalanceLabel.textAlignment = .left + } } @objc func showAccountSelectorDialog(_ sender: Any) { diff --git a/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.xib b/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.xib index 175c1d63..1d49915a 100644 --- a/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.xib +++ b/Decred Wallet/Custom Views/WalletAccountView/WalletAccountView.xib @@ -1,9 +1,9 @@ - + - + @@ -36,7 +36,7 @@ - + - + @@ -104,7 +104,7 @@ - + diff --git a/Decred Wallet/Features/App Launch/StartScreenViewController.swift b/Decred Wallet/Features/App Launch/StartScreenViewController.swift index b6e628e2..de3d02f0 100644 --- a/Decred Wallet/Features/App Launch/StartScreenViewController.swift +++ b/Decred Wallet/Features/App Launch/StartScreenViewController.swift @@ -62,6 +62,22 @@ class StartScreenViewController: UIViewController, CAAnimationDelegate { Utils.showBanner(in: self.view, type: .error, text: "init multiwallet error: \(initError!.localizedDescription)") } } + + let attribute = view.semanticContentAttribute + let layoutDirection = UIView.userInterfaceLayoutDirection(for: attribute) + if layoutDirection == .rightToLeft { + createWalletBtn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 32) + restoreWalletBtn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 32) + importWatchWalletBtn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 32) + + createWalletBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 16) + restoreWalletBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 16) + importWatchWalletBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 16) + + createWalletBtn.contentHorizontalAlignment = .right + importWatchWalletBtn.contentHorizontalAlignment = .right + restoreWalletBtn.contentHorizontalAlignment = .right + } if #available(iOS 13.0, *) { @@ -422,3 +438,23 @@ class StartScreenViewController: UIViewController, CAAnimationDelegate { } } } + +extension UIButton { + func setInsets( + forContentPadding contentPadding: UIEdgeInsets, + imageTitlePadding: CGFloat + ) { + self.contentEdgeInsets = UIEdgeInsets( + top: contentPadding.top, + left: contentPadding.left, + bottom: contentPadding.bottom, + right: contentPadding.right + imageTitlePadding + ) + self.titleEdgeInsets = UIEdgeInsets( + top: 0, + left: imageTitlePadding, + bottom: 0, + right: -imageTitlePadding + ) + } +} diff --git a/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.swift b/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.swift index 23b13046..9d573269 100644 --- a/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.swift +++ b/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.swift @@ -25,4 +25,14 @@ class AccountSelectorTableViewCell: UITableViewCell { self.totalAccountBalanceLabel.attributedText = Utils.getAttributedString(str: "\(totalBalanceRoundedOff)", siz: 15.0, TexthexColor: UIColor.appColors.text1) } } + + override func awakeFromNib() { + super.awakeFromNib() + let attribute = self.semanticContentAttribute + let layoutDirection = UIView.userInterfaceLayoutDirection(for: attribute) + if layoutDirection == .rightToLeft { + self.totalAccountBalanceLabel.textAlignment = .left + self.spendableAccountBalanceLabel.textAlignment = .left + } + } } diff --git a/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.xib b/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.xib index 0abfcb16..55691156 100644 --- a/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.xib +++ b/Decred Wallet/Features/Custom Dialogs/AccountSelectorDialog/AccountSelectorTableViewCell.xib @@ -1,9 +1,9 @@ - + - + @@ -26,25 +26,25 @@ diff --git a/Decred Wallet/Features/More/More Features/Help/Help.storyboard b/Decred Wallet/Features/More/More Features/Help/Help.storyboard index 0e98d5b4..130fcbfd 100644 --- a/Decred Wallet/Features/More/More Features/Help/Help.storyboard +++ b/Decred Wallet/Features/More/More Features/Help/Help.storyboard @@ -1,9 +1,9 @@ - + - + diff --git a/Decred Wallet/Features/More/More Features/Politeia/Politeia.storyboard b/Decred Wallet/Features/More/More Features/Politeia/Politeia.storyboard index b6c5bf30..00641d62 100644 --- a/Decred Wallet/Features/More/More Features/Politeia/Politeia.storyboard +++ b/Decred Wallet/Features/More/More Features/Politeia/Politeia.storyboard @@ -241,7 +241,7 @@ -