From ca8c2cb8c5cd6341540ad026e7540e9f3553353b Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 10 Aug 2023 18:58:48 -0500 Subject: [PATCH] =?UTF-8?q?[ExpFeat]=20Adds=20=E2=80=9CReview=20Save=20Sta?= =?UTF-8?q?tes=E2=80=9D=20to=20fix=20save=20states=20associated=20with=20w?= =?UTF-8?q?rong=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Delta.xcodeproj/project.pbxproj | 4 +++ .../ExperimentalFeatures.swift | 5 ++++ .../Features/ReviewSaveStatesOptions.swift | 30 +++++++++++++++++++ .../FeatureDetailView.swift | 26 ++++++++++++---- 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 Delta/Experimental Features/Features/ReviewSaveStatesOptions.swift diff --git a/Delta.xcodeproj/project.pbxproj b/Delta.xcodeproj/project.pbxproj index 8ea0217..41fa489 100644 --- a/Delta.xcodeproj/project.pbxproj +++ b/Delta.xcodeproj/project.pbxproj @@ -171,6 +171,7 @@ BFFDF04623E3D3A600931B96 /* libMupen64Plus.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BFFDF04523E3D3A600931B96 /* libMupen64Plus.a */; }; D5011C48281B6E8B00A0760B /* CharacterSet+Filename.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5011C47281B6E8B00A0760B /* CharacterSet+Filename.swift */; }; D510BC752A5CA9F500450CC0 /* Delta6ToDelta7.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = D510BC742A5CA9F500450CC0 /* Delta6ToDelta7.xcmappingmodel */; }; + D5147EC82A817B4A00D6CD64 /* ReviewSaveStatesOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5147EC72A817B4A00D6CD64 /* ReviewSaveStatesOptions.swift */; }; D517F6BA29E730DA000D14D0 /* SettingsName.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5A9C01929DDFBDD00A8D610 /* SettingsName.swift */; }; D517F6BE29E7535F000D14D0 /* Collection+Optionals.swift in Sources */ = {isa = PBXBuildFile; fileRef = D517F6BD29E7535F000D14D0 /* Collection+Optionals.swift */; }; D51CB7A129EDC01400B59678 /* libDeltaFeatures.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D5D7C1F129E60DFF00663793 /* libDeltaFeatures.a */; }; @@ -439,6 +440,7 @@ C786AF1D2DDB6223BE2063CC /* Pods-Delta.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Delta.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Delta/Pods-Delta.debug.xcconfig"; sourceTree = ""; }; D5011C47281B6E8B00A0760B /* CharacterSet+Filename.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CharacterSet+Filename.swift"; sourceTree = ""; }; D510BC742A5CA9F500450CC0 /* Delta6ToDelta7.xcmappingmodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcmappingmodel; path = Delta6ToDelta7.xcmappingmodel; sourceTree = ""; }; + D5147EC72A817B4A00D6CD64 /* ReviewSaveStatesOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewSaveStatesOptions.swift; sourceTree = ""; }; D517F6BD29E7535F000D14D0 /* Collection+Optionals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+Optionals.swift"; sourceTree = ""; }; D51CB7A529EDC15900B59678 /* ExperimentalFeatures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExperimentalFeatures.swift; sourceTree = ""; }; D524F4A2273DE9C000D500B2 /* ProcessInfo+JIT.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProcessInfo+JIT.swift"; sourceTree = ""; }; @@ -1114,6 +1116,7 @@ D5DF06DE29F326E6009E577C /* AirPlaySkins.swift */, ACF7E30C29F73D03000FE071 /* GameScreenshots.swift */, AC1C990F29F8B8C30020E6E4 /* ToastNotificationOptions.swift */, + D5147EC72A817B4A00D6CD64 /* ReviewSaveStatesOptions.swift */, ); path = Features; sourceTree = ""; @@ -1543,6 +1546,7 @@ D5011C48281B6E8B00A0760B /* CharacterSet+Filename.swift in Sources */, BFE593CC21F3F8C2003412A6 /* _GameSave.swift in Sources */, BF63A1A321A4AAAE00EE8F61 /* RecordSyncStatusViewController.swift in Sources */, + D5147EC82A817B4A00D6CD64 /* ReviewSaveStatesOptions.swift in Sources */, BFAA1FED1B8AA4FA00495943 /* Settings.swift in Sources */, BFA0D1271D3AE1F600565894 /* GameViewController.swift in Sources */, BF59428A1E09BC8B0051894B /* _SaveState.swift in Sources */, diff --git a/Delta/Experimental Features/ExperimentalFeatures.swift b/Delta/Experimental Features/ExperimentalFeatures.swift index 9e9ca7e..c84a5a8 100644 --- a/Delta/Experimental Features/ExperimentalFeatures.swift +++ b/Delta/Experimental Features/ExperimentalFeatures.swift @@ -36,6 +36,11 @@ struct ExperimentalFeatures: FeatureContainer options: ToastNotificationOptions()) var toastNotifications + @Feature(name: "Review Save States", + description: "Review recent Save States to make sure they are associated with the correct game.", + options: ReviewSaveStatesOptions()) + var reviewSaveStates + private init() { self.prepareFeatures() diff --git a/Delta/Experimental Features/Features/ReviewSaveStatesOptions.swift b/Delta/Experimental Features/Features/ReviewSaveStatesOptions.swift new file mode 100644 index 0000000..37b53c4 --- /dev/null +++ b/Delta/Experimental Features/Features/ReviewSaveStatesOptions.swift @@ -0,0 +1,30 @@ +// +// LinkSaveStatesOptions.swift +// Delta +// +// Created by Riley Testut on 8/7/23. +// Copyright © 2023 Riley Testut. All rights reserved. +// + +import SwiftUI + +import DeltaFeatures + +struct ReviewSaveStatesView: UIViewControllerRepresentable +{ + func makeUIViewController(context: Context) -> ReviewSaveStatesViewController + { + let viewController = ReviewSaveStatesViewController() + return viewController + } + + func updateUIViewController(_ uiViewController: ReviewSaveStatesViewController, context: Context) + { + } +} + +struct ReviewSaveStatesOptions +{ + @Option(name: "View Save States", detailView: { _ in ReviewSaveStatesView() }) + private var reviewSaveStates: String = "" // Hack until I figure out how to support Void properties... +} diff --git a/Delta/Settings/Experimental Features/FeatureDetailView.swift b/Delta/Settings/Experimental Features/FeatureDetailView.swift index ef0cafb..4b29400 100644 --- a/Delta/Settings/Experimental Features/FeatureDetailView.swift +++ b/Delta/Settings/Experimental Features/FeatureDetailView.swift @@ -97,11 +97,7 @@ private struct OptionRow: View where Detail } else { - let wrappedDetailView = Form { - detailView - } - - NavigationLink(destination: wrappedDetailView) { + NavigationLink(destination: wrap(detailView)) { HStack { Text(name) Spacer() @@ -122,4 +118,24 @@ private struct OptionRow: View where Detail self.displayInline = displayInline } } + + func wrap(_ detailView: some View) -> AnyView + { + let wrappedDetailView: AnyView + + if self.detailView is any UIViewControllerRepresentable + { + wrappedDetailView = AnyView(detailView.ignoresSafeArea()) + } + else + { + let form = Form { + detailView + } + + wrappedDetailView = AnyView(form) + } + + return wrappedDetailView + } }