Skip to content

Commit ac41d5a

Browse files
authored
Merge pull request #21438 from wordpress-mobile/remove-mrprogressview
Remove MRProgress
2 parents 7c47251 + 0ab4a66 commit ac41d5a

File tree

6 files changed

+134
-51
lines changed

6 files changed

+134
-51
lines changed

Podfile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ abstract_target 'Apps' do
115115
pod 'AppCenter', app_center_version, configurations: app_center_configurations
116116
pod 'AppCenter/Distribute', app_center_version, configurations: app_center_configurations
117117

118-
pod 'MRProgress', '0.8.3'
119118
pod 'Starscream', '3.0.6'
120119
pod 'SVProgressHUD', '2.2.5'
121120
pod 'ZendeskSupportSDK', '5.3.0'
@@ -428,16 +427,4 @@ post_install do |installer|
428427
yellow_marker = "\033[33m"
429428
reset_marker = "\033[0m"
430429
puts "#{yellow_marker}The abstract target warning below is expected. Feel free to ignore it.#{reset_marker}"
431-
432-
# Fix a compiling issue in Xcode 15 beta.
433-
# This line in particular https://github.com/mrackwitz/MRProgress/blob/0.8.3/src/Components/MRProgressOverlayView.m#L811
434-
# The error message is "Multiple methods named 'setProgress:' found with mismatched result, parameter type or attributes"
435-
# We are going to replace the `id` with `MRProgressView *` (or any other type that has a method `setProgress:` that takes a float argument).
436-
mrprogress_filepath = "#{project_root}/Pods/MRProgress/src/Components/MRProgressOverlayView.m"
437-
File.chmod(0o644, mrprogress_filepath)
438-
lines = File.readlines(mrprogress_filepath)
439-
if lines[810] == " [((id)self.modeView) setProgress:self.progress];\n"
440-
lines[810] = " [((MRProgressView *)self.modeView) setProgress:self.progress];\n"
441-
File.write(mrprogress_filepath, lines.join)
442-
end
443430
end

Podfile.lock

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,34 +45,6 @@ PODS:
4545
- Kanvas (1.4.4)
4646
- MediaEditor (1.2.2):
4747
- CropViewController (~> 2.5.3)
48-
- MRProgress (0.8.3):
49-
- MRProgress/ActivityIndicator (= 0.8.3)
50-
- MRProgress/Blur (= 0.8.3)
51-
- MRProgress/Circular (= 0.8.3)
52-
- MRProgress/Icons (= 0.8.3)
53-
- MRProgress/NavigationBarProgress (= 0.8.3)
54-
- MRProgress/Overlay (= 0.8.3)
55-
- MRProgress/ActivityIndicator (0.8.3):
56-
- MRProgress/Stopable
57-
- MRProgress/Blur (0.8.3):
58-
- MRProgress/Helper
59-
- MRProgress/Circular (0.8.3):
60-
- MRProgress/Helper
61-
- MRProgress/ProgressBaseClass
62-
- MRProgress/Stopable
63-
- MRProgress/Helper (0.8.3)
64-
- MRProgress/Icons (0.8.3)
65-
- MRProgress/NavigationBarProgress (0.8.3):
66-
- MRProgress/ProgressBaseClass
67-
- MRProgress/Overlay (0.8.3):
68-
- MRProgress/ActivityIndicator
69-
- MRProgress/Blur
70-
- MRProgress/Circular
71-
- MRProgress/Helper
72-
- MRProgress/Icons
73-
- MRProgress/ProgressBaseClass (0.8.3)
74-
- MRProgress/Stopable (0.8.3):
75-
- MRProgress/Helper
7648
- NSObject-SafeExpectations (0.0.4)
7749
- "NSURL+IDN (0.4)"
7850
- OCMock (3.4.3)
@@ -157,7 +129,6 @@ DEPENDENCIES:
157129
- JTAppleCalendar (~> 8.0.5)
158130
- Kanvas (~> 1.4.4)
159131
- MediaEditor (>= 1.2.2, ~> 1.2)
160-
- MRProgress (= 0.8.3)
161132
- NSObject-SafeExpectations (~> 0.0.4)
162133
- "NSURL+IDN (~> 0.4)"
163134
- OCMock (~> 3.4.3)
@@ -197,7 +168,6 @@ SPEC REPOS:
197168
- JTAppleCalendar
198169
- Kanvas
199170
- MediaEditor
200-
- MRProgress
201171
- NSObject-SafeExpectations
202172
- "NSURL+IDN"
203173
- OCMock
@@ -263,7 +233,6 @@ SPEC CHECKSUMS:
263233
JTAppleCalendar: 16c6501b22cb27520372c28b0a2e0b12c8d0cd73
264234
Kanvas: f932eaed3d3f47aae8aafb6c2d27c968bdd49030
265235
MediaEditor: d08314cfcbfac74361071a306b4bc3a39b3356ae
266-
MRProgress: 16de7cc9f347e8846797a770db102a323fe7ef09
267236
NSObject-SafeExpectations: ab8fe623d36b25aa1f150affa324e40a2f3c0374
268237
"NSURL+IDN": afc873e639c18138a1589697c3add197fe8679ca
269238
OCMock: 43565190abc78977ad44a61c0d20d7f0784d35ab
@@ -294,6 +263,6 @@ SPEC CHECKSUMS:
294263
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
295264
ZIPFoundation: ae5b4b813d216d3bf0a148773267fff14bd51d37
296265

