Browse Source

Utilities - apply SwiftLint

pull/1/head
InKwon James Kim 5 years ago
parent
commit
dfbfd9e8a0
  1. 4
      .swiftlint.yml
  2. 4
      GME Remit.xcodeproj/project.pbxproj
  3. 22
      GME Remit/Utilities/ConfirmAlert/ConfirmViewController.swift
  4. 677
      GME Remit/Utilities/CountryInfo.swift
  5. 6
      GME Remit/Utilities/Database/UserDefaultsWrapper.swift
  6. 5
      GME Remit/Utilities/GMEAlert/GMEAlertViewController.swift
  7. 6
      GME Remit/Utilities/HotLine/Application Logic/Service/HotLineService.swift
  8. 13
      GME Remit/Utilities/HotLine/User Interface/View/Cell/HotLineCell.swift
  9. 5
      GME Remit/Utilities/HotLine/User Interface/Wireframe/HotLineWireframe.swift
  10. 2
      GME Remit/Utilities/HotLine/User Interface/Wireframe/HotLineWireframeInput.swift
  11. 182
      GME Remit/Utilities/ImageCroper.swift
  12. 4
      GME Remit/Utilities/KeyChain.swift
  13. 51
      GME Remit/Utilities/ScrollableSegmentedControl.swift
  14. 56
      GME Remit/Utilities/SearchAddress/Application Logic/Interactor/SearchAddressInteractor.swift
  15. 14
      GME Remit/Utilities/SearchAddress/Application Logic/Interactor/SearchAddressInteractorIO.swift
  16. 84
      GME Remit/Utilities/SearchAddress/Application Logic/Model/Juso.swift
  17. 16
      GME Remit/Utilities/SearchAddress/Application Logic/Model/JusoContainer.swift
  18. 20
      GME Remit/Utilities/SearchAddress/Application Logic/Model/JusoResult.swift
  19. 76
      GME Remit/Utilities/SearchAddress/Application Logic/Service/SearchAddressService.swift
  20. 14
      GME Remit/Utilities/SearchAddress/Application Logic/Service/SearchAddressServiceType.swift
  21. 10
      GME Remit/Utilities/SearchAddress/Module Interface/SearchAddressModuleInterface.swift
  22. 48
      GME Remit/Utilities/SearchAddress/User Interface/Presenter/SearchAddressPresenter.swift
  23. 9
      GME Remit/Utilities/SearchAddress/User Interface/View/SearchAddressViewController.swift
  24. 10
      GME Remit/Utilities/SearchAddress/User Interface/View/SearchAddressViewInterface.swift
  25. 64
      GME Remit/Utilities/SearchAddress/User Interface/Wireframe/SearchAddressWireframe.swift
  26. 10
      GME Remit/Utilities/SearchAddress/User Interface/Wireframe/SearchAddressWireframeInput.swift
  27. 16
      GME Remit/Utilities/SecureKeypad.swift
  28. 32
      GME Remit/Utilities/TablePresenter/User Interface/View/TablePresenterViewController.swift
  29. 2
      GME Remit/Utilities/TablePresenter/User Interface/Wireframe/TablePresenterWireframe.swift
  30. 31
      GME Remit/Utilities/WebLinks/WkWebView/WkWebViewController.swift

4
.swiftlint.yml

@ -4,9 +4,9 @@ disabled_rules: # 실행에서 제외할 룰 식별자들
- control_statement
- trailing_whitespace
- function_parameter_count
opt_in_rules: # 일부 룰은 옵트 인 형태로 제공
- missing_docs
# 사용 가능한 모든 룰은 swiftlint rules 명령으로 확인 가능

4
GME Remit.xcodeproj/project.pbxproj

