Skip to content

Commit

Permalink
✨ (GEK): Add finish button to ActivityView for unstructured play
Browse files Browse the repository at this point in the history
  • Loading branch information
macteuts authored and ladislas committed Aug 23, 2024
1 parent 4557559 commit f0bc52b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Modules/GameEngineKit/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,24 @@
}
}
},
"game_engine_kit.activity_view.finish_button": {
"comment": "The title of the finish button",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Finish"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Terminer"
}
}
}
},
"game_engine_kit.activity_view.hide_reinforcer_to_show_answers_button": {
"comment": "The title of the hide reinforcer to show answers button",
"extractionState": "extracted_with_value",
Expand Down
16 changes: 16 additions & 0 deletions Modules/GameEngineKit/Sources/Views/Activity/ActivityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,22 @@ public struct ActivityView: View {
)
}

private var finishButton: some View {
Button(String(l10n.GameEngineKit.ActivityView.finishButton.characters)) {
// TODO(@macteuts): Move the following out of then View if relevant
self.viewModel.currentExerciseSharedData.state = .completed(level: .excellent)
}
.buttonStyle(.bordered)
.tint(.gray)
.padding()
.transition(
.asymmetric(
insertion: .opacity.animation(.snappy.delay(2)),
removal: .identity
)
)
}

private var hideReinforcerToShowAnswersButton: some View {
Button(String(l10n.GameEngineKit.ActivityView.hideReinforcerToShowAnswersButton.characters)) {
withAnimation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ extension l10n {
comment: "The title of the continue button"
)

static let finishButton = LocalizedString(
"game_engine_kit.activity_view.finish_button",
bundle: GameEngineKitResources.bundle,
value: "Finish",
comment: "The title of the finish button"
)

static let hideReinforcerToShowAnswersButton = LocalizedString(
"game_engine_kit.activity_view.hide_reinforcer_to_show_answers_button",
bundle: GameEngineKitResources.bundle,
Expand Down

0 comments on commit f0bc52b

Please sign in to comment.