Provide a context menu for deleting posts (#232)

* Delete local posts from post list via context menu

* Build build number

* Bump version/build numbers

* Update change log
This commit is contained in:
Angelo Stavrow 2022-11-19 09:10:24 -05:00 committed by GitHub
parent 9e71e3f113
commit fcd7c167c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 10 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Mac] Holding the Shift key when launching clears the app's "last draft" state and instead loads a new blank draft.
- [Mac] Added a menu item for toggling the toolbar.
- [Mac] In a post with unpublished changes (i.e., with "local" or "edited" status), the post is autosaved after a one-second pause in typing.
- [iOS/Mac] Added a context-menu item to delete local posts from the post list.
### Changed

View File

@ -41,6 +41,25 @@ struct PostCellView: View {
PostStatusBadgeView(post: post)
}
.padding(5)
.contextMenu {
Button(
action: didTapDeleteContextMenuItem,
label: { Label("Delete", systemImage: "trash") }
)
.disabled(post.status != PostStatus.local.rawValue)
}
}
private func didTapDeleteContextMenuItem() {
guard post.status == PostStatus.local.rawValue else { return }
if post === model.selectedPost {
model.selectedPost = nil
model.editor.clearLastDraft()
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
model.posts.remove(post)
}
}
}

View File

@ -1050,7 +1050,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 687;
CURRENT_PROJECT_VERSION = 690;
DEVELOPMENT_TEAM = TPPAB4YBA6;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
@ -1062,7 +1062,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.13;
MARKETING_VERSION = 1.0.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform.ActionExtension-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@ -1081,7 +1081,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 687;
CURRENT_PROJECT_VERSION = 690;
DEVELOPMENT_TEAM = TPPAB4YBA6;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
@ -1093,7 +1093,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.13;
MARKETING_VERSION = 1.0.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform.ActionExtension-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@ -1224,7 +1224,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 687;
CURRENT_PROJECT_VERSION = 690;
DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist;
@ -1233,7 +1233,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.13;
MARKETING_VERSION = 1.0.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform";
PRODUCT_NAME = "WriteFreely-MultiPlatform";
SDKROOT = iphoneos;
@ -1250,7 +1250,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 687;
CURRENT_PROJECT_VERSION = 690;
DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist;
@ -1259,7 +1259,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.13;
MARKETING_VERSION = 1.0.14;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform";
PRODUCT_NAME = "WriteFreely-MultiPlatform";
SDKROOT = iphoneos;
@ -1278,7 +1278,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 687;
CURRENT_PROJECT_VERSION = 690;
DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
@ -1305,7 +1305,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 687;
CURRENT_PROJECT_VERSION = 690;
DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;