From 8e77122497be91e8d0463b8ca1d6d5b8f58cddf8 Mon Sep 17 00:00:00 2001 From: InKwon James Kim Date: Fri, 26 Jul 2019 18:42:49 +0900 Subject: [PATCH] new registration --- GME Remit.xcodeproj/project.pbxproj | 4 + GMERemittance/Model/NativeCountry.swift | 1286 +++++++++++++++++ .../Model/RegisterRequestModel.swift | 58 +- .../View/HomeViewController.swift | 2 +- .../Wireframe/LauncherScreenWireframe.swift | 2 +- .../View/LoginViewController.swift | 2 +- .../Interactor/KycInteractor.swift | 66 +- .../Interactor/KycInteractorIO.swift | 2 +- .../Module Interface/KycModuleInterface.swift | 3 +- .../Presenter/KycPresenter.swift | 50 +- .../View/KycViewController.swift | 10 +- .../View/KycViewInterface.swift | 1 - .../Wireframe/KycWireframe.swift | 12 - .../Wireframe/KycWireframeInput.swift | 1 - .../User Interface/View/kycForm1.storyboard | 209 ++- .../View/kycForm1ViewController.swift | 70 +- .../View/PennyTestViewController.swift | 16 +- .../View/PennyTestSubmitViewController.swift | 26 +- .../Interactor/RegisterInteractor.swift | 83 -- .../User Interface/View/Register.storyboard | 359 ++--- .../View/RegisterViewController.swift | 533 ++++--- .../SendMoneyVerificationViewController.swift | 2 +- GMERemittance/Utility/Database/GMEDB.swift | 2 - GMERemittance/Utility/SecureKeypad.swift | 9 +- .../User Interface/View/Cell/TableCell.swift | 16 +- .../View/TablePresenterViewController.swift | 7 +- .../Classes/ValidationTextField.swift | 2 +- en.lproj/Localizable.strings | 5 + 28 files changed, 1916 insertions(+), 922 deletions(-) create mode 100644 GMERemittance/Model/NativeCountry.swift diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj index c2ec1631..f514ec8a 100644 --- a/GME Remit.xcodeproj/project.pbxproj +++ b/GME Remit.xcodeproj/project.pbxproj @@ -209,6 +209,7 @@ 73469FA12293C1B00062946B /* PaymentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73469F952293C1AF0062946B /* PaymentCell.swift */; }; 73469FA22293C1B00062946B /* SelectPaymentViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73469F962293C1AF0062946B /* SelectPaymentViewInterface.swift */; }; 73469FA32293C1B00062946B /* SelectPayment.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73469F972293C1AF0062946B /* SelectPayment.storyboard */; }; + 7347367122EACCBA00D0219D /* NativeCountry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7347367022EACCBA00D0219D /* NativeCountry.swift */; }; 736A8C402277EB2A00337A50 /* BiometricAuthenticationNotificationModuleInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736A8C2D2277EB2900337A50 /* BiometricAuthenticationNotificationModuleInterface.swift */; }; 736A8C412277EB2A00337A50 /* BiometricAuthenticationNotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736A8C312277EB2900337A50 /* BiometricAuthenticationNotificationService.swift */; }; 736A8C422277EB2A00337A50 /* BiometricAuthenticationNotificationServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736A8C322277EB2900337A50 /* BiometricAuthenticationNotificationServiceType.swift */; }; @@ -2406,6 +2407,7 @@ 73469F952293C1AF0062946B /* PaymentCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PaymentCell.swift; sourceTree = ""; }; 73469F962293C1AF0062946B /* SelectPaymentViewInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectPaymentViewInterface.swift; sourceTree = ""; }; 73469F972293C1AF0062946B /* SelectPayment.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = SelectPayment.storyboard; sourceTree = ""; }; + 7347367022EACCBA00D0219D /* NativeCountry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = NativeCountry.swift; path = GMERemittance/Model/NativeCountry.swift; sourceTree = SOURCE_ROOT; }; 736A8C2D2277EB2900337A50 /* BiometricAuthenticationNotificationModuleInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BiometricAuthenticationNotificationModuleInterface.swift; sourceTree = ""; }; 736A8C312277EB2900337A50 /* BiometricAuthenticationNotificationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BiometricAuthenticationNotificationService.swift; sourceTree = ""; }; 736A8C322277EB2900337A50 /* BiometricAuthenticationNotificationServiceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BiometricAuthenticationNotificationServiceType.swift; sourceTree = ""; }; @@ -10589,6 +10591,7 @@ D962231C212C123600B7A115 /* Model */ = { isa = PBXGroup; children = ( + 7347367022EACCBA00D0219D /* NativeCountry.swift */, D962231D212C126500B7A115 /* ExchangeModel.swift */, D9E57944212E938D00D47AC0 /* ExchangeRateDetailModel.swift */, D95B5E4821314D31000C0B33 /* GmeContacts.swift */, @@ -13955,6 +13958,7 @@ D95B5E3921311057000C0B33 /* GmeContactsModuleInterface.swift in Sources */, 7313872322E68F4C0095ACEB /* ScrollableSegmentedControl.swift in Sources */, D9CB4977213290B200B7A124 /* SendMoneyTransFerReasonViewModel.swift in Sources */, + 7347367122EACCBA00D0219D /* NativeCountry.swift in Sources */, D922D98921351AAE00D43053 /* SendMoneyExchangeRatePresenter.swift in Sources */, 736A8C472277EB2A00337A50 /* BiometricAuthenticationNotificationWireframe.swift in Sources */, 730D7891227A94E1007E517E /* RewardWireframe.swift in Sources */, diff --git a/GMERemittance/Model/NativeCountry.swift b/GMERemittance/Model/NativeCountry.swift new file mode 100644 index 00000000..6541c501 --- /dev/null +++ b/GMERemittance/Model/NativeCountry.swift @@ -0,0 +1,1286 @@ +// +// NativeCountry.swift +// GME Remit +// +// Created by InKwon James Kim on 26/07/2019. +// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. +// + +import ObjectMapper + +struct StaticModels { + private let nativeCountryOrigin = NativeCountryContainer(JSONString: countries) + + let nativeCountries: [NativeCountryModel] + + init(){ + nativeCountries = nativeCountryOrigin!.nativeCountries + } +} + + +struct NativeCountryContainer: Mappable { + var nativeCountries = [NativeCountryModel]() + + init?(map: Map) { } + + mutating func mapping(map: Map) { + nativeCountries <- map["NativeCountry"] + } +} + +struct NativeCountryModel: Mappable, TablePresenterProtocol { + var id: String = "" + var text: String = "" + var code: String = "" + + var cellTitle: String? { + return text + } + + var cellImage: UIImage? { + return CountryEnum(rawValue: code.lowercased())?.flag ?? #imageLiteral(resourceName: "flag_default") + } + + init?(map: Map) {} + + mutating func mapping(map: Map) { + id <- map["id"] + text <- map["text"] + code <- map["code"] + } +} + +fileprivate let countries = +""" +{ +"NativeCountry":[ +{ +"id":"2", +"text":"Afghanistan", +"code":"AF" +}, +{ +"id":"75", +"text":"Åland Islands", +"code":"AX" +}, +{ +"id":"3", +"text":"Albania", +"code":"AL" +}, +{ +"id":"5", +"text":"Algeria", +"code":"DZ" +}, +{ +"id":"6", +"text":"American Samoa", +"code":"AS" +}, +{ +"id":"7", +"text":"Andorra", +"code":"AD" +}, +{ +"id":"8", +"text":"Angola", +"code":"AO" +}, +{ +"id":"189", +"text":"Anguilla", +"code":"AI" +}, +{ +"id":"4", +"text":"Antarctica", +"code":"AQ" +}, +{ +"id":"9", +"text":"Antigua and Barbuda", +"code":"AG" +}, +{ +"id":"11", +"text":"Argentina", +"code":"AR" +}, +{ +"id":"17", +"text":"Armenia", +"code":"AM" +}, +{ +"id":"154", +"text":"Aruba", +"code":"AW" +}, +{ +"id":"12", +"text":"Australia", +"code":"AU" +}, +{ +"id":"13", +"text":"Austria", +"code":"AT" +}, +{ +"id":"10", +"text":"Azerbaijan", +"code":"AZ" +}, +{ +"id":"14", +"text":"Bahamas", +"code":"BS" +}, +{ +"id":"15", +"text":"Bahrain", +"code":"BH" +}, +{ +"id":"16", +"text":"Bangladesh", +"code":"BD" +}, +{ +"id":"18", +"text":"Barbados", +"code":"BB" +}, +{ +"id":"35", +"text":"Belarus", +"code":"BY" +}, +{ +"id":"19", +"text":"Belgium", +"code":"BE" +}, +{ +"id":"27", +"text":"Belize", +"code":"BZ" +}, +{ +"id":"60", +"text":"Benin", +"code":"BJ" +}, +{ +"id":"20", +"text":"Bermuda", +"code":"BM" +}, +{ +"id":"21", +"text":"Bhutan", +"code":"BT" +}, +{ +"id":"22", +"text":"Bolivia", +"code":"BO" +}, +{ +"id":"23", +"text":"Bosnia and Herzegovina", +"code":"BA" +}, +{ +"id":"24", +"text":"Botswana", +"code":"BW" +}, +{ +"id":"25", +"text":"Bouvet Island", +"code":"BV" +}, +{ +"id":"26", +"text":"Brazil", +"code":"BR" +}, +{ +"id":"28", +"text":"British Indian Ocean Territory", +"code":"IO" +}, +{ +"id":"31", +"text":"Brunei", +"code":"BN" +}, +{ +"id":"32", +"text":"Bulgaria", +"code":"BG" +}, +{ +"id":"240", +"text":"Burkina Faso", +"code":"BF" +}, +{ +"id":"34", +"text":"Burundi", +"code":"BI" +}, +{ +"id":"36", +"text":"Cambodia", +"code":"KH" +}, +{ +"id":"37", +"text":"Cameroon", +"code":"CM" +}, +{ +"id":"38", +"text":"Canada", +"code":"CA" +}, +{ +"id":"39", +"text":"Cape Verde", +"code":"CV" +}, +{ +"id":"40", +"text":"Cayman Islands", +"code":"KY" +}, +{ +"id":"41", +"text":"Central African Republic", +"code":"CF" +}, +{ +"id":"43", +"text":"Chad", +"code":"TD" +}, +{ +"id":"44", +"text":"Chile", +"code":"CL" +}, +{ +"id":"45", +"text":"China", +"code":"CN" +}, +{ +"id":"47", +"text":"Christmas Island", +"code":"CX" +}, +{ +"id":"48", +"text":"Cocos (Keeling) Islands", +"code":"CC" +}, +{ +"id":"49", +"text":"Colombia", +"code":"CO" +}, +{ +"id":"50", +"text":"Comoros", +"code":"KM" +}, +{ +"id":"52", +"text":"Congo", +"code":"CG" +}, +{ +"id":"53", +"text":"Congo, Democratic Republic of the", +"code":"CD" +}, +{ +"id":"54", +"text":"Cook Islands", +"code":"CK" +}, +{ +"id":"55", +"text":"Costa Rica", +"code":"CR" +}, +{ +"id":"111", +"text":"Côte d'Ivoire", +"code":"CI" +}, +{ +"id":"56", +"text":"Croatia", +"code":"HR" +}, +{ +"id":"57", +"text":"Cuba", +"code":"CU" +}, +{ +"id":"58", +"text":"Cyprus", +"code":"CY" +}, +{ +"id":"59", +"text":"Czech Republic", +"code":"CZ" +}, +{ +"id":"61", +"text":"Denmark", +"code":"DK" +}, +{ +"id":"80", +"text":"Djibouti", +"code":"DJ" +}, +{ +"id":"62", +"text":"Dominica", +"code":"DM" +}, +{ +"id":"63", +"text":"Dominican Republic", +"code":"DO" +}, +{ +"id":"64", +"text":"Ecuador", +"code":"EC" +}, +{ +"id":"232", +"text":"Egypt", +"code":"EG" +}, +{ +"id":"65", +"text":"El Salvador", +"code":"SV" +}, +{ +"id":"66", +"text":"Equatorial Guinea", +"code":"GQ" +}, +{ +"id":"68", +"text":"Eritrea", +"code":"ER" +}, +{ +"id":"69", +"text":"Estonia", +"code":"EE" +}, +{ +"id":"67", +"text":"Ethiopia", +"code":"ET" +}, +{ +"id":"71", +"text":"Falkland Islands (Malvinas)", +"code":"FK" +}, +{ +"id":"70", +"text":"Faroe Islands", +"code":"FO" +}, +{ +"id":"73", +"text":"Fiji", +"code":"FJ" +}, +{ +"id":"74", +"text":"Finland", +"code":"FI" +}, +{ +"id":"76", +"text":"France", +"code":"FR" +}, +{ +"id":"77", +"text":"French Guiana", +"code":"GF" +}, +{ +"id":"78", +"text":"French Polynesia", +"code":"PF" +}, +{ +"id":"79", +"text":"French Southern Territories", +"code":"TF" +}, +{ +"id":"81", +"text":"Gabon", +"code":"GA" +}, +{ +"id":"83", +"text":"Gambia", +"code":"GM" +}, +{ +"id":"82", +"text":"Georgia", +"code":"GE" +}, +{ +"id":"85", +"text":"Germany", +"code":"DE" +}, +{ +"id":"86", +"text":"Ghana", +"code":"GH" +}, +{ +"id":"87", +"text":"Gibraltar", +"code":"GI" +}, +{ +"id":"89", +"text":"Greece", +"code":"GR" +}, +{ +"id":"90", +"text":"Greenland", +"code":"GL" +}, +{ +"id":"91", +"text":"Grenada", +"code":"GD" +}, +{ +"id":"92", +"text":"Guadeloupe", +"code":"GP" +}, +{ +"id":"93", +"text":"Guam", +"code":"GU" +}, +{ +"id":"94", +"text":"Guatemala", +"code":"GT" +}, +{ +"id":"234", +"text":"Guernsey", +"code":"GG" +}, +{ +"id":"95", +"text":"Guinea", +"code":"GN" +}, +{ +"id":"178", +"text":"Guinea-Bissau", +"code":"GW" +}, +{ +"id":"96", +"text":"Guyana", +"code":"GY" +}, +{ +"id":"97", +"text":"Haiti", +"code":"HT" +}, +{ +"id":"98", +"text":"Heard Island and McDonald Islands", +"code":"HM" +}, +{ +"id":"99", +"text":"Holy See (Vatican City State)", +"code":"VA" +}, +{ +"id":"100", +"text":"Honduras", +"code":"HN" +}, +{ +"id":"101", +"text":"Hong Kong", +"code":"HK" +}, +{ +"id":"102", +"text":"Hungary", +"code":"HU" +}, +{ +"id":"103", +"text":"Iceland", +"code":"IS" +}, +{ +"id":"104", +"text":"India", +"code":"IN" +}, +{ +"id":"105", +"text":"Indonesia", +"code":"ID" +}, +{ +"id":"107", +"text":"Iraq", +"code":"IQ" +}, +{ +"id":"108", +"text":"Ireland", +"code":"IE" +}, +{ +"id":"236", +"text":"Isle of Man", +"code":"IM" +}, +{ +"id":"109", +"text":"Israel", +"code":"IL" +}, +{ +"id":"110", +"text":"Italy", +"code":"IT" +}, +{ +"id":"112", +"text":"Jamaica", +"code":"JM" +}, +{ +"id":"113", +"text":"Japan", +"code":"JP" +}, +{ +"id":"235", +"text":"Jersey", +"code":"JE" +}, +{ +"id":"115", +"text":"Jordan", +"code":"JO" +}, +{ +"id":"114", +"text":"Kazakhstan", +"code":"KZ" +}, +{ +"id":"116", +"text":"Kenya", +"code":"KE" +}, +{ +"id":"88", +"text":"Kiribati", +"code":"KI" +}, +{ +"id":"119", +"text":"Kuwait", +"code":"KW" +}, +{ +"id":"120", +"text":"Kyrgyzstan", +"code":"KG" +}, +{ +"id":"121", +"text":"Laos", +"code":"LA" +}, +{ +"id":"124", +"text":"Latvia", +"code":"LV" +}, +{ +"id":"122", +"text":"Lebanon", +"code":"LB" +}, +{ +"id":"123", +"text":"Lesotho", +"code":"LS" +}, +{ +"id":"125", +"text":"Liberia", +"code":"LR" +}, +{ +"id":"126", +"text":"Libyan Arab Jamahiriya", +"code":"LY" +}, +{ +"id":"127", +"text":"Liechtenstein", +"code":"LI" +}, +{ +"id":"128", +"text":"Lithuania", +"code":"LT" +}, +{ +"id":"129", +"text":"Luxembourg", +"code":"LU" +}, +{ +"id":"130", +"text":"Macao", +"code":"MO" +}, +{ +"id":"231", +"text":"Macedonia", +"code":"MK" +}, +{ +"id":"131", +"text":"Madagascar", +"code":"MG" +}, +{ +"id":"132", +"text":"Malawi", +"code":"MW" +}, +{ +"id":"133", +"text":"Malaysia", +"code":"MY" +}, +{ +"id":"134", +"text":"Maldives", +"code":"MV" +}, +{ +"id":"135", +"text":"Mali", +"code":"ML" +}, +{ +"id":"136", +"text":"Malta", +"code":"MT" +}, +{ +"id":"167", +"text":"Marshall Islands", +"code":"MH" +}, +{ +"id":"137", +"text":"Martinique", +"code":"MQ" +}, +{ +"id":"138", +"text":"Mauritania", +"code":"MR" +}, +{ +"id":"139", +"text":"Mauritius", +"code":"MU" +}, +{ +"id":"51", +"text":"Mayotte", +"code":"YT" +}, +{ +"id":"140", +"text":"Mexico", +"code":"MX" +}, +{ +"id":"166", +"text":"Micronesia", +"code":"FM" +}, +{ +"id":"143", +"text":"Moldova", +"code":"MD" +}, +{ +"id":"141", +"text":"Monaco", +"code":"MC" +}, +{ +"id":"142", +"text":"Mongolia", +"code":"MN" +}, +{ +"id":"144", +"text":"Montenegro", +"code":"ME" +}, +{ +"id":"145", +"text":"Montserrat", +"code":"MS" +}, +{ +"id":"146", +"text":"Morocco", +"code":"MA" +}, +{ +"id":"147", +"text":"Mozambique", +"code":"MZ" +}, +{ +"id":"33", +"text":"Myanmar", +"code":"MM" +}, +{ +"id":"149", +"text":"Namibia", +"code":"NA" +}, +{ +"id":"150", +"text":"Nauru", +"code":"NR" +}, +{ +"id":"151", +"text":"Nepal", +"code":"NP" +}, +{ +"id":"152", +"text":"Netherlands", +"code":"NL" +}, +{ +"id":"153", +"text":"Netherlands Antilles", +"code":"AN" +}, +{ +"id":"155", +"text":"New Caledonia", +"code":"NC" +}, +{ +"id":"157", +"text":"New Zealand", +"code":"NZ" +}, +{ +"id":"158", +"text":"Nicaragua", +"code":"NI" +}, +{ +"id":"159", +"text":"Niger", +"code":"NE" +}, +{ +"id":"160", +"text":"Nigeria", +"code":"NG" +}, +{ +"id":"161", +"text":"Niue", +"code":"NU" +}, +{ +"id":"162", +"text":"Norfolk Island", +"code":"NF" +}, +{ +"id":"164", +"text":"Northern Mariana Islands", +"code":"MP" +}, +{ +"id":"163", +"text":"Norway", +"code":"NO" +}, +{ +"id":"148", +"text":"Oman", +"code":"OM" +}, +{ +"id":"169", +"text":"Pakistan", +"code":"PK" +}, +{ +"id":"168", +"text":"Palau", +"code":"PW" +}, +{ +"id":"84", +"text":"Palestinian Territory, Occupied", +"code":"PS" +}, +{ +"id":"170", +"text":"Panama", +"code":"PA" +}, +{ +"id":"171", +"text":"Papua New Guinea", +"code":"PG" +}, +{ +"id":"172", +"text":"Paraguay", +"code":"PY" +}, +{ +"id":"173", +"text":"Peru", +"code":"PE" +}, +{ +"id":"174", +"text":"Philippines", +"code":"PH" +}, +{ +"id":"175", +"text":"Pitcairn", +"code":"PN" +}, +{ +"id":"176", +"text":"Poland", +"code":"PL" +}, +{ +"id":"177", +"text":"Portugal", +"code":"PT" +}, +{ +"id":"180", +"text":"Puerto Rico", +"code":"PR" +}, +{ +"id":"181", +"text":"Qatar", +"code":"QA" +}, +{ +"id":"182", +"text":"Réunion", +"code":"RE" +}, +{ +"id":"183", +"text":"Romania", +"code":"RO" +}, +{ +"id":"184", +"text":"Russian Federation", +"code":"RU" +}, +{ +"id":"185", +"text":"Rwanda", +"code":"RW" +}, +{ +"id":"186", +"text":"Saint Barthélemy", +"code":"BL" +}, +{ +"id":"187", +"text":"Saint Helena", +"code":"SH" +}, +{ +"id":"188", +"text":"Saint Kitts and Nevis", +"code":"KN" +}, +{ +"id":"190", +"text":"Saint Lucia", +"code":"LC" +}, +{ +"id":"191", +"text":"Saint Martin (French part)", +"code":"MF" +}, +{ +"id":"192", +"text":"Saint Pierre and Miquelon", +"code":"PM" +}, +{ +"id":"193", +"text":"Saint Vincent and the Grenadines", +"code":"VC" +}, +{ +"id":"245", +"text":"Samoa", +"code":"WS" +}, +{ +"id":"194", +"text":"San Marino", +"code":"SM" +}, +{ +"id":"195", +"text":"Sao Tome and Principe", +"code":"ST" +}, +{ +"id":"196", +"text":"Saudi Arabia", +"code":"SA" +}, +{ +"id":"197", +"text":"Senegal", +"code":"SN" +}, +{ +"id":"198", +"text":"Serbia", +"code":"RS" +}, +{ +"id":"199", +"text":"Seychelles", +"code":"SC" +}, +{ +"id":"200", +"text":"Sierra Leone", +"code":"SL" +}, +{ +"id":"201", +"text":"Singapore", +"code":"SG" +}, +{ +"id":"202", +"text":"Slovakia", +"code":"SK" +}, +{ +"id":"204", +"text":"Slovenia", +"code":"SI" +}, +{ +"id":"29", +"text":"Solomon Islands", +"code":"SB" +}, +{ +"id":"205", +"text":"Somalia", +"code":"SO" +}, +{ +"id":"206", +"text":"South Africa", +"code":"ZA" +}, +{ +"id":"72", +"text":"South Georgia and the South Sandwich Islands", +"code":"GS" +}, +{ +"id":"118", +"text":"South Korea", +"code":"KR" +}, +{ +"id":"208", +"text":"Spain", +"code":"ES" +}, +{ +"id":"42", +"text":"Sri Lanka", +"code":"LK" +}, +{ +"id":"210", +"text":"Sudan", +"code":"SD" +}, +{ +"id":"211", +"text":"Suriname", +"code":"SR" +}, +{ +"id":"212", +"text":"Svalbard and Jan Mayen", +"code":"SJ" +}, +{ +"id":"213", +"text":"Swaziland", +"code":"SZ" +}, +{ +"id":"214", +"text":"Sweden", +"code":"SE" +}, +{ +"id":"215", +"text":"Switzerland", +"code":"CH" +}, +{ +"id":"216", +"text":"Syria", +"code":"SY" +}, +{ +"id":"46", +"text":"Taiwan", +"code":"TW" +}, +{ +"id":"217", +"text":"Tajikistan", +"code":"TJ" +}, +{ +"id":"237", +"text":"Tanzania", +"code":"TZ" +}, +{ +"id":"218", +"text":"Thailand", +"code":"TH" +}, +{ +"id":"249", +"text":"Third Party", +"code":"TP" +}, +{ +"id":"179", +"text":"Timor-Leste", +"code":"TL" +}, +{ +"id":"219", +"text":"Togo", +"code":"TG" +}, +{ +"id":"220", +"text":"Tokelau", +"code":"TK" +}, +{ +"id":"221", +"text":"Tonga", +"code":"TO" +}, +{ +"id":"222", +"text":"Trinidad and Tobago", +"code":"TT" +}, +{ +"id":"224", +"text":"Tunisia", +"code":"TN" +}, +{ +"id":"225", +"text":"Turkey", +"code":"TR" +}, +{ +"id":"226", +"text":"Turkmenistan", +"code":"TM" +}, +{ +"id":"227", +"text":"Turks and Caicos Islands", +"code":"TC" +}, +{ +"id":"228", +"text":"Tuvalu", +"code":"TV" +}, +{ +"id":"229", +"text":"Uganda", +"code":"UG" +}, +{ +"id":"230", +"text":"Ukraine", +"code":"UA" +}, +{ +"id":"223", +"text":"United Arab Emirates", +"code":"AE" +}, +{ +"id":"233", +"text":"United Kingdom", +"code":"UK" +}, +{ +"id":"238", +"text":"United States", +"code":"US" +}, +{ +"id":"165", +"text":"United States Minor Outlying Islands", +"code":"UM" +}, +{ +"id":"241", +"text":"Uruguay", +"code":"UY" +}, +{ +"id":"242", +"text":"Uzbekistan", +"code":"UZ" +}, +{ +"id":"156", +"text":"Vanuatu", +"code":"VU" +}, +{ +"id":"243", +"text":"Venezuela", +"code":"VE" +}, +{ +"id":"203", +"text":"Vietnam", +"code":"VN" +}, +{ +"id":"30", +"text":"Virgin Islands, British", +"code":"VG" +}, +{ +"id":"239", +"text":"Virgin Islands, U.S.", +"code":"VI" +}, +{ +"id":"244", +"text":"Wallis and Futuna", +"code":"WF" +}, +{ +"id":"209", +"text":"Western Sahara", +"code":"EH" +}, +{ +"id":"246", +"text":"Yemen", +"code":"YE" +}, +{ +"id":"247", +"text":"Zambia", +"code":"ZM" +}, +{ +"id":"207", +"text":"Zimbabwe", +"code":"ZW" +} +] +} + +""" diff --git a/GMERemittance/Model/RegisterRequestModel.swift b/GMERemittance/Model/RegisterRequestModel.swift index fe2041af..7fb09bc2 100644 --- a/GMERemittance/Model/RegisterRequestModel.swift +++ b/GMERemittance/Model/RegisterRequestModel.swift @@ -17,35 +17,35 @@ import Foundation class RegisterRequestModel: Serializer { - var username: String? - var password: String? - var encryptedPassword: String? - var encryptedConfirmPassword: String? - var confirmPassword: String? - var clientId: String? - var uuid: String? - var appVersion: String? - var phoneBrand: String? - var phoneOs: String? - var fcmId: String? // device id - var osVersion: String? - var dob: String? - - func serialize() -> [String : String] { - var dict = ["":""] - dict["username"] = self.username ?? "" - dict["password"] = self.encryptedPassword ?? "" - dict["confirmPassword"] = self.encryptedConfirmPassword ?? "" - dict["clientId"] = self.clientId ?? "" - dict["uuid"] = self.uuid ?? "" - dict["appVersion"] = self.appVersion ?? "" - dict["phoneBrand"] = self.phoneBrand ?? "" - dict["phoneOs"] = self.phoneOs ?? "" - dict["fcmId"] = self.fcmId ?? "" - dict["osVersion"] = self.osVersion ?? "" - dict["Dob"] = self.dob ?? "" - return dict - } + var username: String? + var nativeCountry: String? + var mobileNumber: String? + var encryptedPassword: String? + var clientId: String? + var uuid: String? + var appVersion: String? + var phoneBrand: String? + var phoneOs: String? + var fcmId: String? // device id + var osVersion: String? + var dob: String? + + func serialize() -> [String : String] { + var dict = ["":""] + dict["username"] = self.username ?? "" + dict["password"] = self.encryptedPassword ?? "" + dict["nativeCountry"] = self.nativeCountry ?? "" + dict["mobileNumber"] = self.mobileNumber ?? "" + dict["clientId"] = self.clientId ?? "" + dict["uuid"] = self.uuid ?? "" + dict["appVersion"] = self.appVersion ?? "" + dict["phoneBrand"] = self.phoneBrand ?? "" + dict["phoneOs"] = self.phoneOs ?? "" + dict["fcmId"] = self.fcmId ?? "" + dict["osVersion"] = self.osVersion ?? "" + dict["Dob"] = self.dob ?? "" + return dict + } } diff --git a/GMERemittance/Module/Home/User Interface/View/HomeViewController.swift b/GMERemittance/Module/Home/User Interface/View/HomeViewController.swift index 18ddc5e9..0f3c9122 100644 --- a/GMERemittance/Module/Home/User Interface/View/HomeViewController.swift +++ b/GMERemittance/Module/Home/User Interface/View/HomeViewController.swift @@ -692,7 +692,7 @@ extension HomeViewController: UIGestureRecognizerDelegate { extension HomeViewController { func save(user: User?) { // FIXME: FOR TEST -// Utility.save(user: user) + Utility.save(user: user) } private func checkKFTCToken() { diff --git a/GMERemittance/Module/LauncherScreen/User Interface/Wireframe/LauncherScreenWireframe.swift b/GMERemittance/Module/LauncherScreen/User Interface/Wireframe/LauncherScreenWireframe.swift index e0e50c2c..5ebad8e6 100644 --- a/GMERemittance/Module/LauncherScreen/User Interface/Wireframe/LauncherScreenWireframe.swift +++ b/GMERemittance/Module/LauncherScreen/User Interface/Wireframe/LauncherScreenWireframe.swift @@ -96,7 +96,7 @@ extension LauncherScreenWireframe: BiometricAuthenticationViewControllerDelegate // MARK: - SecureKeypadDelegate extension LauncherScreenWireframe: SecureKeypadDelegate { - func didComplete(_ encryptedString: String) { + func didComplete(_ encryptedString: String, length: Int) { if encryptedString != "" { KeyChain.shared.save(data: encryptedString, key: .password) doLogin() diff --git a/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift b/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift index b9b1fa2d..2675b01e 100644 --- a/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift +++ b/GMERemittance/Module/Login/User Interface/View/LoginViewController.swift @@ -325,7 +325,7 @@ extension LoginViewController: BiometricAuthenticationViewControllerDelegate { // MARK: - SecureKeypadDelegate extension LoginViewController: SecureKeypadDelegate { - func didComplete(_ encryptedString: String) { + func didComplete(_ encryptedString: String, length: Int) { if encryptedString != "" { self.encryptedPassword = encryptedString self.passwordTextField.text = "password" diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractor.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractor.swift index 46283cdc..9ceaea73 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractor.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractor.swift @@ -122,53 +122,37 @@ class KycInteractor { // MARK: Kyc interactor input interface extension KycInteractor: KycInteractorInput { - - func validate(model: KYCRequestModel) { - let shouldSubmit = model.kycForm1?.isCompleted ?? false && - model.kycForm2?.isCompleted ?? false && - model.kycForm3?.isCompleted ?? false - - if shouldSubmit { - /// call api here. - let params = self.getParams(model: model) - let images = self.getImageParams(model: model) - self.service.submit(param: params, images: images, success: { (response) in + func submit(model: KYCRequestModel) { + let params = self.getParams(model: model) + let images = self.getImageParams(model: model) + self.service.submit(param: params, images: images, success: { (response) in + + GMEDB.shared.getFcmToken { (token, error) in - GMEDB.shared.getFcmToken { (token, error) in + guard let error = error else { + let userId = Utility.getMyUserName() + var param = ["userId" : userId] - guard let error = error else { - let userId = Utility.getMyUserName() - var param = ["userId" : userId] - - param["uuid"] = Utility.getUUid() ?? "" - param["appVersion"] = Utility.getAppVersion() - param["phoneBrand"] = Utility.getPhoneBrand() - param["phoneOs"] = Utility.getPhoneOs() - param["fcmId"] = token ?? "" - param["osVersion"] = Utility.getOsVersion() + param["uuid"] = Utility.getUUid() ?? "" + param["appVersion"] = Utility.getAppVersion() + param["phoneBrand"] = Utility.getPhoneBrand() + param["phoneOs"] = Utility.getPhoneOs() + param["fcmId"] = token ?? "" + param["osVersion"] = Utility.getOsVersion() + + self.service.fetchUserInfo(param: param, success: { (user) in + Utility.save(user: user) + GMEDB.shared.user.set(true, .kyc) + self.output?.submitSuccess() + }, failure: { (error) in - self.service.fetchUserInfo(param: param, success: { (user) in - Utility.save(user: user) - GMEDB.shared.user.set(true, .kyc) - self.output?.submitSuccess() - }, failure: { (error) in - - }) - return - } - self.output?.show(error: error) + }) + return } - }) { (error) in self.output?.show(error: error) } - }else { - // FIXME: FOR TEST - GMEDB.shared.user.set(true, .kyc) - self.output?.submitSuccess() - -// self.output?.show(result1: result1) -// self.output?.show(result2: result2) -// self.output?.show(result3: result3) + }) { (error) in + self.output?.show(error: error) } } } diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractorIO.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractorIO.swift index 3a874bb2..2c31f8ff 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractorIO.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractorIO.swift @@ -7,7 +7,7 @@ // protocol KycInteractorInput: class { - func validate(model: KYCRequestModel) + func submit(model: KYCRequestModel) } protocol KycInteractorOutput: class { diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/Module Interface/KycModuleInterface.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/Module Interface/KycModuleInterface.swift index 0420c70a..e4901dff 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/Module Interface/KycModuleInterface.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/Module Interface/KycModuleInterface.swift @@ -7,6 +7,5 @@ // protocol KycModuleInterface: class { - func validate(model: KYCRequestModel) - func goHome() + func submit(model: KYCRequestModel) } diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Presenter/KycPresenter.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Presenter/KycPresenter.swift index 1b4312d7..cacf4eb6 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Presenter/KycPresenter.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Presenter/KycPresenter.swift @@ -9,41 +9,37 @@ import Foundation class KycPresenter { - - // MARK: Properties - - weak var view: KycViewInterface? - var interactor: KycInteractorInput? - var wireframe: KycWireframeInput? - - // MARK: Converting entities + + // MARK: Properties + + weak var view: KycViewInterface? + var interactor: KycInteractorInput? + var wireframe: KycWireframeInput? + + // MARK: Converting entities } - // MARK: Kyc module interface +// MARK: Kyc module interface extension KycPresenter: KycModuleInterface { - - func validate(model: KYCRequestModel) { - self.view?.showLoading() - self.interactor?.validate(model: model) - } + + func submit(model: KYCRequestModel) { + self.view?.showLoading() + self.interactor?.submit(model: model) + } } // MARK: Kyc interactor output interface extension KycPresenter: KycInteractorOutput { - - func submitSuccess() { - wireframe?.goToPennyTest() - } - - func goHome() { - self.wireframe?.gotToHome() - } - func show(error: Error) { - self.view?.hideLoading() - self.view?.show(error: error.localizedDescription) - } - + func submitSuccess() { + wireframe?.goToPennyTest() + } + + func show(error: Error) { + self.view?.hideLoading() + self.view?.show(error: error.localizedDescription) + } + } diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewController.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewController.swift index 9fe8f4f5..35bc5c38 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewController.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewController.swift @@ -134,7 +134,7 @@ // TODO: // first validate. guard let requestModel = self.requestModel else {return} - self.presenter?.validate(model: requestModel) + self.presenter?.submit(model: requestModel) // if error show them to respect page (if possible) // then submit to server. // then show result. @@ -155,14 +155,6 @@ // MARK: KycViewInterface extension KycViewController: KycViewInterface { - func showOption() { - let message = "Would you like to apply for penny test now?" - self.alertWithOkCancel(message: message, title: "Info", okTitle: "Ok", style: UIAlertController.Style.alert, cancelTitle: "Cancel", OkStyle: UIAlertAction.Style.default, cancelStyle: UIAlertAction.Style.default, okAction: { - }) { - self.presenter?.goHome() - } - } - func show(error: String) { self.alert(type: .error, message: error) } diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewInterface.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewInterface.swift index ddaf673c..a50c6472 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewInterface.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewInterface.swift @@ -8,7 +8,6 @@ protocol KycViewInterface: class { func show(error: String) - func showOption() func showLoading() func hideLoading() } diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframe.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframe.swift index 1aa04517..a62ec85d 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframe.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframe.swift @@ -33,18 +33,6 @@ extension KycWireframe: KycWireframeInput { return viewController } - func gotToHome() { - if let navigation = self.view.navigationController { - CATransaction.begin() - CATransaction.setCompletionBlock { - NotificationCenter.default.post(name: NSNotification.Name.init("showPennyTestFirstTime"), object: nil) - } - navigation.popViewController(animated: true) - - CATransaction.commit() - } - } - func goToPennyTest(){ view.navigationController?.pushViewController(PennyTestWireframe().getMainView(), animated: true) } diff --git a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframeInput.swift b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframeInput.swift index 2cb2d79a..56febd88 100644 --- a/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframeInput.swift +++ b/GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/Wireframe/KycWireframeInput.swift @@ -9,6 +9,5 @@ import Foundation protocol KycWireframeInput: WireframeInput { - func gotToHome() func goToPennyTest() } diff --git a/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1.storyboard b/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1.storyboard index 5849b040..ea2ad09e 100644 --- a/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1.storyboard +++ b/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1.storyboard @@ -27,10 +27,10 @@ - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + @@ -223,8 +194,6 @@ - - diff --git a/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1ViewController.swift b/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1ViewController.swift index e3ce7de2..b249d554 100644 --- a/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1ViewController.swift +++ b/GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1ViewController.swift @@ -63,16 +63,12 @@ class KycForm1ViewController: UIViewController { struct StringConstants { let fullname = "full_name_text".localized() let fullnamePlaceholder = "full_name_placeholder_text".localized() - let mobileNumber = "mobile_number_text".localized() - let mobilePlaceholder = "mobile_number_placeholder_text".localized() let email = "email_text_optional".localized() let emailPlaceholder = "placeholder_enter_receiver_email_text".localized() let dob = "dob_text".localized() let dobPlaceholder = "select_dob_text".localized() let gender = "gender_text".localized() let genderPlacholder = "gender_placeholder_text".localized() - let nativeCountry = "native_country_text".localized() - let nativeCountryPlaceholder = "native_country_placeholder_text".localized() let addressInKorea = "address_in_korea_text".localized() let addressPlaceholder = "address_in_korea_text".localized() let province = "province_text".localized() @@ -85,11 +81,10 @@ class KycForm1ViewController: UIViewController { let firstNameError = "kyc_first_name_error".localized() let genderError = "kyc_gender_error".localized() let emailError = "invalid email".localized() - let nativeCountryError = "kyc_native_country_error".localized() let addressError = "kyc_address_error".localized() let occupationError = "kyc_occupation_error".localized() let provinceError = "kyc_province_error".localized() - let mobileNumberError = "kyc_mobile_invalid_number_error".localized() + let dobError = "dob_valid_error".localized() } @@ -97,9 +92,7 @@ class KycForm1ViewController: UIViewController { private var validDic = [ KycForm1FieldKeys.firstName: false, KycForm1FieldKeys.gender: false, - KycForm1FieldKeys.mobileNumber: false, KycForm1FieldKeys.email: false, - KycForm1FieldKeys.nativeCountry: false, KycForm1FieldKeys.address: false, KycForm1FieldKeys.province: false, KycForm1FieldKeys.occupation: false, @@ -122,9 +115,7 @@ class KycForm1ViewController: UIViewController { @IBOutlet weak var firstNameTextField: ValidationTextField! @IBOutlet weak var genderTextField: ValidationTextField! @IBOutlet weak var dobTextField: ValidationTextField! - @IBOutlet weak var mobileNumberTextField: ValidationTextField! @IBOutlet weak var emailTextField: ValidationTextField! - @IBOutlet weak var nativeCountryTextField: ValidationTextField! @IBOutlet weak var addressTextField: ValidationTextField! @IBOutlet weak var provinceTextField: ValidationTextField! @IBOutlet weak var occupationTextField: ValidationTextField! @@ -148,12 +139,13 @@ class KycForm1ViewController: UIViewController { var errorLabels: [UILabel] = [] var textfields: [UITextField] = [] var delegate: KYCForm1Delegate? - var countries: [KeyValueModel]? + var countries: [NativeCountryModel]? var occupations: [KeyValueModel]? var kycModel: KycModel? { didSet { - self.countries = kycModel?.nativeCountry +// self.countries = kycModel?.nativeCountry + self.countries = StaticModels().nativeCountries self.occupations = kycModel?.occupations self.proviences = kycModel?.city } @@ -163,12 +155,12 @@ class KycForm1ViewController: UIViewController { var selectedGender: String? - var selectedCountry: SendMoneyCountryViewModel? { - didSet { - self.nativeCountryTextField.text = selectedCountry?.name - nativeCountryTextField.sendActions(for: .editingChanged) - } - } +// var selectedCountry: NativeCountryModel? { +// didSet { +// self.nativeCountryTextField.text = selectedCountry?.text +// nativeCountryTextField.sendActions(for: .editingChanged) +// } +// } var selectedProvience: KeyValueModel? { didSet { @@ -233,11 +225,9 @@ class KycForm1ViewController: UIViewController { removeNonASCII( textFields: [ self.firstNameTextField, - self.mobileNumberTextField, self.emailTextField, self.dobTextField, self.genderTextField, - self.nativeCountryTextField, self.addressTextField, self.provinceTextField, self.occupationTextField @@ -251,41 +241,38 @@ class KycForm1ViewController: UIViewController { let titleFont = UIFont(name: "SanFranciscoDisplay-Regular", size: 12)! self.firstNameTextField.titleText = StringConstants().fullname - self.mobileNumberTextField.titleText = StringConstants().mobileNumber + self.emailTextField.titleText = StringConstants().email self.dobTextField.titleText = StringConstants().dob self.genderTextField.titleText = StringConstants().gender - self.nativeCountryTextField.titleText = StringConstants().nativeCountry + self.addressTextField.titleText = StringConstants().addressInKorea self.provinceTextField.titleText = StringConstants().province self.occupationTextField.titleText = StringConstants().occupation self.referralCodeTextField.titleText = StringConstants().referralCode self.firstNameTextField.placeholder = StringConstants().fullnamePlaceholder - self.mobileNumberTextField.placeholder = StringConstants().mobilePlaceholder + self.emailTextField.placeholder = StringConstants().emailPlaceholder self.dobTextField.placeholder = StringConstants().dobPlaceholder self.genderTextField.placeholder = StringConstants().genderPlacholder - self.nativeCountryTextField.placeholder = StringConstants().nativeCountryPlaceholder self.addressTextField.placeholder = StringConstants().addressPlaceholder self.provinceTextField.placeholder = StringConstants().provincePlaceholder self.occupationTextField.placeholder = StringConstants().occupationPlaceholder self.firstNameTextField.errorMessage = StringConstants().firstNameError - self.mobileNumberTextField.errorMessage = StringConstants().mobileNumberError + self.emailTextField.errorMessage = StringConstants().emailError self.genderTextField.errorMessage = StringConstants().genderError - self.nativeCountryTextField.errorMessage = StringConstants().nativeCountryError + self.addressTextField.errorMessage = StringConstants().addressError self.provinceTextField.errorMessage = StringConstants().provinceError self.occupationTextField.errorMessage = StringConstants().occupationError self.firstNameTextField.titleFont = titleFont - self.mobileNumberTextField.titleFont = titleFont self.emailTextField.titleFont = titleFont self.dobTextField.titleFont = titleFont self.genderTextField.titleFont = titleFont - self.nativeCountryTextField.titleFont = titleFont self.addressTextField.titleFont = titleFont self.provinceTextField.titleFont = titleFont self.occupationTextField.titleFont = titleFont @@ -294,10 +281,8 @@ class KycForm1ViewController: UIViewController { private func setError(){ self.firstNameTextField.validCondition = { !$0.isEmpty } - self.mobileNumberTextField.validCondition = { $0.count > 9 && $0.count < 12} self.emailTextField.validCondition = { $0.isEmail() } self.genderTextField.validCondition = { !$0.isEmpty } - self.nativeCountryTextField.validCondition = { !$0.isEmpty } self.addressTextField.validCondition = { !$0.isEmpty } self.provinceTextField.validCondition = { !$0.isEmpty } self.occupationTextField.validCondition = { !$0.isEmpty } @@ -316,9 +301,7 @@ class KycForm1ViewController: UIViewController { self.emailTextField.delegate = self self.dobTextField.delegate = self self.addressTextField.delegate = self - self.nativeCountryTextField.delegate = self self.occupationTextField.delegate = self - self.mobileNumberTextField.delegate = self self.provinceTextField.delegate = self } @@ -375,9 +358,6 @@ extension KycForm1ViewController: UITextFieldDelegate { case genderTextField: self.showGenderPicker() return false - case nativeCountryTextField: - self.showCountryPickerview() - return false case provinceTextField: self.showProviencePickerview() return false @@ -394,18 +374,10 @@ extension KycForm1ViewController: UITextFieldDelegate { extension KycForm1ViewController { private func showCountryPickerview() { - let _countries = self.countries ?? [] - let data: [SendMoneyCountryViewModel] = _countries.map({ - let model = SendMoneyCountryViewModel() - model.id = $0.id - model.name = $0.text - return model - }) - TablePresenterWireframe().openWith( tag: 0, delegate: self, - model: data, + model: countries, source: self ) } @@ -518,8 +490,6 @@ extension KycForm1ViewController: TablePresenterDelegate { func TablePresenterView(_ viewController: TablePresenterViewController, didSelectModel model: TablePresenterProtocol?) { switch viewController.view.tag { - case 0: - self.selectedCountry = model as? SendMoneyCountryViewModel case 1: self.selectedOccupation = model as? KeyValueModel case 2: @@ -551,16 +521,12 @@ extension KycForm1ViewController { switch tf { case firstNameTextField: validDic[KycForm1FieldKeys.firstName] = tf.isValid - case mobileNumberTextField: - validDic[KycForm1FieldKeys.mobileNumber] = tf.isValid case emailTextField: validDic[KycForm1FieldKeys.email] = tf.isValid case genderTextField: validDic[KycForm1FieldKeys.gender] = tf.isValid case dobTextField: validDic[KycForm1FieldKeys.dob] = tf.isValid - case nativeCountryTextField: - validDic[KycForm1FieldKeys.nativeCountry] = tf.isValid case addressTextField: validDic[KycForm1FieldKeys.address] = tf.isValid case provinceTextField: @@ -581,9 +547,9 @@ extension KycForm1ViewController { lastName: "", gender: selectedGender ?? "", dob: dobTextField.text ?? "", - mobile: mobileNumberTextField.text ?? "", + mobile: GMEDB.shared.user.string(.mobileNumber) ?? "", email: emailTextField.text ?? "", - nativeCountry: selectedCountry?.id ?? "", + nativeCountry: GMEDB.shared.user.string(.country) ?? "", country: addressTextField.text ?? "", province: selectedProvience?.id ?? "", occupation: selectedOccupation?.id ?? "", diff --git a/GMERemittance/Module/RegisterModules/PennyTest/User Interface/View/PennyTestViewController.swift b/GMERemittance/Module/RegisterModules/PennyTest/User Interface/View/PennyTestViewController.swift index 09bf0a57..c4ee81d0 100644 --- a/GMERemittance/Module/RegisterModules/PennyTest/User Interface/View/PennyTestViewController.swift +++ b/GMERemittance/Module/RegisterModules/PennyTest/User Interface/View/PennyTestViewController.swift @@ -107,14 +107,14 @@ class PennyTestViewController: UIViewController { } }) { (error) in // FIXME: FOR TEST - GMEDB.shared.user.set(PennyTestStatusCode.requested.rawValue, .pennyTestStatusCode) - let wireframe = PennyTestSubmitWireframe() - if let navigation = self.navigationController { - wireframe.parentViewController = self - wireframe.pushMainView(in: navigation) - } -// self.hideLoading() -// self.alert(type: .error, message: error.localizedDescription) +// GMEDB.shared.user.set(PennyTestStatusCode.requested.rawValue, .pennyTestStatusCode) +// let wireframe = PennyTestSubmitWireframe() +// if let navigation = self.navigationController { +// wireframe.parentViewController = self +// wireframe.pushMainView(in: navigation) +// } + self.hideLoading() + self.alert(type: .error, message: error.localizedDescription) } } diff --git a/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift b/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift index fea87e94..a33799d9 100644 --- a/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift +++ b/GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift @@ -203,20 +203,20 @@ class PennyTestSubmitViewController: UIViewController { }) { (error) in // FIXME: FOR TEST - self.alertWithOk( - type: .normal, - message: "For Test", - title: "Success", - okTitle: "Ok", - style: UIAlertController.Style.alert, - OkStyle: .default, - okAction: { - GMEDB.shared.user.set(PennyTestStatusCode.completed.rawValue, .pennyTestStatusCode) - self.dismiss() - } - ) +// self.alertWithOk( +// type: .normal, +// message: "For Test", +// title: "Success", +// okTitle: "Ok", +// style: UIAlertController.Style.alert, +// OkStyle: .default, +// okAction: { +// GMEDB.shared.user.set(PennyTestStatusCode.completed.rawValue, .pennyTestStatusCode) +// self.dismiss() +// } +// ) -// self.alert(type: .error, message: error.localizedDescription) + self.alert(type: .error, message: error.localizedDescription) } } diff --git a/GMERemittance/Module/RegisterModules/Register/Application Logic/Interactor/RegisterInteractor.swift b/GMERemittance/Module/RegisterModules/Register/Application Logic/Interactor/RegisterInteractor.swift index 8d04ca1f..f72ca0f9 100644 --- a/GMERemittance/Module/RegisterModules/Register/Application Logic/Interactor/RegisterInteractor.swift +++ b/GMERemittance/Module/RegisterModules/Register/Application Logic/Interactor/RegisterInteractor.swift @@ -21,94 +21,11 @@ class RegisterInteractor { init(service: RegisterServiceType) { self.service = service } - - private func isValidPasword(password: String, confirmPassword: String) -> (isValid: Bool, error: String) { - var error = "" - var isValid = true - - // >= 9, 1 special character, 1 number - // - // func isValidLength() -> Bool { - // return password.count >= 9 - // } - // - // func hasNumber() -> Bool { - // let characterSet = CharacterSet.init(charactersIn: "1234567890") - // return password.rangeOfCharacter(from: characterSet) != nil - // } - // - // func hasLetter() -> Bool { - // let characterSet = CharacterSet.letters - // return password.rangeOfCharacter(from: characterSet) != nil - // } - // - // func hasSpecialCharacter() -> Bool { - // let characterSet = CharacterSet.alphanumerics - // return password.rangeOfCharacter(from: characterSet.inverted) != nil - // } - // - // func hasUpperCase() -> Bool { - // let characterSet = CharacterSet.uppercaseLetters - // return password.rangeOfCharacter(from: characterSet) != nil - // } - // - - if password.isEmpty { - error = error + "\n" + "password_empty_error".localized() - isValid = false - } - - if confirmPassword.isEmpty { - error = error + "\n" + "password_confirm_empty_error".localized() - isValid = false - } - - return (isValid, error) - } - // MARK: Converting entities - - private func isValid(userName: String, password: String, confirmPassword: String, dob: String) -> (isValid: Bool, error: Error) { - var error = "" - var isValid = true - // user name - - - - if userName.isEmpty { - error = error + "email_valid_error".localized(); - isValid = false - } - - if !Utility.isValidEmail(email: userName) { - error = error + "dob_valid_error".localized() - isValid = false - } - - let result = self.isValidPasword(password: password, confirmPassword: confirmPassword) - - if !result.isValid { - error = error + result.error - isValid = false - } - - if dob.isEmpty { - error = error + "\n " + "select_dob_text".localized() - isValid = false - } - - let _error = NSError.init(domain: "LoginInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : error]) - return (isValid, _error) - } } extension RegisterInteractor: RegisterInteractorInput { func register(model: RegisterRequestModel) { - let validationResult = self.isValid(userName: model.username ?? "", password: model.encryptedPassword ?? "", confirmPassword: model.encryptedConfirmPassword ?? "", dob: model.dob ?? "") - if !validationResult.isValid { - self.output?.show(error: validationResult.error) - return - } GMEDB.shared.getFcmToken { (token, error) in model.uuid = Utility.getUUid() diff --git a/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard b/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard index 672f9bef..07fae080 100644 --- a/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard +++ b/GMERemittance/Module/RegisterModules/Register/User Interface/View/Register.storyboard @@ -1,12 +1,11 @@ - + - @@ -18,207 +17,137 @@ - - + + - + - - + + - + - - - - + - - + + - - - - - - + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + - - - - - - - - - - - - - - + - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + - - - - - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + - + - + diff --git a/GMERemittance/Module/RegisterModules/Register/User Interface/View/RegisterViewController.swift b/GMERemittance/Module/RegisterModules/Register/User Interface/View/RegisterViewController.swift index f35fb6c3..815e4660 100644 --- a/GMERemittance/Module/RegisterModules/Register/User Interface/View/RegisterViewController.swift +++ b/GMERemittance/Module/RegisterModules/Register/User Interface/View/RegisterViewController.swift @@ -8,333 +8,284 @@ import UIKit import Localize_Swift +import ValidationTextField class RegisterViewController: UIViewController { + + struct StringConstants { + let userIdTitle = "userid_title_text".localized() + let useridPlaceholder = "userid_placeholder_text".localized() + let useridError = "userid_error_text".localized() + + let passwordTitle = "password_text".localized() + let passwordPlaceholder = "create_password_text".localized() + let passwordError = "password_policy_error".localized() - struct StringConstants { - let userIdTitle = "login_user_id_text".localized() - let useridPlaceholder = "email_text".localized() - let passwordTitle = "password_text".localized() - let passwordPlaceholder = "create_password_text".localized() - - let confirmPasswordTitle = "confirm_password_text".localized() - let confirmPasswordPlaceholder = "confirm_password_text".localized() - - let dobTitlePlaceholder = "dob_text".localized() - let alreadyHaveAccountText = "already_have_account_text".localized() - let loginText = "login_text".localized() - let registerText = "register_text".localized() - let registerHeader = "register_title_text".localized() - let registerSubtitle = "register_subtitle_text".localized() - } - - // MARK: IBOutlets - - @IBOutlet weak var emailTextField: UITextField! - @IBOutlet weak var passwordTextField: UITextField! - @IBOutlet weak var confirmPasswordTextfield: UITextField! - @IBOutlet weak var dobTextField: UITextField! - - // header labels - @IBOutlet weak var headerLabel: UILabel! - @IBOutlet weak var subHeaderLabel: UILabel! - - // title labels - @IBOutlet weak var userIdTitleLabel: UILabel! - @IBOutlet weak var passwordTitleLabel: UILabel! - @IBOutlet weak var confirmPasswordTitleLabel: UILabel! - @IBOutlet weak var dobTitileLabel: UILabel! - - @IBOutlet weak var alreadyHaveAccountLabel: UILabel! - - // buttons - @IBOutlet weak var loginButton: UIButton! - @IBOutlet weak var registerButton: UIButton! - - // MARK: Properties - let datePicker = UIDatePicker() - var presenter: RegisterModuleInterface? + let confirmPasswordTitle = "confirm_password_text".localized() + let confirmPasswordPlaceholder = "confirm_password_text".localized() - // keyboard - var mQwertyTransKeyView : TransKeyView? - var mNumberTransKeyView : TransKeyView? + let dobTitlePlaceholder = "dob_text".localized() + let alreadyHaveAccountText = "already_have_account_text".localized() + let loginText = "login_text".localized() + let registerText = "register_text".localized() + let registerHeader = "register_title_text".localized() + let registerSubtitle = "register_subtitle_text".localized() - var secureKey : NSData! - var numberCipherString : String! - var qwertyCipherString : String! + let mobileNumber = "mobile_number_text".localized() + let mobilePlaceholder = "mobile_number_placeholder_text".localized() - var isTranskeyShowing : Bool! - var isShowQwerty : Bool! = true - var isShowNumber : Bool! + let nativeCountry = "native_country_text".localized() + let nativeCountryPlaceholder = "native_country_placeholder_text".localized() - var password: String! { - didSet { - self.passwordTextField.text = password - } + let nativeCountryError = "kyc_native_country_error".localized() + let mobileNumberError = "kyc_mobile_invalid_number_error".localized() + } + + // MARK: IBOutlets + + @IBOutlet weak var idTextField: ValidationTextField! + @IBOutlet weak var passwordTextField: ValidationTextField! + @IBOutlet weak var nativeCountryTextField: ValidationTextField! + @IBOutlet weak var mobileTextField: ValidationTextField! + + // header labels + @IBOutlet weak var headerLabel: UILabel! + @IBOutlet weak var subHeaderLabel: UILabel! + @IBOutlet weak var alreadyHaveAccountLabel: UILabel! + + // buttons + @IBOutlet weak var loginButton: UIButton! + @IBOutlet weak var registerButton: UIButton! + + // MARK: Properties + var presenter: RegisterModuleInterface? + + private var encryptedPassword: String = "" + + private lazy var countries = StaticModels().nativeCountries + private var validDic = [ + "id": false, + "password": false, + "country": false, + "mobile": false + ] + + private var selectedNativeCountry: NativeCountryModel? { + didSet { + nativeCountryTextField.text = selectedNativeCountry?.text + nativeCountryTextField.sendActions(for: .editingChanged) } - var encryptedPassword: String! - var encryptedConfirmPassword: String! - var confirmPassword: String! { - didSet { - self.confirmPasswordTextfield.text = confirmPassword - } + } + + private var isValid = false { + didSet{ + registerButton.isEnabled = isValid + registerButton.backgroundColor = isValid ? AppConstants.themeRedColor : .lightGray } + } + + // MARK: VC's Life cycle + + override func viewDidLoad() { + super.viewDidLoad() + self.setup() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.setupPicturedNavBar() + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.navigationItem.title = "" + } + + // MARK: IBActions + + @IBAction func login(_ sender: UIButton) { + self.presenter?.login() + } + + @IBAction func register(_ sender: UIButton) { + let model = RegisterRequestModel() + model.username = idTextField.text + model.encryptedPassword = encryptedPassword + model.nativeCountry = selectedNativeCountry?.id + model.mobileNumber = mobileTextField.text - var showingPasswordField = false - var showingConfirmPasswordField: Bool = false - - // MARK: VC's Life cycle + self.presenter?.register(model: model) + } + + // MARK: Other Functions + + private func setup() { + // all setup should be done here + setupPicturedNavBar() + configureLanguage() - override func viewDidLoad() { - super.viewDidLoad() - self.setupKeyboard() - self.setup() - } + passwordTextField.delegate = self + nativeCountryTextField.delegate = self - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - self.setupPicturedNavBar() - } + passwordTextField.inputView = UIView() + nativeCountryTextField.inputView = UIView() - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - self.navigationItem.title = "" - - mQwertyTransKeyView?.mTK_ClearDelegateSubviews() - mNumberTransKeyView?.mTK_ClearDelegateSubviews() - if isTranskeyShowing == false { - mQwertyTransKeyView?.delegate = nil; - mNumberTransKeyView?.delegate = nil; - } - } + removeNonASCII( + textFields: [ + idTextField, + passwordTextField, + nativeCountryTextField, + mobileTextField + ] + ) - // MARK: IBActions + registerButton.layer.cornerRadius = 10 - @IBAction func login(_ sender: UIButton) { - self.presenter?.login() - } + } + + private func configureLanguage() { + let font = UIFont.init(name: "SanFranciscoDisplay-regular", size: 12)! - private func setupDatePicker() { - self.datePicker.datePickerMode = .date - self.dobTextField.inputView = datePicker - datePicker.maximumDate = Date() - self.datePicker.addTarget(self, action: #selector(handleDatePicker(sender:)), for: .valueChanged) - } + headerLabel.text = StringConstants().registerHeader + subHeaderLabel.text = StringConstants().registerSubtitle + alreadyHaveAccountLabel.text = StringConstants().alreadyHaveAccountText - @objc private func handleDatePicker(sender: UIDatePicker) { - let dateFormatter = DateFormatter() - dateFormatter.dateFormat = "yyyy-MM-dd" - self.dobTextField.text = dateFormatter.string(from: sender.date) - } - @IBAction func register(_ sender: UIButton) { - let email = self.emailTextField.text! -// let password = self.passwordTextField.text! - let password = self.password - let dob = self.dobTextField.text! - let confirmPassword = self.confirmPasswordTextfield.text! - let model = RegisterRequestModel() - model.username = email - model.password = password - model.encryptedConfirmPassword = self.encryptedConfirmPassword - model.confirmPassword = confirmPassword - model.dob = dob - model.encryptedPassword = self.encryptedPassword - self.presenter?.register(model: model) - } + idTextField.titleText = StringConstants().userIdTitle + idTextField.titleFont = font + idTextField.placeholder = StringConstants().useridPlaceholder + idTextField.errorMessage = StringConstants().useridError + idTextField.validCondition = {$0.count > 5} - // MARK: Other Functions + passwordTextField.titleText = StringConstants().passwordTitle + passwordTextField.titleFont = font + passwordTextField.placeholder = StringConstants().passwordPlaceholder + passwordTextField.errorMessage = StringConstants().passwordError + passwordTextField.validCondition = { $0.count > 5 } + nativeCountryTextField.titleText = StringConstants().nativeCountry + nativeCountryTextField.titleFont = font + nativeCountryTextField.placeholder = StringConstants().nativeCountryPlaceholder + nativeCountryTextField.errorMessage = StringConstants().nativeCountryError + nativeCountryTextField.validCondition = { !$0.isEmpty } - func setupKeyboard() { - isShowNumber = false - isShowQwerty = true - isTranskeyShowing = false - - setQwertyTranskey() - // self.showQwertyTranskeyAction() - } + mobileTextField.titleText = StringConstants().mobileNumber + mobileTextField.titleFont = font + mobileTextField.placeholder = StringConstants().mobilePlaceholder + mobileTextField.errorMessage = StringConstants().mobileNumberError + mobileTextField.validCondition = { $0.count > 9 && $0.count < 12} - func setQwertyTranskey(){ - mQwertyTransKeyView = TransKeyView() - mQwertyTransKeyView?.mTK_Init(self) - mQwertyTransKeyView?.delegate = self - mQwertyTransKeyView?.mTK_MakeSecureKey() - mQwertyTransKeyView?.mTK_Supported(byDeviceOrientation: SupportedByDevicePortrait) - mQwertyTransKeyView?.mTK_EnableSamekeyInputDataEncrypt(false) - // ccr key - mQwertyTransKeyView?.mTK_LicenseCheck("license_mtranskey") + loginButton.setTitle(StringConstants().loginText, for: .normal) + registerButton.setTitle(StringConstants().registerText, for: .normal) + } + + private func showCountryPickerview() { + TablePresenterWireframe().openWith( + tag: 0, + delegate: self, + model: countries, + source: self + ) + } + + private func removeNonASCII(textFields: [UITextField]) { + textFields.forEach { + $0.addTarget(self, action: #selector(editingChanged(_:)), for: .editingChanged) } + } + + @objc private func editingChanged(_ textField: UITextField) { + textField.removeNonASCII() - private func setup() { - // all setup should be done here - self.setupPicturedNavBar() - self.setupDatePicker() - self.configureLanguage() - self.passwordTextField.delegate = self - self.confirmPasswordTextfield.delegate = self - - } + let tf = textField as! ValidationTextField - private func configureLanguage() { - self.headerLabel.text = StringConstants().registerHeader - self.subHeaderLabel.text = StringConstants().registerSubtitle - self.userIdTitleLabel.text = "email_text".localized() - self.emailTextField.placeholder = StringConstants().useridPlaceholder - let passwordPlaceholder = StringConstants().passwordPlaceholder - let attributedPasswordPlaceholder = NSMutableAttributedString(string: passwordPlaceholder) - - let passwordPolicy = " (\("password_policy_error".localized()))" - - let font = UIFont.init(name: "SanFranciscoDisplay-regular", size: 12)! - let myAttribute = [ NSAttributedString.Key.foregroundColor: UIColor.lightGray, NSAttributedString.Key.font : font ] - let attributedPasswordPolicy = NSAttributedString(string: passwordPolicy, attributes: myAttribute) - attributedPasswordPlaceholder.append(attributedPasswordPolicy) - self.passwordTitleLabel.attributedText = attributedPasswordPlaceholder - self.passwordTextField.placeholder = StringConstants().passwordPlaceholder - self.confirmPasswordTitleLabel.text = StringConstants().confirmPasswordPlaceholder - self.confirmPasswordTextfield.placeholder = StringConstants().confirmPasswordPlaceholder - self.dobTitileLabel.text = StringConstants().dobTitlePlaceholder - self.dobTextField.placeholder = StringConstants().dobTitlePlaceholder - self.alreadyHaveAccountLabel.text = StringConstants().alreadyHaveAccountText - self.loginButton.setTitle(StringConstants().loginText, for: .normal) - self.registerButton.setTitle(StringConstants().registerText, for: .normal) + switch tf { + case idTextField: + validDic["id"] = tf.isValid + case passwordTextField: + validDic["password"] = tf.isValid + case nativeCountryTextField: + validDic["country"] = tf.isValid + case mobileTextField: + validDic["mobile"] = tf.isValid + default: + break } + + isValid = validDic.reduce(true){ $0 && $1.value} + } } // MARK: RegisterViewInterface extension RegisterViewController: RegisterViewInterface { - func showLoading() { - self.showProgressHud() - } - - func hideLoading() { - self.hideProgressHud() - } - - func show(error: String) { - self.alert(type: .error, message: error) - } - - func show(message: String) { - self.alertWithOk(type: .normal, message: message, title: "Success", okTitle: "Ok") { - self.presenter?.login() - } + func showLoading() { + self.showProgressHud() + } + + func hideLoading() { + self.hideProgressHud() + } + + func show(error: String) { + self.alert(type: .error, message: error) + } + + func show(message: String) { + self.alertWithOk(type: .normal, message: message, title: "Success", okTitle: "Ok") { + self.presenter?.login() } + } } - -extension RegisterViewController: TransKeyViewDelegate { - func secureInputFinish(_ type: Int) { - NSLog("secureInputFinish Btn Type : %d", type) - NSLog("secureInputFinish"); - var targetView : TransKeyView? - - NSLog("qwerty : " + isShowQwerty.description + " number : " + isShowNumber.description) - if isShowQwerty == true{ - qwertyCipherString = mQwertyTransKeyView?.mTK_GetSecureData() - - if showingPasswordField { - if mQwertyTransKeyView?.mTK_GetDataLength() == 0 { - self.encryptedPassword = "" - self.passwordTextField.text = "" - }else { - self.encryptedPassword = qwertyCipherString - self.passwordTextField.text = "password" - } } - - if showingConfirmPasswordField { - if mQwertyTransKeyView?.mTK_GetDataLength() == 0 { - - encryptedConfirmPassword = "" - self.confirmPasswordTextfield.text = "" - }else { - - encryptedConfirmPassword = qwertyCipherString - self.confirmPasswordTextfield.text = "password" - } - - } - - targetView = mQwertyTransKeyView - - // self.mQwertyTransKeyView?.dismissViewControllerAnimated(true, completion: nil) - - } - - isShowQwerty = false - isShowNumber = false - isTranskeyShowing = false - - targetView?.dismiss(animated: true, completion: nil) - +// MARK: - UITextFieldDelegate +extension RegisterViewController: UITextFieldDelegate { + func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { + switch textField { + case passwordTextField: + let secureKeypad = SecureKeypad(target: self) + secureKeypad.delegate = self + secureKeypad.present(animated: true) + + return false + case nativeCountryTextField: + showCountryPickerview() + return false + default: + return true } + } +} + +// MARK: - SecureKeypadDelegate +extension RegisterViewController: SecureKeypadDelegate { + func didComplete(_ encryptedString: String, length: Int) { + encryptedPassword = encryptedString + + var garbagePassword = "" - func showQwertyPasswordTranskeyAction(){ - // let pbkdfKey = "acc4af609fad57f1cd870a5d94092a24be5fd974" - //// let salts = { 1, 6, 0, 7, 4, 4, 4, 4, 8, 8, 7, 1, 4, 3, 3, 3, 3, 3, 3, 3} - // var PBKDF2_SALT : NSData! - // let PBKDF2_IT = 512; - - // mQwertyTransKeyView?.mTK_SetPBKDF_RandKey(<#T##randkey: NSData!##NSData!#>) - - - // setQwertyTranskey() - - if mQwertyTransKeyView?.isBeingPresented == false { - isShowQwerty = true - isTranskeyShowing = true - - let hintStr = String(format:"password", 0) - let font = UIFont(name: "Arial", size: 15) - - mQwertyTransKeyView?.mTK_SetHint(hintStr, font: font) - mQwertyTransKeyView?.mTK_ShowMessageIfMaxLength("16자리 입력이 초과되었습니다.") - mQwertyTransKeyView?.mTK_UseCursor(true) - mQwertyTransKeyView?.mTK_UseAllDeleteButton(true) - mQwertyTransKeyView?.mTK_UseNavigationBar(true) - mQwertyTransKeyView?.mTK_UseVoiceOver(true) - mQwertyTransKeyView?.mTK_setHideInputPasswordDelay(3) - mQwertyTransKeyView?.mTK_SetControlCenter(false) - mQwertyTransKeyView?.mTK_setIgnoreStatusbar(false) - // mQwertyTransKeyView?.mTK_SetLanguage(1) - mQwertyTransKeyView?.mTK_Supported(byDeviceOrientation: SupportedByDevicePortraitAndLandscape) - mQwertyTransKeyView?.mTK_UseShiftOptional(true) - mQwertyTransKeyView?.setKeyboardType(self, - keypadType: 0, - mTK_inputType: 2, - mTK_inputTitle: "password", - mTK_cryptType: 0, - mTK_maxLength: 100, - mTK_minLength: 0, - mTK_keypadUpper: false, - mTK_languageType: 1) - mQwertyTransKeyView?.mTK_EnableSamekeyInputDataEncrypt(false) - mQwertyTransKeyView?.mTK_SetUseBalloonImageButton(true) - if let mQwertyTransKeyView = mQwertyTransKeyView { - self.present(mQwertyTransKeyView, animated: true, completion: nil) - } - } - + for _ in 0.. Bool { - if textField == passwordTextField { - self.showingPasswordField = true - self.showingConfirmPasswordField = false - self.showQwertyPasswordTranskeyAction() - return false - } - - if textField == confirmPasswordTextfield { - self.showingConfirmPasswordField = true - self.showingPasswordField = false - self.showQwertyPasswordTranskeyAction() - return false - } - return true - } +// MARK: - TablePresenterDelegate +extension RegisterViewController: TablePresenterDelegate { + func TablePresenterView(_ viewController: TablePresenterViewController) -> TablePresenterConfiguration { + return TablePresenterConfiguration( + presenterTitle: "select_country_text".localized(), + closeButtonTitle: "cancel_text".localized(), + notFoundTitle: "no_result_found_text".localized(), + searchBarPlaceHolder: "search_country_text".localized(), + isUseSearchBar: true + ) + } + + func TablePresenterView(_ viewController: TablePresenterViewController, didSelectModel model: TablePresenterProtocol?) { + selectedNativeCountry = model as? NativeCountryModel + } } diff --git a/GMERemittance/Module/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift b/GMERemittance/Module/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift index 1fd5bd41..2609d613 100644 --- a/GMERemittance/Module/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift +++ b/GMERemittance/Module/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift @@ -317,7 +317,7 @@ extension SendMoneyVerificationViewController: BiometricAuthenticationViewContro } extension SendMoneyVerificationViewController: SecureKeypadDelegate { - func didComplete(_ encryptedString: String) { + func didComplete(_ encryptedString: String, length: Int) { self.password = encryptedString } } diff --git a/GMERemittance/Utility/Database/GMEDB.swift b/GMERemittance/Utility/Database/GMEDB.swift index 1bfcb90a..b8fc8d12 100644 --- a/GMERemittance/Utility/Database/GMEDB.swift +++ b/GMERemittance/Utility/Database/GMEDB.swift @@ -106,8 +106,6 @@ extension GMEDB { .set(user?.nickName, .nickName) self.user - // FIXME: FOR TEST -// .set(true, .kyc) .set(user?.kyc, .kyc) .set(user?.pennyTestStatus, .pennyTestStatusCode) .set(user?.verified, .verified) diff --git a/GMERemittance/Utility/SecureKeypad.swift b/GMERemittance/Utility/SecureKeypad.swift index ac711ff0..5f4db767 100644 --- a/GMERemittance/Utility/SecureKeypad.swift +++ b/GMERemittance/Utility/SecureKeypad.swift @@ -9,7 +9,7 @@ import Foundation protocol SecureKeypadDelegate: class { - func didComplete(_ encryptedString: String) + func didComplete(_ encryptedString: String, length: Int) } enum SecureKeypadType { @@ -45,6 +45,7 @@ class SecureKeypad: NSObject { private var keypadType: SecureKeypadType = .ascii private var encryptedString = "" + private var decryptedLength = 0 init(target: UIViewController, keypadType: SecureKeypadType = .ascii) { super.init() @@ -180,13 +181,15 @@ extension SecureKeypad: TransKeyViewDelegate { self.encryptedString = vc.mTK_GetSecureData() - if vc.mTK_GetDataLength() == 0 { + self.decryptedLength = vc.mTK_GetDataLength() + + if self.decryptedLength == 0 { self.encryptedString = "" } vc.dismiss(animated: true){ - self.delegate?.didComplete(self.encryptedString) + self.delegate?.didComplete(self.encryptedString, length: self.decryptedLength) } } } diff --git a/GMERemittance/Utility/TablePresenter/User Interface/View/Cell/TableCell.swift b/GMERemittance/Utility/TablePresenter/User Interface/View/Cell/TableCell.swift index 25a5c74f..82527111 100644 --- a/GMERemittance/Utility/TablePresenter/User Interface/View/Cell/TableCell.swift +++ b/GMERemittance/Utility/TablePresenter/User Interface/View/Cell/TableCell.swift @@ -14,12 +14,18 @@ class TableCell: UITableViewCell { @IBOutlet weak var cellTitleLabel: UILabel! func setModel(_ model: TablePresenterProtocol?) { - if model?.cellImage == nil { - cellImageView.isHidden = true - } - - cellImageView.image = model?.cellImage + let cellImage = model?.cellImage + cellImageView.isHidden = cellImage == nil ? true : false + cellImageView.image = cellImage cellTitleLabel.text = model?.cellTitle } + + func optimizeCell() { + if cellImageView.image == nil { + cellImageView.isHidden = true + } else { + cellImageView.isHidden = false + } + } } diff --git a/GMERemittance/Utility/TablePresenter/User Interface/View/TablePresenterViewController.swift b/GMERemittance/Utility/TablePresenter/User Interface/View/TablePresenterViewController.swift index e5307135..32b08446 100644 --- a/GMERemittance/Utility/TablePresenter/User Interface/View/TablePresenterViewController.swift +++ b/GMERemittance/Utility/TablePresenter/User Interface/View/TablePresenterViewController.swift @@ -147,8 +147,7 @@ extension TablePresenterViewController: UITableViewDataSource { return cell } - - + } // MARK: - UITableViewDelegate @@ -159,6 +158,10 @@ extension TablePresenterViewController: UITableViewDelegate { self.dismiss(animated: true) } } + +// func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { +// (cell as? TableCell)?.optimizeCell() +// } } diff --git a/Pods/ValidationTextField/ValidationTextField/Classes/ValidationTextField.swift b/Pods/ValidationTextField/ValidationTextField/Classes/ValidationTextField.swift index 3243acf8..5071ab5f 100644 --- a/Pods/ValidationTextField/ValidationTextField/Classes/ValidationTextField.swift +++ b/Pods/ValidationTextField/ValidationTextField/Classes/ValidationTextField.swift @@ -383,7 +383,7 @@ open class ValidationTextField: UITextField { } private func update(){ - if !isValid && isEditing && text != "" { + if !isValid && text != "" { errorLabel.text = errorMessage errorLabel.textColor = errorColor errorLabel.font = errorFont diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index 6b45ec3e..96c9b912 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -519,3 +519,8 @@ "id_number_title_text" = "ID Number (Optional)"; "placeholder_enter_id_type_text" = "Select ID Type"; "placeholder_enter_id_number_text" = "Enter receiver's ID number"; + +// New Register +"userid_title_text" = "User ID"; +"userid_placeholder_text" = "Enter your ID for using GME"; +"userid_error_text" = "ID must be at least 6 characters";