Browse Source

timer added

pull/1/head
gme_2 6 years ago
parent
commit
44c5654779
  1. 8
      GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift
  2. 11
      GMERemittance/Module/SendMoneyCode/User Interface/View/SendMoneyCode.storyboard
  3. 33
      GMERemittance/Module/SendMoneyCode/User Interface/View/SendMoneyCodeViewController.swift
  4. 18
      GMERemittance/Recipient/RecipientListViewController.swift
  5. 4
      GMERemittance/UrlManager.swift
  6. 2
      en.lproj/Localizable.strings

8
GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift

@ -214,10 +214,10 @@ class SendMoneyVerificationViewController: UITableViewController {
func askPassword() {
if (self.requestModel?.autoDebitAccount?.type ?? "").lowercased() == "wallet" {
showQwertyTranskeyAction()
return
}
// if (self.requestModel?.autoDebitAccount?.type ?? "").lowercased() == "wallet" {
// showQwertyTranskeyAction()
// return
// }
SendMoneyCodeWireframe().open(completion: self.otpEntered, source: self)
}

11
GMERemittance/Module/SendMoneyCode/User Interface/View/SendMoneyCode.storyboard

@ -116,15 +116,16 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="jkc-rY-cKa">
<rect key="frame" x="140" y="293" width="75" height="14.5"/>
<rect key="frame" x="130.5" y="293" width="94" height="14.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Retry in :" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iIg-Bj-Ocp">
<rect key="frame" x="0.0" y="0.0" width="45" height="14.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Try again in :" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iIg-Bj-Ocp">
<rect key="frame" x="0.0" y="0.0" width="64" height="14.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="12"/>
<color key="textColor" red="0.29019607843137252" green="0.29019607843137252" blue="0.29019607843137252" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jc2-Jf-Akf">
<rect key="frame" x="47" y="0.0" width="28" height="14.5"/>
<rect key="frame" x="66" y="0.0" width="28" height="14.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="12"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -198,6 +199,8 @@
<connections>
<outlet property="backGourndBorderView" destination="glg-iv-MSv" id="97Q-nt-38d"/>
<outlet property="counterLabel" destination="jc2-Jf-Akf" id="tUV-83-8Vz"/>
<outlet property="counterStackView" destination="jkc-rY-cKa" id="UZi-kX-ejb"/>
<outlet property="counterTitleLabel" destination="iIg-Bj-Ocp" id="Vop-tp-93a"/>
<outlet property="notNowButton" destination="Enm-wU-bXW" id="hYJ-qF-KHh"/>
<outlet property="resendButton" destination="mpj-Sq-1Kl" id="KXL-tz-y3J"/>
<outlet property="submitButton" destination="ibk-1l-bfT" id="3lA-I7-Qej"/>

33
GMERemittance/Module/SendMoneyCode/User Interface/View/SendMoneyCodeViewController.swift

@ -21,21 +21,33 @@ class SendMoneyCodeViewController: UIViewController {
@IBOutlet weak var submitButton: UIButton!
@IBOutlet weak var notNowButton: UIButton!
@IBOutlet weak var counterLabel: UILabel!
@IBOutlet weak var counterTitleLabel: UILabel!
@IBOutlet weak var counterStackView: UIStackView!
@IBOutlet weak var backGourndBorderView: UIView!
var timer: Timer?
var count: Int = 0 {
let expiryTime = 120 // second
var count: Int = 120 {
didSet {
let remainingTime = 120 - count
if ( remainingTime <= 0) {
count = 0 // two minutes passed
if ( count <= 0) {
count = expiryTime // two minutes passed
self.timer?.invalidate()
self.resendButton.isHidden = false
self.resendButton.isUserInteractionEnabled = true
self.counterStackView.isHidden = true
} else {
let result = count.quotientAndRemainder(dividingBy: 60)
self.counterLabel.text = "\(2 - result.quotient): \(60 - result.remainder)"
let result = count.quotientAndRemainder(dividingBy: 60)
self.counterLabel.text = "\(result.quotient): \(result.remainder)"
// if (result.quotient == 1 || result.remainder == 60 ) {
// self.counterLabel.text = "\(1): \(59)"
// }else {
// self.counterLabel.text = "\(2 - result.quotient): \(60 - result.remainder)"
// }
}
@ -148,6 +160,8 @@ class SendMoneyCodeViewController: UIViewController {
self.resendButton.setTitle("resend_text".localized(), for: UIControlState.normal)
self.submitButton.setTitle("submit_text".localized(), for: UIControlState.normal)
self.notNowButton.setTitle("not_now_text".localized(), for: UIControlState.normal)
self.counterTitleLabel.text = "resend_code_text".localized()
}
@IBAction func viewSample(_ sender: Any) {
@ -189,7 +203,6 @@ class SendMoneyCodeViewController: UIViewController {
self.requestOtp(customerId: customerId, success: { (message) in
self.hideProgressHud()
self.startTimer()
self.resendButton.isHidden = true
}) { (error) in
self.hideProgressHud()
self.alert(message: error.localizedDescription)
@ -199,10 +212,12 @@ class SendMoneyCodeViewController: UIViewController {
private func startTimer() {
self.timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.updateCounter), userInfo: nil, repeats: true)
self.timer?.fire()
self.resendButton.isUserInteractionEnabled = false
self.counterStackView.isHidden = false
}
@objc func updateCounter() {
self.count += 1
self.count -= 1
}
private func requestOtpCodeRetryCount() {

18
GMERemittance/Recipient/RecipientListViewController.swift

@ -142,19 +142,19 @@ extension RecipientListViewController: UITableViewDelegate,UITableViewDataSource
// TODO:- for kftc enable this in next release
self.showMethodSelection(for: index)
// self.showMethodSelection(for: index)
// remove this
// if let navigation = self.navigationController {
// if let reciepient = self.reciepients?.elementAt(index: index) {
// let wireframe = SendMoneyParentWireframe()
// let acunt = Account()
// acunt.type = "wallet"
// wireframe.open(for: reciepient, with: acunt, in: navigation)
// }
// }
if let navigation = self.navigationController {
if let reciepient = self.reciepients?.elementAt(index: index) {
let wireframe = SendMoneyParentWireframe()
let acunt = Account()
acunt.type = "wallet"
wireframe.open(for: reciepient, with: acunt, in: navigation)
}
}
}

4
GMERemittance/UrlManager.swift

@ -28,15 +28,15 @@ class UrlManager {
let oldLiveServerUrl = "https://mobileapi.gmeremit.com:8002/api/v1/"
// let oldUatServer = "http://gmeuat.gmeremit.com:5012/api/v1/"
let oldUatServer = "http://gmeuat.gmeremit.com:5029/api/v1/"
let oldUatServer = "http://gmeuat.gmeremit.com:5012/api/v1/"
// this is the new url without mentioning of version
let staggingServerUrl = "http://gmeuat.gmeremit.com:5022/api/"
let liveServerUrl = "https://mobileapi.gmeremit.com:8002/api/"
// let uatServer = "http://gmeuat.gmeremit.com:5012/api/"
let uatServer = "http://gmeuat.gmeremit.com:5012/api/"
init() {
switch server {
case .uat:

2
en.lproj/Localizable.strings

@ -394,7 +394,7 @@
"otp_empty_error" = "OTP code cannot be empty";
"requesting_otp_text" = "Requesting OTP";
"resend_code_text" = "Try again in";
Loading…
Cancel
Save