Initial Commit

This commit is contained in:
2024-05-02 13:20:40 +05:30
commit 39bd2e66da
103 changed files with 5420 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
//
// OnBoardVC.swift
// WOKA
//
// Created by MacBook Pro on 25/04/24.
//
import UIKit
import Lottie
class OnBoardVC: UIViewController {
@IBOutlet var viewLottie: UIView!
@IBOutlet weak var wokaLogoTopConstriant: NSLayoutConstraint!
@IBOutlet weak var carouselCV: UICollectionView!
@IBOutlet weak var pageControl: UIPageControl!
@IBOutlet weak var createAccountBtn: UIButton!
@IBOutlet weak var loginBtn: UIButton!
@IBOutlet weak var loginAsGuestBtn: UIButton!
@IBOutlet weak var mainStack: UIStackView!
var topConstriantFromSplash = Float()
var vm = OnBoardVM()
// MARK: - LifeCycle
deinit{
AuthFunc.shareInstance.stopSound()
}
override func viewDidLoad() {
super.viewDidLoad()
vm.vc = self
AuthFunc.shareInstance.playStartUpsound()
vm.initData()
}
@IBAction func pageControl(_ sender: UIPageControl) {
self.carouselCV.scrollToItem(at: IndexPath(row: sender.currentPage, section: 0), at: .centeredHorizontally, animated: true)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
vm.resumeBackGroundAnimationJSON()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.setNavigationBarHidden(true, animated: animated)
vm.stopBackGroundAnimationJSON()
}
// MARK: - Button Tap Handler
@IBAction func createAccountBtnTapped(_ sender: UIButton) {
let sb = UIStoryboard(name: K.StoryBoard.main, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.OnBoarding.selectAgeVC) as! SelectAgeVC
self.navigationController?.pushViewController(vc, animated: true)
}
@IBAction func loginBtnTapped(_ sender: UIButton) {
}
@IBAction func guestLoginBtnTapped(_ sender: UIButton) {
}
// MARK: - Collection Scroll Handling
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let visibleRect = CGRect(origin: self.carouselCV.contentOffset, size: self.carouselCV.bounds.size)
let visiblePoint = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
if let visibleIndexPath = self.carouselCV.indexPathForItem(at: visiblePoint) {
self.pageControl.currentPage = visibleIndexPath.row
}
}
}
// MARK: - Collection delegate and datasource
extension OnBoardVC : UICollectionViewDelegate,UICollectionViewDataSource{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return vm.data?.count ?? 0
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: K.CellIdentifier.OnBoarding.onBoardCell, for: indexPath) as! OnBoardCell
if let data = vm.data?[indexPath.row]{
cell.setData(data: data)
}
return cell
}
}
// MARK: - Collection Flow Layout
extension OnBoardVC : UICollectionViewDelegateFlowLayout{
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 10
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let frameSize = collectionView.frame.size
return CGSize(width: frameSize.width - 10, height: frameSize.height)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5)
}
}

View File

@@ -0,0 +1,51 @@
//
// SelectAgeVC.swift
// WOKA
//
// Created by Bilal on 26/04/2024.
//
import UIKit
class SelectAgeVC: UIViewController {
@IBOutlet weak var underAgeView: UIView!
@IBOutlet weak var aboveAgeView: UIView!
@IBOutlet weak var privacyLabel: UILabel!
@IBOutlet weak var magicNoLabel: UILabel!
@IBOutlet weak var yearsLabel: UILabel!
@IBOutlet weak var iAmUnderLabel: UILabel!
@IBOutlet weak var iAmAboveLabel: UILabel!
@IBOutlet weak var underLabel: UILabel!
@IBOutlet weak var aboveLabel: UILabel!
@IBOutlet weak var underTextLabel: UILabel!
@IBOutlet weak var aboveTextLabel: UILabel!
@IBOutlet weak var numberText: UILabel!
@IBOutlet weak var wokaLogoTopSpacing: NSLayoutConstraint!
var vm = SelectAgeVM()
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
vm.vc = self
vm.initData()
}
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)
}
// MARK: - Button Tap Handler
}

View File

@@ -0,0 +1,95 @@
//
// SplashVC.swift
// WOKA
//
// Created by MacBook Pro on 25/04/24.
//
import UIKit
import Lottie
class SplashVC: UIViewController {
@IBOutlet weak var wokaLogo: UIImageView!
@IBOutlet weak var hindiBtn: UIButton!
@IBOutlet weak var englishBtn: UIButton!
@IBOutlet weak var languageBtnStack: UIStackView!
@IBOutlet weak var wokaOriginY: NSLayoutConstraint!
var vm = SplashVM()
// MARK: - View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
vm.vc = self
vm.playSplashSound()
animateImageScale()
self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.plain, target:nil, action:nil)
}
@IBAction func languageBtnTapped(_ sender: UIButton) {
switch sender{
case hindiBtn:
K.GVar.localized = K.LocalizedEnum.hindi
case englishBtn:
K.GVar.localized = K.LocalizedEnum.english
default:
K.GVar.localized = K.LocalizedEnum.english
}
let sb = UIStoryboard(name: K.StoryBoard.main, bundle: nil)
let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.OnBoarding.onBoardVC) as! OnBoardVC
// Create a CATransition instance
let transition = CATransition()
transition.duration = 0.3 // Set the duration of the animation
transition.type = CATransitionType.fade // Set the type of animation to fade
// Optionally, set other properties such as timing function, subtype, etc.
// transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
// transition.subtype = CATransitionSubtype.fromTop
// Get the navigation controller
guard let navigationController = navigationController else { return }
// Perform the push animation with the custom transition
navigationController.view.layer.add(transition, forKey: nil)
navigationController.pushViewController(vc, animated: false)
}
func animateImageScale() {
UIView.animate(withDuration: 3.0, delay: 0, options: [], animations: {
self.wokaLogo.transform = CGAffineTransform(scaleX: 1.8, y: 1.8)
}, completion: nil)
let newConstant = wokaOriginY.constant - 50
Timer.scheduledTimer(withTimeInterval: 6, repeats: false) { _ in
UIView.animate(withDuration: 0.5, animations: {
// Update the constant value of the top constraint
self.wokaOriginY.constant = newConstant
// Inform the layout system to update
self.view.layoutIfNeeded()
}) { _ in
UIView.animate(withDuration: 0.3, delay: 0,options : [.transitionCrossDissolve],animations: {
// Set the isHidden property of the view
self.languageBtnStack.isHidden = false
}) {_ in
// Inform the stack view to update its layout
self.languageBtnStack.layoutIfNeeded()
}
}
}
}
override func viewDidLayoutSubviews() {
vm.initView()
}
}