- updated cart icon in whole shop module , myoders - Finalsied the payment gateway response
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
//
|
|
// MyOrdersVM.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 30/07/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class MyOrdersVM{
|
|
|
|
weak var vc : MyOrdersVC!
|
|
var cartButton: UIBarButtonItem!
|
|
|
|
func initView(){
|
|
|
|
vc.title = "MY ORDERS".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
|
|
|
|
cartButton = BadgeBarBtn.shared.setupCartButton(target: self, action: #selector(self.cartButtonTapped))
|
|
self.vc.navigationItem.rightBarButtonItem = cartButton
|
|
|
|
//check if cart is not fetched
|
|
if !CartDataCache.isFetched{
|
|
CartDataCache.shareInstance.getCartList(vc: self.vc) { [weak self] isDone in
|
|
guard let self else{return}
|
|
if isDone{
|
|
if let button = cartButton.customView as? UIButton {
|
|
BadgeBarBtn.shared.updateBadge(for: button, with: CartDataCache.cartListData.count.toString())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@objc func cartButtonTapped(){
|
|
let sb = UIStoryboard(name: K.StoryBoard.cart, bundle: nil)
|
|
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Cart.cartListVC) as! CartListVC
|
|
self.vc.navigationController?.pushViewController(vcPush, animated: true)
|
|
}
|
|
}
|