From 8af7515d7aadb29cb8149954f8fbbe683b161f26 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Thu, 22 Feb 2024 09:32:42 +0100 Subject: [PATCH] :recycle: (ContentKit): Rename ActivityExerciseManager to CurrentActivityManager --- ...ger.swift => CurrentActivityManager.swift} | 2 +- .../Activity/ActivityViewViewModel.swift | 46 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) rename Modules/ContentKit/Sources/Activity/{ActivityExerciseManager.swift => CurrentActivityManager.swift} (98%) diff --git a/Modules/ContentKit/Sources/Activity/ActivityExerciseManager.swift b/Modules/ContentKit/Sources/Activity/CurrentActivityManager.swift similarity index 98% rename from Modules/ContentKit/Sources/Activity/ActivityExerciseManager.swift rename to Modules/ContentKit/Sources/Activity/CurrentActivityManager.swift index dbfe1d5b7d..c590643bf2 100644 --- a/Modules/ContentKit/Sources/Activity/ActivityExerciseManager.swift +++ b/Modules/ContentKit/Sources/Activity/CurrentActivityManager.swift @@ -2,7 +2,7 @@ // Copyright APF France handicap // SPDX-License-Identifier: Apache-2.0 -public class ActivityExerciseManager { +public class CurrentActivityManager { // MARK: Lifecycle public init(activity: Activity) { diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityViewViewModel.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityViewViewModel.swift index 6b38942d71..7e8fc3755f 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityViewViewModel.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityViewViewModel.swift @@ -12,22 +12,22 @@ class ActivityViewViewModel: ObservableObject { init(activity: Activity) { self.currentActivity = activity - self.exerciseManager = ActivityExerciseManager(activity: activity) + self.activityManager = CurrentActivityManager(activity: activity) - self.totalGroups = self.exerciseManager.totalGroups - self.currentGroupIndex = self.exerciseManager.currentGroupIndex + self.totalGroups = self.activityManager.totalGroups + self.currentGroupIndex = self.activityManager.currentGroupIndex - self.groupSizeEnumeration = self.exerciseManager.activity.exercisePayload.exerciseGroups.map(\.exercises.count) + self.groupSizeEnumeration = self.activityManager.activity.exercisePayload.exerciseGroups.map(\.exercises.count) - self.totalExercisesInCurrentGroup = self.exerciseManager.totalExercisesInCurrentGroup - self.currentExerciseIndexInCurrentGroup = self.exerciseManager.currentExerciseIndexInCurrentGroup + self.totalExercisesInCurrentGroup = self.activityManager.totalExercisesInCurrentGroup + self.currentExerciseIndexInCurrentGroup = self.activityManager.currentExerciseIndexInCurrentGroup - self.currentExercise = self.exerciseManager.currentExercise - self.currentExerciseInterface = self.exerciseManager.currentExercise.interface + self.currentExercise = self.activityManager.currentExercise + self.currentExerciseInterface = self.activityManager.currentExercise.interface self.currentExerciseSharedData = ExerciseSharedData( - groupIndex: self.exerciseManager.currentGroupIndex, - exerciseIndex: self.exerciseManager.currentExerciseIndexInCurrentGroup + groupIndex: self.activityManager.currentGroupIndex, + exerciseIndex: self.activityManager.currentExerciseIndexInCurrentGroup ) self.completedExercisesSharedData.append(self.currentExerciseSharedData) @@ -97,20 +97,20 @@ class ActivityViewViewModel: ObservableObject { } var isFirstExercise: Bool { - self.exerciseManager.isFirstExercise + self.activityManager.isFirstExercise } var isLastExercise: Bool { - self.exerciseManager.isLastExercise + self.activityManager.isLastExercise } func moveToNextExercise() { - self.exerciseManager.moveToNextExercise() + self.activityManager.moveToNextExercise() self.updateValues() } func moveToPreviousExercise() { - self.exerciseManager.moveToPreviousExercise() + self.activityManager.moveToPreviousExercise() self.updateValues() } @@ -120,20 +120,20 @@ class ActivityViewViewModel: ObservableObject { // MARK: Private - private let exerciseManager: ActivityExerciseManager + private let activityManager: CurrentActivityManager private var cancellables: Set = [] private func updateValues() { - self.currentExercise = self.exerciseManager.currentExercise - self.currentExerciseInterface = self.exerciseManager.currentExercise.interface - self.currentGroupIndex = self.exerciseManager.currentGroupIndex - self.totalGroups = self.exerciseManager.totalGroups - self.currentExerciseIndexInCurrentGroup = self.exerciseManager.currentExerciseIndexInCurrentGroup - self.totalExercisesInCurrentGroup = self.exerciseManager.totalExercisesInCurrentGroup + self.currentExercise = self.activityManager.currentExercise + self.currentExerciseInterface = self.activityManager.currentExercise.interface + self.currentGroupIndex = self.activityManager.currentGroupIndex + self.totalGroups = self.activityManager.totalGroups + self.currentExerciseIndexInCurrentGroup = self.activityManager.currentExerciseIndexInCurrentGroup + self.totalExercisesInCurrentGroup = self.activityManager.totalExercisesInCurrentGroup self.currentExerciseSharedData = ExerciseSharedData( - groupIndex: self.exerciseManager.currentGroupIndex, - exerciseIndex: self.exerciseManager.currentExerciseIndexInCurrentGroup + groupIndex: self.activityManager.currentGroupIndex, + exerciseIndex: self.activityManager.currentExerciseIndexInCurrentGroup ) self.completedExercisesSharedData.append(self.currentExerciseSharedData)