Browse Source

add GMEDB

pull/1/head
InKwon James Kim 5 years ago
parent
commit
58b3a20154
  1. BIN
      .DS_Store
  2. 37
      GME Remit.xcodeproj/project.pbxproj
  3. BIN
      GMERemittance/.DS_Store
  4. 230
      GMERemittance/Api/RestApiManager.swift
  5. 21
      GMERemittance/AppDelegate.swift
  6. 2
      GMERemittance/Base/WireframeInput.swift
  7. 20
      GMERemittance/Extension/UIViewControllerExtension.swift
  8. 4
      GMERemittance/Extension/UIViewExtension.swift
  9. 46
      GMERemittance/Library/MultiMediaManager.swift
  10. 4
      GMERemittance/Library/WebLinks/WebLinksViewController.swift
  11. 4
      GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift
  12. 47
      GMERemittance/Model/User.swift
  13. 8
      GMERemittance/Module/AppUpdate/User Interface/View/AppUpdate.storyboard
  14. 11
      GMERemittance/Module/AppUpdate/User Interface/View/AppUpdateViewController.swift
  15. 2
      GMERemittance/Module/AutoDebitModules/AddAccount/User Interface/View/AddAccountViewController.swift
  16. 4
      GMERemittance/Module/AutoDebitModules/AutoDebit/Application Logic/Interactor/AutoDebitInteractor.swift
  17. 8
      GMERemittance/Module/AutoDebitModules/AutoDebit/User Interface/View/AutoDebitViewController.swift
  18. 2
      GMERemittance/Module/Cell/GmeContactsTableViewCell.swift
  19. 14
      GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift
  20. 4
      GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift
  21. 6
      GMERemittance/Module/GmeContacts/User Interface/View/GmeContactsViewController.swift
  22. 4
      GMERemittance/Module/Home/User Interface/View/Cell/HomeRemainingLimitTableViewCell.swift
  23. 33
      GMERemittance/Module/Home/User Interface/View/HomeViewController.swift
  24. 4
      GMERemittance/Module/Login/User Interface/View/LoginViewController.swift
  25. 8
      GMERemittance/Module/Main/User Interface/View/MainViewController.swift
  26. 38
      GMERemittance/Module/Main/User Interface/Wireframe/MainWireframe.swift
  27. 11
      GMERemittance/Module/PopupNotification/User Interface/View/PopupNotificationViewController.swift
  28. 14
      GMERemittance/Module/PopupNotification/User Interface/Wireframe/PopupNotificationWireframe.swift
  29. 2
      GMERemittance/Module/Profile/ProfileChangePasswordViewController.swift
  30. 17
      GMERemittance/Module/Profile/ProfileViewController.swift
  31. 7
      GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractor.swift
  32. 2
      GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewController.swift
  33. 4
      GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1ViewController.swift
  34. 6
      GMERemittance/Module/RegisterModules/KYC/kycForm2/User Interface/View/kycForm2ViewController.swift
  35. 4
      GMERemittance/Module/RegisterModules/KYC/kycForm3/User Interface/View/kycForm3ViewController.swift
  36. 18
      GMERemittance/Module/RegisterModules/PennyTest/User Interface/View/PennyTestViewController.swift
  37. 26
      GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift
  38. 2
      GMERemittance/Module/RegisterModules/Register/User Interface/View/RegisterViewController.swift
  39. 2
      GMERemittance/Module/RewardModules/OrderHistory/Application Logic/Service/OrderHistoryService.swift
  40. 2
      GMERemittance/Module/RewardModules/OrderHistory/User Interface/View/OrderHistoryViewController.swift
  41. 10
      GMERemittance/Module/RewardModules/Redeem/User Interface/View/RedeemViewController.swift
  42. 2
      GMERemittance/Module/RewardModules/Reward/User Interface/View/Cell/RewardItemCollectionViewCell.swift
  43. 4
      GMERemittance/Module/RewardModules/Reward/User Interface/View/RewardViewController.swift
  44. 2
      GMERemittance/Module/SendMoneyModules/PaymentSelection/User Interface/View/PaymentSelectionViewController.swift
  45. 2
      GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepientViewController.swift
  46. 3
      GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/Application Logic/Interactor/EditReciepientInteractor.swift
  47. 2
      GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepientViewController.swift
  48. 12
      GMERemittance/Module/SendMoneyModules/Recipient/RecipientListViewController.swift
  49. 2
      GMERemittance/Module/SendMoneyModules/Resend/User Interface/View/ResendViewController.swift
  50. 6
      GMERemittance/Module/SendMoneyModules/ResendExchange/User Interface/View/ResendExchangeViewController.swift
  51. 9
      GMERemittance/Module/SendMoneyModules/SendMoneyCode/User Interface/View/SendMoneyCodeViewController.swift
  52. 8
      GMERemittance/Module/SendMoneyModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift
  53. 12
      GMERemittance/Module/SendMoneyModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift
  54. 6
      GMERemittance/Module/SendMoneyModules/SendMoneyPaymentMode/User Interface/View/BankBranchPicker/BankBranchPickerViewController.swift
  55. 2
      GMERemittance/Module/SendMoneyModules/SendMoneyPaymentMode/User Interface/View/SendMoneyPaymentModeViewController.swift
  56. 4
      GMERemittance/Module/SendMoneyModules/SendMoneyPaymentMode/User Interface/View/ViewModels/BankPicker/BankPickerViewController.swift
  57. 10
      GMERemittance/Module/SendMoneyModules/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift
  58. 8
      GMERemittance/Module/SendMoneyModules/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractor.swift
  59. 6
      GMERemittance/Module/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift
  60. 12
      GMERemittance/Module/SideMenu/AboutGMEViewController.swift
  61. 10
      GMERemittance/Module/SideMenu/Auto refund/AutoRefundsViewController.swift
  62. 2
      GMERemittance/Module/SideMenu/SettingViewController.swift
  63. 31
      GMERemittance/Module/SideMenu/SideMenuViewController.swift
  64. 20
      GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
  65. 4
      GMERemittance/Module/TransactionHistoryModules/MessageCompose/User Interface/View/MessageComposeViewController.swift
  66. 4
      GMERemittance/Module/TransactionHistoryModules/TransactionHistory/User Interface/View/DatePickerViewController.swift
  67. 2
      GMERemittance/Module/TransactionHistoryModules/TransactionHistory/User Interface/View/TransactionHistoryViewController.swift
  68. 2
      GMERemittance/Module/WalletStatement/User Interface/View/WalletStatementViewController.swift
  69. BIN
      GMERemittance/Utility/.DS_Store
  70. 148
      GMERemittance/Utility/AppConstants.swift
  71. 138
      GMERemittance/Utility/Database/GMEDB.swift
  72. 119
      GMERemittance/Utility/Database/UserDefaultsWrapper.swift
  73. 2
      GMERemittance/Utility/GMENumberTextField.swift
  74. 4
      GMERemittance/Utility/HotLine/Application Logic/Interactor/HotLineInteractor.swift
  75. 4
      GMERemittance/Utility/KeyChain.swift
  76. 113
      GMERemittanceTests/DatabaseTest.swift

BIN
.DS_Store

37
GME Remit.xcodeproj/project.pbxproj

