Skip to content

Commit 7f6cac6

Browse files
committed
Revert "Add nullability modifiers"
This reverts commit 5903404.
1 parent 8c90fee commit 7f6cac6

File tree

5 files changed

+49
-38
lines changed

5 files changed

+49
-38
lines changed

WordPress/Classes/Services/ReaderTopicService.h

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#import <Foundation/Foundation.h>
22
#import "CoreDataStack.h"
33

4-
NS_ASSUME_NONNULL_BEGIN
5-
64
extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
75

86
@class ReaderAbstractTopic;
@@ -14,11 +12,11 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
1412

1513
@property (nonatomic, strong, readonly) id<CoreDataStack> coreDataStack;
1614

17-
- (instancetype)initWithCoreDataStack:(id<CoreDataStack>)coreDataStack NS_DESIGNATED_INITIALIZER;
15+
- (nonnull instancetype)initWithCoreDataStack:(id<CoreDataStack>)coreDataStack NS_DESIGNATED_INITIALIZER;
1816

1917
- (instancetype)init NS_UNAVAILABLE;
2018

21-
- (nullable ReaderAbstractTopic *)currentTopicInContext:(NSManagedObjectContext *)context;
19+
- (ReaderAbstractTopic *)currentTopicInContext:(NSManagedObjectContext *)context;
2220

2321
- (void)setCurrentTopic:(ReaderAbstractTopic *)topic;
2422

@@ -28,7 +26,7 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
2826
@param success block called on a successful fetch.
2927
@param failure block called if there is any error. `error` can be any underlying network error.
3028
*/
31-
- (void)fetchReaderMenuWithSuccess:(void (^)(void))success failure:(void (^)(NSError * _Nullable error))failure;
29+
- (void)fetchReaderMenuWithSuccess:(void (^)(void))success failure:(void (^)(NSError *error))failure;
3230

3331
/**
3432
Deletes all search topics from core data and saves the context.
@@ -63,7 +61,7 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
6361
@param phrase: The search phrase.
6462
@param completion: A completion callback to receive the created ReaderSearchTopic instance.
6563
*/
66-
- (void)createSearchTopicForSearchPhrase:(NSString *)phrase completion:(void (^)(NSManagedObjectID * _Nullable objectID))completion;
64+
- (void)createSearchTopicForSearchPhrase:(NSString *)phrase completion:(void (^)(NSManagedObjectID *))completion;
6765

6866
/**
6967
Unfollows the specified topic
@@ -72,7 +70,7 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
7270
@param success block called on a successful fetch.
7371
@param failure block called if there is any error. `error` can be any underlying network error.
7472
*/
75-
- (void)unfollowTag:(ReaderTagTopic *)topic withSuccess:(void (^)(void))success failure:(void (^)(NSError * _Nullable error))failure;
73+
- (void)unfollowTag:(ReaderTagTopic *)topic withSuccess:(void (^)(void))success failure:(void (^)(NSError *error))failure;
7674

7775
/**
7876
Follow the tag with the specified name
@@ -83,7 +81,7 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
8381
*/
8482
- (void)followTagNamed:(NSString *)tagName
8583
withSuccess:(void (^)(void))success
86-
failure:(void (^)(NSError * _Nullable error))failure
84+
failure:(void (^)(NSError *error))failure
8785
source:(NSString *)source;
8886

8987
/**
@@ -93,7 +91,7 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
9391
@param success block called on a successful change.
9492
@param failure block called if there is any error. `error` can be any underlying network error.
9593
*/
96-
- (void)toggleFollowingForTag:(ReaderTagTopic *)topic success:(void (^)(void))success failure:(void (^)(NSError * _Nullable error))failure;
94+
- (void)toggleFollowingForTag:(ReaderTagTopic *)topic success:(void (^)(void))success failure:(void (^)(NSError *error))failure;
9795

9896
/**
9997
Toggle the following status of the site for the specified site topic
@@ -104,7 +102,7 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
104102
*/
105103
- (void)toggleFollowingForSite:(ReaderSiteTopic *)topic
106104
success:(void (^)(BOOL follow))success
107-
failure:(void (^)(BOOL follow, NSError * _Nullable error))failure;
105+
failure:(void (^)(BOOL follow, NSError *error))failure;
108106

109107
/**
110108
Fetch a tag topic for a tag with the specified slug.
@@ -114,8 +112,8 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
114112
@param failure block called if there is any error. `error` can be any underlying network error.
115113
*/
116114
- (void)tagTopicForTagWithSlug:(NSString *)slug
117-
success:(void(^)(NSManagedObjectID * _Nullable objectID))success
118-
failure:(void (^)(NSError * _Nullable error))failure;
115+
success:(void(^)(NSManagedObjectID *objectID))success
116+
failure:(void (^)(NSError *error))failure;
119117

