Skip to content
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

Remove MRProgress #21438

Merged
merged 4 commits into from
Aug 28, 2023
Merged

Remove MRProgress #21438

merged 4 commits into from
Aug 28, 2023

Conversation

crazytonyli
Copy link
Contributor

Background

The last change to the MRProgress library is 7 years ago. I had to do #21235 recently to make it compile on Xcode 15. Considering it's only used in one place (changing a post's feature image), I have implemented the view we needed and removed the library from the codebase.

Changes

The new StoppableProgressIndicatorView type is our replacement of MRActivityIndicatorView. To make the diff as small as possible, I have made the new type's API compatible with the MRProgress one.

The view is used to display a progress indicator while the feature image is being uploaded. Here is a side by side appearance comparison:

MRActivityIndicatorView StoppableProgressIndicatorView
Progress-before.mp4
Progress-after.mp4

Test Instructions

Go to a post's "Post Settings" and update the post's featured image. Verify different kinds of operations: stop, cancel, re-upload the image, etc.

If you want to inspect the progress indicator animation, you can make following local changes to keep the animation forever:

  1. Checkout the second commit 3d8e4a0
  2. Save the following diff into a file
  3. Run git appply /path/to/diff
  4. Launch the app using Xcode
diff --git a/WordPress/Classes/ViewRelated/Post/PostSettingsViewController.m b/WordPress/Classes/ViewRelated/Post/PostSettingsViewController.m
index b63441d4c3..5eea64113d 100644
--- a/WordPress/Classes/ViewRelated/Post/PostSettingsViewController.m
+++ b/WordPress/Classes/ViewRelated/Post/PostSettingsViewController.m
@@ -795,29 +795,7 @@ FeaturedImageViewControllerDelegate>
 
 - (UITableViewCell *)configureFeaturedImageCellForIndexPath:(NSIndexPath *)indexPath
 {
-    if (!self.apost.featuredImage && !self.isUploadingMedia) {
-        return [self cellForSetFeaturedImage];
-
-    } else if (self.isUploadingMedia || self.apost.featuredImage.remoteStatus == MediaRemoteStatusPushing) {
-        // Is featured Image set on the post and it's being pushed to the server?
-        if (!self.isUploadingMedia) {
-            self.isUploadingMedia = YES;
-            [self setupObservingOfMedia:self.apost.featuredImage];
-        }
-        self.featuredImage = nil;
-        return [self cellForFeaturedImageUploadProgressAtIndexPath:indexPath];
-
-    } else if (self.apost.featuredImage && self.apost.featuredImage.remoteStatus == MediaRemoteStatusFailed) {
-        // Do we have an feature image set and for some reason the upload failed?
-        return [self cellForFeaturedImageError];
-    } else {
-        NSURL *featuredURL = [self urlForFeaturedImage];
-        if (!featuredURL) {
-            return [self cellForSetFeaturedImage];
-        }
-
-        return [self cellForFeaturedImageWithURL:featuredURL atIndexPath:indexPath];
-    }
+    return [self cellForFeaturedImageUploadProgressAtIndexPath:indexPath];
 }
 
 - (UITableViewCell *)configureStickyPostCellForIndexPath:(NSIndexPath *)indexPath
@@ -861,7 +839,10 @@ FeaturedImageViewControllerDelegate>
 {
     self.progressCell = [self.tableView dequeueReusableCellWithIdentifier:TableViewProgressCellIdentifier forIndexPath:indexPath];
     [WPStyleGuide configureTableViewCell:self.progressCell];
-    [self.progressCell setProgress:self.featuredImageProgress];
+
+    NSProgress *progress = [NSProgress discreteProgressWithTotalUnitCount:1000];
+    progress.cancellationHandler = ^(){};
+    [self.progressCell setProgress:progress];
     self.progressCell.tag = PostSettingsRowFeaturedLoading;
     return self.progressCell;
 }

Regression Notes

  1. Potential unintended areas of impact
    None.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    The "Test Instructions"

  3. What automated tests I added (or what prevented me from doing so)
    None.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

@crazytonyli crazytonyli requested a review from mokagio August 28, 2023 01:30
@crazytonyli crazytonyli self-assigned this Aug 28, 2023
@crazytonyli crazytonyli added this to the 23.2 milestone Aug 28, 2023
@wpmobilebot
Copy link
Contributor

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr21438-0ab4a66
Version23.1
Bundle IDorg.wordpress.alpha
Commit0ab4a66
App Center BuildWPiOS - One-Offs #6875
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr21438-0ab4a66
Version23.1
Bundle IDcom.jetpack.alpha
Commit0ab4a66
App Center Buildjetpack-installable-builds #5915
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Comment on lines +28 to +33
- (instancetype)initWithCoder:(NSCoder *)coder
{
NSAssert(false, @"WPProgressTableViewCell can't be created using a nib");
return [super initWithCoder:coder];
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition.

Comment on lines +55 to +58
override func tintColorDidChange() {
super.tintColorDidChange()
updateAppearance()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the videos in the PR description, the tint color of both implementations stands out as the default iOS color against the rest of the Jetpack app the brand green.

Sort of out of scope for this PR, given that the MRProgress implementation also had this inconsistency, but maybe in building this you might have noticed an appropriate spot in the codebase where to set the tint color?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed that. I didn't look into it though. 😓

Comment on lines -48 to -54
- MRProgress (0.8.3):
- MRProgress/ActivityIndicator (= 0.8.3)
- MRProgress/Blur (= 0.8.3)
- MRProgress/Circular (= 0.8.3)
- MRProgress/Icons (= 0.8.3)
- MRProgress/NavigationBarProgress (= 0.8.3)
- MRProgress/Overlay (= 0.8.3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also great to be getting rid of all these other sub-dependencies that we were carrying around without actually using them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marius used to be a CocoaPods contributor, so he probably used it for testing subspecs 👀

@crazytonyli crazytonyli merged commit ac41d5a into trunk Aug 28, 2023
@crazytonyli crazytonyli deleted the remove-mrprogressview branch August 28, 2023 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants