Skip to content

Commit 12e547f

Browse files
authored
v5.1.2 iOS apps (#47)
* fix maybe * less ratelimit * data 5.1.1 * scout 5.1.1 new color and spanish support * update spanish localization * fix the match endpoint * less annoying regex filter * fix match predictions: * fix something * "real" game endpoints * username 💀 * rust cleanup * v5.1.2 of scout app
1 parent eeac213 commit 12e547f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+5241
-3877
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bear_tracks"
3-
version = "5.1.0"
3+
version = "5.1.2"
44
edition = "2021"
55
authors = ["Jayen Agrawal"]
66
description = "a scouting app for frc"

ios/beartracks/bearTracks.xcodeproj/project.pbxproj

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
F5081BA22B741D15001497DB /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5081BA12B741D15001497DB /* AppState.swift */; };
1111
F540A13D2B549D2500611384 /* TeamView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F540A13C2B549D2500611384 /* TeamView.swift */; };
1212
F540A13F2B549D2E00611384 /* TeamViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F540A13E2B549D2E00611384 /* TeamViewModel.swift */; };
13+
F542E34C2B9C028F002F6E05 /* MatchDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F542E34B2B9C028F002F6E05 /* MatchDetailView.swift */; };
1314
F54E76C22B527D96003C65A2 /* bearTracksApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F54E76C12B527D96003C65A2 /* bearTracksApp.swift */; };
1415
F54E76C62B527D97003C65A2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F54E76C52B527D97003C65A2 /* Assets.xcassets */; };
1516
F54E76C92B527D97003C65A2 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F54E76C82B527D97003C65A2 /* Preview Assets.xcassets */; };
@@ -28,7 +29,7 @@
2829
F5B8D1AF2B9670F200D3F230 /* beartracks_watchApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5B8D1AE2B9670F200D3F230 /* beartracks_watchApp.swift */; };
2930
F5B8D1B32B9670F200D3F230 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F5B8D1B22B9670F200D3F230 /* Assets.xcassets */; };
3031
F5B8D1B62B9670F200D3F230 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F5B8D1B52B9670F200D3F230 /* Preview Assets.xcassets */; };
31-
F5B8D1B92B9670F200D3F230 /* beartracks-watch Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = F5B8D1AC2B9670F200D3F230 /* beartracks-watch Watch App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
32+
F5B8D1B92B9670F200D3F230 /* beartracks-watch Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = F5B8D1AC2B9670F200D3F230 /* beartracks-watch Watch App.app */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
3233
F5B8D1BD2B96710900D3F230 /* URLSessionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5AE2E592B5288FB0033DB0D /* URLSessionConfiguration.swift */; };
3334
F5B8D1BE2B96715500D3F230 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5081BA12B741D15001497DB /* AppState.swift */; };
3435
F5B8D1BF2B96716D00D3F230 /* SettingsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5AE2E4E2B527E170033DB0D /* SettingsManager.swift */; };
@@ -81,6 +82,7 @@
8182
F5081BA12B741D15001497DB /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
8283
F540A13C2B549D2500611384 /* TeamView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TeamView.swift; sourceTree = "<group>"; };
8384
F540A13E2B549D2E00611384 /* TeamViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TeamViewModel.swift; sourceTree = "<group>"; };
85+
F542E34B2B9C028F002F6E05 /* MatchDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchDetailView.swift; sourceTree = "<group>"; };
8486
F54E76BE2B527D96003C65A2 /* bearTracks.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = bearTracks.app; sourceTree = BUILT_PRODUCTS_DIR; };
8587
F54E76C12B527D96003C65A2 /* bearTracksApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = bearTracksApp.swift; sourceTree = "<group>"; };
8688
F54E76C52B527D97003C65A2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -155,6 +157,7 @@
155157
F5AE2E402B527E050033DB0D /* DetailedView.swift */,
156158
F5AE2E5B2B52FD430033DB0D /* LoginStateValidator.swift */,
157159
F5AE2E5D2B52FF3F0033DB0D /* LoginView.swift */,
160+
F542E34B2B9C028F002F6E05 /* MatchDetailView.swift */,
158161
F5AE2E3F2B527E050033DB0D /* MatchList.swift */,
159162
F5AE2E4E2B527E170033DB0D /* SettingsManager.swift */,
160163
F5AE2E522B527E170033DB0D /* SettingsView.swift */,
@@ -316,6 +319,7 @@
316319
F5081BA22B741D15001497DB /* AppState.swift in Sources */,
317320
F540A13D2B549D2500611384 /* TeamView.swift in Sources */,
318321
F5AE2E4C2B527E050033DB0D /* DataView.swift in Sources */,
322+
F542E34C2B9C028F002F6E05 /* MatchDetailView.swift in Sources */,
319323
F5AE2E462B527E050033DB0D /* MatchList.swift in Sources */,
320324
);
321325
runOnlyForDeploymentPostprocessing = 0;
@@ -345,6 +349,7 @@
345349
/* Begin PBXTargetDependency section */
346350
F5B8D1B82B9670F200D3F230 /* PBXTargetDependency */ = {
347351
isa = PBXTargetDependency;
352+
platformFilter = ios;
348353
target = F5B8D1AB2B9670F200D3F230 /* beartracks-watch Watch App */;
349354
targetProxy = F5B8D1B72B9670F200D3F230 /* PBXContainerItemProxy */;
350355
};
@@ -479,7 +484,7 @@
479484
CODE_SIGN_ENTITLEMENTS = bearTracks/bearTracks.entitlements;
480485
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
481486
CODE_SIGN_STYLE = Automatic;
482-
CURRENT_PROJECT_VERSION = 25;
487+
CURRENT_PROJECT_VERSION = 40;
483488
DEVELOPMENT_ASSET_PATHS = "\"bearTracks/Preview Content\"";
484489
DEVELOPMENT_TEAM = D6MFYYVHA8;
485490
ENABLE_PREVIEWS = YES;
@@ -499,7 +504,7 @@
499504
"$(inherited)",
500505
"@executable_path/Frameworks",
501506
);
502-
MARKETING_VERSION = 5.1.0;
507+
MARKETING_VERSION = 5.1.2;
503508
PRODUCT_BUNDLE_IDENTIFIER = com.jayagra.beartracks;
504509
PRODUCT_NAME = "$(TARGET_NAME)";
505510
SDKROOT = xros;
@@ -523,7 +528,7 @@
523528
CODE_SIGN_ENTITLEMENTS = bearTracks/bearTracks.entitlements;
524529
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
525530
CODE_SIGN_STYLE = Automatic;
526-
CURRENT_PROJECT_VERSION = 25;
531+
CURRENT_PROJECT_VERSION = 40;
527532
DEVELOPMENT_ASSET_PATHS = "\"bearTracks/Preview Content\"";
528533
DEVELOPMENT_TEAM = D6MFYYVHA8;
529534
ENABLE_PREVIEWS = YES;
@@ -543,7 +548,7 @@
543548
"$(inherited)",
544549
"@executable_path/Frameworks",
545550
);
546-
MARKETING_VERSION = 5.1.0;
551+
MARKETING_VERSION = 5.1.2;
547552
PRODUCT_BUNDLE_IDENTIFIER = com.jayagra.beartracks;
548553
PRODUCT_NAME = "$(TARGET_NAME)";
549554
SDKROOT = xros;
@@ -565,7 +570,7 @@
565570
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
566571
CODE_SIGN_ENTITLEMENTS = "beartracks-watch Watch App/beartracks-watch Watch App.entitlements";
567572
CODE_SIGN_STYLE = Automatic;
568-
CURRENT_PROJECT_VERSION = 1;
573+
CURRENT_PROJECT_VERSION = 30;
569574
DEVELOPMENT_ASSET_PATHS = "\"beartracks-watch Watch App/Preview Content\"";
570575
DEVELOPMENT_TEAM = D6MFYYVHA8;
571576
ENABLE_PREVIEWS = YES;
@@ -578,7 +583,7 @@
578583
"$(inherited)",
579584
"@executable_path/Frameworks",
580585
);
581-
MARKETING_VERSION = 1.0;
586+
MARKETING_VERSION = 5.1.1;
582587
PRODUCT_BUNDLE_IDENTIFIER = com.jayagra.beartracks.watchkitapp;
583588
PRODUCT_NAME = "$(TARGET_NAME)";
584589
SDKROOT = watchos;
@@ -597,7 +602,7 @@
597602
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
598603
CODE_SIGN_ENTITLEMENTS = "beartracks-watch Watch App/beartracks-watch Watch App.entitlements";
599604
CODE_SIGN_STYLE = Automatic;
600-
CURRENT_PROJECT_VERSION = 1;
605+
CURRENT_PROJECT_VERSION = 30;
601606
DEVELOPMENT_ASSET_PATHS = "\"beartracks-watch Watch App/Preview Content\"";
602607
DEVELOPMENT_TEAM = D6MFYYVHA8;
603608
ENABLE_PREVIEWS = YES;
@@ -610,7 +615,7 @@
610615
"$(inherited)",
611616
"@executable_path/Frameworks",
612617
);
613-
MARKETING_VERSION = 1.0;
618+
MARKETING_VERSION = 5.1.1;
614619
PRODUCT_BUNDLE_IDENTIFIER = com.jayagra.beartracks.watchkitapp;
615620
PRODUCT_NAME = "$(TARGET_NAME)";
616621
SDKROOT = watchos;

