- Worked on autolayout and did fixes for screen iphone 6s and iphone 11pro max resolutions

- 12-1 woka meeting
- Did Rnd on Container view. This will help for theming
- Made a custom class to add the child view and remove child view.
- Added Moon if the theme color is night
- added the Ca animation for the stars to show glowing effect
- Mapped all the stars with the delay time
- Handled the theme switch
This commit is contained in:
Bilal
2024-05-24 19:26:54 +05:30
parent 33180a55ab
commit 025aa41585
92 changed files with 1251 additions and 458 deletions

View File

@@ -1,111 +0,0 @@
//
// HomeVM.swift
// WOKA
//
// Created by MacBook Pro on 23/05/24.
//
import UIKit
class HomeVM{
weak var vc : HomeVC!
func initView(){
AuthFunc.shareInstance.initTimePeriods()
startInitialTimer()
addTapGestureToMovingView()
}
// MARK: - LiveTV Tap Handling
private func addTapGestureToMovingView(){
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:)))
vc.liveTVView.addGestureRecognizer(tap)
vc.liveTVView.isUserInteractionEnabled = true
}
// function which is triggered when handleTap is called
@objc func handleTap(_ sender: UITapGestureRecognizer) {
print("tapped")
// let vc = self.storyboard?.instantiateViewController(identifier: "ViewController") as! ViewController
//
// DispatchQueue.main.async {
// do {
// // Create a JWMediaTrack with the thumbnails .vtt file
// // let thumbnailTrack = try JWThumbnailTrackBuilder()
// // .file(URL(string:"https://content.jwplatform.com/videos/Agy4RIje-Ysj2G4DQ.mp4")!)
// // .build()
//
// // Create a JWPlayerItem
// let item = try JWPlayerItemBuilder()
// .file(URL(string:self.videoStreamURL)!)
// .title("Testing Title")
// .posterImage(URL(string: "https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg")!)
// // .mediaTracks([thumbnailTrack])
// .build()
//
// // Create a config, and give it the item as a playlist.
// let config = try JWPlayerConfigurationBuilder()
// .playlist(items: [item])
// .autostart(true)
// .preload(.auto)
// .repeatContent(true)
// .build()
//
// vc.config = config
// }
// catch {
// // Handle Error
// }
// vc.dismissTapped = self.tapped
//
// vc.modalPresentationStyle = .overFullScreen
// self.present(vc, animated: false) {
// self.stopLiveStream()
// vc.transitionToFullScreen(animated: true) {
// print("FullScreen")
// }
//// vc.setDeviceOrientation(orientation: .landscapeRight)
// }
//// self.navigationController?.pushViewController(vc, animated: true)
// }
}
// MARK: - Handle Time Change
@objc func handleBackground(){
let currentTime = Date()
for period in AuthFunc.shareInstance.timePeriods {
if period.contains(currentTime: currentTime) {
let details = period.details
// Update view's background color with a gradient or single color
vc.gradientView.applyGradient(colors: [details.color1, details.color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 0.8))
vc.nameLabel.textColor = details.textColor
vc.welcomeLabel.textColor = details.textColor
vc.homeGrass.image = UIImage(named: details.grass)
break
}
}
}
func startInitialTimer() {
self.handleBackground()
let now = Date()
let nextMinute = Calendar.current.nextDate(after: now, matching: DateComponents(second: 0), matchingPolicy: .nextTime)!
let timeInterval = nextMinute.timeIntervalSince(now)
// Schedule the initial timer to fire at the start of the next minute
vc.timer = Timer.scheduledTimer(timeInterval: timeInterval, target: self, selector: #selector(startRepeatingTimer), userInfo: nil, repeats: false)
}
@objc func startRepeatingTimer() {
// Handle the minute change when the initial timer fires
self.handleBackground()
// Schedule the repeating timer to fire every minute
vc.timer = Timer.scheduledTimer(timeInterval: 60, target: self, selector: #selector(handleBackground), userInfo: nil, repeats: false)
}
}