@ -2420,7 +2420,7 @@
73157B9922DC1EEC009B836F /* PopupNotificationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PopupNotificationViewController.swift; sourceTree = "<group>"; };
73157B9A22DC1EEC009B836F /* PopupNotification.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = PopupNotification.storyboard; sourceTree = "<group>"; };
73157BA622DC3F14009B836F /* Date+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Ext.swift"; sourceTree = "<group>"; };
731627A42301009800BA48A8 /* ExchangeRateRequestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ExchangeRateRequestModel.swift; path = "GME Remit/Models/ExchangeRateRequestModel.swift"; sourceTree = "<group>"; };
731627A42301009800BA48A8 /* ExchangeRateRequestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExchangeRateRequestModel.swift; sourceTree = "<group>"; };
73168A1E22F3CC4B00878038 /* NativeCountry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NativeCountry.swift; sourceTree = "<group>"; };
73168A2222F3D01900878038 /* TablePresenterProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TablePresenterProtocol.swift; sourceTree = "<group>"; };
73195A9D22FD14D400151434 /* SetupRecipientModuleInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetupRecipientModuleInterface.swift; sourceTree = "<group>"; };
@ -6688,7 +6688,6 @@
9FD260EB1FD00458007A511D = {
isa = PBXGroup;
children = (
731627A42301009800BA48A8 /* ExchangeRateRequestModel.swift */,
D94838D421757F8C00FFC19E /* GME Remit.entitlements */,
9FD260F61FD00458007A511D /* GME Remit */,
9FD2610B1FD00458007A511D /* GME RemitTests */,
@ -10873,6 +10872,7 @@
D962231C212C123600B7A115 /* Models */ = {
isa = PBXGroup;
children = (
731627A42301009800BA48A8 /* ExchangeRateRequestModel.swift */,
0470301121CA4BD000B6C9C3 /* Account.swift */,
04DC27EB21A51E29003714F5 /* AutoRefund.swift */,
D962231D212C126500B7A115 /* ExchangeModel.swift */,

22
GME Remit/Utilities/ConfirmAlert/ConfirmViewController.swift

@ -8,7 +8,7 @@
import UIKit
protocol ConfirmViewControllerDelegate {
protocol ConfirmViewControllerDelegate: class {
func confirm(_ viewController: ConfirmViewController)
func cancel(_ viewController: ConfirmViewController)
}
@ -24,7 +24,7 @@ struct ConfirmViewControllerConfiguration {
class ConfirmViewController: UIViewController {
var delegate: ConfirmViewControllerDelegate?
weak var delegate: ConfirmViewControllerDelegate?
private var configure: ConfirmViewControllerConfiguration?
@ -98,17 +98,17 @@ class ConfirmViewController: UIViewController {
self.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
}
func setConfigure(with configure: ConfirmViewControllerConfiguration){
func setConfigure(with configure: ConfirmViewControllerConfiguration) {
self.configure = configure
}
private func roundView(){
private func roundView() {
mainView.layer.cornerRadius = 5
confirmButton.layer.cornerRadius = 5
cancelButton.layer.cornerRadius = 5
}
private func setMultiLanguage(){
private func setMultiLanguage() {
receiverTitleLabel.text = "receiver_text".localized()
mobileNumberTitleLabel.text = "mobile_number_text".localized()
branchTitleLabel.text = "branch_text".localized()
@ -118,17 +118,17 @@ class ConfirmViewController: UIViewController {
confirmButton.setTitle("confirm_text".localized(), for: .normal)
}
private func cancel(){
mainView.originToBottom(){
self.dismiss(animated: true){
private func cancel() {
mainView.originToBottom() {
self.dismiss(animated: true) {
self.delegate?.cancel(self)
}
}
}
private func confirm(){
mainView.originToBottom(){
self.dismiss(animated: true){
private func confirm() {
mainView.originToBottom() {
self.dismiss(animated: true) {
print("Touched Confirm!")
self.delegate?.confirm(self)
}

677
GME Remit/Utilities/CountryInfo.swift

@ -8,359 +8,330 @@
import Foundation
/*
case "BY":
return R.drawable.flag_belarus;
*/
//Country Default Receiving Amount
//azerbaijan 1,000
//Bangladesh 100,000
//Belarus 1,000
//Cambodia 500
//Georgia 1,000
//India 100,000
//Indonesia 15,000,000
//Kazakhstan 1,000
//Kyrgyzstan 1,000
//Malaysia 10,000
//Moldova 1,000
//Mongolia(USD) 1,000
//Mongolia(MNT) 2,000,000
//Myanmar 1,500,000
//Nepal 100,000
//Pakistan 100,000
//Philippines 500
//Russian Federation 1,000
//Singapore 2,000
//Sri Lanka(LKR) 100,000
//Sri Lanka(USD) 1,000
//Tajikistan 1,000
//Thailand(THB) 30,000
//Uzbekistan 1,000
//Vietnam(VND) 50,000,000
//Vietnam(USD) 2,000
class CountryInfo {
private var flag: [String: UIImage] =
[
"mm": #imageLiteral(resourceName: "flag_myanmar"),
"bs": #imageLiteral(resourceName: "flag_bahamas"),
"bo": #imageLiteral(resourceName: "flag_bolivia"),
"jo": #imageLiteral(resourceName: "flag_jordan"),
"cl": #imageLiteral(resourceName: "flag_chile"),
"fr": #imageLiteral(resourceName: "flag_france"),
"sa": #imageLiteral(resourceName: "flag_saudi_arabia"),
"mu": #imageLiteral(resourceName: "flag_mauritius"),
"kz": #imageLiteral(resourceName: "flag_kazakhstan"),
"tr": #imageLiteral(resourceName: "flag_turkey"),
"sn": #imageLiteral(resourceName: "flag_senegal"),
"hk": #imageLiteral(resourceName: "flag_hong_kong"),
"fj": #imageLiteral(resourceName: "flag_fiji"),
"cz": #imageLiteral(resourceName: "flag_czech_republic"),
"nu": #imageLiteral(resourceName: "flag_niue"),
"jm": #imageLiteral(resourceName: "flag_jamaica"),
"gg": #imageLiteral(resourceName: "flag_guernsey"),
"ph": #imageLiteral(resourceName: "flag_philippines"),
"bv": #imageLiteral(resourceName: "flag_bouvet_island"),
"yt": #imageLiteral(resourceName: "flag_mayotte"),
"bd": #imageLiteral(resourceName: "flag_bangladesh"),
"tj": #imageLiteral(resourceName: "flag_tajikistan"),
"bg": #imageLiteral(resourceName: "flag_bulgaria"),
"hn": #imageLiteral(resourceName: "flag_honduras"),
"bn": #imageLiteral(resourceName: "flag_brunei"),
"gn": #imageLiteral(resourceName: "flag_guinea"),
"ai": #imageLiteral(resourceName: "flag_anguilla"),
"cv": #imageLiteral(resourceName: "flag_cape_verde"),
"et": #imageLiteral(resourceName: "flag_ethiopia"),
"sg": #imageLiteral(resourceName: "flag_singapore"),
"dk": #imageLiteral(resourceName: "flag_denmark"),
"dj": #imageLiteral(resourceName: "flag_djibouti"),
"nr": #imageLiteral(resourceName: "flag_nauru"),
"sb": #imageLiteral(resourceName: "flag_solomon_islands"),
"so": #imageLiteral(resourceName: "flag_somalia"),
"gi": #imageLiteral(resourceName: "flag_gibraltar"),
"gf": #imageLiteral(resourceName: "flag_french_guiana"),
"gh": #imageLiteral(resourceName: "flag_ghana"),
"mt": #imageLiteral(resourceName: "flag_malta"),
"gm": #imageLiteral(resourceName: "flag_gambia"),
"ck": #imageLiteral(resourceName: "flag_cook_islands"),
"sl": #imageLiteral(resourceName: "flag_sierra_leone"),
"li": #imageLiteral(resourceName: "flag_liechtenstein"),
"ls": #imageLiteral(resourceName: "flag_lesotho"),
"fm": #imageLiteral(resourceName: "flag_micronesia"),
"nl": #imageLiteral(resourceName: "flag_netherlands"),
"gd": #imageLiteral(resourceName: "flag_grenada"),
"cx": #imageLiteral(resourceName: "flag_christmas_island"),
"qa": #imageLiteral(resourceName: "flag_qatar"),
"vn": #imageLiteral(resourceName: "flag_vietnam"),
"au": #imageLiteral(resourceName: "flag_australia"),
"la": #imageLiteral(resourceName: "flag_laos"),
"dm": #imageLiteral(resourceName: "flag_dominica"),
"tt": #imageLiteral(resourceName: "flag_trinidad_and_tobago"),
"mq": #imageLiteral(resourceName: "flag_martinique"),
"sv": #imageLiteral(resourceName: "flag_el_salvador"),
"mr": #imageLiteral(resourceName: "flag_mauritania"),
"pw": #imageLiteral(resourceName: "flag_palau"),
"be": #imageLiteral(resourceName: "flag_belgium"),
"ve": #imageLiteral(resourceName: "flag_venezuela"),
"as": #imageLiteral(resourceName: "flag_american_samoa"),
"zm": #imageLiteral(resourceName: "flag_zambia"),
"mx": #imageLiteral(resourceName: "flag_mexico"),
"jp": #imageLiteral(resourceName: "flag_japan"),
"th": #imageLiteral(resourceName: "flag_thailand"),
"za": #imageLiteral(resourceName: "flag_south_africa"),
"tg": #imageLiteral(resourceName: "flag_togo"),
"sr": #imageLiteral(resourceName: "flag_suriname"),
"pf": #imageLiteral(resourceName: "flag_french_polynesia"),
"dz": #imageLiteral(resourceName: "flag_algeria"),
"az": #imageLiteral(resourceName: "flag_azerbaijan"),
"bz": #imageLiteral(resourceName: "flag_belize"),
"at": #imageLiteral(resourceName: "flag_austria"),
"pr": #imageLiteral(resourceName: "flag_puerto_rico"),
"ec": #imageLiteral(resourceName: "flag_ecuador"),
"ws": #imageLiteral(resourceName: "flag_samoa"),
"ag": #imageLiteral(resourceName: "flag_antigua_and_barbuda"),
"ne": #imageLiteral(resourceName: "flag_niger"),
"si": #imageLiteral(resourceName: "flag_slovenia"),
"lr": #imageLiteral(resourceName: "flag_liberia"),
"wf": #imageLiteral(resourceName: "flag_wallis_and_futuna"),
"kg": #imageLiteral(resourceName: "flag_kyrgyzstan"),
"pm": #imageLiteral(resourceName: "flag_saint_pierre_and_miquelon"),
"bi": #imageLiteral(resourceName: "flag_burundi"),
"co": #imageLiteral(resourceName: "flag_colombia"),
"gu": #imageLiteral(resourceName: "flag_guam"),
"bw": #imageLiteral(resourceName: "flag_botswana"),
"sz": #imageLiteral(resourceName: "flag_swaziland"),
"im": #imageLiteral(resourceName: "flag_isle_of_man"),
"je": #imageLiteral(resourceName: "flag_jersey"),
"ki": #imageLiteral(resourceName: "flag_kiribati"),
"cr": #imageLiteral(resourceName: "flag_costa_rica"),
"bb": #imageLiteral(resourceName: "flag_barbados"),
"mn": #imageLiteral(resourceName: "flag_mongolia"),
"to": #imageLiteral(resourceName: "flag_tonga"),
"uk": #imageLiteral(resourceName: "flag_united_kingdom"),
"id": #imageLiteral(resourceName: "flag_indonesia"),
"ua": #imageLiteral(resourceName: "flag_ukraine"),
"kn": #imageLiteral(resourceName: "flag_saint_kitts_and_nevis"),
"gy": #imageLiteral(resourceName: "flag_guyana"),
"cn": #imageLiteral(resourceName: "flag_china"),
"cu": #imageLiteral(resourceName: "flag_cuba"),
"es": #imageLiteral(resourceName: "flag_spain"),
"no": #imageLiteral(resourceName: "flag_norway"),
"ht": #imageLiteral(resourceName: "flag_haiti"),
"al": #imageLiteral(resourceName: "flag_albania"),
"mz": #imageLiteral(resourceName: "flag_mozambique"),
"in": #imageLiteral(resourceName: "flag_india"),
"br": #imageLiteral(resourceName: "flag_brazil"),
"bj": #imageLiteral(resourceName: "flag_benin"),
"se": #imageLiteral(resourceName: "flag_sweden"),
"pe": #imageLiteral(resourceName: "flag_peru"),
"cf": #imageLiteral(resourceName: "flag_central_african_republic"),
"tz": #imageLiteral(resourceName: "flag_tanzania"),
"uy": #imageLiteral(resourceName: "flag_uruguay"),
"vu": #imageLiteral(resourceName: "flag_vanuatu"),
"my": #imageLiteral(resourceName: "flag_malaysia"),
"md": #imageLiteral(resourceName: "flag_moldova"),
"gt": #imageLiteral(resourceName: "flag_guatemala"),
"is": #imageLiteral(resourceName: "flag_iceland"),
"gr": #imageLiteral(resourceName: "flag_greece"),
"tw": #imageLiteral(resourceName: "flag_taiwan"),
"om": #imageLiteral(resourceName: "flag_oman"),
"pt": #imageLiteral(resourceName: "flag_portugal"),
"by": #imageLiteral(resourceName: "flag_belarus"),
"kw": #imageLiteral(resourceName: "flag_kuwait"),
"gl": #imageLiteral(resourceName: "flag_greenland"),
"td": #imageLiteral(resourceName: "flag_chad"),
"na": #imageLiteral(resourceName: "flag_namibia"),
"ee": #imageLiteral(resourceName: "flag_estonia"),
"ms": #imageLiteral(resourceName: "flag_montserrat"),
"mv": #imageLiteral(resourceName: "flag_maldives"),
"af": #imageLiteral(resourceName: "flag_afghanistan"),
"nc": #imageLiteral(resourceName: "flag_new_caledonia"),
"ga": #imageLiteral(resourceName: "flag_gabon"),
"mo": #imageLiteral(resourceName: "flag_macao"),
"ni": #imageLiteral(resourceName: "flag_nicaragua"),
"zw": #imageLiteral(resourceName: "flag_zimbabwe"),
"bm": #imageLiteral(resourceName: "flag_bermuda"),
"rs": #imageLiteral(resourceName: "flag_serbia"),
"cy": #imageLiteral(resourceName: "flag_cyprus"),
"ao": #imageLiteral(resourceName: "flag_angola"),
"py": #imageLiteral(resourceName: "flag_paraguay"),
"tv": #imageLiteral(resourceName: "flag_tuvalu"),
"mc": #imageLiteral(resourceName: "flag_monaco"),
"sm": #imageLiteral(resourceName: "flag_san_marino"),
"er": #imageLiteral(resourceName: "flag_eritrea"),
"bt": #imageLiteral(resourceName: "flag_bhutan"),
"ba": #imageLiteral(resourceName: "flag_bosnia_and_herzegovina"),
"sc": #imageLiteral(resourceName: "flag_seychelles"),
"mg": #imageLiteral(resourceName: "flag_madagascar"),
"st": #imageLiteral(resourceName: "flag_sao_tome_and_principe"),
"eg": #imageLiteral(resourceName: "flag_egypt"),
"ky": #imageLiteral(resourceName: "flag_cayman_islands"),
"ug": #imageLiteral(resourceName: "flag_uganda"),
"sy": #imageLiteral(resourceName: "flag_syria"),
"cm": #imageLiteral(resourceName: "flag_cameroon"),
"aq": #imageLiteral(resourceName: "flag_antarctica"),
"tn": #imageLiteral(resourceName: "flag_tunisia"),
"ge": #imageLiteral(resourceName: "flag_georgia"),
"it": #imageLiteral(resourceName: "flag_italy"),
"gq": #imageLiteral(resourceName: "flag_equatorial_guinea"),
"ca": #imageLiteral(resourceName: "flag_canada"),
"am": #imageLiteral(resourceName: "flag_armenia"),
"rw": #imageLiteral(resourceName: "flag_rwanda"),
"bf": #imageLiteral(resourceName: "flag_burkina_faso"),
"fo": #imageLiteral(resourceName: "flag_faroe_islands"),
"aw": #imageLiteral(resourceName: "flag_aruba"),
"fi": #imageLiteral(resourceName: "flag_finland"),
"lv": #imageLiteral(resourceName: "flag_latvia"),
"lt": #imageLiteral(resourceName: "flag_lithuania"),
"np": #imageLiteral(resourceName: "flag_nepal"),
"pg": #imageLiteral(resourceName: "flag_papua_new_guinea"),
"ad": #imageLiteral(resourceName: "flag_andorra"),
"me": #imageLiteral(resourceName: "flag_montenegro"),
"pa": #imageLiteral(resourceName: "flag_panama"),
"kh": #imageLiteral(resourceName: "flag_cambodia"),
"ma": #imageLiteral(resourceName: "flag_morocco"),
"lb": #imageLiteral(resourceName: "flag_lebanon"),
"tk": #imageLiteral(resourceName: "flag_tokelau"),
"nz": #imageLiteral(resourceName: "flag_new_zealand"),
"sd": #imageLiteral(resourceName: "flag_sudan"),
"hu": #imageLiteral(resourceName: "flag_hungary"),
"iq": #imageLiteral(resourceName: "flag_iraq"),
"hr": #imageLiteral(resourceName: "flag_croatia"),
"ch": #imageLiteral(resourceName: "flag_switzerland"),
"do": #imageLiteral(resourceName: "flag_dominican_republic"),
"mk": #imageLiteral(resourceName: "flag_macedonia"),
"ng": #imageLiteral(resourceName: "flag_nigeria"),
"lu": #imageLiteral(resourceName: "flag_luxembourg"),
"pk": #imageLiteral(resourceName: "flag_pakistan"),
"ro": #imageLiteral(resourceName: "flag_romania"),
"ar": #imageLiteral(resourceName: "flag_argentina"),
"de": #imageLiteral(resourceName: "flag_germany"),
"km": #imageLiteral(resourceName: "flag_comoros"),
"sk": #imageLiteral(resourceName: "flag_slovakia"),
"ke": #imageLiteral(resourceName: "flag_kenya"),
"ml": #imageLiteral(resourceName: "flag_mali"),
"ye": #imageLiteral(resourceName: "flag_yemen"),
"il": #imageLiteral(resourceName: "flag_israel"),
"ae": #imageLiteral(resourceName: "flag_united_arab_emirates"),
"eh": #imageLiteral(resourceName: "flag_western_sahara"),
"io": #imageLiteral(resourceName: "flag_british_indian_ocean_territory"),
"mw": #imageLiteral(resourceName: "flag_malawi"),
"lk": #imageLiteral(resourceName: "flag_sri_lanka"),
"bh": #imageLiteral(resourceName: "flag_bahrain"),
"nf": #imageLiteral(resourceName: "flag_norfolk_island"),
"kr": #imageLiteral(resourceName: "flag_south_korea"),
"uz":#imageLiteral(resourceName: "flag_uzbekistn"),
"ru":#imageLiteral(resourceName: "flag_russia"),
"en": #imageLiteral(resourceName: "flag_united_kingdom")
]
var defaultCountries = ["Nepal", "Cambodia", "Philipinnes", "Sri Lanka", "Vietnam", "India", "Pakistan", "azerbaijan", "Bangladesh", "Belarus", "Georgia", "Indonesia", "Kazakhstan", "Kyrgyzstan", "Malaysia", "Moldova", "Mongolia", "Myanmar", "Russian Federation", "Singapore", "Tajikistan", "Thailand", "Uzbekistan"]
var defaultCountryCodes = ["np", "kh", "ph", "lk", "vn", "in", "pk", "az", "bd", "by", "ge", "kz", "kg", "my", "md", "mn", "mm", "ru", "sg", "tj", "th", "uz", "en"]
private var defaultSendingAmount: [String: String] =
[
"np" : "100000", // nepal
"kh" : "500", // cambodia
"ph" : "50000", // philipines
"lk" : "100,000", // sri lanka
"vn" : "50000000", // Vietnam
"in" : "50000", // india
"pk" : "100000", // pakistan
"az" : "1000", // azerbaijan
"bd" : "100000", // Bangladesh
"by" : "1000", // Belarus
"ge" : "1000", // Georgia
// "id" : "1000000", // indonesia
"kz" : "1000", // Kazakhstan
"kg" : "1000", // Kyrgyzstan
"my" : "10000", // Malaysia
"md" : "1000", // Moldova
"mn" : "1000", // Mongolia
"mm" : "1500000", // Myanmar
"ru" : "1000", // Russian Federation
"sg" : "2000", // Singapore
"tj" : "1000", // Tajikistan
"th" : "30000", // Thailand
"uz" : "1000", // Uzbekistan
"default": "1000000"
]
private var defaultSendingCurrency: [String: String] =
[
"np" : "NPR", // nepal
"kh" : "USD", // cambodia
"ph" : "PHP", // philipines
"lk" : "LKR", // sri lanka
"vn" : "VND", // vietnam
"in" : "INR", // india
"pk" : "PKR", // pakistan
"az" : "USD", // azerbaijan
"bd" : "USD", // Bangladesh
"by" : "USD", // Belarus
"ge" : "USD", // Georgia
"id" : "IDR", // Indonesia
"kz" : "USD", // Kazakhstan
"kg" : "USD", // Kyrgyzstan
"my" : "MYR", // Malaysia
"md" : "USD", // Moldova
"mn" : "USD", // Mongolia
"mm" : "MMK", // Myanmar
"ru" : "USD", // Russian Federation
"sg" : "SGD", // Singapore
"tj" : "USD", // Tajikistan
"th" : "THB", // Thailand
"uz" : "USD", // Uzbekistan
"default": "KRW"
]
private var flag: [String: UIImage] =
[
"mm": #imageLiteral(resourceName: "flag_myanmar"),
"bs": #imageLiteral(resourceName: "flag_bahamas"),
"bo": #imageLiteral(resourceName: "flag_bolivia"),
"jo": #imageLiteral(resourceName: "flag_jordan"),
"cl": #imageLiteral(resourceName: "flag_chile"),
"fr": #imageLiteral(resourceName: "flag_france"),
"sa": #imageLiteral(resourceName: "flag_saudi_arabia"),
"mu": #imageLiteral(resourceName: "flag_mauritius"),
"kz": #imageLiteral(resourceName: "flag_kazakhstan"),
"tr": #imageLiteral(resourceName: "flag_turkey"),
"sn": #imageLiteral(resourceName: "flag_senegal"),
"hk": #imageLiteral(resourceName: "flag_hong_kong"),
"fj": #imageLiteral(resourceName: "flag_fiji"),
"cz": #imageLiteral(resourceName: "flag_czech_republic"),
"nu": #imageLiteral(resourceName: "flag_niue"),
"jm": #imageLiteral(resourceName: "flag_jamaica"),
"gg": #imageLiteral(resourceName: "flag_guernsey"),
"ph": #imageLiteral(resourceName: "flag_philippines"),
"bv": #imageLiteral(resourceName: "flag_bouvet_island"),
"yt": #imageLiteral(resourceName: "flag_mayotte"),
"bd": #imageLiteral(resourceName: "flag_bangladesh"),
"tj": #imageLiteral(resourceName: "flag_tajikistan"),
"bg": #imageLiteral(resourceName: "flag_bulgaria"),
"hn": #imageLiteral(resourceName: "flag_honduras"),
"bn": #imageLiteral(resourceName: "flag_brunei"),
"gn": #imageLiteral(resourceName: "flag_guinea"),
"ai": #imageLiteral(resourceName: "flag_anguilla"),
"cv": #imageLiteral(resourceName: "flag_cape_verde"),
"et": #imageLiteral(resourceName: "flag_ethiopia"),
"sg": #imageLiteral(resourceName: "flag_singapore"),
"dk": #imageLiteral(resourceName: "flag_denmark"),
"dj": #imageLiteral(resourceName: "flag_djibouti"),
"nr": #imageLiteral(resourceName: "flag_nauru"),
"sb": #imageLiteral(resourceName: "flag_solomon_islands"),
"so": #imageLiteral(resourceName: "flag_somalia"),
"gi": #imageLiteral(resourceName: "flag_gibraltar"),
"gf": #imageLiteral(resourceName: "flag_french_guiana"),
"gh": #imageLiteral(resourceName: "flag_ghana"),
"mt": #imageLiteral(resourceName: "flag_malta"),
"gm": #imageLiteral(resourceName: "flag_gambia"),
"ck": #imageLiteral(resourceName: "flag_cook_islands"),
"sl": #imageLiteral(resourceName: "flag_sierra_leone"),
"li": #imageLiteral(resourceName: "flag_liechtenstein"),
"ls": #imageLiteral(resourceName: "flag_lesotho"),
"fm": #imageLiteral(resourceName: "flag_micronesia"),
"nl": #imageLiteral(resourceName: "flag_netherlands"),
"gd": #imageLiteral(resourceName: "flag_grenada"),
"cx": #imageLiteral(resourceName: "flag_christmas_island"),
"qa": #imageLiteral(resourceName: "flag_qatar"),
"vn": #imageLiteral(resourceName: "flag_vietnam"),
"au": #imageLiteral(resourceName: "flag_australia"),
"la": #imageLiteral(resourceName: "flag_laos"),
"dm": #imageLiteral(resourceName: "flag_dominica"),
"tt": #imageLiteral(resourceName: "flag_trinidad_and_tobago"),
"mq": #imageLiteral(resourceName: "flag_martinique"),
"sv": #imageLiteral(resourceName: "flag_el_salvador"),
"mr": #imageLiteral(resourceName: "flag_mauritania"),
"pw": #imageLiteral(resourceName: "flag_palau"),
"be": #imageLiteral(resourceName: "flag_belgium"),
"ve": #imageLiteral(resourceName: "flag_venezuela"),
"as": #imageLiteral(resourceName: "flag_american_samoa"),
"zm": #imageLiteral(resourceName: "flag_zambia"),
"mx": #imageLiteral(resourceName: "flag_mexico"),
"jp": #imageLiteral(resourceName: "flag_japan"),
"th": #imageLiteral(resourceName: "flag_thailand"),
"za": #imageLiteral(resourceName: "flag_south_africa"),
"tg": #imageLiteral(resourceName: "flag_togo"),
"sr": #imageLiteral(resourceName: "flag_suriname"),
"pf": #imageLiteral(resourceName: "flag_french_polynesia"),
"dz": #imageLiteral(resourceName: "flag_algeria"),
"az": #imageLiteral(resourceName: "flag_azerbaijan"),
"bz": #imageLiteral(resourceName: "flag_belize"),
"at": #imageLiteral(resourceName: "flag_austria"),
"pr": #imageLiteral(resourceName: "flag_puerto_rico"),
"ec": #imageLiteral(resourceName: "flag_ecuador"),
"ws": #imageLiteral(resourceName: "flag_samoa"),
"ag": #imageLiteral(resourceName: "flag_antigua_and_barbuda"),
"ne": #imageLiteral(resourceName: "flag_niger"),
"si": #imageLiteral(resourceName: "flag_slovenia"),
"lr": #imageLiteral(resourceName: "flag_liberia"),
"wf": #imageLiteral(resourceName: "flag_wallis_and_futuna"),
"kg": #imageLiteral(resourceName: "flag_kyrgyzstan"),
"pm": #imageLiteral(resourceName: "flag_saint_pierre_and_miquelon"),
"bi": #imageLiteral(resourceName: "flag_burundi"),
"co": #imageLiteral(resourceName: "flag_colombia"),
"gu": #imageLiteral(resourceName: "flag_guam"),
"bw": #imageLiteral(resourceName: "flag_botswana"),
"sz": #imageLiteral(resourceName: "flag_swaziland"),
"im": #imageLiteral(resourceName: "flag_isle_of_man"),
"je": #imageLiteral(resourceName: "flag_jersey"),
"ki": #imageLiteral(resourceName: "flag_kiribati"),
"cr": #imageLiteral(resourceName: "flag_costa_rica"),
"bb": #imageLiteral(resourceName: "flag_barbados"),
"mn": #imageLiteral(resourceName: "flag_mongolia"),
"to": #imageLiteral(resourceName: "flag_tonga"),
"uk": #imageLiteral(resourceName: "flag_united_kingdom"),
"id": #imageLiteral(resourceName: "flag_indonesia"),
"ua": #imageLiteral(resourceName: "flag_ukraine"),
"kn": #imageLiteral(resourceName: "flag_saint_kitts_and_nevis"),
"gy": #imageLiteral(resourceName: "flag_guyana"),
"cn": #imageLiteral(resourceName: "flag_china"),
"cu": #imageLiteral(resourceName: "flag_cuba"),
"es": #imageLiteral(resourceName: "flag_spain"),
"no": #imageLiteral(resourceName: "flag_norway"),
"ht": #imageLiteral(resourceName: "flag_haiti"),
"al": #imageLiteral(resourceName: "flag_albania"),
"mz": #imageLiteral(resourceName: "flag_mozambique"),
"in": #imageLiteral(resourceName: "flag_india"),
"br": #imageLiteral(resourceName: "flag_brazil"),
"bj": #imageLiteral(resourceName: "flag_benin"),
"se": #imageLiteral(resourceName: "flag_sweden"),
"pe": #imageLiteral(resourceName: "flag_peru"),
"cf": #imageLiteral(resourceName: "flag_central_african_republic"),
"tz": #imageLiteral(resourceName: "flag_tanzania"),
"uy": #imageLiteral(resourceName: "flag_uruguay"),
"vu": #imageLiteral(resourceName: "flag_vanuatu"),
"my": #imageLiteral(resourceName: "flag_malaysia"),
"md": #imageLiteral(resourceName: "flag_moldova"),
"gt": #imageLiteral(resourceName: "flag_guatemala"),
"is": #imageLiteral(resourceName: "flag_iceland"),
"gr": #imageLiteral(resourceName: "flag_greece"),
"tw": #imageLiteral(resourceName: "flag_taiwan"),
"om": #imageLiteral(resourceName: "flag_oman"),
"pt": #imageLiteral(resourceName: "flag_portugal"),
"by": #imageLiteral(resourceName: "flag_belarus"),
"kw": #imageLiteral(resourceName: "flag_kuwait"),
"gl": #imageLiteral(resourceName: "flag_greenland"),
"td": #imageLiteral(resourceName: "flag_chad"),
"na": #imageLiteral(resourceName: "flag_namibia"),
"ee": #imageLiteral(resourceName: "flag_estonia"),
"ms": #imageLiteral(resourceName: "flag_montserrat"),
"mv": #imageLiteral(resourceName: "flag_maldives"),
"af": #imageLiteral(resourceName: "flag_afghanistan"),
"nc": #imageLiteral(resourceName: "flag_new_caledonia"),
"ga": #imageLiteral(resourceName: "flag_gabon"),
"mo": #imageLiteral(resourceName: "flag_macao"),
"ni": #imageLiteral(resourceName: "flag_nicaragua"),
"zw": #imageLiteral(resourceName: "flag_zimbabwe"),
"bm": #imageLiteral(resourceName: "flag_bermuda"),
"rs": #imageLiteral(resourceName: "flag_serbia"),
"cy": #imageLiteral(resourceName: "flag_cyprus"),
"ao": #imageLiteral(resourceName: "flag_angola"),
"py": #imageLiteral(resourceName: "flag_paraguay"),
"tv": #imageLiteral(resourceName: "flag_tuvalu"),
"mc": #imageLiteral(resourceName: "flag_monaco"),
"sm": #imageLiteral(resourceName: "flag_san_marino"),
"er": #imageLiteral(resourceName: "flag_eritrea"),
"bt": #imageLiteral(resourceName: "flag_bhutan"),
"ba": #imageLiteral(resourceName: "flag_bosnia_and_herzegovina"),
"sc": #imageLiteral(resourceName: "flag_seychelles"),
"mg": #imageLiteral(resourceName: "flag_madagascar"),
"st": #imageLiteral(resourceName: "flag_sao_tome_and_principe"),
"eg": #imageLiteral(resourceName: "flag_egypt"),
"ky": #imageLiteral(resourceName: "flag_cayman_islands"),
"ug": #imageLiteral(resourceName: "flag_uganda"),
"sy": #imageLiteral(resourceName: "flag_syria"),
"cm": #imageLiteral(resourceName: "flag_cameroon"),
"aq": #imageLiteral(resourceName: "flag_antarctica"),
"tn": #imageLiteral(resourceName: "flag_tunisia"),
"ge": #imageLiteral(resourceName: "flag_georgia"),
"it": #imageLiteral(resourceName: "flag_italy"),
"gq": #imageLiteral(resourceName: "flag_equatorial_guinea"),
"ca": #imageLiteral(resourceName: "flag_canada"),
"am": #imageLiteral(resourceName: "flag_armenia"),
"rw": #imageLiteral(resourceName: "flag_rwanda"),
"bf": #imageLiteral(resourceName: "flag_burkina_faso"),
"fo": #imageLiteral(resourceName: "flag_faroe_islands"),
"aw": #imageLiteral(resourceName: "flag_aruba"),
"fi": #imageLiteral(resourceName: "flag_finland"),
"lv": #imageLiteral(resourceName: "flag_latvia"),
"lt": #imageLiteral(resourceName: "flag_lithuania"),
"np": #imageLiteral(resourceName: "flag_nepal"),
"pg": #imageLiteral(resourceName: "flag_papua_new_guinea"),
"ad": #imageLiteral(resourceName: "flag_andorra"),
"me": #imageLiteral(resourceName: "flag_montenegro"),
"pa": #imageLiteral(resourceName: "flag_panama"),
"kh": #imageLiteral(resourceName: "flag_cambodia"),
"ma": #imageLiteral(resourceName: "flag_morocco"),
"lb": #imageLiteral(resourceName: "flag_lebanon"),
"tk": #imageLiteral(resourceName: "flag_tokelau"),
"nz": #imageLiteral(resourceName: "flag_new_zealand"),
"sd": #imageLiteral(resourceName: "flag_sudan"),
"hu": #imageLiteral(resourceName: "flag_hungary"),
"iq": #imageLiteral(resourceName: "flag_iraq"),
"hr": #imageLiteral(resourceName: "flag_croatia"),
"ch": #imageLiteral(resourceName: "flag_switzerland"),
"do": #imageLiteral(resourceName: "flag_dominican_republic"),
"mk": #imageLiteral(resourceName: "flag_macedonia"),
"ng": #imageLiteral(resourceName: "flag_nigeria"),
"lu": #imageLiteral(resourceName: "flag_luxembourg"),
"pk": #imageLiteral(resourceName: "flag_pakistan"),
"ro": #imageLiteral(resourceName: "flag_romania"),
"ar": #imageLiteral(resourceName: "flag_argentina"),
"de": #imageLiteral(resourceName: "flag_germany"),
"km": #imageLiteral(resourceName: "flag_comoros"),
"sk": #imageLiteral(resourceName: "flag_slovakia"),
"ke": #imageLiteral(resourceName: "flag_kenya"),
"ml": #imageLiteral(resourceName: "flag_mali"),
"ye": #imageLiteral(resourceName: "flag_yemen"),
"il": #imageLiteral(resourceName: "flag_israel"),
"ae": #imageLiteral(resourceName: "flag_united_arab_emirates"),
"eh": #imageLiteral(resourceName: "flag_western_sahara"),
"io": #imageLiteral(resourceName: "flag_british_indian_ocean_territory"),
"mw": #imageLiteral(resourceName: "flag_malawi"),
"lk": #imageLiteral(resourceName: "flag_sri_lanka"),
"bh": #imageLiteral(resourceName: "flag_bahrain"),
"nf": #imageLiteral(resourceName: "flag_norfolk_island"),
"kr": #imageLiteral(resourceName: "flag_south_korea"),
"uz":#imageLiteral(resourceName: "flag_uzbekistn"),
"ru":#imageLiteral(resourceName: "flag_russia"),
"en": #imageLiteral(resourceName: "flag_united_kingdom")
]
var defaultCountries = [
"Nepal", "Cambodia", "Philipinnes", "Sri Lanka", "Vietnam", "India", "Pakistan", "azerbaijan",
"Bangladesh", "Belarus", "Georgia", "Indonesia", "Kazakhstan", "Kyrgyzstan", "Malaysia", "Moldova",
"Mongolia", "Myanmar", "Russian Federation", "Singapore", "Tajikistan", "Thailand", "Uzbekistan"
]
var defaultCountryCodes = [
"np", "kh", "ph", "lk", "vn", "in", "pk", "az", "bd", "by", "ge", "kz", "kg", "my", "md", "mn", "mm",
"ru", "sg", "tj", "th", "uz", "en"
]
private var defaultSendingAmount: [String: String] =
[
"np" : "100000", // nepal
"kh" : "500", // cambodia
"ph" : "50000", // philipines
"lk" : "100,000", // sri lanka
"vn" : "50000000", // Vietnam
"in" : "50000", // india
"pk" : "100000", // pakistan
"az" : "1000", // azerbaijan
"bd" : "100000", // Bangladesh
"by" : "1000", // Belarus
"ge" : "1000", // Georgia
// "id" : "1000000", // indonesia
"kz" : "1000", // Kazakhstan
"kg" : "1000", // Kyrgyzstan
"my" : "10000", // Malaysia
"md" : "1000", // Moldova
"mn" : "1000", // Mongolia
"mm" : "1500000", // Myanmar
"ru" : "1000", // Russian Federation
"sg" : "2000", // Singapore
"tj" : "1000", // Tajikistan
"th" : "30000", // Thailand
"uz" : "1000", // Uzbekistan
"default": "1000000"
]
private var defaultSendingCurrency: [String: String] =
[
"np" : "NPR", // nepal
"kh" : "USD", // cambodia
"ph" : "PHP", // philipines
"lk" : "LKR", // sri lanka
"vn" : "VND", // vietnam
"in" : "INR", // india
"pk" : "PKR", // pakistan
"az" : "USD", // azerbaijan
"bd" : "USD", // Bangladesh
"by" : "USD", // Belarus
"ge" : "USD", // Georgia
"id" : "IDR", // Indonesia
"kz" : "USD", // Kazakhstan
"kg" : "USD", // Kyrgyzstan
"my" : "MYR", // Malaysia
"md" : "USD", // Moldova
"mn" : "USD", // Mongolia
"mm" : "MMK", // Myanmar
"ru" : "USD", // Russian Federation
"sg" : "SGD", // Singapore
"tj" : "USD", // Tajikistan
"th" : "THB", // Thailand
"uz" : "USD", // Uzbekistan
"default": "KRW"
]
private var secondarySendingCurrency: [String: String] =
[
"vn" : "USD", // vietnam
"mn" : "MNT", // Mongolia
"lk" : "USD" // sri lanka
]
private var secondarySendingAmount: [String: String] =
[
"vn" : "2000", // Vietnam
"lk" : "1000", // sri lanka
"mn" : "2000000" // Mongolia
]
func getFlag(for countryCode: String) -> UIImage? {
return flag[countryCode.lowercased()] ?? nil
}
func getDefaultSendingAmount(for countryCode: String) -> String? {
return defaultSendingAmount[countryCode.lowercased()]
}
func getDefaultSendingCurrency(for countryCode: String) -> String? {
return defaultSendingCurrency[countryCode.lowercased()]
}
func getDefaultSendingMoneyInKoreanWon() -> String? {
return defaultSendingAmount["default"]
}
func doesCountryCodeHasDefined(country: String, currency: String) -> Bool {
return defaultSendingCurrency[country.lowercased()]?.contains(currency) ?? false
}
func doesSecondaryOptiopsHasDefined(country: String, currency: String) -> Bool {
return secondarySendingCurrency[country.lowercased()]?.contains(currency) ?? false
}
func getSecondarySendingAmount(for countryCode: String) -> String? {
return secondarySendingAmount[countryCode.lowercased()]
}
private var secondarySendingCurrency: [String: String] =
[
"vn" : "USD", // vietnam
"mn" : "MNT", // Mongolia
"lk" : "USD", // sri lanka
]
private var secondarySendingAmount: [String: String] =
[
"vn" : "2000", // Vietnam
"lk" : "1000", // sri lanka
"mn" : "2000000", // Mongolia
]
func getFlag(for countryCode: String) -> UIImage? {
return flag[countryCode.lowercased()] ?? nil
}
func getDefaultSendingAmount(for countryCode: String) -> String? {
return defaultSendingAmount[countryCode.lowercased()]
}
func getDefaultSendingCurrency(for countryCode: String) -> String? {
return defaultSendingCurrency[countryCode.lowercased()]
}
func getDefaultSendingMoneyInKoreanWon() -> String? {
return defaultSendingAmount["default"]
}
func doesCountryCodeHasDefined(country: String, currency: String) -> Bool {
return defaultSendingCurrency[country.lowercased()]?.contains(currency) ?? false
}
func doesSecondaryOptiopsHasDefined(country: String, currency: String) -> Bool {
return secondarySendingCurrency[country.lowercased()]?.contains(currency) ?? false
}
func getSecondarySendingAmount(for countryCode: String) -> String? {
return secondarySendingAmount[countryCode.lowercased()]
}
}

6
GME Remit/Utilities/Database/UserDefaultsWrapper.swift

@ -6,10 +6,8 @@
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
protocol KeyProtocol: RawRepresentable, CaseIterable {}
class UserDefaultsWrapper<Keys: KeyProtocol> where Keys.RawValue == String {
func float(_ key: Keys) -> Float? {
return UserDefaults.standard.float(forKey: key.rawValue)
@ -97,7 +95,7 @@ extension UserDefaultsWrapper {
@discardableResult
func removeAll() -> Self {
Keys.allCases.forEach{
Keys.allCases.forEach {
UserDefaults.standard.removeObject(forKey: $0.rawValue)
}
return self
@ -115,7 +113,7 @@ extension UserDefaultsWrapper {
func debugPrintAllElement() -> Self {
print("\(Keys.self)'s All Elements")
Keys.allCases.forEach{
Keys.allCases.forEach {
print("\($0.rawValue): \(object($0) as Any)")
}
return self

5
GME Remit/Utilities/GMEAlert/GMEAlertViewController.swift

@ -84,14 +84,13 @@ class GMEAlertViewController: UIViewController {
}
@IBAction func touchRightButton(_ sender: UIButton) {
self.dismiss(animated: false){
self.dismiss(animated: false) {
self.rightButtonAction?()
}
}
@IBAction func touchLeftButton(_ sender: UIButton) {
self.dismiss(animated: false){
self.dismiss(animated: false) {
self.leftButtonAction?()
}
}

6
GME Remit/Utilities/HotLine/Application Logic/Service/HotLineService.swift

@ -9,7 +9,10 @@
import Foundation
class HotLineService: HotLineServiceType {
func fetchHotLines(success: @escaping (([HotLine]?) -> Void), failure: @escaping (Error) -> Void){
func fetchHotLines(
success: @escaping (([HotLine]?) -> Void),
failure: @escaping (Error) -> Void
) {
let testInput = """
{
@ -122,7 +125,6 @@ class HotLineService: HotLineServiceType {
}
"""
let hotLineContainer = HotLineContainer(JSONString: testInput)
success(hotLineContainer?.data)
}

13
GME Remit/Utilities/HotLine/User Interface/View/Cell/HotLineCell.swift

@ -65,7 +65,7 @@ class HotLineCell: UITableViewCell {
}
func setModel(_ model: HotLine?){
func setModel(_ model: HotLine?) {
remitPhoneNunmber = model?.remitPhoneNumber
remitFacebookURL = model?.remitFacebookURL
@ -77,14 +77,7 @@ class HotLineCell: UITableViewCell {
}
private func startCall(contactNumber: String){
if let url = URL(string: "tel://\(contactNumber.removeWhitespacesInBetween())"), UIApplication.shared.canOpenURL(url) {
if #available(iOS 10, *) {
UIApplication.shared.open(url)
} else {
UIApplication.shared.openURL(url)
}
}
private func startCall(contactNumber: String) {
UIApplication.tryURL(url: "tel://\(contactNumber.removeWhitespacesInBetween())")
}
}

5
GME Remit/Utilities/HotLine/User Interface/Wireframe/HotLineWireframe.swift

@ -33,7 +33,10 @@ extension HotLineWireframe: HotLineWireframeInput {
}
func openHotLineUsingPanModal(in source: UIViewController?) {
let vc = self.getMainView() as! HotLineViewController
guard let vc = self.getMainView() as? HotLineViewController else {
return
}
source?.presentPanModal(vc)
}
}

2
GME Remit/Utilities/HotLine/User Interface/Wireframe/HotLineWireframeInput.swift

@ -9,5 +9,5 @@
import Foundation
protocol HotLineWireframeInput: WireframeInput {
func openHotLineUsingPanModal(in source: UIViewController?)
func openHotLineUsingPanModal(in source: UIViewController?)
}

182
GME Remit/Utilities/ImageCroper.swift

@ -9,105 +9,111 @@ import Foundation
import RSKImageCropper
import Localize_Swift
protocol ImageCropperDelegate {
func didCropWith(image: UIImage)
func didFailedCropWith(error: Error)
protocol ImageCropperDelegate: class {
func didCropWith(image: UIImage)
func didFailedCropWith(error: Error)
}
class ImageCroper: NSObject {
var imageCropper: RSKImageCropViewController = RSKImageCropViewController()
weak var presentingViewController: UIViewController?
var delegate: ImageCropperDelegate?
fileprivate var cropRatio: CGFloat = 1
init(presentingViewController: UIViewController) {
super.init()
self.presentingViewController = presentingViewController
self.imageCropper.delegate = self
self.imageCropper.dataSource = self
}
func cropImage(image: UIImage, ratio: CGFloat = 1) {
self.cropRatio = ratio
self.imageCropper = RSKImageCropViewController(image: image, cropMode: .custom)
imageCropper.chooseButton.setTitle("done_text".localized(), for: .normal)
self.imageCropper.delegate = self
self.imageCropper.dataSource = self
self.presentingViewController?.present(imageCropper, animated: true, completion: nil)
}
var imageCropper: RSKImageCropViewController = RSKImageCropViewController()
weak var presentingViewController: UIViewController?
weak var delegate: ImageCropperDelegate?
fileprivate var cropRatio: CGFloat = 1
init(presentingViewController: UIViewController) {
super.init()
self.presentingViewController = presentingViewController
self.imageCropper.delegate = self
self.imageCropper.dataSource = self
}
func cropImage(image: UIImage, ratio: CGFloat = 1) {
self.cropRatio = ratio
self.imageCropper = RSKImageCropViewController(image: image, cropMode: .custom)
imageCropper.chooseButton.setTitle("done_text".localized(), for: .normal)
self.imageCropper.delegate = self
self.imageCropper.dataSource = self
self.presentingViewController?.present(imageCropper, animated: true, completion: nil)
}
}
extension ImageCroper: RSKImageCropViewControllerDelegate {
func imageCropViewControllerDidCancelCrop(_ controller: RSKImageCropViewController) {
presentingViewController?.dismiss(animated: true, completion: nil)
}
func imageCropViewController(_ controller: RSKImageCropViewController, didCropImage croppedImage: UIImage, usingCropRect cropRect: CGRect) {
presentingViewController?.dismiss(animated: true, completion: {
// image cropped here
self.delegate?.didCropWith(image: croppedImage)
})
}
func imageCropViewController(_ controller: RSKImageCropViewController, didCropImage croppedImage: UIImage, usingCropRect cropRect: CGRect, rotationAngle: CGFloat) {
self.delegate?.didCropWith(image: croppedImage)
self.imageCropper.dismiss(animated: true, completion: nil)
}
func imageCropViewControllerDidCancelCrop(_ controller: RSKImageCropViewController) {
presentingViewController?.dismiss(animated: true, completion: nil)
}
func imageCropViewController(
_ controller: RSKImageCropViewController,
didCropImage croppedImage: UIImage,
usingCropRect cropRect: CGRect
) {
presentingViewController?.dismiss(animated: true, completion: {
// image cropped here
self.delegate?.didCropWith(image: croppedImage)
})
}
func imageCropViewController(
_ controller: RSKImageCropViewController,
didCropImage croppedImage: UIImage,
usingCropRect cropRect: CGRect,
rotationAngle: CGFloat
) {
self.delegate?.didCropWith(image: croppedImage)
self.imageCropper.dismiss(animated: true, completion: nil)
}
}
extension ImageCroper: RSKImageCropViewControllerDataSource {
func imageCropViewControllerCustomMaskRect(_ controller: RSKImageCropViewController) -> CGRect {
guard let viewController = presentingViewController else {return CGRect.zero}
var maskSize:CGSize
let heightRatio: CGFloat = self.cropRatio //35/71
let maskWidth:CGFloat = UIScreen.main.bounds.size.width - 40
let maskHeight: CGFloat = CGFloat( ceilf( Float(maskWidth * heightRatio)))
func imageCropViewControllerCustomMaskRect(_ controller: RSKImageCropViewController) -> CGRect {
guard let viewController = presentingViewController else {return CGRect.zero}
var maskSize:CGSize
let heightRatio: CGFloat = self.cropRatio //35/71
let maskWidth:CGFloat = UIScreen.main.bounds.size.width - 40
let maskHeight: CGFloat = CGFloat( ceilf( Float(maskWidth * heightRatio)))
maskSize = CGSize(width: maskWidth, height: maskHeight)
let maskRect: CGRect = CGRect(x: (viewController.view.frame.size.width - maskSize.width ) * 0.5, y: (viewController.view.frame.size.height - maskSize.height) * 0.5, width: maskSize.width, height: maskSize.height)
return maskRect
}
maskSize = CGSize(width: maskWidth, height: maskHeight)
let maskRect = CGRect(
x: (viewController.view.frame.size.width - maskSize.width ) * 0.5,
y: (viewController.view.frame.size.height - maskSize.height) * 0.5,
width: maskSize.width,
height: maskSize.height
)
func imageCropViewControllerCustomMaskPath(_ controller: RSKImageCropViewController) -> UIBezierPath {
let rect = controller.maskRect;
let point1 = CGPoint(x: rect.minX,y: rect.minY);
let point2 = CGPoint(x: rect.maxX, y: rect.minY);
let point3 = CGPoint(x: rect.maxX, y: rect.maxY);
let point4 = CGPoint(x: rect.minX, y: rect.maxY);
let rectangle = UIBezierPath()
rectangle.move(to: point1)
rectangle.addLine(to: point2)
rectangle.addLine(to: point3)
rectangle.addLine(to: point4)
rectangle.close()
return rectangle;
}
return maskRect
}
func imageCropViewControllerCustomMaskPath(_ controller: RSKImageCropViewController) -> UIBezierPath {
let rect = controller.maskRect
func imageCropViewControllerCustomMovementRect(_ controller: RSKImageCropViewController) -> CGRect {
return controller.maskRect
}
let point1 = CGPoint(x: rect.minX,y: rect.minY)
let point2 = CGPoint(x: rect.maxX, y: rect.minY)
let point3 = CGPoint(x: rect.maxX, y: rect.maxY)
let point4 = CGPoint(x: rect.minX, y: rect.maxY)
let rectangle = UIBezierPath()
rectangle.move(to: point1)
rectangle.addLine(to: point2)
rectangle.addLine(to: point3)
rectangle.addLine(to: point4)
rectangle.close()
return rectangle;
}
func imageCropViewControllerCustomMovementRect(_ controller: RSKImageCropViewController) -> CGRect {
return controller.maskRect
}
}

4
GME Remit/Utilities/KeyChain.swift

@ -23,7 +23,7 @@ final class KeyChain {
static let shared = KeyChain()
private var keychain: Keychain
private init(){
private init() {
self.keychain = Keychain(service: "com.gme.gmeremit")
// There is no userId, it's logout or remove app all and reinstall app.
@ -32,7 +32,7 @@ final class KeyChain {
}
}
func save(data: String, key: KeyType){
func save(data: String, key: KeyType) {
do {
try self.keychain.set(data, key: key.rawValue)
} catch let error {

51
GME Remit/Utilities/ScrollableSegmentedControl.swift

@ -9,17 +9,19 @@
import UIKit
protocol ScrollableSegmentedControlDelegate: class {
func selectItemAt(index : Int, onScrollUISegmentController scrollUISegmentController: ScrollableSegmentedControl)
func selectItemAt(
index : Int,
onScrollUISegmentController scrollUISegmentController: ScrollableSegmentedControl
)
}
@IBDesignable
class ScrollableSegmentedControl: UIScrollView {
class ScrollableSegmentedControl: UIScrollView {
private var segmentedControl: UISegmentedControl = UISegmentedControl()
weak var segmentDelegate: ScrollableSegmentedControlDelegate?
@IBInspectable
public var segmentTintColor: UIColor = .black {
didSet {
@ -27,7 +29,6 @@ class ScrollableSegmentedControl: UIScrollView {
}
}
@IBInspectable
public var itemWidth: CGFloat = 150 {
didSet {
@ -36,13 +37,15 @@ class ScrollableSegmentedControl: UIScrollView {
public var segmentFont: UIFont = UIFont.systemFont(ofSize: 13) {
didSet {
self.segmentedControl.setTitleTextAttributes([NSAttributedString.Key.font: self.segmentFont],for: UIControl.State())
self.segmentedControl.setTitleTextAttributes(
[NSAttributedString.Key.font: self.segmentFont],
for: UIControl.State()
)
}
}
public var itemsCount: Int = 3
public var segmentheight : CGFloat = 29.0
public var segmentItems = [String]() {
didSet {
self.itemsCount = segmentItems.count
@ -73,7 +76,10 @@ class ScrollableSegmentedControl: UIScrollView {
let width = CGFloat(self.itemWidth * CGFloat(self.itemsCount))
self.segmentedControl = UISegmentedControl(frame: CGRect(x: 0 , y: 0, width: width , height: segmentheight))
self.segmentedControl = UISegmentedControl(
frame: CGRect(x: 0 , y: 0, width: width , height: segmentheight)
)
self.addSubview(self.segmentedControl)
self.backgroundColor = .clear
showsHorizontalScrollIndicator = false
@ -109,7 +115,6 @@ class ScrollableSegmentedControl: UIScrollView {
constant: 0
).isActive = true
NSLayoutConstraint(
item: self.segmentedControl,
attribute: NSLayoutConstraint.Attribute.trailing,
@ -120,7 +125,6 @@ class ScrollableSegmentedControl: UIScrollView {
constant: 0
).isActive = true
NSLayoutConstraint(
item: self.segmentedControl,
attribute: NSLayoutConstraint.Attribute.top,
@ -131,25 +135,42 @@ class ScrollableSegmentedControl: UIScrollView {
constant: 0
).isActive = true
let contentHeight = self.frame.height
self.contentSize = CGSize (width: width, height: contentHeight)
self.segmentedControl.setTitleTextAttributes([NSAttributedString.Key.font: self.segmentFont],for: UIControl.State())
self.segmentedControl.setTitleTextAttributes(
[NSAttributedString.Key.font: self.segmentFont],
for: UIControl.State()
)
self.segmentedControl.tintColor = self.segmentTintColor
insertItems()
self.segmentedControl.addTarget(self, action: #selector(self.segmentChangeSelectedIndex(_:)), for: .valueChanged)
self.segmentedControl.addTarget(
self,
action: #selector(self.segmentChangeSelectedIndex(_:)),
for: .valueChanged
)
self.segmentedControl.selectedSegmentIndex = 0;
}
func insertItems(){
func insertItems() {
for item in segmentItems {
self.segmentedControl.insertSegment(withTitle: item, at: (segmentItems.firstIndex(of: item))!, animated: false)
self.segmentedControl.insertSegment(
withTitle: item,
at: (segmentItems.firstIndex(of: item))!,
animated: false
)
}
}
@objc func segmentChangeSelectedIndex(_ sender: AnyObject) {
segmentDelegate?.selectItemAt(index: self.segmentedControl.selectedSegmentIndex, onScrollUISegmentController: self)
segmentDelegate?.selectItemAt(
index: self.segmentedControl.selectedSegmentIndex,
onScrollUISegmentController: self
)
print("\(self.segmentedControl.selectedSegmentIndex)")
}
}

56
GME Remit/Utilities/SearchAddress/Application Logic/Interactor/SearchAddressInteractor.swift

@ -9,37 +9,39 @@
import Foundation
class SearchAddressInteractor {
// MARK: Properties
weak var output: SearchAddressInteractorOutput?
private let service: SearchAddressServiceType
// MARK: Initialization
init(service: SearchAddressServiceType) {
self.service = service
}
// MARK: Converting entities
// MARK: Properties
weak var output: SearchAddressInteractorOutput?
private let service: SearchAddressServiceType
// MARK: Initialization
init(service: SearchAddressServiceType) {
self.service = service
}
// MARK: Converting entities
}
// MARK: AddressSearch interactor input interface
extension SearchAddressInteractor: SearchAddressInteractorInput {
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
) {
self.service.fetchAddress(
pageIndex: pageIndex,
interval: interval,
keyword: keyword,
success: {
self.output?.setJusoModel(with: $0)
}){
self.output?.failure(with: $0)
}
}
self.service.fetchAddress(
pageIndex: pageIndex,
interval: interval,
keyword: keyword,
success: {
self.output?.setJusoModel(with: $0)
},
failure: {
self.output?.failure(with: $0)
}
)
}
}

14
GME Remit/Utilities/SearchAddress/Application Logic/Interactor/SearchAddressInteractorIO.swift

@ -7,14 +7,14 @@
//
protocol SearchAddressInteractorInput: class {
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
)
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
)
}
protocol SearchAddressInteractorOutput: class {
func setJusoModel(with model: JusoResult?)
func failure(with error: Error)
func setJusoModel(with model: JusoResult?)
func failure(with error: Error)
}

84
GME Remit/Utilities/SearchAddress/Application Logic/Model/Juso.swift

@ -10,47 +10,47 @@ import Foundation
import ObjectMapper
class Juso: Mappable {
var roadAddr: String?
var jibunAddr: String?
var zipNo: String?
var admCd: String?
var rnMgtSn: String?
var bdKdcd: String?
var siNm: String?
var sggNm: String?
var emdNm: String?
var liNm: String?
var rn: String?
var udrtYn: String?
var buldMnnm: String?
var buldSlno: String?
var mtYn: String?
var lnbrMnnm: String?
var lnbrSlno: String?
var korAddr: String?
var roadAddr: String?
var jibunAddr: String?
var zipNo: String?
var admCd: String?
var rnMgtSn: String?
var bdKdcd: String?
var siNm: String?
var sggNm: String?
var emdNm: String?
var liNm: String?
var rn: String?
var udrtYn: String?
var buldMnnm: String?
var buldSlno: String?
var mtYn: String?
var lnbrMnnm: String?
var lnbrSlno: String?
var korAddr: String?
required init?(map: Map) {
required init?(map: Map) {
}
func mapping(map: Map) {
self.roadAddr <- map["roadAddr"]
self.jibunAddr <- map["jibunAddr"]
self.zipNo <- map["zipNo"]
self.admCd <- map["admCd"]
self.rnMgtSn <- map["rnMgtSn"]
self.bdKdcd <- map["bdKdcd"]
self.siNm <- map["siNm"]
self.sggNm <- map["sggNm"]
self.emdNm <- map["emdNm"]
self.liNm <- map["liNm"]
self.rn <- map["rn"]
self.udrtYn <- map["udrtYn"]
self.buldMnnm <- map["buldMnnm"]
self.buldSlno <- map["buldSlno"]
self.mtYn <- map["mtYn"]
self.lnbrMnnm <- map["lnbrMnnm"]
self.lnbrSlno <- map["lnbrSlno"]
self.korAddr <- map["korAddr"]
}
}
func mapping(map: Map) {
self.roadAddr <- map["roadAddr"]
self.jibunAddr <- map["jibunAddr"]
self.zipNo <- map["zipNo"]
self.admCd <- map["admCd"]
self.rnMgtSn <- map["rnMgtSn"]
self.bdKdcd <- map["bdKdcd"]
self.siNm <- map["siNm"]
self.sggNm <- map["sggNm"]
self.emdNm <- map["emdNm"]
self.liNm <- map["liNm"]
self.rn <- map["rn"]
self.udrtYn <- map["udrtYn"]
self.buldMnnm <- map["buldMnnm"]
self.buldSlno <- map["buldSlno"]
self.mtYn <- map["mtYn"]
self.lnbrMnnm <- map["lnbrMnnm"]
self.lnbrSlno <- map["lnbrSlno"]
self.korAddr <- map["korAddr"]
}
}

16
GME Remit/Utilities/SearchAddress/Application Logic/Model/JusoContainer.swift

@ -10,13 +10,13 @@ import Foundation
import ObjectMapper
class JusoContainer: Mappable {
var results: JusoResult?
var results: JusoResult?
required init?(map: Map) {
required init?(map: Map) {
}
func mapping(map: Map) {
self.results <- map["results"]
}
}
func mapping(map: Map) {
self.results <- map["results"]
}
}

20
GME Remit/Utilities/SearchAddress/Application Logic/Model/JusoResult.swift

@ -10,15 +10,15 @@ import Foundation
import ObjectMapper
class JusoResult: Mappable {
var common: JusoCommon?
var juso: [Juso]?
var common: JusoCommon?
var juso: [Juso]?
required init?(map: Map) {
required init?(map: Map) {
}
func mapping(map: Map) {
self.common <- map["common"]
self.juso <- map["juso"]
}
}
func mapping(map: Map) {
self.common <- map["common"]
self.juso <- map["juso"]
}
}

76
GME Remit/Utilities/SearchAddress/Application Logic/Service/SearchAddressService.swift

@ -10,45 +10,47 @@ import Foundation
import Alamofire
class SearchAddressService: SearchAddressServiceType {
// MARK: Properties
// MARK: Initialization
// MARK: Data management
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String,
success: @escaping (JusoResult?) -> Void,
failure: @escaping (Error) -> Void
) {
// MARK: Properties
let params = [
"confmKey":"U01TX0FVVEgyMDE5MDQyMjE2MzU1NzEwODY3MjA=",
"currentPage":"\(pageIndex)",
"countPerPage":"\(interval)",
"keyword":"\(keyword)",
"resultType": "json"
]
let url = "http://www.juso.go.kr/addrlink/addrEngApi.do"
// MARK: Initialization
// MARK: Data management
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String,
success: @escaping (JusoResult?) -> Void,
failure: @escaping (Error) -> Void
){
let params = [
"confmKey":"U01TX0FVVEgyMDE5MDQyMjE2MzU1NzEwODY3MjA=",
"currentPage":"\(pageIndex)",
"countPerPage":"\(interval)",
"keyword":"\(keyword)",
"resultType": "json"
]
let url = "http://www.juso.go.kr/addrlink/addrEngApi.do"
Alamofire.request(
url,
method: .get,
parameters: params,
encoding: URLEncoding.default
)
.handle(success: {(response: JusoContainer?) in
if (response?.results?.common?.errorCode ?? "") != "0" {
let error = NSError.init(domain: "Search Address", code: 0, userInfo: [NSLocalizedDescriptionKey : response?.results?.common?.errorMessage ?? ""])
failure(error)
}
Alamofire.request(
url,
method: .get,
parameters: params,
encoding: URLEncoding.default
)
.handle(success: {(response: JusoContainer?) in
if (response?.results?.common?.errorCode ?? "") != "0" {
let error = NSError.init(domain: "Search Address", code: 0, userInfo: [NSLocalizedDescriptionKey : response?.results?.common?.errorMessage ?? ""])
failure(error)
}
success(response?.results)
}){
success(response?.results)
},
failure: {
failure($0)
}
}
}
)
}
}

14
GME Remit/Utilities/SearchAddress/Application Logic/Service/SearchAddressServiceType.swift

@ -9,11 +9,11 @@
import Foundation
protocol SearchAddressServiceType: class {
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String,
success: @escaping (JusoResult?) -> Void,
failure: @escaping (Error) -> Void
)
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String,
success: @escaping (JusoResult?) -> Void,
failure: @escaping (Error) -> Void
)
}

10
GME Remit/Utilities/SearchAddress/Module Interface/SearchAddressModuleInterface.swift

@ -7,9 +7,9 @@
//
protocol SearchAddressModuleInterface: class {
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
)
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
)
}

48
GME Remit/Utilities/SearchAddress/User Interface/Presenter/SearchAddressPresenter.swift

@ -9,39 +9,39 @@
import Foundation
class SearchAddressPresenter {
// MARK: Properties
weak var view: SearchAddressViewInterface?
var interactor: SearchAddressInteractorInput?
var wireframe: SearchAddressWireframeInput?
// MARK: Converting entities
// MARK: Properties
weak var view: SearchAddressViewInterface?
var interactor: SearchAddressInteractorInput?
var wireframe: SearchAddressWireframeInput?
// MARK: Converting entities
}
// MARK: AddressSearch module interface
extension SearchAddressPresenter: SearchAddressModuleInterface {
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
func fetchAddress(
pageIndex: Int,
interval: Int,
keyword: String
) {
self.view?.startLoading()
self.interactor?.fetchAddress(pageIndex: pageIndex, interval: interval, keyword: keyword)
}
self.view?.startLoading()
self.interactor?.fetchAddress(pageIndex: pageIndex, interval: interval, keyword: keyword)
}
}
// MARK: AddressSearch interactor output interface
extension SearchAddressPresenter: SearchAddressInteractorOutput {
func setJusoModel(with model: JusoResult?) {
self.view?.endLoading()
self.view?.setJusoModel(with: model)
}
func failure(with error: Error) {
self.view?.endLoading()
self.view?.failure(with: error)
}
func setJusoModel(with model: JusoResult?) {
self.view?.endLoading()
self.view?.setJusoModel(with: model)
}
func failure(with error: Error) {
self.view?.endLoading()
self.view?.failure(with: error)
}
}

9
GME Remit/Utilities/SearchAddress/User Interface/View/SearchAddressViewController.swift

@ -47,7 +47,7 @@ class SearchAddressViewController: UIViewController {
private var isSearch = false
private var searchedText = "" {
didSet{
didSet {
self.presenter?.fetchAddress(
pageIndex: self.pageIndex,
interval: self.interval,
@ -149,7 +149,11 @@ extension SearchAddressViewController: UITableViewDataSource {
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "AddressTableViewCell") as! AddressTableViewCell
guard let cell = tableView.dequeueReusableCell(
withIdentifier: "AddressTableViewCell"
) as? AddressTableViewCell else {
return UITableViewCell()
}
cell.setModel(with: self.jusoList[indexPath.row])
@ -159,7 +163,6 @@ extension SearchAddressViewController: UITableViewDataSource {
extension SearchAddressViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//TODO : if selected, return Juso model to parent
self.delegate?.searchAddress(viewController: self, selectedJuso: self.jusoList[indexPath.row])
}

10
GME Remit/Utilities/SearchAddress/User Interface/View/SearchAddressViewInterface.swift

@ -7,9 +7,9 @@
//
protocol SearchAddressViewInterface: class {
func setJusoModel(with model: JusoResult?)
func failure(with error: Error)
func startLoading()
func endLoading()
func setJusoModel(with model: JusoResult?)
func failure(with error: Error)
func startLoading()
func endLoading()
}

64
GME Remit/Utilities/SearchAddress/User Interface/Wireframe/SearchAddressWireframe.swift

@ -9,42 +9,42 @@
import UIKit
class SearchAddressWireframe {
weak var view: UIViewController!
weak var view: UIViewController!
}
extension SearchAddressWireframe: SearchAddressWireframeInput {
var storyboardName: String {return "SearchAddress"}
func getMainView() -> UIViewController {
let service = SearchAddressService()
let interactor = SearchAddressInteractor(service: service)
let presenter = SearchAddressPresenter()
let viewController = viewControllerFromStoryboard(of: SearchAddressViewController.self)
var storyboardName: String {return "SearchAddress"}
viewController.presenter = presenter
interactor.output = presenter
presenter.interactor = interactor
presenter.wireframe = self
presenter.view = viewController
func getMainView() -> UIViewController {
let service = SearchAddressService()
let interactor = SearchAddressInteractor(service: service)
let presenter = SearchAddressPresenter()
let viewController = viewControllerFromStoryboard(of: SearchAddressViewController.self)
viewController.presenter = presenter
interactor.output = presenter
presenter.interactor = interactor
presenter.wireframe = self
presenter.view = viewController
self.view = viewController
return viewController
}
self.view = viewController
return viewController
}
func openViewControllerWithNavigationWithDelegate(
delegate: SearchAddressDelegate,
viewController: UIViewController,
source: UIViewController
) {
func openViewControllerWithNavigationWithDelegate(
delegate: SearchAddressDelegate,
viewController: UIViewController,
source: UIViewController
) {
let viewController = self.getMainView()
(viewController as? SearchAddressViewController)?.delegate = delegate
self.openViewControllerWithNavigation(
viewController: viewController,
source: source
)
}
let viewController = self.getMainView()
(viewController as? SearchAddressViewController)?.delegate = delegate
self.openViewControllerWithNavigation(
viewController: viewController,
source: source
)
}
}

10
GME Remit/Utilities/SearchAddress/User Interface/Wireframe/SearchAddressWireframeInput.swift

@ -9,9 +9,9 @@
import Foundation
protocol SearchAddressWireframeInput: WireframeInput {
func openViewControllerWithNavigationWithDelegate(
delegate: SearchAddressDelegate,
viewController: UIViewController,
source: UIViewController
)
func openViewControllerWithNavigationWithDelegate(
delegate: SearchAddressDelegate,
viewController: UIViewController,
source: UIViewController
)
}

16
GME Remit/Utilities/SecureKeypad.swift

@ -59,8 +59,8 @@ class SecureKeypad: NSObject {
deinit {
self.asciiKeypad.mTK_ClearDelegateSubviews()
self.numberPad.mTK_ClearDelegateSubviews()
self.asciiKeypad.delegate = nil;
self.numberPad.delegate = nil;
self.asciiKeypad.delegate = nil
self.numberPad.delegate = nil
}
func present(animated: Bool, completion: (() -> Void)? = nil) {
@ -87,20 +87,17 @@ class SecureKeypad: NSObject {
}
}
private func initKeypad(){
private func initKeypad() {
switch self.keypadType {
case .ascii:
self.initASCIIKeypad()
self.updateASCIIUI()
case.numberic:
//TODO: Numberic keypad
self.initNumberKeypad()
self.updateNumber()
break
}
}
/// init ASCII keypad
private func initASCIIKeypad() {
asciiKeypad.mTK_Init(self)
@ -137,7 +134,7 @@ class SecureKeypad: NSObject {
)
}
private func initNumberKeypad(){
private func initNumberKeypad() {
numberPad.mTK_Init(self)
numberPad.delegate = self
numberPad.mTK_MakeSecureKey()
@ -151,7 +148,7 @@ class SecureKeypad: NSObject {
numberPad.mTK_Supported(byDeviceOrientation: SupportedByDevicePortraitAndLandscape)
}
private func updateNumber(){
private func updateNumber() {
numberPad.mTK_SetHint(self.placeholder, font: self.placeholderFont)
numberPad.setKeyboardType(
self,
@ -187,8 +184,7 @@ extension SecureKeypad: TransKeyViewDelegate {
self.encryptedString = ""
}
vc.dismiss(animated: true){
vc.dismiss(animated: true) {
self.delegate?.didComplete(self.encryptedString, length: self.decryptedLength)
}
}

32
GME Remit/Utilities/TablePresenter/User Interface/View/TablePresenterViewController.swift

@ -76,7 +76,7 @@ class TablePresenterViewController: UIViewController {
// MARK: IBActions
@IBAction func touchCloseButton(_ sender: UIButton) {
mainView.originToBottom() {
mainView.originToBottom {
self.dismiss(animated: true)
}
}
@ -110,7 +110,7 @@ extension TablePresenterViewController {
presenter?.fetchModel()
}
private func setConfiguration(){
private func setConfiguration() {
let configuration = delegate?.tablePresenterView(self)
titleLabel.text = configuration?.presenterTitle
@ -127,7 +127,6 @@ extension TablePresenterViewController {
}
}
// MARK: - UITableViewDataSource
extension TablePresenterViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
@ -153,18 +152,13 @@ extension TablePresenterViewController: UITableViewDataSource {
// MARK: - UITableViewDelegate
extension TablePresenterViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
mainView.originToBottom() {[weak self] in guard let `self` = self else { return }
mainView.originToBottom {[weak self] in guard let `self` = self else { return }
self.delegate?.tablePresenterView(self, didSelectModel: self.model?[indexPath.row])
self.dismiss(animated: true)
}
}
// func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
// (cell as? TableCell)?.optimizeCell()
// }
}
// MARK: - UIGestureRecognizerDelegate
extension TablePresenterViewController: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
@ -179,23 +173,3 @@ extension TablePresenterViewController: UISearchBarDelegate {
presenter?.filterModel(word: searchText)
}
}
// Don't Use Dynamic Height
// @IBOutlet weak var height: NSLayoutConstraint!
//
// private func setHeight(){
// guard let model = model else { return }
//
// dynamicHeight = CGFloat(153 + 44 * (model.count + 1))
//
// if dynamicHeight < view.frame.height * 0.5 {
// dynamicHeight = view.frame.height * 0.5
// } else if dynamicHeight > view.frame.height * 0.8 {
// dynamicHeight = view.frame.height * 0.8
// }
//
// if height != nil {
// height.constant = dynamicHeight
// }
//}

2
GME Remit/Utilities/TablePresenter/User Interface/Wireframe/TablePresenterWireframe.swift

@ -10,7 +10,7 @@ import UIKit
class TablePresenterWireframe {
weak var view: UIViewController!
private var delegate: TablePresenterDelegate?
private weak var delegate: TablePresenterDelegate?
private var model: [TablePresenterProtocol]?
}

31
GME Remit/Utilities/WebLinks/WkWebView/WkWebViewController.swift

@ -65,7 +65,6 @@ class WkWebViewController: UIViewController {
}
extension WkWebViewController: WKUIDelegate, WKNavigationDelegate {
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
print("start")
@ -78,20 +77,31 @@ extension WkWebViewController: WKUIDelegate, WKNavigationDelegate {
self.navigationItem.title = webView.title
}
func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
let alertController = UIAlertController(title: message, message: nil,
preferredStyle: UIAlertController.Style.alert);
func webView(
_ webView: WKWebView,
runJavaScriptAlertPanelWithMessage message: String,
initiatedByFrame frame: WKFrameInfo,
completionHandler: @escaping () -> Void
) {
let alertController = UIAlertController(
title: message,
message: nil,
preferredStyle: UIAlertController.Style.alert
)
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel) {
_ in completionHandler()}
);
alertController.addAction(
UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel) { _ in completionHandler()}
)
self.present(alertController, animated: true, completion: {});
self.present(alertController, animated: true, completion: nil)
}
}
extension WkWebViewController: WKScriptMessageHandler {
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
extension WkWebViewController: WKScriptMessageHandler {
func userContentController(
_ userContentController: WKUserContentController,
didReceive message: WKScriptMessage
) {
print(message.name)
if let body = message.body as? String {
self.alertWithOk(
@ -101,4 +111,3 @@ extension WkWebViewController: WKScriptMessageHandler {
}
}
}
Loading…
Cancel
Save