-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offline Mode: Sync Publishing #22689
Conversation
@@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN | |||
|
|||
/** | |||
BOOL flag set to true if the post is first time published. | |||
|
|||
- note: Deprecated (kahu-offline-mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using this marker for anything that's scheduled for removal once the project is live. I'm not "officially"deprecating these APIs to avoid polluting the project with warnings.
/// | ||
/// - warning: Work-in-progress (kahu-offline-mode) | ||
@MainActor | ||
func _publish(_ post: AbstractPost) async throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm underscoring the methods that are work-in-progress and are only designed to be used in the scope of the project. It also helps avoid the name conflicts.
notifyNewPostPublished() | ||
} | ||
SearchManager.shared.indexItem(post) | ||
AppRatingUtility.shared.incrementSignificantEvent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything non-editor related is now handled by PostCoordinator
to allow you to safely publish outside of the editor.
Noting that it no longer sets post.shouldAttemptAutoUpload = true
and no longer uses isFirstTimePublish
which should never have been part of the model layer.
/// | ||
/// - warning: Work-in-progress (kahu-offline-mode) | ||
@MainActor | ||
func _upload(_ parameters: RemotePost, for post: AbstractPost) async throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameters: RemotePost
– this will definitely change, but the idea is that by bringing back synchronous operations, we need a way to:
- Send the request with new parameters without updating the database to make sure there is nothing to revert if it fails
- Be able to send only what's changes and that's coming in the next scopes
post = original | ||
} | ||
PostHelper.update(post, with: uploadedPost, in: context) | ||
PostService(managedObjectContext: context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method, including updateMediaFor
is pretty much one-to-one replacement to the Objective-C version from PostService
that Tony replaced with PostRepository
.
updateMediaFor
is an odd one. It set the postID
for assets, but it makes little scene because asset->post is a one-to-many relationship.
let viewController = PrepublishingViewController(post: post, identifiers: prepublishingIdentifiers) { [weak self] result in | ||
switch result { | ||
case .completed(let post): | ||
self?.post = post |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a no-op because the post instance never changes.
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr22689-5205217 | |
Version | 24.3 | |
Bundle ID | com.jetpack.alpha | |
Commit | 5205217 | |
App Center Build | jetpack-installable-builds #8105 |
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr22689-5205217 | |
Version | 24.3 | |
Bundle ID | org.wordpress.alpha | |
Commit | 5205217 | |
App Center Build | WPiOS - One-Offs #9062 |
a83b389
to
0a155d2
Compare
0a155d2
to
8047234
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as described!
I wonder if we should continue showing the success notice message when creating a post/page from the FAB. IMO I don't think the implicit indication of closing the editor is enough - I'd expect to see some explicit indication that the post was uploaded (if I'm on the My Site screen).
sync-publishing-from-fab.mp4
Co-authored-by: Momo Ozawa <[email protected]>
Co-authored-by: Momo Ozawa <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to unblock - lmk what you think of adding an explicit message to acknowledge a successful upload for the FAB flow.
Test cases for notifications: Success (Notice)
Success (Local Notification)
Failure (Notice)
Failure (Local Notification)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test cases work as described
Part of #22579
To test:
Important
Make sure to enable the
.offlineMode
feature flag.This is the only scenario that is now officially supported. We'll need more tests, including automated test in the future PRs.
Regression Notes
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist: