Manos Chorianopoulos

add LoyaltyHistoryVC part 2, wallet fixes

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
This diff could not be displayed because it is too large.
......@@ -122,6 +122,16 @@ import SwiftEventBus
}
}
SwiftEventBus.onBackgroundThread(self, name: "vouchers_service_unavailable") { result in
DispatchQueue.main.async {
print("=== vouchers_service_unavailable event ===")
self.showVouchersFailureDialog()
}
}
// TODO: DELETE ===>
// let coupon = swiftApi.ActiveDFYCouponModel()
// coupon._value = "12"
......@@ -149,7 +159,7 @@ import SwiftEventBus
// TODO: Uncomment when UnifiedCoupons will be shown again
// getCouponsSetsDealsRequest()
setBackButton()
setBackButton("ic_close_3")
setNavigationTitle("My Rewards")
tableView.delegate = self
......@@ -605,6 +615,28 @@ import SwiftEventBus
}))
self.present(alert, animated: true, completion: nil)
}
func showVouchersFailureDialog() -> Void {
let alert = UIAlertController(title: "Προσπάθησε ξανά αργότερα", message: "Προσωρινά μη διαθέσιμη πληροφορία.\nΠαρακαλούμε δοκίμασε ξανά σε λίγο.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
switch action.style{
case .default:
// self.handleSpinnerAndEmptyView()
// self.tableView.reloadData()
self.navigationController?.popViewController(animated: true)
self.dismiss(animated: true, completion: {})
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}
}))
self.present(alert, animated: true, completion: nil)
}
func startTimer() {
print("========= MyRewards Timer Started! =========")
......@@ -720,15 +752,24 @@ import SwiftEventBus
}
} else {
self.emptyView.isHidden = true
self.emptyViewHeight.constant = 0
self.showSpinner = false
if (self.dfyCoupons.count == 0 && self.unifiedCoupons.count == 0 && self.coupons.count == 0) {
self.showActiveCouponsBanners = false
if (swiftApi().getShowVouchersBanner() == "false") {
self.emptyView.isHidden = false
self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height
} else {
self.emptyView.isHidden = true
self.emptyViewHeight.constant = 0
}
} else {
self.emptyView.isHidden = true
self.emptyViewHeight.constant = 0
self.showActiveCouponsBanners = true
}
}
......@@ -787,8 +828,9 @@ import SwiftEventBus
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "LoyaltyHistoryBadge"))
// TODO: Open new HistoryVC
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "LoyaltyHistoryViewController") as! SwiftWarplyFramework.LoyaltyHistoryViewController
self.navigationController?.pushViewController(vc, animated: true)
}
@IBAction func dfyEarnButtonAction(_ sender: Any) {
......