120118
/**
121119
Fetch a site topic for a site with the specified ID.
@@ -127,8 +125,8 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
127125
*/
128126
- (void)siteTopicForSiteWithID:(NSNumber *)siteID
129127
isFeed:(BOOL)isFeed
130-
success:(void (^)(NSManagedObjectID * _Nullable objectID, BOOL isFollowing))success
131-
failure:(void (^)(NSError * _Nullable error))failure;
128+
success:(void (^)(NSManagedObjectID *objectID, BOOL isFollowing))success
129+
failure:(void (^)(NSError *error))failure;
132130

133131
@end
134132

@@ -138,5 +136,3 @@ extern NSString * const ReaderTopicFreshlyPressedPathCommponent;
138136
- (void)mergeMenuTopics:(NSArray *)topics isLoggedIn:(BOOL)isLoggedIn withSuccess:(void (^)(void))success;
139137
- (NSString *)formatTitle:(NSString *)str;
140138
@end
141-
142-
NS_ASSUME_NONNULL_END

WordPress/Classes/ViewRelated/Reader/Controllers/ReaderStreamViewController.swift

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -435,21 +435,23 @@ import AutomatticTracks
435435
if isViewLoaded {
436436
displayLoadingStream()
437437
}
438-
guard let tagSlug else {
439-
return wpAssertionFailure("tag slug is missing")
440-
}
438+
assert(tagSlug != nil, "A tag slug is requred before fetching a tag topic")
441439
let service = ReaderTopicService(coreDataStack: ContextManager.shared)
442-
service.tagTopicForTag(withSlug: tagSlug, success: { [weak self] objectID in
443-
let context = ContextManager.shared.mainContext
444-
guard let objectID, let topic = (try? context.existingObject(with: objectID)) as? ReaderAbstractTopic else {
445-
DDLogError("Reader: Error retriving an existing tag topic by its objectID")
440+
service.tagTopicForTag(withSlug: tagSlug,
441+
success: { [weak self] (objectID: NSManagedObjectID?) in
442+
443+
let context = ContextManager.shared.mainContext
444+
guard let objectID, let topic = (try? context.existingObject(with: objectID)) as? ReaderAbstractTopic else {
445+
DDLogError("Reader: Error retriving an existing tag topic by its objectID")
446+
self?.displayLoadingStreamFailed()
447+
return
448+
}
449+
self?.readerTopic = topic
450+
451+
},
452+
failure: { [weak self] (error: Error?) in
446453
self?.displayLoadingStreamFailed()
447-
return
448-
}
449-
self?.readerTopic = topic
450-
}, failure: { [weak self] _ in
451-
self?.displayLoadingStreamFailed()
452-
})
454+
})
453455
}
454456

455457
// MARK: - Setup

