diff --git a/Apps/LekaApp/Sources/Navigation/Navigation.swift b/Apps/LekaApp/Sources/Navigation/Navigation.swift index f2412da0b7..78cb65b528 100644 --- a/Apps/LekaApp/Sources/Navigation/Navigation.swift +++ b/Apps/LekaApp/Sources/Navigation/Navigation.swift @@ -9,9 +9,9 @@ import SwiftUI // MARK: - FullScreenCoverContent -enum FullScreenCoverContent: Identifiable { +enum FullScreenCoverContent: Hashable, Identifiable { case welcomeView - case activityView + case activityView(carereceiver: Carereceiver? = nil) // MARK: Internal diff --git a/Apps/LekaApp/Sources/Views/Categories/CategoryActivitiesView.swift b/Apps/LekaApp/Sources/Views/Categories/CategoryActivitiesView.swift index a9e2fba6bc..bb4e858601 100644 --- a/Apps/LekaApp/Sources/Views/Categories/CategoryActivitiesView.swift +++ b/Apps/LekaApp/Sources/Views/Categories/CategoryActivitiesView.swift @@ -38,7 +38,7 @@ struct CategoryActivitiesView: View { self.navigation.sheetContent = .carereceiverPicker(activity: activity) } else { self.navigation.currentActivity = activity - self.navigation.fullScreenCoverContent = .activityView + self.navigation.fullScreenCoverContent = .activityView(carereceiver: nil) } }) } diff --git a/Apps/LekaApp/Sources/Views/Categories/CategoryCurriculumsView.swift b/Apps/LekaApp/Sources/Views/Categories/CategoryCurriculumsView.swift index d954a86f5e..0b5f871e87 100644 --- a/Apps/LekaApp/Sources/Views/Categories/CategoryCurriculumsView.swift +++ b/Apps/LekaApp/Sources/Views/Categories/CategoryCurriculumsView.swift @@ -65,7 +65,7 @@ struct CategoryCurriculumsView: View { self.navigation.sheetContent = .carereceiverPicker(activity: activity) } else { self.navigation.currentActivity = activity - self.navigation.fullScreenCoverContent = .activityView + self.navigation.fullScreenCoverContent = .activityView(carereceiver: nil) } }) diff --git a/Apps/LekaApp/Sources/Views/Categories/CategoryRemotesView.swift b/Apps/LekaApp/Sources/Views/Categories/CategoryRemotesView.swift index 3c36210843..2e3dbbbb3a 100644 --- a/Apps/LekaApp/Sources/Views/Categories/CategoryRemotesView.swift +++ b/Apps/LekaApp/Sources/Views/Categories/CategoryRemotesView.swift @@ -38,7 +38,7 @@ struct CategoryRemotesView: View { self.navigation.sheetContent = .carereceiverPicker(activity: activity) } else { self.navigation.currentActivity = activity - self.navigation.fullScreenCoverContent = .activityView + self.navigation.fullScreenCoverContent = .activityView(carereceiver: nil) } }) } diff --git a/Apps/LekaApp/Sources/Views/DeveloperMode/AllActivitiesView.swift b/Apps/LekaApp/Sources/Views/DeveloperMode/AllActivitiesView.swift index 541a822dc0..2c73985978 100644 --- a/Apps/LekaApp/Sources/Views/DeveloperMode/AllActivitiesView.swift +++ b/Apps/LekaApp/Sources/Views/DeveloperMode/AllActivitiesView.swift @@ -21,7 +21,7 @@ struct AllActivitiesView: View { ScrollView(showsIndicators: true) { ActivityGridView(activities: self.activities, onStartActivity: { activity in self.navigation.currentActivity = activity - self.navigation.fullScreenCoverContent = .activityView + self.navigation.fullScreenCoverContent = .activityView(carereceiver: nil) }) } .navigationTitle("All Activities") diff --git a/Apps/LekaApp/Sources/Views/MainView/MainView.swift b/Apps/LekaApp/Sources/Views/MainView/MainView.swift index 6df61916c8..7f375e454f 100644 --- a/Apps/LekaApp/Sources/Views/MainView/MainView.swift +++ b/Apps/LekaApp/Sources/Views/MainView/MainView.swift @@ -142,8 +142,8 @@ struct MainView: View { switch content { case .welcomeView: WelcomeView() - case .activityView: - ActivityView(activity: self.navigation.currentActivity!) + case let .activityView(carereceiver): + ActivityView(activity: self.navigation.currentActivity!, reinforcer: carereceiver?.reinforcer ?? .rainbow) } } } @@ -173,10 +173,10 @@ struct MainView: View { }, onSelected: { carereceiver in self.carereceiverManager.setCurrentCarereceiver(to: carereceiver) self.navigation.currentActivity = activity - self.navigation.fullScreenCoverContent = .activityView + self.navigation.fullScreenCoverContent = .activityView(carereceiver: carereceiver) }, onSkip: { self.navigation.currentActivity = activity - self.navigation.fullScreenCoverContent = .activityView + self.navigation.fullScreenCoverContent = .activityView(carereceiver: nil) }) .navigationBarTitleDisplayMode(.inline) } diff --git a/Modules/ContentKit/Sources/Activity/Activity.swift b/Modules/ContentKit/Sources/Activity/Activity.swift index d9e7a51d68..9e3f29e018 100644 --- a/Modules/ContentKit/Sources/Activity/Activity.swift +++ b/Modules/ContentKit/Sources/Activity/Activity.swift @@ -4,6 +4,7 @@ import Foundation import LocalizationKit +import RobotKit import UIKit import Yams diff --git a/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift b/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift index 567048c190..b5953b9d5b 100644 --- a/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift +++ b/Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift @@ -16,8 +16,9 @@ import SwiftUI public struct ActivityView: View { // MARK: Lifecycle - public init(activity: Activity) { + public init(activity: Activity, reinforcer: Robot.Reinforcer = .rainbow) { self._viewModel = StateObject(wrappedValue: ActivityViewViewModel(activity: activity)) + self.reinforcer = reinforcer } // MARK: Public @@ -179,6 +180,7 @@ public struct ActivityView: View { @State private var isInfoSheetPresented: Bool = false private let robot = Robot.shared + private let reinforcer: Robot.Reinforcer @ViewBuilder private var endOfActivityScoreView: some View { @@ -196,8 +198,7 @@ public struct ActivityView: View { speed: 0.2 ) .onAppear { - // TODO(@ladislas/@hugo): Use reinforcer children choice - self.robot.run(.fire) + self.robot.run(self.reinforcer) } .transition( .asymmetric(