| 1 |
efrain |
1 |
//
|
|
|
2 |
// MainView.swift
|
|
|
3 |
// twogetskills
|
|
|
4 |
//
|
|
|
5 |
// Created by Efrain Yanez Recanatini on 2/17/22.
|
|
|
6 |
//
|
|
|
7 |
|
|
|
8 |
import SwiftUI
|
|
|
9 |
|
|
|
10 |
struct MainView: View {
|
|
|
11 |
@StateObject private var appNavigation = AppNavigation()
|
|
|
12 |
@StateObject private var networkMonitor = NetworkMonitor()
|
|
|
13 |
@State private var showToast : Bool = true
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
var body: some View {
|
|
|
17 |
ZStack {
|
|
|
18 |
Color("color_window_background").ignoresSafeArea(.all)
|
|
|
19 |
|
|
|
20 |
VStack(spacing: 0) {
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
if appNavigation.pageActive == AppMainPage.intro1 {
|
|
|
24 |
IntroStep1View()
|
|
|
25 |
.environmentObject(appNavigation)
|
|
|
26 |
.environmentObject(networkMonitor)
|
|
|
27 |
.transition(.scale)
|
|
|
28 |
|
|
|
29 |
} else if appNavigation.pageActive == AppMainPage.intro2 {
|
|
|
30 |
IntroStep2View()
|
|
|
31 |
.environmentObject(appNavigation)
|
|
|
32 |
.environmentObject(networkMonitor)
|
|
|
33 |
.transition(.scale)
|
|
|
34 |
|
|
|
35 |
} else if appNavigation.pageActive == AppMainPage.intro3 {
|
|
|
36 |
IntroStep3View()
|
|
|
37 |
.environmentObject(appNavigation)
|
|
|
38 |
.environmentObject(networkMonitor)
|
|
|
39 |
.transition(.scale)
|
|
|
40 |
|
|
|
41 |
} else if appNavigation.pageActive == AppMainPage.signin {
|
|
|
42 |
SigninView()
|
|
|
43 |
.environmentObject(appNavigation)
|
|
|
44 |
.environmentObject(networkMonitor)
|
|
|
45 |
.transition(.scale)
|
|
|
46 |
|
|
|
47 |
} else if appNavigation.pageActive == AppMainPage.splash {
|
|
|
48 |
SplashScreenView()
|
|
|
49 |
.environmentObject(appNavigation)
|
|
|
50 |
.environmentObject(networkMonitor)
|
|
|
51 |
} else {
|
|
|
52 |
HomeView()
|
|
|
53 |
.environmentObject(appNavigation)
|
|
|
54 |
.environmentObject(networkMonitor)
|
|
|
55 |
.transition(.scale)
|
|
|
56 |
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
//Spacer()
|
|
|
60 |
/*
|
|
|
61 |
if(self.networkMonitor.status == .disconnected) {
|
|
|
62 |
Text("The popup")
|
|
|
63 |
.frame(width: UIScreen.main.bounds.width, height: 60)
|
|
|
64 |
.background(Color("color_error_background"))
|
|
|
65 |
.foregroundColor(Color("color_error_foreground"))
|
|
|
66 |
.font(.callout)
|
|
|
67 |
}*/
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
/*}
|
|
|
75 |
.onAppear {
|
|
|
76 |
let snackbar = TTGSnackbar(message: "Two actions !", duration: .forever)
|
|
|
77 |
|
|
|
78 |
// Action 1
|
|
|
79 |
snackbar.actionText = "Yes"
|
|
|
80 |
snackbar.actionTextColor = UIColor.green
|
|
|
81 |
snackbar.actionBlock = { (snackbar) in print("Yes") }
|
|
|
82 |
|
|
|
83 |
// Action 2
|
|
|
84 |
snackbar.secondActionText = "No"
|
|
|
85 |
snackbar.secondActionTextColor = UIColor.yellow
|
|
|
86 |
snackbar.secondActionBlock = { (snackbar) in print("No") }
|
|
|
87 |
|
|
|
88 |
//{ ((snackbar) in NSLog("Click No !")).dismiss() }
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
snackbar.backgroundColor = colorErrorBackground
|
|
|
92 |
snackbar.show()
|
|
|
93 |
}
|
|
|
94 |
*/
|
|
|
95 |
/*
|
|
|
96 |
.popup(isPresented: self.$networkMonitor.isConnected, type: .toast, position: .bottom, dragToDismiss: false) {
|
|
|
97 |
|
|
|
98 |
Text("The popup")
|
|
|
99 |
.frame(width: UIScreen.main.bounds.width, height: 60)
|
|
|
100 |
.background(Color(colorErrorBackground ?? .red))
|
|
|
101 |
.foregroundColor(Color(colorErrorForeground ?? .black))
|
|
|
102 |
.font(.callout)
|
|
|
103 |
}*/
|
|
|
104 |
/*
|
|
|
105 |
.toast(isPresenting: $showToast){
|
|
|
106 |
|
|
|
107 |
// `.alert` is the default displayMode
|
|
|
108 |
//AlertToast(type: .regular, title: "Message Sent!")
|
|
|
109 |
|
|
|
110 |
//Choose .hud to toast alert from the top of the screen
|
|
|
111 |
//AlertToast(displayMode: .hud, type: .regular, title: "Message Sent!")
|
|
|
112 |
|
|
|
113 |
//Choose .banner to slide/pop alert from the bottom of the screen
|
|
|
114 |
//AlertToast(displayMode: .banner(.slide), type: .regular, title: "Message Sent!")
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
}*/
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
}
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
struct MainView_Previews: PreviewProvider {
|
|
|
128 |
static var previews: some View {
|
|
|
129 |
MainView()
|
|
|
130 |
}
|
|
|
131 |
}
|
|
|
132 |
|