Disable Feedbin add account button until fields are filled
This commit is contained in:
parent
1cefea6f29
commit
baa9070016
@ -36,6 +36,9 @@ class FeedbinAccountViewController: UITableViewController {
|
|||||||
} else {
|
} else {
|
||||||
actionButton.setTitle(NSLocalizedString("Add Account", comment: "Update Credentials"), for: .normal)
|
actionButton.setTitle(NSLocalizedString("Add Account", comment: "Update Credentials"), for: .normal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: emailTextField)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: passwordTextField)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func cancel(_ sender: Any) {
|
@IBAction func cancel(_ sender: Any) {
|
||||||
@ -113,6 +116,10 @@ class FeedbinAccountViewController: UITableViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func textDidChange(_ note: Notification) {
|
||||||
|
actionButton.isEnabled = !(emailTextField.text?.isEmpty ?? false) && !(passwordTextField.text?.isEmpty ?? false)
|
||||||
|
}
|
||||||
|
|
||||||
private func showError(_ message: String) {
|
private func showError(_ message: String) {
|
||||||
presentError(title: "Error", message: message)
|
presentError(title: "Error", message: message)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15508"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15508"/>
|
||||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
@ -440,15 +439,13 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7ZV-Eg-jhP" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7ZV-Eg-jhP" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="44" id="RBi-fn-0o2"/>
|
<constraint firstAttribute="height" constant="44" id="RBi-fn-0o2"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<state key="normal" title="Credentials">
|
<state key="normal" title="Credentials"/>
|
||||||
<color key="titleColor" name="primaryAccentColor"/>
|
|
||||||
</state>
|
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="credentials:" destination="SLc-SS-bhp" eventType="touchUpInside" id="aJb-x2-Pno"/>
|
<action selector="credentials:" destination="SLc-SS-bhp" eventType="touchUpInside" id="aJb-x2-Pno"/>
|
||||||
</connections>
|
</connections>
|
||||||
@ -473,7 +470,7 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uBW-xT-sbZ" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uBW-xT-sbZ" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="44" id="DTB-y7-Fwx"/>
|
<constraint firstAttribute="height" constant="44" id="DTB-y7-Fwx"/>
|
||||||
@ -679,15 +676,13 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vhl-Lu-KFz" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vhl-Lu-KFz" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="44" id="7iW-YA-9eK"/>
|
<constraint firstAttribute="height" constant="44" id="7iW-YA-9eK"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<state key="normal" title="Add Account">
|
<state key="normal" title="Add Account"/>
|
||||||
<color key="titleColor" name="primaryAccentColor"/>
|
|
||||||
</state>
|
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="add:" destination="Tgu-u6-glx" eventType="touchUpInside" id="zO2-qG-v34"/>
|
<action selector="add:" destination="Tgu-u6-glx" eventType="touchUpInside" id="zO2-qG-v34"/>
|
||||||
</connections>
|
</connections>
|
||||||
@ -789,22 +784,20 @@
|
|||||||
</tableViewSection>
|
</tableViewSection>
|
||||||
<tableViewSection id="oez-j7-Bnb">
|
<tableViewSection id="oez-j7-Bnb">
|
||||||
<cells>
|
<cells>
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="TdT-na-AmS" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="TdT-na-AmS">
|
||||||
<rect key="frame" x="0.0" y="141" width="414" height="43.5"/>
|
<rect key="frame" x="0.0" y="141" width="414" height="43.5"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TdT-na-AmS" id="LVF-fO-2pw">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TdT-na-AmS" id="LVF-fO-2pw">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ohs-Iz-tfT" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ohs-Iz-tfT" customClass="VibrantButton" customModule="NetNewsWire" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="44" id="Nt4-lI-hkF"/>
|
<constraint firstAttribute="height" constant="44" id="Nt4-lI-hkF"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<state key="normal" title="Action">
|
<state key="normal" title="Action"/>
|
||||||
<color key="titleColor" name="primaryAccentColor"/>
|
|
||||||
</state>
|
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="action:" destination="PrL-bD-PFa" eventType="touchUpInside" id="AmE-ou-ltA"/>
|
<action selector="action:" destination="PrL-bD-PFa" eventType="touchUpInside" id="AmE-ou-ltA"/>
|
||||||
</connections>
|
</connections>
|
||||||
@ -1089,8 +1082,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<image name="accountFeedbin" width="120" height="102"/>
|
<image name="accountFeedbin" width="120" height="102"/>
|
||||||
<image name="accountLocal" width="78" height="98"/>
|
<image name="accountLocal" width="78" height="98"/>
|
||||||
<namedColor name="primaryAccentColor">
|
|
||||||
<color red="0.031372549019607843" green="0.41568627450980394" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
||||||
</namedColor>
|
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
@ -26,6 +26,7 @@ class VibrantButton: UIButton {
|
|||||||
override var isHighlighted: Bool {
|
override var isHighlighted: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
backgroundColor = isHighlighted ? AppAssets.secondaryAccentColor : nil
|
backgroundColor = isHighlighted ? AppAssets.secondaryAccentColor : nil
|
||||||
|
titleLabel?.alpha = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user