diff --git a/Apps/LekaApp/Sources/Views/Categories/CategoryLibraryView.swift b/Apps/LekaApp/Sources/Views/Categories/CategoryLibraryView.swift index c2f7bca4e6..cfa731565f 100644 --- a/Apps/LekaApp/Sources/Views/Categories/CategoryLibraryView.swift +++ b/Apps/LekaApp/Sources/Views/Categories/CategoryLibraryView.swift @@ -14,13 +14,13 @@ struct CategoryLibraryView: View { if self.authManagerViewModel.userAuthenticationState == .loggedIn { switch self.category { case .libraryCurriculums: - LibraryCurriculumsView(viewModel: self.rootAccountViewModel) + LibraryCurriculumsView(viewModel: self.libraryManagerViewModel) .navigationTitle(String(l10n.MainView.Sidebar.CategoryLabel.libraryCurriculums.characters)) case .libraryStories: - LibraryStoriesView(viewModel: self.rootAccountViewModel) + LibraryStoriesView(viewModel: self.libraryManagerViewModel) .navigationTitle(String(l10n.MainView.Sidebar.CategoryLabel.libraryStories.characters)) default: - LibraryActivitiesView(viewModel: self.rootAccountViewModel) + LibraryActivitiesView(viewModel: self.libraryManagerViewModel) .navigationTitle(String(l10n.MainView.Sidebar.CategoryLabel.libraryActivities.characters)) } } else { @@ -29,7 +29,7 @@ struct CategoryLibraryView: View { } } - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @ObservedObject var authManagerViewModel = AuthManagerViewModel.shared } diff --git a/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+ActivitiesView.swift b/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+ActivitiesView.swift index 49792fb07f..623adfe5ad 100644 --- a/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+ActivitiesView.swift +++ b/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+ActivitiesView.swift @@ -12,7 +12,7 @@ import SwiftUI struct LibraryActivitiesView: View { // MARK: Lifecycle - init(viewModel: RootAccountManagerViewModel) { + init(viewModel: LibraryManagerViewModel) { self.viewModel = viewModel } @@ -38,7 +38,7 @@ struct LibraryActivitiesView: View { // MARK: Private @ObservedObject private var navigation: Navigation = .shared - @ObservedObject private var viewModel: RootAccountManagerViewModel + @ObservedObject private var viewModel: LibraryManagerViewModel @ObservedObject private var authManagerViewModel: AuthManagerViewModel = .shared private var activities: [Activity] { @@ -52,7 +52,7 @@ struct LibraryActivitiesView: View { } #Preview { - let viewModel = RootAccountManagerViewModel() + let viewModel = LibraryManagerViewModel() NavigationStack { LibraryActivitiesView(viewModel: viewModel) } diff --git a/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+CurriculumsView.swift b/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+CurriculumsView.swift index 25d439e64c..ae6a09ce76 100644 --- a/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+CurriculumsView.swift +++ b/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+CurriculumsView.swift @@ -10,7 +10,7 @@ import SwiftUI struct LibraryCurriculumsView: View { // MARK: Lifecycle - init(viewModel: RootAccountManagerViewModel) { + init(viewModel: LibraryManagerViewModel) { self.viewModel = viewModel } @@ -37,7 +37,7 @@ struct LibraryCurriculumsView: View { // MARK: Private @ObservedObject private var navigation: Navigation = .shared - @ObservedObject private var viewModel: RootAccountManagerViewModel + @ObservedObject private var viewModel: LibraryManagerViewModel @ObservedObject private var authManagerViewModel: AuthManagerViewModel = .shared private var curriculums: [Curriculum] { @@ -51,6 +51,6 @@ struct LibraryCurriculumsView: View { } #Preview { - let viewModel = RootAccountManagerViewModel() + let viewModel = LibraryManagerViewModel() LibraryCurriculumsView(viewModel: viewModel) } diff --git a/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+StoriesView.swift b/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+StoriesView.swift index be3580f7e6..971e1dfecd 100644 --- a/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+StoriesView.swift +++ b/Apps/LekaApp/Sources/Views/PersonalLibrary/Library+StoriesView.swift @@ -12,7 +12,7 @@ import SwiftUI struct LibraryStoriesView: View { // MARK: Lifecycle - init(viewModel: RootAccountManagerViewModel) { + init(viewModel: LibraryManagerViewModel) { self.viewModel = viewModel } @@ -38,7 +38,7 @@ struct LibraryStoriesView: View { // MARK: Private @ObservedObject private var navigation: Navigation = .shared - @ObservedObject private var viewModel: RootAccountManagerViewModel + @ObservedObject private var viewModel: LibraryManagerViewModel @ObservedObject private var authManagerViewModel: AuthManagerViewModel = .shared private var stories: [Story] { @@ -52,7 +52,7 @@ struct LibraryStoriesView: View { } #Preview { - let viewModel = RootAccountManagerViewModel() + let viewModel = LibraryManagerViewModel() NavigationStack { LibraryStoriesView(viewModel: viewModel) } diff --git a/Apps/LekaApp/Sources/Views/Settings/SettingsView.swift b/Apps/LekaApp/Sources/Views/Settings/SettingsView.swift index c846eebf91..1eb510dc5c 100644 --- a/Apps/LekaApp/Sources/Views/Settings/SettingsView.swift +++ b/Apps/LekaApp/Sources/Views/Settings/SettingsView.swift @@ -246,12 +246,12 @@ struct SettingsView: View { @ObservedObject private var styleManager: StyleManager = .shared @ObservedObject private var navigation = Navigation.shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() private func reset() { self.caregiverManager.resetData() self.carereceiverManager.resetData() - self.rootAccountViewModel.resetData() + self.libraryManagerViewModel.resetData() self.styleManager.accentColor = DesignKitAsset.Colors.lekaDarkBlue.swiftUIColor self.styleManager.colorScheme = .light } diff --git a/Modules/ContentKit/Sources/Views/ActivityDetailsView.swift b/Modules/ContentKit/Sources/Views/ActivityDetailsView.swift index bb305689d9..1831e5ad8a 100644 --- a/Modules/ContentKit/Sources/Views/ActivityDetailsView.swift +++ b/Modules/ContentKit/Sources/Views/ActivityDetailsView.swift @@ -121,15 +121,15 @@ public struct ActivityDetailsView: View { if let currentCaregiverID = self.caregiverManagerViewModel.currentCaregiver?.id { ToolbarItem { Menu { - if self.rootAccountViewModel.isActivitySaved(activityID: self.activity.uuid) { + if self.libraryManagerViewModel.isActivitySaved(activityID: self.activity.uuid) { Button(role: .destructive) { - self.rootAccountViewModel.removeSavedActivity(activityID: self.activity.uuid) + self.libraryManagerViewModel.removeSavedActivity(activityID: self.activity.uuid) } label: { Label(String(l10n.Library.MenuActions.removeFromlibraryButtonLabel.characters), systemImage: "trash") } } else { Button { - self.rootAccountViewModel.addSavedActivity( + self.libraryManagerViewModel.addSavedActivity( activityID: self.activity.uuid, caregiverID: currentCaregiverID ) @@ -176,7 +176,7 @@ public struct ActivityDetailsView: View { @ObservedObject private var styleManager: StyleManager = .shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel() private let activity: Activity diff --git a/Modules/ContentKit/Sources/Views/ActivityListView.swift b/Modules/ContentKit/Sources/Views/ActivityListView.swift index efe638c4e1..137a6a2912 100644 --- a/Modules/ContentKit/Sources/Views/ActivityListView.swift +++ b/Modules/ContentKit/Sources/Views/ActivityListView.swift @@ -82,15 +82,15 @@ public struct ActivityListView: View { if let currentCaregiverID = self.caregiverManagerViewModel.currentCaregiver?.id { Button {} label: { Menu { - if self.rootAccountViewModel.isActivitySaved(activityID: activity.uuid) { + if self.libraryManagerViewModel.isActivitySaved(activityID: activity.uuid) { Button(role: .destructive) { - self.rootAccountViewModel.removeSavedActivity(activityID: activity.uuid) + self.libraryManagerViewModel.removeSavedActivity(activityID: activity.uuid) } label: { Label(String(l10n.Library.MenuActions.removeFromlibraryButtonLabel.characters), systemImage: "trash") } } else { Button { - self.rootAccountViewModel.addSavedActivity( + self.libraryManagerViewModel.addSavedActivity( activityID: activity.uuid, caregiverID: currentCaregiverID ) @@ -155,7 +155,7 @@ public struct ActivityListView: View { @ObservedObject private var styleManager: StyleManager = .shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel() } diff --git a/Modules/ContentKit/Sources/Views/CurriculumDetailsView.swift b/Modules/ContentKit/Sources/Views/CurriculumDetailsView.swift index be96c70a88..ce683cb885 100644 --- a/Modules/ContentKit/Sources/Views/CurriculumDetailsView.swift +++ b/Modules/ContentKit/Sources/Views/CurriculumDetailsView.swift @@ -146,15 +146,15 @@ public struct CurriculumDetailsView: View { if let currentCaregiverID = self.caregiverManagerViewModel.currentCaregiver?.id { ToolbarItem { Menu { - if self.rootAccountViewModel.isCurriculumSaved(curriculumID: self.curriculum.uuid) { + if self.libraryManagerViewModel.isCurriculumSaved(curriculumID: self.curriculum.uuid) { Button(role: .destructive) { - self.rootAccountViewModel.removeSavedCurriculum(curriculumID: self.curriculum.uuid) + self.libraryManagerViewModel.removeSavedCurriculum(curriculumID: self.curriculum.uuid) } label: { Label(String(l10n.Library.MenuActions.removeFromlibraryButtonLabel.characters), systemImage: "trash") } } else { Button { - self.rootAccountViewModel.addSavedCurriculum( + self.libraryManagerViewModel.addSavedCurriculum( curriculumID: self.curriculum.uuid, caregiverID: currentCaregiverID ) @@ -188,7 +188,7 @@ public struct CurriculumDetailsView: View { @State private var isDescriptionExpanded = false @ObservedObject private var styleManager: StyleManager = .shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel() private let curriculum: Curriculum diff --git a/Modules/ContentKit/Sources/Views/CurriculumGroupboxView.swift b/Modules/ContentKit/Sources/Views/CurriculumGroupboxView.swift index 75f02c8105..b9a25742e9 100644 --- a/Modules/ContentKit/Sources/Views/CurriculumGroupboxView.swift +++ b/Modules/ContentKit/Sources/Views/CurriculumGroupboxView.swift @@ -35,15 +35,15 @@ public struct CurriculumGroupboxView: View { Button {} label: { Menu { - if self.rootAccountViewModel.isCurriculumSaved(curriculumID: self.curriculum.uuid) { + if self.libraryManagerViewModel.isCurriculumSaved(curriculumID: self.curriculum.uuid) { Button(role: .destructive) { - self.rootAccountViewModel.removeSavedCurriculum(curriculumID: self.curriculum.uuid) + self.libraryManagerViewModel.removeSavedCurriculum(curriculumID: self.curriculum.uuid) } label: { Label(String(l10n.Library.MenuActions.removeFromlibraryButtonLabel.characters), systemImage: "trash") } } else { Button { - self.rootAccountViewModel.addSavedCurriculum( + self.libraryManagerViewModel.addSavedCurriculum( curriculumID: self.curriculum.uuid, caregiverID: currentCaregiverID ) @@ -87,7 +87,7 @@ public struct CurriculumGroupboxView: View { Image(systemName: "checkmark.circle.fill") .font(.title3) .foregroundStyle(Color.secondary) - .opacity(self.rootAccountViewModel.isCurriculumSaved(curriculumID: self.curriculum.uuid) ? 1 : 0) + .opacity(self.libraryManagerViewModel.isCurriculumSaved(curriculumID: self.curriculum.uuid) ? 1 : 0) Spacer() @@ -111,7 +111,7 @@ public struct CurriculumGroupboxView: View { @ObservedObject private var styleManager: StyleManager = .shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel() private let curriculum: Curriculum diff --git a/Modules/ContentKit/Sources/Views/LibraryActivityListView.swift b/Modules/ContentKit/Sources/Views/LibraryActivityListView.swift index 5aea2aa729..58306bbb42 100644 --- a/Modules/ContentKit/Sources/Views/LibraryActivityListView.swift +++ b/Modules/ContentKit/Sources/Views/LibraryActivityListView.swift @@ -81,15 +81,15 @@ public struct LibraryActivityListView: View { if let currentCaregiverID = self.caregiverManagerViewModel.currentCaregiver?.id { Button {} label: { Menu { - if self.rootAccountViewModel.isActivitySaved(activityID: activity.uuid) { + if self.libraryManagerViewModel.isActivitySaved(activityID: activity.uuid) { Button(role: .destructive) { - self.rootAccountViewModel.removeSavedActivity(activityID: activity.uuid) + self.libraryManagerViewModel.removeSavedActivity(activityID: activity.uuid) } label: { Label(String(l10n.Library.MenuActions.removeFromlibraryButtonLabel.characters), systemImage: "trash") } } else { Button { - self.rootAccountViewModel.addSavedActivity( + self.libraryManagerViewModel.addSavedActivity( activityID: activity.uuid, caregiverID: currentCaregiverID ) @@ -154,7 +154,7 @@ public struct LibraryActivityListView: View { @ObservedObject private var styleManager: StyleManager = .shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel() } diff --git a/Modules/ContentKit/Sources/Views/StoryDetailsView.swift b/Modules/ContentKit/Sources/Views/StoryDetailsView.swift index ae54a769a0..f62c1d3d4b 100644 --- a/Modules/ContentKit/Sources/Views/StoryDetailsView.swift +++ b/Modules/ContentKit/Sources/Views/StoryDetailsView.swift @@ -112,15 +112,15 @@ public struct StoryDetailsView: View { if let currentCaregiverID = self.caregiverManagerViewModel.currentCaregiver?.id { ToolbarItem { Menu { - if self.rootAccountViewModel.isStorySaved(storyID: self.story.uuid) { + if self.libraryManagerViewModel.isStorySaved(storyID: self.story.uuid) { Button(role: .destructive) { - self.rootAccountViewModel.removeSavedStory(storyID: self.story.uuid) + self.libraryManagerViewModel.removeSavedStory(storyID: self.story.uuid) } label: { Label(String(l10n.Library.MenuActions.removeFromlibraryButtonLabel.characters), systemImage: "trash") } } else { Button { - self.rootAccountViewModel.addSavedStory( + self.libraryManagerViewModel.addSavedStory( storyID: self.story.uuid, caregiverID: currentCaregiverID ) @@ -167,7 +167,7 @@ public struct StoryDetailsView: View { @ObservedObject private var styleManager: StyleManager = .shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel() private let story: Story diff --git a/Modules/ContentKit/Sources/Views/StoryListView.swift b/Modules/ContentKit/Sources/Views/StoryListView.swift index fbb8f3a32d..824a472cbc 100644 --- a/Modules/ContentKit/Sources/Views/StoryListView.swift +++ b/Modules/ContentKit/Sources/Views/StoryListView.swift @@ -66,15 +66,15 @@ public struct StoryListView: View { Button {} label: { Menu { - if self.rootAccountViewModel.isStorySaved(storyID: story.uuid) { + if self.libraryManagerViewModel.isStorySaved(storyID: story.uuid) { Button(role: .destructive) { - self.rootAccountViewModel.removeSavedStory(storyID: story.uuid) + self.libraryManagerViewModel.removeSavedStory(storyID: story.uuid) } label: { Label(String(l10n.Library.MenuActions.removeFromlibraryButtonLabel.characters), systemImage: "trash") } } else { Button { - self.rootAccountViewModel.addSavedStory( + self.libraryManagerViewModel.addSavedStory( storyID: story.uuid, caregiverID: currentCaregiverID ) @@ -126,7 +126,7 @@ public struct StoryListView: View { @ObservedObject private var styleManager: StyleManager = .shared - @StateObject private var rootAccountViewModel = RootAccountManagerViewModel() + @StateObject private var libraryManagerViewModel = LibraryManagerViewModel() @StateObject private var caregiverManagerViewModel = CaregiverManagerViewModel() }