Skip to content

Options should be nullable for subscription #1085

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

Merged
merged 3 commits into from
Apr 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Example/Messaging/Tests/FIRMessagingServiceTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,15 @@ - (void)testSubscribeWithInvalidTopic {
XCTestExpectation *exceptionExpectation =
[self expectationWithDescription:@"Should throw exception for invalid token"];
@try {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: When testing, you can just cast nil pointers to nonnull types. (id _Nonnull)nil

[messaging.pubsub subscribeWithToken:@"abcdef1234"
topic:nil
options:nil
handler:^(NSError *error) {
XCTFail(@"Should not invoke the handler");
}];
#pragma clang diagnostic pop
}
@catch (NSException *exception) {
[exceptionExpectation fulfill];
Expand All @@ -169,12 +172,15 @@ - (void)testUnsubscribeWithInvalidTopic {
XCTestExpectation *exceptionExpectation =
[self expectationWithDescription:@"Should throw exception for invalid token"];
@try {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
[messaging.pubsub unsubscribeWithToken:@"abcdef1234"
topic:nil
options:nil
handler:^(NSError *error) {
XCTFail(@"Should not invoke the handler");
}];
#pragma clang diagnostic pop
}
@catch (NSException *exception) {
[exceptionExpectation fulfill];
Expand Down
4 changes: 2 additions & 2 deletions Firebase/Messaging/FIRMessagingPubSub.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)subscribeWithToken:(NSString *)token
topic:(NSString *)topic
options:(NSDictionary *)options
options:(nullable NSDictionary *)options
handler:(FIRMessagingTopicOperationCompletion)handler;

/**
Expand All @@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)unsubscribeWithToken:(NSString *)token
topic:(NSString *)topic
options:(NSDictionary *)options
options:(nullable NSDictionary *)options
handler:(FIRMessagingTopicOperationCompletion)handler;

/**
Expand Down