Update collection alias when refreshing moved posts (#250)

This commit is contained in:
Angelo Stavrow 2023-06-10 07:33:44 -04:00 committed by GitHub
parent 6bb8be4d46
commit ba3f44b287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 8 deletions

View File

@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Mac] Fixed some build warnings in the project.
- [Mac] Bumped WriteFreely package to v0.3.6 to handle decoding of fractional seconds in dates.
- [Mac] Fixed a bug that prevented a remotely-edited post from updating until you navigated away and back.
- [iOS, Mac] Fixed a bug where posts moved from one blog to another on a different client didn't update in the app.
## [1.0.15-ios] - 2022-01-15

View File

@ -113,6 +113,7 @@ extension WriteFreelyModel {
}
}
// swiftlint:disable function_body_length
func fetchUserPostsHandler(result: Result<[WFPost], Error>) {
// We're done with the network request.
DispatchQueue.main.async {
@ -136,6 +137,15 @@ extension WriteFreelyModel {
"Error updating post: could not determine which copy of post is newer."
)
}
if managedPost.collectionAlias != fetchedPost.collectionAlias {
// The post has been moved so we update the managed post's collectionAlias property.
DispatchQueue.main.async {
if self.selectedPost == managedPost {
self.selectedPost = nil
}
managedPost.collectionAlias = fetchedPost.collectionAlias
}
}
postsToDelete.removeAll(where: { $0.postId == fetchedPost.postId })
}
} else {
@ -161,6 +171,7 @@ extension WriteFreelyModel {
self.currentError = LocalStoreError.couldNotFetchPosts("cached")
}
}
// swiftlint:enable function_body_length
func publishHandler(result: Result<WFPost, Error>) {
// We're done with the network request.

View File

@ -1063,7 +1063,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 700;
CURRENT_PROJECT_VERSION = 701;
DEVELOPMENT_TEAM = TPPAB4YBA6;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
@ -1075,7 +1075,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.15;
MARKETING_VERSION = 1.0.16;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform.ActionExtension-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@ -1094,7 +1094,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 700;
CURRENT_PROJECT_VERSION = 701;
DEVELOPMENT_TEAM = TPPAB4YBA6;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "ActionExtension-iOS/Info.plist";
@ -1106,7 +1106,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.15;
MARKETING_VERSION = 1.0.16;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform.ActionExtension-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@ -1237,7 +1237,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 700;
CURRENT_PROJECT_VERSION = 701;
DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist;
@ -1246,7 +1246,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.15;
MARKETING_VERSION = 1.0.16;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform";
PRODUCT_NAME = "WriteFreely-MultiPlatform";
SDKROOT = iphoneos;
@ -1263,7 +1263,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 700;
CURRENT_PROJECT_VERSION = 701;
DEVELOPMENT_TEAM = TPPAB4YBA6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist;
@ -1272,7 +1272,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.15;
MARKETING_VERSION = 1.0.16;
PRODUCT_BUNDLE_IDENTIFIER = "com.abunchtell.WriteFreely-MultiPlatform";
PRODUCT_NAME = "WriteFreely-MultiPlatform";
SDKROOT = iphoneos;