WordPress/Classes/ViewRelated/Reader/Manage/ReaderTagsTableViewModel.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,15 @@ extension ReaderTagsTableViewModel {
209209
/// - topic: The tag topic that is to be unfollowed.
210210
private func unfollow(_ topic: ReaderTagTopic) {
211211
let service = ReaderTopicService(coreDataStack: ContextManager.shared)
212-
service.unfollowTag(topic, withSuccess: {
213-
// Do nothing
214-
}, failure: { error in
212+
service.unfollowTag(topic, withSuccess: nil) { (error) in
215213
DDLogError("Could not unfollow topic \(topic), \(String(describing: error))")
216214

217215
let title = NSLocalizedString("Could Not Remove Topic", comment: "Title of a prompt informing the user there was a probem unsubscribing from a topic in the reader.")
218216
let message = error?.localizedDescription
219217
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
220218
alert.addCancelActionWithTitle(SharedStrings.Button.ok)
221219
alert.presentFromRootViewController()
222-
})
220+
}
223221
}
224222

225223
/// Scrolls the tableView so the specified tag is in view and flashes that row

WordPress/WordPress-Swift.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// Due to a known issue, the compiler produces warnings on the Swift code that an intent definition file generates.
2+
/// Ref: https://developer.apple.com/forums/thread/686448
3+
/// As a workaround, we ignore all multiple method declarations warnings when importing WordPress-Swift.h
4+
#pragma clang diagnostic push
5+
#pragma clang diagnostic ignored "-Wduplicate-method-match"
6+
#import "WordPress-Swift-XcodeGenerated.h"
7+
#pragma clang diagnostic pop

WordPress/WordPress.xcodeproj/project.pbxproj

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@
14501450
7EC9FE0A22C627DB00C5A888 /* PostEditorAnalyticsSessionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostEditorAnalyticsSessionTests.swift; sourceTree = "<group>"; };
14511451
7EF2EE9F210A67B60007A76B /* notifications-unapproved-comment.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "notifications-unapproved-comment.json"; sourceTree = "<group>"; };
14521452
801D951C291ADB7E0051993E /* OverlayFrequencyTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayFrequencyTrackerTests.swift; sourceTree = "<group>"; };
1453+
80293CF6284450AD0083F946 /* WordPress-Swift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WordPress-Swift.h"; sourceTree = "<group>"; };
14531454
80379C6D2A5C0D8F00D924AC /* PostTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostTests.swift; sourceTree = "<group>"; };
14541455
803BB99329667CF700B3F6D6 /* JetpackBrandingTextProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackBrandingTextProviderTests.swift; sourceTree = "<group>"; };
14551456
803DE81828FFB7B5007D4E9C /* RemoteParameterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteParameterTests.swift; sourceTree = "<group>"; };
@@ -2010,11 +2011,6 @@
20102011
path = Sources;
20112012
sourceTree = "<group>";
20122013
};
2013-
0C5A1A042D9B080900C25301 /* WordPressAuthenticatorTests */ = {
2014-
isa = PBXFileSystemSynchronizedRootGroup;
2015-
path = WordPressAuthenticatorTests;
2016-
sourceTree = "<group>";
2017-
};
20182014
0C5A3FAB2D9B1EF400C25301 /* Reader */ = {
20192015
isa = PBXFileSystemSynchronizedRootGroup;
20202016
exceptions = (
@@ -2023,6 +2019,11 @@
20232019
path = Reader;
20242020
sourceTree = "<group>";
20252021
};
2022+
0C5A1A042D9B080900C25301 /* WordPressAuthenticatorTests */ = {
2023+
isa = PBXFileSystemSynchronizedRootGroup;
2024+
path = WordPressAuthenticatorTests;
2025+
sourceTree = "<group>";
2026+
};
20262027
0C5C46FE2D98397A00F2CD55 /* Keystone */ = {
20272028
isa = PBXFileSystemSynchronizedRootGroup;
20282029
exceptions = (
@@ -2559,6 +2560,7 @@
25592560
8D1107310486CEB800E47090 /* Info.plist */,
25602561
931DF4D818D09A2F00540BDD /* InfoPlist.strings */,
25612562
E1D91454134A853D0089019C /* Localizable.strings */,
2563+
80293CF6284450AD0083F946 /* WordPress-Swift.h */,
25622564
4A690C142BA790BC00A8E0C5 /* PrivacyInfo.xcprivacy */,
25632565
);
25642566
name = Resources;
@@ -6845,6 +6847,7 @@
68456847
PRODUCT_NAME = WordPress;
68466848
PROVISIONING_PROFILE_SPECIFIER = "WordPress Development";
68476849
SWIFT_OBJC_BRIDGING_HEADER = "Classes/System/WordPress-Bridging-Header.h";
6850+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift-XcodeGenerated.h";
68486851
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
68496852
SWIFT_VERSION = 5.0;
68506853
TARGETED_DEVICE_FAMILY = "1,2";
@@ -6900,6 +6903,7 @@
69006903
PRODUCT_NAME = WordPress;
69016904
PROVISIONING_PROFILE_SPECIFIER = "match AppStore org.wordpress";
69026905
SWIFT_OBJC_BRIDGING_HEADER = "Classes/System/WordPress-Bridging-Header.h";
6906+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift-XcodeGenerated.h";
69036907
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
69046908
SWIFT_VERSION = 5.0;
69056909
TARGETED_DEVICE_FAMILY = "1,2";
@@ -8083,6 +8087,7 @@
80838087
PRODUCT_NAME = WordPress;
80848088
PROVISIONING_PROFILE_SPECIFIER = "match InHouse org.wordpress.alpha";
80858089
SWIFT_OBJC_BRIDGING_HEADER = "Classes/System/WordPress-Bridging-Header.h";
8090+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift-XcodeGenerated.h";
80868091
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
80878092
SWIFT_VERSION = 5.0;
80888093
TARGETED_DEVICE_FAMILY = "1,2";
@@ -8651,6 +8656,7 @@
86518656
PRODUCT_NAME = "$(TARGET_NAME)";
86528657
PROVISIONING_PROFILE_SPECIFIER = "Jetpack iOS Development";
86538658
SWIFT_OBJC_BRIDGING_HEADER = "Classes/System/WordPress-Bridging-Header.h";
8659+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift-XcodeGenerated.h";
86548660
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
86558661
SWIFT_VERSION = 5.0;
86568662
TARGETED_DEVICE_FAMILY = "1,2";
@@ -8706,6 +8712,7 @@
87068712
PRODUCT_NAME = "$(TARGET_NAME)";
87078713
PROVISIONING_PROFILE_SPECIFIER = "match AppStore com.automattic.jetpack";
87088714
SWIFT_OBJC_BRIDGING_HEADER = "Classes/System/WordPress-Bridging-Header.h";
8715+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift-XcodeGenerated.h";
87098716
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
87108717
SWIFT_VERSION = 5.0;
87118718
TARGETED_DEVICE_FAMILY = "1,2";
@@ -8757,6 +8764,7 @@
87578764
PRODUCT_NAME = "$(TARGET_NAME)";
87588765
PROVISIONING_PROFILE_SPECIFIER = "match InHouse com.jetpack.alpha";
87598766
SWIFT_OBJC_BRIDGING_HEADER = "Classes/System/WordPress-Bridging-Header.h";
8767+
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift-XcodeGenerated.h";
87608768
SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
87618769
SWIFT_VERSION = 5.0;
87628770
TARGETED_DEVICE_FAMILY = "1,2";

0 commit comments

Comments
 (0)