-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSplashScreenVC.swift
58 lines (44 loc) · 1.98 KB
/
SplashScreenVC.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// ViewController.swift
// RM Client
//
// Created by Yazan Tarifi on 31/08/2023.
//
import UIKit
class SplashScreenVC: RmBaseVC {
override func onScreenStarted() {
super.onScreenStarted()
// Init Splash Design
view.backgroundColor = RmThemeUtils.shared.getApplicationPrimaryColor()
let configuration = UIImage.SymbolConfiguration(textStyle: .footnote, scale: .small)
let image = UIImage(systemName: "person.circle.fill", withConfiguration: configuration)
let imageView = UIImageView(image: image)
imageView.tintColor = .white
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(imageView)
// Add Logo Constraints
imageView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
imageView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true
imageView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -80).isActive = true
imageView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 80).isActive = true
// Start The Timer to Load Splash Screen Time
DispatchQueue.main.asyncAfter(deadline: .now() + 3, execute: {
self.onValidateApplicationNavigation()
})
}
private func onValidateApplicationNavigation() {
if RmLocalStorage.shared.isFirstTimeAppOpened() {
self.navigationController?.pushViewController(OnBoardingScreenVC.getInstance(), animated: true)
return
}
if RmLocalStorage.shared.isUserLoggedIn() {
onPushViewController(vc: HomeScreenVC.getInstance())
return
}
onPushViewController(vc: AuthScreenVC.getInstance())
}
override func getTitle() -> String {
return "Splash"
}
}