From 884da073e993f1bd4f9b3e637f623fae4ec01c41 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Sat, 10 Sep 2022 08:30:55 -0400 Subject: [PATCH] Prepare release v1.0.11 for iOS (#225) * Add error handling to Mac app * Log fatal crashes and present alert on next launch * Update crash alert copy and navigate to help forum * Refactor logging into reuseable methods * Refactor class to use protocol * Add environment object to settings window * Improve deactivation of app when miniaturizing * Chagne dispatch type when creating new post * Bump version and build number * Remove unnecessary TODO comment * Update change log * Log fatal crashes and present alert on next launch * Update crash alert copy and navigate to help forum * Refactor logging into reuseable methods * Add environment object to settings window * Improve deactivation of app when miniaturizing * Chagne dispatch type when creating new post * Improve default window size (#220) * Clean up unnecessary import * Set idealWidth property on sidebars * Unset selected post on collection change (#218) * Unset selected post when changing collection * Update change log * Bump build number and update change log --- CHANGELOG.md | 17 ++++++++++++++--- Shared/Navigation/ContentView.swift | 4 +++- Shared/PostCollection/CollectionListView.swift | 2 ++ Shared/WriteFreely_MultiPlatformApp.swift | 1 + .../project.pbxproj | 16 ++++++++-------- macOS/AppDelegate.swift | 10 ++++------ 6 files changed, 32 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5d8730..ee812c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,8 +37,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Mac] Fixed a potential crash if the system keychain wasn't available at app launch. - [Mac] Cleaned up some straggling project warnings. - [Mac] Improved error-handling under the hood for better app stability. -- [iOS/Mac] Fixed a bug where the new-post button doesn't appear in the iOS 16 beta. -- [iOS/Mac] Fixed a bug where alerts weren't presented for login errors. +- [Mac] Selecting another collection while a blank draft is in the editor now works as expected. +- [Mac] Fixed a bug where the new-post button doesn't appear in the iOS 16 beta. +- [Mac] Fixed a bug where the list of posts published outside of a blog didn't update its title (Drafts/Anonymous). +- [Mac] Fixed a bug where alerts weren't presented for login errors. +- [Mac] Fixed some build warnings in the project. + +## [1.0.11-ios] - 2022-09-07 + +- [iOS] Fixed a bug where the new-post button doesn't appear in the iOS 16 beta. +- [iOS] Fixed a bug where the list of posts published outside of a blog didn't update its title (Drafts/Anonymous). +- [iOS] Fixed a bug where alerts weren't presented for login errors. +- [iOS] Fixed some build warnings in the project. ## [1.0.10-ios] - 2022-07-28 @@ -277,7 +287,8 @@ suffixes to differentiate between platforms, until both are at feature parity. - Contributing guide - This changelog -[Unreleased]: https://github.com/writeas/writefreely-swiftui-multiplatform/compare/v1.0.10-ios...HEAD +[Unreleased]: https://github.com/writeas/writefreely-swiftui-multiplatform/compare/v1.0.11-ios...HEAD +[1.0.11-ios]: https://github.com/writeas/writefreely-swiftui-multiplatform/compare/v1.0.10-ios...v1.0.11-ios [1.0.10-ios]: https://github.com/writeas/writefreely-swiftui-multiplatform/compare/v1.0.9-ios...v1.0.10-ios [1.0.9-ios]: https://github.com/writeas/writefreely-swiftui-multiplatform/compare/v1.0.8-ios...v1.0.9-ios [1.0.8-ios]: https://github.com/writeas/writefreely-swiftui-multiplatform/compare/v1.0.7-ios...v1.0.8-ios diff --git a/Shared/Navigation/ContentView.swift b/Shared/Navigation/ContentView.swift index f57a541..bbbd598 100644 --- a/Shared/Navigation/ContentView.swift +++ b/Shared/Navigation/ContentView.swift @@ -28,7 +28,7 @@ struct ContentView: View { // Create the new-post managed object let managedPost = model.editor.generateNewLocalPost(withFont: model.preferences.font) withAnimation { - DispatchQueue.main.asyncAfter(deadline: .now()) { + DispatchQueue.main.async { // Load the new post in the editor self.model.selectedPost = managedPost } @@ -36,6 +36,7 @@ struct ContentView: View { }, label: { Image(systemName: "square.and.pencil") }) .help("Create a new local draft.") } + .frame(idealWidth: 200) #else CollectionListView() .withErrorHandling() @@ -45,6 +46,7 @@ struct ContentView: View { ZStack { PostListView(selectedCollection: model.selectedCollection, showAllPosts: model.showAllPosts) .withErrorHandling() + .frame(idealWidth: 300) if model.isProcessingRequest { ZStack { Color(NSColor.controlBackgroundColor).opacity(0.75) diff --git a/Shared/PostCollection/CollectionListView.swift b/Shared/PostCollection/CollectionListView.swift index 91c4c3d..2c3dab7 100644 --- a/Shared/PostCollection/CollectionListView.swift +++ b/Shared/PostCollection/CollectionListView.swift @@ -33,11 +33,13 @@ struct CollectionListView: View { ) .listStyle(SidebarListStyle()) .onChange(of: model.selectedCollection) { collection in + model.selectedPost = nil if collection != model.editor.fetchSelectedCollectionFromAppStorage() { self.model.editor.selectedCollectionURL = collection?.objectID.uriRepresentation() } } .onChange(of: model.showAllPosts) { value in + model.selectedPost = nil if value != model.editor.showAllPostsFlag { self.model.editor.showAllPostsFlag = model.showAllPosts } diff --git a/Shared/WriteFreely_MultiPlatformApp.swift b/Shared/WriteFreely_MultiPlatformApp.swift index 51e261a..53b2ae0 100644 --- a/Shared/WriteFreely_MultiPlatformApp.swift +++ b/Shared/WriteFreely_MultiPlatformApp.swift @@ -135,6 +135,7 @@ struct WriteFreely_MultiPlatformApp: App { } .tag(2) } + .environmentObject(model) .withErrorHandling() .frame(minWidth: 500, maxWidth: 500, minHeight: 200) .padding() diff --git a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj index 796445f..e1fb5e0 100644 --- a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj +++ b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj @@ -1054,7 +1054,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 674; + CURRENT_PROJECT_VERSION = 676; DEVELOPMENT_TEAM = TPPAB4YBA6; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "ActionExtension-iOS/Info.plist"; @@ -1085,7 +1085,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 674; + CURRENT_PROJECT_VERSION = 676; DEVELOPMENT_TEAM = TPPAB4YBA6; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "ActionExtension-iOS/Info.plist"; @@ -1228,7 +1228,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 674; + CURRENT_PROJECT_VERSION = 676; DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; @@ -1254,7 +1254,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 674; + CURRENT_PROJECT_VERSION = 676; DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; @@ -1282,7 +1282,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 620; + CURRENT_PROJECT_VERSION = 676; DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; @@ -1292,7 +1292,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.6.0; + MARKETING_VERSION = 0.7.0; PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform"; PRODUCT_NAME = "WriteFreely for Mac"; SDKROOT = macosx; @@ -1309,7 +1309,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 620; + CURRENT_PROJECT_VERSION = 676; DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; @@ -1319,7 +1319,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.6.0; + MARKETING_VERSION = 0.7.0; PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform"; PRODUCT_NAME = "WriteFreely for Mac"; SDKROOT = macosx; diff --git a/macOS/AppDelegate.swift b/macOS/AppDelegate.swift index 410ffe9..a1dd53f 100644 --- a/macOS/AppDelegate.swift +++ b/macOS/AppDelegate.swift @@ -1,5 +1,4 @@ import Cocoa -import Sparkle class AppDelegate: NSObject, NSApplicationDelegate { @@ -15,13 +14,12 @@ class AppDelegate: NSObject, NSApplicationDelegate { } } - // If we're miniaturizing the window, deactivate it as well by activating Finder.app (note that - // this will bring any Finder windows that are behind other apps to the foreground). + // If we're miniaturizing the window, deactivate it as well. + // Credit to KHKnobl on GitHub: + // https://github.com/writefreely/writefreely-swiftui-multiplatform/issues/135#issuecomment-1101713817 func applicationDidChangeOcclusionState(_ notification: Notification) { if let window = NSApp.windows.first, window.isMiniaturized { - NSWorkspace.shared.runningApplications.first(where: { - $0.activationPolicy == .regular - })?.activate(options: .activateAllWindows) + NSApp.hide(self) } }