- Internet issue - Added api to get blogs, with data model decoding, inflating the collection view - Added api to get the songs, with data model decoding , inflated tableview with dynamic height - Added inline player for song list
133 lines
5.3 KiB
Swift
133 lines
5.3 KiB
Swift
//
|
|
// SideMenuVC.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 21/05/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class SideMenuVC: UIViewController {
|
|
|
|
@IBOutlet weak var logoutBtn: UIButton!
|
|
@IBOutlet weak var selectionMenuTrailingConstraint: NSLayoutConstraint!
|
|
@IBOutlet weak var languageControl: CustomizableSegmentControl!
|
|
|
|
@IBOutlet weak var theme1: UIView!
|
|
@IBOutlet weak var theme2: UIView!
|
|
|
|
//Theme Select Outlets
|
|
@IBOutlet weak var themeOneView: UIView!
|
|
@IBOutlet weak var themeOneCheckMark: UIImageView!
|
|
@IBOutlet weak var themeTwoView: UIView!
|
|
@IBOutlet weak var themetwoCheckMark: UIImageView!
|
|
@IBOutlet weak var userName: UILabel!
|
|
|
|
@IBOutlet weak var aboutBtn: UIButton!
|
|
@IBOutlet weak var faqBtn: UIButton!
|
|
@IBOutlet weak var wokaSupportBtn: UIButton!
|
|
@IBOutlet weak var profileBtn: UIButton!
|
|
@IBOutlet weak var myOrderBtn: UIButton!
|
|
@IBOutlet weak var addChildBtn: UIButton!
|
|
@IBOutlet weak var deactivateBtn: UIButton!
|
|
@IBOutlet weak var termsConditionBtn: UIButton!
|
|
@IBOutlet weak var privacyPolicyBtn: UIButton!
|
|
@IBOutlet weak var disclaimerBtn: UIButton!
|
|
|
|
@IBOutlet weak var avatarImage: UIImageView!
|
|
@IBOutlet weak var scrollView: UIScrollView!
|
|
|
|
var vm = SideMenuVM()
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
vm.vc = self
|
|
vm.initView()
|
|
}
|
|
|
|
override func viewDidLayoutSubviews() {
|
|
vm.themeSelect()
|
|
}
|
|
|
|
@IBAction func closeBtnTapped(_ sender: UIButton) {
|
|
self.sideMenuController?.hideMenu()
|
|
}
|
|
|
|
@IBAction func btnTapped(_ sender : UIButton){
|
|
switch sender{
|
|
case aboutBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.about])
|
|
case faqBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.faq])
|
|
case wokaSupportBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.support])
|
|
case profileBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.profile])
|
|
case myOrderBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.order])
|
|
case addChildBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.addChild])
|
|
case deactivateBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.deactivate])
|
|
case termsConditionBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.termsCondition])
|
|
case privacyPolicyBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.privacyPolicy])
|
|
case disclaimerBtn:
|
|
self.sideMenuController?.hideMenu()
|
|
NotificationCenter.default.post(name: .linkPush, object: nil, userInfo: ["type": LinkTypeEnum.disclaimer])
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
|
|
@IBAction func logoutBtnTapped(_ sender: LocalisedElementsButton) {
|
|
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
|
|
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.yesNoAlertVC) as! YesNoAlertVC
|
|
vcPush.mainTitleText = "WOKA"
|
|
vcPush.contentLabel = "Do you want to LOGOUT from the WOKA APP"
|
|
vcPush.onDoneBlock = { [weak self] mode in
|
|
guard let self else{return}
|
|
switch mode{
|
|
case .yes:
|
|
//If user clicked to proceed on login. Call the api.
|
|
vm.logoutUser { isDone in
|
|
self.sideMenuController?.hideMenu()
|
|
AuthFunc.shareInstance.logout()
|
|
UIApplication.setRootView(LoginNavVC.instantiate(from: .AuthenticationSB))
|
|
}
|
|
case .no:
|
|
print("no")
|
|
}
|
|
}
|
|
vcPush.modalPresentationStyle = .overCurrentContext
|
|
vcPush.modalTransitionStyle = .crossDissolve
|
|
self.present(vcPush, animated: true)
|
|
}
|
|
|
|
@IBAction func languageSwitchSlide(_ sender: CustomizableSegmentControl) {
|
|
let generator = UINotificationFeedbackGenerator()
|
|
generator.notificationOccurred(.success)
|
|
Timer.scheduledTimer(withTimeInterval: 0.2, repeats: false) { _ in
|
|
switch sender.selectedSegmentIndex{
|
|
case 0: // English
|
|
AuthFunc.shareInstance.setDefaultLanguage(language: .english)
|
|
case 1: // Hindi
|
|
AuthFunc.shareInstance.setDefaultLanguage(language: .hindi)
|
|
default:
|
|
break
|
|
}
|
|
self.sideMenuController?.hideMenu()
|
|
}
|
|
}
|
|
}
|