Browse Source

developing to be visible for balance

pull/1/head
Jeongbae Kong 5 years ago
parent
commit
366e5172b1
  1. 24
      GME Remit/Modules/ManageAccountsModules/InboundAccounts/User Interface/View/InboundAccounts.storyboard
  2. 22
      GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/Presenter/PhoneCardRechargePresenter.swift
  3. 28
      GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardBankListCell.swift
  4. 26
      GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardRecharge.storyboard
  5. 48
      GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardRechargeViewController.swift

24
GME Remit/Modules/ManageAccountsModules/InboundAccounts/User Interface/View/InboundAccounts.storyboard

@ -32,7 +32,7 @@
<inset key="separatorInset" minX="5" minY="0.0" maxX="5" maxY="0.0"/> <inset key="separatorInset" minX="5" minY="0.0" maxX="5" maxY="0.0"/>
<color key="sectionIndexBackgroundColor" name="ThemeMainBackground"/> <color key="sectionIndexBackgroundColor" name="ThemeMainBackground"/>
<view key="tableFooterView" contentMode="scaleToFill" id="FKJ-fI-LmX"> <view key="tableFooterView" contentMode="scaleToFill" id="FKJ-fI-LmX">
<rect key="frame" x="0.0" y="152.5" width="355" height="70"/>
<rect key="frame" x="0.0" y="154" width="355" height="70"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pat-ec-i28"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pat-ec-i28">
@ -55,26 +55,26 @@
</view> </view>
<prototypes> <prototypes>
<tableViewCell opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="InboundAccountCell" id="AeP-ID-ahM" customClass="InboundAccountCell" customModule="GME_Remit" customModuleProvider="target"> <tableViewCell opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="InboundAccountCell" id="AeP-ID-ahM" customClass="InboundAccountCell" customModule="GME_Remit" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="355" height="96.5"/>
<rect key="frame" x="0.0" y="28" width="355" height="98"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="AeP-ID-ahM" id="b9x-HH-nRS"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="AeP-ID-ahM" id="b9x-HH-nRS">
<rect key="frame" x="0.0" y="0.0" width="355" height="96.5"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="98"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<view opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AWu-nl-Eel"> <view opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AWu-nl-Eel">
<rect key="frame" x="5" y="5" width="345" height="86.5"/>
<rect key="frame" x="5" y="5" width="345" height="88"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="ebc-B5-3Fg"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="ebc-B5-3Fg">
<rect key="frame" x="80" y="10" width="155" height="66.5"/>
<rect key="frame" x="80" y="10" width="151" height="68"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Standard Chartered Korea(SC First)" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="yXe-nl-aiX"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Standard Chartered Korea(SC First)" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="yXe-nl-aiX">
<rect key="frame" x="0.0" y="0.0" width="155" height="40.5"/>
<rect key="frame" x="0.0" y="0.0" width="151" height="41.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Bank Account" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="k0e-on-9Xi"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Bank Account" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="k0e-on-9Xi">
<rect key="frame" x="0.0" y="47.5" width="155" height="19"/>
<rect key="frame" x="0.0" y="48.5" width="151" height="19.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="16"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="16"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -82,7 +82,7 @@
</subviews> </subviews>
</stackView> </stackView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="sc" translatesAutoresizingMaskIntoConstraints="NO" id="DUf-vD-36D"> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="sc" translatesAutoresizingMaskIntoConstraints="NO" id="DUf-vD-36D">
<rect key="frame" x="20" y="31" width="40" height="25"/>
<rect key="frame" x="20" y="31.5" width="40" height="25"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="40" id="Heg-As-5wJ"/> <constraint firstAttribute="width" constant="40" id="Heg-As-5wJ"/>
@ -90,7 +90,7 @@
</constraints> </constraints>
</imageView> </imageView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="8by-vt-0xy"> <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="8by-vt-0xy">
<rect key="frame" x="275" y="28.5" width="65" height="30"/>
<rect key="frame" x="275" y="29" width="65" height="30"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nrY-wI-eQM"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nrY-wI-eQM">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/> <rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
@ -167,13 +167,13 @@
<rect key="frame" x="10" y="5" width="355" height="30"/> <rect key="frame" x="10" y="5" width="355" height="30"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aWf-wz-9Cf"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aWf-wz-9Cf">
<rect key="frame" x="0.0" y="0.0" width="228" height="30"/>
<rect key="frame" x="0.0" y="0.0" width="230" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="LmG-ZD-fLc"> <stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="LmG-ZD-fLc">
<rect key="frame" x="238" y="0.0" width="117" height="30"/>
<rect key="frame" x="240" y="0.0" width="115" height="30"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_warning" translatesAutoresizingMaskIntoConstraints="NO" id="HkK-bt-2he"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_warning" translatesAutoresizingMaskIntoConstraints="NO" id="HkK-bt-2he">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/> <rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
@ -184,7 +184,7 @@
</constraints> </constraints>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="254" text="Waiting verified" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UAc-fD-iht"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="254" text="Waiting verified" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UAc-fD-iht">
<rect key="frame" x="35" y="0.0" width="82" height="30"/>
<rect key="frame" x="35" y="0.0" width="80" height="30"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="12"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="12"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>

