From 2d7137cd4d728cee6a76c14d18c7bc592a1013ae Mon Sep 17 00:00:00 2001 From: xan-m Date: Tue, 28 Sep 2021 16:02:54 -0700 Subject: [PATCH] Last-minute bug fixes and some clarity improvements for renaming of watches --- Infini-iOS.xcodeproj/project.pbxproj | 8 ++-- Infini-iOS/View Components/SettingsView.swift | 3 ++ .../View Components/Sheets/SheetManager.swift | 14 ++---- .../Sheets/What's New/WhatsNewBody.swift | 43 +++++++++++++++++++ .../Sheets/What's New/WhatsNewBody090.swift | 33 -------------- .../Sheets/What's New/WhatsNewSheet.swift | 4 +- 6 files changed, 56 insertions(+), 49 deletions(-) create mode 100644 Infini-iOS/View Components/Sheets/What's New/WhatsNewBody.swift delete mode 100644 Infini-iOS/View Components/Sheets/What's New/WhatsNewBody090.swift diff --git a/Infini-iOS.xcodeproj/project.pbxproj b/Infini-iOS.xcodeproj/project.pbxproj index 3c31aa1..9b44055 100644 --- a/Infini-iOS.xcodeproj/project.pbxproj +++ b/Infini-iOS.xcodeproj/project.pbxproj @@ -9,7 +9,7 @@ /* Begin PBXBuildFile section */ 2617EF37270364CE00FE6F48 /* ChartViewSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2617EF36270364CE00FE6F48 /* ChartViewSelector.swift */; }; 2617EF3927036C9B00FE6F48 /* WhatsNewSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2617EF3827036C9B00FE6F48 /* WhatsNewSheet.swift */; }; - 2617EF3D27036DC600FE6F48 /* WhatsNewBody090.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2617EF3C27036DC600FE6F48 /* WhatsNewBody090.swift */; }; + 2617EF3D27036DC600FE6F48 /* WhatsNewBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2617EF3C27036DC600FE6F48 /* WhatsNewBody.swift */; }; 26318B1626CB27E70036051E /* Infini_iOS.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 26318B1426CB27E70036051E /* Infini_iOS.xcdatamodeld */; }; 2632388426F2531C00D72B43 /* DFUWithBLE.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2632388326F2531C00D72B43 /* DFUWithBLE.swift */; }; 2632388626F2548600D72B43 /* DFUWithoutBLE.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2632388526F2548600D72B43 /* DFUWithoutBLE.swift */; }; @@ -85,7 +85,7 @@ /* Begin PBXFileReference section */ 2617EF36270364CE00FE6F48 /* ChartViewSelector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartViewSelector.swift; sourceTree = ""; }; 2617EF3827036C9B00FE6F48 /* WhatsNewSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatsNewSheet.swift; sourceTree = ""; }; - 2617EF3C27036DC600FE6F48 /* WhatsNewBody090.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatsNewBody090.swift; sourceTree = ""; }; + 2617EF3C27036DC600FE6F48 /* WhatsNewBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatsNewBody.swift; sourceTree = ""; }; 26318B1526CB27E70036051E /* Infini_iOS.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Infini_iOS.xcdatamodel; sourceTree = ""; }; 2632388326F2531C00D72B43 /* DFUWithBLE.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DFUWithBLE.swift; sourceTree = ""; }; 2632388526F2548600D72B43 /* DFUWithoutBLE.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DFUWithoutBLE.swift; sourceTree = ""; }; @@ -177,7 +177,7 @@ isa = PBXGroup; children = ( 2617EF3827036C9B00FE6F48 /* WhatsNewSheet.swift */, - 2617EF3C27036DC600FE6F48 /* WhatsNewBody090.swift */, + 2617EF3C27036DC600FE6F48 /* WhatsNewBody.swift */, ); path = "What's New"; sourceTree = ""; @@ -544,7 +544,7 @@ 26318B1626CB27E70036051E /* Infini_iOS.xcdatamodeld in Sources */, 266F53EC26FAABE7007481A6 /* TimeRangeTabs.swift in Sources */, 26C5FAD826FC129400921207 /* ArbitraryNotificationView.swift in Sources */, - 2617EF3D27036DC600FE6F48 /* WhatsNewBody090.swift in Sources */, + 2617EF3D27036DC600FE6F48 /* WhatsNewBody.swift in Sources */, 264BFE7626BC52720050A223 /* HexStringToData.swift in Sources */, 2632388626F2548600D72B43 /* DFUWithoutBLE.swift in Sources */, 26C5FADC26FE7EB000921207 /* SheetCloseButton.swift in Sources */, diff --git a/Infini-iOS/View Components/SettingsView.swift b/Infini-iOS/View Components/SettingsView.swift index dfe802f..9f35a1c 100644 --- a/Infini-iOS/View Components/SettingsView.swift +++ b/Infini-iOS/View Components/SettingsView.swift @@ -13,6 +13,7 @@ import SwiftUI struct Settings_Page: View { @ObservedObject var bleManager = BLEManager.shared + @ObservedObject var deviceInfo = BLEDeviceInfo.shared @Environment(\.colorScheme) var colorScheme @AppStorage("watchNotifications") var watchNotifications: Bool = true @@ -28,6 +29,7 @@ struct Settings_Page: View { @State private var changedName: String = "" private var nameManager = DeviceNameManager() @State private var resultMessage = "" + @State private var deviceName = "" var body: some View { VStack { @@ -52,6 +54,7 @@ struct Settings_Page: View { }.disabled(!autoconnect || autoconnectUUID.isEmpty) } Section(header: Text("Device Name")) { + Text("Current Device Name: " + deviceInfo.deviceName) TextField("Enter New Name", text: $changedName) Button { UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) diff --git a/Infini-iOS/View Components/Sheets/SheetManager.swift b/Infini-iOS/View Components/Sheets/SheetManager.swift index da3d3fd..1ec15d2 100644 --- a/Infini-iOS/View Components/Sheets/SheetManager.swift +++ b/Infini-iOS/View Components/Sheets/SheetManager.swift @@ -28,33 +28,27 @@ class SheetManager: ObservableObject { private var whatsNew: Bool = true let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "" - var lastVersion = UserDefaults.standard.value(forKey: "lastVersion") as? String ?? "" + var defaults = UserDefaults.standard func showWhatsNew () -> Bool { if !whatsNew { return false } else { var showSheet = false - - print("before: ", lastVersion, " ", currentVersion) - if lastVersion == "" { - lastVersion = "0.0.0" - } - + let lastVersion = defaults.value(forKey: "lastVersion") as? String ?? "0.0.0" let comparison = currentVersion.compare(lastVersion, options: .numeric) if comparison == .orderedDescending { showSheet = true } - lastVersion = currentVersion + defaults.set(currentVersion, forKey: "lastVersion") whatsNew = false - print(showSheet) return showSheet } } func setNextSheet() { - let onboarding = UserDefaults.standard.value(forKey: "onboarding")// as? Bool ?? true + let onboarding = defaults.value(forKey: "onboarding") if onboarding == nil { SheetManager.shared.sheetSelection = .onboarding SheetManager.shared.showSheet = true diff --git a/Infini-iOS/View Components/Sheets/What's New/WhatsNewBody.swift b/Infini-iOS/View Components/Sheets/What's New/WhatsNewBody.swift new file mode 100644 index 0000000..b3e2405 --- /dev/null +++ b/Infini-iOS/View Components/Sheets/What's New/WhatsNewBody.swift @@ -0,0 +1,43 @@ +// +// WhatsNewBody090.swift +// Infini-iOS +// +// Created by Alex Emry on 9/28/21. +// +// + + +import SwiftUI + +struct WhatsNewBody: View { + + var body: some View { + ScrollView{ + Text("UI Changes") + .font(.title2) + .padding() + Text("Tons of UI changes: New 'Home' view features some stats about your watch and the connect/disconnect button. DFU page was cleaned up a little. Color scheme changes were made to improve clarity for light mode users.") + .padding() + Text("Chart Persistence") + .font(.title2) + .padding() + Text("Infini-iOS is now capable of saving chart data as it is generated, and chart data can now be filtered by time. I've set the watch to prune data older than a week for now, but am open to suggestions!") + Text("Device Naming") + .font(.title2) + .padding() + Text("Devices can now be named in Infini-iOS! While this name has no effect on the watch, setting a name for the device in Infini-iOS associates the UUID of the watch with the new name. Any time this watch would appear on screen (Home screen, Connect screen, etc), your chosen name will display instead of 'InfiniTime'. Hopefully this will be helpful for those of you that have more than one watch!") + .padding() + Text("Arbitrary Notifications") + .font(.title2) + .padding() + Text("Now you can send arbitrary notifications to your PineTime from the Settings Menu. Have a short list of stuff to get at the store? Send the list as a notification and it will be on your wrist as you shop!") + .padding() + Text("Firmware Updates") + .font(.title2) + .padding() + Text("- Updated DFU process: DFU downloads are now available! Now, when you tap the 'Select Firmware File' button, you're given the option to select a local file or download a firmware file. Tapping the download button uses the GitHub API to bring up a list of firmware files available on GitHub. Selecting a file from that list will download it and prepare it for flashing. After flashing, the file is deleted. Also, when a watch is connected, Infini-iOS will compare the firmware version number on the watch to this list, and notify you of any updates on the Home screen.") + .padding() + } + } +} + diff --git a/Infini-iOS/View Components/Sheets/What's New/WhatsNewBody090.swift b/Infini-iOS/View Components/Sheets/What's New/WhatsNewBody090.swift deleted file mode 100644 index 2547ccb..0000000 --- a/Infini-iOS/View Components/Sheets/What's New/WhatsNewBody090.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// WhatsNewBody090.swift -// Infini-iOS -// -// Created by Alex Emry on 9/28/21. -// -// - - -import SwiftUI - -struct WhatsNew090: View { - - var body: some View { - ScrollView{ - VStack { - Text("- Tons of UI changes: New 'Home' view features some stats about your watch and the connect/disconnect button. DFU page was cleaned up a little. Color scheme changes were made to improve clarity for light mode users.") - .padding() - Text("- Chart Persistence: Infini-iOS is now capable of saving chart data as it is generated, and chart data can now be filtered by time. I've set the watch to prune data older than a week for now, but am open to suggestions!") - .padding() - Text("- Device Naming: Devices can now be named in Infini-iOS! While this name has no effect on the watch, setting a name for the device in Infini-iOS associates the UUID of the watch with the new name. Any time this watch would appear on screen (Home screen, Connect screen, etc), your chosen name will display instead of 'InfiniTime'. Hopefully this will be helpful for those of you that have more than one watch!") - .padding() - Text("- Notifications: Now you can send arbitrary notifications to your PineTime from the Settings Menu. Have a short list of stuff to get at the store? Send the list as a notification and it will be on your wrist as you shop!") - .padding() - Text("- Updated DFU process: DFU downloads are now available! Now, when you tap the 'Select Firmware File' button, you're given the option to select a local file or download a firmware file. Tapping the download button uses the GitHub API to bring up a list of firmware files available on GitHub. Selecting a file from that list will download it and prepare it for flashing. After flashing, the file is deleted. Also, when a watch is connected, Infini-iOS will compare the firmware version number on the watch to this list, and notify you of any updates on the Home screen.") - .padding() - Text("- Behind the scenes: Lots of bug fixes, refactoring, and process improvements. I've come a long way with Swift since I started the app, so I've begun the process of re-implementing many of the core features in a more sensible way.") - .padding() - } - } - } -} - diff --git a/Infini-iOS/View Components/Sheets/What's New/WhatsNewSheet.swift b/Infini-iOS/View Components/Sheets/What's New/WhatsNewSheet.swift index c0add56..2f8a3a3 100644 --- a/Infini-iOS/View Components/Sheets/What's New/WhatsNewSheet.swift +++ b/Infini-iOS/View Components/Sheets/What's New/WhatsNewSheet.swift @@ -18,12 +18,12 @@ struct WhatsNew: View { ScrollView{ VStack { Text(String("What's New in \(appVersion!)")) - .font(.title2) + .font(.largeTitle) .padding(.horizontal) Text("Welcome to the new version of Infini-iOS! I hope you enjoy the features I've added to the app for this version. Please feel free to get in touch with me about any issues you experience or changes you'd like to see!") .padding() - WhatsNew090() + WhatsNewBody() OnboardingDismissButton() } }