diff --git a/GME Remit.xcodeproj/project.pbxproj b/GME Remit.xcodeproj/project.pbxproj
index 6dae068b..7ff59037 100644
--- a/GME Remit.xcodeproj/project.pbxproj
+++ b/GME Remit.xcodeproj/project.pbxproj
@@ -8917,8 +8917,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DEVELOPMENT_TEAM = GH2642V3WY;
-
+ DEVELOPMENT_TEAM = 68KRG7GPAV;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -8942,7 +8941,7 @@
"$(OTHER_LDFLAGS)",
"-ObjC",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.japan.jmeremit1;
+ PRODUCT_BUNDLE_IDENTIFIER = com.japan.jmeremit;
PRODUCT_NAME = "JME Remit";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "GME Remit/Supported Files/GMERemittance-Bridging-Header.h";
@@ -8963,8 +8962,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DEVELOPMENT_TEAM = GH2642V3WY;
-
+ DEVELOPMENT_TEAM = 68KRG7GPAV;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -8988,7 +8986,7 @@
"$(OTHER_LDFLAGS)",
"-ObjC",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.japan.jmeremit1;
+ PRODUCT_BUNDLE_IDENTIFIER = com.japan.jmeremit;
PRODUCT_NAME = "JME Remit";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "GME Remit/Supported Files/GMERemittance-Bridging-Header.h";
diff --git a/GME Remit/Extensions/Date+Ext.swift b/GME Remit/Extensions/Date+Ext.swift
index 2352af76..ad5a3ec5 100644
--- a/GME Remit/Extensions/Date+Ext.swift
+++ b/GME Remit/Extensions/Date+Ext.swift
@@ -24,9 +24,18 @@ extension Date {
}
extension Date {
- func asString(style: DateFormatter.Style) -> String {
- let dateFormatter = DateFormatter()
- dateFormatter.dateStyle = style
- return dateFormatter.string(from: self)
- }
+ func asString(style: DateFormatter.Style) -> String {
+ let dateFormatter = DateFormatter()
+ dateFormatter.dateStyle = style
+ return dateFormatter.string(from: self)
+ }
+
+ func converToString(dateFormat format: String) -> String
+ {
+ let dateFormatter = DateFormatter()
+ dateFormatter.dateFormat = format
+ return dateFormatter.string(from: self)
+ }
+
}
+
diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift
index 6fe7926d..94095b5f 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift
@@ -28,16 +28,16 @@ class RecipientsInteractor {
// MARK: Recipients interactor input interface
extension RecipientsInteractor: RecipientsInteractorInput {
- func fetchRecipients(isRefresh: Bool) {
+ func fetchRecipients(isRefresh: Bool, fromDate: String, toDate: String, pageCount: String, countryCode: String) {
if isRefresh {
- fetchRecipients()
+ fetchRecipients(fromDate: fromDate, toDate: toDate, pageCount: pageCount, countryCode: countryCode)
return
}
guard
let recipients = self.recipients
else {
- fetchRecipients()
+ fetchRecipients(fromDate: fromDate, toDate: toDate, pageCount: pageCount, countryCode: countryCode)
return
}
@@ -45,17 +45,18 @@ extension RecipientsInteractor: RecipientsInteractorInput {
}
func deleteRecipient(who recipient: Recipient) {
- let myUsername = GMEDB.shared.user.string(.userId) ?? ""
- service.deleteRecipient(
- username: myUsername,
- reciepient: recipient,
- success: { self.fetchRecipients(isRefresh: true) },
- failure: {self.output?.setError(with: $0)}
- )
+// let myUsername = GMEDB.shared.user.string(.userId) ?? ""
+// service.deleteRecipient(
+// username: myUsername,
+// reciepient: recipient,
+// success: { self.fetchRecipients(isRefresh: true) },
+// failure: {self.output?.setError(with: $0)}
+// )
}
- private func fetchRecipients() {
+ private func fetchRecipients(fromDate: String, toDate: String, pageCount: String, countryCode: String) {
service.fetchRecipients(
+ fromDate: fromDate, toDate: toDate, pageCount: pageCount, countryCode: countryCode,
success: {
self.recipients = $0.recipients
self.output?.setRecipients(using: $0.recipients)
diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift
index 10e8a508..5365ae9c 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift
@@ -7,11 +7,11 @@
//
protocol RecipientsInteractorInput: class {
- func fetchRecipients(isRefresh: Bool)
- func deleteRecipient(who recipient: Recipient)
+ func fetchRecipients(isRefresh: Bool, fromDate: String, toDate: String, pageCount: String, countryCode: String)
+ func deleteRecipient(who recipient: Recipient)
}
protocol RecipientsInteractorOutput: class {
- func setRecipients(using model: FetchBeneficiariesModel?)
- func setError(with error: Error)
+ func setRecipients(using model: FetchBeneficiariesModel?)
+ func setError(with error: Error)
}
diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift
index c7cf654f..8ce693a5 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift
@@ -11,12 +11,16 @@ import Alamofire
class RecipientsService: RecipientsServiceType {
func fetchRecipients(
+ fromDate: String,
+ toDate: String,
+ pageCount: String,
+ countryCode: String,
success: @escaping (FetchRecipientsModel) -> Void,
failure: @escaping (Error) -> Void
) {
let senderID = GMEDB.shared.user.string(.senderId) ?? ""
APIRouter
- .fetchRecipients(senderID: senderID, fromDate: "", toDate: "", countryCode: "", pageCount: "")
+ .fetchRecipients(senderID: senderID, fromDate: fromDate, toDate: toDate, countryCode: "", pageCount: "")
.json(success: success, failure: failure)
}
diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift
index d2d7c33d..0f8a5f0c 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsServiceType.swift
@@ -8,6 +8,10 @@
protocol RecipientsServiceType: class, ApiServiceType {
func fetchRecipients(
+ fromDate: String,
+ toDate: String,
+ pageCount: String,
+ countryCode: String,
success: @escaping (FetchRecipientsModel) -> Void,
failure: @escaping (Error) -> Void
)
diff --git a/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift b/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift
index c3746e79..f9cd2275 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift
@@ -7,7 +7,7 @@
//
protocol RecipientsModuleInterface: class {
- func fetchRecipients(isRefresh: Bool)
+ func fetchRecipients(isRefresh: Bool, fromDate: String, toDate: String, pageCount: String, countryCode: String)
func openSendMoneyCalculate(who recipient: Recipient)
func openAddRecipient(with delegate: SetupRecipientDelegate)
diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift
index 8541d47e..c5966a00 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift
@@ -50,9 +50,9 @@ extension RecipientsPresenter: RecipientsModuleInterface {
interactor?.deleteRecipient(who: recipient)
}
- func fetchRecipients(isRefresh: Bool) {
+ func fetchRecipients(isRefresh: Bool, fromDate: String, toDate: String, pageCount: String, countryCode: String) {
viewModel?.progress(isShow: true)
- interactor?.fetchRecipients(isRefresh: isRefresh)
+ interactor?.fetchRecipients(isRefresh: isRefresh, fromDate: fromDate, toDate: toDate, pageCount: pageCount, countryCode: countryCode)
}
}
diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/Recipients.storyboard b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/Recipients.storyboard
index 6fa73709..cc57b763 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/Recipients.storyboard
+++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/Recipients.storyboard
@@ -295,7 +295,7 @@
-
+
diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift
index 5fa7028e..91388929 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift
@@ -26,9 +26,9 @@ class RecipientsViewController: UIViewController {
private lazy var deleteTrigger = PublishSubject()
private let impact = UISelectionFeedbackGenerator()
private var model: [Recipient]?
- var refreshControl: UIRefreshControl?
- var from: String?
- var to: String?
+ private lazy var refreshControl = UIRefreshControl()
+ var from: Date?
+ var to: Date?
// MARK: Computed Properties
@@ -61,9 +61,9 @@ class RecipientsViewController: UIViewController {
}
@IBAction func cancelDate(_ sender: UIButton) {
- from = Calendar.current.date(byAdding: .weekOfMonth, value: -1, to: Date())!.asString(style: .medium)
- to = Date().asString(style: .medium)
- self.viewModel.fetchTransaction(fromDate: from ?? "", toDate: to ?? "", pageCount: "", countryCode: "")
+ self.from = Calendar.current.date(byAdding: .weekOfMonth, value: -1, to: Date())
+ self.to = Date()
+ self.viewModel.fetchTransaction(fromDate: self.from?.converToString(dateFormat: "yyyy-MM-dd") ?? "", toDate: self.to?.converToString(dateFormat: "yyyy-MM-dd") ?? "", pageCount: "", countryCode: "")
}
@IBAction func dateTapped(_ sender: UIButton) {
@@ -88,17 +88,27 @@ class RecipientsViewController: UIViewController {
if self.presentingViewController == nil {
self.navigationItem.leftBarButtonItem = nil
}
+
+ }
+
+ private func addRefreshControl() {
+ let colorOption = [NSAttributedString.Key.foregroundColor : UIColor.themeWhite]
+
+ let title = NSAttributedString(string: "pull to refresh", attributes: colorOption)
+
+ refreshControl.attributedTitle = title
+ refreshControl.backgroundColor = .themeBlue
+ refreshControl.tintColor = .themeWhite
+ refreshControl.addTarget(self, action: #selector(refresh), for: .valueChanged)
- refreshControl = UIRefreshControl()
- refreshControl?.addTarget(self, action: #selector(refresh(_:)), for: .valueChanged)
- scrollView.refreshControl = refreshControl
+ self.scrollView.refreshControl = refreshControl
}
@objc func refresh(_ sender: AnyObject){
- refreshControl?.endRefreshing()
- self.viewModel.presenter?.fetchRecipients(isRefresh: true)
-
- }
+ refreshControl.endRefreshing()
+ self.viewModel.fetchTransaction(fromDate: self.from?.converToString(dateFormat: "yyyy-MM-dd") ?? "", toDate: self.to?.converToString(dateFormat: "yyyy-MM-dd") ?? "", pageCount: "", countryCode: "")
+
+ }
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
@@ -114,6 +124,15 @@ class RecipientsViewController: UIViewController {
view.endEditing(true)
}
+
+ func convertToDate(date: String) -> Date? {
+ let dateFormatter = DateFormatter()
+ dateFormatter.dateFormat = "yyyy-MM-dd"
+ dateFormatter.timeZone = TimeZone.current
+ dateFormatter.locale = Locale.current
+ return dateFormatter.date(from: date)
+ }
+
private func getHUmanReadableDate(date: String?) -> String? {
if let date = DateFormatter.toDate(dateString: date ?? "", format: AppConstants.dateFormat) {
let dateString = DateFormatter.toString(date: date, format: AppConstants.humanReadableDateFormat)
@@ -123,8 +142,8 @@ class RecipientsViewController: UIViewController {
}
private func selectedDate(from: String?, to: String?) {
- self.from = from
- self.to = to
+ self.from = convertToDate(date: from ?? "")
+ self.to = convertToDate(date: to ?? "")
guard let fromDate = from, let toDate = to else {return}
self.viewModel.fetchTransaction(fromDate: fromDate, toDate: toDate, pageCount: "", countryCode: "")
}
@@ -184,6 +203,7 @@ extension RecipientsViewController {
)
setUIBinding()
+ addRefreshControl()
}
private func setUIBinding() {
@@ -243,7 +263,7 @@ extension RecipientsViewController {
onNext: {[weak self] _ in guard let `self` = self else { return }
DispatchQueue.main.async {
self.viewWillLayoutSubviews()
- guard let fromDate = self.from, let toDate = self.to else {
+ guard let fromDate = self.from?.asString(style: .medium), let toDate = self.to?.asString(style: .medium) else {
return
}
self.fromDateLabel.text = fromDate
diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift
index 7c48c503..95a20bb6 100644
--- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift
+++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift
@@ -58,14 +58,18 @@ class RecipientsViewModel: ViewModelType {
input
.fetchTrigger
.drive(onNext: { [weak self] in guard let `self` = self else { return }
- self.presenter?.fetchRecipients(isRefresh: false)
+ let fromDate = Calendar.current.date(byAdding: .day, value: -7, to: Date())?.converToString(dateFormat: "yyyy-MM-dd")
+ let toDate = Date().converToString(dateFormat: "yyyy-MM-dd")
+ self.presenter?.fetchRecipients(isRefresh: false,fromDate: fromDate ?? "", toDate: toDate, pageCount: "", countryCode: "")
})
.disposed(by: disposeBag)
input
.refreshTrigger
.drive(onNext: { [weak self] in guard let `self` = self else { return }
- self.presenter?.fetchRecipients(isRefresh: true)
+ let fromDate = Calendar.current.date(byAdding: .day, value: -7, to: Date())?.converToString(dateFormat: "yyyy-MM-dd")
+ let toDate = Date().converToString(dateFormat: "yyyy-MM-dd")
+ self.presenter?.fetchRecipients(isRefresh: true, fromDate: fromDate ?? "", toDate: toDate, pageCount: "", countryCode: "")
})
.disposed(by: disposeBag)
@@ -130,7 +134,7 @@ class RecipientsViewModel: ViewModelType {
}
func fetchTransaction(fromDate: String, toDate: String, pageCount: String, countryCode: String) {
- self.presenter?.fetchRecipients(isRefresh: true)
+ self.presenter?.fetchRecipients(isRefresh: true, fromDate: fromDate, toDate: toDate, pageCount: pageCount, countryCode: countryCode)
}
}
@@ -186,12 +190,12 @@ extension RecipientsViewModel: SetupRecipientDelegate {
func setupRecieientForTermsVC(_ viewController: TermsAndConditionViewController, didSelectRecipientID: String?) {
selectedRecipientID = didSelectRecipientID
- presenter?.fetchRecipients(isRefresh: true)
+ // presenter?.fetchRecipients(isRefresh: true)
}
func setupRecieient(_ viewController: SetupRecipientViewController, didSelectRecipientID: String?) {
selectedRecipientID = didSelectRecipientID
- presenter?.fetchRecipients(isRefresh: true)
+ // presenter?.fetchRecipients(isRefresh: true)
}
func checkOtp(otp: String, userId: String, receiverID: String) {
diff --git a/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/View/DatePickerViewController.swift b/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/View/DatePickerViewController.swift
index 1c4a20a7..8961f345 100644
--- a/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/View/DatePickerViewController.swift
+++ b/GME Remit/Modules/RemittanceModules/TransactionHistoryModules/TransactionHistory/User Interface/View/DatePickerViewController.swift
@@ -78,8 +78,8 @@ class DatePickerViewController: UIViewController {
configureLanguage()
guard let aMonthAgo = Calendar.current.date(
- byAdding: .month,
- value: -1,
+ byAdding: .day,
+ value: -7,
to: Date()) else {
return
}