297-
PODFILE CHECKSUM: e54eeda47b03e4225509b2162f40d720a5708616
266+
PODFILE CHECKSUM: 84696d620643641ef8db3ddce7eae79ea144286e
298267

299268
COCOAPODS: 1.12.1

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [**] [internal] Fix a crash when disconnecting the app from the "Connected Applications" on WordPress.com. [#21375]
77
* [*] Fix an issue where the "Take Photo" flow was not working without the "All Photos" access [#21398](https://github.com/wordpress-mobile/WordPress-iOS/pull/21398)
88
* [*] Fix a couple of small issues with media uploads error handling [#21411](https://github.com/wordpress-mobile/WordPress-iOS/pull/21411)
9+
* [**] [internal] Replace the progress indicator implementation in uploading featured image from "Post Settings" [#21438]
910

1011
23.0.1
1112
-----

WordPress/Classes/ViewRelated/Cells/WPProgressTableViewCell.m

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#import "WPProgressTableViewCell.h"
2-
#pragma clang diagnostic push
3-
#pragma clang diagnostic ignored "-Wstrict-prototypes"
4-
#import "MRProgress.h"
5-
#pragma clang diagnostic pop
2+
#import "WordPress-Swift.h"
63

74
static void *ProgressObserverContext = &ProgressObserverContext;
85

96
NSProgressUserInfoKey const WPProgressImageThumbnailKey = @"WPProgressImageThumbnailKey";
107
@interface WPProgressTableViewCell ()
118

12-
@property (nonatomic, strong) IBOutlet MRActivityIndicatorView * progressView;
9+
@property (nonatomic, strong) StoppableProgressIndicatorView * progressView;
1310

1411
@end
1512

@@ -21,13 +18,19 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
2118
{
2219
self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
2320
if (self) {
24-
_progressView = [[MRActivityIndicatorView alloc] initWithFrame:CGRectMake(10.0,0.0,40.0,40.0)];
21+
_progressView = [[StoppableProgressIndicatorView alloc] initWithFrame:CGRectMake(10.0,0.0,40.0,40.0)];
2522
_progressView.hidden = YES;
2623
self.accessoryView = _progressView;
2724
}
2825
return self;
2926
}
3027

28+
- (instancetype)initWithCoder:(NSCoder *)coder
29+
{
30+
NSAssert(false, @"WPProgressTableViewCell can't be created using a nib");
31+
return [super initWithCoder:coder];
32+
}
33+
3134
- (void)dealloc
3235
{
3336
[_progress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))];
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import Foundation
2+
import UIKit
3+
4+
private let rotationAnimationKey = "rotation"
5+
6+
@objcMembers class StoppableProgressIndicatorView: UIView {
7+
8+
private let progressIndicator: CAShapeLayer
9+
let stopButton: UIControl
10+
11+
var hidesWhenStopped: Bool = true {
12+
didSet {
13+
if hidesWhenStopped, !isAnimating {
14+
isHidden = true
15+
}
16+
}
17+
}
18+
19+
var mayStop: Bool {
20+
get { !stopButton.isHidden }
21+
set { stopButton.isHidden = !newValue }
22+
}
23+
24+
var isAnimating: Bool {
25+
progressIndicator.animation(forKey: rotationAnimationKey) != nil
26+
}
27+
28+
private var resumeAnimation: Bool = true
29+
30+
override init(frame: CGRect) {
31+
stopButton = UIControl(frame: .zero)
32+
progressIndicator = CAShapeLayer()
33+
progressIndicator.isHidden = true
34+
progressIndicator.lineWidth = 2
35+
super.init(frame: frame)
36+
37+
layer.addSublayer(progressIndicator)
38+
addSubview(stopButton)
39+
stopButton.translatesAutoresizingMaskIntoConstraints = false
40+
NSLayoutConstraint.activate([
41+
stopButton.centerXAnchor.constraint(equalTo: centerXAnchor),
42+
stopButton.centerYAnchor.constraint(equalTo: centerYAnchor),
43+
stopButton.widthAnchor.constraint(equalTo: stopButton.heightAnchor),
44+
stopButton.widthAnchor.constraint(equalTo: widthAnchor, multiplier: 0.3),
45+
])
46+
47+
updateAppearance()
48+
NotificationCenter.default.addObserver(self, selector: #selector(enterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
49+
}
50+
51+
required init?(coder: NSCoder) {
52+
fatalError("init(coder:) has not been implemented")
53+
}
54+
55+
override func tintColorDidChange() {
56+
super.tintColorDidChange()
57+
updateAppearance()
58+
}
59+
60+
override func layoutSubviews() {
61+
super.layoutSubviews()
62+
progressIndicator.frame = layer.bounds
63+
resetIndicatorShape()
64+
}
65+
66+
func startAnimating() {
67+
if isAnimating {
68+
return
69+
}
70+
71+
isHidden = false
72+
progressIndicator.isHidden = false
73+
resumeAnimation = true
74+
75+
let rotation = CABasicAnimation(keyPath: "transform.rotation")
76+
rotation.toValue = CGFloat.pi * 2
77+
rotation.duration = 1
78+
rotation.repeatCount = Float.infinity
79+
progressIndicator.add(rotation, forKey: rotationAnimationKey)
80+
}
81+
82+
func stopAnimating() {
83+
resumeAnimation = false
84+
progressIndicator.removeAnimation(forKey: rotationAnimationKey)
85+
progressIndicator.isHidden = true
86+
87+
if hidesWhenStopped {
88+
isHidden = true
89+
}
90+
}
91+
92+
func enterForeground() {
93+
if resumeAnimation {
94+
startAnimating()
95+
}
96+
}
97+
98+
private func resetIndicatorShape() {
99+
let bounds = progressIndicator.bounds
100+
let path = CGMutablePath()
101+
path.addArc(
102+
center: CGPoint(x: bounds.midX, y: bounds.midY),
103+
radius: (bounds.width - progressIndicator.lineWidth) / 2,
104+
startAngle: -CGFloat.pi / 2,
105+
endAngle: -CGFloat.pi / 2 + CGFloat.pi * 1.8,
106+
clockwise: false
107+
)
108+
progressIndicator.path = path
109+
}
110+
111+
private func updateAppearance() {
112+
stopButton.backgroundColor = tintColor
113+
progressIndicator.strokeColor = tintColor.cgColor
114+
progressIndicator.fillColor = nil
115+
}
116+
117+
}

WordPress/WordPress.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,8 @@
12861286
4AD5657028E413160054C676 /* Blog+History.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AD5656E28E413160054C676 /* Blog+History.swift */; };
12871287
4AD5657228E543A30054C676 /* BlogQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AD5657128E543A30054C676 /* BlogQueryTests.swift */; };
12881288
4AEF2DD929A84B2C00345734 /* ReaderSiteServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AEF2DD829A84B2C00345734 /* ReaderSiteServiceTests.swift */; };
1289+
4AFB1A812A9C08CE007CE165 /* StoppableProgressIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AFB1A802A9C08CE007CE165 /* StoppableProgressIndicatorView.swift */; };
1290+
4AFB1A822A9C08CE007CE165 /* StoppableProgressIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AFB1A802A9C08CE007CE165 /* StoppableProgressIndicatorView.swift */; };
12891291
4AFB8FBF2824999500A2F4B2 /* ContextManager+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AFB8FBE2824999400A2F4B2 /* ContextManager+Helpers.swift */; };
12901292
4B2DD0F29CD6AC353C056D41 /* Pods_WordPressUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DCE7542239FBC709B90EA85 /* Pods_WordPressUITests.framework */; };
12911293
4BB2296498BE66D515E3D610 /* Pods_JetpackShareExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23052F0F1F9B2503E33D0A26 /* Pods_JetpackShareExtension.framework */; };
@@ -6865,6 +6867,7 @@
68656867
4AD5656E28E413160054C676 /* Blog+History.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Blog+History.swift"; sourceTree = "<group>"; };
68666868
4AD5657128E543A30054C676 /* BlogQueryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlogQueryTests.swift; sourceTree = "<group>"; };
68676869
4AEF2DD829A84B2C00345734 /* ReaderSiteServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderSiteServiceTests.swift; sourceTree = "<group>"; };
6870+
4AFB1A802A9C08CE007CE165 /* StoppableProgressIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoppableProgressIndicatorView.swift; sourceTree = "<group>"; };
68686871
4AFB8FBE2824999400A2F4B2 /* ContextManager+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ContextManager+Helpers.swift"; sourceTree = "<group>"; };
68696872
4D520D4E22972BC9002F5924 /* acknowledgements.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = acknowledgements.html; path = "../Pods/Target Support Files/Pods-Apps-WordPress/acknowledgements.html"; sourceTree = "<group>"; };
68706873
4D670B9448DF9991366CF42D /* Pods_WordPressStatsWidgets.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WordPressStatsWidgets.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -9871,6 +9874,7 @@
98719874
FADFBD25265F580500039C41 /* MultilineButton.swift */,
98729875
808C578E27C7FB1A0099A92C /* ButtonScrollView.swift */,
98739876
0C8078AA2A4E01A5002ABF29 /* PagingFooterView.swift */,
9877+
4AFB1A802A9C08CE007CE165 /* StoppableProgressIndicatorView.swift */,
98749878
);
98759879
path = Views;
98769880
sourceTree = "<group>";
@@ -22583,6 +22587,7 @@
2258322587
FE7B9A8A2A6BD20200488791 /* PrepublishingSocialAccountsTableFooterView.swift in Sources */,
2258422588
E15632CC1EB9ECF40035A099 /* TableViewKeyboardObserver.swift in Sources */,
2258522589
E1A03F48174283E10085D192 /* BlogToJetpackAccount.m in Sources */,
22590+
4AFB1A812A9C08CE007CE165 /* StoppableProgressIndicatorView.swift in Sources */,
2258622591
B522C4F81B3DA79B00E47B59 /* NotificationSettingsViewController.swift in Sources */,
2258722592
FEC26033283FC902003D886A /* RootViewCoordinator+BloggingPrompt.swift in Sources */,
2258822593
93E63369272AC532009DACF8 /* LoginEpilogueChooseSiteTableViewCell.swift in Sources */,
@@ -24816,6 +24821,7 @@
2481624821
FABB23C52602FC2C00C8785C /* JetpackScanViewController.swift in Sources */,
2481724822
FABB23C62602FC2C00C8785C /* ReaderSubscribingNotificationAction.swift in Sources */,
2481824823
FABB23C72602FC2C00C8785C /* GutenbergMediaInserterHelper.swift in Sources */,
24824+
4AFB1A822A9C08CE007CE165 /* StoppableProgressIndicatorView.swift in Sources */,
2481924825
FABB23C92602FC2C00C8785C /* JetpackState.swift in Sources */,
2482024826
FABB23CA2602FC2C00C8785C /* EditPostViewController.swift in Sources */,
2482124827
0141929D2983F0A300CAEDB0 /* SupportConfiguration.swift in Sources */,

0 commit comments

Comments
 (0)