22
GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/Presenter/PhoneCardRechargePresenter.swift

@ -47,7 +47,7 @@ class PhoneCardRechargePresenter: ViewModelType {
let viewWillAppear: Driver<Void> let viewWillAppear: Driver<Void>
let selectAutodebit: Driver<Void> let selectAutodebit: Driver<Void>
let selectedIndex: Driver<Int> let selectedIndex: Driver<Int>
let showBalanceTrigger: Driver<Void>
let showBalanceTrigger: Driver<Account>
let availableBalance: Driver<String> let availableBalance: Driver<String>
let selectedMobile: Driver<String> let selectedMobile: Driver<String>
let contactOpenTap: Driver<Void> let contactOpenTap: Driver<Void>
@ -101,13 +101,14 @@ class PhoneCardRechargePresenter: ViewModelType {
}) })
.disposed(by: disposeBag) .disposed(by: disposeBag)
input.showBalanceTrigger.withLatestFrom(selectedPaymentMode.asDriverOnErrorJustComplete()) { $1 }
.drive(onNext: {
let fintechUseNumber = $0?.fintechUseNumber ?? ""
let type = $0?.type ?? "autodebit"
self.progressLinker.onNext(true)
self.interactor?.fetchBalanceForPowerCall(type: type, fintechUseNumber: fintechUseNumber)
}).disposed(by: disposeBag)
input.showBalanceTrigger
.drive(onNext: { [weak self] in
let fintechUseNumber = $0.fintechUseNumber ?? ""
let type = $0.type ?? "autodebit"
self?.progressLinker.onNext(true)
self?.interactor?.fetchBalanceForPowerCall(type: type, fintechUseNumber: fintechUseNumber)
})
.disposed(by: disposeBag)
input.selectAutodebit.drive(onNext: {[weak self] in input.selectAutodebit.drive(onNext: {[weak self] in
let model = try? self?.bankModel.value() let model = try? self?.bankModel.value()
@ -115,7 +116,8 @@ class PhoneCardRechargePresenter: ViewModelType {
}) })
.disposed(by: disposeBag) .disposed(by: disposeBag)
input.selectedIndex.withLatestFrom(bankModel.asDriverOnErrorJustComplete()) { (indexPath, bank) -> Account in
input.selectedIndex
.withLatestFrom(bankModel.asDriverOnErrorJustComplete()) { (indexPath, bank) -> Account in
return bank[indexPath] return bank[indexPath]
} }
.drive(onNext: {[weak self] in .drive(onNext: {[weak self] in
@ -144,7 +146,6 @@ class PhoneCardRechargePresenter: ViewModelType {
let isEnableNext = combinedInput let isEnableNext = combinedInput
.map { balance, _, type, priceModel, carrierPlan, dataOnlyType, selectedPaymentType, autoDebitBalance -> Status in .map { balance, _, type, priceModel, carrierPlan, dataOnlyType, selectedPaymentType, autoDebitBalance -> Status in
if selectedPaymentType?.type == "wallet" { if selectedPaymentType?.type == "wallet" {
switch type { switch type {
@ -332,7 +333,6 @@ extension PhoneCardRechargePresenter: PhoneCardRechargeInteractorOutput {
// MARK: PhoneCardRecharge wireframe output interface // MARK: PhoneCardRecharge wireframe output interface
extension PhoneCardRechargePresenter: PhoneCardRechargeWireframeOutput { extension PhoneCardRechargePresenter: PhoneCardRechargeWireframeOutput {
func setSelectedAccount(_ selectedAccount: Account) { func setSelectedAccount(_ selectedAccount: Account) {
getBalanceLinker.onNext(nil) getBalanceLinker.onNext(nil)
selectedPaymentMode.onNext(selectedAccount) selectedPaymentMode.onNext(selectedAccount)
} }

28
GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardBankListCell.swift

@ -22,9 +22,15 @@ enum BankType {
} }
} }
protocol PhoneCardBankListCellDelegate: class {
func showBalance(with model: Account?)
}
class PhoneCardBankListCell: UITableViewCell { class PhoneCardBankListCell: UITableViewCell {
// MARK : IBOUTLET
weak var delegate: PhoneCardBankListCellDelegate?
private var model: Account?
@IBOutlet weak var bankNameLabel: UILabel! @IBOutlet weak var bankNameLabel: UILabel!
@IBOutlet weak var showBalanceLabel: UILabel! @IBOutlet weak var showBalanceLabel: UILabel!
@IBOutlet weak var showBalanceButton: UIButton! @IBOutlet weak var showBalanceButton: UIButton!
@ -36,13 +42,18 @@ class PhoneCardBankListCell: UITableViewCell {
} }
func setModel(_ model: Account) { func setModel(_ model: Account) {
bankNameLabel.text = model.bankName
self.model = model
if model.type == "wallet" { if model.type == "wallet" {
bankNameLabel.text = model.bankName
showBalanceButton.isHidden = true showBalanceButton.isHidden = true
balanceStackView.isHidden = false balanceStackView.isHidden = false
showBalanceLabel.text = GMEDB.shared.user.string(.availableBalance) showBalanceLabel.text = GMEDB.shared.user.string(.availableBalance)
} else { } else {
guard let account = model.accountNumMasked else {
return self.bankNameLabel.text = model.bankName
}
bankNameLabel.text = "\(model.bankName ?? "") (\(account)) "
balanceStackView.isHidden = true balanceStackView.isHidden = true
showBalanceButton.isHidden = false showBalanceButton.isHidden = false
showBalanceButton.setTitle("account_balance_button_text".localized(), for: .normal) showBalanceButton.setTitle("account_balance_button_text".localized(), for: .normal)
@ -55,8 +66,19 @@ class PhoneCardBankListCell: UITableViewCell {
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
}
// Configure the view for the selected state
@IBAction func showBlanaceButton(_ sender: UIButton) {
delegate?.showBalance(with: model)
} }
}
extension PhoneCardBankListCell: showKFTCBalanceDelegate {
func KFTCBalanceShow(with balance: String) {
balanceStackView.isHidden = false
showBalanceButton.isHidden = true
showBalanceLabel.text = balance
}
} }

26
GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardRecharge.storyboard

@ -246,7 +246,7 @@
<color key="titleColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="titleColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state> </state>
<connections> <connections>
<action selector="checkBalanceButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="yb1-8X-A2U"/>
<action selector="showBlanaceButton:" destination="Hnk-Sj-SXn" eventType="touchUpInside" id="zb7-Hb-Vps"/>
</connections> </connections>
</button> </button>
</subviews> </subviews>
@ -569,7 +569,7 @@
<rect key="frame" x="0.0" y="0.0" width="305" height="25"/> <rect key="frame" x="0.0" y="0.0" width="305" height="25"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Cell Phone" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ATr-GR-fdE"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Cell Phone" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ATr-GR-fdE">
<rect key="frame" x="0.0" y="0.0" width="68" height="25"/>
<rect key="frame" x="0.0" y="0.0" width="63.666666666666664" height="25"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="25" id="DmQ-fW-QTA"/> <constraint firstAttribute="height" constant="25" id="DmQ-fW-QTA"/>
</constraints> </constraints>
@ -578,7 +578,7 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="01052850125" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="F3s-hq-mVr"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="01052850125" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="F3s-hq-mVr">
<rect key="frame" x="68" y="0.0" width="237" height="25"/>
<rect key="frame" x="63.666666666666671" y="0.0" width="241.33333333333331" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -589,13 +589,13 @@
<rect key="frame" x="0.0" y="29" width="305" height="25"/> <rect key="frame" x="0.0" y="29" width="305" height="25"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Charge Type" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="592-jP-xgS"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Charge Type" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="592-jP-xgS">
<rect key="frame" x="0.0" y="0.0" width="78.666666666666671" height="25"/>
<rect key="frame" x="0.0" y="0.0" width="74.333333333333329" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="mediaLog 11G(50,600)" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="CiS-wv-umW"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="mediaLog 11G(50,600)" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="CiS-wv-umW">
<rect key="frame" x="78.666666666666671" y="0.0" width="226.33333333333331" height="25"/>
<rect key="frame" x="74.333333333333329" y="0.0" width="230.66666666666669" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -606,13 +606,13 @@
<rect key="frame" x="0.0" y="58" width="305" height="25"/> <rect key="frame" x="0.0" y="58" width="305" height="25"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Data" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="798-HQ-YHW"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Data" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="798-HQ-YHW">
<rect key="frame" x="0.0" y="0.0" width="29.333333333333332" height="25"/>
<rect key="frame" x="0.0" y="0.0" width="27.666666666666668" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="11GB + 3M Unlimited" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="VyR-26-utb"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="11GB + 3M Unlimited" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="VyR-26-utb">
<rect key="frame" x="29.333333333333343" y="0.0" width="275.66666666666663" height="25"/>
<rect key="frame" x="27.666666666666657" y="0.0" width="277.33333333333337" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -623,13 +623,13 @@
<rect key="frame" x="0.0" y="87" width="305" height="25"/> <rect key="frame" x="0.0" y="87" width="305" height="25"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Voice" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P5S-MB-7Q1"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Voice" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P5S-MB-7Q1">
<rect key="frame" x="0.0" y="0.0" width="34" height="25"/>
<rect key="frame" x="0.0" y="0.0" width="33" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unlimited" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="EL5-jZ-vOn"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unlimited" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="EL5-jZ-vOn">
<rect key="frame" x="34" y="0.0" width="271" height="25"/>
<rect key="frame" x="33" y="0.0" width="272" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -640,13 +640,13 @@
<rect key="frame" x="0.0" y="116" width="305" height="25"/> <rect key="frame" x="0.0" y="116" width="305" height="25"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="SMS" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ozC-cy-dC6"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="SMS" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ozC-cy-dC6">
<rect key="frame" x="0.0" y="0.0" width="30.666666666666668" height="25"/>
<rect key="frame" x="0.0" y="0.0" width="26.666666666666668" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unlimited" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="OnW-ui-fSi"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unlimited" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="OnW-ui-fSi">
<rect key="frame" x="30.666666666666657" y="0.0" width="274.33333333333337" height="25"/>
<rect key="frame" x="26.666666666666657" y="0.0" width="278.33333333333337" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -659,13 +659,13 @@
<rect key="frame" x="0.0" y="145" width="305" height="25"/> <rect key="frame" x="0.0" y="145" width="305" height="25"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Payment Amount" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wtY-Oq-MdK"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Payment Amount" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wtY-Oq-MdK">
<rect key="frame" x="0.0" y="0.0" width="108.33333333333333" height="25"/>
<rect key="frame" x="0.0" y="0.0" width="106" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeRed"/> <color key="textColor" name="ThemeRed"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="₩ 50,100" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="XLT-1R-BKf"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="₩ 50,100" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="XLT-1R-BKf">
<rect key="frame" x="108.33333333333336" y="0.0" width="196.66666666666663" height="25"/>
<rect key="frame" x="106" y="0.0" width="199" height="25"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeRed"/> <color key="textColor" name="ThemeRed"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>

48
GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardRechargeViewController.swift

@ -12,6 +12,10 @@ import RxCocoa
import ContactsUI import ContactsUI
protocol showKFTCBalanceDelegate: class {
func KFTCBalanceShow(with balance: String)
}
class PhoneCardRechargeViewController: UIViewController { class PhoneCardRechargeViewController: UIViewController {
// MARK: Properties // MARK: Properties
@ -22,7 +26,12 @@ class PhoneCardRechargeViewController: UIViewController {
private let availableBalance = PublishSubject<String>() private let availableBalance = PublishSubject<String>()
private let selectedMobile = PublishSubject<String>() private let selectedMobile = PublishSubject<String>()
private let selectPaymentType = PublishSubject<Void>() private let selectPaymentType = PublishSubject<Void>()
private let balanceShow = PublishSubject<Account>()
private var amountButtons = [UIButton]() private var amountButtons = [UIButton]()
weak var balanceDelegate: showKFTCBalanceDelegate?
private var showKFTCBalance: String?
// MARK: Computed Properties // MARK: Computed Properties
// MARK: IBOutlets // MARK: IBOutlets
@ -116,7 +125,6 @@ class PhoneCardRechargeViewController: UIViewController {
@IBAction func checkBalanceButton(_ sender: UIButton) { @IBAction func checkBalanceButton(_ sender: UIButton) {
} }
} }
// MARK: Other Functions // MARK: Other Functions
@ -207,7 +215,7 @@ extension PhoneCardRechargeViewController {
viewWillAppear: viewWillAppear, viewWillAppear: viewWillAppear,
selectAutodebit: selectPaymentType.asDriverOnErrorJustComplete(), selectAutodebit: selectPaymentType.asDriverOnErrorJustComplete(),
selectedIndex: tableView.rx.itemSelected.map {$0.row}.asDriverOnErrorJustComplete(), selectedIndex: tableView.rx.itemSelected.map {$0.row}.asDriverOnErrorJustComplete(),
showBalanceTrigger: balanceCheckButton.rx.tap.asDriver(),
showBalanceTrigger: balanceShow.asDriverOnErrorJustComplete(),
availableBalance: availableBalance.asDriverOnErrorJustComplete(), availableBalance: availableBalance.asDriverOnErrorJustComplete(),
selectedMobile: selectedMobile.asDriverOnErrorJustComplete(), selectedMobile: selectedMobile.asDriverOnErrorJustComplete(),
contactOpenTap: contactButton.rx.tap.asDriverOnErrorJustComplete(), contactOpenTap: contactButton.rx.tap.asDriverOnErrorJustComplete(),
@ -242,10 +250,8 @@ extension PhoneCardRechargeViewController {
output.getBalance.map { $0?.balance?.decimalToCurrency() } output.getBalance.map { $0?.balance?.decimalToCurrency() }
.drive(onNext: { [weak self] in .drive(onNext: { [weak self] in
guard let balance = $0 else { return } guard let balance = $0 else { return }
self?.balanceStackView.isHidden = false
self?.balanceCheckButton.isHidden = true
self?.mycashAmountLabel.text = balance
self?.showKFTCBalance = balance
self?.balanceDelegate?.KFTCBalanceShow(with: balance)
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
output.isProgress output.isProgress
@ -300,14 +306,35 @@ extension PhoneCardRechargeViewController {
} }
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
let items = Observable.just(output.getBalance.asObservable())
// let items = Observable.just([
// 1,
// 2,
// 3
// ])
items
.bind(to: tableView.rx.items(cellIdentifier: "PhoneCardBankListCell", cellType: PhoneCardBankListCell.self)) { (_, _, cell) in
cell.balanceStackView.isHidden = false
cell.showBalanceButton.isHidden = true
}
.disposed(by: disposeBag)
// items.bind(to: tableView.rx.items(cellIdentifier: "PhoneCardBankListCell", cellType: UITableViewCell.self)) { (_, _, cell: PhoneCardBankListCell) in
// cell.balanceStackView.isHidden = false
// cell.showBalanceButton.isHidden = true
// }
// .disposed(by: disposeBag)
output output
.bankModel.drive( .bankModel.drive(
tableView.rx.items(cellIdentifier: "PhoneCardBankListCell") tableView.rx.items(cellIdentifier: "PhoneCardBankListCell")
) { (_, element: Account, cell: PhoneCardBankListCell) in ) { (_, element: Account, cell: PhoneCardBankListCell) in
cell.delegate = self
cell.setModel(element) cell.setModel(element)
} }
.disposed(by: disposeBag) .disposed(by: disposeBag)
// output // output
// .selectedPaymentMode.drive( // .selectedPaymentMode.drive(
// tableView.rx.items(cellIdentifier: "PhoneCardBankListCell") // tableView.rx.items(cellIdentifier: "PhoneCardBankListCell")
@ -512,3 +539,10 @@ extension PhoneCardRechargeViewController: CNContactPickerDelegate {
selectedMobile.onNext(selectedContact?.extract(regex: "[0-9]") ?? "") selectedMobile.onNext(selectedContact?.extract(regex: "[0-9]") ?? "")
} }
} }
extension PhoneCardRechargeViewController: PhoneCardBankListCellDelegate {
func showBalance(with model: Account?) {
guard let model = model else { return }
balanceShow.onNext(model)
}
}
Loading…
Cancel
Save