ios/beartracks/bearTracks/AppState.swift

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,53 @@ import Combine
99
import Foundation
1010

1111
class AppState: ObservableObject {
12-
#if targetEnvironment(macCatalyst)
12+
#if targetEnvironment(macCatalyst)
1313
@Published public var selectedTab: Tab? = .teams
14-
#elseif os(watchOS)
15-
#else
14+
#elseif os(watchOS)
15+
#else
1616
@Published public var selectedTab: Tab = .teams
17-
#endif
18-
@Published public var loginRequired: Bool = false
19-
private var cancellables: Set<AnyCancellable> = []
20-
21-
#if !os(watchOS)
17+
#endif
18+
@Published public var loginRequired: Bool = false
19+
@Published public var matchJson: [Match] = []
20+
private var cancellables: Set<AnyCancellable> = []
21+
22+
#if !os(watchOS)
2223
init() {
23-
$selectedTab
24-
.receive(on: DispatchQueue.main)
25-
.sink { _ in }
26-
.store(in: &cancellables)
24+
$selectedTab
25+
.receive(on: DispatchQueue.main)
26+
.sink { _ in }
27+
.store(in: &cancellables)
28+
}
29+
#endif
30+
}
31+
32+
/// FRC API's Schedule structure
33+
struct MatchData: Codable {
34+
let Schedule: [Match]
35+
}
36+
37+
/// FRC API's Match structure
38+
struct Match: Codable, Identifiable {
39+
var id = UUID()
40+
let description: String
41+
let startTime: String
42+
let matchNumber: Int
43+
let field: String
44+
let tournamentLevel: String
45+
let teams: [Team]
46+
47+
private enum CodingKeys: String, CodingKey {
48+
case description, startTime, matchNumber, field, tournamentLevel, teams
49+
}
50+
}
51+
52+
/// FRC API's Team structure
53+
struct Team: Codable, Identifiable {
54+
var id = UUID()
55+
let teamNumber: Int
56+
let station: String
57+
let surrogate: Bool
58+
private enum CodingKeys: String, CodingKey {
59+
case teamNumber, station, surrogate
2760
}
28-
#endif
2961
}

