Files
Woka_Native_iOS/WOKA/SideBarNav/Controller/ContactSupportVC.swift
Bilal 4175dca940 - Added api for FAQ’s , Made data model and decoded it
- Made 3 layer gradient for the view
- Completed FAq expand collapse with logic.
- addd error handler
- Made Woka Support UI
- Added Custom DropDown in support
- Added Custom Gradeint
- Handled the autolayouts
- Added Check for No Subject Selected
2024-06-04 20:01:51 +05:30

98 lines
4.2 KiB
Swift

//
// ContactSupportVC.swift
// WOKA
//
// Created by Bilal on 04/06/2024.
//
import UIKit
class ContactSupportVC: UIViewController {
@IBOutlet weak var supportGirlImage: UIImageView!
let dropDownModule = DropDown()
var dataSource = [String]()
@IBOutlet weak var bottomArrow: UIImageView!
@IBOutlet weak var subjectStack: UIStackView!
@IBOutlet weak var subjectLabel: UILabel!
@IBOutlet weak var messageTF: UITextView!
@IBOutlet weak var submitBtn: LocalisedElementsButton!
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Woka Support"
let color1 = #colorLiteral(red: 0.7294117647, green: 0.7529411765, blue: 0.3803921569, alpha: 1)
let color2 = #colorLiteral(red: 0.1843137255, green: 0.2156862745, blue: 0.0431372549, alpha: 1)
self.view.applyGradient(colors: [color1, color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 0.8))
let color3 = #colorLiteral(red: 0.968627451, green: 0.7882352941, blue: 0.1294117647, alpha: 1)
let color4 = #colorLiteral(red: 0.968627451, green: 0.4196078431, blue: 0.1098039216, alpha: 1)
self.submitBtn.applyGradient(colors: [color3, color4], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 0.8))
self.submitBtn.roundCorner()
supportGirlImage.roundCorner()
subjectStack.roundCorner()
messageTF.textContainerInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
dataSource = ["Query" , "Complaint", "Suggestion", "Other"]
initDropDown()
bottomArrow.addTapGesture {
self.dropDownModule.show()
}
subjectLabel.addTapGesture {
self.dropDownModule.show()
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.setNavigationBarHidden(true, animated: animated)
}
@IBAction func submitBtnTapped(_ sender: LocalisedElementsButton) {
if subjectLabel.text?.lowercased() == "select subject"{
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.alertCustomVC) as! AlertCustomVC
vcPush.contentLabel = "Please select subject".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
vcPush.mainTitleText = "Error".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)
// vcPush.onDoneBlock = { isDone in }
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.present(vcPush, animated: true)
return
}
}
// this func will initialize the dropdown menu
func initDropDown(){
dropDownModule.anchorView = subjectStack
dropDownModule.dataSource = dataSource
dropDownModule.cornerRadius = 10
dropDownModule.bottomOffset = CGPoint(x: 0, y:(dropDownModule.anchorView?.plainView.bounds.height)!)
dropDownModule.topOffset = CGPoint(x: 0, y:-(dropDownModule.anchorView?.plainView.bounds.height)!)
dropDownModule.direction = .bottom
dropDownModule.textFont = FontCustom.shareInstance.customFont(fontName: .Exo2_Medium, size: 16)
dropDownModule.shadowColor = UIColor.appColor(.TextDarkBlue)!
dropDownModule.backgroundColor = .white
dropDownModule.shadowOffset = CGSize(width: 0, height: 1)
dropDownModule.separatorColor = UIColor.lightGray
dropDownModule.width = subjectStack.frame.width
dropDownModule.selectionBackgroundColor = UIColor.appColor(.TextDarkBlue)!
dropDownModule.selectedTextColor = UIColor.white
dropDownModule.selectRow(0)
dropDownModule.selectionAction = { [unowned self] (index: Int, item: String) in
self.subjectLabel.text = item
print(index , item)
}
}
}