Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BP-243] WalletRename storyboard refactoring #200

Open
wants to merge 15 commits into
base: refactoring/BP-258-storyboards-layout
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions App/Modules/WalletRename/RenameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protocol RenameViewControllerDelegate:class {

class RenameViewController: BaseViewController {

@IBOutlet weak var nameWalletTF:UITextField!
@IBOutlet var nameLabel: UILabel!
@IBOutlet var nameWalletTF: UITextField!
@IBOutlet var saveBarButtonItem: UIBarButtonItem!

var selectedWalletName:String!
let service = HDWalletServiceImplementation()
Expand All @@ -34,17 +36,14 @@ class RenameViewController: BaseViewController {

override func viewDidLoad() {
super.viewDidLoad()
let rightBarButton = UIBarButtonItem(title: NSLocalizedString("Save", comment: ""), style: .plain, target: self, action: #selector(self.saveWalletName))
navigationItem.setRightBarButton(rightBarButton, animated: false)

title = LocalizedStrings.title
nameLabel.text = LocalizedStrings.nameLabelTitle
nameWalletTF.placeholder = LocalizedStrings.nameTextFieldPlaceholder
}

func addCancelButtonIfNeed() {
let cancel = UIButton(type: .system)
cancel.setTitle("Cancel", for: .normal)
cancel.setTitleColor(UIColor.mainColor, for: .normal)
cancel.titleLabel?.font = UIFont.systemFont(ofSize: 17)
cancel.addTarget(self, action: #selector(fadeOut), for: .touchUpInside)
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: cancel)
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(fadeOut))
}

@objc func fadeOut() {
Expand Down Expand Up @@ -95,3 +94,13 @@ class RenameViewController: BaseViewController {
}

}

private extension RenameViewController {

struct LocalizedStrings {
static let title = NSLocalizedString("Title", tableName: "WalletRename", comment: "")
static let nameLabelTitle = NSLocalizedString("WalletNameLabelTitle", tableName: "WalletRename", comment: "")
static let nameTextFieldPlaceholder = NSLocalizedString("WalletNameTextFieldPlaceholder", tableName: "WalletRename", comment: "")
}

}
68 changes: 38 additions & 30 deletions App/Modules/WalletRename/WalletRename.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -12,49 +13,56 @@
<!--Rename Wallet-->
<scene sceneID="ZPM-Ry-nW3">
<objects>
<viewController title="Rename Wallet" hidesBottomBarWhenPushed="YES" id="JYY-IY-B5W" customClass="RenameViewController" customModule="BankexWallet" customModuleProvider="target" sceneMemberID="viewController">
<viewController hidesBottomBarWhenPushed="YES" id="JYY-IY-B5W" customClass="RenameViewController" customModule="BankexWallet" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Z0m-Iv-3X2">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y9A-NY-hZ2">
<rect key="frame" x="19" y="68" width="54" height="24"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="20"/>
<color key="textColor" red="0.12549019607843137" green="0.13725490196078433" blue="0.14901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Wallet Name" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="YDQ-RL-4WJ">
<rect key="frame" x="19" y="102" width="356" height="26"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="ixS-CZ-Wfl"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TnT-FG-f0H">
<rect key="frame" x="19" y="128" width="356" height="1"/>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="DzA-Fq-8Sa">
<rect key="frame" x="16" y="48" width="343" height="53"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y9A-NY-hZ2">
<rect key="frame" x="0.0" y="0.0" width="343" height="24"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="20"/>
<color key="textColor" red="0.12549019607843137" green="0.13725490196078433" blue="0.14901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Wallet Name" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="YDQ-RL-4WJ">
<rect key="frame" x="0.0" y="32" width="343" height="21"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<view contentMode="scaleToFill" placeholderIntrinsicWidth="infinite" placeholderIntrinsicHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="efN-BQ-Dpo" customClass="SeparatorView" customModule="BankexWallet" customModuleProvider="target">
<rect key="frame" x="16" y="105" width="359" height="1"/>
<color key="backgroundColor" red="0.44313725490196076" green="0.50196078431372548" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="AUC-d6-9LT"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="zJa-dI-OZf" firstAttribute="trailing" secondItem="TnT-FG-f0H" secondAttribute="trailing" id="2ph-Cu-cGC"/>
<constraint firstItem="YDQ-RL-4WJ" firstAttribute="top" secondItem="Y9A-NY-hZ2" secondAttribute="bottom" constant="10" id="EN7-Ig-Tl2"/>
<constraint firstItem="Y9A-NY-hZ2" firstAttribute="top" secondItem="zJa-dI-OZf" secondAttribute="top" constant="48" id="Jh8-uT-D4j"/>
<constraint firstItem="YDQ-RL-4WJ" firstAttribute="leading" secondItem="Y9A-NY-hZ2" secondAttribute="leading" id="LZj-B3-RvV"/>
<constraint firstItem="zJa-dI-OZf" firstAttribute="trailing" secondItem="YDQ-RL-4WJ" secondAttribute="trailing" id="Mzp-r5-o5j"/>
<constraint firstItem="TnT-FG-f0H" firstAttribute="leading" secondItem="YDQ-RL-4WJ" secondAttribute="leading" id="UIP-Ng-aVt"/>
<constraint firstItem="Y9A-NY-hZ2" firstAttribute="leading" secondItem="zJa-dI-OZf" secondAttribute="leading" constant="19" id="kCC-cD-W6C"/>
<constraint firstItem="TnT-FG-f0H" firstAttribute="top" secondItem="YDQ-RL-4WJ" secondAttribute="bottom" id="l1Q-38-lS5"/>
<constraint firstItem="DzA-Fq-8Sa" firstAttribute="leading" secondItem="Z0m-Iv-3X2" secondAttribute="leadingMargin" id="7IX-F4-MvN"/>
<constraint firstItem="DzA-Fq-8Sa" firstAttribute="top" secondItem="Z0m-Iv-3X2" secondAttribute="topMargin" constant="48" id="Hac-67-Dx8"/>
<constraint firstItem="efN-BQ-Dpo" firstAttribute="top" secondItem="DzA-Fq-8Sa" secondAttribute="bottom" constant="4" id="IXI-2o-G3t"/>
<constraint firstAttribute="trailing" secondItem="efN-BQ-Dpo" secondAttribute="trailing" id="Koh-jz-jwk"/>
<constraint firstAttribute="trailingMargin" secondItem="DzA-Fq-8Sa" secondAttribute="trailing" id="VPB-fT-EVw"/>
<constraint firstItem="efN-BQ-Dpo" firstAttribute="leading" secondItem="DzA-Fq-8Sa" secondAttribute="leading" id="iul-2i-5oA"/>
</constraints>
<viewLayoutGuide key="safeArea" id="zJa-dI-OZf"/>
</view>
<navigationItem key="navigationItem" title="Rename Wallet" id="W7q-an-4Gu">
<barButtonItem key="rightBarButtonItem" style="plain" systemItem="save" id="IZA-wz-l9r">
<connections>
<action selector="saveWalletName" destination="JYY-IY-B5W" id="FAa-VP-xr1"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" translucent="NO" prompted="NO"/>
<connections>
<outlet property="nameLabel" destination="Y9A-NY-hZ2" id="WAJ-sM-Vl3"/>
<outlet property="nameWalletTF" destination="YDQ-RL-4WJ" id="AJt-98-pZ1"/>
<outlet property="saveBarButtonItem" destination="IZA-wz-l9r" id="b8k-Ey-kkU"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yTe-a6-2wn" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
12 changes: 12 additions & 0 deletions App/Modules/WalletRename/WalletRename.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
WalletRename.strings
BankexWallet

Created by Oleg Kolomyitsev on 10/01/2019.
Copyright © 2019 BANKEX Foundation. All rights reserved.
*/

"Title" = "Rename Wallet";
"WalletNameLabelTitle" = "Name";
"WalletNameTextFieldPlaceholder" = "Wallet Name";

4 changes: 4 additions & 0 deletions BankexWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
92BCEDEA21D0D805002264FE /* TransactionDetailsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92BCEDE921D0D805002264FE /* TransactionDetailsService.swift */; };
92BCEDEC21D0E23D002264FE /* TransactionDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92BCEDEB21D0E23D002264FE /* TransactionDetails.swift */; };
92DF231521D3D65C00AF00A0 /* SFSafariViewController+AssetManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92DF231421D3D65C00AF00A0 /* SFSafariViewController+AssetManagement.swift */; };
92E27B1321E7402B0033D214 /* WalletRename.strings in Resources */ = {isa = PBXBuildFile; fileRef = 92E27B1221E7402B0033D214 /* WalletRename.strings */; };
B81B598E56469045FD5A9424 /* Pods_BankexWalletUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 64A16C3A5FF4B56B886DA004 /* Pods_BankexWalletUITests.framework */; };
BC001E220296F73719F0697F /* Pods_Wallet_Widget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C33ADE69F5E6B37793B41AB /* Pods_Wallet_Widget.framework */; };
C7B75CCA6F60C9EB0D8D5C74 /* Pods_BankexWallet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D481374BDCC0F5EA10FEDC13 /* Pods_BankexWallet.framework */; };
Expand Down Expand Up @@ -580,6 +581,7 @@
92BCEDE921D0D805002264FE /* TransactionDetailsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionDetailsService.swift; sourceTree = "<group>"; };
92BCEDEB21D0E23D002264FE /* TransactionDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionDetails.swift; sourceTree = "<group>"; };
92DF231421D3D65C00AF00A0 /* SFSafariViewController+AssetManagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SFSafariViewController+AssetManagement.swift"; sourceTree = "<group>"; };
92E27B1221E7402B0033D214 /* WalletRename.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = WalletRename.strings; sourceTree = "<group>"; };
BD1E76CD13960E44B2411D0D /* Pods-BankexWalletUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BankexWalletUITests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-BankexWalletUITests/Pods-BankexWalletUITests.debug.xcconfig"; sourceTree = "<group>"; };
CD8DBF0DC86534920BCAE980 /* Pods-BankexWalletTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BankexWalletTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-BankexWalletTests/Pods-BankexWalletTests.release.xcconfig"; sourceTree = "<group>"; };
CE3C7F6D77310F0641F1B97E /* Pods-Wallet Widget.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Wallet Widget.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Wallet Widget/Pods-Wallet Widget.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1046,6 +1048,7 @@
isa = PBXGroup;
children = (
71EB27A421D4CBEF00B9EE30 /* WalletRename.storyboard */,
92E27B1221E7402B0033D214 /* WalletRename.strings */,
86BE227D2161895C00C1B18D /* RenameViewController.swift */,
);
path = WalletRename;
Expand Down Expand Up @@ -1861,6 +1864,7 @@
71155E7421B4F3F700ED7B4E /* AssetManagementEthFailure.xcassets in Resources */,
71EB27A821D5001B00B9EE30 /* NetworkAdd.storyboard in Resources */,
86D7FB8721495AA0008245DE /* PlaceholderCell.xib in Resources */,
92E27B1321E7402B0033D214 /* WalletRename.strings in Resources */,
7185063021E61A1B00CA204F /* TransactionProcessing.storyboard in Resources */,
714B5ADB21CBBBD400CA729A /* TransactionDetails.strings in Resources */,
71EB27B421D5FAB200B9EE30 /* ContactAdd.storyboard in Resources */,
Expand Down