diff --git a/VITTY/ContentView.swift b/VITTY/ContentView.swift index fa053f8..61a05e3 100644 --- a/VITTY/ContentView.swift +++ b/VITTY/ContentView.swift @@ -12,7 +12,7 @@ struct ContentView: View { @State private var communityPageViewModel = CommunityPageViewModel() @State private var suggestedFriendsViewModel = SuggestedFriendsViewModel() @State private var friendRequestViewModel = FriendRequestViewModel() - @StateObject var authState: AuthViewModel = AuthViewModel() + @State var authState: AuthViewModel = AuthViewModel() @StateObject var timeTableVM: TimetableViewModel = TimetableViewModel() // @StateObject var localNotificationsManager = NotificationsManager() // @StateObject var notifVM = NotificationsViewModel() @@ -47,7 +47,7 @@ struct ContentView: View { // ) { _ in // NotificationsManager.shared.getNotificationSettings() // } - .environmentObject(authState) + .environment(authState) .environmentObject(timeTableVM) // .environmentObject(notifVM) .environment(communityPageViewModel) diff --git a/VITTY/VITTY.xcodeproj/project.pbxproj b/VITTY/VITTY.xcodeproj/project.pbxproj index d12a902..3d766dc 100644 --- a/VITTY/VITTY.xcodeproj/project.pbxproj +++ b/VITTY/VITTY.xcodeproj/project.pbxproj @@ -125,9 +125,9 @@ 5251A7FC2B46E3A800D44CFE /* SwiftFormatConfiguration in Frameworks */ = {isa = PBXBuildFile; productRef = 5251A7FB2B46E3A800D44CFE /* SwiftFormatConfiguration */; }; 5251A7FE2B46E3A800D44CFE /* swift-format in Frameworks */ = {isa = PBXBuildFile; productRef = 5251A7FD2B46E3A800D44CFE /* swift-format */; }; 525AA7A92B4B0164003C6A12 /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525AA7A82B4B0164003C6A12 /* SearchView.swift */; }; + 525FFEF62B6F906C001CAAD3 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 525FFEF52B6F906C001CAAD3 /* GoogleService-Info.plist */; }; + 525FFEF82B6F9072001CAAD3 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 525FFEF72B6F9072001CAAD3 /* GoogleService-Info.plist */; }; 52A955832B497C7A00CA6EC5 /* FriendTimeTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52A955822B497C7A00CA6EC5 /* FriendTimeTableView.swift */; }; - 52CC87052B677B110030B7E9 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52CC87042B677B110030B7E9 /* GoogleService-Info.plist */; }; - 52CC87072B677B160030B7E9 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52CC87062B677B160030B7E9 /* GoogleService-Info.plist */; }; 52DBBE882B47B6B30014C57A /* FriendCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52DBBE872B47B6B30014C57A /* FriendCard.swift */; }; 5D141B052A2658CD005977F8 /* textField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D141B042A2658CD005977F8 /* textField.swift */; }; 5D141B0A2A265B15005977F8 /* Profile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D141B092A265B15005977F8 /* Profile.swift */; }; @@ -281,9 +281,9 @@ 524B843B2B46F6FD006D18BD /* AddFriendsHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddFriendsHeader.swift; sourceTree = ""; }; 5251A7FF2B46E3C000D44CFE /* .swift-format */ = {isa = PBXFileReference; lastKnownFileType = text; path = ".swift-format"; sourceTree = ""; }; 525AA7A82B4B0164003C6A12 /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = ""; }; + 525FFEF52B6F906C001CAAD3 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; + 525FFEF72B6F9072001CAAD3 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; 52A955822B497C7A00CA6EC5 /* FriendTimeTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendTimeTableView.swift; sourceTree = ""; }; - 52CC87042B677B110030B7E9 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; - 52CC87062B677B160030B7E9 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; 52DBBE872B47B6B30014C57A /* FriendCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendCard.swift; sourceTree = ""; }; 5D141B042A2658CD005977F8 /* textField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = textField.swift; sourceTree = ""; }; 5D141B092A265B15005977F8 /* Profile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Profile.swift; sourceTree = ""; }; @@ -490,9 +490,24 @@ 314A408D27383BEC0058082F /* VITTY */ = { isa = PBXGroup; children = ( + 314A40A527383C3F0058082F /* Model */, + 5D3D92502A1816CC0013803E /* Username */, + 314A40A327383C280058082F /* ViewModel */, + 5D141B062A265AF0005977F8 /* Profile */, + 5D44FFF72A2A69C70005A1E4 /* SetStatus */, + 5D1FF25D2A32637D00B0620A /* Schedule */, + 5D1FF25F2A3263CA00B0620A /* SplashScreen */, + 5D1FF2612A3263FE00B0620A /* NotificationView */, + 5D1FF2632A32643400B0620A /* Settings */, + 5D141B032A2658BE005977F8 /* Components */, + 5D1FF2662A32653400B0620A /* Instructions */, + 5D629B392A3FA5FB000B8E7A /* FriendActivity */, + 5DE8C00C2A8FC7B100AE3995 /* FriendCircle */, + 5DB03A312A85553800DB7E60 /* SideMenu */, + 524B842C2B46EBA6006D18BD /* Home */, + 524B84302B46EF07006D18BD /* Circle */, + 52DC41DF2B6F8B1500CCF8DB /* Firebase */, 52CC87082B677FCC0030B7E9 /* Auth */, - 52CC87012B677AFA0030B7E9 /* Firebase */, - 5D3D924F2A1816980013803E /* Core */, 3109637F278227580009A29C /* Services */, 31128CF02772F0210084C9EA /* Info.plist */, 314A40A127383C0A0058082F /* Utilities */, @@ -528,13 +543,6 @@ path = ViewModel; sourceTree = ""; }; - 314A40A427383C370058082F /* View */ = { - isa = PBXGroup; - children = ( - ); - path = View; - sourceTree = ""; - }; 314A40A527383C3F0058082F /* Model */ = { isa = PBXGroup; children = ( @@ -800,39 +808,39 @@ path = Views; sourceTree = ""; }; - 52CC87012B677AFA0030B7E9 /* Firebase */ = { + 52CC87082B677FCC0030B7E9 /* Auth */ = { isa = PBXGroup; children = ( - 52CC87032B677B060030B7E9 /* Prod */, - 52CC87022B677B020030B7E9 /* Dev */, + 3168511E277319480046A9AC /* SignupOR.swift */, + 5D72EDD92AB9906200704BF5 /* Auth */, + 31096380278227730009A29C /* AuthService.swift */, ); - path = Firebase; + path = Auth; sourceTree = ""; }; - 52CC87022B677B020030B7E9 /* Dev */ = { + 52DC41DF2B6F8B1500CCF8DB /* Firebase */ = { isa = PBXGroup; children = ( - 52CC87062B677B160030B7E9 /* GoogleService-Info.plist */, + 52DC41E12B6F8B2100CCF8DB /* Prod */, + 52DC41E02B6F8B1E00CCF8DB /* Dev */, ); - path = Dev; + path = Firebase; sourceTree = ""; }; - 52CC87032B677B060030B7E9 /* Prod */ = { + 52DC41E02B6F8B1E00CCF8DB /* Dev */ = { isa = PBXGroup; children = ( - 52CC87042B677B110030B7E9 /* GoogleService-Info.plist */, + 525FFEF72B6F9072001CAAD3 /* GoogleService-Info.plist */, ); - path = Prod; + path = Dev; sourceTree = ""; }; - 52CC87082B677FCC0030B7E9 /* Auth */ = { + 52DC41E12B6F8B2100CCF8DB /* Prod */ = { isa = PBXGroup; children = ( - 3168511E277319480046A9AC /* SignupOR.swift */, - 5D72EDD92AB9906200704BF5 /* Auth */, - 31096380278227730009A29C /* AuthService.swift */, + 525FFEF52B6F906C001CAAD3 /* GoogleService-Info.plist */, ); - path = Auth; + path = Prod; sourceTree = ""; }; 5D141B032A2658BE005977F8 /* Components */ = { @@ -965,30 +973,6 @@ path = View; sourceTree = ""; }; - 5D3D924F2A1816980013803E /* Core */ = { - isa = PBXGroup; - children = ( - 524B84302B46EF07006D18BD /* Circle */, - 524B842C2B46EBA6006D18BD /* Home */, - 5DB03A312A85553800DB7E60 /* SideMenu */, - 5DE8C00C2A8FC7B100AE3995 /* FriendCircle */, - 5D629B392A3FA5FB000B8E7A /* FriendActivity */, - 5D1FF2662A32653400B0620A /* Instructions */, - 5D141B032A2658BE005977F8 /* Components */, - 5D1FF2632A32643400B0620A /* Settings */, - 5D1FF2612A3263FE00B0620A /* NotificationView */, - 5D1FF25F2A3263CA00B0620A /* SplashScreen */, - 5D1FF25D2A32637D00B0620A /* Schedule */, - 5D44FFF72A2A69C70005A1E4 /* SetStatus */, - 5D141B062A265AF0005977F8 /* Profile */, - 5D3D92502A1816CC0013803E /* Username */, - 314A40A527383C3F0058082F /* Model */, - 314A40A427383C370058082F /* View */, - 314A40A327383C280058082F /* ViewModel */, - ); - path = Core; - sourceTree = ""; - }; 5D3D92502A1816CC0013803E /* Username */ = { isa = PBXGroup; children = ( @@ -1325,8 +1309,8 @@ 31128CF92772F57E0084C9EA /* Poppins-Medium.ttf in Resources */, 31128CFA2772F57E0084C9EA /* Poppins-SemiBoldItalic.ttf in Resources */, 31128CFC2772F57E0084C9EA /* Poppins-Regular.ttf in Resources */, - 52CC87052B677B110030B7E9 /* GoogleService-Info.plist in Resources */, - 52CC87072B677B160030B7E9 /* GoogleService-Info.plist in Resources */, + 525FFEF62B6F906C001CAAD3 /* GoogleService-Info.plist in Resources */, + 525FFEF82B6F9072001CAAD3 /* GoogleService-Info.plist in Resources */, 314A409627383BEE0058082F /* Preview Assets.xcassets in Resources */, 314A409327383BEE0058082F /* Assets.xcassets in Resources */, ); diff --git a/VITTY/VITTY/Auth/AuthService.swift b/VITTY/VITTY/Auth/AuthService.swift index fb75c19..0ed339f 100644 --- a/VITTY/VITTY/Auth/AuthService.swift +++ b/VITTY/VITTY/Auth/AuthService.swift @@ -18,15 +18,16 @@ enum LoginOption { case appleSignin } -class AuthViewModel: NSObject, ObservableObject { - @Published var loggedInUser: User? - @Published var isAuthenticating: Bool = false - @Published var error: NSError? - @Published var onboardingComplete: Bool = false +@Observable +class AuthViewModel: NSObject { + var loggedInUser: User? + var isAuthenticating: Bool = false + var error: NSError? + var onboardingComplete: Bool = false - @Published var isNewUser: Bool = false + var isNewUser: Bool = false - @Published var myUser: AuthResponse = AuthResponse( + var myUser: AuthResponse = AuthResponse( name: "", picture: "", role: "", @@ -37,10 +38,10 @@ class AuthViewModel: NSObject, ObservableObject { let auth = Auth.auth() fileprivate var currentNonce: String? - @Published var token: String = "" - @Published var username: String = "" - @Published var name: String = "" - @Published var image: String = "" + var token: String = "" + var username: String = "" + var name: String = "" + var image: String = "" // MARK: UserDefault keys diff --git a/VITTY/VITTY/Core/Circle/AddFriends/View/AddFriendsView.swift b/VITTY/VITTY/Circle/AddFriends/View/AddFriendsView.swift similarity index 97% rename from VITTY/VITTY/Core/Circle/AddFriends/View/AddFriendsView.swift rename to VITTY/VITTY/Circle/AddFriends/View/AddFriendsView.swift index 77f8923..8080e36 100644 --- a/VITTY/VITTY/Core/Circle/AddFriends/View/AddFriendsView.swift +++ b/VITTY/VITTY/Circle/AddFriends/View/AddFriendsView.swift @@ -9,7 +9,7 @@ import SwiftUI struct AddFriendsView: View { - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(SuggestedFriendsViewModel.self) private var suggestedFriendsViewModel @Environment(FriendRequestViewModel.self) private var friendRequestViewModel diff --git a/VITTY/VITTY/Core/Circle/AddFriends/View/Components/AddFriendsHeader.swift b/VITTY/VITTY/Circle/AddFriends/View/Components/AddFriendsHeader.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/AddFriends/View/Components/AddFriendsHeader.swift rename to VITTY/VITTY/Circle/AddFriends/View/Components/AddFriendsHeader.swift diff --git a/VITTY/VITTY/Core/Circle/FriendRequest/Model/FriendRequestRaw.swift b/VITTY/VITTY/Circle/FriendRequest/Model/FriendRequestRaw.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/FriendRequest/Model/FriendRequestRaw.swift rename to VITTY/VITTY/Circle/FriendRequest/Model/FriendRequestRaw.swift diff --git a/VITTY/VITTY/Core/Circle/FriendRequest/ViewModel/FriendRequestViewModel.swift b/VITTY/VITTY/Circle/FriendRequest/ViewModel/FriendRequestViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/FriendRequest/ViewModel/FriendRequestViewModel.swift rename to VITTY/VITTY/Circle/FriendRequest/ViewModel/FriendRequestViewModel.swift diff --git a/VITTY/VITTY/Core/Circle/FriendRequest/Views/Components/FriendReqCard.swift b/VITTY/VITTY/Circle/FriendRequest/Views/Components/FriendReqCard.swift similarity index 98% rename from VITTY/VITTY/Core/Circle/FriendRequest/Views/Components/FriendReqCard.swift rename to VITTY/VITTY/Circle/FriendRequest/Views/Components/FriendReqCard.swift index 26fbed6..cf1a60e 100644 --- a/VITTY/VITTY/Core/Circle/FriendRequest/Views/Components/FriendReqCard.swift +++ b/VITTY/VITTY/Circle/FriendRequest/Views/Components/FriendReqCard.swift @@ -8,7 +8,7 @@ import SwiftUI struct FriendReqCard: View { - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(FriendRequestViewModel.self) private var friendRequestViewModel let friend: Friend diff --git a/VITTY/VITTY/Core/Circle/FriendRequest/Views/FriendRequestView.swift b/VITTY/VITTY/Circle/FriendRequest/Views/FriendRequestView.swift similarity index 94% rename from VITTY/VITTY/Core/Circle/FriendRequest/Views/FriendRequestView.swift rename to VITTY/VITTY/Circle/FriendRequest/Views/FriendRequestView.swift index 0e37fd7..61ad8bd 100644 --- a/VITTY/VITTY/Core/Circle/FriendRequest/Views/FriendRequestView.swift +++ b/VITTY/VITTY/Circle/FriendRequest/Views/FriendRequestView.swift @@ -9,7 +9,7 @@ import SwiftUI struct FriendRequestView: View { - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(FriendRequestViewModel.self) private var friendRequestViewModel var body: some View { diff --git a/VITTY/VITTY/Core/Circle/FriendTimetable/View/FriendTimetableView.swift b/VITTY/VITTY/Circle/FriendTimetable/View/FriendTimetableView.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/FriendTimetable/View/FriendTimetableView.swift rename to VITTY/VITTY/Circle/FriendTimetable/View/FriendTimetableView.swift diff --git a/VITTY/VITTY/Core/Circle/Models/Friend.swift b/VITTY/VITTY/Circle/Models/Friend.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/Models/Friend.swift rename to VITTY/VITTY/Circle/Models/Friend.swift diff --git a/VITTY/VITTY/Core/Circle/Search/Views/SearchView.swift b/VITTY/VITTY/Circle/Search/Views/SearchView.swift similarity index 97% rename from VITTY/VITTY/Core/Circle/Search/Views/SearchView.swift rename to VITTY/VITTY/Circle/Search/Views/SearchView.swift index 7fa8290..af09c0e 100644 --- a/VITTY/VITTY/Core/Circle/Search/Views/SearchView.swift +++ b/VITTY/VITTY/Circle/Search/Views/SearchView.swift @@ -11,7 +11,7 @@ struct SearchView: View { @State private var searchText = "" @State private var searchedFriends = [Friend]() @State private var loading = false - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(\.dismiss) var dismiss var body: some View { Group { diff --git a/VITTY/VITTY/Core/Circle/SuggestedFriends/ViewModel/SuggestedFriendsViewModel.swift b/VITTY/VITTY/Circle/SuggestedFriends/ViewModel/SuggestedFriendsViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/SuggestedFriends/ViewModel/SuggestedFriendsViewModel.swift rename to VITTY/VITTY/Circle/SuggestedFriends/ViewModel/SuggestedFriendsViewModel.swift diff --git a/VITTY/VITTY/Core/Circle/SuggestedFriends/Views/Components/AddFriendCard.swift b/VITTY/VITTY/Circle/SuggestedFriends/Views/Components/AddFriendCard.swift similarity index 97% rename from VITTY/VITTY/Core/Circle/SuggestedFriends/Views/Components/AddFriendCard.swift rename to VITTY/VITTY/Circle/SuggestedFriends/Views/Components/AddFriendCard.swift index 29ceac9..4a5c55f 100644 --- a/VITTY/VITTY/Core/Circle/SuggestedFriends/Views/Components/AddFriendCard.swift +++ b/VITTY/VITTY/Circle/SuggestedFriends/Views/Components/AddFriendCard.swift @@ -9,7 +9,7 @@ import SwiftUI struct AddFriendCard: View { - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(SuggestedFriendsViewModel.self) private var suggestedFriendsViewModel let friend: Friend diff --git a/VITTY/VITTY/Core/Circle/SuggestedFriends/Views/SuggestedFriendsView.swift b/VITTY/VITTY/Circle/SuggestedFriends/Views/SuggestedFriendsView.swift similarity index 94% rename from VITTY/VITTY/Core/Circle/SuggestedFriends/Views/SuggestedFriendsView.swift rename to VITTY/VITTY/Circle/SuggestedFriends/Views/SuggestedFriendsView.swift index 850b8f5..619e03f 100644 --- a/VITTY/VITTY/Core/Circle/SuggestedFriends/Views/SuggestedFriendsView.swift +++ b/VITTY/VITTY/Circle/SuggestedFriends/Views/SuggestedFriendsView.swift @@ -9,7 +9,7 @@ import SwiftUI struct SuggestedFriendsView: View { - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(SuggestedFriendsViewModel.self) private var suggestedFriendsViewModel var body: some View { diff --git a/VITTY/VITTY/Core/Circle/View/CommunityPage.swift b/VITTY/VITTY/Circle/View/CommunityPage.swift similarity index 97% rename from VITTY/VITTY/Core/Circle/View/CommunityPage.swift rename to VITTY/VITTY/Circle/View/CommunityPage.swift index c5d7267..badf78c 100644 --- a/VITTY/VITTY/Core/Circle/View/CommunityPage.swift +++ b/VITTY/VITTY/Circle/View/CommunityPage.swift @@ -9,7 +9,7 @@ import SwiftUI struct CommunityPage: View { - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @EnvironmentObject private var timeTableViewModel: TimetableViewModel @Environment(CommunityPageViewModel.self) private var communityPageViewModel @State private var friend: Friend? = nil diff --git a/VITTY/VITTY/Core/Circle/View/Components/CommunityPageHeader.swift b/VITTY/VITTY/Circle/View/Components/CommunityPageHeader.swift similarity index 96% rename from VITTY/VITTY/Core/Circle/View/Components/CommunityPageHeader.swift rename to VITTY/VITTY/Circle/View/Components/CommunityPageHeader.swift index 4413fe2..8fa8126 100644 --- a/VITTY/VITTY/Core/Circle/View/Components/CommunityPageHeader.swift +++ b/VITTY/VITTY/Circle/View/Components/CommunityPageHeader.swift @@ -9,7 +9,7 @@ import SwiftUI struct CommunityPageHeader: View { @State private var isAddFriendsViewPresented = false - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(FriendRequestViewModel.self) private var friendRequestViewModel @Environment(CommunityPageViewModel.self) private var communityPageViewModel diff --git a/VITTY/VITTY/Core/Circle/View/Components/FriendCard.swift b/VITTY/VITTY/Circle/View/Components/FriendCard.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/View/Components/FriendCard.swift rename to VITTY/VITTY/Circle/View/Components/FriendCard.swift diff --git a/VITTY/VITTY/Core/Circle/View/Components/FriendTimeTableView.swift b/VITTY/VITTY/Circle/View/Components/FriendTimeTableView.swift similarity index 97% rename from VITTY/VITTY/Core/Circle/View/Components/FriendTimeTableView.swift rename to VITTY/VITTY/Circle/View/Components/FriendTimeTableView.swift index c7096d8..966ca70 100644 --- a/VITTY/VITTY/Core/Circle/View/Components/FriendTimeTableView.swift +++ b/VITTY/VITTY/Circle/View/Components/FriendTimeTableView.swift @@ -13,7 +13,7 @@ struct FriendTimeTableView: View { @Environment(\.dismiss) var dismiss @EnvironmentObject var timetableViewModel: TimetableViewModel - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(CommunityPageViewModel.self) private var communityPageViewModel @State var tabSelected: Int = Date.convertToMondayWeek() diff --git a/VITTY/VITTY/Core/Circle/ViewModel/CommunityPageViewModel.swift b/VITTY/VITTY/Circle/ViewModel/CommunityPageViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/Circle/ViewModel/CommunityPageViewModel.swift rename to VITTY/VITTY/Circle/ViewModel/CommunityPageViewModel.swift diff --git a/VITTY/VITTY/Core/Components/AsyncImage/UserImage.swift b/VITTY/VITTY/Components/AsyncImage/UserImage.swift similarity index 100% rename from VITTY/VITTY/Core/Components/AsyncImage/UserImage.swift rename to VITTY/VITTY/Components/AsyncImage/UserImage.swift diff --git a/VITTY/VITTY/Core/Components/Common/CustomButton.swift b/VITTY/VITTY/Components/Common/CustomButton.swift similarity index 100% rename from VITTY/VITTY/Core/Components/Common/CustomButton.swift rename to VITTY/VITTY/Components/Common/CustomButton.swift diff --git a/VITTY/VITTY/Core/Components/Common/CustomTextField.swift b/VITTY/VITTY/Components/Common/CustomTextField.swift similarity index 100% rename from VITTY/VITTY/Core/Components/Common/CustomTextField.swift rename to VITTY/VITTY/Components/Common/CustomTextField.swift diff --git a/VITTY/VITTY/Core/Components/Common/ExamHolidayMode.swift b/VITTY/VITTY/Components/Common/ExamHolidayMode.swift similarity index 100% rename from VITTY/VITTY/Core/Components/Common/ExamHolidayMode.swift rename to VITTY/VITTY/Components/Common/ExamHolidayMode.swift diff --git a/VITTY/VITTY/Core/Components/Common/LogoutPopup.swift b/VITTY/VITTY/Components/Common/LogoutPopup.swift similarity index 95% rename from VITTY/VITTY/Core/Components/Common/LogoutPopup.swift rename to VITTY/VITTY/Components/Common/LogoutPopup.swift index 6772d07..7e6d43b 100644 --- a/VITTY/VITTY/Core/Components/Common/LogoutPopup.swift +++ b/VITTY/VITTY/Components/Common/LogoutPopup.swift @@ -8,7 +8,7 @@ import SwiftUI struct LogoutPopup: View { - @EnvironmentObject var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Binding var showLogout: Bool var cornerRadius = 3.0 var fontSizeButton = 14.0 diff --git a/VITTY/VITTY/Core/Components/textField.swift b/VITTY/VITTY/Components/textField.swift similarity index 100% rename from VITTY/VITTY/Core/Components/textField.swift rename to VITTY/VITTY/Components/textField.swift diff --git a/VITTY/VITTY/Core/FriendActivity/View/Components/FriendRow.swift b/VITTY/VITTY/FriendActivity/View/Components/FriendRow.swift similarity index 100% rename from VITTY/VITTY/Core/FriendActivity/View/Components/FriendRow.swift rename to VITTY/VITTY/FriendActivity/View/Components/FriendRow.swift diff --git a/VITTY/VITTY/Core/FriendActivity/View/FriendActivity.swift b/VITTY/VITTY/FriendActivity/View/FriendActivity.swift similarity index 100% rename from VITTY/VITTY/Core/FriendActivity/View/FriendActivity.swift rename to VITTY/VITTY/FriendActivity/View/FriendActivity.swift diff --git a/VITTY/VITTY/Core/FriendActivity/ViewModel/FriendActivityViewModel.swift b/VITTY/VITTY/FriendActivity/ViewModel/FriendActivityViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/FriendActivity/ViewModel/FriendActivityViewModel.swift rename to VITTY/VITTY/FriendActivity/ViewModel/FriendActivityViewModel.swift diff --git a/VITTY/VITTY/Core/FriendCircle/View/Components/CustomTabBar.swift b/VITTY/VITTY/FriendCircle/View/Components/CustomTabBar.swift similarity index 100% rename from VITTY/VITTY/Core/FriendCircle/View/Components/CustomTabBar.swift rename to VITTY/VITTY/FriendCircle/View/Components/CustomTabBar.swift diff --git a/VITTY/VITTY/Core/FriendCircle/View/Components/UserDetailsRow.swift b/VITTY/VITTY/FriendCircle/View/Components/UserDetailsRow.swift similarity index 100% rename from VITTY/VITTY/Core/FriendCircle/View/Components/UserDetailsRow.swift rename to VITTY/VITTY/FriendCircle/View/Components/UserDetailsRow.swift diff --git a/VITTY/VITTY/Core/FriendCircle/View/FriendCircle.swift b/VITTY/VITTY/FriendCircle/View/FriendCircle.swift similarity index 97% rename from VITTY/VITTY/Core/FriendCircle/View/FriendCircle.swift rename to VITTY/VITTY/FriendCircle/View/FriendCircle.swift index d9dcc35..141d967 100644 --- a/VITTY/VITTY/Core/FriendCircle/View/FriendCircle.swift +++ b/VITTY/VITTY/FriendCircle/View/FriendCircle.swift @@ -8,7 +8,7 @@ import SwiftUI struct FriendCircle: View { - @EnvironmentObject var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(\.presentationMode) var presentationMode @State var text: String = "" @@ -54,7 +54,7 @@ struct FriendCircle: View { SuggestionsView() .tag(Tabs.suggestions) RequestsView() - .environmentObject(authState) + .environment(authState) .environmentObject(vm) .tag(Tabs.requests) FriendsView() diff --git a/VITTY/VITTY/Core/FriendCircle/View/FriendsView.swift b/VITTY/VITTY/FriendCircle/View/FriendsView.swift similarity index 100% rename from VITTY/VITTY/Core/FriendCircle/View/FriendsView.swift rename to VITTY/VITTY/FriendCircle/View/FriendsView.swift diff --git a/VITTY/VITTY/Core/FriendCircle/View/RequestsView.swift b/VITTY/VITTY/FriendCircle/View/RequestsView.swift similarity index 94% rename from VITTY/VITTY/Core/FriendCircle/View/RequestsView.swift rename to VITTY/VITTY/FriendCircle/View/RequestsView.swift index 417ac2b..c7e8819 100644 --- a/VITTY/VITTY/Core/FriendCircle/View/RequestsView.swift +++ b/VITTY/VITTY/FriendCircle/View/RequestsView.swift @@ -8,7 +8,7 @@ import SwiftUI struct RequestsView: View { - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @EnvironmentObject private var vm: FriendCircleViewModel var body: some View { diff --git a/VITTY/VITTY/Core/FriendCircle/View/SuggestionsView.swift b/VITTY/VITTY/FriendCircle/View/SuggestionsView.swift similarity index 100% rename from VITTY/VITTY/Core/FriendCircle/View/SuggestionsView.swift rename to VITTY/VITTY/FriendCircle/View/SuggestionsView.swift diff --git a/VITTY/VITTY/Core/FriendCircle/ViewModel/FriendCircleViewModel.swift b/VITTY/VITTY/FriendCircle/ViewModel/FriendCircleViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/FriendCircle/ViewModel/FriendCircleViewModel.swift rename to VITTY/VITTY/FriendCircle/ViewModel/FriendCircleViewModel.swift diff --git a/VITTY/VITTY/Core/Home/View/HomeView.swift b/VITTY/VITTY/Home/View/HomeView.swift similarity index 100% rename from VITTY/VITTY/Core/Home/View/HomeView.swift rename to VITTY/VITTY/Home/View/HomeView.swift diff --git a/VITTY/VITTY/Core/Instructions/View/InstructionsCards.swift b/VITTY/VITTY/Instructions/View/InstructionsCards.swift similarity index 98% rename from VITTY/VITTY/Core/Instructions/View/InstructionsCards.swift rename to VITTY/VITTY/Instructions/View/InstructionsCards.swift index ca37234..caafd28 100644 --- a/VITTY/VITTY/Core/Instructions/View/InstructionsCards.swift +++ b/VITTY/VITTY/Instructions/View/InstructionsCards.swift @@ -8,7 +8,7 @@ import SwiftUI struct InstructionsCards: View { - @EnvironmentObject var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState var body: some View { VStack { ZStack(alignment: .leading) { diff --git a/VITTY/VITTY/Core/Instructions/View/InstructionsView.swift b/VITTY/VITTY/Instructions/View/InstructionsView.swift similarity index 90% rename from VITTY/VITTY/Core/Instructions/View/InstructionsView.swift rename to VITTY/VITTY/Instructions/View/InstructionsView.swift index cfd0368..ae2fde7 100644 --- a/VITTY/VITTY/Core/Instructions/View/InstructionsView.swift +++ b/VITTY/VITTY/Instructions/View/InstructionsView.swift @@ -8,7 +8,7 @@ import SwiftUI struct InstructionsView: View { - @EnvironmentObject var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @EnvironmentObject var ttVM: TimetableViewModel @State var goToHomeScreen = UserDefaults.standard.bool(forKey: "instructionsComplete") @@ -19,13 +19,20 @@ struct InstructionsView: View { // notifsSetup is true when notifications don't need to be setup and false when they do @AppStorage(AuthViewModel.notifsSetupKey) var notifsSetup = false + + var isNewUser: Binding { + return Binding ( + get: {authState.isNewUser}, + set: {authState.isNewUser = $0} + ) + } var body: some View { ZStack { if !hideInstructionsView { instructionsView() .fullScreenCover( - isPresented: $authState.isNewUser, + isPresented: isNewUser, content: { UserName() } @@ -34,7 +41,7 @@ struct InstructionsView: View { else { HomeView() .navigationTitle("").navigationBarHidden(true).environmentObject(ttVM) - .environmentObject(authState) + .environment(authState) // .environmentObject(notifVM) } @@ -57,7 +64,7 @@ struct InstructionsView: View { struct InstructionsView_Previews: PreviewProvider { static var previews: some View { InstructionsView() - .environmentObject(AuthViewModel()) + .environment(AuthViewModel()) .environmentObject(TimetableViewModel()) // .environmentObject(NotificationsViewModel()) } @@ -76,14 +83,14 @@ extension InstructionsView { NavigationLink { HomeView() .navigationTitle("").navigationBarHidden(true).environmentObject(ttVM) - .environmentObject(authState) + .environment(authState) } label: { doneButton() } NavigationLink( destination: HomeView().navigationTitle("").navigationBarHidden(true) - .environmentObject(ttVM).environmentObject(authState), + .environmentObject(ttVM).environment(authState), // .environmentObject(notifVM), isActive: $goToHomeScreen ) { diff --git a/VITTY/VITTY/Core/Model/Classes.swift b/VITTY/VITTY/Model/Classes.swift similarity index 100% rename from VITTY/VITTY/Core/Model/Classes.swift rename to VITTY/VITTY/Model/Classes.swift diff --git a/VITTY/VITTY/Core/Model/NotificationsSettingsModel.swift b/VITTY/VITTY/Model/NotificationsSettingsModel.swift similarity index 100% rename from VITTY/VITTY/Core/Model/NotificationsSettingsModel.swift rename to VITTY/VITTY/Model/NotificationsSettingsModel.swift diff --git a/VITTY/VITTY/Core/Model/TimeTableInformation.swift b/VITTY/VITTY/Model/TimeTableInformation.swift similarity index 100% rename from VITTY/VITTY/Core/Model/TimeTableInformation.swift rename to VITTY/VITTY/Model/TimeTableInformation.swift diff --git a/VITTY/VITTY/Core/Model/timetable/Timetable.swift b/VITTY/VITTY/Model/timetable/Timetable.swift similarity index 100% rename from VITTY/VITTY/Core/Model/timetable/Timetable.swift rename to VITTY/VITTY/Model/timetable/Timetable.swift diff --git a/VITTY/VITTY/Core/Model/user/Friend/FriendReqResponse.swift b/VITTY/VITTY/Model/user/Friend/FriendReqResponse.swift similarity index 100% rename from VITTY/VITTY/Core/Model/user/Friend/FriendReqResponse.swift rename to VITTY/VITTY/Model/user/Friend/FriendReqResponse.swift diff --git a/VITTY/VITTY/Core/Model/user/Friend/FriendResponse.swift b/VITTY/VITTY/Model/user/Friend/FriendResponse.swift similarity index 100% rename from VITTY/VITTY/Core/Model/user/Friend/FriendResponse.swift rename to VITTY/VITTY/Model/user/Friend/FriendResponse.swift diff --git a/VITTY/VITTY/Core/Model/user/Friend/GetFriendReqResponse.swift b/VITTY/VITTY/Model/user/Friend/GetFriendReqResponse.swift similarity index 100% rename from VITTY/VITTY/Core/Model/user/Friend/GetFriendReqResponse.swift rename to VITTY/VITTY/Model/user/Friend/GetFriendReqResponse.swift diff --git a/VITTY/VITTY/Core/Model/user/UserResponse.swift b/VITTY/VITTY/Model/user/UserResponse.swift similarity index 100% rename from VITTY/VITTY/Core/Model/user/UserResponse.swift rename to VITTY/VITTY/Model/user/UserResponse.swift diff --git a/VITTY/VITTY/Core/NotificationView/View/Components/CustomNotificationButton.swift b/VITTY/VITTY/NotificationView/View/Components/CustomNotificationButton.swift similarity index 100% rename from VITTY/VITTY/Core/NotificationView/View/Components/CustomNotificationButton.swift rename to VITTY/VITTY/NotificationView/View/Components/CustomNotificationButton.swift diff --git a/VITTY/VITTY/Core/NotificationView/View/Components/CustomNotificationsLabel.swift b/VITTY/VITTY/NotificationView/View/Components/CustomNotificationsLabel.swift similarity index 100% rename from VITTY/VITTY/Core/NotificationView/View/Components/CustomNotificationsLabel.swift rename to VITTY/VITTY/NotificationView/View/Components/CustomNotificationsLabel.swift diff --git a/VITTY/VITTY/Core/NotificationView/View/Components/CustomNotifsListView.swift b/VITTY/VITTY/NotificationView/View/Components/CustomNotifsListView.swift similarity index 100% rename from VITTY/VITTY/Core/NotificationView/View/Components/CustomNotifsListView.swift rename to VITTY/VITTY/NotificationView/View/Components/CustomNotifsListView.swift diff --git a/VITTY/VITTY/Core/NotificationView/View/Components/NotificationsViewHeader.swift b/VITTY/VITTY/NotificationView/View/Components/NotificationsViewHeader.swift similarity index 93% rename from VITTY/VITTY/Core/NotificationView/View/Components/NotificationsViewHeader.swift rename to VITTY/VITTY/NotificationView/View/Components/NotificationsViewHeader.swift index c3ded38..79c3e04 100644 --- a/VITTY/VITTY/Core/NotificationView/View/Components/NotificationsViewHeader.swift +++ b/VITTY/VITTY/NotificationView/View/Components/NotificationsViewHeader.swift @@ -9,7 +9,6 @@ import SwiftUI struct NotificationsViewHeader: View { @EnvironmentObject var ttVM: TimetableViewModel - @EnvironmentObject var authVM: AuthViewModel var buttonAction: () -> Void var body: some View { HStack { diff --git a/VITTY/VITTY/Core/NotificationView/View/NotificationsView.swift b/VITTY/VITTY/NotificationView/View/NotificationsView.swift similarity index 96% rename from VITTY/VITTY/Core/NotificationView/View/NotificationsView.swift rename to VITTY/VITTY/NotificationView/View/NotificationsView.swift index 879785e..d304c4e 100644 --- a/VITTY/VITTY/Core/NotificationView/View/NotificationsView.swift +++ b/VITTY/VITTY/NotificationView/View/NotificationsView.swift @@ -10,7 +10,7 @@ import SwiftUI struct NotificationsView: View { - @EnvironmentObject var authVM: AuthViewModel + @Environment(AuthViewModel.self) private var authVM @EnvironmentObject var ttVM: TimetableViewModel @Binding var notifPrefs: [NotificationsSettingsModel] diff --git a/VITTY/VITTY/Core/NotificationView/ViewModel/NotificationsViewModel.swift b/VITTY/VITTY/NotificationView/ViewModel/NotificationsViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/NotificationView/ViewModel/NotificationsViewModel.swift rename to VITTY/VITTY/NotificationView/ViewModel/NotificationsViewModel.swift diff --git a/VITTY/VITTY/Core/Profile/View/Profile.swift b/VITTY/VITTY/Profile/View/Profile.swift similarity index 97% rename from VITTY/VITTY/Core/Profile/View/Profile.swift rename to VITTY/VITTY/Profile/View/Profile.swift index b66c92f..32f1958 100644 --- a/VITTY/VITTY/Core/Profile/View/Profile.swift +++ b/VITTY/VITTY/Profile/View/Profile.swift @@ -9,7 +9,7 @@ import SwiftUI struct Profile: View { @StateObject private var vm = ProfileViewModel() - @EnvironmentObject private var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState @Environment(\.presentationMode) var presentationMode var body: some View { diff --git a/VITTY/VITTY/Core/Profile/ViewModel/ProfileViewModel.swift b/VITTY/VITTY/Profile/ViewModel/ProfileViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/Profile/ViewModel/ProfileViewModel.swift rename to VITTY/VITTY/Profile/ViewModel/ProfileViewModel.swift diff --git a/VITTY/VITTY/Core/Schedule/View/Components/ClassCards.swift b/VITTY/VITTY/Schedule/View/Components/ClassCards.swift similarity index 100% rename from VITTY/VITTY/Core/Schedule/View/Components/ClassCards.swift rename to VITTY/VITTY/Schedule/View/Components/ClassCards.swift diff --git a/VITTY/VITTY/Core/Schedule/View/Components/SchedulePageHeader.swift b/VITTY/VITTY/Schedule/View/Components/SchedulePageHeader.swift similarity index 100% rename from VITTY/VITTY/Core/Schedule/View/Components/SchedulePageHeader.swift rename to VITTY/VITTY/Schedule/View/Components/SchedulePageHeader.swift diff --git a/VITTY/VITTY/Core/Schedule/View/Components/ScheduleTabBarView.swift b/VITTY/VITTY/Schedule/View/Components/ScheduleTabBarView.swift similarity index 100% rename from VITTY/VITTY/Core/Schedule/View/Components/ScheduleTabBarView.swift rename to VITTY/VITTY/Schedule/View/Components/ScheduleTabBarView.swift diff --git a/VITTY/VITTY/Core/Schedule/View/Components/TabBarDay.swift b/VITTY/VITTY/Schedule/View/Components/TabBarDay.swift similarity index 100% rename from VITTY/VITTY/Core/Schedule/View/Components/TabBarDay.swift rename to VITTY/VITTY/Schedule/View/Components/TabBarDay.swift diff --git a/VITTY/VITTY/Core/Schedule/View/Components/TimeTableScrollView.swift b/VITTY/VITTY/Schedule/View/Components/TimeTableScrollView.swift similarity index 100% rename from VITTY/VITTY/Core/Schedule/View/Components/TimeTableScrollView.swift rename to VITTY/VITTY/Schedule/View/Components/TimeTableScrollView.swift diff --git a/VITTY/VITTY/Core/Schedule/View/SchedulePage.swift b/VITTY/VITTY/Schedule/View/SchedulePage.swift similarity index 94% rename from VITTY/VITTY/Core/Schedule/View/SchedulePage.swift rename to VITTY/VITTY/Schedule/View/SchedulePage.swift index d9f1293..14b8fc4 100644 --- a/VITTY/VITTY/Core/Schedule/View/SchedulePage.swift +++ b/VITTY/VITTY/Schedule/View/SchedulePage.swift @@ -13,7 +13,7 @@ struct SchedulePage: View { @State var showLogout: Bool = false @EnvironmentObject var timetableViewModel: TimetableViewModel - @EnvironmentObject var authVM: AuthViewModel + @Environment(AuthViewModel.self) private var authVM // @EnvironmentObject var notifVM: NotificationsViewModel @StateObject var schedulePageVM = SchedulePageViewModel() @@ -34,7 +34,7 @@ struct SchedulePage: View { NavigationLink( destination: SettingsView().environmentObject(timetableViewModel) - .environmentObject(authVM), + .environment(authVM), // .environmentObject(notifVM), isActive: $goToSettings ) { @@ -49,7 +49,7 @@ struct SchedulePage: View { tabSelected = Date.convertToMondayWeek() } if showLogout { - LogoutPopup(showLogout: $showLogout).environmentObject(authVM) + LogoutPopup(showLogout: $showLogout).environment(authVM) } } @@ -100,7 +100,7 @@ struct SchedulePage: View { edge: .trailing, content: { MenuView() - .environmentObject(authVM) + .environment(authVM) .environmentObject(timetableViewModel) // .environmentObject(notifVM) } @@ -111,7 +111,7 @@ struct SchedulePage: View { struct HomePage_Previews: PreviewProvider { static var previews: some View { SchedulePage() - .environmentObject(AuthViewModel()) + .environment(AuthViewModel()) .environmentObject(TimetableViewModel()) // .environmentObject(NotificationsViewModel()) } diff --git a/VITTY/VITTY/Core/Schedule/ViewModel/SchedulePageViewModel.swift b/VITTY/VITTY/Schedule/ViewModel/SchedulePageViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/Schedule/ViewModel/SchedulePageViewModel.swift rename to VITTY/VITTY/Schedule/ViewModel/SchedulePageViewModel.swift diff --git a/VITTY/VITTY/Core/SetStatus/View/SetStatusView.swift b/VITTY/VITTY/SetStatus/View/SetStatusView.swift similarity index 100% rename from VITTY/VITTY/Core/SetStatus/View/SetStatusView.swift rename to VITTY/VITTY/SetStatus/View/SetStatusView.swift diff --git a/VITTY/VITTY/Core/SetStatus/View/StatusRowView.swift b/VITTY/VITTY/SetStatus/View/StatusRowView.swift similarity index 100% rename from VITTY/VITTY/Core/SetStatus/View/StatusRowView.swift rename to VITTY/VITTY/SetStatus/View/StatusRowView.swift diff --git a/VITTY/VITTY/Core/SetStatus/ViewModel/SetStatusViewModel.swift b/VITTY/VITTY/SetStatus/ViewModel/SetStatusViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/SetStatus/ViewModel/SetStatusViewModel.swift rename to VITTY/VITTY/SetStatus/ViewModel/SetStatusViewModel.swift diff --git a/VITTY/VITTY/Core/Settings/View/Components/SettingsHeader.swift b/VITTY/VITTY/Settings/View/Components/SettingsHeader.swift similarity index 93% rename from VITTY/VITTY/Core/Settings/View/Components/SettingsHeader.swift rename to VITTY/VITTY/Settings/View/Components/SettingsHeader.swift index fa72d3c..e4504c2 100644 --- a/VITTY/VITTY/Core/Settings/View/Components/SettingsHeader.swift +++ b/VITTY/VITTY/Settings/View/Components/SettingsHeader.swift @@ -9,7 +9,6 @@ import SwiftUI struct SettingsHeader: View { @EnvironmentObject var ttVM: TimetableViewModel - @EnvironmentObject var authVM: AuthViewModel var buttonAction: () -> Void var body: some View { HStack { diff --git a/VITTY/VITTY/Core/Settings/View/SettingsView.swift b/VITTY/VITTY/Settings/View/SettingsView.swift similarity index 97% rename from VITTY/VITTY/Core/Settings/View/SettingsView.swift rename to VITTY/VITTY/Settings/View/SettingsView.swift index 7cfa595..024386c 100644 --- a/VITTY/VITTY/Core/Settings/View/SettingsView.swift +++ b/VITTY/VITTY/Settings/View/SettingsView.swift @@ -13,7 +13,7 @@ struct SettingsView: View { var githubURL = URL(string: "https://github.com/GDGVIT/vitty-ios") var gdscURL = URL(string: "https://dscvit.com/") - @EnvironmentObject var authVM: AuthViewModel + @Environment(AuthViewModel.self) private var authState @EnvironmentObject var ttVM: TimetableViewModel // @EnvironmentObject var notifVM: NotificationsViewModel @@ -63,7 +63,7 @@ struct SettingsView: View { struct SettingsView_Previews: PreviewProvider { static var previews: some View { SettingsView() - .environmentObject(AuthViewModel()) + .environment(AuthViewModel()) .environmentObject(TimetableViewModel()) // .environmentObject(NotificationsViewModel()) } diff --git a/VITTY/VITTY/Core/SideMenu/View/MenuView.swift b/VITTY/VITTY/SideMenu/View/MenuView.swift similarity index 96% rename from VITTY/VITTY/Core/SideMenu/View/MenuView.swift rename to VITTY/VITTY/SideMenu/View/MenuView.swift index 5809411..47d7768 100644 --- a/VITTY/VITTY/Core/SideMenu/View/MenuView.swift +++ b/VITTY/VITTY/SideMenu/View/MenuView.swift @@ -8,7 +8,7 @@ import SwiftUI struct MenuView: View { - @EnvironmentObject var authVM: AuthViewModel + @Environment(AuthViewModel.self) private var authVM @EnvironmentObject var ttVM: TimetableViewModel // @EnvironmentObject var notifVM: NotificationsViewModel @@ -73,7 +73,7 @@ struct MenuView: View { struct MenuView_Previews: PreviewProvider { static var previews: some View { MenuView() - .environmentObject(AuthViewModel()) + .environment(AuthViewModel()) .environmentObject(TimetableViewModel()) // .environmentObject(NotificationsViewModel()) } @@ -151,7 +151,7 @@ extension MenuView { } .fullScreenCover(isPresented: $vm.showProfile) { Profile() - .environmentObject(authVM) + .environment(authVM) } } @@ -174,7 +174,7 @@ extension MenuView { } .fullScreenCover(isPresented: $vm.showFriendCircle) { FriendCircle() - .environmentObject(authVM) + .environment(authVM) } } @@ -221,7 +221,7 @@ extension MenuView { } .fullScreenCover(isPresented: $vm.showSettings) { SettingsView() - .environmentObject(authVM) + .environment(authVM) .environmentObject(ttVM) // .environmentObject(notifVM) } diff --git a/VITTY/VITTY/Core/SideMenu/View/SlideInView.swift b/VITTY/VITTY/SideMenu/View/SlideInView.swift similarity index 100% rename from VITTY/VITTY/Core/SideMenu/View/SlideInView.swift rename to VITTY/VITTY/SideMenu/View/SlideInView.swift diff --git a/VITTY/VITTY/Core/SideMenu/View/ToggleSwitch.swift b/VITTY/VITTY/SideMenu/View/ToggleSwitch.swift similarity index 100% rename from VITTY/VITTY/Core/SideMenu/View/ToggleSwitch.swift rename to VITTY/VITTY/SideMenu/View/ToggleSwitch.swift diff --git a/VITTY/VITTY/Core/SideMenu/ViewModel/MenuViewModel.swift b/VITTY/VITTY/SideMenu/ViewModel/MenuViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/SideMenu/ViewModel/MenuViewModel.swift rename to VITTY/VITTY/SideMenu/ViewModel/MenuViewModel.swift diff --git a/VITTY/VITTY/Core/SplashScreen/View/Components/SplashScreenIllustration.swift b/VITTY/VITTY/SplashScreen/View/Components/SplashScreenIllustration.swift similarity index 100% rename from VITTY/VITTY/Core/SplashScreen/View/Components/SplashScreenIllustration.swift rename to VITTY/VITTY/SplashScreen/View/Components/SplashScreenIllustration.swift diff --git a/VITTY/VITTY/Core/SplashScreen/View/Components/SplashScreenTabIndicator.swift b/VITTY/VITTY/SplashScreen/View/Components/SplashScreenTabIndicator.swift similarity index 100% rename from VITTY/VITTY/Core/SplashScreen/View/Components/SplashScreenTabIndicator.swift rename to VITTY/VITTY/SplashScreen/View/Components/SplashScreenTabIndicator.swift diff --git a/VITTY/VITTY/Core/SplashScreen/View/SplashScreen.swift b/VITTY/VITTY/SplashScreen/View/SplashScreen.swift similarity index 94% rename from VITTY/VITTY/Core/SplashScreen/View/SplashScreen.swift rename to VITTY/VITTY/SplashScreen/View/SplashScreen.swift index 170d257..3d4d686 100644 --- a/VITTY/VITTY/Core/SplashScreen/View/SplashScreen.swift +++ b/VITTY/VITTY/SplashScreen/View/SplashScreen.swift @@ -10,7 +10,7 @@ import SwiftUI struct SplashScreen: View { @State var selectedTab: Int = 0 @State var onboardingComplete: Bool = false - @EnvironmentObject var authState: AuthViewModel + @Environment(AuthViewModel.self) private var authState var body: some View { VStack { @@ -58,7 +58,7 @@ struct SplashScreen: View { struct SplashScreen_Previews: PreviewProvider { static var previews: some View { SplashScreen() - .environmentObject(AuthViewModel()) + .environment(AuthViewModel()) } } diff --git a/VITTY/VITTY/Core/Username/View/UserName.swift b/VITTY/VITTY/Username/View/UserName.swift similarity index 98% rename from VITTY/VITTY/Core/Username/View/UserName.swift rename to VITTY/VITTY/Username/View/UserName.swift index 840a35f..1383c93 100644 --- a/VITTY/VITTY/Core/Username/View/UserName.swift +++ b/VITTY/VITTY/Username/View/UserName.swift @@ -10,7 +10,7 @@ import SwiftUI struct UserName: View { @StateObject private var vm = UserNameViewModel() @Environment(\.presentationMode) var presentationMode - @EnvironmentObject var authVM: AuthViewModel + @Environment(AuthViewModel.self) private var authVM var body: some View { ZStack { diff --git a/VITTY/VITTY/Core/Username/ViewModel/UserNameViewModel.swift b/VITTY/VITTY/Username/ViewModel/UserNameViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/Username/ViewModel/UserNameViewModel.swift rename to VITTY/VITTY/Username/ViewModel/UserNameViewModel.swift diff --git a/VITTY/VITTY/Core/ViewModel/ClassCardViewModel.swift b/VITTY/VITTY/ViewModel/ClassCardViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/ViewModel/ClassCardViewModel.swift rename to VITTY/VITTY/ViewModel/ClassCardViewModel.swift diff --git a/VITTY/VITTY/Core/ViewModel/TimetableViewModel.swift b/VITTY/VITTY/ViewModel/TimetableViewModel.swift similarity index 100% rename from VITTY/VITTY/Core/ViewModel/TimetableViewModel.swift rename to VITTY/VITTY/ViewModel/TimetableViewModel.swift