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
This commit is contained in:
Angelo Stavrow 2022-09-10 08:30:55 -04:00 committed by GitHub
parent 0d43cb0bd8
commit 884da073e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 18 deletions

View File

@ -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] Fixed a potential crash if the system keychain wasn't available at app launch.
- [Mac] Cleaned up some straggling project warnings. - [Mac] Cleaned up some straggling project warnings.
- [Mac] Improved error-handling under the hood for better app stability. - [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. - [Mac] Selecting another collection while a blank draft is in the editor now works as expected.
- [iOS/Mac] Fixed a bug where alerts weren't presented for login errors. - [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 ## [1.0.10-ios] - 2022-07-28
@ -277,7 +287,8 @@ suffixes to differentiate between platforms, until both are at feature parity.
- Contributing guide - Contributing guide
- This changelog - 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.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.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 [1.0.8-ios]: https://github.com/writeas/writefreely-swiftui-multiplatform/compare/v1.0.7-ios...v1.0.8-ios

View File

@ -28,7 +28,7 @@ struct ContentView: View {
// Create the new-post managed object // Create the new-post managed object
let managedPost = model.editor.generateNewLocalPost(withFont: model.preferences.font) let managedPost = model.editor.generateNewLocalPost(withFont: model.preferences.font)
withAnimation { withAnimation {
DispatchQueue.main.asyncAfter(deadline: .now()) { DispatchQueue.main.async {
// Load the new post in the editor // Load the new post in the editor
self.model.selectedPost = managedPost self.model.selectedPost = managedPost
} }
@ -36,6 +36,7 @@ struct ContentView: View {
}, label: { Image(systemName: "square.and.pencil") }) }, label: { Image(systemName: "square.and.pencil") })
.help("Create a new local draft.") .help("Create a new local draft.")
} }
.frame(idealWidth: 200)
#else #else
CollectionListView() CollectionListView()
.withErrorHandling() .withErrorHandling()
@ -45,6 +46,7 @@ struct ContentView: View {
ZStack { ZStack {
PostListView(selectedCollection: model.selectedCollection, showAllPosts: model.showAllPosts) PostListView(selectedCollection: model.selectedCollection, showAllPosts: model.showAllPosts)
.withErrorHandling() .withErrorHandling()
.frame(idealWidth: 300)
if model.isProcessingRequest { if model.isProcessingRequest {
ZStack { ZStack {
Color(NSColor.controlBackgroundColor).opacity(0.75) Color(NSColor.controlBackgroundColor).opacity(0.75)

View File

@ -33,11 +33,13 @@ struct CollectionListView: View {
) )
.listStyle(SidebarListStyle()) .listStyle(SidebarListStyle())
.onChange(of: model.selectedCollection) { collection in .onChange(of: model.selectedCollection) { collection in
model.selectedPost = nil
if collection != model.editor.fetchSelectedCollectionFromAppStorage() { if collection != model.editor.fetchSelectedCollectionFromAppStorage() {
self.model.editor.selectedCollectionURL = collection?.objectID.uriRepresentation() self.model.editor.selectedCollectionURL = collection?.objectID.uriRepresentation()
} }
} }
.onChange(of: model.showAllPosts) { value in .onChange(of: model.showAllPosts) { value in
model.selectedPost = nil
if value != model.editor.showAllPostsFlag { if value != model.editor.showAllPostsFlag {
self.model.editor.showAllPostsFlag = model.showAllPosts self.model.editor.showAllPostsFlag = model.showAllPosts
} }

View File

@ -135,6 +135,7 @@ struct WriteFreely_MultiPlatformApp: App {
} }
.tag(2) .tag(2)
} }
.environmentObject(model)
.withErrorHandling() .withErrorHandling()
.frame(minWidth: 500, maxWidth: 500, minHeight: 200) .frame(minWidth: 500, maxWidth: 500, minHeight: 200)
.padding() .padding()

View File

@ -1054,7 +1054,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements"; CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 674; CURRENT_PROJECT_VERSION = 676;
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist"; INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
@ -1085,7 +1085,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements"; CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 674; CURRENT_PROJECT_VERSION = 676;
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist"; INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
@ -1228,7 +1228,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements"; CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 674; CURRENT_PROJECT_VERSION = 676;
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist; INFOPLIST_FILE = iOS/Info.plist;
@ -1254,7 +1254,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements"; CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 674; CURRENT_PROJECT_VERSION = 676;
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist; INFOPLIST_FILE = iOS/Info.plist;
@ -1282,7 +1282,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 620; CURRENT_PROJECT_VERSION = 676;
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@ -1292,7 +1292,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.6.0; MARKETING_VERSION = 0.7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform"; PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform";
PRODUCT_NAME = "WriteFreely for Mac"; PRODUCT_NAME = "WriteFreely for Mac";
SDKROOT = macosx; SDKROOT = macosx;
@ -1309,7 +1309,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 620; CURRENT_PROJECT_VERSION = 676;
DEVELOPMENT_TEAM = TPPAB4YBA6; DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@ -1319,7 +1319,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 0.6.0; MARKETING_VERSION = 0.7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform"; PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform";
PRODUCT_NAME = "WriteFreely for Mac"; PRODUCT_NAME = "WriteFreely for Mac";
SDKROOT = macosx; SDKROOT = macosx;

View File

@ -1,5 +1,4 @@
import Cocoa import Cocoa
import Sparkle
class AppDelegate: NSObject, NSApplicationDelegate { 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 // If we're miniaturizing the window, deactivate it as well.
// this will bring any Finder windows that are behind other apps to the foreground). // Credit to KHKnobl on GitHub:
// https://github.com/writefreely/writefreely-swiftui-multiplatform/issues/135#issuecomment-1101713817
func applicationDidChangeOcclusionState(_ notification: Notification) { func applicationDidChangeOcclusionState(_ notification: Notification) {
if let window = NSApp.windows.first, window.isMiniaturized { if let window = NSApp.windows.first, window.isMiniaturized {
NSWorkspace.shared.runningApplications.first(where: { NSApp.hide(self)
$0.activationPolicy == .regular
})?.activate(options: .activateAllWindows)
} }
} }