diff --git a/GME Remit/Models/Response/AccountEx.swift b/GME Remit/Models/Response/AccountEx.swift index 3f9419a6..de07583f 100644 --- a/GME Remit/Models/Response/AccountEx.swift +++ b/GME Remit/Models/Response/AccountEx.swift @@ -113,6 +113,16 @@ class KftcLanguage: Mappable { } } +extension KftcLanguage: TablePresenterProtocol { + var cellTitle: String? { + return value + } + + var cellImage: UIImage? { + return nil + } +} + class KftcHeader: Mappable { var key: String? var value: String? diff --git a/GME Remit/Modules/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift b/GME Remit/Modules/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift index 8551353a..ba1fad8d 100644 --- a/GME Remit/Modules/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift +++ b/GME Remit/Modules/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift @@ -391,8 +391,6 @@ extension ExchangeRatesViewController: UICollectionViewDataSource { case .cardPayment: return configureCardPaymentCell(collectionView: collectionView, indexPath: indexPath) - default: - return configureCashDeliveryCell(collectionView: collectionView, indexPath: indexPath) } } diff --git a/GME Remit/Modules/Home/User Interface/View/HomeViewController.swift b/GME Remit/Modules/Home/User Interface/View/HomeViewController.swift index f4ce6e31..d947ad7e 100644 --- a/GME Remit/Modules/Home/User Interface/View/HomeViewController.swift +++ b/GME Remit/Modules/Home/User Interface/View/HomeViewController.swift @@ -495,7 +495,7 @@ extension HomeViewController { } private func showManageAccounts() { - let wireframe = ManageAccountGroupWireframe() +// let wireframe = ManageAccountGroupWireframe() if let navigation = self.navigationController { // wireframe.pushMainView(in: navigation) TotalManageAccountsWireframe().pushMainView(in: navigation) diff --git a/GME Remit/Modules/ManageAccountsModules/AutoDebitModules/AddAccount/User Interface/View/AddAccount.storyboard b/GME Remit/Modules/ManageAccountsModules/AutoDebitModules/AddAccount/User Interface/View/AddAccount.storyboard index ecbda04c..526167ae 100644 --- a/GME Remit/Modules/ManageAccountsModules/AutoDebitModules/AddAccount/User Interface/View/AddAccount.storyboard +++ b/GME Remit/Modules/ManageAccountsModules/AutoDebitModules/AddAccount/User Interface/View/AddAccount.storyboard @@ -1,9 +1,9 @@ - + - + @@ -36,14 +36,14 @@ - + - + - + @@ -52,10 +52,11 @@ + - + @@ -65,10 +66,11 @@ + - + @@ -78,6 +80,7 @@ + @@ -91,7 +94,7 @@ + + + + + + + + + - + - + - + @@ -68,44 +111,44 @@ - - + + - - + - + - - + @@ -186,7 +237,7 @@ - + @@ -195,6 +246,7 @@ + @@ -208,6 +260,7 @@ + @@ -216,78 +269,174 @@ - - + + - - + + + + + + + + + - - - + - + + + + - - - - - AUTO -DEBIT - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - + + + + + @@ -303,6 +452,9 @@ DEBIT + + + diff --git a/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/View/TotalManageAccountsViewController.swift b/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/View/TotalManageAccountsViewController.swift index 181cfb61..71bf2b5e 100644 --- a/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/View/TotalManageAccountsViewController.swift +++ b/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/View/TotalManageAccountsViewController.swift @@ -16,6 +16,21 @@ enum AccountType: Int { case autodebit case inbound case none + + var name: String { + switch self { + case .all: + return "ALL" + case .primary: + return "PRIMARY" + case .autodebit: + return "AUTO DEBIT" + case .inbound: + return "Inbound" + case .none: + return "NONE" + } + } } class TotalManageAccountsViewController: UIViewController { @@ -24,6 +39,10 @@ class TotalManageAccountsViewController: UIViewController { var presenter: TotalManageAccountsPresenter! private let disposeBag = DisposeBag() + private let addAutodebit = PublishSubject() + private let addInbound = PublishSubject() + private let verifyAccount = PublishSubject() + private let deleteAutodebitAccount = PublishSubject() // MARK: Computed Properties private var accounts: [TotalAccount] = [] { @@ -31,10 +50,35 @@ class TotalManageAccountsViewController: UIViewController { tableView.reloadData() } } + + private var kftcModel: KFTCModel? { + didSet { + let configure = TablePresenterConfiguration(presenterTitle: "Select Language") + languageTextField.useAsDropDown(with: configure, items: kftcModel?.languages) + languageTextField.placeholder = "token_renewal_placeholder_text".localized() + languageTextField.rightViewMode = .never + } + } + + private var isEdit = false { + didSet { + tableView.reloadData() + } + } + lazy var languageTextField = ValidationTextField(frame: .zero) + // MARK: IBOutlets @IBOutlet private weak var tableView: UITableView! @IBOutlet private weak var accountTypeSegment: UISegmentedControl! + @IBOutlet private weak var deleteButton: UIButton! + @IBOutlet private weak var renewButton: UIBarButtonItem! + @IBOutlet private weak var addButton: UIBarButtonItem! + + @IBOutlet private weak var primaryTagLabel: UILabel! + @IBOutlet private weak var autodebitTagLabel: UILabel! + @IBOutlet private weak var inboundTagLabel: UILabel! + @IBOutlet private weak var filterNameLabel: UILabel! // MARK: VC's Life cycle override func viewDidLoad() { @@ -54,7 +98,10 @@ class TotalManageAccountsViewController: UIViewController { } // MARK: IBActions - + @IBAction func touchEdit(_ sender: UIButton) { + isEdit = !isEdit + } + } // MARK: Other Functions @@ -76,13 +123,85 @@ extension TotalManageAccountsViewController { labels.numberOfLines = 2 labels.minimumScaleFactor = 0.6 labels.adjustsFontSizeToFitWidth = true + labels.font = .sanfrancisco(.medium, size: 12) } } } + + deleteButton.titleLabel?.minimumScaleFactor = 0.5 + deleteButton.titleLabel?.adjustsFontSizeToFitWidth = true + + view.addSubview(languageTextField) + + primaryTagLabel.layer.cornerRadius = 5 + autodebitTagLabel.layer.cornerRadius = 5 + inboundTagLabel.layer.cornerRadius = 5 } private func setUIBinding() { + accountTypeSegment.rx.selectedSegmentIndex + .map {AccountType(rawValue: $0)?.name} + .bind(to: filterNameLabel.rx.text).disposed(by: disposeBag) + + renewButton.rx.tap.asDriver().drive(onNext: {[weak self] in + self?.alertWithOkCancel( + type: .normal, + message: "token_renewal_confirm_text".localized(), + title: "token_renewal_text".localized(), + okTitle: "yes_text".localized(), + cancelTitle: "no_text".localized(), + okAction: {[weak self] in + self?.languageTextField.becomeFirstResponder() + }, + cancelAction: nil + ) + }).disposed(by: disposeBag) + addButton.rx.tap.asDriver().drive(onNext: {[weak self] in + guard let `self` = self else { return } + let alert = UIAlertController( + title: nil, + message: "Add Account", + preferredStyle: .actionSheet + ) + + let autodebit = UIAlertAction( + title: "Autodebit Account", + style: .default + ) { _ in + self.addAutodebit.onNext(self.kftcModel) + } + + let inbound = UIAlertAction( + title: "Inbound Account", + style: .default + ) { _ in + self.addInbound.onNext(nil) + } + + let cancel = UIAlertAction(title: "Cancel", style: .cancel) + alert.addAction(autodebit) + alert.addAction(inbound) + alert.addAction(cancel) + alert.view.tintColor = .themeText + + if UIDevice.current.userInterfaceIdiom == .pad { + if let popoverController = alert.popoverPresentationController { + popoverController.sourceView = self.view + popoverController.sourceRect = CGRect( + x: self.view.bounds.midX, + y: self.view.bounds.midY, + width: 0, + height: 0 + ) + + popoverController.permittedArrowDirections = [] + self.present(alert, animated: true, completion: nil) + } + } else { + self.present(alert, animated: true, completion: nil) + } + }).disposed(by: disposeBag) } private func setBinding() { @@ -95,7 +214,12 @@ extension TotalManageAccountsViewController { let input = TotalManageAccountsPresenter.Input( viewWillAppear: viewWillAppear, - selectedType: selectedType + selectedType: selectedType, + addAutodebitAccount: addAutodebit.asDriverOnErrorJustComplete(), + addInboundAccount: addInbound.asDriverOnErrorJustComplete(), + verifyAccount: verifyAccount.asDriverOnErrorJustComplete(), + deleteAutodebitAccount: deleteAutodebitAccount.asDriverOnErrorJustComplete(), + tokenRenew: languageTextField.selectedItem.map {$0 as? KftcLanguage}.asDriverOnErrorJustComplete() ) let output = presenter.transform(input: input) @@ -113,9 +237,14 @@ extension TotalManageAccountsViewController { output.accounts.drive(onNext: {[weak self] in self?.accounts = $0 }).disposed(by: disposeBag) + + output.kftcModel.drive(onNext: {[weak self] in + self?.kftcModel = $0 + }).disposed(by: disposeBag) } } +// MARK: UITableViewDataSource extension TotalManageAccountsViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return accounts.count @@ -126,13 +255,55 @@ extension TotalManageAccountsViewController: UITableViewDataSource { return UITableViewCell() } - cell.setModel(with: self.accounts[indexPath.row]) + cell.setModel(with: self.accounts[indexPath.row], isEdit: isEdit) + cell.delegate = self + return cell } } +// MARK: UITableViewDelegate extension TotalManageAccountsViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 110 + return 95 + } +} + +// MARK: AccountCellDelegate +extension TotalManageAccountsViewController: AccountCellDelegate { + func delete(_ model: TotalAccount) { + alertWithOkCancel( + message: "auto_debit_delete_confirm_description".localized(), + title: "are_you_sure_text".localized(), + okTitle: "delete_text".localized(), + okAction: { [weak self] in + self?.deleteAutodebitAccount.onNext(model.autodebitID ?? "") + } + ) + } + + func migrate(_ model: TotalAccount) { + let bank = BankInformation(bankCode: model.bankCode, bankName: model.bankName) + + let model = PenneyTestRequest( + accountID: model.autodebitID, + accountType: "autodebit", + bank: bank, + account: model.accountNo ?? "" + ) + addInbound.onNext(model) + } + + func verify(_ model: TotalAccount) { + let bankInformation = BankInformation( + bankCode: model.bankCode ?? "", + bankName: model.bankName ?? "" + ) + + let pennyTestRequest = PenneyTestRequest( + bank: bankInformation, + account: model.accountNo ?? "" + ) + verifyAccount.onNext(pennyTestRequest) } } diff --git a/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframe.swift b/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframe.swift index 4a551c59..2db70aa1 100644 --- a/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframe.swift +++ b/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframe.swift @@ -13,7 +13,6 @@ class TotalManageAccountsWireframe { } extension TotalManageAccountsWireframe: TotalManageAccountsWireframeInput { - var storyboardName: String {return "TotalManageAccounts"} func getMainView() -> UIViewController { @@ -30,4 +29,32 @@ extension TotalManageAccountsWireframe: TotalManageAccountsWireframeInput { view = viewController return viewController } + + func openAddAutodebit(with model: KFTCModel?) { + AddAccountWireframe().openPushMainView(with: model, source: view) + } + + func openAddInbound(with model: PenneyTestRequest?) { + AddInboundAccountWireframe().open(with: model, source: view) + } + + func openVerify(with model: PenneyTestRequest) { + InboundPennyTestSubmitWireframe().open(with: model, on: view) + } + + func openRefreshToken(header: [KftcHeader]?, url: String?) { + guard let viewcontroller = UIStoryboard( + name: "WKWebView", + bundle: nil + ).instantiateViewController(withIdentifier: "WkWebViewController") as? WkWebViewController else { + return + } + + viewcontroller.url = url?.components(separatedBy: .whitespaces).joined() + viewcontroller.headers = header + + let navigationController = UINavigationController(rootViewController: viewcontroller) + + view.present(navigationController, animated: true, completion: nil) + } } diff --git a/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframeInput.swift b/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframeInput.swift index d41101d5..06143828 100644 --- a/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframeInput.swift +++ b/GME Remit/Modules/ManageAccountsModules/TotalManageAccounts/User Interface/Wireframe/TotalManageAccountsWireframeInput.swift @@ -9,5 +9,8 @@ import Foundation protocol TotalManageAccountsWireframeInput: WireframeInput { - + func openAddAutodebit(with model: KFTCModel?) + func openAddInbound(with model: PenneyTestRequest?) + func openVerify(with model: PenneyTestRequest) + func openRefreshToken(header: [KftcHeader]?, url: String?) } diff --git a/GME Remit/Modules/PowerCallModules/RechargeHistory/Application Logic/Service/RechargeHistoryService.swift b/GME Remit/Modules/PowerCallModules/RechargeHistory/Application Logic/Service/RechargeHistoryService.swift index cf8b017f..4a2e3852 100644 --- a/GME Remit/Modules/PowerCallModules/RechargeHistory/Application Logic/Service/RechargeHistoryService.swift +++ b/GME Remit/Modules/PowerCallModules/RechargeHistory/Application Logic/Service/RechargeHistoryService.swift @@ -15,92 +15,6 @@ class RechargeHistoryService: RechargeHistoryServiceType { success: @escaping ([RechargeHistory]) -> Void, failure: @escaping (Error) -> Void ) { - //FIXME: Test - let text = -""" -{ - "ErrorCode": "0", - "Msg": "SUCCESS", - "Id": "", - "Extra": "", - "Extra2": "", - "Data": [ - { - "Status": "W", - "PhoneNo": "01073412296", - "CardName": "SnowMan", - "ChargeType": "DATA CHARGE", - "ProductPrice": "16500", - "RequestTime": "2019-11-05 오전 9:48:04", - "ControllNo": "19110509480452040154" - }, - { - "Status": "S", - "PhoneNo": "01073412296", - "CardName": "SnowMan", - "ChargeType": "DATA CHARGE", - "ProductPrice": "16500", - "RequestTime": "2019-11-05 오전 9:23:24", - "ControllNo": "19110509232455040154" - }, - { - "Status": "F", - "PhoneNo": "01073412296", - "CardName": "SnowMan", - "ChargeType": "DATA CHARGE", - "ProductPrice": "16500", - "RequestTime": "2019-11-04 오후 6:09:21", - "ControllNo": "19110418091953340154" - }, - { - "Status": "Wait", - "PhoneNo": "01073412296", - "CardName": "????", - "ChargeType": "DATA CHARGE", - "ProductPrice": "16500", - "RequestTime": "2019-11-04 오후 6:03:40", - "ControllNo": "19110418032491740154" - }, - { - "Status": "W", - "PhoneNo": "01092161470", - "CardName": null, - "ChargeType": "MONTH CHARGE", - "ProductPrice": "39600", - "RequestTime": "2019-11-04 오후 5:19:11", - "ControllNo": "19110417191138040154" - }, - { - "Status": "S", - "PhoneNo": "01073412296", - "CardName": null, - "ChargeType": "DATA CHARGE", - "ProductPrice": "16500", - "RequestTime": "2019-11-04 오후 4:19:58", - "ControllNo": "19110416195287040154" - }, - { - "Status": "F", - "PhoneNo": "01073412296", - "CardName": null, - "ChargeType": "DATA CHARGE", - "ProductPrice": "16500", - "RequestTime": "2019-11-04 오후 4:02:10", - "ControllNo": "19110416020822340154" - } - ] -} -""" -// guard -// let json = ResponseContainerArray(JSONString: text), -// let data = json.data else { -// let error = NSError(domain: "TEST data error", code: 0, message: "Wrong Test Data") -// failure(error) -// return -// } -// -// success(data) - APIRouter.fetchRechargeHistory(from: from, to: to) .json(success: success, failure: failure) } diff --git a/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/Wireframe/TransactionHistoryWireframe.swift b/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/Wireframe/TransactionHistoryWireframe.swift index e899f918..8a73e51a 100644 --- a/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/Wireframe/TransactionHistoryWireframe.swift +++ b/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/Wireframe/TransactionHistoryWireframe.swift @@ -73,7 +73,6 @@ extension TransactionHistoryWireframe: TransactionHistoryWireframeInput { } func openInboundReceipt(with model: TransactionModel?) { - // TODO Link InboundReceipt InboundReceiptWireframe().push(with: model, on: view) } } diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_delete2.imageset/Contents.json b/GME Remit/Supported Files/Assets.xcassets/ic_delete2.imageset/Contents.json new file mode 100644 index 00000000..d32123b8 --- /dev/null +++ b/GME Remit/Supported Files/Assets.xcassets/ic_delete2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_delete2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_delete2.imageset/ic_delete2.png b/GME Remit/Supported Files/Assets.xcassets/ic_delete2.imageset/ic_delete2.png new file mode 100644 index 00000000..9425c78e Binary files /dev/null and b/GME Remit/Supported Files/Assets.xcassets/ic_delete2.imageset/ic_delete2.png differ diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_delete3.imageset/Contents.json b/GME Remit/Supported Files/Assets.xcassets/ic_delete3.imageset/Contents.json new file mode 100644 index 00000000..70cff91c --- /dev/null +++ b/GME Remit/Supported Files/Assets.xcassets/ic_delete3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_delete3.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_delete3.imageset/ic_delete3.png b/GME Remit/Supported Files/Assets.xcassets/ic_delete3.imageset/ic_delete3.png new file mode 100644 index 00000000..6e8deefe Binary files /dev/null and b/GME Remit/Supported Files/Assets.xcassets/ic_delete3.imageset/ic_delete3.png differ diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_edit.imageset/Contents.json b/GME Remit/Supported Files/Assets.xcassets/ic_edit.imageset/Contents.json new file mode 100644 index 00000000..04b1ba81 --- /dev/null +++ b/GME Remit/Supported Files/Assets.xcassets/ic_edit.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_edit.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_edit.imageset/ic_edit.png b/GME Remit/Supported Files/Assets.xcassets/ic_edit.imageset/ic_edit.png new file mode 100644 index 00000000..be7e8826 Binary files /dev/null and b/GME Remit/Supported Files/Assets.xcassets/ic_edit.imageset/ic_edit.png differ diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_minus.imageset/Contents.json b/GME Remit/Supported Files/Assets.xcassets/ic_minus.imageset/Contents.json new file mode 100644 index 00000000..a91c9968 --- /dev/null +++ b/GME Remit/Supported Files/Assets.xcassets/ic_minus.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_minus.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_minus.imageset/ic_minus.png b/GME Remit/Supported Files/Assets.xcassets/ic_minus.imageset/ic_minus.png new file mode 100644 index 00000000..8f12947c Binary files /dev/null and b/GME Remit/Supported Files/Assets.xcassets/ic_minus.imageset/ic_minus.png differ diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_minus2.imageset/Contents.json b/GME Remit/Supported Files/Assets.xcassets/ic_minus2.imageset/Contents.json new file mode 100644 index 00000000..d02895bd --- /dev/null +++ b/GME Remit/Supported Files/Assets.xcassets/ic_minus2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_minus2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GME Remit/Supported Files/Assets.xcassets/ic_minus2.imageset/ic_minus2.png b/GME Remit/Supported Files/Assets.xcassets/ic_minus2.imageset/ic_minus2.png new file mode 100644 index 00000000..39137721 Binary files /dev/null and b/GME Remit/Supported Files/Assets.xcassets/ic_minus2.imageset/ic_minus2.png differ diff --git a/GME Remit/Utilities/TablePresenter/User Interface/View/TablePresenter.storyboard b/GME Remit/Utilities/TablePresenter/User Interface/View/TablePresenter.storyboard index 53b35f3a..23af8a67 100644 --- a/GME Remit/Utilities/TablePresenter/User Interface/View/TablePresenter.storyboard +++ b/GME Remit/Utilities/TablePresenter/User Interface/View/TablePresenter.storyboard @@ -3,7 +3,7 @@ - +