@ -208,6 +208,9 @@
736A8C482277EB2A00337A50 /* BiometricAuthenticationNotification.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 736A8C3D2277EB2900337A50 /* BiometricAuthenticationNotification.storyboard */; };
736A8C492277EB2A00337A50 /* BiometricAuthenticationNotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736A8C3E2277EB2900337A50 /* BiometricAuthenticationNotificationViewController.swift */; };
736A8C4A2277EB2A00337A50 /* BiometricAuthenticationNotificationViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736A8C3F2277EB2900337A50 /* BiometricAuthenticationNotificationViewInterface.swift */; };
7383F43622DEB864003D6393 /* GMEDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7383F43522DEB864003D6393 /* GMEDB.swift */; };
7383F43822DEB87D003D6393 /* DatabaseTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7383F43722DEB87D003D6393 /* DatabaseTest.swift */; };
7383F43E22DF15B8003D6393 /* UserDefaultsWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7383F43D22DF15B8003D6393 /* UserDefaultsWrapper.swift */; };
7384B28222CB377300DD04D9 /* GMEAlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7384B28022CB377300DD04D9 /* GMEAlertViewController.swift */; };
7384B28322CB377300DD04D9 /* GMEAlertViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7384B28122CB377300DD04D9 /* GMEAlertViewController.xib */; };
7388821922CDF20F00592960 /* UITextField+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7388821822CDF20F00592960 /* UITextField+Ext.swift */; };
@ -2384,6 +2387,9 @@
736A8C3D2277EB2900337A50 /* BiometricAuthenticationNotification.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = BiometricAuthenticationNotification.storyboard; sourceTree = "<group>"; };
736A8C3E2277EB2900337A50 /* BiometricAuthenticationNotificationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BiometricAuthenticationNotificationViewController.swift; sourceTree = "<group>"; };
736A8C3F2277EB2900337A50 /* BiometricAuthenticationNotificationViewInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BiometricAuthenticationNotificationViewInterface.swift; sourceTree = "<group>"; };
7383F43522DEB864003D6393 /* GMEDB.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GMEDB.swift; sourceTree = "<group>"; };
7383F43722DEB87D003D6393 /* DatabaseTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseTest.swift; sourceTree = "<group>"; };
7383F43D22DF15B8003D6393 /* UserDefaultsWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsWrapper.swift; sourceTree = "<group>"; };
7384B28022CB377300DD04D9 /* GMEAlertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GMEAlertViewController.swift; sourceTree = "<group>"; };
7384B28122CB377300DD04D9 /* GMEAlertViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GMEAlertViewController.xib; sourceTree = "<group>"; };
7388821822CDF20F00592960 /* UITextField+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField+Ext.swift"; sourceTree = "<group>"; };
@ -5719,6 +5725,15 @@
path = View;
sourceTree = "<group>";
};
7383F43422DEB864003D6393 /* Database */ = {
isa = PBXGroup;
children = (
7383F43522DEB864003D6393 /* GMEDB.swift */,
7383F43D22DF15B8003D6393 /* UserDefaultsWrapper.swift */,
);
path = Database;
sourceTree = "<group>";
};
7384B27F22CB375400DD04D9 /* GMEAlert */ = {
isa = PBXGroup;
children = (
@ -6286,6 +6301,7 @@
7310475B226960E70025D77D /* KeychainTest.swift */,
9FD2610E1FD00458007A511D /* Info.plist */,
738DEC1A22D429AB00936C2C /* FunctionTest.swift */,
7383F43722DEB87D003D6393 /* DatabaseTest.swift */,
);
path = GMERemittanceTests;
sourceTree = "<group>";
@ -10475,6 +10491,7 @@
D96A4FBA2146075800CFD507 /* Utility */ = {
isa = PBXGroup;
children = (
7383F43422DEB864003D6393 /* Database */,
7384B27F22CB375400DD04D9 /* GMEAlert */,
7312F6452281486200172BDD /* ConfirmAlert */,
73895FF522C2F208003FEA90 /* TablePresenter */,
@ -11527,7 +11544,7 @@
TargetAttributes = {
9FD260F31FD00458007A511D = {
CreatedOnToolsVersion = 9.1;
LastSwiftMigration = 0920;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.BackgroundModes = {
@ -11540,6 +11557,7 @@
};
9FD261071FD00458007A511D = {
CreatedOnToolsVersion = 9.1;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
TestTargetID = 9FD260F31FD00458007A511D;
};
@ -13504,6 +13522,7 @@
73157B9F22DC1EEC009B836F /* PopupNotificationInteractorIO.swift in Sources */,
D96A4FDB21460B4A00CFD507 /* SplashScreenWireframeInput.swift in Sources */,
730D78BE227A94F2007E517E /* AddressTableViewCell.swift in Sources */,
7383F43E22DF15B8003D6393 /* UserDefaultsWrapper.swift in Sources */,
730197B222535135001954AB /* kycForm2Wireframe.swift in Sources */,
736A8C422277EB2A00337A50 /* BiometricAuthenticationNotificationServiceType.swift in Sources */,
D9D2242B22407EBA00C7313D /* ResendListModel.swift in Sources */,
@ -13924,6 +13943,7 @@
BEC9AFFC224FC49C00A2DA06 /* BiometricAuthenticationModuleInterface.swift in Sources */,
730D7886227A94E1007E517E /* RedeemViewController.swift in Sources */,
D97785A3215DC55F00754079 /* TransactionHistoryWireframeInput.swift in Sources */,
7383F43622DEB864003D6393 /* GMEDB.swift in Sources */,
04E36E2021AE585200783685 /* PennyTestSubmitWireframeInput.swift in Sources */,
D90A9D5C2136942300A96E45 /* BankBranchPickerViewController.swift in Sources */,
D922D9682135145F00D43053 /* SendMoneyParentWireframe.swift in Sources */,
@ -14048,6 +14068,7 @@
files = (
731154CC227C178A00FEBF7F /* APITest.swift in Sources */,
7310475C226960E70025D77D /* KeychainTest.swift in Sources */,
7383F43822DEB87D003D6393 /* DatabaseTest.swift in Sources */,
738DEC1B22D429AB00936C2C /* FunctionTest.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -14263,8 +14284,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "GMERemittance/GMERemittance-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@ -14297,8 +14317,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "GMERemittance/GMERemittance-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@ -14316,7 +14335,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gmeremit.online.GMERemittanceTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GME Remit.app/GME Remit";
};
@ -14335,7 +14354,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gmeremit.online.GMERemittanceTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GME Remit.app/GME Remit";
};
@ -14353,7 +14372,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gmeremit.online.GMERemittanceUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = GMERemittance;
};
@ -14371,7 +14390,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gmeremit.online.GMERemittanceUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = GMERemittance;
};

BIN
GMERemittance/.DS_Store

230
GMERemittance/Api/RestApiManager.swift

@ -13,144 +13,144 @@ import ObjectMapper
import Localize_Swift
enum ApiResult {
case success(JSON)
case failure(JSON)
case success(JSON)
case failure(JSON)
}
enum Server {
case uat2
case uat
case stagging
case live
case kftcTest
case uat2
case uat
case stagging
case live
case kftcTest
}
class RestApiMananger {
let manager: SessionManager
let manager: SessionManager
static let sharedInstance = RestApiMananger()
static let sharedInstance = RestApiMananger()
init() {
self.manager = Alamofire.SessionManager.default
manager.session.configuration.timeoutIntervalForRequest = 150
}
func getUUID() -> String {
let uuid = UserDefaults.standard.object(forKey: AppConstants.uuid) as? String
if uuid != nil {
return uuid!
} else {
let uuid = UUID().uuidString
UserDefaults.standard.set(uuid, forKey: AppConstants.uuid)
return uuid
}
}
init() {
self.manager = Alamofire.SessionManager.default
manager.session.configuration.timeoutIntervalForRequest = 150
}
func getContentHeaderBeforeLogin() -> [String: String] {
func getUUID() -> String {
return ["Authorization": "Basic " + ("172017F9EC11222E8107142733:QRK2UM0Q" +
":" + getUUID()).toBase64(),
"GME-TOKEN" : "39587YT398@FBQOW8RY3#948R7GB@CNEQW987GF87$TD18$1981..919@@##joghndvberteiru",
"Content-Type": "application/json"]
let uuid = GMEDB.shared.app.string(.uuid)
if uuid != nil {
return uuid!
} else {
let uuid = UUID().uuidString
GMEDB.shared.app.set(uuid, .uuid)
return uuid
}
}
func getContentHeaderAfterLogin() -> [String: String] {
let accessCode = UserDefaults.standard.object(forKey: "com.gmeremit.accessCode") as? String ?? ""
func getContentHeaderBeforeLogin() -> [String: String] {
let currentLanguage = Localize.currentLanguage()
let lang = Utility.getLanguageHeader(for: currentLanguage)
return [
"Authorization": "Bearer " + accessCode,
return ["Authorization": "Basic " + ("172017F9EC11222E8107142733:QRK2UM0Q" +
":" + getUUID()).toBase64(),
"GME-TOKEN" : "39587YT398@FBQOW8RY3#948R7GB@CNEQW987GF87$TD18$1981..919@@##joghndvberteiru",
"Content-Type": "application/json",
"clientId": Utility.getMyKftcClientId(),
"lang" : lang
]
"Content-Type": "application/json"]
}
func getContentHeaderAfterLogin() -> [String: String] {
let accessCode = GMEDB.shared.user.string(.accessCode) ?? ""
let currentLanguage = Localize.currentLanguage()
let lang = Utility.getLanguageHeader(for: currentLanguage)
return [
"Authorization": "Bearer " + accessCode,
"GME-TOKEN" : "39587YT398@FBQOW8RY3#948R7GB@CNEQW987GF87$TD18$1981..919@@##joghndvberteiru",
"Content-Type": "application/json",
"clientId": Utility.getMyKftcClientId(),
"lang" : lang
]
}
// ccr
// added failure for delete operation. check if code is 204. if show show successfull message even in error
func request<T: Mappable>(method: HTTPMethod, url: String, params: [String: Any]?, encoding: ParameterEncoding = JSONEncoding.default, needsAuthorization: Bool = true, success: @escaping (T) -> (), failure: @escaping (Error) -> ()) {
if NetworkReachabilityManager()?.isReachable ?? false {
let header = needsAuthorization ? getContentHeaderAfterLogin() : getContentHeaderBeforeLogin()
manager.request(
url,
method: method,
parameters: params,
encoding: encoding,
headers: header
).handle(success: success, failure: failure)
}else {
let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."])
failure(error)
}
// ccr
// added failure for delete operation. check if code is 204. if show show successfull message even in error
func request<T: Mappable>(method: HTTPMethod, url: String, params: [String: Any]?, encoding: ParameterEncoding = JSONEncoding.default, needsAuthorization: Bool = true, success: @escaping (T) -> (), failure: @escaping (Error) -> ()) {
if NetworkReachabilityManager()?.isReachable ?? false {
let header = needsAuthorization ? getContentHeaderAfterLogin() : getContentHeaderBeforeLogin()
manager.request(
url,
method: method,
parameters: params,
encoding: encoding,
headers: header
).handle(success: success, failure: failure)
}else {
let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."])
failure(error)
}
}
func kftcRequest<T: Mappable>(method: HTTPMethod, header: [String: String], url: String, params: [String: Any]?, encoding: ParameterEncoding = JSONEncoding.default, needsAuthorization: Bool = true, success: @escaping (T) -> (), failure: @escaping (Error) -> ()) {
if NetworkReachabilityManager()?.isReachable ?? false {
manager.request(
url,
method: method,
parameters: params,
encoding: encoding,
headers: header
).handle(success: success, failure: failure)
}else {
let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."])
failure(error)
}
func kftcRequest<T: Mappable>(method: HTTPMethod, header: [String: String], url: String, params: [String: Any]?, encoding: ParameterEncoding = JSONEncoding.default, needsAuthorization: Bool = true, success: @escaping (T) -> (), failure: @escaping (Error) -> ()) {
if NetworkReachabilityManager()?.isReachable ?? false {
manager.request(
url,
method: method,
parameters: params,
encoding: encoding,
headers: header
).handle(success: success, failure: failure)
}else {
}
func requestMultipart<T: Mappable>(
method: HTTPMethod,
_ URLString: URLConvertible,
parameters: [String: String]? = nil,
images: [String: Data],
encoding: Alamofire.ParameterEncoding = URLEncoding.default,
needsAuthorization: Bool = true,
success: @escaping (T)-> Void,
failure: @escaping (Error) -> ()) {
if NetworkReachabilityManager()?.isReachable == true {
let headers = needsAuthorization ? getContentHeaderAfterLogin() : getContentHeaderBeforeLogin()
self.manager.upload(
multipartFormData: { multipartFormData in
if !images.isEmpty {
images.forEach({ (data) in
multipartFormData.append(data.value, withName: data.key, fileName: data.key + ".jpeg", mimeType: "image/jpeg")
})
}
parameters?.forEach({ (params) in
multipartFormData.append(params.value.data(using: String.Encoding.utf8, allowLossyConversion: false)!, withName: params.key)
})
},
to: URLString,
method: method,
headers: headers,
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.handle(success: success, failure: failure)
case .failure:
let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."])
failure(error)
}
}
func requestMultipart<T: Mappable>(
method: HTTPMethod,
_ URLString: URLConvertible,
parameters: [String: String]? = nil,
images: [String: Data],
encoding: Alamofire.ParameterEncoding = URLEncoding.default,
needsAuthorization: Bool = true,
success: @escaping (T)-> Void,
failure: @escaping (Error) -> ()) {
if NetworkReachabilityManager()?.isReachable == true {
let headers = needsAuthorization ? getContentHeaderAfterLogin() : getContentHeaderBeforeLogin()
self.manager.upload(
multipartFormData: { multipartFormData in
if !images.isEmpty {
images.forEach({ (data) in
multipartFormData.append(data.value, withName: data.key, fileName: data.key + ".jpeg", mimeType: "image/jpeg")
})
}
parameters?.forEach({ (params) in
multipartFormData.append(params.value.data(using: String.Encoding.utf8, allowLossyConversion: false)!, withName: params.key)
})
},
to: URLString,
method: method,
headers: headers,
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.handle(success: success, failure: failure)
case .failure:
let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."])
failure(error)
}
}
)
} else {
let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."])
failure(error)
}
}
}
)
} else {
let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."])
failure(error)
}
}
}

21
GMERemittance/AppDelegate.swift

@ -20,7 +20,7 @@ import IQKeyboardManagerSwift
import LGSideMenuController
import Localize_Swift
let server: Server = .live
let server: Server = .stagging
var overlayView: UIView?
@UIApplicationMain
@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
UIApplication.shared.applicationIconBadgeNumber = 0
@ -56,8 +56,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
setupNavBar()
setEntryPoint()
UserDefaults.standard.removeObject(forKey: AppConstants.isOpenedTokenRenwalAlert)
UserDefaults.standard.removeObject(forKey: AppConstants.isOpenedPopupNotification)
GMEDB
.shared
.app
.remove([.isOpenedTokenRenwalAlert, .isOpenedPopupNotification])
return true
}
@ -89,9 +91,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
func applicationDidEnterBackground(_ application: UIApplication) {
let store = UserDefaults.standard
let language = Localize.currentLanguage()
store.set(language, forKey: AppConstants.currentLanguage)
GMEDB.shared.app.set(language, .currentLanguage)
let viewcontroller = UIViewController()
viewcontroller.view.backgroundColor = AppConstants.themeRedColor
@ -103,12 +104,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let topView = UIApplication.shared.keyWindow?.subviews.last
topView?.addSubview(view)
topView?.bringSubview(toFront: view)
topView?.bringSubviewToFront(view)
}
func applicationWillEnterForeground(_ application: UIApplication) {
if let language = UserDefaults.standard.string(forKey: AppConstants.currentLanguage) {
if let language = GMEDB.shared.app.string(.currentLanguage) {
Localize.setCurrentLanguage(language)
}
overlayView?.removeFromSuperview()
@ -120,9 +121,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// MARK: - Other Functions
extension AppDelegate {
private func setUUID() {
if UserDefaults.standard.string(forKey: AppConstants.uuid) == nil {
if GMEDB.shared.app.string(.uuid) == nil {
let uuid = UUID().uuidString
UserDefaults.standard.set(uuid, forKey: AppConstants.uuid)
GMEDB.shared.app.set(uuid, .uuid)
}
}

2
GMERemittance/Base/WireframeInput.swift

@ -10,7 +10,7 @@ import UIKit
protocol WireframeInput {
var window: UIWindow? {get}
weak var view: UIViewController! {get}
var view: UIViewController! {get}
var storyboardName: String {get}
func openMainView(source: UIViewController)
func pushMainView(on source: UIViewController)

20
GMERemittance/Extension/UIViewControllerExtension.swift

@ -78,10 +78,10 @@ extension UIViewController {
message: String?,
title: String? = nil,
okTitle: String = "ok_text".localized(),
style: UIAlertControllerStyle? = .alert,
style: UIAlertController.Style? = .alert,
cancelTitle: String = "cancel_text".localized(),
OkStyle: UIAlertActionStyle = .default,
cancelStyle: UIAlertActionStyle = .default,
OkStyle: UIAlertAction.Style = .default,
cancelStyle: UIAlertAction.Style = .default,
okAction: (()->())? = nil,
cancelAction: (()->())? = nil
) {
@ -112,8 +112,8 @@ extension UIViewController {
message: String?,
title: String? = nil,
okTitle: String = "ok_text".localized(),
style: UIAlertControllerStyle? = .alert,
OkStyle: UIAlertActionStyle = .default,
style: UIAlertController.Style? = .alert,
OkStyle: UIAlertAction.Style = .default,
okAction: (()->())? = nil
) {
let settedTitle: String
@ -142,9 +142,9 @@ extension UIViewController {
type: AlertType,
message: String?,
title: String?,
style: UIAlertControllerStyle? = .alert
style: UIAlertController.Style? = .alert
) -> UIAlertController {
let customerWalletNumber = UserDefaults.standard.string(forKey: UserKeys.walletNumber) ?? ""
let customerWalletNumber = GMEDB.shared.user.string(.walletNumber) ?? ""
let customerTitle: String
switch type {
@ -184,7 +184,7 @@ extension UIViewController {
) {
let titleText: String
let customerWalletNumber = UserDefaults.standard.string(forKey: UserKeys.walletNumber) ?? ""
let customerWalletNumber = GMEDB.shared.user.string(.walletNumber) ?? ""
switch type {
case .error:
@ -212,7 +212,7 @@ extension UIViewController {
}
extension UIAlertController {
func addAction(title: String?, style: UIAlertActionStyle = .default, handler: (()->())? = nil) {
func addAction(title: String?, style: UIAlertAction.Style = .default, handler: (()->())? = nil) {
let action = UIAlertAction(title: title, style: style, handler: {_ in
handler?()
})
@ -268,7 +268,7 @@ extension UIViewController {
if #available(iOS 11.0, *) {
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationController?.navigationBar.largeTitleTextAttributes =
[NSAttributedStringKey.font: font]
[NSAttributedString.Key.font: font]
}
// UINavigationBar.appearance().titleTextAttributes =

4
GMERemittance/Extension/UIViewExtension.swift

@ -29,13 +29,13 @@ extension UIView {
extension UIView {
func fadeIn(duration: TimeInterval = 1.0, delay: TimeInterval = 0.0, completion: @escaping ((Bool) -> Void) = {(finished: Bool) -> Void in}) {
UIView.animate(withDuration: duration, delay: delay, options: UIViewAnimationOptions.curveEaseIn, animations: {
UIView.animate(withDuration: duration, delay: delay, options: UIView.AnimationOptions.curveEaseIn, animations: {
self.alpha = 1.0
}, completion: completion)
}
func fadeOut(duration: TimeInterval = 1.0, delay: TimeInterval = 3.0, completion: @escaping (Bool) -> Void = {(finished: Bool) -> Void in}) {
UIView.animate(withDuration: duration, delay: delay, options: UIViewAnimationOptions.curveEaseIn, animations: {
UIView.animate(withDuration: duration, delay: delay, options: UIView.AnimationOptions.curveEaseIn, animations: {
self.alpha = 0.0
}, completion: completion)
}

46
GMERemittance/Library/MultiMediaManager.swift

@ -35,19 +35,19 @@ class MultiMediaManager: NSObject {
imagePicker.allowsEditing = true
}
func openPicker(mode: UIImagePickerControllerCameraCaptureMode) {
var presentationStyle: UIAlertControllerStyle = .actionSheet
func openPicker(mode: UIImagePickerController.CameraCaptureMode) {
var presentationStyle: UIAlertController.Style = .actionSheet
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad) {
presentationStyle = .alert
}
//
let alertController = UIAlertController(title: nil, message: "Gme would like to access your camera", preferredStyle: presentationStyle)
let cameraAction = UIAlertAction(title: "camera_text".localized(), style: UIAlertActionStyle.default) { (action) in
let cameraAction = UIAlertAction(title: "camera_text".localized(), style: UIAlertAction.Style.default) { (action) in
self.openCamera(mode: .photo)
}
let galleryAction = UIAlertAction(title: "gallery_text".localized(), style: UIAlertActionStyle.default) { (action) in
let galleryAction = UIAlertAction(title: "gallery_text".localized(), style: UIAlertAction.Style.default) { (action) in
self.showPhotoGallery(mode: mode)
}
let cancelAction = UIAlertAction(title: "cancel_text".localized(), style: .cancel, handler: nil)
@ -63,9 +63,9 @@ class MultiMediaManager: NSObject {
}
}
func openCamera(mode: UIImagePickerControllerCameraCaptureMode) {
func openCamera(mode: UIImagePickerController.CameraCaptureMode) {
func openPicker() {
self.imagePicker.sourceType = UIImagePickerControllerSourceType.camera
self.imagePicker.sourceType = UIImagePickerController.SourceType.camera
let mediaTypes = ["public.image"]
self.imagePicker.mediaTypes = mediaTypes
self.imagePicker.cameraCaptureMode = mode
@ -78,9 +78,9 @@ class MultiMediaManager: NSObject {
openPicker()
}else {
self.presenter?.presenting().alert(message: "camera_access_denied_text", okAction: {
let url = URL(string: UIApplicationOpenSettingsURLString)!
let url = URL(string: UIApplication.openSettingsURLString)!
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
UIApplication.shared.open(url, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
} else {
// Fallback on earlier versions
}
@ -89,19 +89,19 @@ class MultiMediaManager: NSObject {
}
}
private func showPhotoGallery(mode: UIImagePickerControllerCameraCaptureMode) {
private func showPhotoGallery(mode: UIImagePickerController.CameraCaptureMode) {
PermissionHelper.isAllowedToShowGallary { (isAllowed) in
if isAllowed {
self.imagePicker.allowsEditing = false
self.imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary
self.imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
let mediaTypes = mode == .video ? ["public.image", "public.movie"] : ["public.image"]
self.imagePicker.mediaTypes = mediaTypes
self.presentViewController(viewController: self.imagePicker, animated: true, completion: nil)
}else {
self.presenter?.presenting().alert(message: "galery_access_denied_text".localized(), okAction: {
let url = URL(string: UIApplicationOpenSettingsURLString)!
let url = URL(string: UIApplication.openSettingsURLString)!
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
UIApplication.shared.open(url, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
} else {
// Fallback on earlier versions
}
@ -125,12 +125,15 @@ class MultiMediaManager: NSObject {
}
extension MultiMediaManager: UIImagePickerControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
// Local variable inserted by Swift 4.2 migrator.
let info = convertFromUIImagePickerControllerInfoKeyDictionary(info)
var completion: (()->())?
if let mediaType = info["UIImagePickerControllerMediaType"] as? String {
if mediaType == "public.image" {
if let picture = info[UIImagePickerControllerOriginalImage] as? UIImage {
if let picture = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.originalImage)] as? UIImage {
if let cropsize = self.delegate?.cropSize?() {
if picture.size.width < cropsize.width || picture.size.height < cropsize.height {
self.delegate?.didFinishPickingWithError(error: "Image size must be greater than \(cropsize.width) X \(cropsize.height)")
@ -181,3 +184,18 @@ struct PermissionHelper {
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromUIImagePickerControllerInfoKeyDictionary(_ input: [UIImagePickerController.InfoKey: Any]) -> [String: Any] {
return Dictionary(uniqueKeysWithValues: input.map {key, value in (key.rawValue, value)})
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromUIImagePickerControllerInfoKey(_ input: UIImagePickerController.InfoKey) -> String {
return input.rawValue
}

4
GMERemittance/Library/WebLinks/WebLinksViewController.swift

@ -32,11 +32,11 @@ class WebLinksViewController: UIViewController {
override func viewDidLoad() {
UIApplication.shared.statusBarStyle = .lightContent
super.viewDidLoad()
let barButton = UIBarButtonItem.init(title: "penny_test_close_text".localized(), style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.cancel))
let barButton = UIBarButtonItem.init(title: "penny_test_close_text".localized(), style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.cancel))
self.navigationItem.rightBarButtonItem = barButton
webView = UIWebView(frame: self.view.frame)
webView?.delegate = self
activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
activityIndicator = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.gray)
activityIndicator?.center = self.view.center
self.view.addSubview(webView!)
self.view.addSubview(activityIndicator!)

4
GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift

@ -38,13 +38,13 @@ class WkWebViewController: UIViewController {
view = webView
self.webView = webView
activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
activityIndicator = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.gray)
webView.addSubview(activityIndicator!)
webView.isUserInteractionEnabled = true
activityIndicator?.startAnimating()
activityIndicator?.isHidden = false
activityIndicator?.hidesWhenStopped = true
webView.bringSubview(toFront: activityIndicator!)
webView.bringSubviewToFront(activityIndicator!)
if let myURL = URL(string: url ?? "") {
let myRequest = URLRequest(url: myURL)

47
GMERemittance/Model/User.swift

@ -6,53 +6,8 @@
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
//
import Foundation
import ObjectMapper
struct UserKeys {
static let yearlyLimit = "yearlyLimit"
static let userId = "com.gmeremit.username"
static let senderId = "senderId"
static let fullName = "com.gmeremit.fullName"
static let firstName = "firstName"
static let middleName = "middleName"
static let lastName = "lastName"
static let nickName = "com.gmeremit.nickName"
static let dateOfBirth = "date_of_birth"
static let email = "com.gmeremit.email"
static let mobileNumber = "com.gmeremit.mobileNumber"
static let rewardPoint = "com.gmeremit.rewardPoint"
static let walletNumber = "com.gmeremit.walletNumber"
static let availableBalance = "com.gmeremit.balance"
static let primaryBankName = "com.gmeremit.bankName"
static let primaryAccountNumber = "PrimaryAccountNumber"
static let accessCode = "com.gmeremit.accessCode"
static let dpUrl = "com.gmeremit.dpUrl"
static let kyc = "com.gmeremit.isKYCSubmitted"
static let verified = "com.gmeremit.isVerified"
static let active = "active"
static let cmRegistrationId = "cmRegistrationId"
static let isReferred = "com.gmeremit.isReferred"
static let country = "country"
static let province = "province"
static let provinceId = "provinceId"
static let sourceId = "com.gmeremit.sourceId"
static let idType = "idType"
static let idNumber = "idNumber"
static let countryCode = "countryCode"
static let ErrorCode = "ErrorCode"
static let hasRequestedPennyTest = "hasRequestedPennyTest"
static let isPennyTestPending = "isPennyTestPending"
static let kftcClientId = "kftcClientId"
static let Msg = "Msg"
static let Id = "Id"
static let Data = "Data"
static let isUseBiometricAuth = "com.gmeremit.isUseBiometricAuth"
static let remindKFTCTokenDay = "remindKFTCTokenDay"
}
class UserContainer: Mappable {
var errorCode: String?
var message: String?
@ -130,7 +85,7 @@ class User: Mappable {
availableBalance <- map["availableBalance"]
accessCode <- map["accessCode"]
dpUrl <- map["dpUrl"]
dateOfBirth <- map["Dob"]
dateOfBirth <- map["dob"]
platforms <- map["appUpdate"]
kyc <- map["kyc"]
yearlyLimit <- map["yearlyLimit"]

8
GMERemittance/Module/AppUpdate/User Interface/View/AppUpdate.storyboard

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="HSb-ou-7T5">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="HSb-ou-7T5">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
@ -127,8 +127,8 @@
</scene>
</scenes>
<resources>
<image name="ic_cloud_banner" width="4000" height="102"/>
<image name="ic_logo_white_large 2" width="665" height="196"/>
<image name="ic_cloud_banner" width="2000" height="51"/>
<image name="ic_logo_white_large 2" width="332.5" height="98"/>
</resources>
<color key="tintColor" red="0.78177064659999995" green="0.55228364470000002" blue="0.018981300289999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</document>

11
GMERemittance/Module/AppUpdate/User Interface/View/AppUpdateViewController.swift

@ -53,8 +53,8 @@ class AppUpdateViewController: UIViewController {
private func configureText() {
self.updateMessageTextLabel.text = StringConstants().updateMessageText
self.updateButton.setTitle(StringConstants().updateText, for: UIControlState.normal)
self.notNowButton.setTitle(StringConstants().notNowText, for: UIControlState.normal)
self.updateButton.setTitle(StringConstants().updateText, for: UIControl.State.normal)
self.notNowButton.setTitle(StringConstants().notNowText, for: UIControl.State.normal)
}
func configureUpdateButton() {
@ -72,7 +72,7 @@ class AppUpdateViewController: UIViewController {
func update() {
let urlStr = "itms-apps://itunes.apple.com/gh/app/gme-remit/id1439161261?mt=8"
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
UIApplication.shared.open(URL(string: urlStr)!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
} else {
UIApplication.shared.openURL(URL(string: urlStr)!)
@ -84,3 +84,8 @@ class AppUpdateViewController: UIViewController {
extension AppUpdateViewController: AppUpdateViewInterface {
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
}

2
GMERemittance/Module/AutoDebitModules/AddAccount/User Interface/View/AddAccountViewController.swift

@ -105,7 +105,7 @@ class AddAccountViewController: UIViewController {
@IBAction private func verifyAccountButtonTouch(_ sender: UIButton) {
presenter?.verifyAccount(
customerID: UserDefaults.standard.string(forKey: UserKeys.senderId) ?? "", // senderID
customerID: GMEDB.shared.user.string(.senderId) ?? "", // senderID
bankCode: selectedBank?.bankCode ?? "",
accountNumber: accountTextField.text ?? "")
}

4
GMERemittance/Module/AutoDebitModules/AutoDebit/Application Logic/Interactor/AutoDebitInteractor.swift

@ -28,7 +28,7 @@ class AutoDebitInteractor {
extension AutoDebitInteractor: AutoDebitInteractorInput {
func fetchKFTCBankAccountList() {
guard let email = UserDefaults.standard.string(forKey: UserKeys.email)
guard let email = GMEDB.shared.user.string(.email)
else {
return
}
@ -67,7 +67,7 @@ extension AutoDebitInteractor: AutoDebitInteractorInput {
func refreshToken(language: KftcLanguage?) {
guard
let email = UserDefaults.standard.string(forKey: UserKeys.email),
let email = GMEDB.shared.user.string(.email),
let language = language else { return }
let service2 = AddAccountService()

8
GMERemittance/Module/AutoDebitModules/AutoDebit/User Interface/View/AutoDebitViewController.swift

@ -227,13 +227,11 @@ extension AutoDebitViewController: UITableViewDelegate {
message: self.multiLanguages.deleteTitleText,
title: self.multiLanguages.confirmationText,
okTitle: self.multiLanguages.deleteText,
OkStyle: UIAlertActionStyle.destructive,
OkStyle: UIAlertAction.Style.destructive,
okAction: { [weak self] in
guard let `self` = self else { return }
let email = UserDefaults
.standard
.string(forKey: "com.gmeremit.username") ?? ""
let email = GMEDB.shared.user.string(.userId) ?? ""
guard let account = self.accounts?.elementAt(index: indexPath.row) else { return }
@ -319,7 +317,7 @@ extension AutoDebitViewController: UIPickerViewDataSource {
extension AutoDebitViewController {
private func addRefreshControlTableView() {
let colorOption = [NSAttributedStringKey.foregroundColor : AppConstants.themWhiteColor];
let colorOption = [NSAttributedString.Key.foregroundColor : AppConstants.themWhiteColor];
let title = NSAttributedString(string: "Token Renewal", attributes: colorOption)

2
GMERemittance/Module/Cell/GmeContactsTableViewCell.swift

@ -31,7 +31,7 @@ class GmeContactsTableViewCell: UITableViewCell {
self.addressLabel.text = contact?.address
self.languageLabel.text = contact?.language
self.telephoneButton.setTitle((contact?.contactNumber?.joined(separator: ", ") ) ?? "", for: UIControlState.normal)
self.telephoneButton.setTitle((contact?.contactNumber?.joined(separator: ", ") ) ?? "", for: UIControl.State.normal)
self.languageLabel.isHidden = (contact?.language ?? "") == ""
}

14
GMERemittance/Module/ExchangeRates/User Interface/View/ExchangeRatesViewController.swift

@ -136,7 +136,7 @@ class ExchangeRatesViewController: UIViewController {
// todo: show default native country and falg
// Do any additional setup after loading the view.
// populateDefaultAmounts()
self.nativeCountryCode = UserDefaults.standard.string(forKey: UserKeys.countryCode)
self.nativeCountryCode = GMEDB.shared.user.string(.countryCode)
fetchExchangeRateInformation()
}
@ -420,11 +420,11 @@ class ExchangeRatesViewController: UIViewController {
let tapGuesture = UITapGestureRecognizer(target: self, action: #selector(self.showCountryList(_:)))
self.countryListTapGuesture = tapGuesture
self.countryListStackView.addGestureRecognizer(self.countryListTapGuesture!)
self.reciepientTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControlEvents.editingChanged)
self.senderTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControlEvents.editingChanged)
self.reciepientTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
self.senderTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
self.reciepientTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControlEvents.editingDidBegin)
self.senderTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControlEvents.editingDidBegin)
self.reciepientTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControl.Event.editingDidBegin)
self.senderTextField.addTarget(self, action: #selector(self.textFieldSelected(sender:)), for: UIControl.Event.editingDidBegin)
}
@ -458,7 +458,7 @@ class ExchangeRatesViewController: UIViewController {
}
private func setup() {
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImageRenderingMode.alwaysTemplate)
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImage.RenderingMode.alwaysTemplate)
let image = dropDownImage
self.dropDownImageView.image = image
self.dropDownImageView.tintColor = UIColor.white
@ -485,7 +485,7 @@ class ExchangeRatesViewController: UIViewController {
self.youSendTitleLabel.text = constant.youSendText
self.recepientGetsTitleLabel.text = constant.recepientGetsText
self.selectPaymentModeTitleLabel.text = "select_payment_mode_text".localized()
self.calculateTItleLabel.setTitle(constant.calculate, for: UIControlState.normal)
self.calculateTItleLabel.setTitle(constant.calculate, for: UIControl.State.normal)
}
func show(error: String) {

4
GMERemittance/Module/ForgotPassword/User Interface/View/ForgotPasswordViewController.swift

@ -71,8 +71,8 @@ class ForgotPasswordViewController: UIViewController {
func configureLanguage() {
self.userNameTextField.placeholder = StringConstants().userIdPlaceholder
self.dobTextField.placeholder = StringConstants().dobPlaceholder
self.resetButton.setTitle(StringConstants().resetText, for: UIControlState.normal)
self.cancelButton.setTitle(StringConstants().cancelText, for: UIControlState.normal)
self.resetButton.setTitle(StringConstants().resetText, for: UIControl.State.normal)
self.cancelButton.setTitle(StringConstants().cancelText, for: UIControl.State.normal)
self.headerLabel.text = StringConstants().headerTitle
self.subHeaderLabel.text = StringConstants().subHeaderTitle
self.userIdTitleLabel.text = "email_text".localized()

6
GMERemittance/Module/GmeContacts/User Interface/View/GmeContactsViewController.swift

@ -191,7 +191,7 @@ extension GmeContactsViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
print(indexPath.row)
if indexPath.row == 0 {return 10}
return UITableViewAutomaticDimension
return UITableView.automaticDimension
}
}
@ -226,7 +226,7 @@ extension GmeContactsViewController: GmeContactCallDelegate {
let alert = UIAlertController(title:nil, message:"help_you_text".localized(), preferredStyle: .actionSheet)
numbers?.forEach({ number in
let action = UIAlertAction.init(title: "\(number)", style: UIAlertActionStyle.default, handler: { action in
let action = UIAlertAction.init(title: "\(number)", style: UIAlertAction.Style.default, handler: { action in
self.call(number: number)
})
alert.addAction(action)
@ -234,7 +234,7 @@ extension GmeContactsViewController: GmeContactCallDelegate {
alert.view.tintColor = UIColor.darkGray
alert.addAction(UIAlertAction(title: "cancel_text".localized(), style: UIAlertActionStyle.cancel, handler: nil))
alert.addAction(UIAlertAction(title: "cancel_text".localized(), style: UIAlertAction.Style.cancel, handler: nil))
present(alert, animated: true, completion: nil)
}

4
GMERemittance/Module/Home/User Interface/View/Cell/HomeRemainingLimitTableViewCell.swift

@ -33,7 +33,7 @@ class HomeRemainingLimitTableViewCell: UITableViewCell {
}
func setup() {
let limits = UserDefaults.standard.string(forKey: UserKeys.yearlyLimit)
let limits = GMEDB.shared.user.string(.yearlyLimit)
self.amountLabel.text = limits
self.userNameLabel.text = user?.firstName?.capitalized
configureText()
@ -42,7 +42,7 @@ class HomeRemainingLimitTableViewCell: UITableViewCell {
self.pointContainerView.addGestureRecognizer(self.rewardTapGesture)
self.pointContainerView.isUserInteractionEnabled = true
self.rewardPointAmountLabel.text = UserDefaults.standard.string(forKey: UserKeys.rewardPoint)?.likeCommaMoney()
self.rewardPointAmountLabel.text = GMEDB.shared.user.string(.rewardPoint)?.likeCommaMoney()
self.pointBackgroundView.layer.cornerRadius = 10
pointContainerView.layer.cornerRadius = 10

33
GMERemittance/Module/Home/User Interface/View/HomeViewController.swift

@ -73,10 +73,9 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
var hotLines: [HotLine]? {
didSet {
guard let nativeCountry = UserDefaults.standard.string(forKey: UserKeys.countryCode)?.lowercased() else {
guard let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased() else {
return
}
// let userCountry = UserDefaults.standard.string(forKey: AppConstants.firstTimeLanguageIsSet)
userHotLine = hotLines?.filter { $0.countryCode == nativeCountry }.first
}
}
@ -168,7 +167,7 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
guard let ios = platform.filter({ $0.os ?? "" == "IOS"}).first else {return}
let critical = ios.critical ?? "N"
UserDefaults.standard.set(critical, forKey: AppConstants.criticalUpdate)
GMEDB.shared.app.set(critical, .criticalUpdate)
if critical == "Y" {
guard
@ -195,7 +194,8 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
private func updateBalance() {
let balance = user?.availableBalance ?? ""
UserDefaults.standard.set(balance, forKey: UserKeys.availableBalance)
GMEDB.shared.user.set(balance, .availableBalance)
let userInfo = [SideMenuNavigationNotifications.availableBalance : balance]
NotificationCenter.default.post(name: self.getAvailableBalanceNotificationName(), object: nil, userInfo: userInfo)
self.tableView.reloadData()
@ -258,7 +258,7 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
}
private func addRefreshControlTableView() {
let colorOption = [NSAttributedStringKey.foregroundColor : AppConstants.themWhiteColor];
let colorOption = [NSAttributedString.Key.foregroundColor : AppConstants.themWhiteColor];
let title = NSAttributedString(string: "pull to refresh", attributes: colorOption)
let refreshControl = UIRefreshControl()
@ -316,7 +316,7 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
// alert.view.subviews.last?.subviews.last?.layer.cornerRadius = 10
alert.addAction(UIAlertAction(title: "cancel_text".localized(), style: UIAlertActionStyle.cancel, handler: nil))
alert.addAction(UIAlertAction(title: "cancel_text".localized(), style: UIAlertAction.Style.cancel, handler: nil))
if UIDevice.current.userInterfaceIdiom == .pad { // iPad
if let popoverController = alert.popoverPresentationController { // ActionSheet .
@ -394,7 +394,7 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
self.verificationText.text = StringConstants().registerProcessText
self.verificationHeaderLeftImageview.image = UIImage.init(named: "ic_home_verified")
let image = UIImage.init(named: "ic_home_payoutLocation")
self.verificationHeaderRightButton.setImage(image, for: UIControlState.normal)
self.verificationHeaderRightButton.setImage(image, for: UIControl.State.normal)
}else if didSubmitKycAndNotVerified() && shouldShowPennyTestError() {
verificationTitleLabel.text = StringConstants().continueRegistrationTitleText
self.verificationText.text = StringConstants().pennyTestPrimaryBankText
@ -407,7 +407,7 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
verificationTitleLabel.text = StringConstants().verificationInProcessTitleText
self.verificationText.text = StringConstants().soonToUseGmeServicesTitle
self.verificationHeaderLeftImageview.image = #imageLiteral(resourceName: "ic_home_verified")
self.verificationHeaderRightButton.setImage(#imageLiteral(resourceName: "ic_home_payoutLocation"), for: UIControlState.normal)
self.verificationHeaderRightButton.setImage(#imageLiteral(resourceName: "ic_home_payoutLocation"), for: UIControl.State.normal)
}
if didSubmitKycAndVerified() && !Utility.pennyTestVerified() {
@ -649,7 +649,7 @@ extension HomeViewController: UITableViewDelegate {
switch _section {
case .balance:
return UITableViewAutomaticDimension
return UITableView.automaticDimension
case .collection:
let totalHeight = view.frame.height
let ramainingBalanceCellHeight: CGFloat = 100
@ -760,20 +760,15 @@ extension HomeViewController: UIGestureRecognizerDelegate {
extension HomeViewController {
private func save(value: Any?, forKey: String) {
let defaults = UserDefaults.standard
defaults.set(value, forKey: forKey)
}
func save(user: User?) {
Utility.save(user: user)
}
private func checkKFTCToken() {
if !UserDefaults.standard.bool(forKey: AppConstants.isOpenedTokenRenwalAlert) {
if !GMEDB.shared.app.bool(.isOpenedTokenRenwalAlert) {
// TODO: Show Alert for token refresh (navigation push)
guard
let remind = UserDefaults.standard.string(forKey: UserKeys.remindKFTCTokenDay),
let remind = GMEDB.shared.user.string(.remindKFTCTokenDay),
let remindDay = Int(remind) else {
popUpNotification()
return
@ -791,11 +786,11 @@ extension HomeViewController {
cancelTitle: "later_text".localized(),
okAction: {
AutoDebitWireframe().pushMainView(on: self)
UserDefaults.standard.set(true, forKey: AppConstants.isOpenedTokenRenwalAlert)
GMEDB.shared.app.set(true, .isOpenedTokenRenwalAlert)
},
cancelAction : {
self.popUpNotification()
UserDefaults.standard.set(true, forKey: AppConstants.isOpenedTokenRenwalAlert)
GMEDB.shared.app.set(true, .isOpenedTokenRenwalAlert)
}
)
} else {
@ -810,7 +805,7 @@ extension HomeViewController {
dateformat.dateFormat = "yyyy-MM-dd"
let expireDate = dateformat.date(from: "2019-08-01")
UserDefaults.standard.set(expireDate, forKey: AppConstants.dateOfExpireNotification)
GMEDB.shared.app.set(expireDate, .dateOfExpireNotification)
PopupNotificationWireframe().show(source: self)
}
}

4
GMERemittance/Module/Login/User Interface/View/LoginViewController.swift

@ -178,7 +178,7 @@ class LoginViewController: UIViewController {
self.subtitle.alpha = 0
self.forgotPasswordView.alpha = 0
self.logoImageView.center.y += (self.logoImageView.bounds.height + 20)
self.loginButton.setTitle("", for: UIControlState.normal)
self.loginButton.setTitle("", for: UIControl.State.normal)
}
@ -197,7 +197,7 @@ class LoginViewController: UIViewController {
UIView.animate(withDuration: 0.5, delay: 0.4, options: [], animations: {
self.loginButton.transform = CGAffineTransform.identity
}, completion: { (_) in
self.loginButton.setTitle("Login", for: UIControlState.normal)
self.loginButton.setTitle("Login", for: UIControl.State.normal)
})

8
GMERemittance/Module/Main/User Interface/View/MainViewController.swift

@ -85,8 +85,8 @@ extension UINavigationBar {
navBarAppearance.barTintColor = Colors.defaultRed
let font = Fonts.NavBar.titleFont
navBarAppearance.titleTextAttributes = [
NSAttributedStringKey.foregroundColor: UIColor.black,
NSAttributedStringKey.font: font]
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.font: font]
navBarAppearance.tintColor = UIColor.black
}
@ -95,8 +95,8 @@ extension UINavigationBar {
navBarAppearance.barTintColor = Colors.defaultRed
let font = Fonts.NavBar.titleFont
navBarAppearance.titleTextAttributes = [
NSAttributedStringKey.foregroundColor: UIColor.black,
NSAttributedStringKey.font: font]
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.font: font]
navBarAppearance.tintColor = UIColor.black
}
}

38
GMERemittance/Module/Main/User Interface/Wireframe/MainWireframe.swift

@ -58,7 +58,7 @@ extension MainWireframe: MainWireframeInput {
message: message,
title: "Warning",
okTitle: "Logout",
style: UIAlertControllerStyle.alert,
style: UIAlertController.Style.alert,
OkStyle: .destructive
){
self.logout()
@ -67,43 +67,11 @@ extension MainWireframe: MainWireframeInput {
static func logout() {
guard let window = MainWireframe.shared?.window else {return}
let store = UserDefaults.standard
store.set(false, forKey: "com.gmeremit.loginStatus")
store.removeObject(forKey: "com.gmeremit.dpUrl")
store.removeObject(forKey: "com.gmeremit.walletNumber")
store.removeObject(forKey: "com.gmeremit.bankName")
store.removeObject(forKey: "com.gmeremit.fullName")
store.removeObject(forKey: "com.gmeremit.username")
store.removeObject(forKey: "com.gmeremit.nickName")
store.removeObject(forKey: "com.gmeremit.balance")
store.removeObject(forKey: "com.gmeremit.rewardPoint")
store.removeObject(forKey: "com.gmeremit.isVerified")
store.removeObject(forKey: "com.gmeremit.isKYCSubmitted")
store.removeObject(forKey: "com.gmeremit.email")
store.removeObject(forKey: "com.gmeremit.mobileNumber")
store.removeObject(forKey: "com.gmeremit.password")
store.removeObject(forKey: " com.gmeremit.isReferred")
store.removeObject(forKey: " com.gmeremit.isReferred")
store.removeObject(forKey: UserKeys.primaryAccountNumber)
store.removeObject(forKey: UserKeys.primaryBankName)
store.removeObject(forKey: UserKeys.province)
store.removeObject(forKey: UserKeys.provinceId)
store.removeObject(forKey: UserKeys.yearlyLimit)
store.removeObject(forKey: UserKeys.availableBalance)
store.removeObject(forKey: UserKeys.availableBalance)
store.removeObject(forKey: UserKeys.isUseBiometricAuth)
store.setValue(nil, forKey: UserKeys.accessCode)
store.removeObject(forKey: AppConstants.dateOfDontShowNotification)
store.removeObject(forKey: AppConstants.dateOfExpireNotification)
store.removeObject(forKey: AppConstants.isOpenedTokenRenwalAlert)
store.removeObject(forKey: AppConstants.isOpenedPopupNotification)
GMEDB.shared.user.removeAll()
GMEDB.shared.app.removeAll()
KeyChain.shared.save(data: "0", key: .login)
store.set(false, forKey: AppConstants.pennyTestPresentedOnce)
let splaseWireframe = SplashScreenWireframe()
let nav = UINavigationController.init(rootViewController: splaseWireframe.getMainView())
window.rootViewController = nav

11
GMERemittance/Module/PopupNotification/User Interface/View/PopupNotificationViewController.swift

@ -32,15 +32,20 @@ class PopupNotificationViewController: UIViewController {
// MARK: IBActions
@IBAction func touchDontShowAgainTodayButton(_ sender: UIButton) {
UserDefaults.standard.set(true, forKey: AppConstants.isOpenedPopupNotification)
// TODO: now .
let now = Date()
UserDefaults.standard.set(now, forKey: AppConstants.dateOfDontShowNotification)
GMEDB
.shared
.app
.set(true, .isOpenedPopupNotification)
.set(now, .dateOfDontShowNotification)
dismiss(animated: true, completion: nil)
}
@IBAction func touchOkButton(_ sender: UIButton) {
UserDefaults.standard.set(true, forKey: AppConstants.isOpenedPopupNotification)
GMEDB.shared.app.set(true, .isOpenedPopupNotification)
dismiss(animated: true, completion: nil)
}

14
GMERemittance/Module/PopupNotification/User Interface/Wireframe/PopupNotificationWireframe.swift

@ -36,28 +36,24 @@ extension PopupNotificationWireframe: PopupNotificationWireframeInput {
let now = Date()
// FIXME: Temporary expire date
if let expireDate = UserDefaults
.standard
.object(forKey: AppConstants.dateOfExpireNotification) as? Date {
if let expireDate = GMEDB.shared.app.object(.dateOfExpireNotification) as? Date {
if let remindDate = expireDate - now, remindDate <= 0 {
return
}
}
if let date = UserDefaults
.standard
.object(forKey: AppConstants.dateOfDontShowNotification) as? Date {
if let date = GMEDB.shared.app.object(.dateOfDontShowNotification) as? Date {
// TODO: if now - date == 0 then don't show notification else show notification and delete dateOfDontShowNotification
if let remindDate = now - date, remindDate == 0 {
return
}
UserDefaults.standard.removeObject(forKey: AppConstants.dateOfDontShowNotification)
GMEDB.shared.app.remove(.dateOfDontShowNotification)
}
if !UserDefaults.standard.bool(forKey: AppConstants.isOpenedPopupNotification) {
if !GMEDB.shared.app.bool(.isOpenedPopupNotification) {
source.present(getMainView(), animated: true, completion: nil)
}
}

2
GMERemittance/Module/Profile/ProfileChangePasswordViewController.swift

@ -115,7 +115,7 @@ class ProfileChangePasswordViewController: UIViewController {
self.newPasswordTitleLabel.text = "new_password_text".localized()
self.currentPasswowrdTitleLabel.text = "current_password_placeholder_text".localized()
self.confirmPasswordTitlelabel.text = "confirm_password_text".localized()
self.saveButton.setTitle("save_text".localized(), for: UIControlState.normal)
self.saveButton.setTitle("save_text".localized(), for: UIControl.State.normal)
}

17
GMERemittance/Module/Profile/ProfileViewController.swift

@ -56,8 +56,8 @@ class ProfileViewController: UIViewController {
func configureLanguage() {
self.availableBalancetTitleLabel.text = StringConstants().yourAvailableBalanceText
self.gmeWalletNoTitle.text = "gme_wallet_no_text".localized()
self.withdrawButton.setTitle(StringConstants().withdrawButtonText, for: UIControlState.normal)
self.changePasswordButton.setTitle(StringConstants().changePasswordText, for: UIControlState.normal)
self.withdrawButton.setTitle(StringConstants().withdrawButtonText, for: UIControl.State.normal)
self.changePasswordButton.setTitle(StringConstants().changePasswordText, for: UIControl.State.normal)
}
override func setupTabItem() {
@ -79,14 +79,13 @@ class ProfileViewController: UIViewController {
}
func show() {
let store = UserDefaults.standard
let name = store.string(forKey: UserKeys.firstName)
let name = GMEDB.shared.user.string(.firstName)
self.labelUserName?.text = name?.capitalized
self.labelMobileNumber.text = store.string(forKey: UserKeys.mobileNumber)
self.labelEmail.text = store.string(forKey: UserKeys.email)
self.labelBalance.text = store.string(forKey: UserKeys.availableBalance)
let walletNum = store.string(forKey: UserKeys.walletNumber)
let bankName = store.string(forKey: UserKeys.primaryBankName)
self.labelMobileNumber.text = GMEDB.shared.user.string(.mobileNumber)
self.labelEmail.text = GMEDB.shared.user.string(.email)
self.labelBalance.text = GMEDB.shared.user.string(.availableBalance)
let walletNum = GMEDB.shared.user.string(.walletNumber)
let bankName = GMEDB.shared.user.string(.primaryBankName)
bankNameLabel.text = bankName
gmeWalletNumber.text = walletNum
labelUserProfileName.layer.backgroundColor = UIColor(hex: 0x2e3192).cgColor

7
GMERemittance/Module/RegisterModules/KYC/Kyc/Application Logic/Interactor/KycInteractor.swift

@ -279,12 +279,11 @@ class KycInteractor {
}
private func getCompressedImage(image: UIImage) -> Data? {
return UIImageJPEGRepresentation(image, 0.6)
return image.jpegData(compressionQuality: 0.6)
}
private func getParams(model: KYCRequestModel) -> [String: String] {
let defaults = UserDefaults.standard
let userName = defaults.string(forKey: UserKeys.userId) ?? ""
let userName = GMEDB.shared.user.string(.userId) ?? ""
let gender = model.kycForm1?.gender ?? ""
var _gender = ""
@ -361,7 +360,7 @@ extension KycInteractor: KycInteractorInput {
self.service.fetchUserInfo(param: param, success: { (user) in
Utility.save(user: user)
UserDefaults.standard.set(true, forKey: UserKeys.kyc)
GMEDB.shared.user.set(true, .kyc)
self.output?.submitSuccess()
}, failure: { (error) in

2
GMERemittance/Module/RegisterModules/KYC/Kyc/User Interface/View/KycViewController.swift

@ -180,7 +180,7 @@ 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: UIAlertControllerStyle.alert, cancelTitle: "Cancel", OkStyle: UIAlertActionStyle.default, cancelStyle: UIAlertActionStyle.default, okAction: {
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?.showPennyTest()
}) {
self.presenter?.goHome()

4
GMERemittance/Module/RegisterModules/KYC/kycForm1/User Interface/View/kycForm1ViewController.swift

@ -250,7 +250,7 @@ class KycForm1ViewController: UIViewController {
self.provinceTitleLabel.text = StringConstants().province
self.occupationTitleLabel.text = StringConstants().occupation
self.referralCodeTitleLabel.text = StringConstants().referralCode
self.saveAndContinue.setTitle(StringConstants().saveAndCoutinueText, for: UIControlState.normal)
self.saveAndContinue.setTitle(StringConstants().saveAndCoutinueText, for: UIControl.State.normal)
self.firstNameTextField.placeholder = StringConstants().fullnamePlaceholder
self.mobileNumberTextField.placeholder = StringConstants().mobilePlaceholder
@ -263,7 +263,7 @@ class KycForm1ViewController: UIViewController {
}
private func setupEmail() {
if let email = UserDefaults.standard.string(forKey: UserKeys.email) {
if let email = GMEDB.shared.user.string(.email){
self.emailTextField.text = email
self.emailTextField.isUserInteractionEnabled = false
}

6
GMERemittance/Module/RegisterModules/KYC/kycForm2/User Interface/View/kycForm2ViewController.swift

@ -140,12 +140,12 @@ class KycForm2ViewController: UIViewController {
case .alieanCard, .nationalIdCard:
self.verificationIdNumberTextField.keyboardType = .numberPad
self.verificationIdNumberTextField.addTarget(self, action: #selector(self.verificationIdTextChanged(sender:)
), for: UIControlEvents.editingChanged)
), for: UIControl.Event.editingChanged)
break
case .passport:
self.verificationIdNumberTextField.keyboardType = .default
self.verificationIdNumberTextField.removeTarget(self, action: #selector(self.verificationIdTextChanged(sender:)
), for: UIControlEvents.editingChanged)
), for: UIControl.Event.editingChanged)
break
}
}
@ -285,7 +285,7 @@ class KycForm2ViewController: UIViewController {
self.sourceOfFundTextField.placeholder = StringConstants().sourceOfFundPlaceholder
self.headerTitleLabel.text = StringConstants().headerTitle
self.saveAndContinueButton.setTitle("save_and_continue_text".localized(), for: UIControlState.normal)
self.saveAndContinueButton.setTitle("save_and_continue_text".localized(), for: UIControl.State.normal)
}
private func setupHiddenFields() {

4
GMERemittance/Module/RegisterModules/KYC/kycForm3/User Interface/View/kycForm3ViewController.swift

@ -98,7 +98,7 @@ class KycForm3ViewController: UIViewController {
$0?.setTitle(StringConstants().veiwSampleText, for: .normal)
})
self.submitButton.setTitle("submit_text".localized(), for: UIControlState.normal)
self.submitButton.setTitle("submit_text".localized(), for: UIControl.State.normal)
}
// MARK: Properties
@ -204,7 +204,7 @@ class KycForm3ViewController: UIViewController {
}
private func showPicker() {
multiMediaManager?.openPicker(mode: UIImagePickerControllerCameraCaptureMode.photo)
multiMediaManager?.openPicker(mode: UIImagePickerController.CameraCaptureMode.photo)
}
func showSample(type: PictureType, titleString: String) {

18
GMERemittance/Module/RegisterModules/PennyTest/User Interface/View/PennyTestViewController.swift

@ -40,7 +40,7 @@ class PennyTestViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
UserDefaults.standard.set(true, forKey: AppConstants.pennyTestPresentedOnce)
GMEDB.shared.user.set(true, .pennyTestPresentedOnce)
self.navigationItem.title = "penny_test_title_text".localized()
self.setupNormalNavigation()
@ -50,7 +50,7 @@ class PennyTestViewController: UIViewController {
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.title = ""
UserDefaults.standard.set(true, forKey: AppConstants.pennyTestPresentedOnce)
GMEDB.shared.user.set(true, .pennyTestPresentedOnce)
}
@ -70,13 +70,13 @@ class PennyTestViewController: UIViewController {
_view.frame = self.view.frame
self.view.addSubview(_view)
}
UserDefaults.standard.set(true, forKey: AppConstants.pennyTestPresentedOnce)
GMEDB.shared.user.set(true, .pennyTestPresentedOnce)
configureText()
}
private func configureText() {
self.proceedButton.setTitle(StringConstants().proceedText, for: UIControlState.normal)
self.dismissButton.setTitle(StringConstants().notNowText, for: UIControlState.normal)
self.proceedButton.setTitle(StringConstants().proceedText, for: UIControl.State.normal)
self.dismissButton.setTitle(StringConstants().notNowText, for: UIControl.State.normal)
// penny_test_promt_description_text
infoLabel.text = "penny_test_promt_description_text".localized()
}
@ -98,7 +98,7 @@ class PennyTestViewController: UIViewController {
self.initiate(userId: userId, isResendRequest: "N", success: { result in
self.hideLoading()
UserDefaults.standard.set(result.message, forKey: AppConstants.pennyTestServerMessage)
GMEDB.shared.user.set(result.message, .pennyTestServerMessage)
self.updatePennyTestRequestStatus()
let wireframe = PennyTestSubmitWireframe()
if let navigation = self.navigationController {
@ -112,13 +112,11 @@ class PennyTestViewController: UIViewController {
}
private func updatePennyTestRequestStatus() {
let _default = UserDefaults.standard
_default.set(PennyTestStatusCode.requested.rawValue, forKey: AppConstants.pennyTestStatusCode)
GMEDB.shared.user.set(PennyTestStatusCode.requested.rawValue, .pennyTestStatusCode)
}
private func updatePennyTestCancelledStatus() {
let _default = UserDefaults.standard
_default.set(PennyTestStatusCode.cancelled.rawValue, forKey: AppConstants.pennyTestStatusCode)
GMEDB.shared.user.set(PennyTestStatusCode.cancelled.rawValue, .pennyTestStatusCode)
}
func showLoading() {

26
GMERemittance/Module/RegisterModules/PennyTestSubmit/User Interface/View/PennyTestSubmitViewController.swift

@ -57,7 +57,7 @@ class PennyTestSubmitViewController: UIViewController {
private func setup() {
// all setup should be done here
requestPennytestInfoDuringViewLoad()
let message = UserDefaults.standard.string(forKey: AppConstants.pennyTestServerMessage)
let message = GMEDB.shared.user.string(.pennyTestServerMessage)
self.titleLabel.text = message
configureText()
@ -66,10 +66,10 @@ class PennyTestSubmitViewController: UIViewController {
private func configureText() {
self.titleLabel.text = "penny_test_promt_description_text".localized()
self.dipositReferencelabel.text = StringConstants().depositReferenceText
self.viewSampleButton.setTitle(StringConstants().viewSampleText, for: UIControlState.normal)
self.resendButton.setTitle(StringConstants().resendRequestText, for: UIControlState.normal)
self.submitButton.setTitle(StringConstants().submitText, for: UIControlState.normal)
self.notNowButton.setTitle(StringConstants().notNowText, for: UIControlState.normal)
self.viewSampleButton.setTitle(StringConstants().viewSampleText, for: UIControl.State.normal)
self.resendButton.setTitle(StringConstants().resendRequestText, for: UIControl.State.normal)
self.submitButton.setTitle(StringConstants().submitText, for: UIControl.State.normal)
self.notNowButton.setTitle(StringConstants().notNowText, for: UIControl.State.normal)
}
@IBAction func viewSample(_ sender: Any) {
@ -115,8 +115,8 @@ class PennyTestSubmitViewController: UIViewController {
message: result.message,
title: "success_text".localized(),
okTitle: "ok_text".localized(),
style: UIAlertControllerStyle.alert,
OkStyle: UIAlertActionStyle.default,
style: UIAlertController.Style.alert,
OkStyle: UIAlertAction.Style.default,
okAction: nil
)
self.updatePennyTestRequestStatus()
@ -128,14 +128,13 @@ class PennyTestSubmitViewController: UIViewController {
}
private func requestPennytestInfoDuringViewLoad() {
let message = UserDefaults.standard.string(forKey: AppConstants.pennyTestServerMessage)
let userId = Utility.getMyUserName()
self.showLoading()
self.initiate(userId: userId, isResendRequest: "N", success: { result in
self.hideLoading()
self.titleLabel.text = result.message
UserDefaults.standard.set(result.message, forKey: AppConstants.pennyTestServerMessage)
GMEDB.shared.user.set(result.message, .pennyTestServerMessage)
self.updatePennyTestRequestStatus()
}) { (error) in
self.updatePennyTestRequestStatus()
@ -145,8 +144,7 @@ class PennyTestSubmitViewController: UIViewController {
}
private func updatePennyTestRequestStatus() {
let _default = UserDefaults.standard
_default.set(PennyTestStatusCode.requested.rawValue, forKey: AppConstants.pennyTestStatusCode)
GMEDB.shared.user.set(PennyTestStatusCode.requested.rawValue, .pennyTestStatusCode)
}
private func showLoading() {
@ -180,7 +178,7 @@ class PennyTestSubmitViewController: UIViewController {
let balance = response.extra ?? ""
let userInfo = [SideMenuNavigationNotifications.availableBalance : balance]
UserDefaults.standard.set(balance, forKey: UserKeys.availableBalance)
GMEDB.shared.user.set(balance, .availableBalance)
NotificationCenter.default.post(name: self.getAvailableBalanceNotificationName(), object: nil, userInfo: userInfo)
// UPDATE YEARLY LIMIT
@ -195,10 +193,10 @@ class PennyTestSubmitViewController: UIViewController {
message: response.message ?? "",
title: "Success",
okTitle: "Ok",
style: UIAlertControllerStyle.alert,
style: UIAlertController.Style.alert,
OkStyle: .default,
okAction: {
UserDefaults.standard.set(PennyTestStatusCode.completed.rawValue, forKey: AppConstants.pennyTestStatusCode)
GMEDB.shared.user.set(PennyTestStatusCode.completed.rawValue, .pennyTestStatusCode)
self.dismiss()
}
)

2
GMERemittance/Module/RegisterModules/Register/User Interface/View/RegisterViewController.swift

@ -187,7 +187,7 @@ class RegisterViewController: UIViewController {
let passwordPolicy = " (\("password_policy_error".localized()))"
let font = UIFont.init(name: "SanFranciscoDisplay-regular", size: 12)!
let myAttribute = [ NSAttributedString.Key.foregroundColor: UIColor.lightGray, NSAttributedStringKey.font : font ]
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

2
GMERemittance/Module/RewardModules/OrderHistory/Application Logic/Service/OrderHistoryService.swift

@ -16,7 +16,7 @@ class OrderHistoryService: OrderHistoryServiceType {
failure: @escaping(Error) -> Void
) {
guard let email = UserDefaults.standard.string(forKey: UserKeys.email) else {
guard let email = GMEDB.shared.user.string(.email) else {
let error = NSError.init(
domain: "Network",
code: 0,

2
GMERemittance/Module/RewardModules/OrderHistory/User Interface/View/OrderHistoryViewController.swift

@ -181,7 +181,7 @@ extension OrderHistoryViewController {
}
private func addRefreshControl() {
let colorOption = [NSAttributedStringKey.foregroundColor : AppConstants.themWhiteColor];
let colorOption = [NSAttributedString.Key.foregroundColor : AppConstants.themWhiteColor];
let title = NSAttributedString(string: "pull to refresh", attributes: colorOption)

10
GMERemittance/Module/RewardModules/Redeem/User Interface/View/RedeemViewController.swift

@ -58,8 +58,8 @@ class RedeemViewController: UIViewController {
switch selectedUserType {
case .user:
isEnable = false
name = UserDefaults.standard.string(forKey: UserKeys.fullName)
phoneNumber = UserDefaults.standard.string(forKey: UserKeys.mobileNumber)
name = GMEDB.shared.user.string(.fullName)
phoneNumber = GMEDB.shared.user.string(.mobileNumber)
case .custom:
isEnable = true
name = ""
@ -395,8 +395,8 @@ extension RedeemViewController {
userNameTextField.isEnabled = false
userPhoneNumberTextField.isEnabled = false
userNameTextField.text = UserDefaults.standard.string(forKey: UserKeys.fullName)
userPhoneNumberTextField.text = UserDefaults.standard.string(forKey: UserKeys.mobileNumber)
userNameTextField.text = GMEDB.shared.user.string(.fullName)
userPhoneNumberTextField.text = GMEDB.shared.user.string(.mobileNumber)
userNameTextField.sendActions(for: .editingChanged)
userPhoneNumberTextField.sendActions(for: .editingChanged)
@ -467,7 +467,7 @@ extension RedeemViewController: ConfirmViewControllerDelegate {
let address = "\(detailAddressTextField.text ?? ""), \(addressTextField.text ?? "")"
ordered = Redeem(
userID: UserDefaults.standard.string(forKey: UserKeys.email),
userID: GMEDB.shared.user.string(.email),
productCode: model?.productCode,
usePoint: model?.pointPrice,
orderType: "1",

2
GMERemittance/Module/RewardModules/Reward/User Interface/View/Cell/RewardItemCollectionViewCell.swift

@ -46,7 +46,7 @@ class RewardItemCollectionViewCell: UICollectionViewCell {
self.redeemButton.layer.cornerRadius = 10
self.redeemButton.addTarget(self, action: #selector(redeemButtonTouch), for: .touchUpInside)
let totalPoint = UserDefaults.standard.integer(forKey: UserKeys.rewardPoint)
let totalPoint = GMEDB.shared.user.integer(.rewardPoint)
let isEnable = totalPoint >= Int(self.model?.pointPrice ?? "") ?? 0

4
GMERemittance/Module/RewardModules/Reward/User Interface/View/RewardViewController.swift

@ -52,7 +52,7 @@ class RewardViewController: UIViewController {
title = "reward_group_title_text".localized()
collectionView.setContentOffset(.zero, animated: false)
rewardPoint = UserDefaults.standard.string(forKey: UserKeys.rewardPoint)?.likeCommaMoney()
rewardPoint = GMEDB.shared.user.string(.rewardPoint)?.likeCommaMoney()
collectionView.reloadData()
}
@ -125,7 +125,7 @@ class RewardViewController: UIViewController {
}
private func addRefreshControlCollectionView() {
let colorOption = [NSAttributedStringKey.foregroundColor : AppConstants.themWhiteColor];
let colorOption = [NSAttributedString.Key.foregroundColor : AppConstants.themWhiteColor];
let title = NSAttributedString(string: "pull to refresh", attributes: colorOption)

2
GMERemittance/Module/SendMoneyModules/PaymentSelection/User Interface/View/PaymentSelectionViewController.swift

@ -59,7 +59,7 @@ class PaymentSelectionViewController: UIViewController {
}
private func configureText() {
self.closeButton.setTitle(StringConstants().closeText, for: UIControlState.normal)
self.closeButton.setTitle(StringConstants().closeText, for: UIControl.State.normal)
}
}

2
GMERemittance/Module/SendMoneyModules/Recipient/AddReciepient/User Interface/View/AddReciepientViewController.swift

@ -217,7 +217,7 @@ class AddReciepientViewController: UIViewController {
private func setupTargets() {
[firstNameTextField, middleNameTextField, lastNameTextField, countryTextField, stateProvinceTextField, districtTextField, addressTextField, relationTextField, mobileTextField, emailTextField, transferReasonTextField, cityTextField].forEach({
$0.addTarget(self, action: #selector(self.textFieldChanged(sender:)), for: UIControlEvents.editingChanged)
$0.addTarget(self, action: #selector(self.textFieldChanged(sender:)), for: UIControl.Event.editingChanged)
})
}

3
GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/Application Logic/Interactor/EditReciepientInteractor.swift

@ -40,8 +40,7 @@ extension EditReciepientInteractor: EditReciepientInteractorInput {
}
func save(reciepient: Recipient) {
let defaults = UserDefaults.standard
let myUsername = defaults.string(forKey: "com.gmeremit.username") ?? ""
let myUsername = GMEDB.shared.user.string(.userId) ?? ""
self.service.save(model: reciepient.serialize(), username: myUsername, success: { (reciepient) in
self.output?.success()
}) { (error) in

2
GMERemittance/Module/SendMoneyModules/Recipient/EditReciepient/User Interface/View/EditReciepientViewController.swift

@ -202,7 +202,7 @@ class EditReciepientViewController: UIViewController {
private func setupTargets() {
[firstNameTextField, middleNameTextField, lastNameTextField, countryTextField, stateProvinceTextField, districtTextField, addressTextField, relationTextField, mobileTextField, emailTextField, transferReasonTextField, cityTextField].forEach({
$0?.addTarget(self, action: #selector(self.textFieldChanged(sender:)), for: UIControlEvents.editingChanged)
$0?.addTarget(self, action: #selector(self.textFieldChanged(sender:)), for: UIControl.Event.editingChanged)
})
}

12
GMERemittance/Module/SendMoneyModules/Recipient/RecipientListViewController.swift

@ -153,9 +153,8 @@ extension RecipientListViewController: UITableViewDelegate,UITableViewDataSource
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .destructive, title: "delete_text".localized()) { (action, indexPath) in
self.alertWithOkCancel(message: "delete_recipient_confirmation_text".localized(), title: "alert_text".localized(), OkStyle: UIAlertActionStyle.destructive, okAction: {
let defaults = UserDefaults.standard
let myUsername = defaults.string(forKey: "com.gmeremit.username") ?? ""
self.alertWithOkCancel(message: "delete_recipient_confirmation_text".localized(), title: "alert_text".localized(), OkStyle: UIAlertAction.Style.destructive, okAction: {
let myUsername = GMEDB.shared.user.string(.userId) ?? ""
self.showProgressHud()
if let reciepient = self.reciepients?.elementAt(index: indexPath.row) {
@ -166,14 +165,14 @@ extension RecipientListViewController: UITableViewDelegate,UITableViewDataSource
}
guard let deletedPerson = reciepient else {return}
if let index = self.reciepients?.index(where: {
if let index = self.reciepients?.firstIndex(where: {
($0.recipientId ?? "") == (deletedPerson.recipientId ?? "")
}) {
UIView.animate(withDuration: 0.5, animations: {
tableView.beginUpdates()
self.reciepients?.remove(at: index)
let indexPath = IndexPath(item: index, section: 0)
self.tableView.deleteRows(at: [indexPath], with: UITableViewRowAnimation.fade)
self.tableView.deleteRows(at: [indexPath], with: UITableView.RowAnimation.fade)
tableView.endUpdates()
})
@ -202,8 +201,7 @@ extension RecipientListViewController: UITableViewDelegate,UITableViewDataSource
}
func fetchReceipients() {
let defaults = UserDefaults.standard
let myUsername = defaults.string(forKey: "com.gmeremit.username") ?? ""
let myUsername = GMEDB.shared.user.string(.userId) ?? ""
self.fetchReciepientList(username: myUsername, success: { (reciepients) in
self.hideProgressHud()
// TODO

2
GMERemittance/Module/SendMoneyModules/Resend/User Interface/View/ResendViewController.swift

@ -151,7 +151,7 @@ class ResendViewController: UIViewController {
let imageview = UIImageView(image: #imageLiteral(resourceName: "ic_search"))
self.searchTextField.leftView = imageview
self.searchTextField.leftViewMode = .always
self.searchTextField.addTarget(self, action: #selector(search(sender:)), for: UIControlEvents.editingChanged)
self.searchTextField.addTarget(self, action: #selector(search(sender:)), for: UIControl.Event.editingChanged)
}
@objc func search(sender: UITextField) {

6
GMERemittance/Module/SendMoneyModules/ResendExchange/User Interface/View/ResendExchangeViewController.swift

@ -176,7 +176,7 @@ class ResendExchangeViewController: UIViewController {
self.recipientGetsTitleLabel.text = "recepient_gets_text".localized()
self.youSendTitleLabel.text = "you_send_text".localized()
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImageRenderingMode.alwaysTemplate)
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImage.RenderingMode.alwaysTemplate)
couponDropDownImageView.image = dropDownImage
couponDropDownImageView.tintColor = AppConstants.themeRedColor
@ -305,9 +305,9 @@ class ResendExchangeViewController: UIViewController {
}
private func setupTargets() {
self.reciepientTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControlEvents.editingChanged)
self.reciepientTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
self.senderTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControlEvents.editingChanged)
self.senderTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
}
func calculate() {

9
GMERemittance/Module/SendMoneyModules/SendMoneyCode/User Interface/View/SendMoneyCodeViewController.swift

@ -139,7 +139,7 @@ class SendMoneyCodeViewController: UIViewController {
// all setup should be done here
self.titleLabel.text = "enter_otp_password_text".localized()
self.verificationCodeTextField.placeholder = "otp_password_hint_text".localized()
self.resendButton.setTitle("resend_request_text".localized(), for: UIControlState.normal)
self.resendButton.setTitle("resend_request_text".localized(), for: UIControl.State.normal)
self.submitButton.setTitle("submit_text".localized(), for: .normal)
self.notNowButton.setTitle("not_now_text".localized(), for: .normal)
verificationCodeTextField.delegate = self
@ -152,9 +152,9 @@ class SendMoneyCodeViewController: UIViewController {
self.titleLabel.text = "penny_test_promt_description_text".localized()
self.otpCodeTitlelabel.text = "otp__Code_text".localized()
self.resendButton.setTitle("resend_text".localized(), for: UIControlState.normal)
self.submitButton.setTitle("submit_text".localized(), for: UIControlState.normal)
self.notNowButton.setTitle("not_now_text".localized(), for: UIControlState.normal)
self.resendButton.setTitle("resend_text".localized(), for: UIControl.State.normal)
self.submitButton.setTitle("submit_text".localized(), for: UIControl.State.normal)
self.notNowButton.setTitle("not_now_text".localized(), for: UIControl.State.normal)
self.counterTitleLabel.text = "resend_code_text".localized()
}
@ -210,7 +210,6 @@ class SendMoneyCodeViewController: UIViewController {
}
private func requestOtpCodeRetryCount() {
let _default = UserDefaults.standard
}
}

8
GMERemittance/Module/SendMoneyModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift

@ -227,8 +227,8 @@ class SendMoneyExchangeRateViewController: UIViewController {
countryListTapGuesture = tapGuesture
countryListStackView.addGestureRecognizer(countryListTapGuesture!)
reciepientTextField.addTarget(self, action: #selector(textChanged(sender:)), for: UIControlEvents.editingChanged)
senderTextField.addTarget(self, action: #selector(textChanged(sender:)), for: UIControlEvents.editingChanged)
reciepientTextField.addTarget(self, action: #selector(textChanged(sender:)), for: UIControl.Event.editingChanged)
senderTextField.addTarget(self, action: #selector(textChanged(sender:)), for: UIControl.Event.editingChanged)
}
@objc private func showCountryList(_ sender: UITapGestureRecognizer) {
@ -248,7 +248,7 @@ class SendMoneyExchangeRateViewController: UIViewController {
exchangeInfoStackView.isHidden = true
exchangeInfoStackView.alpha = 0
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImageRenderingMode.alwaysTemplate)
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImage.RenderingMode.alwaysTemplate)
let image = dropDownImage
dropDownImageView.image = image
@ -416,7 +416,7 @@ extension SendMoneyExchangeRateViewController: SendMoneyExchangeRateViewInterfac
}
extension SendMoneyExchangeRateViewController {
override func didMove(toParentViewController parent: UIViewController?) {
override func didMove(toParent parent: UIViewController?) {
self.viewWillAppear(true)
}
}

12
GMERemittance/Module/SendMoneyModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift

@ -247,13 +247,13 @@ class SendMoneyParentViewController: UIViewController {
// Make SendMoneyPaymentModeViewController as front View Controller
private func addPaymentModeViewController() {
guard let paymentModeViewController = self.SendMoneyPaymentModeViewController else {return}
self.addChildViewController(paymentModeViewController)
self.addChild(paymentModeViewController)
UIView.transition(with: self.containerView, duration: 0.33, options: .transitionCrossDissolve, animations: {
self.containerView.addSubview(paymentModeViewController.view)
}, completion: nil)
paymentModeViewController.view.frame = containerView.bounds
paymentModeViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
paymentModeViewController.didMove(toParentViewController: self)
paymentModeViewController.didMove(toParent: self)
}
// Make SendMoneyPaymentModeViewController as front View Controller
@ -261,13 +261,13 @@ class SendMoneyParentViewController: UIViewController {
guard let exchangeViewController = self.SendMoneyExchangeRateViewController as? SendMoneyExchangeRateViewController else {return}
exchangeViewController.requestModel = self.requestModel
exchangeViewController.actionDelegate = self
self.addChildViewController(exchangeViewController)
self.addChild(exchangeViewController)
UIView.transition(with: self.containerView, duration: 0.33, options: .transitionCrossDissolve, animations: {
self.containerView.addSubview(exchangeViewController.view)
}, completion: nil)
exchangeViewController.view.frame = containerView.bounds
exchangeViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
exchangeViewController.didMove(toParentViewController: self)
exchangeViewController.didMove(toParent: self)
}
// Make SendMoneyExchangeRateViewController as front View Controller
@ -275,13 +275,13 @@ class SendMoneyParentViewController: UIViewController {
guard let verificationViewController = self.SendMoneyVerificationViewController as? SendMoneyVerificationViewController else {return}
verificationViewController.reciepient = self.receipient
verificationViewController.requestModel = self.requestModel
self.addChildViewController(verificationViewController)
self.addChild(verificationViewController)
UIView.transition(with: self.containerView, duration: 0.33, options: .transitionCrossDissolve, animations: {
self.containerView.addSubview(verificationViewController.view)
}, completion: nil)
verificationViewController.view.frame = containerView.bounds
verificationViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
verificationViewController.didMove(toParentViewController: self)
verificationViewController.didMove(toParent: self)
}
}

6
GMERemittance/Module/SendMoneyModules/SendMoneyPaymentMode/User Interface/View/BankBranchPicker/BankBranchPickerViewController.swift

@ -111,7 +111,7 @@ class BankBranchPickerViewController: UIViewController {
}
private func setupTarget() {
self.searchTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControlEvents.editingChanged)
self.searchTextField.addTarget(self, action: #selector(self.textChanged(sender:)), for: UIControl.Event.editingChanged)
}
@objc private func textChanged(sender: UITextField) {
@ -149,7 +149,7 @@ class BankBranchPickerViewController: UIViewController {
self.titleLabel.text = text.capitalized
self.searchTextField.placeholder = "search_branch_text".localized()
self.cancelButton.setTitle("cancel_text".localized(), for: UIControlState.normal)
self.cancelButton.setTitle("cancel_text".localized(), for: UIControl.State.normal)
}
private func setupPlaces() {
@ -173,7 +173,7 @@ class BankBranchPickerViewController: UIViewController {
private func setupSearchService() {
self.searchTextField.addTarget(self, action: #selector(self.search(sender:)), for: UIControlEvents.editingChanged)
self.searchTextField.addTarget(self, action: #selector(self.search(sender:)), for: UIControl.Event.editingChanged)
}

2
GMERemittance/Module/SendMoneyModules/SendMoneyPaymentMode/User Interface/View/SendMoneyPaymentModeViewController.swift

@ -156,7 +156,7 @@ class SendMoneyPaymentModeViewController: UIViewController {
self.bankTextField.placeholder = StringConstants().bankPlaceholder
self.branchTextField.placeholder = StringConstants().branchPlaceholder
self.accountTextField.placeholder = StringConstants().accountNumber
self.countinueButton.setTitle(StringConstants().continueText, for: UIControlState.normal)
self.countinueButton.setTitle(StringConstants().continueText, for: UIControl.State.normal)
}
// MARK: IBActions

4
GMERemittance/Module/SendMoneyModules/SendMoneyPaymentMode/User Interface/View/ViewModels/BankPicker/BankPickerViewController.swift

@ -142,7 +142,7 @@ class BankPickerViewController: UIViewController {
}
self.titleLabel.text = text.capitalized
self.cancelButton.setTitle("cancel_text".localized(), for: UIControlState.normal)
self.cancelButton.setTitle("cancel_text".localized(), for: UIControl.State.normal)
}
private func setupPlaces() {
@ -167,7 +167,7 @@ class BankPickerViewController: UIViewController {
private func setupSearchService() {
self.searchTextField.addTarget(self, action: #selector(self.search(sender:)), for: UIControlEvents.editingChanged)
self.searchTextField.addTarget(self, action: #selector(self.search(sender:)), for: UIControl.Event.editingChanged)
}

10
GMERemittance/Module/SendMoneyModules/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift

@ -166,16 +166,16 @@ class SendMoneyReceiptViewController: UIViewController {
self.exRateTitleLabel.text = StringConstants().exRateText
self.totalPayoutAmountTitleLabel.text = StringConstants().payoutAmountText
self.sentAmountTitleLabel.text = StringConstants().totalSentAmountText
self.doneButton.setTitle(StringConstants().doneText, for: UIControlState.normal)
self.requestToCancelButton.setTitle("request_to_cancel_text".localized(), for: UIControlState.normal)
self.requestToChangeButton.setTitle("request_to_change_text".localized(), for: UIControlState.normal)
self.doneButton.setTitle(StringConstants().doneText, for: UIControl.State.normal)
self.requestToCancelButton.setTitle("request_to_cancel_text".localized(), for: UIControl.State.normal)
self.requestToChangeButton.setTitle("request_to_change_text".localized(), for: UIControl.State.normal)
usedCouponTitleLabel.text = "used_coupon_title_text".localized()
}
func setupBackButton() {
if shouldShowCancelAmmendButton {
self.navigationController?.navigationItem.hidesBackButton = false
let button = UIBarButtonItem.init(image: #imageLiteral(resourceName: "backIconBlack"), style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.back))
let button = UIBarButtonItem.init(image: #imageLiteral(resourceName: "backIconBlack"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.back))
self.navigationItem.backBarButtonItem = button
self.doneButton.isHidden = true
self.transactionReportButtonStackView.isHidden = false
@ -184,7 +184,7 @@ class SendMoneyReceiptViewController: UIViewController {
self.doneButton.isHidden = false
self.transactionReportButtonStackView.isHidden = true
self.navigationController?.navigationItem.hidesBackButton = true
let button = UIBarButtonItem.init(title: nil, style: UIBarButtonItemStyle.plain, target: nil, action: nil)
let button = UIBarButtonItem.init(title: nil, style: UIBarButtonItem.Style.plain, target: nil, action: nil)
self.navigationItem.leftBarButtonItem = button
}
}

8
GMERemittance/Module/SendMoneyModules/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractor.swift

@ -35,7 +35,7 @@ extension SendMoneyVerificationInteractor: SendMoneyVerificationInteractorInput
let balance = response?.data?.extra ?? ""
let userInfo = [SideMenuNavigationNotifications.availableBalance : balance]
UserDefaults.standard.set(balance, forKey: UserKeys.availableBalance)
GMEDB.shared.user.set(balance, .availableBalance)
NotificationCenter.default.post(name: self.getAvailableBalanceNotificationName(), object: nil, userInfo: userInfo)
// UPDATE YEARLY LIMIT
let limit = response?.data?.remainingLimit ?? ""
@ -60,10 +60,8 @@ extension SendMoneyVerificationInteractor: SendMoneyVerificationInteractorInput
}
func getParams(model: SendMoneyRequestModel, reciepient: Recipient) -> [String: Any] {
let _default = UserDefaults.standard
guard let username = _default.value(forKey: UserKeys.userId) as? String else {return [:]}
let senderId = _default.value(forKey: UserKeys.senderId) as? String
guard let username = GMEDB.shared.user.string(.userId) else {return [:]}
let senderId = GMEDB.shared.user.string(.senderId)
let recieverId = reciepient.recipientId
let params: [String: Any] =

6
GMERemittance/Module/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift

@ -113,7 +113,7 @@ class SendMoneyVerificationViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
return UITableView.automaticDimension
}
override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
@ -221,7 +221,7 @@ extension SendMoneyVerificationViewController: SendMoneyVerificationViewInterfac
message: successMessage,
title: "Success",
okTitle: "OK",
style: UIAlertControllerStyle.alert,
style: UIAlertController.Style.alert,
OkStyle: .default
) {
if let id = model?.id {
@ -260,7 +260,7 @@ extension SendMoneyVerificationViewController: SendMoneyVerificationViewInterfac
}
extension SendMoneyVerificationViewController {
override func didMove(toParentViewController parent: UIViewController?) {
override func didMove(toParent parent: UIViewController?) {
self.viewWillAppear(true)
}
}

12
GMERemittance/Module/SideMenu/AboutGMEViewController.swift

@ -86,11 +86,8 @@ class AboutGMEViewController: UIViewController {
}
@IBAction func openFacebook(_ sender: Any) {
// Based on selected Language
// guard let nativeCountry = UserDefaults.standard.string(forKey: AppConstants.firstTimeLanguageIsSet) else {return}
//
// Based on native country
guard let nativeCountry = UserDefaults.standard.string(forKey: UserKeys.countryCode)?.lowercased() else {
guard let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased() else {
return
}
@ -105,7 +102,7 @@ extension UIApplication {
let application = UIApplication.shared
if let _url = URL(string: url), application.canOpenURL(_url) {
if #available(iOS 10.0, *) {
application.open(URL(string: url)!, options: [:], completionHandler: nil)
application.open(URL(string: url)!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
} else {
// Fallback on earlier versions
}
@ -113,3 +110,8 @@ extension UIApplication {
}
}
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
}

10
GMERemittance/Module/SideMenu/Auto refund/AutoRefundsViewController.swift

@ -68,7 +68,7 @@ class AutoRefundsViewController: UIViewController {
self.availableBalanceTitleLabel.text = StringConstants().availableBalanceTitleText + " : "
self.refundChargeTitleLabel.text = StringConstants().refundChargeTitleTxty + " : "
self.yourRefundLabel.text = StringConstants().yourRefundText
self.refundButton.setTitle(StringConstants().refundButtonText, for: UIControlState.normal)
self.refundButton.setTitle(StringConstants().refundButtonText, for: UIControl.State.normal)
self.headerTitleLabel.text = StringConstants().headerTitleText
}
@ -117,8 +117,8 @@ class AutoRefundsViewController: UIViewController {
message: successMessage?.message,
title: "Success",
okTitle: "Ok",
style: UIAlertControllerStyle.alert,
OkStyle: UIAlertActionStyle.default,
style: UIAlertController.Style.alert,
OkStyle: UIAlertAction.Style.default,
okAction: {
self.navigationController?.popViewController(animated: true)
self.updateBalance(value: successMessage)
@ -132,9 +132,7 @@ class AutoRefundsViewController: UIViewController {
private func updateBalance(value: SuccessMessage?) {
let balance = value?.extra ?? ""
let yearlyLimits = value?.yearlyLimit ?? ""
// UserDefaults.standard.set(yearlyLimits, forKey: UserKeys.yearlyLimit)
UserDefaults.standard.set(balance, forKey: UserKeys.availableBalance)
GMEDB.shared.user.set(balance, .availableBalance)
let userInfo = [SideMenuNavigationNotifications.availableBalance : balance]
NotificationCenter.default.post(name: self.getAvailableBalanceNotificationName(), object: nil, userInfo: userInfo)

2
GMERemittance/Module/SideMenu/SettingViewController.swift

@ -57,7 +57,7 @@ class SettingViewController: UIViewController {
Localize.setCurrentLanguage(code)
}
print("code: \(code)")
UserDefaults.standard.set(code, forKey: AppConstants.firstTimeLanguageIsSet)
GMEDB.shared.app.set(code, .firstTimeLanguageIsSet)
}
}

31
GMERemittance/Module/SideMenu/SideMenuViewController.swift

@ -103,14 +103,14 @@ class SideMenuViewController: UIViewController {
}
@objc private func configureText() {
autoDebitAccountButton.setTitle(StringConstants().autoDebitMenuText, for: UIControlState.normal)
aboutGmeButton.setTitle(StringConstants().aboutGmeMenuText, for: UIControlState.normal)
settingButton.setTitle(StringConstants().settingMenuText, for: UIControlState.normal)
logoutButton.setTitle(StringConstants().logoutTitleText, for: UIControlState.normal)
autoDebitAccountButton.setTitle(StringConstants().autoDebitMenuText, for: UIControl.State.normal)
aboutGmeButton.setTitle(StringConstants().aboutGmeMenuText, for: UIControl.State.normal)
settingButton.setTitle(StringConstants().settingMenuText, for: UIControl.State.normal)
logoutButton.setTitle(StringConstants().logoutTitleText, for: UIControl.State.normal)
self.availableBalanceTitleLabel.text = StringConstants().availableBalanceTitleLabelText
self.gmeWalletNoTitleLabel.text = StringConstants().gmeWalletNoTitleText
self.withdrawButton.setTitle(StringConstants().withdrawButtonText, for: UIControlState.normal)
self.transactionHistryButton.setTitle("transaction_report_text".localized(), for: UIControlState.normal)
self.withdrawButton.setTitle(StringConstants().withdrawButtonText, for: UIControl.State.normal)
self.transactionHistryButton.setTitle("transaction_report_text".localized(), for: UIControl.State.normal)
}
@ -129,7 +129,7 @@ class SideMenuViewController: UIViewController {
$0?.textColor = AppConstants.themWhiteColor
})
[aboutGmeButton, settingButton, logoutButton].forEach({
$0?.setTitleColor(AppConstants.themWhiteColor, for: UIControlState.normal)
$0?.setTitleColor(AppConstants.themWhiteColor, for: UIControl.State.normal)
})
aboutIconImageView.tintColor = AppConstants.themWhiteColor
}
@ -198,31 +198,30 @@ class SideMenuViewController: UIViewController {
}
func setUpSettingsScreen() {
let store = UserDefaults.standard
//PHONE
labelPhone.text = store.string(forKey: UserKeys.mobileNumber)
labelPhone.text = GMEDB.shared.user.string(.mobileNumber)
//EMAIL
labelEmail.text = store.string(forKey: UserKeys.email)
labelEmail.text = GMEDB.shared.user.string(.email)
//NAME
labelProfileName.text = store.string(forKey: UserKeys.firstName)?.capitalized
labelProfileName.text = GMEDB.shared.user.string(.firstName)?.capitalized
//WALLET NUMBER
labelWalletNumber.text = store.string(forKey: UserKeys.walletNumber)
labelWalletNumber.text = GMEDB.shared.user.string(.walletNumber)
//BALANCE
let balance = store.string(forKey: UserKeys.availableBalance)
let balance = GMEDB.shared.user.string(.availableBalance)
labelBalance.text = Utility.getCommaSeperatedString(numberString: balance ?? "")
//BANK NAME
labelBank.text = store.string(forKey: UserKeys.primaryBankName)
labelBank.text = GMEDB.shared.user.string(.primaryBankName)
//IMAGE
let userDpString = store.string(forKey: UserKeys.dpUrl)
let userDpString = GMEDB.shared.user.string(.dpUrl) ?? ""
if let userDpUrl = URL(string: userDpString!) {
if let userDpUrl = URL(string: userDpString) {
SDImageCache.shared().clearMemory()
SDImageCache.shared().clearDisk()
self.imageViewProfileSetting.sd_setImage(with: userDpUrl, completed: nil)

20
GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift

@ -57,8 +57,7 @@ class SplashScreenViewController: UIViewController {
let code = Language.init(rawValue: selectedLanguage?.code ?? "en")?.code ?? "en"
Localize.setCurrentLanguage(code)
UserDefaults.standard.set(selectedLanguage?.code ?? "en", forKey: AppConstants.firstTimeLanguageIsSet)
GMEDB.shared.app.set(selectedLanguage?.code ?? "en", .firstTimeLanguageIsSet)
setText()
flagImageView.image = CountryInfo().getFlag(for: selectedLanguage?.code ?? "")
@ -151,7 +150,7 @@ class SplashScreenViewController: UIViewController {
configureLanguage()
// if exist a selected language then don't animate, and put in the selected language into languageLabel
if let language = UserDefaults.standard.string(forKey: AppConstants.firstTimeLanguageIsSet){
if let language = GMEDB.shared.app.string(.firstTimeLanguageIsSet) {
selectedLanguage = languages
.filter{
$0.code?.languageCode == language.languageCode
@ -283,15 +282,15 @@ class SplashScreenViewController: UIViewController {
private func changeLanguageInfo(text: String, flag: UIImage?) {
let animation = CATransition()
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
animation.type = kCATransitionPush
animation.subtype = kCATransitionFromTop
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
animation.type = CATransitionType.push
animation.subtype = CATransitionSubtype.fromTop
animation.duration = 0.8
languageLabel.layer.add(animation, forKey: kCATransitionPush)
languageLabel.layer.add(animation, forKey: convertFromCATransitionType(CATransitionType.push))
languageLabel.text = text
flagImageView.layer.add(animation, forKey: kCATransitionPush)
flagImageView.layer.add(animation, forKey: convertFromCATransitionType(CATransitionType.push))
flagImageView.image = flag
}
@ -334,3 +333,8 @@ extension SplashScreenViewController: TablePresenterDelegate {
}
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromCATransitionType(_ input: CATransitionType) -> String {
return input.rawValue
}

4
GMERemittance/Module/TransactionHistoryModules/MessageCompose/User Interface/View/MessageComposeViewController.swift

@ -75,8 +75,8 @@ class MessageComposeViewController: UIViewController {
private func configureText() {
self.headerLabel.text = StringConstants().headerText
self.submitButton.setTitle(StringConstants().submitText, for: UIControlState.normal)
self.cancelButton.setTitle(StringConstants().cancelText, for: UIControlState.normal)
self.submitButton.setTitle(StringConstants().submitText, for: UIControl.State.normal)
self.cancelButton.setTitle(StringConstants().cancelText, for: UIControl.State.normal)
}
private func setupSubject() {

4
GMERemittance/Module/TransactionHistoryModules/TransactionHistory/User Interface/View/DatePickerViewController.swift

@ -95,8 +95,8 @@ class DatePickerViewController: UIViewController {
toTitleLabel.text = StringConstants().toPlaceholderText
fromTextfield.placeholder = StringConstants().fromPlaceholderText
toTextfield.placeholder = StringConstants().toPlaceholderText
cancelButton.setTitle(StringConstants().cancelButtonText, for: UIControlState.normal)
searchButton.setTitle(StringConstants().searchButtonText, for: UIControlState.normal)
cancelButton.setTitle(StringConstants().cancelButtonText, for: UIControl.State.normal)
searchButton.setTitle(StringConstants().searchButtonText, for: UIControl.State.normal)
}
private func setupFromDatePicker() {

2
GMERemittance/Module/TransactionHistoryModules/TransactionHistory/User Interface/View/TransactionHistoryViewController.swift

@ -156,7 +156,7 @@ class TransactionHistoryViewController: UIViewController {
let imageview = UIImageView(image: #imageLiteral(resourceName: "ic_search"))
self.searchTextField.leftView = imageview
self.searchTextField.leftViewMode = .always
self.searchTextField.addTarget(self, action: #selector(search(sender:)), for: UIControlEvents.editingChanged)
self.searchTextField.addTarget(self, action: #selector(search(sender:)), for: UIControl.Event.editingChanged)
}
@objc func search(sender: UITextField) {

2
GMERemittance/Module/WalletStatement/User Interface/View/WalletStatementViewController.swift

@ -114,7 +114,7 @@ class WalletStatementViewController: UIViewController {
}
private func setupDateFilterButton() {
let filterItem = UIBarButtonItem.init(image: #imageLiteral(resourceName: "ic_calender"), style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.openSearchFilter))
let filterItem = UIBarButtonItem.init(image: #imageLiteral(resourceName: "ic_calender"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.openSearchFilter))
self.navigationItem.rightBarButtonItem = filterItem
}

BIN
GMERemittance/Utility/.DS_Store

148
GMERemittance/Utility/AppConstants.swift

@ -21,22 +21,7 @@ class AppConstants {
static let emergencyLogoutErrorCode = -1111
static let maxKoreanMobileNoLength = 11
static let MainWireFrameNotificationName = "MainViewControllerSelect"
static let pennyTestServerMessage = "pennyTestServerMessage"
static let pennyTestStatusCode = "pennyTestStatusCode"
static let pennyTestRequested = "pennyTestRequested"
static let pennyTestPresentedOnce = "pennyTestPresentedOnce"
static let criticalUpdate = "criticalUpdate"
static let primaryBankWArningMessage = "Please verify your primary bank account to complete the registration."
static let yearlyLimitNotification = "Yearly LImit"
static let firstTimeLanguageIsSet = "firstTimeLanguageIsSet"
static let currentLanguage = "currentLanguage"
static let selectedReceiverCountryCode = "receiverCountryCode"
static let accessTokenRegTime = "accessTokenRegTime"
static let accessTokenExpTime = "accessTokenExpTime"
static let dateOfDontShowNotification = "dateOfDontShowNotification"
static let dateOfExpireNotification = "dateOfExpireNotification"
static let isOpenedTokenRenwalAlert = "isOpenedTokenRenwalAlert"
static let isOpenedPopupNotification = "isOpenedPopupNotification"
}
enum Devices {
@ -158,6 +143,8 @@ extension String {
class Utility {
static let database = GMEDB.shared
static func getDeviceModel() -> Devices {
if UIDevice().userInterfaceIdiom == .phone {
switch UIScreen.main.nativeBounds.height {
@ -177,28 +164,6 @@ class Utility {
}
}
// var code: String {
// switch self {
// case .en, .th, .id, .mn, .uz:
// return self.rawValue
// case .kr:
// return "ko"
// case .kh:
// return "km"
// case .lk:
// return "si"
// case .mm:
// return "my"
// case .np:
// return "ne"
// case .bd:
// return "bn"
// case .ru:
// return "ru-RU"
// case .vn:
// return "vi-VN"
// }
static func getLanguageHeader(for currentLanugage: String) -> String {
var header = ""
switch currentLanugage {
@ -234,88 +199,66 @@ class Utility {
}
static func isVerifiedUser() -> Bool {
let val = (UserDefaults.standard.object(forKey: UserKeys.verified) as? Bool ) ?? false
return val
return database.user.bool(.verified)
}
static func didSubmitKyc() -> Bool {
let val = (UserDefaults.standard.object(forKey: UserKeys.kyc) as? Bool ) ?? false
return val
return database.user.bool(.kyc)
}
static func isCriticalUpdate() -> Bool {
let val = (UserDefaults.standard.object(forKey: AppConstants.criticalUpdate) as? String )?.lowercased() == "Y".lowercased()
return val
return database.app.string(.criticalUpdate)?.lowercased() == "Y".lowercased()
}
static func didPennyTestRequested() -> Bool {
let val = (UserDefaults.standard.object(forKey: AppConstants.pennyTestStatusCode) as? String ) ?? "0" == PennyTestStatusCode.requested.rawValue // 0 is false and "1" = true 2 = cancelled
return val
return database.user.string(.pennyTestStatusCode) ?? "0" == PennyTestStatusCode.requested.rawValue // 0 is false and "1" = true 2 = cancelled
}
static func pennyTestPresentedOnce() -> Bool {
let val = UserDefaults.standard.bool(forKey: AppConstants.pennyTestPresentedOnce)
return val
return database.user.bool(.pennyTestPresentedOnce)
}
static func didPennyTestCancelled() -> Bool {
let val = (UserDefaults.standard.object(forKey: AppConstants.pennyTestStatusCode) as? String ) ?? "0" == PennyTestStatusCode.cancelled.rawValue
return val
return database.user.string(.pennyTestStatusCode) ?? "0" == PennyTestStatusCode.cancelled.rawValue
}
static func didPennyTestNotInitiated() -> Bool {
let val = (UserDefaults.standard.object(forKey: AppConstants.pennyTestStatusCode) as? String ) ?? PennyTestStatusCode.notStarted.rawValue == PennyTestStatusCode.notStarted.rawValue
return val
return database.user.string(.pennyTestStatusCode) ?? PennyTestStatusCode.notStarted.rawValue == PennyTestStatusCode.notStarted.rawValue
}
static func pennyTestVerified() -> Bool {
let val = (UserDefaults.standard.object(forKey: AppConstants.pennyTestStatusCode) as? String ) ?? PennyTestStatusCode.notStarted.rawValue == PennyTestStatusCode.completed.rawValue
return val
return database.user.string(.pennyTestStatusCode) ?? PennyTestStatusCode.notStarted.rawValue == PennyTestStatusCode.completed.rawValue
}
static func shouldShowPennyTestError() -> Bool {
let val = (UserDefaults.standard.object(forKey: AppConstants.pennyTestStatusCode) as? String ) ?? PennyTestStatusCode.notStarted.rawValue != PennyTestStatusCode.completed.rawValue
return val
return database.user.string(.pennyTestStatusCode) ?? PennyTestStatusCode.notStarted.rawValue != PennyTestStatusCode.completed.rawValue
}
static func shouldShowPennyTestScreen() -> Bool {
let completed = (UserDefaults.standard.object(forKey: AppConstants.pennyTestStatusCode) as? String ) ?? PennyTestStatusCode.notStarted.rawValue == PennyTestStatusCode.completed.rawValue
let completed = database.user.string(.pennyTestStatusCode) ?? PennyTestStatusCode.notStarted.rawValue == PennyTestStatusCode.completed.rawValue
let cancelled = Utility.didPennyTestCancelled()
let requested = Utility.didPennyTestRequested()
return !cancelled && !completed && !requested
}
static func getMyUserName() -> String {
let defaults = UserDefaults.standard
let myUsername = defaults.string(forKey: UserKeys.userId) ?? ""
return myUsername
return database.user.string(.userId) ?? ""
}
static func getMyId() -> String {
let defaults = UserDefaults.standard
let myId = defaults.string(forKey: UserKeys.senderId) ?? ""
return myId
return database.user.string(.senderId) ?? ""
}
static func getMyKftcClientId() -> String {
let defaults = UserDefaults.standard
let myId = defaults.string(forKey: UserKeys.kftcClientId) ?? ""
return myId
return database.user.string(.kftcClientId) ?? ""
}
static func getMyIdNumber() -> String {
let defaults = UserDefaults.standard
let myId = defaults.string(forKey: UserKeys.idNumber) ?? ""
return myId
return database.user.string(.idNumber) ?? ""
}
static func getMyPrimaryAccountNumber() -> String {
let defaults = UserDefaults.standard
let val = defaults.string(forKey: UserKeys.primaryAccountNumber) ?? ""
print(val)
return val
return database.user.string(.primaryAccountNumber) ?? ""
}
static func isValidEmail(email: String) -> Bool {
@ -352,59 +295,26 @@ class Utility {
}
static func save(user: User?, accessCodeBase64: String? = nil, password: String? = nil, login: Bool? = false) {
func save(value: Any?, forKey: String) {
let defaults = UserDefaults.standard
defaults.set(value, forKey: forKey)
}
save(value: user?.dpUrl ?? "", forKey: UserKeys.dpUrl)
save(value: user?.walletNumber ?? "", forKey: UserKeys.walletNumber)
save(value: user?.primaryBankName ?? "", forKey: UserKeys.primaryBankName)
let firstName = user?.firstName ?? ""
let middleName = user?.lastName ?? ""
let lastName = user?.lastName ?? ""
let fullName = firstName + " " + middleName + " " + lastName
save(value: fullName, forKey: UserKeys.fullName)
save(value: firstName, forKey: UserKeys.firstName)
save(value: lastName, forKey: UserKeys.lastName)
if login ?? false {
save(value: accessCodeBase64, forKey: UserKeys.accessCode)
save(value: user?.kftcClientId ?? "", forKey: UserKeys.kftcClientId)
GMEDB
.shared
.user
.set(accessCodeBase64, .accessCode)
.set(user?.kftcClientId, .kftcClientId)
}
save(value: user?.userId ?? "", forKey: UserKeys.userId)
save(value: user?.nickName ?? "", forKey: UserKeys.nickName)
save(value: user?.availableBalance ?? "", forKey: user?.availableBalance ?? "0" )
save(value: user?.rewardPoint ?? "", forKey: UserKeys.rewardPoint)
save(value: user?.verified ?? false, forKey: UserKeys.verified)
save(value: user?.kyc ?? "", forKey: UserKeys.kyc)
save(value: user?.email ?? "", forKey: UserKeys.email)
save(value: user?.mobileNumber ?? "", forKey: UserKeys.mobileNumber)
save(value: user?.sourceId ?? "", forKey: UserKeys.sourceId)
save(value: "111111", forKey: "com.gmeremit.password")
save(value: user?.isReferred ?? "", forKey: UserKeys.isReferred)
save(value: user?.idType ?? "", forKey: UserKeys.idType)
save(value: user?.idNumber ?? "", forKey: UserKeys.idNumber)
save(value: user?.country ?? "" , forKey: UserKeys.country)
save(value: user?.countryCode, forKey: UserKeys.countryCode)
save(value: user?.primaryAccountNumber, forKey: UserKeys.primaryAccountNumber)
save(value: user?.senderId, forKey: UserKeys.senderId)
save(value: user?.yearlyLimit, forKey: UserKeys.yearlyLimit)
save(value: user?.dateOfBirth, forKey: UserKeys.dateOfBirth)
save(value: user?.pennyTestStatus, forKey: AppConstants.pennyTestStatusCode)
save(value: user?.accessTokenRegTime, forKey: AppConstants.accessTokenRegTime)
save(value: user?.accessTokenExpTime, forKey: AppConstants.accessTokenExpTime)
GMEDB
.shared
.setUser(user)
// save remind day of KFTC Token
let remindDay = calculateDDay(registDate: user?.accessTokenRegTime)
// let remindDay = calculateDDay(registDate: "7/20/2018 4:49:32 PM")
save(value: remindDay, forKey: UserKeys.remindKFTCTokenDay)
// let remindDay = calculateDDay(registDate: "7/20/2018 4:49:32 PM")
GMEDB.shared.user.set(remindDay, .remindKFTCTokenDay)
guard let encryptedPassword = password else { return }
let email = UserDefaults.standard.string(forKey: UserKeys.email) ?? ""
let email = GMEDB.shared.user.string(.email) ?? ""
if email != KeyChain.shared.get(key: .email) {
KeyChain.shared.remove(key: .biometricAuth)

138
GMERemittance/Utility/Database/GMEDB.swift

@ -0,0 +1,138 @@
//
// Database.swift
// GME Remit
//
// Created by InKwon James Kim on 17/07/2019.
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
protocol GMEDBKeyProtocol: RawRepresentable, CaseIterable {}
class GMEDB {
static let shared = GMEDB()
private var database: UserDefaults {
return UserDefaults.standard
}
enum UserKeys: String, GMEDBKeyProtocol {
case pennyTestServerMessage = "pennyTestServerMessage"
case pennyTestStatusCode = "pennyTestStatusCode"
case pennyTestRequested = "pennyTestRequested"
case pennyTestPresentedOnce = "pennyTestPresentedOnce"
case accessTokenRegTime = "accessTokenRegTime"
case accessTokenExpTime = "accessTokenExpTime"
case yearlyLimit = "yearlyLimit"
case userId = "com.gmeremit.username"
case senderId = "senderId"
case fullName = "com.gmeremit.fullName"
case firstName = "firstName"
case middleName = "middleName"
case lastName = "lastName"
case nickName = "com.gmeremit.nickName"
case dateOfBirth = "date_of_birth"
case email = "com.gmeremit.email"
case mobileNumber = "com.gmeremit.mobileNumber"
case rewardPoint = "com.gmeremit.rewardPoint"
case walletNumber = "com.gmeremit.walletNumber"
case availableBalance = "com.gmeremit.balance"
case primaryBankName = "com.gmeremit.bankName"
case primaryAccountNumber = "PrimaryAccountNumber"
case accessCode = "com.gmeremit.accessCode"
case dpUrl = "com.gmeremit.dpUrl"
case kyc = "com.gmeremit.isKYCSubmitted"
case verified = "com.gmeremit.isVerified"
case active = "active"
case cmRegistrationId = "cmRegistrationId"
case isReferred = "com.gmeremit.isReferred"
case country = "country"
case province = "province"
case provinceId = "provinceId"
case sourceId = "com.gmeremit.sourceId"
case idType = "idType"
case idNumber = "idNumber"
case countryCode = "countryCode"
case ErrorCode = "ErrorCode"
case hasRequestedPennyTest = "hasRequestedPennyTest"
case isPennyTestPending = "isPennyTestPending"
case kftcClientId = "kftcClientId"
case Msg = "Msg"
case Id = "Id"
case Data = "Data"
case isUseBiometricAuth = "com.gmeremit.isUseBiometricAuth"
case remindKFTCTokenDay = "remindKFTCTokenDay"
}
enum AppKey: String, GMEDBKeyProtocol {
case uuid = "uuid"
case firstTimeLanguageIsSet = "firstTimeLanguageIsSet"
case criticalUpdate = "criticalUpdate"
case currentLanguage = "currentLanguage"
case dateOfDontShowNotification = "dateOfDontShowNotification"
case dateOfExpireNotification = "dateOfExpireNotification"
case isOpenedTokenRenwalAlert = "isOpenedTokenRenwalAlert"
case isOpenedPopupNotification = "isOpenedPopupNotification"
}
let user = UserDefaultsWrapper<UserKeys>()
let app = UserDefaultsWrapper<AppKey>()
}
extension GMEDB {
@discardableResult
func setUser(_ user: User?) -> UserDefaultsWrapper<UserKeys> {
let firstName = user?.firstName ?? ""
let middleName = user?.lastName ?? ""
let lastName = user?.lastName ?? ""
let fullName = firstName + " " + middleName + " " + lastName
self.user
.set(user?.dpUrl, .dpUrl)
.set(user?.walletNumber, .walletNumber)
.set(user?.primaryBankName, .primaryBankName)
self.user
.set(fullName, .fullName)
.set(firstName, .firstName)
.set(lastName, .lastName)
.set(user?.userId, .userId)
.set(user?.nickName, .nickName)
self.user
.set(user?.availableBalance, .availableBalance)
.set(user?.rewardPoint, .rewardPoint)
.set(user?.verified, .verified)
.set(user?.kyc, .kyc)
self.user
.set(user?.email, .email)
.set(user?.mobileNumber, .mobileNumber)
.set(user?.sourceId, .sourceId)
.set(user?.isReferred, .isReferred)
self.user
.set(user?.idType, .idType)
.set(user?.idNumber, .idNumber)
.set(user?.country, .country)
.set(user?.countryCode, .countryCode)
self.user
.set(user?.primaryAccountNumber, .primaryAccountNumber)
.set(user?.senderId, .senderId)
.set(user?.yearlyLimit, .yearlyLimit)
.set(user?.dateOfBirth, .dateOfBirth)
self.user
.set(user?.pennyTestStatus, .pennyTestStatusCode)
.set(user?.accessTokenRegTime, .accessTokenRegTime)
.set(user?.accessTokenExpTime, .accessTokenExpTime)
return self.user
}
}

119
GMERemittance/Utility/Database/UserDefaultsWrapper.swift

@ -0,0 +1,119 @@
//
// InnerDatabase.swift
// GME Remit
//
// Created by InKwon James Kim on 17/07/2019.
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
class UserDefaultsWrapper<Keys: GMEDBKeyProtocol> where Keys.RawValue == String {
func float(_ key: Keys) -> Float? {
return UserDefaults.standard.float(forKey: key.rawValue)
}
func string(_ key: Keys) -> String? {
return UserDefaults.standard.string(forKey: key.rawValue)
}
func bool(_ key: Keys) -> Bool {
return UserDefaults.standard.bool(forKey: key.rawValue)
}
func double(_ key: Keys) -> Double? {
return UserDefaults.standard.double(forKey: key.rawValue)
}
func integer(_ key: Keys) -> Int {
return UserDefaults.standard.integer(forKey: key.rawValue)
}
func object(_ key: Keys) -> Any? {
return UserDefaults.standard.object(forKey: key.rawValue)
}
}
extension UserDefaultsWrapper {
@discardableResult
func set(_ url: URL?, _ key: Keys) -> Self {
UserDefaults.standard.set(url, forKey: key.rawValue)
return self
}
@discardableResult
func set(_ value: Any?, _ key: Keys) -> Self {
UserDefaults.standard.set(value, forKey: key.rawValue)
return self
}
@discardableResult
func set(_ value: Bool?, _ key: Keys) -> Self {
UserDefaults.standard.set(value, forKey: key.rawValue)
return self
}
@discardableResult
func set(_ value: Double?, _ key: Keys) -> Self {
UserDefaults.standard.set(value, forKey: key.rawValue)
return self
}
@discardableResult
func set(_ value: String?, _ key: Keys) -> Self {
UserDefaults.standard.set(value, forKey: key.rawValue)
return self
}
@discardableResult
func set(_ value: Int?, _ key: Keys) -> Self {
UserDefaults.standard.set(value, forKey: key.rawValue)
return self
}
@discardableResult
func set(_ value: Float?, _ key: Keys) -> Self {
UserDefaults.standard.set(value, forKey: key.rawValue)
return self
}
}
extension UserDefaultsWrapper {
@discardableResult
func remove(_ key: Keys) -> Self {
UserDefaults.standard.removeObject(forKey: key.rawValue)
return self
}
@discardableResult
func remove(_ keys: [Keys]) -> Self {
keys.forEach {
UserDefaults.standard.removeObject(forKey: $0.rawValue)
}
return self
}
@discardableResult
func removeAll() -> Self {
Keys.allCases.forEach{
UserDefaults.standard.removeObject(forKey: $0.rawValue)
}
return self
}
}
extension UserDefaultsWrapper {
@discardableResult
func debugPrint(_ key: Keys) -> UserDefaultsWrapper {
print("\(key.rawValue): \(object(key) as Any)")
return self
}
@discardableResult
func debugPrintAllElement() -> Self {
print("\(Keys.self)'s All Elements")
Keys.allCases.forEach{
print("\($0.rawValue): \(object($0) as Any)")
}
return self
}
}

2
GMERemittance/Utility/GMENumberTextField.swift

@ -21,7 +21,7 @@ class GMENumberTextField: UITextField {
keyboardType = .numberPad
customerNativeCountry = UserDefaults.standard.string(forKey: UserKeys.countryCode)
customerNativeCountry = GMEDB.shared.user.string(.countryCode)
selectKeyboardType()
}

4
GMERemittance/Utility/HotLine/Application Logic/Interactor/HotLineInteractor.swift

@ -30,10 +30,8 @@ extension HotLineInteractor: HotLineInteractorInput {
service.fetchHotLines(
success: {
// Base selected Language
// let userCountry = UserDefaults.standard.string(forKey: AppConstants.firstTimeLanguageIsSet)
// Base Native Country as lowercased
let userCountry = UserDefaults.standard.string(forKey: UserKeys.countryCode)?.lowercased()
let userCountry = GMEDB.shared.user.string(.countryCode)?.lowercased()
guard
let userHotLine = $0?.filter({ $0.countryCode == userCountry }),

4
GMERemittance/Utility/KeyChain.swift

@ -25,7 +25,7 @@ final class KeyChain {
self.keychain = Keychain(service: "com.gme.gmeremit")
// There is no email, it's logout or remove app all and reinstall app.
if UserDefaults.standard.string(forKey: UserKeys.email) == nil {
if GMEDB.shared.user.string(.email) == nil {
try? keychain.removeAll()
}
}
@ -39,7 +39,7 @@ final class KeyChain {
}
func get(key: KeyType) -> String? {
guard let pw = try? self.keychain.get(key.rawValue) else {
guard let pw = ((try? self.keychain.get(key.rawValue)) as String??) else {
return nil
}

113
GMERemittanceTests/DatabaseTest.swift

@ -0,0 +1,113 @@
//
// DatabaseTest.swift
// GMERemittanceTests
//
// Created by InKwon James Kim on 17/07/2019.
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
import XCTest
@testable import GME_Remit
class DatabaseTest: XCTestCase {
let testUserJson =
"""
{
"Id" : "",
"Extra" : "",
"Extra2" : "",
"Data" : {
"accessCode" : null,
"accessTokenRegTime" : "",
"kyc" : false,
"mobileNumber" : "",
"provinceId" : "",
"availableBalance" : "0",
"country" : "",
"ErrorCode" : "0",
"pennyTestStatus" : "0",
"accessTokenExpTime" : "",
"Extra" : "",
"firstName" : "iosDemo@gmeremit.com",
"Data" : null,
"yearlyLimit" : "30,000",
"dob" : "1988-03-27",
"dpUrl" : null,
"email" : "iosDemo@gmeremit.com",
"sourceId" : "",
"countryCode" : "",
"senderId" : "17",
"active" : true,
"appUpdate" : [
{
"Info" : "This version of the app is out of date and will stop working soon. To keep using GME, please install the latest update.",
"OS" : "IOS",
"Build" : "6",
"Version" : "2.2.2",
"Critical" : "Y"
},
{
"Info" : "This version of the app is out of date and will stop working soon. To keep using GME, please install the latest update.",
"OS" : "ANDROID",
"Build" : "17",
"Version" : "2.3.0",
"Critical" : "Y"
}
],
"Extra2" : "",
"isReferred" : false,
"rewardPoint" : "0",
"province" : "",
"cmRegistrationId" : "",
"Msg" : "",
"primaryBankName" : "",
"Id" : "",
"verified" : false,
"walletNumber" : "",
"userId" : "iosDemo@gmeremit.com",
"kftcClientId" : null
},
"ErrorCode" : "0",
"Msg" : "success"
}
"""
func testSetUser() {
let object = UserContainer(JSONString: testUserJson)
GMEDB
.shared
.setUser(object?.data)
.debugPrintAllElement()
XCTAssert(GMEDB.shared.user.string(.availableBalance) == Optional("0"))
XCTAssert(GMEDB.shared.user.string(.country) == Optional(""))
XCTAssert(GMEDB.shared.user.string(.ErrorCode) == nil)
XCTAssert(GMEDB.shared.user.string(.pennyTestStatusCode) == Optional("0"))
XCTAssert(GMEDB.shared.user.string(.firstName) == Optional("iosDemo@gmeremit.com"))
XCTAssert(GMEDB.shared.user.string(.Data) == nil)
XCTAssert(GMEDB.shared.user.string(.yearlyLimit) == Optional("30,000"))
XCTAssert(GMEDB.shared.user.string(.dateOfBirth) == Optional("1988-03-27"))
XCTAssert(GMEDB.shared.user.string(.senderId) == Optional("17"))
}
func testRemoveAll() {
GMEDB
.shared
.user
.removeAll()
.debugPrintAllElement()
XCTAssert(GMEDB.shared.user.string(.availableBalance) == nil)
XCTAssert(GMEDB.shared.user.string(.country) == nil)
XCTAssert(GMEDB.shared.user.string(.ErrorCode) == nil)
XCTAssert(GMEDB.shared.user.string(.pennyTestStatusCode) == nil)
XCTAssert(GMEDB.shared.user.string(.firstName) == nil)
XCTAssert(GMEDB.shared.user.string(.Data) == nil)
XCTAssert(GMEDB.shared.user.string(.yearlyLimit) == nil)
XCTAssert(GMEDB.shared.user.string(.dateOfBirth) == nil)
XCTAssert(GMEDB.shared.user.string(.senderId) == nil)
}
}
Loading…
Cancel
Save