Skip to content

Commit 1b26ecb

Browse files
authored
Merge pull request #63 from TaskarCenterAtUW/feature-crossing-island
Feature crossing island & Custom Sure Alert changes
2 parents e1420dc + ec4a537 commit 1b26ecb

File tree

13 files changed

+169
-56
lines changed

13 files changed

+169
-56
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +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-
971F9FDC2B836DF3005397CC /* CustomNoteAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971F9FDB2B836DF3005397CC /* CustomNoteAlert.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 */; };
3536
972454152B14A49A0036B91A /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 972454142B14A49A0036B91A /* Extensions.swift */; };
3637
973FBFFE2B46BB3800878269 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 973FBFFD2B46BB3800878269 /* Utils.swift */; };
3738
973FC0012B46CD5D00878269 /* QuestsListUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 973FC0002B46CD5D00878269 /* QuestsListUIView.swift */; };
@@ -282,7 +283,8 @@
282283
970D5BD42B677CC500C20BE7 /* OSMUserData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSMUserData.swift; sourceTree = "<group>"; };
283284
971575162B5FFD6F0044797C /* MapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapView.swift; sourceTree = "<group>"; };
284285
971575182B5FFE910044797C /* LocationManagerCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationManagerCoordinator.swift; sourceTree = "<group>"; };
285-
971F9FDB2B836DF3005397CC /* CustomNoteAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomNoteAlert.swift; sourceTree = "<group>"; };
286+
971F9FDE2B847349005397CC /* CrossingIslandForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrossingIslandForm.swift; sourceTree = "<group>"; };
287+
971F9FE02B847358005397CC /* CrossingIsland.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrossingIsland.swift; sourceTree = "<group>"; };
286288
972454142B14A49A0036B91A /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
287289
973FBFFD2B46BB3800878269 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
288290
973FC0002B46CD5D00878269 /* QuestsListUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuestsListUIView.swift; sourceTree = "<group>"; };
@@ -649,6 +651,15 @@
649651
path = Map;
650652
sourceTree = "<group>";
651653
};
654+
971F9FDD2B847318005397CC /* CrossingIsland */ = {
655+
isa = PBXGroup;
656+
children = (
657+
971F9FDE2B847349005397CC /* CrossingIslandForm.swift */,
658+
971F9FE02B847358005397CC /* CrossingIsland.swift */,
659+
);
660+
path = CrossingIsland;
661+
sourceTree = "<group>";
662+
};
652663
973FBFFF2B46CD4100878269 /* QuestsList */ = {
653664
isa = PBXGroup;
654665
children = (
@@ -670,7 +681,6 @@
670681
97AC1C092B6B7F10004F0BF4 /* CustomVerticalButtonsList.swift */,
671682
97AC1C0B2B6B843C004F0BF4 /* CustomAlert.swift */,
672683
FABF3CF72B822F120080EAC9 /* CustomSureAlert.swift */,
673-
971F9FDB2B836DF3005397CC /* CustomNoteAlert.swift */,
674684
);
675685
path = CustomComponents;
676686
sourceTree = "<group>";
@@ -972,6 +982,7 @@
972982
A4E7119C2B57A22300C9DE08 /* quests */ = {
973983
isa = PBXGroup;
974984
children = (
985+
971F9FDD2B847318005397CC /* CrossingIsland */,
975986
97AC1C1F2B726A9F004F0BF4 /* TactilePavingKerb */,
976987
97AC1C0D2B70CED0004F0BF4 /* SidewalkSurface */,
977988
97AC1C042B6A44C1004F0BF4 /* SideWalkValidation */,
@@ -1637,15 +1648,16 @@
16371648
973FC0032B47DE0700878269 /* QuestsVM.swift in Sources */,
16381649
A4E711AE2B59004700C9DE08 /* StepsIncline.swift in Sources */,
16391650
973FC0142B4D353800878269 /* SideWalkWidthForm.swift in Sources */,
1640-
971F9FDC2B836DF3005397CC /* CustomNoteAlert.swift in Sources */,
16411651
971575172B5FFD6F0044797C /* MapView.swift in Sources */,
16421652
973FC04A2B5A478C00878269 /* CrossMarkingForm.swift in Sources */,
16431653
973FC03F2B59418B00878269 /* WayLit.swift in Sources */,
16441654
A40004EC2B62338400AF21FB /* AppQuestManager.swift in Sources */,
16451655
FA5853C12B21F17F00301CDA /* OnboardingView.swift in Sources */,
16461656
A4B83AF32B5F9385006684CA /* StoredWay.swift in Sources */,
1657+
971F9FDF2B847349005397CC /* CrossingIslandForm.swift in Sources */,
16471658
05DBBB5F2B1263FF00B6F110 /* DatabaseConnector.swift in Sources */,
16481659
FAF44FC12B30850A004FE664 /* OnboardingView3.swift in Sources */,
1660+
971F9FE12B847358005397CC /* CrossingIsland.swift in Sources */,
16491661
970D5BD12B62B61300C20BE7 /* MapViewController.swift in Sources */,
16501662
0536DD972B0BD95100B04C4B /* URLSession+Extension.swift in Sources */,
16511663
973FC04C2B5A5F5F00878269 /* RadioItem.swift in Sources */,

GoInfoGame/GoInfoGame/Helpers/LocalizedStrings.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ enum LocalizedStrings: String {
8585
case questStepsRampSeparateWheelchair = "quest_steps_ramp_separate_wheelchair"
8686
case questStepsRampSeparateWheelchairConfirm = "quest_steps_ramp_separate_wheelchair_confirm"
8787
case questStepsRampSeparateWheelchairDecline = "quest_steps_ramp_separate_wheelchair_decline"
88+
case questPedestrianCrossingIsland = "quest_pedestrian_crossing_island"
8889
case dontShowAgain = "dont_show_again"
90+
case questTactilePavingKerbTitle = "quest_tactile_paving_kerb_title"
8991

9092
var localized: String {
9193
return NSLocalizedString(rawValue, comment: "")
9294
}
9395
}
94-
95-
//"quest_step_count_title"= "How many steps are here?"
96-
//"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/UI/CustomComponents/CustomNoteAlert.swift

Lines changed: 0 additions & 29 deletions
This file was deleted.

GoInfoGame/GoInfoGame/UI/CustomComponents/CustomSureAlert.swift

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,31 @@
88
import SwiftUI
99

1010
struct CustomSureAlert: View {
11-
let onCancel: () -> Void
12-
let onConfirm: () -> Void
11+
let alertTitle: String /// Title of the alert
12+
let content: String /// Main content of the alert
13+
let leftBtnLabel: String /// Label for the left button (usually cancel)
14+
let rightBtnLabel: String /// Label for the right button (usually confirm)
15+
let isDontShowCheckVisible: Bool /// Flag indicating if the "Don't show again" checkbox should be visible
16+
let onCancel: () -> Void /// Closure to handle cancel action
17+
let onConfirm: () -> Void /// Closure to handle confirm action
1318

1419
var body: some View {
15-
CustomAlert(title: LocalizedStrings.questSourceDialogTitle.localized, content: {
20+
CustomAlert(title: alertTitle, content: {
1621
VStack {
17-
Text(LocalizedStrings.questSourceDialogNote.localized)
22+
Text(content)
1823
Spacer()
19-
HStack {
20-
Image(systemName: "square")
21-
.foregroundColor(.gray)
22-
Text(LocalizedStrings.dontShowAgain.localized)
24+
if isDontShowCheckVisible {
25+
HStack {
26+
Image(systemName: "square")
27+
.foregroundColor(.gray)
28+
Text(LocalizedStrings.dontShowAgain.localized)
29+
}
2330
}
2431
}
25-
}, leftActionText: LocalizedStrings.undoConfirmNegative.localized, rightActionText: LocalizedStrings.questGenericConfirmationYes.localized, leftButtonAction: onCancel, rightButtonAction: onConfirm, height: 200, width: 270)
32+
}, leftActionText: leftBtnLabel, rightActionText: rightBtnLabel, leftButtonAction: onCancel, rightButtonAction: onConfirm, height: 200, width: 270)
2633
}
2734
}
2835

2936
#Preview {
30-
CustomSureAlert(onCancel: {}, onConfirm: {})
37+
CustomSureAlert(alertTitle: "", content: LocalizedStrings.questSourceDialogNote.localized,leftBtnLabel: "", rightBtnLabel: "", isDontShowCheckVisible: true, onCancel: {}, onConfirm: {})
3138
}

GoInfoGame/GoInfoGame/en.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,7 @@
8484
"quest_steps_ramp_separate_wheelchair" = "Is the wheelchair ramp displayed as a separate way on the map?";
8585
"quest_steps_ramp_separate_wheelchair_confirm" = "separate";
8686
"quest_steps_ramp_separate_wheelchair_decline" = "not separate";
87+
"quest_pedestrian_crossing_island" = "Does this pedestrian crossing have an island?";
8788
"dont_show_again" = "Don't show again for this session";
89+
"quest_tactile_paving_kerb_title" = "Is there tactile paving on this curb here?";
8890

GoInfoGame/GoInfoGame/quests/BusStopLit/BusStopLitForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct BusStopLitForm: View, QuestForm {
3333
.shadow(color: .gray, radius: 2, x: 0, y: 2))
3434
}.padding()
3535
if isShowingAreYouSure {
36-
CustomSureAlert(onCancel: {
36+
CustomSureAlert(alertTitle: LocalizedStrings.questSourceDialogTitle.localized, content: LocalizedStrings.questSourceDialogNote.localized,leftBtnLabel: LocalizedStrings.undoConfirmNegative.localized, rightBtnLabel:LocalizedStrings.questGenericConfirmationYes.localized, isDontShowCheckVisible: true,onCancel: {
3737
self.isShowingAreYouSure = false
3838
}, onConfirm: {
3939
self.isShowingAreYouSure = false
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: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
@State private var showOtherAlert = false
19+
20+
var body: some View {
21+
ZStack {
22+
VStack{
23+
QuestionHeader(icon: Image("ic_quest_pedestrian_crossing_island"),
24+
title: LocalizedStrings.questPedestrianCrossingIsland.localized,
25+
subtitle: "Unmarked Crossing")
26+
YesNoView(actionBtnLabel: LocalizedStrings.cantSay.localized, action: { answer in
27+
self.selectedAnswer = answer
28+
if answer == .yes || answer == .no {
29+
self.isShowingAreYouSure.toggle()
30+
} else if answer == .other {
31+
self.showOtherAlert.toggle()
32+
}
33+
})
34+
.background(
35+
RoundedRectangle(cornerRadius: 10)
36+
.fill(Color.white)
37+
.shadow(color: .gray, radius: 2, x: 0, y: 2))
38+
}.padding()
39+
if isShowingAreYouSure {
40+
CustomSureAlert(alertTitle: LocalizedStrings.questSourceDialogTitle.localized, content: LocalizedStrings.questSourceDialogNote.localized,leftBtnLabel: LocalizedStrings.undoConfirmNegative.localized, rightBtnLabel:LocalizedStrings.questGenericConfirmationYes.localized, isDontShowCheckVisible: true,onCancel: {
41+
self.isShowingAreYouSure = false
42+
}, onConfirm: {
43+
self.isShowingAreYouSure = false
44+
self.action?(selectedAnswer)
45+
})
46+
.zIndex(1)
47+
}
48+
/// if user selects other answers option
49+
if showOtherAlert {
50+
/// display leave a note instead alert
51+
CustomSureAlert(alertTitle: LocalizedStrings.questLeaveNewNoteTitle.localized, content: LocalizedStrings.questLeaveNewNoteDescription.localized,leftBtnLabel: LocalizedStrings.questLeaveNewNoteNo.localized, rightBtnLabel:LocalizedStrings.questLeaveNewNoteYes.localized, isDontShowCheckVisible: false, onCancel: {
52+
self.showOtherAlert = false
53+
}, onConfirm: {
54+
self.showOtherAlert = false
55+
})
56+
}
57+
}
58+
}
59+
}
60+
61+
#Preview {
62+
CrossingIslandForm()
63+
}

GoInfoGame/GoInfoGame/quests/Handrail/HandRailForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct HandRailForm: View, QuestForm {
3030
.shadow(color: .gray, radius: 2, x: 0, y: 2))
3131
}.padding()
3232
if isShowingAreYouSure {
33-
CustomSureAlert(onCancel: {
33+
CustomSureAlert(alertTitle: LocalizedStrings.questSourceDialogTitle.localized, content: LocalizedStrings.questSourceDialogNote.localized,leftBtnLabel: LocalizedStrings.undoConfirmNegative.localized, rightBtnLabel:LocalizedStrings.questGenericConfirmationYes.localized, isDontShowCheckVisible: true,onCancel: {
3434
self.isShowingAreYouSure = false
3535
}, onConfirm: {
3636
self.isShowingAreYouSure = false

GoInfoGame/GoInfoGame/quests/QuestsRepository.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class QuestsRepository {
2424
CrossMarking(),
2525
SideWalkValidation(),
2626
SidewalkSurface(),
27-
TactilePavingKerb()
27+
TactilePavingKerb(),
28+
CrossingIsland()
2829
]
2930

3031
var displayQuests: [DisplayUnit] {

0 commit comments

Comments
 (0)