Skip to content

Commit 806ea43

Browse files
authored
Merge pull request #167 from TaskarCenterAtUW/feature-element-list-category
Quest Selection UI and functionality
2 parents a8f5039 + ebde5b9 commit 806ea43

File tree

5 files changed

+110
-99
lines changed

5 files changed

+110
-99
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@
193193
FA87A8172B6AC885000A6BEA /* StepsInclineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA87A8162B6AC885000A6BEA /* StepsInclineTests.swift */; };
194194
FA87A8192B6B01A4000A6BEA /* HandRailTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA87A8182B6B01A4000A6BEA /* HandRailTests.swift */; };
195195
FA87A81B2B6B042E000A6BEA /* SideWalkWidthTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA87A81A2B6B042E000A6BEA /* SideWalkWidthTests.swift */; };
196-
FA8C74BF2C1B00E600D28220 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8C74BE2C1B00E600D28220 /* SettingsView.swift */; };
197196
FA8C74C22C4E89C800D28220 /* LongForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8C74C12C4E89C800D28220 /* LongForm.swift */; };
198197
FA8C74C42C4FDE1000D28220 /* LongFormModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8C74C32C4FDE1000D28220 /* LongFormModel.swift */; };
199198
FA8C74C72C4FE2E900D28220 /* LongFormWidthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8C74C62C4FE2E900D28220 /* LongFormWidthView.swift */; };
@@ -218,6 +217,7 @@
218217
FAD5C50A2AFCBE720040C61A /* GoInfoGameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD5C5092AFCBE720040C61A /* GoInfoGameTests.swift */; };
219218
FAD5C5142AFCBE720040C61A /* GoInfoGameUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD5C5132AFCBE720040C61A /* GoInfoGameUITests.swift */; };
220219
FAD5C5162AFCBE720040C61A /* GoInfoGameUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD5C5152AFCBE720040C61A /* GoInfoGameUITestsLaunchTests.swift */; };
220+
FAE2584F2D39819300D2BB12 /* QuestCategoryListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAE2584E2D39819300D2BB12 /* QuestCategoryListView.swift */; };
221221
FAF44FBD2B3084EC004FE664 /* OnboardingView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF44FBC2B3084EC004FE664 /* OnboardingView1.swift */; };
222222
FAF44FBF2B3084FB004FE664 /* OnboardingView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF44FBE2B3084FB004FE664 /* OnboardingView2.swift */; };
223223
FAF44FC12B30850A004FE664 /* OnboardingView3.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF44FC02B30850A004FE664 /* OnboardingView3.swift */; };
@@ -499,7 +499,6 @@
499499
FA87A8162B6AC885000A6BEA /* StepsInclineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsInclineTests.swift; sourceTree = "<group>"; };
500500
FA87A8182B6B01A4000A6BEA /* HandRailTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HandRailTests.swift; sourceTree = "<group>"; };
501501
FA87A81A2B6B042E000A6BEA /* SideWalkWidthTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideWalkWidthTests.swift; sourceTree = "<group>"; };
502-
FA8C74BE2C1B00E600D28220 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
503502
FA8C74C12C4E89C800D28220 /* LongForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LongForm.swift; sourceTree = "<group>"; };
504503
FA8C74C32C4FDE1000D28220 /* LongFormModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LongFormModel.swift; sourceTree = "<group>"; };
505504
FA8C74C62C4FE2E900D28220 /* LongFormWidthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LongFormWidthView.swift; sourceTree = "<group>"; };
@@ -531,6 +530,7 @@
531530
FAD5C50F2AFCBE720040C61A /* GoInfoGameUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GoInfoGameUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
532531
FAD5C5132AFCBE720040C61A /* GoInfoGameUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoInfoGameUITests.swift; sourceTree = "<group>"; };
533532
FAD5C5152AFCBE720040C61A /* GoInfoGameUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoInfoGameUITestsLaunchTests.swift; sourceTree = "<group>"; };
533+
FAE2584E2D39819300D2BB12 /* QuestCategoryListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuestCategoryListView.swift; sourceTree = "<group>"; };
534534
FAF44FBC2B3084EC004FE664 /* OnboardingView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView1.swift; sourceTree = "<group>"; };
535535
FAF44FBE2B3084FB004FE664 /* OnboardingView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView2.swift; sourceTree = "<group>"; };
536536
FAF44FC02B30850A004FE664 /* OnboardingView3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView3.swift; sourceTree = "<group>"; };
@@ -680,7 +680,6 @@
680680
05CB71DD2B0FAEC200DED821 /* UI */ = {
681681
isa = PBXGroup;
682682
children = (
683-
FA8C74BD2C1B00CC00D28220 /* Settings */,
684683
971342712BBD240500174EBF /* InitialView */,
685684
FABF3CF92B86062E0080EAC9 /* Camera */,
686685
FA87A80E2B681416000A6BEA /* Utils */,
@@ -1166,6 +1165,7 @@
11661165
A4E7119C2B57A22300C9DE08 /* quests */ = {
11671166
isa = PBXGroup;
11681167
children = (
1168+
FAE2584C2D39816600D2BB12 /* QuestCategory */,
11691169
FA8C74C02C4E89A600D28220 /* LongQuests */,
11701170
97412A972BBBF39000DF7983 /* KerbHeight */,
11711171
97412A922BBADACA00DF7983 /* StairFlights */,
@@ -1283,14 +1283,6 @@
12831283
path = Utils;
12841284
sourceTree = "<group>";
12851285
};
1286-
FA8C74BD2C1B00CC00D28220 /* Settings */ = {
1287-
isa = PBXGroup;
1288-
children = (
1289-
FA8C74BE2C1B00E600D28220 /* SettingsView.swift */,
1290-
);
1291-
path = Settings;
1292-
sourceTree = "<group>";
1293-
};
12941286
FA8C74C02C4E89A600D28220 /* LongQuests */ = {
12951287
isa = PBXGroup;
12961288
children = (
@@ -1451,6 +1443,22 @@
14511443
path = GoInfoGameUITests;
14521444
sourceTree = "<group>";
14531445
};
1446+
FAE2584C2D39816600D2BB12 /* QuestCategory */ = {
1447+
isa = PBXGroup;
1448+
children = (
1449+
FAE2584D2D39817E00D2BB12 /* UI */,
1450+
);
1451+
path = QuestCategory;
1452+
sourceTree = "<group>";
1453+
};
1454+
FAE2584D2D39817E00D2BB12 /* UI */ = {
1455+
isa = PBXGroup;
1456+
children = (
1457+
FAE2584E2D39819300D2BB12 /* QuestCategoryListView.swift */,
1458+
);
1459+
path = UI;
1460+
sourceTree = "<group>";
1461+
};
14541462
FAFDA1FB2C6D321500ECEAE9 /* Login */ = {
14551463
isa = PBXGroup;
14561464
children = (
@@ -2041,7 +2049,6 @@
20412049
971F9FE42B84CDBF005397CC /* CrossingType.swift in Sources */,
20422050
97AC1C062B6A45B0004F0BF4 /* SideWalkValidation.swift in Sources */,
20432051
FAD5C4F32AFCBE700040C61A /* AppDelegate.swift in Sources */,
2044-
FA8C74BF2C1B00E600D28220 /* SettingsView.swift in Sources */,
20452052
18EC425C2B84987200DE05D7 /* TactilePavingCrosswalkForm.swift in Sources */,
20462053
05DBBB622B164D9A00B6F110 /* RealOPElement.swift in Sources */,
20472054
973FC0422B59467A00878269 /* BusStopLit.swift in Sources */,
@@ -2071,6 +2078,7 @@
20712078
97412A9B2BBBF3B400DF7983 /* KerbHeightForm.swift in Sources */,
20722079
FA8C74C42C4FDE1000D28220 /* LongFormModel.swift in Sources */,
20732080
973FC04A2B5A478C00878269 /* CrossMarkingForm.swift in Sources */,
2081+
FAE2584F2D39819300D2BB12 /* QuestCategoryListView.swift in Sources */,
20742082
FA8C74E32C639BA300D28220 /* LongCrossingQuest.swift in Sources */,
20752083
973FC03F2B59418B00878269 /* WayLit.swift in Sources */,
20762084
971342772BBD415600174EBF /* InitialViewController.swift in Sources */,

GoInfoGame/GoInfoGame/UI/MapViewController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class MapViewController: UIHostingController<MapView> {
2424
let profileButton = UIBarButtonItem(image: UIImage(systemName: "person.crop.circle.fill"), style: .plain, target: self, action: #selector(profileButtonTapped))
2525
navigationItem.leftBarButtonItem = profileButton
2626

27-
let settingsButton = UIBarButtonItem(image: UIImage(systemName: "gearshape.fill"), style: .plain, target: self, action: #selector(settingsButtonTapped))
28-
navigationItem.rightBarButtonItem = settingsButton
27+
// let settingsButton = UIBarButtonItem(image: UIImage(systemName: "gearshape.fill"), style: .plain, target: self, action: #selector(settingsButtonTapped))
28+
// navigationItem.rightBarButtonItem = settingsButton
2929
}
3030

3131

@@ -45,11 +45,11 @@ class MapViewController: UIHostingController<MapView> {
4545
navigationController?.pushViewController(hostingController, animated: true)
4646
}
4747

48-
@objc func settingsButtonTapped() {
49-
let settingsView = SettingsView()
50-
let hostingController = UIHostingController(rootView: settingsView)
51-
navigationController?.pushViewController(hostingController, animated: true)
52-
}
48+
// @objc func settingsButtonTapped() {
49+
// let settingsView = QuestCategoryListView()
50+
// let hostingController = UIHostingController(rootView: settingsView)
51+
// navigationController?.pushViewController(hostingController, animated: true)
52+
// }
5353

5454

5555

GoInfoGame/GoInfoGame/UI/Settings/SettingsView.swift

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//
2+
// QuestCategoryListView.swift
3+
// GoInfoGame
4+
//
5+
// Created by Achyut Kumar M on 16/01/25.
6+
//
7+
8+
import SwiftUI
9+
10+
struct QuestCategoryListView: View {
11+
@ObservedObject var questManager = QuestsRepository.shared
12+
13+
var body: some View {
14+
VStack {
15+
List {
16+
ForEach(questManager.allQuests.indices, id: \.self) { index in
17+
HStack {
18+
Image(uiImage: questManager.allQuests[index].quest.icon)
19+
.resizable()
20+
.aspectRatio(contentMode: .fit)
21+
.frame(width: 30, height: 30)
22+
23+
Text(questManager.allQuests[index].quest.title)
24+
25+
Button(action: {
26+
questManager.allQuests[index].toggleIsDefault()
27+
}) {
28+
CheckBoxView(isChecked: questManager.allQuests[index].isDefault)
29+
}
30+
}
31+
}
32+
}
33+
.navigationTitle("Quest Selection")
34+
.onDisappear {
35+
QuestsPublisher.shared.refreshQuest.send("")
36+
}
37+
}
38+
}
39+
}
40+
41+
struct CheckBoxView: View {
42+
43+
let isChecked: Bool;
44+
45+
var body: some View {
46+
Image(systemName: isChecked ? "checkmark.square.fill" : "square")
47+
.foregroundColor(isChecked ? Color(UIColor.systemBlue) : Color.secondary)
48+
}
49+
}
50+
51+
52+
#Preview {
53+
QuestCategoryListView()
54+
}
55+

GoInfoGame/GoInfoGame/quests/QuestsRepository.swift

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,35 @@ class QuestsRepository: ObservableObject {
5656
return longQuestModels.first(where: { $0.elementType.lowercased() == "crossings" })
5757
}
5858

59-
@Published var applicableQuests: [ApplicableQuest] = [
60-
ApplicableQuest(quest: LongSidewalkQuest(), questId: "1"),
61-
ApplicableQuest(quest: LongKerbQuest(), questId: "1"),
62-
ApplicableQuest(quest: LongCrossingQuest(), questId: "2")
59+
@Published var allQuests: [ApplicableQuest] = [
60+
ApplicableQuest(quest: LongSidewalkQuest(), questId: "1"),
61+
ApplicableQuest(quest: LongKerbQuest(), questId: "2"),
62+
ApplicableQuest(quest: LongCrossingQuest(), questId: "3")
63+
]
6364

64-
65-
66-
// ApplicableQuest(quest: CrossingType(), questId: "1"),
67-
// ApplicableQuest(quest: CrossingIsland(), questId: "8"),
68-
// ApplicableQuest(quest: CrossMarking(), questId: "10"),
69-
//// ApplicableQuest(quest: SidewalkSurface(), questId: "31"),
70-
// ApplicableQuest(quest: StairFlights(), questId: "4"),
71-
// ApplicableQuest(quest: TactilePavingSteps(), questId: "27"),
72-
//// ApplicableQuest(quest: SideWalkWidth(), questId: "3"),
73-
// ApplicableQuest(quest: StepsIncline(), questId: "32"),
74-
// ApplicableQuest(quest: TactilePavingCrosswalk(), questId: "14"),
75-
// ApplicableQuest(quest: CrossingKerbHeight(), questId: "9"),
76-
// ApplicableQuest(quest: KerbHeight(), questId: "19")
77-
]
65+
var applicableQuests: [ApplicableQuest] {
66+
allQuests.filter { $0.isDefault }
67+
}
68+
69+
// @Published var applicableQuests: [ApplicableQuest] = [
70+
// ApplicableQuest(quest: LongSidewalkQuest(), questId: "1"),
71+
// ApplicableQuest(quest: LongKerbQuest(), questId: "1"),
72+
// ApplicableQuest(quest: LongCrossingQuest(), questId: "2")
73+
//
74+
//
75+
//
76+
//// ApplicableQuest(quest: CrossingType(), questId: "1"),
77+
//// ApplicableQuest(quest: CrossingIsland(), questId: "8"),
78+
//// ApplicableQuest(quest: CrossMarking(), questId: "10"),
79+
////// ApplicableQuest(quest: SidewalkSurface(), questId: "31"),
80+
//// ApplicableQuest(quest: StairFlights(), questId: "4"),
81+
//// ApplicableQuest(quest: TactilePavingSteps(), questId: "27"),
82+
////// ApplicableQuest(quest: SideWalkWidth(), questId: "3"),
83+
//// ApplicableQuest(quest: StepsIncline(), questId: "32"),
84+
//// ApplicableQuest(quest: TactilePavingCrosswalk(), questId: "14"),
85+
//// ApplicableQuest(quest: CrossingKerbHeight(), questId: "9"),
86+
//// ApplicableQuest(quest: KerbHeight(), questId: "19")
87+
// ]
7888

7989
// @Published var applicableQuests: [ApplicableQuest] = [
8090
// ApplicableQuest(quest: LongSidewalkQuest(), questId: "1"),

0 commit comments

Comments
 (0)