Skip to content

Commit

Permalink
Spot the Seal (#50)
Browse files Browse the repository at this point in the history
* Added initial Spot the Seal concept

* Fix issue with order of navigatio

* Move destination inside the PuzzlePageView

* Added puzzles to data model

* Don’t add puzzles in the asset catalog

* Added decryption of hints

* Stamping current puzzle when url opened

* Improve stamp colors

* Remove cruft and add comment

* Hide spot the seal when no seals found

* Show checkmark when found solution

* Orange seal

* Store puzzles in the appDataModel

* Added error when decrypting

* Saving and showing hints

* Fixed recursive navigation

* Add initial hint

* Added more puzzles

* Remove unused PDF

* Add last puzzle

* Support dark mode better

* Add tip and answerLength

* Order puzzles

* Update pdf background based on color scheme

* Reset all

* Better colors

* Dark mode support

* Add tint color and move environmentObject to the right place

* Green checkmark

* Replace button with magic url

* Fix tests

* Remove whitespace 🐳

* Remove cruft

* Remove reset button

* Remove outdated comment

* Add comment about puzzle states

* Remove extra whitespace 🐳
  • Loading branch information
nvh authored Aug 30, 2023
1 parent 0fd1ed9 commit 3029e9a
Show file tree
Hide file tree
Showing 31 changed files with 618 additions and 1 deletion.
80 changes: 80 additions & 0 deletions SwiftIslandApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@
2AEDC4C32A4A089100CD0180 /* ConferencePageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AEDC4C22A4A089100CD0180 /* ConferencePageView.swift */; };
2AEDC4C62A4A08AF00CD0180 /* TabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AEDC4C52A4A08AF00CD0180 /* TabBarView.swift */; };
2AF19ED32A7B04A500134E0B /* ConferencePageContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AF19ED22A7B04A500134E0B /* ConferencePageContentView.swift */; };
B332ADF72A9A813C00557AA7 /* truchet-tiles.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B332ADF12A9A813900557AA7 /* truchet-tiles.pdf */; };
B332ADF82A9A813C00557AA7 /* double-names.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B332ADF22A9A813B00557AA7 /* double-names.pdf */; };
B332ADF92A9A813C00557AA7 /* valuta.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B332ADF32A9A813B00557AA7 /* valuta.pdf */; };
B332ADFA2A9A813C00557AA7 /* game-of-life.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B332ADF42A9A813B00557AA7 /* game-of-life.pdf */; };
B332ADFB2A9A813C00557AA7 /* marquee.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B332ADF52A9A813C00557AA7 /* marquee.pdf */; };
B332ADFC2A9A813C00557AA7 /* mills.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B332ADF62A9A813C00557AA7 /* mills.pdf */; };
B340138F2A9EA479008A9C21 /* rebus.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B340138E2A9EA479008A9C21 /* rebus.pdf */; };
B35057F12A9DD19700B71436 /* elements.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B35057F02A9DD19700B71436 /* elements.pdf */; };
B35057F32A9DD1F900B71436 /* the-key.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B35057F22A9DD1F900B71436 /* the-key.pdf */; };
B35057F52A9DD20800B71436 /* safe.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B35057F42A9DD20800B71436 /* safe.pdf */; };
B35057F92A9DD23C00B71436 /* farmers-wedding.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B35057F82A9DD23C00B71436 /* farmers-wedding.pdf */; };
B35057FB2A9DD24400B71436 /* mystery-museum.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B35057FA2A9DD24400B71436 /* mystery-museum.pdf */; };
B354DDE52A9BEEE700C24461 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B354DDE42A9BEEE700C24461 /* Utils.swift */; };
B3733D772A9951B10069D490 /* PuzzleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3733D732A9951B10069D490 /* PuzzleView.swift */; };
B3733D792A9951B10069D490 /* PuzzleItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3733D752A9951B10069D490 /* PuzzleItemView.swift */; };
B3733D7A2A9951B10069D490 /* PuzzlePageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3733D762A9951B10069D490 /* PuzzlePageView.swift */; };
B3C626422A942291002754A8 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3C626412A942291002754A8 /* WebView.swift */; };
B3C626442A94956A002754A8 /* TicketEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3C626432A94956A002754A8 /* TicketEditView.swift */; };
B3F443032A9765E700AFDF43 /* TicketAddButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3F443022A9765E700AFDF43 /* TicketAddButton.swift */; };
Expand Down Expand Up @@ -191,6 +207,22 @@
2AEDC4C22A4A089100CD0180 /* ConferencePageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConferencePageView.swift; sourceTree = "<group>"; };
2AEDC4C52A4A08AF00CD0180 /* TabBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarView.swift; sourceTree = "<group>"; };
2AF19ED22A7B04A500134E0B /* ConferencePageContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConferencePageContentView.swift; sourceTree = "<group>"; };
B332ADF12A9A813900557AA7 /* truchet-tiles.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "truchet-tiles.pdf"; sourceTree = "<group>"; };
B332ADF22A9A813B00557AA7 /* double-names.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "double-names.pdf"; sourceTree = "<group>"; };
B332ADF32A9A813B00557AA7 /* valuta.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = valuta.pdf; sourceTree = "<group>"; };
B332ADF42A9A813B00557AA7 /* game-of-life.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "game-of-life.pdf"; sourceTree = "<group>"; };
B332ADF52A9A813C00557AA7 /* marquee.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = marquee.pdf; sourceTree = "<group>"; };
B332ADF62A9A813C00557AA7 /* mills.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = mills.pdf; sourceTree = "<group>"; };
B340138E2A9EA479008A9C21 /* rebus.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = rebus.pdf; sourceTree = "<group>"; };
B35057F02A9DD19700B71436 /* elements.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = elements.pdf; sourceTree = "<group>"; };
B35057F22A9DD1F900B71436 /* the-key.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "the-key.pdf"; sourceTree = "<group>"; };
B35057F42A9DD20800B71436 /* safe.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = safe.pdf; sourceTree = "<group>"; };
B35057F82A9DD23C00B71436 /* farmers-wedding.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "farmers-wedding.pdf"; sourceTree = "<group>"; };
B35057FA2A9DD24400B71436 /* mystery-museum.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "mystery-museum.pdf"; sourceTree = "<group>"; };
B354DDE42A9BEEE700C24461 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
B3733D732A9951B10069D490 /* PuzzleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PuzzleView.swift; sourceTree = "<group>"; };
B3733D752A9951B10069D490 /* PuzzleItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PuzzleItemView.swift; sourceTree = "<group>"; };
B3733D762A9951B10069D490 /* PuzzlePageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PuzzlePageView.swift; sourceTree = "<group>"; };
B3C626412A942291002754A8 /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = "<group>"; };
B3C626432A94956A002754A8 /* TicketEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TicketEditView.swift; sourceTree = "<group>"; };
B3F443022A9765E700AFDF43 /* TicketAddButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TicketAddButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -241,6 +273,7 @@
2A16EB372A4CDB0400CC881D /* Resources */ = {
isa = PBXGroup;
children = (
B332ADF02A9A812500557AA7 /* Puzzles */,
2A16EB382A4CDB3600CC881D /* Fonts */,
2AECBFB42A95DB43001FBFA9 /* Secrets.json */,
);
Expand Down Expand Up @@ -405,6 +438,7 @@
2AC7DD0C2A59F36C00DB9F6D /* Practical */ = {
isa = PBXGroup;
children = (
B3733D722A9951600069D490 /* Spot the Seal */,
B3F7EEF52A86D6C5001D69B6 /* Tickets */,
2A18CE402A773CFE00969214 /* Practical */,
2A7F127D2A6488E2007C28EA /* Map */,
Expand Down Expand Up @@ -541,6 +575,36 @@
path = Common;
sourceTree = "<group>";
};
B332ADF02A9A812500557AA7 /* Puzzles */ = {
isa = PBXGroup;
children = (
B340138E2A9EA479008A9C21 /* rebus.pdf */,
B35057FA2A9DD24400B71436 /* mystery-museum.pdf */,
B35057F82A9DD23C00B71436 /* farmers-wedding.pdf */,
B35057F42A9DD20800B71436 /* safe.pdf */,
B35057F22A9DD1F900B71436 /* the-key.pdf */,
B35057F02A9DD19700B71436 /* elements.pdf */,
B332ADF22A9A813B00557AA7 /* double-names.pdf */,
B332ADF42A9A813B00557AA7 /* game-of-life.pdf */,
B332ADF52A9A813C00557AA7 /* marquee.pdf */,
B332ADF62A9A813C00557AA7 /* mills.pdf */,
B332ADF12A9A813900557AA7 /* truchet-tiles.pdf */,
B332ADF32A9A813B00557AA7 /* valuta.pdf */,
);
path = Puzzles;
sourceTree = "<group>";
};
B3733D722A9951600069D490 /* Spot the Seal */ = {
isa = PBXGroup;
children = (
B3733D762A9951B10069D490 /* PuzzlePageView.swift */,
B3733D752A9951B10069D490 /* PuzzleItemView.swift */,
B3733D732A9951B10069D490 /* PuzzleView.swift */,
B354DDE42A9BEEE700C24461 /* Utils.swift */,
);
path = "Spot the Seal";
sourceTree = "<group>";
};
B3F7EEF52A86D6C5001D69B6 /* Tickets */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -684,11 +748,23 @@
files = (
2A16EB3B2A4CDB3600CC881D /* WorkSans-Regular.ttf in Resources */,
2AEDC49E2A4A031000CD0180 /* Preview Assets.xcassets in Resources */,
B332ADF82A9A813C00557AA7 /* double-names.pdf in Resources */,
B332ADFB2A9A813C00557AA7 /* marquee.pdf in Resources */,
2A16EB642A4F6CC200CC881D /* GoogleService-Info.plist in Resources */,
2A37FB982A7D3EFC0062E63A /* Acknowledgements.plist in Resources */,
2AEDC49B2A4A031000CD0180 /* Assets.xcassets in Resources */,
B340138F2A9EA479008A9C21 /* rebus.pdf in Resources */,
B332ADFA2A9A813C00557AA7 /* game-of-life.pdf in Resources */,
B332ADFC2A9A813C00557AA7 /* mills.pdf in Resources */,
B35057F32A9DD1F900B71436 /* the-key.pdf in Resources */,
2AECBFB52A95DD58001FBFA9 /* Secrets.json in Resources */,
B332ADF72A9A813C00557AA7 /* truchet-tiles.pdf in Resources */,
B35057F12A9DD19700B71436 /* elements.pdf in Resources */,
B35057F92A9DD23C00B71436 /* farmers-wedding.pdf in Resources */,
2A16EB3C2A4CDB3600CC881D /* WorkSans-Bold.ttf in Resources */,
B332ADF92A9A813C00557AA7 /* valuta.pdf in Resources */,
B35057FB2A9DD24400B71436 /* mystery-museum.pdf in Resources */,
B35057F52A9DD20800B71436 /* safe.pdf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -745,8 +821,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B3733D772A9951B10069D490 /* PuzzleView.swift in Sources */,
2A7F12982A6B19E0007C28EA /* SwiftIslandLogo.swift in Sources */,
2AEDC4C32A4A089100CD0180 /* ConferencePageView.swift in Sources */,
B3733D792A9951B10069D490 /* PuzzleItemView.swift in Sources */,
2A7F12792A640730007C28EA /* ScrollViewOffset.swift in Sources */,
2A16EB362A4CDA4200CC881D /* ConferenceHeaderView.swift in Sources */,
B3C626442A94956A002754A8 /* TicketEditView.swift in Sources */,
Expand All @@ -772,6 +850,7 @@
2A7F12852A65DBEA007C28EA /* LocationManager.swift in Sources */,
2AC7DD092A58CFDD00DB9F6D /* ConferenceBoxFAQItem.swift in Sources */,
2A37FB6A2A7B06AE0062E63A /* ConferenceBoxMentors.swift in Sources */,
B354DDE52A9BEEE700C24461 /* Utils.swift in Sources */,
B3C626422A942291002754A8 /* WebView.swift in Sources */,
2AC7DCF12A58B5E600DB9F6D /* ConferenceBoxFAQ.swift in Sources */,
2A17F0C22A6075BF0055E214 /* MentorView.swift in Sources */,
Expand All @@ -780,6 +859,7 @@
2A7F128D2A69CC39007C28EA /* Defaults.swift in Sources */,
2ACF55A42A605BA300C051FC /* GettingThereMapView.swift in Sources */,
2A7F127F2A6488EC007C28EA /* RequestLocationView.swift in Sources */,
B3733D7A2A9951B10069D490 /* PuzzlePageView.swift in Sources */,
2A7F12812A64891F007C28EA /* LinearGradient.swift in Sources */,
2AE440042A705C8B009078E3 /* ScheduleView.swift in Sources */,
2AE4400E2A717CE4009078E3 /* EventView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "frame.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "seal.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "stamp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions SwiftIslandApp/MainApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct MainApp: App {
@State private var appActionTriggered: AppActions? = nil
@State private var showTicketAlert: Bool = false
@State private var showTicketMessage: String = ""
@State private var currentPuzzleSlug: String?

var body: some Scene {
WindowGroup {
Expand All @@ -40,6 +41,15 @@ struct MainApp: App {
handleOpenURL(url)
}
}
.sheet(isPresented: .constant(currentPuzzleSlug != nil), onDismiss: {
currentPuzzleSlug = nil
}) {
NavigationStack {
PuzzlePageView(currentPuzzleSlug: $currentPuzzleSlug.wrappedValue)
}
.tint(.questionMarkColor)
.environmentObject(appDataModel)
}
// TODO: Make this a navigation path to the actual ticket
.alert("Ticket Added", isPresented: $showTicketAlert, actions: {
Button("OK") {
Expand Down Expand Up @@ -75,7 +85,19 @@ private extension MainApp {
print(error)
}
}
case .seal(let slug):
if slug == "reset" {
Defaults.reset(.puzzleStatus)
Defaults.reset(.puzzleHints)
} else {
let currentStatus = Defaults[.puzzleStatus][slug]
if currentStatus == nil || currentStatus == .NotFound {
Defaults[.puzzleStatus][slug] = .Found
}
}
currentPuzzleSlug = slug
}

}

func handleAppAction(_ appAction: AppActions) {
Expand Down Expand Up @@ -107,6 +129,7 @@ private extension MainApp {
enum URLTask {
case action(appAction: AppActions)
case ticket(slug: String)
case seal(slug: String)

init?(rawValue: URLQueryItem) {
switch rawValue.name {
Expand All @@ -116,6 +139,9 @@ enum URLTask {
case "ticket":
guard let value = rawValue.value else { return nil }
self = .ticket(slug: value)
case "seal":
guard let value = rawValue.value else { return nil }
self = .seal(slug: value)
default:
return nil
}
Expand Down
19 changes: 19 additions & 0 deletions SwiftIslandApp/Pages/Practical/PracticalPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum NavigationPage {
case acknowledgement
case source
case tickets
case spotTheSeal
}

struct PracticalPageView: View {
Expand Down Expand Up @@ -133,8 +134,11 @@ struct PracticalPageView: View {
}
case .source:
SourceView()
case .spotTheSeal:
PuzzlePageView()
}
}

}
.tint(.questionMarkColor)
}
Expand Down Expand Up @@ -168,6 +172,7 @@ struct PracticalPageView_Previews: PreviewProvider {
struct SectionAtTheConference: View {
let iconMaxWidth: CGFloat
@EnvironmentObject private var appDataModel: AppDataModel
@Default(.puzzleStatus) var puzzleStatus

@Binding var navPath: NavigationPath

Expand Down Expand Up @@ -197,6 +202,20 @@ struct SectionAtTheConference: View {
}
}
}
if (!puzzleStatus.isEmpty) {
NavigationLink(value: NavigationPage.spotTheSeal) {
HStack {
Image("seal")
.resizable()
.renderingMode(.template)
.foregroundColor(.questionMarkColor)
.aspectRatio(contentMode:.fit)
.frame(maxWidth: iconMaxWidth)
Text("Spot the Seal")
.dynamicTypeSize(.small ... .medium)
}
}
}
}
}
}
Expand Down
Loading

0 comments on commit 3029e9a

Please sign in to comment.