- Finalised The side menu integration in the project.

This commit is contained in:
2024-05-21 19:36:15 +05:30
parent ce74f4dffd
commit 0ebb59eab8
55 changed files with 2887 additions and 190 deletions

View File

@@ -28,18 +28,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//Lottie Config to handle rendering
LottieConfiguration.shared.renderingEngine = .mainThread
//Configure and modify the side bar
configureSideBar()
return true
}
// func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// print("URL-> " ,url)
//// if let referralCode = getReferralCode(from: url) {
//// // Do something with the referral code
//// print("Referral code: \(referralCode)")
//// }
// return true
// }
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
@@ -54,27 +48,40 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
extension AppDelegate {
// MARK: - Toast Setup
private func setupToast(){
var style = ToastStyle()
style.displayShadow = true
style.messageColor = UIColor.white
style.backgroundColor = UIColor.appColor(.TextDarkBlue)!
style.messageFont = FontCustom.shareInstance.customFont(fontName: .Exo2_Medium, size: 16)
style.titleAlignment = .center
style.messageAlignment = .center
style.cornerRadius = 10
ToastManager.shared.style = style
// toggle "tap to dismiss" functionality
ToastManager.shared.isTapToDismissEnabled = true
// toggle queueing behavior
ToastManager.shared.isQueueEnabled = false
}
// MARK: - Configure Sidebar
private func setupToast(){
var style = ToastStyle()
style.displayShadow = true
style.messageColor = UIColor.white
style.backgroundColor = UIColor.appColor(.TextDarkBlue)!
style.messageFont = FontCustom.shareInstance.customFont(fontName: .Exo2_Medium, size: 16)
style.titleAlignment = .center
style.messageAlignment = .center
style.cornerRadius = 10
ToastManager.shared.style = style
// toggle "tap to dismiss" functionality
ToastManager.shared.isTapToDismissEnabled = true
// toggle queueing behavior
ToastManager.shared.isQueueEnabled = false
}
final private func configureSideBar(){
SideMenuController.preferences.basic.menuWidth = UIScreen.main.bounds.width - 114
SideMenuController.preferences.basic.direction = .right
SideMenuController.preferences.basic.enableRubberEffectWhenPanning = true
SideMenuController.preferences.basic.position = .above
SideMenuController.preferences.basic.enablePanGesture = true
SideMenuController.preferences.basic.enablePanGesture = true
SideMenuController.preferences.basic.defaultCacheKey = "default"
SideMenuController.preferences.animation.hideDuration = 0.6
SideMenuController.preferences.animation.revealDuration = 0.6
}
}

View File

@@ -9,14 +9,6 @@ import Foundation
import AVFoundation
import UIKit
/*
Language Enum
*/
enum LocalizedEnum : String , CaseIterable{
case hindi = "hi"
case english = "en"
}
class AuthFunc{
/**
@@ -35,8 +27,10 @@ class AuthFunc{
//This is temporary variable. Make it emtpy when the registration is finished.
var regData = UserRegPostModel()
// Singleton instance of AuthFunc
static let shareInstance = AuthFunc()
// Returns the device's UUID
func getDeviceUUID() -> String{
/*
UIDevice.current.name // e.g. "My iPhone"
@@ -48,6 +42,7 @@ class AuthFunc{
return UIDevice.current.identifierForVendor!.uuidString
}
// Sets authentication ID and password from the app's info dictionary
func setAuthIDPass(){
if let id = Bundle.main.infoDictionary?["API_KEY_ID"] as? String{
authID = id
@@ -57,32 +52,17 @@ class AuthFunc{
authPass = pass
}
}
func playStartUpsound(){
guard let path = Bundle.main.path(forResource: K.StaticFilesString.onBoardMainSound, ofType:"m4a") else {
return }
let url = URL(fileURLWithPath: path)
let playerItem = AVPlayerItem(url: url)
// Initialize AVQueuePlayer with the player item
player = AVQueuePlayer(items: [playerItem])
// Create AVPlayerLooper
playerLooper = AVPlayerLooper(player: player!, templateItem: playerItem)
player?.play()
}
func stopSound(){
player?.removeAllItems()
}
func pauseSound(){
player?.pause()
}
}
// MARK: - Language Enum
enum LocalizedEnum : String , CaseIterable{
case hindi = "hi"
case english = "en"
}
// MARK: - Enum representing different user types
enum UserType {
case adult
case kid

View File

@@ -0,0 +1,38 @@
//
// AuthFuncStartupSoundHandling.swift
// WOKA
//
// Created by MacBook Pro on 21/05/24.
//
import UIKit
import AVFoundation
extension AuthFunc{
// MARK: - Handle The Sound Globally
func playStartUpsound(){
guard let path = Bundle.main.path(forResource: K.StaticFilesString.onBoardMainSound, ofType:"m4a") else {
return }
let url = URL(fileURLWithPath: path)
let playerItem = AVPlayerItem(url: url)
// Initialize AVQueuePlayer with the player item
player = AVQueuePlayer(items: [playerItem])
// Create AVPlayerLooper
playerLooper = AVPlayerLooper(player: player!, templateItem: playerItem)
player?.play()
}
// Stops the sound
func stopSound() {
player?.removeAllItems()
}
// Pauses the sound
func pauseSound() {
player?.pause()
}
}