diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj index 10af7854..9589306d 100644 --- a/GME Remit.xcodeproj/project.pbxproj +++ b/GME Remit.xcodeproj/project.pbxproj @@ -287,6 +287,7 @@ 7389601322C2F208003FEA90 /* TablePresenterViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7389600822C2F208003FEA90 /* TablePresenterViewInterface.swift */; }; 7389601422C2F208003FEA90 /* TablePresenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7389600922C2F208003FEA90 /* TablePresenterViewController.swift */; }; 7389601922C2FADD003FEA90 /* TableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7389601822C2FADD003FEA90 /* TableCell.swift */; }; + 738B3E4C233B56C6000EA5E5 /* UISearchBar+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 738B3E4B233B56C6000EA5E5 /* UISearchBar+Ext.swift */; }; 738DEC1B22D429AB00936C2C /* FunctionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 738DEC1A22D429AB00936C2C /* FunctionTest.swift */; }; 738F04B12316238600BA5EE7 /* ShadowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 738F04B02316238600BA5EE7 /* ShadowView.swift */; }; 738FD48023038FDE008B144D /* UIFont+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 738FD47F23038FDE008B144D /* UIFont+Ext.swift */; }; @@ -2556,6 +2557,7 @@ 7389600822C2F208003FEA90 /* TablePresenterViewInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TablePresenterViewInterface.swift; sourceTree = ""; }; 7389600922C2F208003FEA90 /* TablePresenterViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TablePresenterViewController.swift; sourceTree = ""; }; 7389601822C2FADD003FEA90 /* TableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableCell.swift; sourceTree = ""; }; + 738B3E4B233B56C6000EA5E5 /* UISearchBar+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISearchBar+Ext.swift"; sourceTree = ""; }; 738DEC1A22D429AB00936C2C /* FunctionTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FunctionTest.swift; sourceTree = ""; }; 738F04B02316238600BA5EE7 /* ShadowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShadowView.swift; sourceTree = ""; }; 738FD47F23038FDE008B144D /* UIFont+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Ext.swift"; sourceTree = ""; }; @@ -4719,6 +4721,7 @@ 736E3219230A3CC1005799AA /* UIDevice+Ext.swift */, 73976D1F2331B4F4003CF5E1 /* UIImageView+Ext.swift */, 73A2238E23399A9F00FD75C9 /* UIScrollView+Ext.swift */, + 738B3E4B233B56C6000EA5E5 /* UISearchBar+Ext.swift */, ); path = Extensions; sourceTree = ""; @@ -14561,6 +14564,7 @@ D945F11D213E1D5100A24824 /* SendMoneyReceiptModuleInterface.swift in Sources */, 73195B3522FD5BC600151434 /* APIRouter.swift in Sources */, 73A6E20222CEE51600E9BC68 /* BadgeAppearance.swift in Sources */, + 738B3E4C233B56C6000EA5E5 /* UISearchBar+Ext.swift in Sources */, D97785AA215DD04400754079 /* TransactionHistoryTableViewCell.swift in Sources */, 73A621622330AD20000FFB5B /* RecentHistoriesInteractor.swift in Sources */, 730D7894227A94E1007E517E /* RewardItemCollectionViewCell.swift in Sources */, diff --git a/GME Remit/AppDelegate.swift b/GME Remit/AppDelegate.swift index 35778c4a..c34ddb1c 100644 --- a/GME Remit/AppDelegate.swift +++ b/GME Remit/AppDelegate.swift @@ -20,7 +20,7 @@ import IQKeyboardManagerSwift import Localize_Swift import ChannelIO -let server: Server = .uat +let server: Server = .staging var overlayView: UIView? @UIApplicationMain diff --git a/GME Remit/Extensions/UISearchBar+Ext.swift b/GME Remit/Extensions/UISearchBar+Ext.swift new file mode 100644 index 00000000..18b84440 --- /dev/null +++ b/GME Remit/Extensions/UISearchBar+Ext.swift @@ -0,0 +1,98 @@ +// +// UISearchBar+Ext.swift +// GME Remit +// +// Created by InKwon James Kim on 25/09/2019. +// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. +// + +import UIKit + +extension UISearchBar { + func getTextField() -> UITextField? { return value(forKey: "searchField") as? UITextField } + + func set(textColor: UIColor) { if let textField = getTextField() { textField.textColor = textColor } } + + func setPlaceholder(textColor: UIColor) { getTextField()?.setPlaceholder(textColor: textColor) } + + func setClearButton(color: UIColor) { getTextField()?.setClearButton(color: color) } + + func setTextField(color: UIColor) { + guard let textField = getTextField() else { return } + switch searchBarStyle { + case .minimal: + textField.layer.backgroundColor = color.cgColor + textField.layer.cornerRadius = 6 + case .prominent, .default: textField.backgroundColor = color + @unknown default: break + } + } + + func setSearchImage(color: UIColor) { + guard let imageView = getTextField()?.leftView as? UIImageView else { return } + imageView.tintColor = color + imageView.image = imageView.image?.withRenderingMode(.alwaysTemplate) + } +} + +private extension UITextField { + + private class Label: UILabel { + private var _textColor = UIColor.lightGray + override var textColor: UIColor! { + set { super.textColor = _textColor } + get { return _textColor } + } + + init(label: UILabel, textColor: UIColor = .lightGray) { + _textColor = textColor + super.init(frame: label.frame) + self.text = label.text + self.font = label.font + } + + required init?(coder: NSCoder) { super.init(coder: coder) } + } + + + private class ClearButtonImage { + static private var _image: UIImage? + static private var semaphore = DispatchSemaphore(value: 1) + static func getImage(closure: @escaping (UIImage?)->()) { + DispatchQueue.global(qos: .userInteractive).async { + semaphore.wait() + DispatchQueue.main.async { + if let image = _image { closure(image); semaphore.signal(); return } + guard let window = UIApplication.shared.windows.first else { semaphore.signal(); return } + let searchBar = UISearchBar(frame: CGRect(x: 0, y: -200, width: UIScreen.main.bounds.width, height: 44)) + window.rootViewController?.view.addSubview(searchBar) + searchBar.text = "txt" + searchBar.layoutIfNeeded() + _image = searchBar.getTextField()?.getClearButton()?.image(for: .normal) + closure(_image) + searchBar.removeFromSuperview() + semaphore.signal() + } + } + } + } + + func setClearButton(color: UIColor) { + ClearButtonImage.getImage { [weak self] image in + guard let image = image, + let button = self?.getClearButton() else { return } + button.imageView?.tintColor = color + button.setImage(image.withRenderingMode(.alwaysTemplate), for: .normal) + } + } + + var placeholderLabel: UILabel? { return value(forKey: "placeholderLabel") as? UILabel } + + func setPlaceholder(textColor: UIColor) { + guard let placeholderLabel = placeholderLabel else { return } + let label = Label(label: placeholderLabel, textColor: textColor) + setValue(label, forKey: "placeholderLabel") + } + + func getClearButton() -> UIButton? { return value(forKey: "clearButton") as? UIButton } +} diff --git a/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/Application Logic/Model/RecentRecipientModel.swift b/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/Application Logic/Model/RecentRecipientModel.swift index 02f539da..39b03cf4 100644 --- a/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/Application Logic/Model/RecentRecipientModel.swift +++ b/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/Application Logic/Model/RecentRecipientModel.swift @@ -19,8 +19,8 @@ struct RecentRecipientModel: Mappable { mutating func mapping(map: Map) { bank <- map["bank"] - account <- map["RecipientAccount"] - name <- map["RecipientName"] + account <- map["recipient_account"] + name <- map["recipient_name"] } } diff --git a/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/User Interface/View/RecentHistories.storyboard b/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/User Interface/View/RecentHistories.storyboard index 294055b1..f70f2866 100644 --- a/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/User Interface/View/RecentHistories.storyboard +++ b/GME Remit/Modules/RemittanceModules/DomesticModules/RecentHistories/User Interface/View/RecentHistories.storyboard @@ -114,9 +114,10 @@ - + + @@ -137,7 +138,7 @@ - + @@ -145,28 +146,40 @@ - + - + - + - + + + + + + + + + + - + + + + - +