From c82ce5fa17e2b9e890c192571ea07b699a24bd8e Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Mon, 12 May 2025 20:49:28 +0100 Subject: [PATCH] Whats New! add AboutView move getVersion() and geBuildID() reorg of presentaion related modifiers --- Config.xcconfig | 2 +- NearFuture.xcodeproj/project.pbxproj | 8 ++ .../xcschemes/NearFuture nodebug.xcscheme | 78 ------------ .../xcschemes/xcschememanagement.plist | 5 - NearFuture/Item.swift | 23 +++- NearFuture/Views/Archive/ArchiveView.swift | 6 - NearFuture/Views/Events/AddEventView.swift | 17 +-- NearFuture/Views/Home/ContentView.swift | 3 + NearFuture/Views/Home/HomeView.swift | 6 - NearFuture/Views/Misc/AboutView.swift | 31 +++++ NearFuture/Views/Settings/SettingsView.swift | 28 +---- NearFuture/Views/Settings/WhatsNewView.swift | 113 ++++++++++++++++++ 12 files changed, 189 insertions(+), 131 deletions(-) delete mode 100644 NearFuture.xcodeproj/xcshareddata/xcschemes/NearFuture nodebug.xcscheme create mode 100644 NearFuture/Views/Misc/AboutView.swift create mode 100644 NearFuture/Views/Settings/WhatsNewView.swift diff --git a/Config.xcconfig b/Config.xcconfig index fbdf540..36f1a68 100644 --- a/Config.xcconfig +++ b/Config.xcconfig @@ -14,4 +14,4 @@ BUNDLE_ID_WIDGETS = com.neon443.NearFuture.widgets GROUP_ID = group.NearFuture VERSION = 4.0.0 NAME = Near Future -BUILD_NUMBER = 0 +BUILD_NUMBER = 2 diff --git a/NearFuture.xcodeproj/project.pbxproj b/NearFuture.xcodeproj/project.pbxproj index b3345db..8af4082 100644 --- a/NearFuture.xcodeproj/project.pbxproj +++ b/NearFuture.xcodeproj/project.pbxproj @@ -8,6 +8,8 @@ /* Begin PBXBuildFile section */ A914FA4B2DD26C6800856265 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A914FA4A2DD26C0F00856265 /* HomeView.swift */; }; + A914FA4D2DD2768900856265 /* WhatsNewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A914FA4C2DD2768900856265 /* WhatsNewView.swift */; }; + A914FA4F2DD276D200856265 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A914FA4E2DD276D200856265 /* AboutView.swift */; }; A920C2882D24011400E4F9B1 /* NearFutureApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A920C2872D24011400E4F9B1 /* NearFutureApp.swift */; }; A920C28C2D24011400E4F9B1 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = A920C28B2D24011400E4F9B1 /* Item.swift */; }; A920C28E2D24011A00E4F9B1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A920C28D2D24011A00E4F9B1 /* Assets.xcassets */; }; @@ -72,6 +74,8 @@ /* Begin PBXFileReference section */ A90FDE222DC0D4310012790C /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; A914FA4A2DD26C0F00856265 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; + A914FA4C2DD2768900856265 /* WhatsNewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WhatsNewView.swift; path = NearFuture/Views/Settings/WhatsNewView.swift; sourceTree = SOURCE_ROOT; }; + A914FA4E2DD276D200856265 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AboutView.swift; path = NearFuture/Views/Misc/AboutView.swift; sourceTree = SOURCE_ROOT; }; A920C2842D24011400E4F9B1 /* NearFuture.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NearFuture.app; sourceTree = BUILT_PRODUCTS_DIR; }; A920C2872D24011400E4F9B1 /* NearFutureApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearFutureApp.swift; sourceTree = ""; }; A920C28B2D24011400E4F9B1 /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = ""; }; @@ -232,6 +236,7 @@ children = ( A949F8462DCAABE00064DCA0 /* SettingsView.swift */, A949F8442DCAABE00064DCA0 /* iCloudSettingsView.swift */, + A914FA4C2DD2768900856265 /* WhatsNewView.swift */, A949F8452DCAABE00064DCA0 /* ImportView.swift */, A949F8432DCAABE00064DCA0 /* ExportView.swift */, ); @@ -271,6 +276,7 @@ isa = PBXGroup; children = ( A949F85D2DCABB420064DCA0 /* Buttons.swift */, + A914FA4E2DD276D200856265 /* AboutView.swift */, ); path = Misc; sourceTree = ""; @@ -452,6 +458,7 @@ files = ( A920C28C2D24011400E4F9B1 /* Item.swift in Sources */, A949F84B2DCAABE00064DCA0 /* ArchiveView.swift in Sources */, + A914FA4F2DD276D200856265 /* AboutView.swift in Sources */, A949F84C2DCAABE00064DCA0 /* AddEventView.swift in Sources */, A914FA4B2DD26C6800856265 /* HomeView.swift in Sources */, A949F84D2DCAABE00064DCA0 /* EditEventView.swift in Sources */, @@ -459,6 +466,7 @@ A949F84F2DCAABE00064DCA0 /* EventListView.swift in Sources */, A949F8502DCAABE00064DCA0 /* HelpView.swift in Sources */, A949F85F2DCABB420064DCA0 /* Buttons.swift in Sources */, + A914FA4D2DD2768900856265 /* WhatsNewView.swift in Sources */, A949F8512DCAABE00064DCA0 /* ExportView.swift in Sources */, A949F8522DCAABE00064DCA0 /* iCloudSettingsView.swift in Sources */, A949F8532DCAABE00064DCA0 /* ImportView.swift in Sources */, diff --git a/NearFuture.xcodeproj/xcshareddata/xcschemes/NearFuture nodebug.xcscheme b/NearFuture.xcodeproj/xcshareddata/xcschemes/NearFuture nodebug.xcscheme deleted file mode 100644 index c8ab148..0000000 --- a/NearFuture.xcodeproj/xcshareddata/xcschemes/NearFuture nodebug.xcscheme +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NearFuture.xcodeproj/xcuserdata/neon443.xcuserdatad/xcschemes/xcschememanagement.plist b/NearFuture.xcodeproj/xcuserdata/neon443.xcuserdatad/xcschemes/xcschememanagement.plist index bdfa797..3d4f3de 100644 --- a/NearFuture.xcodeproj/xcuserdata/neon443.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/NearFuture.xcodeproj/xcuserdata/neon443.xcuserdatad/xcschemes/xcschememanagement.plist @@ -4,11 +4,6 @@ SchemeUserState - NearFuture nodebug.xcscheme_^#shared#^_ - - orderHint - 2 - NearFuture.xcscheme_^#shared#^_ orderHint diff --git a/NearFuture/Item.swift b/NearFuture/Item.swift index b7245fd..4392705 100644 --- a/NearFuture/Item.swift +++ b/NearFuture/Item.swift @@ -107,12 +107,16 @@ func daysUntilEvent(_ eventDate: Date) -> (long: String, short: String) { struct Settings: Codable, Equatable { var showCompletedInHome: Bool var tint: ColorCodable + var showWhatsNew: Bool + var prevAppVersion: String } class SettingsViewModel: ObservableObject { @Published var settings: Settings = Settings( showCompletedInHome: false, - tint: ColorCodable(uiColor: UIColor(named: "AccentColor")!) + tint: ColorCodable(uiColor: UIColor(named: "AccentColor")!), + showWhatsNew: true, + prevAppVersion: getVersion()+getBuildID() ) @Published var notifsGranted: Bool = false @@ -152,6 +156,9 @@ class SettingsViewModel: ObservableObject { self.settings = decodedSetts } } + if self.settings.prevAppVersion != getVersion()+getBuildID() { + self.settings.showWhatsNew = true + } } func saveSettings() { @@ -528,3 +535,17 @@ func cancelNotif(_ id: String) { func cancelAllNotifs() { UNUserNotificationCenter.current().removeAllPendingNotificationRequests() } + +func getVersion() -> String { + guard let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] else { + fatalError("no bundle id wtf lol") + } + return "\(version)" +} + +func getBuildID() -> String { + guard let build = Bundle.main.infoDictionary?["CFBundleVersion"] else { + fatalError("wtf did u do w the build number") + } + return "\(build)" +} diff --git a/NearFuture/Views/Archive/ArchiveView.swift b/NearFuture/Views/Archive/ArchiveView.swift index 6a53feb..60695e0 100644 --- a/NearFuture/Views/Archive/ArchiveView.swift +++ b/NearFuture/Views/Archive/ArchiveView.swift @@ -59,12 +59,6 @@ struct ArchiveView: View { eventRecurrence: $viewModel.editableTemplate.recurrence, adding: true ) - .presentationDragIndicator(.visible) - .apply { - if #available(iOS 16.4, *) { - $0.presentationBackground(.ultraThinMaterial) - } - } } } } diff --git a/NearFuture/Views/Events/AddEventView.swift b/NearFuture/Views/Events/AddEventView.swift index c9a7fd1..76f14c8 100644 --- a/NearFuture/Views/Events/AddEventView.swift +++ b/NearFuture/Views/Events/AddEventView.swift @@ -35,7 +35,9 @@ struct AddEventView: View { var body: some View { ZStack { - backgroundGradient + if !adding { + backgroundGradient + } NavigationStack { Form { Section( @@ -210,6 +212,13 @@ struct AddEventView: View { } } } + .presentationDragIndicator(.visible) + .scrollContentBackground(.hidden) + } + .apply { + if #available(iOS 16.4, *) { + $0.presentationBackground(.ultraThinMaterial) + } } } func resetAddEventView() { @@ -244,11 +253,5 @@ struct AddEventView: View { eventRecurrence: .constant(vm.template.recurrence), adding: true ) - .presentationDragIndicator(.visible) - .apply { - if #available(iOS 16.4, *) { - $0.presentationBackground(.ultraThinMaterial) - } - } } } diff --git a/NearFuture/Views/Home/ContentView.swift b/NearFuture/Views/Home/ContentView.swift index 6ee814c..b37f6e9 100644 --- a/NearFuture/Views/Home/ContentView.swift +++ b/NearFuture/Views/Home/ContentView.swift @@ -46,6 +46,9 @@ struct ContentView: View { } .tag(Tab.settings) } + .sheet(isPresented: $settingsModel.settings.showWhatsNew) { + WhatsNewView(settingsModel: settingsModel) + } } } diff --git a/NearFuture/Views/Home/HomeView.swift b/NearFuture/Views/Home/HomeView.swift index 170dc58..febbc88 100644 --- a/NearFuture/Views/Home/HomeView.swift +++ b/NearFuture/Views/Home/HomeView.swift @@ -111,12 +111,6 @@ struct HomeView: View { eventRecurrence: $eventRecurrence, adding: true //adding event ) - .presentationDragIndicator(.visible) - .apply { - if #available(iOS 16.4, *) { - $0.presentationBackground(.ultraThinMaterial) - } - } } .toolbar { ToolbarItem(placement: .topBarTrailing) { diff --git a/NearFuture/Views/Misc/AboutView.swift b/NearFuture/Views/Misc/AboutView.swift new file mode 100644 index 0000000..b6d4004 --- /dev/null +++ b/NearFuture/Views/Misc/AboutView.swift @@ -0,0 +1,31 @@ +// +// AboutView.swift +// NearFuture +// +// Created by neon443 on 12/05/2025. +// + +import SwiftUI + +struct AboutView: View { + var body: some View { + VStack { + Image(uiImage: #imageLiteral(resourceName: "NearFutureIcon.png")) + .resizable() + .scaledToFit() + .frame(width: 100) + .clipShape(RoundedRectangle(cornerRadius: 25)) + Text("Near Future") + .bold() + .monospaced() + .font(.title) + .frame(maxWidth: .infinity) + Text("Version " + getVersion() + " (\(getBuildID()))") + .frame(maxWidth: .infinity) + } + } +} + +#Preview { + AboutView() +} diff --git a/NearFuture/Views/Settings/SettingsView.swift b/NearFuture/Views/Settings/SettingsView.swift index d88d865..6f64963 100644 --- a/NearFuture/Views/Settings/SettingsView.swift +++ b/NearFuture/Views/Settings/SettingsView.swift @@ -148,20 +148,7 @@ struct SettingsView: View { } } Section("About") { - VStack { - Image(uiImage: #imageLiteral(resourceName: "NearFutureIcon.png")) - .resizable() - .scaledToFit() - .frame(width: 100) - .clipShape(RoundedRectangle(cornerRadius: 25)) - Text("Near Future") - .bold() - .monospaced() - .font(.title) - .frame(maxWidth: .infinity) - Text("Version " + getVersion() + " (\(getBuildID()))") - .frame(maxWidth: .infinity) - } + AboutView() } } } @@ -185,16 +172,3 @@ struct SettingsView: View { ) } -func getVersion() -> String { - guard let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] else { - fatalError("no bundle id wtf lol") - } - return "\(version)" -} - -func getBuildID() -> String { - guard let build = Bundle.main.infoDictionary?["CFBundleVersion"] else { - fatalError("wtf did u do w the build number") - } - return "\(build)" -} diff --git a/NearFuture/Views/Settings/WhatsNewView.swift b/NearFuture/Views/Settings/WhatsNewView.swift new file mode 100644 index 0000000..e7bf1d0 --- /dev/null +++ b/NearFuture/Views/Settings/WhatsNewView.swift @@ -0,0 +1,113 @@ +// +// WhatsNewView.swift +// NearFuture +// +// Created by neon443 on 12/05/2025. +// + +import SwiftUI + +struct WhatsNewView: View { + @ObservedObject var settingsModel: SettingsViewModel + @Environment(\.dismiss) var dismiss + struct WhatsNew: Identifiable { + var id: UUID = UUID() + var symbol: String + var title: String + var subtitle: String + } + var whatsNew: [WhatsNew] = [ + WhatsNew( + symbol: "bell.badge.fill", + title: "Notifications", + subtitle: "Events now have notifications, reminding you to complete them!" + ), + WhatsNew( + symbol: "list.bullet.indent", + title: "Animations!", + subtitle: "I added animations for adding, removing and ticking events, fixing " + ), + WhatsNew( + symbol: "list.bullet.indent", + title: "Animations!", + subtitle: "I added animations for adding, removing and ticking events, fixing " + ) + ] + var body: some View { + NavigationStack { + List { + VStack { + Text("What's New") + .font(.largeTitle) + .bold() + AboutView() + Divider() + ForEach(whatsNew) { new in + WhatsNewChunk( + symbol: new.symbol, + title: new.title, + subtitle: new.subtitle + ) + } + + } + .onDisappear { + settingsModel.saveSettings() + } + } + Button() { + dismiss() + } label: { + Text("Continue") + .font(.headline) + .frame(height: 40) + .bold() + .frame(maxWidth: .infinity) + } + .buttonStyle(BorderedProminentButtonStyle()) + .clipShape(RoundedRectangle(cornerRadius: 15)) + .padding().padding() + } + .scrollContentBackground(.hidden) + .presentationDragIndicator(.visible) + .apply { + if #available(iOS 16.4, *) { + $0.presentationBackground(.ultraThinMaterial) + } + } + } +} + +#Preview { + Color.accent + .ignoresSafeArea(.all) + .sheet(isPresented: .constant(true)) { + WhatsNewView(settingsModel: dummySettingsViewModel()) + } +} + +struct WhatsNewChunk: View { + @State var symbol: String + @State var title: String + @State var subtitle: String + var body: some View { +// GeometryReader { geo in + HStack { + Image(systemName: symbol) + .resizable() + .scaledToFit() + .frame(width: 30, height: 30) + .foregroundStyle(.accent) + .padding(.trailing, 5) + VStack(alignment: .leading) { + Text(title) + .font(.headline) + .bold() + Text(subtitle) + .foregroundStyle(.gray) + .font(.subheadline) + } + } +// } + } +}