Files
Woka_Native_iOS/WOKA/TabBar & SideMenu/Controller/SideMenuVC.swift
BilalKhanWDI 86bd90db31 - Created an extension to handle the rootview.
- Added localisation to theme 1, also updated the English localisation for reversing the language
- Added localisation to the sidebar. Also handled the live language change with the help of observers
- Integrated GetUserData API at splash.
- Added the login NAv. Now if user will logout he will be redirected to the login Screen.
- Added Activity Indicator on the splash to handle the getuserdata.
- Added Guest Login To home.
2024-05-28 19:47:51 +05:30

80 lines
2.6 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 avatarImage: UIImageView!
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 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 = { mode in
switch mode{
case .yes:
//If user clicked to proceed on login. Call the api.
self.sideMenuController?.hideMenu()
AuthFunc.shareInstance.logout()
// UIApplication.setRootView(MainNavController.instantiate(from: .Main))
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) {
Timer.scheduledTimer(withTimeInterval: 0.2, repeats: false) { _ in
switch sender.selectedSegmentIndex{
case 0: // English
AuthFunc.shareInstance.languageSelected = .english
case 1: // Hindi
AuthFunc.shareInstance.languageSelected = .hindi
default:
break
}
self.sideMenuController?.hideMenu()
}
}
}