ios/beartracks/bearTracks/DataView.swift

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -9,97 +9,97 @@ import SwiftUI
99

1010
/// View for a list of all data
1111
struct DataView: View {
12-
@ObservedObject var dataItems: DataViewModel = DataViewModel()
13-
@State private var showSheet: Bool = false
14-
@State private var selectedItem: String = "-1"
15-
16-
var body: some View {
17-
VStack {
18-
NavigationStack {
19-
if !dataItems.dataEntries.isEmpty {
20-
List {
21-
ForEach(dataItems.dataEntries, id: \.Brief.id) { entry in
22-
NavigationLink(value: entry.Brief.id) {
23-
VStack {
24-
HStack {
25-
Text("\(String(entry.Brief.team))")
26-
.font(.title)
27-
.padding(.leading)
28-
.frame(maxWidth: .infinity, alignment: .leading)
29-
Text("match \(String(entry.Brief.match_num))")
30-
.font(.title)
31-
.padding(.trailing)
32-
.frame(maxWidth: .infinity, alignment: .trailing)
33-
}
34-
HStack {
35-
Text(
36-
"#\(String(entry.Brief.id)) • from \(String(entry.Brief.from_team)) (\(entry.Brief.name))"
37-
)
38-
.padding(.leading)
39-
.frame(maxWidth: .infinity, alignment: .leading)
40-
}
41-
}
42-
.contentShape(Rectangle())
43-
.onTapGesture {
44-
selectedItem = String(entry.Brief.id)
45-
showSheet = true
12+
@ObservedObject var dataItems: DataViewModel = DataViewModel()
13+
@State private var showSheet: Bool = false
14+
@State private var selectedItem: String = "-1"
15+
16+
var body: some View {
17+
VStack {
18+
NavigationStack {
19+
if !dataItems.dataEntries.isEmpty {
20+
List {
21+
ForEach(dataItems.dataEntries, id: \.Brief.id) { entry in
22+
VStack {
23+
VStack {
24+
HStack {
25+
Text("\(String(entry.Brief.team))")
26+
.font(.title)
27+
.padding(.leading)
28+
.frame(maxWidth: .infinity, alignment: .leading)
29+
Text("match \(String(entry.Brief.match_num))")
30+
.font(.title)
31+
.padding(.trailing)
32+
.frame(maxWidth: .infinity, alignment: .trailing)
33+
}
34+
HStack {
35+
Text(
36+
"#\(String(entry.Brief.id)) • from \(String(entry.Brief.from_team))"
37+
)
38+
.padding(.leading)
39+
.frame(maxWidth: .infinity, alignment: .leading)
40+
}
41+
}
42+
.contentShape(Rectangle())
43+
.onTapGesture {
44+
selectedItem = String(entry.Brief.id)
45+
showSheet = true
46+
}
47+
#if targetEnvironment(macCatalyst)
48+
.padding([.top, .bottom])
49+
#endif
50+
}
51+
}
52+
}
53+
.navigationTitle("Data")
54+
.navigationDestination(isPresented: $showSheet) {
55+
DetailedView(model: selectedItem)
56+
.navigationTitle("#\(selectedItem)")
57+
}
58+
} else {
59+
if dataItems.loadFailed {
60+
VStack {
61+
Label("failed", systemImage: "xmark.seal.fill")
62+
.padding(.bottom)
63+
.labelStyle(.iconOnly)
64+
.foregroundStyle(Color.pink)
65+
Text("load failed")
66+
.padding(.bottom)
67+
}
68+
.navigationTitle("Data")
69+
} else {
70+
if dataItems.loadComplete {
71+
VStack {
72+
Label("none", systemImage: "questionmark.app.dashed")
73+
.padding(.bottom)
74+
.labelStyle(.iconOnly)
75+
.foregroundStyle(Color.pink)
76+
Text("no data")
77+
.padding(.bottom)
78+
}
79+
.navigationTitle("Data")
80+
} else {
81+
VStack {
82+
Label("loading", systemImage: "hourglass")
83+
.padding(.bottom)
84+
.labelStyle(.iconOnly)
85+
Text("loading data...")
86+
.padding(.bottom)
87+
}
88+
.navigationTitle("Data")
89+
}
90+
}
4691
}
47-
#if targetEnvironment(macCatalyst)
48-
.padding([.top, .bottom])
49-
#endif
50-
}
5192
}
52-
}
53-
.navigationTitle("Data")
54-
.navigationDestination(isPresented: $showSheet) {
55-
DetailedView(model: selectedItem)
56-
.navigationTitle("#\(selectedItem)")
57-
}
58-
} else {
59-
if dataItems.loadFailed {
60-
VStack {
61-
Label("failed", systemImage: "xmark.seal.fill")
62-
.padding(.bottom)
63-
.labelStyle(.iconOnly)
64-
.foregroundStyle(Color.pink)
65-
Text("load failed")
66-
.padding(.bottom)
93+
.refreshable {
94+
dataItems.reload()
6795
}
68-
.navigationTitle("Data")
69-
} else {
70-
if dataItems.loadComplete {
71-
VStack {
72-
Label("none", systemImage: "questionmark.app.dashed")
73-
.padding(.bottom)
74-
.labelStyle(.iconOnly)
75-
.foregroundStyle(Color.pink)
76-
Text("no data")
77-
.padding(.bottom)
78-
}
79-
.navigationTitle("Data")
80-
} else {
81-
VStack {
82-
Label("loading", systemImage: "hourglass")
83-
.padding(.bottom)
84-
.labelStyle(.iconOnly)
85-
Text("loading data...")
86-
.padding(.bottom)
87-
}
88-
.navigationTitle("Data")
96+
.onAppear {
97+
dataItems.reload()
8998
}
90-
}
9199
}
92-
}
93-
.refreshable {
94-
dataItems.reload()
95-
}
96-
.onAppear {
97-
dataItems.reload()
98-
}
99100
}
100-
}
101101
}
102102

103103
#Preview {
104-
DataView()
104+
DataView()
105105
}

0 commit comments

Comments
 (0)