Skip to content

Commit

Permalink
v5.1.2 of scout app
Browse files Browse the repository at this point in the history
  • Loading branch information
JayAgra committed Mar 14, 2024
1 parent 6805fd0 commit 0024844
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 79 deletions.
2 changes: 2 additions & 0 deletions ios/beartracks/beartracks-scout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
F565840F2B54D52A00F587C0 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
F58565C32B7572B400C1606E /* beartracks-scout.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "beartracks-scout.entitlements"; sourceTree = "<group>"; };
F5AD47CB2B54FF0500345122 /* ReviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewView.swift; sourceTree = "<group>"; };
F5B57DEE2BA2989E00C9D95F /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -90,6 +91,7 @@
F565840C2B54D52A00F587C0 /* Assets.xcassets */,
F55ABD6C2B9C40C4006E7FAF /* Localizable.xcstrings */,
F565840E2B54D52A00F587C0 /* Preview Content */,
F5B57DEE2BA2989E00C9D95F /* PrivacyInfo.xcprivacy */,
);
path = "beartracks-scout";
sourceTree = "<group>";
Expand Down
2 changes: 1 addition & 1 deletion ios/beartracks/beartracks-scout/EndView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct EndView: View {
controller.switches.2 = false
}
}
Toggle("Buddy climb", isOn: $controller.switches.2)
Toggle("Harmony", isOn: $controller.switches.2)
.disabled(!controller.switches.1)
}
.padding()
Expand Down
146 changes: 96 additions & 50 deletions ios/beartracks/beartracks-scout/GameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ struct GameView: View {
@State private var holdLengths: (TimeInterval, TimeInterval, TimeInterval) = (0.0, 0.0, 0.0)
@State private var timer: Timer?
@State private var actionState: ActionState = .neutral
@State private var releaseState: ReleaseState = .neutral
@State private var ballOffset: CGSize = .zero

enum ActionState {
case neutral, intake, travel, outtake
}

enum ReleaseState {
case neutral, speaker, amplifier, other
}

var body: some View {
NavigationStack {
if controller.getTeamNumber() != "--" && controller.getMatchNumber() != 0 {
Expand All @@ -30,31 +35,38 @@ struct GameView: View {
Spacer()
VStack {
Text("intake")
.foregroundStyle(Color.gray)
Text(String(format: "%.1f", holdLengths.0))
.foregroundStyle(Color.init(red: 69 / 255, green: 133 / 255, blue: 136 / 255))
}
Spacer()
VStack {
Text("move")
Text("travel")
.foregroundStyle(Color.gray)
Text(String(format: "%.1f", holdLengths.1))
.foregroundStyle(Color.init(red: 177 / 255, green: 98 / 255, blue: 134 / 255))
}
Spacer()
VStack {
Text("outtake")
.foregroundStyle(Color.gray)
Text(String(format: "%.1f", holdLengths.2))
.foregroundStyle(Color.init(red: 104 / 255, green: 157 / 255, blue: 106 / 255))
}
Spacer()
}
.frame(maxWidth: .infinity, alignment: .center)
.padding(.top)
if controller.matchTimes.count == 0 || UserDefaults.standard.bool(forKey: "showLabels") {
VStack {
HStack {
VStack {
HStack {
if releaseState == .other {
Text("other")
.foregroundStyle(getLabelColor())
.frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.init(red: 254 / 255, green: 128 / 255, blue: 25 / 255))
.frame(maxWidth: .infinity, alignment: getLabelAlignment())
} else {
Text("")
.foregroundStyle(getLabelColor())
.frame(maxWidth: .infinity, alignment: .trailing)
.foregroundStyle(getLabelColor(state: true, type: nil))
.frame(maxWidth: .infinity, alignment: getLabelAlignment())
}
}
}
Expand Down Expand Up @@ -115,41 +127,48 @@ struct GameView: View {
self.holdLengths = (0, 0, 0)
}
self.actionState = .neutral
self.releaseState = .neutral
}))
if controller.matchTimes.count == 0 || UserDefaults.standard.bool(forKey: "showLabels") {
VStack {
Spacer()
HStack {
Text("amp —")
.foregroundStyle(getLabelColor())
.frame(maxWidth: .infinity, alignment: .trailing)
}
Spacer()
Spacer()
HStack {
Spacer()
Text("intake")
.foregroundStyle(getLabelColor())
Spacer()
Text("travel")
.foregroundStyle(getLabelColor())
Spacer()
Text("outtake")
.foregroundStyle(getLabelColor())
Spacer()
VStack {
Spacer()
HStack {
if releaseState == .amplifier {
Text("amplifier")
.foregroundStyle(Color.init(red: 250 / 255, green: 189 / 255, blue: 47 / 255))
.frame(maxWidth: .infinity, alignment: getLabelAlignment())
} else {
Text("")
.foregroundStyle(getLabelColor(state: true, type: nil))
.frame(maxWidth: .infinity, alignment: getLabelAlignment())
}
}
Spacer(); Spacer()
HStack {
Spacer()

Text("intake")
.foregroundStyle(getLabelColor(state: false, type: .intake))
Spacer()
Text("travel")
.foregroundStyle(getLabelColor(state: false, type: .travel))
Spacer()
Text("outtake")
.foregroundStyle(getLabelColor(state: false, type: .outtake))
Spacer()
Spacer()
HStack {
Text("speaker —")
.foregroundStyle(getLabelColor())
.frame(maxWidth: .infinity, alignment: .trailing)
}
Spacer(); Spacer(); Spacer(); Spacer(); Spacer()
HStack {
if releaseState == .speaker {
Text("speaker")
.foregroundStyle(Color.init(red: 184 / 255, green: 187 / 255, blue: 38 / 255))
.frame(maxWidth: .infinity, alignment: getLabelAlignment())
} else {
Text("")
.foregroundStyle(getLabelColor(state: true, type: nil))
.frame(maxWidth: .infinity, alignment: getLabelAlignment())
}
Spacer()
}
Spacer()
}
}
.padding(.bottom)
Expand Down Expand Up @@ -210,26 +229,32 @@ struct GameView: View {
}
}

private func updateBallOffset(
dragValue: DragGesture.Value, totalWidth: CGFloat, totalHeight: CGFloat
) {
if abs(self.ballOffset.height) > totalHeight * 0.2
&& abs(dragValue.translation.height) <= totalHeight * 0.2
{
private func updateBallOffset(dragValue: DragGesture.Value, totalWidth: CGFloat, totalHeight: CGFloat) {
if abs(self.ballOffset.height) > totalHeight * 0.2 && abs(dragValue.translation.height) <= totalHeight * 0.2 {
UIImpactFeedbackGenerator(style: .rigid).impactOccurred()
} else if abs(self.ballOffset.height) <= totalHeight * 0.2
&& abs(dragValue.translation.height) > totalHeight * 0.2
{
} else if abs(self.ballOffset.height) <= totalHeight * 0.2 && abs(dragValue.translation.height) > totalHeight * 0.2 {
UIImpactFeedbackGenerator(style: .light).impactOccurred()
}

let newOffset = CGSize(
width: min(
max(dragValue.translation.width, (totalWidth * -0.5) + 30), (totalWidth * 0.5) - 30),
width: min(max(dragValue.translation.width, (totalWidth * -0.5) + 30), (totalWidth * 0.5) - 30),
height: dragValue.translation.height
)

self.ballOffset = newOffset

if abs(self.ballOffset.height) >= totalHeight * 0.2 {
if self.ballOffset.height < 0 {
if abs(self.ballOffset.height) >= totalHeight * 0.475 {
releaseState = .other
} else {
releaseState = .amplifier
}
} else {
releaseState = .speaker
}
} else {
self.releaseState = .neutral
}
}

private func getUIImage(position: ActionState, height: CGFloat) -> Image {
Expand Down Expand Up @@ -282,11 +307,32 @@ struct GameView: View {
}
}

private func getLabelColor() -> Color {
if controller.matchTimes.isEmpty {
private func getLabelColor(state: Bool, type: ActionState?) -> Color {
if controller.matchTimes.isEmpty && state {
return Color.primary
} else {
return Color.gray
if state || actionState != type {
return Color.gray
} else {
switch actionState {
case .neutral:
return Color.init(red: 251 / 255, green: 241 / 255, blue: 199 / 255)
case .intake:
return Color.init(red: 69 / 255, green: 133 / 255, blue: 136 / 255)
case .travel:
return Color.init(red: 177 / 255, green: 98 / 255, blue: 134 / 255)
case .outtake:
return Color.init(red: 104 / 255, green: 157 / 255, blue: 106 / 255)
}
}
}
}

private func getLabelAlignment() -> Alignment {
if UserDefaults.standard.bool(forKey: "leftHand") {
return .trailing
} else {
return .leading
}
}
}
Expand Down
49 changes: 47 additions & 2 deletions ios/beartracks/beartracks-scout/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
}
},
"Alliance wing notes handled (%lld)" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -69,6 +70,7 @@
}
},
"amp —" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -79,7 +81,6 @@
}
},
"amplifier" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand Down Expand Up @@ -140,6 +141,7 @@
}
},
"Buddy climb" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand Down Expand Up @@ -349,6 +351,16 @@
}
}
},
"Harmony" : {
"localizations" : {
"es-419" : {
"stringUnit" : {
"state" : "translated",
"value" : "Armonía"
}
}
}
},
"How was the driving? Did the driver seem confident?" : {
"localizations" : {
"es-419" : {
Expand All @@ -369,6 +381,16 @@
}
}
},
"Left-Handed Labels" : {
"localizations" : {
"es-419" : {
"stringUnit" : {
"state" : "translated",
"value" : "Etiquetas para zurdos"
}
}
}
},
"log in" : {
"localizations" : {
"es-419" : {
Expand Down Expand Up @@ -452,6 +474,7 @@
}
},
"move" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -461,7 +484,18 @@
}
}
},
"Neutral notes handled (%lld)" : {
"localizations" : {
"es-419" : {
"stringUnit" : {
"state" : "translated",
"value" : "Notas neutrales manejadas (%lld)"
}
}
}
},
"Neutral zone notes handled (%lld)" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand Down Expand Up @@ -532,6 +566,7 @@
}
},
"Persist Area Labels" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand Down Expand Up @@ -663,7 +698,6 @@
}
},
"speaker" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand All @@ -684,6 +718,7 @@
}
},
"speaker —" : {
"extractionState" : "stale",
"localizations" : {
"es-419" : {
"stringUnit" : {
Expand Down Expand Up @@ -842,6 +877,16 @@
}
}
}
},
"Wing notes handled (%lld)" : {
"localizations" : {
"es-419" : {
"stringUnit" : {
"state" : "translated",
"value" : "Notas de ala manejadas (%lld)"
}
}
}
}
},
"version" : "1.0"
Expand Down
17 changes: 17 additions & 0 deletions ios/beartracks/beartracks-scout/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
</dict>
</array>
</dict>
</plist>
Loading

0 comments on commit 0024844

Please sign in to comment.