Skip to content

Commit

Permalink
Merge pull request #167 from colcalex/develop
Browse files Browse the repository at this point in the history
Login Button fixes
  • Loading branch information
CristiHabliuc authored Nov 20, 2019
2 parents fddb056 + 9382979 commit d21522c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions MonitorizareVot/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Created by Code4Romania

"Button_Login" = "Login";
"Button_Continue" = "Continue";
"Button_ChangeDepartemnt" = "Change";
"Button_Urban" = "Urban";
Expand Down
1 change: 1 addition & 0 deletions MonitorizareVot/Login/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class LoginViewController: MVViewController {

fileprivate func updateLoginButtonState() {
loginButton.isEnabled = model.isReady
loginButton.setTitle(model.buttonTitle, for: .normal)
}

fileprivate func updateInterface() {
Expand Down
8 changes: 4 additions & 4 deletions MonitorizareVot/Login/LoginViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JtC-yb-2FH">
<rect key="frame" x="0.0" y="167" width="350" height="52"/>
<subviews>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="K5b-wi-jhG">
<rect key="frame" x="165" y="20" width="20" height="20"/>
<color key="color" red="0.94509803920000002" green="0.58823529409999997" blue="0.23137254900000001" alpha="1" colorSpace="calibratedRGB"/>
</activityIndicatorView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QbI-GJ-iXY" customClass="ActionButton" customModule="MonitorizareVot" customModuleProvider="target">
<rect key="frame" x="0.0" y="8" width="350" height="44"/>
<constraints>
Expand All @@ -150,10 +154,6 @@
<action selector="handleLoginButtonTap:" destination="-1" eventType="touchUpInside" id="urU-Us-quk"/>
</connections>
</button>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="K5b-wi-jhG">
<rect key="frame" x="165" y="20" width="20" height="20"/>
<color key="color" red="0.94509803920000002" green="0.58823529409999997" blue="0.23137254900000001" alpha="1" colorSpace="calibratedRGB"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
Expand Down
7 changes: 6 additions & 1 deletion MonitorizareVot/Login/LoginViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@ class LoginViewModel: NSObject {
guard let phoneNumber = phoneNumber,
let code = code,
phoneNumber.count > 5,
code.count > 3 else {
code.count > 3,
!isLoading else {
return false
}
return true
}

var buttonTitle: String {
isLoading ? "" : "Button_Login".localized
}

override init() {
super.init()
#if DEBUG
Expand Down
1 change: 1 addition & 0 deletions MonitorizareVot/ro.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Created by Code4Romania

"Button_Login" = "Login";
"Button_Continue" = "Continuă";
"Button_ChangeDepartemnt" = "Schimbă";
"Button_Urban" = "Urban";
Expand Down

0 comments on commit d21522c

Please sign in to comment.