Browse Source

done implementing/ need to fix some UI

pull/1/head
Jeongbae Kong 5 years ago
parent
commit
ff96781ea1
  1. 12
      GME Remit.xcodeproj/project.pbxproj
  2. 2
      GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardRechargeViewController.swift
  3. 48
      GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/Cell/DomesticBankListTableViewCell.swift
  4. 102
      GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/DomesticRemit.storyboard
  5. 14
      GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/DomesticRemitViewController.swift
  6. 18
      GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/ViewModel/DomesticRemitViewModel.swift

12
GME Remit.xcodeproj/project.pbxproj

@ -616,6 +616,7 @@
73FE8846228A58DE00A5EB56 /* OrderContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73FE8845228A58DE00A5EB56 /* OrderContainer.swift */; };
73FE8848228A595500A5EB56 /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73FE8847228A595500A5EB56 /* Order.swift */; };
89493C13242057E20066567F /* PhoneCardBankListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89493C12242057E20066567F /* PhoneCardBankListCell.swift */; };
894B61E62424A8F9004A463D /* DomesticBankListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894B61E52424A8F9004A463D /* DomesticBankListTableViewCell.swift */; };
917C3001C903ECEF46A5D6D0 /* Pods_GMERemittanceUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4028C5A57499BB54764190C /* Pods_GMERemittanceUITests.framework */; };
9F983C0C2024883D001DCB3F /* UIColor+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F983C0B2024883D001DCB3F /* UIColor+Ext.swift */; };
9FA00FBE1FEE69AF0049753E /* UIView+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA00FBD1FEE69AF0049753E /* UIView+Ext.swift */; };
@ -3058,6 +3059,7 @@
73FE8847228A595500A5EB56 /* Order.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Order.swift; sourceTree = "<group>"; };
745256B2A0B78E97CD1E1E4C /* Pods-GMERemittanceTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GMERemittanceTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-GMERemittanceTests/Pods-GMERemittanceTests.release.xcconfig"; sourceTree = "<group>"; };
89493C12242057E20066567F /* PhoneCardBankListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneCardBankListCell.swift; sourceTree = "<group>"; };
894B61E52424A8F9004A463D /* DomesticBankListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DomesticBankListTableViewCell.swift; sourceTree = "<group>"; };
9F983C0B2024883D001DCB3F /* UIColor+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Ext.swift"; sourceTree = "<group>"; };
9FA00FBD1FEE69AF0049753E /* UIView+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Ext.swift"; sourceTree = "<group>"; };
9FB54C10200879B9003454E2 /* Profile.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Profile.storyboard; sourceTree = "<group>"; };
@ -8059,6 +8061,7 @@
73A621322330742C000FFB5B /* View */ = {
isa = PBXGroup;
children = (
894B61E42424A8E0004A463D /* Cell */,
73A621332330742C000FFB5B /* ViewModel */,
73A621362330742C000FFB5B /* DomesticRemitViewController.swift */,
73A621372330742C000FFB5B /* DomesticRemit.storyboard */,
@ -9130,6 +9133,14 @@
path = Cell;
sourceTree = "<group>";
};
894B61E42424A8E0004A463D /* Cell */ = {
isa = PBXGroup;
children = (
894B61E52424A8F9004A463D /* DomesticBankListTableViewCell.swift */,
);
path = Cell;
sourceTree = "<group>";
};
9F3ADCE62004B80F0037A3A3 /* Profile */ = {
isa = PBXGroup;
children = (
@ -16157,6 +16168,7 @@
73469F992293C1B00062946B /* SelectPaymentServiceType.swift in Sources */,
73EC6C12236984B200060448 /* InternationalTopupService.swift in Sources */,
73469F9D2293C1B00062946B /* SelectPaymentPresenter.swift in Sources */,
894B61E62424A8F9004A463D /* DomesticBankListTableViewCell.swift in Sources */,
7327568323B0456400BF66C5 /* ManageAgreementPresenter.swift in Sources */,
739A7784228BB2B40018A1A9 /* DetailOrderInteractor.swift in Sources */,
736A8C452277EB2A00337A50 /* BiometricNotificationPresenter.swift in Sources */,

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

@ -119,8 +119,6 @@ class PhoneCardRechargeViewController: UIViewController {
super.viewWillAppear(animated)
setupNormalNavigation()
self.title = "local_top_up_text".localized()
// tableView.frame = CGRect(x: tableView.frame.origin.x, y: tableView.frame.origin.y, width: tableView.frame.size.width, height: tableView.size.height+)
}
override func viewDidAppear(_ animated: Bool) {

48
GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/Cell/DomesticBankListTableViewCell.swift

@ -0,0 +1,48 @@
//
// DomesticBankListTableViewCell.swift
// GME Remit
//
// Created by Jeongbae Kong on 2020/03/20.
// Copyright © 2020 Gobal Money Express Co. Ltd. All rights reserved.
//
import UIKit
class DomesticBankListTableViewCell: UITableViewCell {
@IBOutlet private weak var bankNameLabel: UILabel!
@IBOutlet private weak var checkMarkImageView: UIImageView!
@IBOutlet private weak var domesticBankListBackgroundView: UIView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
func setModel(_ model: Account) {
checkMarkImageView.isHidden = true
if model.type == "wallet" {
bankNameLabel.text = model.bankName
} else {
guard let account = model.accountNumMasked else {
return bankNameLabel.text = model.bankName
}
bankNameLabel.text = "\(model.bankName ?? "") \(account)"
}
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
if selected {
domesticBankListBackgroundView.layer.borderWidth = 1
domesticBankListBackgroundView.layer.borderColor = UIColor.themeRed.cgColor
checkMarkImageView.isHidden = false
} else {
domesticBankListBackgroundView.layer.borderColor = UIColor.clear.cgColor
checkMarkImageView.isHidden = true
}
}
}

102
GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/DomesticRemit.storyboard

@ -32,16 +32,85 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="730"/>
<subviews>
<view contentMode="scaleToFill" placeholderIntrinsicWidth="375" placeholderIntrinsicHeight="575" translatesAutoresizingMaskIntoConstraints="NO" id="att-q4-f6H">
<rect key="frame" x="0.0" y="0.0" width="375" height="717"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="833"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0TS-Id-072">
<rect key="frame" x="0.0" y="0.0" width="375" height="170.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="286.5"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="NIp-JO-z9g">
<rect key="frame" x="20" y="5" width="335" height="145.5"/>
<rect key="frame" x="20" y="5" width="335" height="261.5"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gPj-g8-2ov">
<rect key="frame" x="0.0" y="0.0" width="335" height="50"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tto-Ts-aSB">
<rect key="frame" x="0.0" y="0.0" width="335" height="166"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="A9a-kE-Ego">
<rect key="frame" x="0.0" y="0.0" width="335" height="166"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="166" id="9w6-VG-gnf"/>
<constraint firstAttribute="width" constant="335" id="SuM-YR-K6X"/>
</constraints>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="DomesticBankListTableViewCell" rowHeight="121" id="kvD-Ar-usv" customClass="DomesticBankListTableViewCell" customModule="GME_Remit" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="335" height="121"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="kvD-Ar-usv" id="hXB-wm-lJm">
<rect key="frame" x="0.0" y="0.0" width="335" height="121"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="14" translatesAutoresizingMaskIntoConstraints="NO" id="iGn-dQ-f23">
<rect key="frame" x="25" y="14" width="285" height="93"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="orK-1d-Iaq">
<rect key="frame" x="0.0" y="0.0" width="285" height="93"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PaymentType" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3un-2Z-cuW">
<rect key="frame" x="0.0" y="0.0" width="263" height="93"/>
<gestureRecognizers/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="right" translatesAutoresizingMaskIntoConstraints="NO" id="tjJ-CO-e1w">
<rect key="frame" x="263" y="0.0" width="22" height="93"/>
<constraints>
<constraint firstAttribute="width" constant="22" id="y9B-yD-eil"/>
</constraints>
</imageView>
</subviews>
<gestureRecognizers/>
</stackView>
</subviews>
<gestureRecognizers/>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="iGn-dQ-f23" secondAttribute="bottom" constant="3" id="4UM-xu-xdV"/>
<constraint firstItem="iGn-dQ-f23" firstAttribute="leading" secondItem="hXB-wm-lJm" secondAttribute="leadingMargin" constant="10" id="MC8-WJ-v4a"/>
<constraint firstItem="iGn-dQ-f23" firstAttribute="top" secondItem="hXB-wm-lJm" secondAttribute="topMargin" constant="3" id="MCd-qc-HN2"/>
<constraint firstAttribute="trailingMargin" secondItem="iGn-dQ-f23" secondAttribute="trailing" constant="10" id="g2H-eo-WhT"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" name="ThemeWhite"/>
<connections>
<outlet property="bankNameLabel" destination="3un-2Z-cuW" id="C4U-t9-u02"/>
<outlet property="checkMarkImageView" destination="tjJ-CO-e1w" id="jR4-5q-abN"/>
<outlet property="domesticBankListBackgroundView" destination="hXB-wm-lJm" id="3RQ-c6-DME"/>
</connections>
</tableViewCell>
</prototypes>
</tableView>
</subviews>
<color key="backgroundColor" name="ThemeWhite"/>
<constraints>
<constraint firstItem="A9a-kE-Ego" firstAttribute="leading" secondItem="Tto-Ts-aSB" secondAttribute="leading" id="1aw-Az-QUp"/>
<constraint firstItem="A9a-kE-Ego" firstAttribute="top" secondItem="Tto-Ts-aSB" secondAttribute="top" id="F21-j7-8eJ"/>
<constraint firstAttribute="bottom" secondItem="A9a-kE-Ego" secondAttribute="bottom" id="Vjr-Sh-FXO"/>
<constraint firstAttribute="trailing" secondItem="A9a-kE-Ego" secondAttribute="trailing" id="mUC-rI-JQk"/>
</constraints>
</view>
<stackView hidden="YES" opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gPj-g8-2ov">
<rect key="frame" x="0.0" y="173.5" width="335" height="50"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="YRe-d3-yhC" customClass="ValidationTextField" customModule="GME_Remit" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="305" height="50"/>
@ -85,7 +154,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="KCg-go-VB8">
<rect key="frame" x="0.0" y="65" width="335" height="80.5"/>
<rect key="frame" x="0.0" y="181" width="335" height="80.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zVR-3D-DdR">
<rect key="frame" x="0.0" y="0.0" width="335" height="0.5"/>
@ -98,31 +167,31 @@
<rect key="frame" x="0.0" y="10.5" width="335" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="253" verticalHuggingPriority="251" text="Available Balance" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SYv-xg-jya">
<rect key="frame" x="0.0" y="0.0" width="85.5" height="30"/>
<rect key="frame" x="0.0" y="0.0" width="70.5" height="30"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lpH-nz-meb">
<rect key="frame" x="90.5" y="0.0" width="133" height="30"/>
<rect key="frame" x="75.5" y="0.0" width="140.5" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" horizontalHuggingPriority="252" translatesAutoresizingMaskIntoConstraints="NO" id="Zoq-Ph-ipO">
<rect key="frame" x="228.5" y="0.0" width="52.5" height="30"/>
<rect key="frame" x="221" y="0.0" width="60" height="30"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pJB-eJ-bWJ">
<rect key="frame" x="0.0" y="0.0" width="52.5" height="30"/>
<rect key="frame" x="0.0" y="0.0" width="60" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="N/A" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="crF-eg-HNv">
<rect key="frame" x="0.0" y="0.0" width="16.5" height="30"/>
<rect key="frame" x="0.0" y="0.0" width="24" height="30"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" KRW" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JOx-My-xUB">
<rect key="frame" x="16.5" y="0.0" width="36" height="30"/>
<rect key="frame" x="24" y="0.0" width="36" height="30"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
@ -190,7 +259,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="me5-tr-dab">
<rect key="frame" x="10" y="171" width="355" height="536"/>
<rect key="frame" x="10" y="287" width="355" height="536"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="Rbv-gn-yFV">
<rect key="frame" x="10" y="10" width="335" height="516"/>
@ -443,7 +512,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HNr-Vg-UtG">
<rect key="frame" x="0.0" y="170.5" width="375" height="0.5"/>
<rect key="frame" x="0.0" y="286.5" width="375" height="0.5"/>
<color key="backgroundColor" name="ThemeSeparate"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="en2-Cw-FD0"/>
@ -511,6 +580,7 @@
<outlet property="sendButton" destination="UYi-o5-Inc" id="OAE-Q6-Otp"/>
<outlet property="serviceFeeLabel" destination="y8p-0Z-AAL" id="irY-KD-4K9"/>
<outlet property="serviceFeeTitleLabel" destination="CmV-2a-OdT" id="Xzm-ae-g7B"/>
<outlet property="tableView" destination="A9a-kE-Ego" id="8Fw-fr-1ca"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8je-5K-XuW" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -542,6 +612,7 @@
<image name="ic_ExSend" width="20" height="19"/>
<image name="ic_bank" width="51" height="51"/>
<image name="ic_review" width="28" height="39"/>
<image name="right" width="22" height="22"/>
<namedColor name="ThemeMainBackground">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
@ -554,6 +625,9 @@
<namedColor name="ThemeText">
<color red="0.28999999165534973" green="0.28999999165534973" blue="0.28999999165534973" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="ThemeWhite">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
<color key="tintColor" red="0.78177064659999995" green="0.55228364470000002" blue="0.018981300289999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</document>

14
GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/DomesticRemitViewController.swift

@ -44,6 +44,7 @@ class DomesticRemitViewController: UIViewController {
@IBOutlet private weak var serviceFeeTitleLabel: UILabel!
@IBOutlet private weak var balanceMainContainerView: UIStackView!
@IBOutlet weak var tableView: UITableView!
@IBOutlet private weak var autodebitAccountDropDownImageView: UIImageView!
@IBOutlet private weak var balanceContainerView: UIView!
@IBOutlet private weak var bankDropDownImageView: UIImageView!
@ -61,6 +62,8 @@ class DomesticRemitViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
title = "local_transfer_text".localized()
let indexPath = IndexPath(row: 0, section: 0)
self.tableView.selectRow(at: indexPath, animated: false, scrollPosition: .top)
}
override func viewWillDisappear(_ animated: Bool) {
@ -151,6 +154,7 @@ extension DomesticRemitViewController {
viewWillAppear: viewWillAppear,
showBalanceTrigger: balanceButton.rx.tap.asDriver(),
showRecentHistoryTrigger: recentHistoryButton.rx.tap.asDriver(),
selectedBankIndex: tableView.rx.itemSelected.map( { $0.row }).asDriverOnErrorJustComplete(),
selectAutodebit: autoDebitTextField.rx.controlEvent(.editingDidBegin).asDriver(),
selectBankTrigger: bankTextField.rx.controlEvent(.editingDidBegin).asDriver(),
amount: amountTextField.rx.text.orEmpty.asDriver(),
@ -163,6 +167,8 @@ extension DomesticRemitViewController {
let output = viewModel.transform(input: input)
// output
output.isError
.drive(
@ -236,6 +242,14 @@ extension DomesticRemitViewController {
})
.disposed(by: disposeBag)
output
.fetchBankList.drive(
tableView.rx.items(cellIdentifier: "DomesticBankListTableViewCell")
) { (_, element: Account, cell: DomesticBankListTableViewCell) in
cell.setModel(element)
}
.disposed(by: disposeBag)
output.isAvailableRemit
.drive(onNext: { isAvailable in
self.amountTextField.validCondition = {_ in return isAvailable }

18
GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/ViewModel/DomesticRemitViewModel.swift

@ -16,6 +16,7 @@ class DomesticRemitViewModel: ViewModelType {
let viewWillAppear: Driver<Void>
let showBalanceTrigger: Driver<Void>
let showRecentHistoryTrigger: Driver<Void>
let selectedBankIndex: Driver<Int>
let selectAutodebit: Driver<Void>
let selectBankTrigger: Driver<Void>
let amount: Driver<String>
@ -30,6 +31,7 @@ class DomesticRemitViewModel: ViewModelType {
let isError: Driver<Error>
let isProgress: Driver<Bool>
let selectedAutodebit: Driver<Account?>
let fetchBankList: Driver<[Account]>
let selectedServiceFee: Driver<String?>
let selectedBank: Driver<BankInformation?>
let selectedRecipient: Driver<RecentRecipientModel?>
@ -54,6 +56,7 @@ class DomesticRemitViewModel: ViewModelType {
private let getInitialDataLinker = BehaviorSubject<DomesticRemitModel?>(value: nil)
private let getBalanceLinker = BehaviorSubject<BalanceModel?>(value: nil)
private let successRemitLinker = PublishSubject<ResponseContainerObject<DomesticRemitResponseModel>>()
private let getBankListLinker = BehaviorSubject<[Account]>(value: [])
func transform(input: Input) -> Output {
@ -74,6 +77,16 @@ class DomesticRemitViewModel: ViewModelType {
self.presenter?.fetchBalance(type: type, fintechUseNumber: fintechUseNumber)
}).disposed(by: disposeBag)
input.selectedBankIndex
.withLatestFrom(getBankListLinker.asDriverOnErrorJustComplete()) { (indexPath, bank) -> Account in
return bank[indexPath]
}
.drive(onNext: {[weak self] in
self?.getBalanceLinker.onNext(nil)
self?.selectedAutodebitLinker.onNext($0)
})
.disposed(by: disposeBag)
input.selectAutodebit.drive(onNext: {
self.getBalanceLinker.onNext(nil)
self.presenter?.showTablePresenter(type: .autodebit)
@ -181,6 +194,7 @@ class DomesticRemitViewModel: ViewModelType {
isError: errorLinker.asDriverOnErrorJustComplete(),
isProgress: progressLinker.asDriverOnErrorJustComplete(),
selectedAutodebit: selectedAutodebitLinker.asDriverOnErrorJustComplete(),
fetchBankList: getBankListLinker.asDriverOnErrorJustComplete(),
selectedServiceFee: selectedServiceFeeLinker.asDriverOnErrorJustComplete(),
selectedBank: selectedBankLinker.asDriverOnErrorJustComplete(),
selectedRecipient: selectedHistoryLinker.asDriverOnErrorJustComplete(),
@ -206,6 +220,10 @@ extension DomesticRemitViewModel: DomesticRemitViewModelInterface {
func setModel(with model: DomesticRemitModel) {
getInitialDataLinker.onNext(model)
guard let accounts = model.accounts else { return }
getBankListLinker.onNext(accounts)
if model.accounts?.count != 0 {
selectedData(with: model.accounts?[0], type: .autodebit)
}

Loading…
Cancel
Save