Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ladislas/feature/reorganize activity views managers #717

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

import ContentKit
import GameEngineKit
import SwiftUI

struct SampleActivityListView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
}
.frame(maxWidth: .infinity)
}
// TODO: (@ladislas) remove if not necessary

Check warning on line 79 in Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift

View workflow job for this annotation

GitHub Actions / swiftlint

TODOs should be resolved ((@ladislas) remove if not nece...) (todo)
// .disabled(navigation.disableUICompletly)
} detail: {
NavigationStack(path: self.$navigation.path) {
Expand Down Expand Up @@ -125,7 +125,7 @@
.fullScreenCover(isPresented: self.$viewModel.isRobotConnectionPresented) {
RobotConnectionView(viewModel: RobotConnectionViewModel())
}
// TODO: (@team) - Update this onReceive when caregiver are managed by AccountKit

Check warning on line 128 in Apps/LekaApp/Sources/_NEWCodeBase/Views/MainView/MainView.swift

View workflow job for this annotation

GitHub Actions / swiftlint

TODOs should be resolved ((@team) - Update this onReceiv...) (todo)
.onReceive(self.rootOwnerViewModel.$currentCaregiver) { caregiver in
if !self.authManagerViewModel.isUserLoggedOut {
self.isCaregiverPickerPresented = (caregiver == nil)
Expand All @@ -134,11 +134,6 @@
.fullScreenCover(isPresented: self.$isCaregiverPickerPresented) {
CaregiverPicker()
}
.fullScreenCover(item: self.$navigation.currentActivity) {
self.navigation.currentActivity = nil
} content: { activity in
ActivityView(activity: activity)
}
.sheet(isPresented: self.$rootOwnerViewModel.isSettingsViewPresented) {
SettingsView(isCaregiverPickerPresented: self.$isCaregiverPickerPresented)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct MainView: View {
print("version: \(Avatars.version)")
print("id: \(avatarCategorie.id)")
print("name: \(avatarCategorie.name)")
for icon in avatarCategorie.icons {
for icon in avatarCategorie.avatars {
print("iconName: \(icon)")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import SwiftUI

// MARK: - ActivityDetailsView

struct ActivityDetailsView: View {
// MARK: Internal
public struct ActivityDetailsView: View {
// MARK: Lifecycle

let activity: Activity
public init(activity: Activity) {
self.activity = activity
}

// MARK: Public

var body: some View {
public var body: some View {
List {
Section {
HStack {
Expand Down Expand Up @@ -135,7 +139,7 @@ struct ActivityDetailsView: View {
ToolbarItem {
Button {
print("Start activity")
self.navigation.currentActivity = self.activity
self.activityToStart = self.activity
} label: {
Image(systemName: "play.circle")
Text("Start activity")
Expand All @@ -144,16 +148,23 @@ struct ActivityDetailsView: View {
.tint(.lkGreen)
}
}
.fullScreenCover(item: self.$activityToStart) {
self.activityToStart = nil
} content: { activity in
ActivityView(activity: activity)
}
}

// MARK: Private

private let activity: Activity

@State private var selectedAuthor: Author?
@State private var selectedSkill: Skill?
@State private var selectedHMI: HMIDetails?
@State private var selectedType: ActivityType?

private let navigation: Navigation = .shared
@State private var activityToStart: Activity?
}

#Preview {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@
}
}
.sheet(isPresented: self.$isInfoSheetPresented) {
// TODO: (@team) - Add YAML description of activities
Text("Info related to the activity ")
ActivityDetailsView(activity: self.viewModel.currentActivity)
}
.fullScreenCover(isPresented: self.$viewModel.isCurrentActivityCompleted) {
self.endOfActivityScoreView
Expand All @@ -146,7 +145,7 @@

@Environment(\.dismiss) var dismiss

// TODO: (@ladislas) was @ObservedObject, check why

Check warning on line 148 in Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityView.swift

View workflow job for this annotation

GitHub Actions / swiftlint

TODOs should be resolved ((@ladislas) was @ObservedObjec...) (todo)
@StateObject var viewModel: ActivityViewViewModel

// MARK: Private
Expand Down Expand Up @@ -174,7 +173,7 @@
speed: 0.2
)
.onAppear {
// TODO(@ladislas/@hugo): Use reinforcer children choice

Check warning on line 176 in Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityView.swift

View workflow job for this annotation

GitHub Actions / swiftlint

TODOs should be resolved ((@ladislas/@hugo): Use reinfor...) (todo)
self.robot.run(.fire)
}
.transition(
Expand Down
Loading