Skip to content

Commit 025c987

Browse files
committed
Added Crossing island UI and strings
1 parent c04fc73 commit 025c987

File tree

6 files changed

+129
-4
lines changed

6 files changed

+129
-4
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
970D5BD52B677CC500C20BE7 /* OSMUserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970D5BD42B677CC500C20BE7 /* OSMUserData.swift */; };
3232
971575172B5FFD6F0044797C /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971575162B5FFD6F0044797C /* MapView.swift */; };
3333
971575192B5FFE910044797C /* LocationManagerCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971575182B5FFE910044797C /* LocationManagerCoordinator.swift */; };
34+
971F9FDF2B847349005397CC /* CrossingIslandForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971F9FDE2B847349005397CC /* CrossingIslandForm.swift */; };
35+
971F9FE12B847358005397CC /* CrossingIsland.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971F9FE02B847358005397CC /* CrossingIsland.swift */; };
3436
972454152B14A49A0036B91A /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 972454142B14A49A0036B91A /* Extensions.swift */; };
3537
973FBFFE2B46BB3800878269 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 973FBFFD2B46BB3800878269 /* Utils.swift */; };
3638
973FC0012B46CD5D00878269 /* QuestsListUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 973FC0002B46CD5D00878269 /* QuestsListUIView.swift */; };
@@ -279,6 +281,8 @@
279281
970D5BD42B677CC500C20BE7 /* OSMUserData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSMUserData.swift; sourceTree = "<group>"; };
280282
971575162B5FFD6F0044797C /* MapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapView.swift; sourceTree = "<group>"; };
281283
971575182B5FFE910044797C /* LocationManagerCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationManagerCoordinator.swift; sourceTree = "<group>"; };
284+
971F9FDE2B847349005397CC /* CrossingIslandForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrossingIslandForm.swift; sourceTree = "<group>"; };
285+
971F9FE02B847358005397CC /* CrossingIsland.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrossingIsland.swift; sourceTree = "<group>"; };
282286
972454142B14A49A0036B91A /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
283287
973FBFFD2B46BB3800878269 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
284288
973FC0002B46CD5D00878269 /* QuestsListUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuestsListUIView.swift; sourceTree = "<group>"; };
@@ -643,6 +647,15 @@
643647
path = Map;
644648
sourceTree = "<group>";
645649
};
650+
971F9FDD2B847318005397CC /* CrossingIsland */ = {
651+
isa = PBXGroup;
652+
children = (
653+
971F9FDE2B847349005397CC /* CrossingIslandForm.swift */,
654+
971F9FE02B847358005397CC /* CrossingIsland.swift */,
655+
);
656+
path = CrossingIsland;
657+
sourceTree = "<group>";
658+
};
646659
973FBFFF2B46CD4100878269 /* QuestsList */ = {
647660
isa = PBXGroup;
648661
children = (
@@ -956,6 +969,7 @@
956969
A4E7119C2B57A22300C9DE08 /* quests */ = {
957970
isa = PBXGroup;
958971
children = (
972+
971F9FDD2B847318005397CC /* CrossingIsland */,
959973
97AC1C0D2B70CED0004F0BF4 /* SidewalkSurface */,
960974
97AC1C042B6A44C1004F0BF4 /* SideWalkValidation */,
961975
973FC0462B5A475C00878269 /* CrossingMarking */,
@@ -1625,8 +1639,10 @@
16251639
A40004EC2B62338400AF21FB /* AppQuestManager.swift in Sources */,
16261640
FA5853C12B21F17F00301CDA /* OnboardingView.swift in Sources */,
16271641
A4B83AF32B5F9385006684CA /* StoredWay.swift in Sources */,
1642+
971F9FDF2B847349005397CC /* CrossingIslandForm.swift in Sources */,
16281643
05DBBB5F2B1263FF00B6F110 /* DatabaseConnector.swift in Sources */,
16291644
FAF44FC12B30850A004FE664 /* OnboardingView3.swift in Sources */,
1645+
971F9FE12B847358005397CC /* CrossingIsland.swift in Sources */,
16301646
970D5BD12B62B61300C20BE7 /* MapViewController.swift in Sources */,
16311647
0536DD972B0BD95100B04C4B /* URLSession+Extension.swift in Sources */,
16321648
973FC04C2B5A5F5F00878269 /* RadioItem.swift in Sources */,

GoInfoGame/GoInfoGame/Helpers/LocalizedStrings.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ enum LocalizedStrings: String {
7878
case questStepsRampSeparateWheelchair = "quest_steps_ramp_separate_wheelchair"
7979
case questStepsRampSeparateWheelchairConfirm = "quest_steps_ramp_separate_wheelchair_confirm"
8080
case questStepsRampSeparateWheelchairDecline = "quest_steps_ramp_separate_wheelchair_decline"
81+
case questPedestrianCrossingIsland = "quest_pedestrian_crossing_island"
8182

8283
var localized: String {
8384
return NSLocalizedString(rawValue, comment: "")
8485
}
8586
}
86-
87-
//"quest_step_count_title"= "How many steps are here?"
88-
//"quest_step_count_stile_hint" = "Just the number of steps to reach the top. If the step count differs on each side, give the higher number."

GoInfoGame/GoInfoGame/en.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@
7777
"quest_steps_ramp_separate_wheelchair" = "Is the wheelchair ramp displayed as a separate way on the map?";
7878
"quest_steps_ramp_separate_wheelchair_confirm" = "separate";
7979
"quest_steps_ramp_separate_wheelchair_decline" = "not separate";
80+
"quest_pedestrian_crossing_island" = "Does this pedestrian crossing have an island?";
8081

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//
2+
// CrossingIsland.swift
3+
// GoInfoGame
4+
//
5+
// Created by Lakshmi Shweta Pochiraju on 20/02/24.
6+
//
7+
8+
import Foundation
9+
import UIKit
10+
import SwiftUI
11+
import osmparser
12+
13+
class CrossingIsland: QuestBase, Quest {
14+
typealias AnswerClass = YesNoAnswer
15+
var relationData: Element? = nil
16+
var _internalExpression: ElementFilterExpression?
17+
var icon: UIImage = #imageLiteral(resourceName: "ic_quest_pedestrian_crossing_island.pdf")
18+
var wikiLink: String = ""
19+
var changesetComment: String = ""
20+
var title: String = "Crossing Island"
21+
var filter: String = ""
22+
var displayUnit: DisplayUnit {
23+
DisplayUnit(title: self.title, description: "",parent: self,sheetSize:.SMALL )
24+
}
25+
var filterExpression: ElementFilterExpression? {
26+
if(_internalExpression != nil){
27+
return _internalExpression
28+
}
29+
else {
30+
_internalExpression = try? filter.toElementFilterExpression()
31+
return _internalExpression
32+
}
33+
}
34+
var form: AnyView {
35+
get{
36+
return AnyView(self.internalForm as! CrossingIslandForm)
37+
}
38+
}
39+
40+
override init() {
41+
super.init()
42+
self.internalForm = CrossingIslandForm(action: { [self] answer in
43+
self.onAnswer(answer: answer)
44+
})
45+
}
46+
47+
func onAnswer(answer: YesNoAnswer) {
48+
if let rData = self.relationData {
49+
self.updateTags(id: rData.id, tags: ["crossing:island":answer.rawValue], type: rData.type)
50+
}
51+
}
52+
53+
func copyWithElement(element: Element) -> any Quest {
54+
let q = CrossingIsland()
55+
q.relationData = element
56+
return q
57+
}
58+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// CrossingIslandForm.swift
3+
// GoInfoGame
4+
//
5+
// Created by Lakshmi Shweta Pochiraju on 20/02/24.
6+
//
7+
8+
import SwiftUI
9+
10+
import SwiftUI
11+
12+
struct CrossingIslandForm: View, QuestForm {
13+
var action: ((YesNoAnswer) -> Void)?
14+
15+
typealias AnswerClass = YesNoAnswer
16+
@State private var isShowingAreYouSure = false
17+
@State private var selectedAnswer: YesNoAnswer = .unknown
18+
19+
var body: some View {
20+
ZStack {
21+
VStack{
22+
QuestionHeader(icon: Image("ic_quest_pedestrian_crossing_island"),
23+
title: LocalizedStrings.questPedestrianCrossingIsland.localized,
24+
subtitle: "Unmarked Crossing")
25+
YesNoView(action: { answer in
26+
self.selectedAnswer = answer
27+
if answer == .yes || answer == .no {
28+
self.isShowingAreYouSure.toggle()
29+
}
30+
})
31+
.background(
32+
RoundedRectangle(cornerRadius: 10)
33+
.fill(Color.white)
34+
.shadow(color: .gray, radius: 2, x: 0, y: 2))
35+
}.padding()
36+
if isShowingAreYouSure {
37+
CustomSureAlert(onCancel: {
38+
self.isShowingAreYouSure = false
39+
}, onConfirm: {
40+
self.isShowingAreYouSure = false
41+
self.action?(selectedAnswer)
42+
})
43+
.zIndex(1)
44+
}
45+
}
46+
}
47+
}
48+
49+
#Preview {
50+
CrossingIslandForm()
51+
}

GoInfoGame/GoInfoGame/quests/QuestsRepository.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class QuestsRepository {
2323
BusStopLit(),
2424
CrossMarking(),
2525
SideWalkValidation(),
26-
SidewalkSurface()
26+
SidewalkSurface(),
27+
CrossingIsland()
2728
]
2829

2930
var displayQuests: [DisplayUnit] {

0 commit comments

Comments
 (0)