Skip to content

Commit

Permalink
✨ (ContentKitxUIExplorer): Add Melody activity
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Dec 4, 2023
1 parent fac9500 commit c7a9fb4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Leka - iOS Monorepo
# Copyright 2023 APF France handicap
# SPDX-License-Identifier: Apache-2.0

id: 0acffb9d1c4141688721ad430aebe0c2
name: Melody - Au Clair de la Lune
description: L'objectif est de reproduire la mélodie affichée par Leka
image: activity_color_recognition_1
sequence:
- exercises:
- instructions: Joue les notes de la même couleur que Leka
interface: melody
payload:
instrument: xylophone
songs:
- auClairDeLaLune
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let kActivities: [Activity] = [
ContentKit.decodeActivity("activity-hideAndSeek"),
ContentKit.decodeActivity("activity-xylophone-pentatonic"),
ContentKit.decodeActivity("activity-xylophone-heptatonic"),
ContentKit.decodeActivity("activity-melody-au_clair_de_la_lune"),
]

struct GEKNewSystemView: View {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Leka - iOS Monorepo
// Copyright 2023 APF France handicap
// SPDX-License-Identifier: Apache-2.0

public enum MIDIRecordingPlayer {

public struct Payload: Codable {
public let instrument: String
public let songs: [MIDIRecording]

enum CodingKeys: String, CodingKey {

Check failure on line 11 in Modules/ContentKit/Sources/Exercise/Exercice+MIDIRecordingPlayer.swift

View workflow job for this annotation

GitHub Actions / lint

Types should be nested at most 1 level deep (nesting)

Check failure on line 11 in Modules/ContentKit/Sources/Exercise/Exercice+MIDIRecordingPlayer.swift

View workflow job for this annotation

GitHub Actions / lint

Types should be nested at most 1 level deep (nesting)
case instrument, songs
}

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.instrument = try container.decode(String.self, forKey: .instrument)

let MIDIRecordingSongs = try container.decode([MIDIRecording.Song].self, forKey: .songs)
self.songs = MIDIRecordingSongs.map { MIDIRecording($0) }
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extension Exercise {
case remoteArrow
case hideAndSeek
case musicalInstruments
case melody
}

}
1 change: 1 addition & 0 deletions Modules/ContentKit/Sources/Exercise/Exercise+Payload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ extension TouchToSelect.Payload: ExercisePayloadProtocol {}
extension DragAndDropIntoZones.Payload: ExercisePayloadProtocol {}
extension DragAndDropToAssociate.Payload: ExercisePayloadProtocol {}
extension AudioRecordingPlayer.Payload: ExercisePayloadProtocol {}
extension MIDIRecordingPlayer.Payload: ExercisePayloadProtocol {}
extension HideAndSeek.Payload: ExercisePayloadProtocol {}
extension MusicalInstrument.Payload: ExercisePayloadProtocol {}
3 changes: 3 additions & 0 deletions Modules/ContentKit/Sources/Exercise/Exercise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public struct Exercise: Codable {
case (.musicalInstruments, .none):
payload = try container.decode(MusicalInstrument.Payload.self, forKey: .payload)

case (.melody, .none):
payload = try container.decode(MIDIRecordingPlayer.Payload.self, forKey: .payload)

case (.remoteStandard, .none),
(.remoteArrow, .none):
payload = nil
Expand Down

0 comments on commit c7a9fb4

Please sign in to comment.