Browse Source

adding protocol

pull/1/head
gme_2 6 years ago
parent
commit
1d992464f5
  1. 20
      GMERemittance.xcodeproj/project.pbxproj
  2. 11
      GMERemittance/Api/ApiServiceType.swift
  3. 21
      GMERemittance/Api/ExchangeRateApiService.swift
  4. 24
      GMERemittance/Extension/ExtensionJSON.swift
  5. 6
      GMERemittance/Module/ExchangeRateViewControllerV2.swift
  6. 11
      GMERemittance/RestApiManager.swift

20
GMERemittance.xcodeproj/project.pbxproj

@ -232,6 +232,9 @@
D962231E212C126500B7A115 /* ExchangeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D962231D212C126500B7A115 /* ExchangeModel.swift */; };
D9638A02212CF30C00B48742 /* CountryFlag.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9638A01212CF30C00B48742 /* CountryFlag.swift */; };
D96848C7212D3A7400EF12B1 /* DataRequestExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96848C6212D3A7400EF12B1 /* DataRequestExtension.swift */; };
D96848C9212D3AEB00EF12B1 /* ExtensionJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96848C8212D3AEB00EF12B1 /* ExtensionJSON.swift */; };
D96848CC212D3F2300EF12B1 /* ExchangeRateApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96848CB212D3F2300EF12B1 /* ExchangeRateApiService.swift */; };
D96848CE212D419400EF12B1 /* ApiServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D96848CD212D419400EF12B1 /* ApiServiceType.swift */; };
EBFC1719B80F43F88EB01F69 /* Pods_GMERemittanceTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0380AEB198AADC0BC4394515 /* Pods_GMERemittanceTests.framework */; };
FF29296C212B8DFE00FF5BAC /* ExchangeRateCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF29296B212B8DFE00FF5BAC /* ExchangeRateCollectionViewCell.swift */; };
FFD19C7C2112E8F20073689F /* Pods_GMERemittance.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FFD19C7B2112E8F20073689F /* Pods_GMERemittance.framework */; };
@ -495,6 +498,9 @@
D962231D212C126500B7A115 /* ExchangeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExchangeModel.swift; sourceTree = "<group>"; };
D9638A01212CF30C00B48742 /* CountryFlag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountryFlag.swift; sourceTree = "<group>"; };
D96848C6212D3A7400EF12B1 /* DataRequestExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataRequestExtension.swift; sourceTree = "<group>"; };
D96848C8212D3AEB00EF12B1 /* ExtensionJSON.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionJSON.swift; sourceTree = "<group>"; };
D96848CB212D3F2300EF12B1 /* ExchangeRateApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExchangeRateApiService.swift; sourceTree = "<group>"; };
D96848CD212D419400EF12B1 /* ApiServiceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiServiceType.swift; sourceTree = "<group>"; };
E4028C5A57499BB54764190C /* Pods_GMERemittanceUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GMERemittanceUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FF29296B212B8DFE00FF5BAC /* ExchangeRateCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExchangeRateCollectionViewCell.swift; sourceTree = "<group>"; };
FFD19C7B2112E8F20073689F /* Pods_GMERemittance.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_GMERemittance.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@ -631,6 +637,7 @@
0477E2A420492EDA00B02377 /* LabelExtension.swift */,
D962230B212BD7A100B7A115 /* ArrayExtension.swift */,
D96848C6212D3A7400EF12B1 /* DataRequestExtension.swift */,
D96848C8212D3AEB00EF12B1 /* ExtensionJSON.swift */,
);
path = Extension;
sourceTree = "<group>";
@ -888,6 +895,7 @@
9FD260F61FD00458007A511D /* GMERemittance */ = {
isa = PBXGroup;
children = (
D96848CA212D3F1200EF12B1 /* Api */,
D962231C212C123600B7A115 /* Model */,
D96222FF212BD5E700B7A115 /* Library */,
D907AB96212AA8A300915A87 /* Module */,
@ -1065,6 +1073,15 @@
path = Model;
sourceTree = "<group>";
};
D96848CA212D3F1200EF12B1 /* Api */ = {
isa = PBXGroup;
children = (
D96848CB212D3F2300EF12B1 /* ExchangeRateApiService.swift */,
D96848CD212D419400EF12B1 /* ApiServiceType.swift */,
);
path = Api;
sourceTree = "<group>";
};
FF29296A212B8DE600FF5BAC /* Cell */ = {
isa = PBXGroup;
children = (
@ -1533,6 +1550,8 @@
D962230C212BD7A100B7A115 /* ArrayExtension.swift in Sources */,
04B67E922046CA7A000A4248 /* WalletReviewViewController.swift in Sources */,
04B232DF2003732E00736B89 /* RequestNewCodeViewController.swift in Sources */,
D96848CE212D419400EF12B1 /* ApiServiceType.swift in Sources */,
D96848C9212D3AEB00EF12B1 /* ExtensionJSON.swift in Sources */,
A24B44FA204CF108009BF491 /* InviteeModel.swift in Sources */,
9FB54C1320088EF7003454E2 /* WithdrawViewController.swift in Sources */,
0496B84E1FE7DFCD0044810E /* UIViewControllerExtension.swift in Sources */,
@ -1634,6 +1653,7 @@
04CD5395208F0765008F0971 /* UploadImageViewModel.swift in Sources */,
A2CB8E592027002E00008EEE /* ExchangeRateViewModel.swift in Sources */,
A2B9D7592020C616007C1049 /* MyStoryViewController.swift in Sources */,
D96848CC212D3F2300EF12B1 /* ExchangeRateApiService.swift in Sources */,
A2B0DD8E2085AC690074A5BA /* PaymentMethodId.swift in Sources */,
047635AE200B3F1B00E6F4E5 /* MobileRechargeViewModel.swift in Sources */,
A2E337992048451E002DB015 /* EarnedViewController.swift in Sources */,

11
GMERemittance/Api/ApiServiceType.swift

@ -0,0 +1,11 @@
//
// BaseApi.swift
// GMERemittance
//
// Created by gme_2 on 22/08/2018.
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
//
import Foundation

21
GMERemittance/Api/ExchangeRateApiService.swift

@ -0,0 +1,21 @@
//
// ExchangeRateApiService.swift
// GMERemittance
//
// Created by gme_2 on 22/08/2018.
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
//
import Foundation
protocol FetchCountryCurrencyInformation {
func fetchCountryCurrencyInfo(success: @escaping ([ExchangeRateData]) -> (), failure: @escaping (Error) -> ())
}
extension FetchCountryCurrencyInformation {
func fetchCountryCurrencyInfo(success: @escaping ([ExchangeRateData]) -> (), failure: @escaping (Error) -> ()) {
}
}

24
GMERemittance/Extension/ExtensionJSON.swift

@ -0,0 +1,24 @@
//
// ExtensionJSON.swift
// GMERemittance
//
// Created by gme_2 on 22/08/2018.
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
//
import Foundation
import SwiftyJSON
import ObjectMapper
extension JSON {
func map<T: Mappable>() -> [T]? {
let json = self.array
let mapped: [T]? = json?.compactMap({$0.map()})
return mapped
}
func map<T: Mappable>() -> T? {
let obj: T? = Mapper<T>().map(JSONObject: self.object)
return obj
}
}

6
GMERemittance/Module/ExchangeRateViewControllerV2.swift

@ -63,6 +63,7 @@ class ExchangeRateViewControllerV2: UIViewController {
createTestModel()
// todo: show default native country and falg
// Do any additional setup after loading the view.
fetchExchangeRateInformation()
}
@ -105,13 +106,16 @@ class ExchangeRateViewControllerV2: UIViewController {
}
// function
// other function
func countrySelected(model: [ExchangeRateModel]) {
self.selectedExchageRateModel = model.first
print(model.first?.country)
// show country with flag.
}
private func fetchExchangeRateInformation() {
}
private func setupTargets() {
let tapGuesture = UITapGestureRecognizer(target: self, action: #selector(self.showCountryList(_:)))

11
GMERemittance/RestApiManager.swift

@ -21,14 +21,15 @@ enum ApiResult {
class RestApiMananger {
let manager = Alamofire.SessionManager.default
manager.session.configuration.timeoutIntervalForRequest = 60
manager.session.configuration.timeoutIntervalForResource = 60
let manager: SessionManager
static let sharedInstance = RestApiMananger()
private init() {
init() {
self.manager = Alamofire.SessionManager.default
manager.session.configuration.timeoutIntervalForRequest = 60
manager.session.configuration.timeoutIntervalForResource = 60
}
func getUUID() -> String {

Loading…
Cancel
Save