mirror of
https://github.com/google/GoogleUtilities
synced 2026-11-09 22:25:54 +05:45
Update style (#229)
This commit is contained in:
1 parent
5f2a543edb
commit
5d06b17529
4 files changed
+53
-51
No files matched your search
@@ -399,8 +399,8 @@ static dispatch_once_t sProxyAppDelegateRemoteNotificationOnceToken;
|
||||
}
|
||||
|
||||
// For application:handleEventsForBackgroundURLSession:completionHandler:
|
||||
SEL handleEventsForBackgroundURLSessionSEL = @selector(application:
|
||||
handleEventsForBackgroundURLSession:completionHandler:);
|
||||
SEL handleEventsForBackgroundURLSessionSEL =
|
||||
@selector(application:handleEventsForBackgroundURLSession:completionHandler:);
|
||||
[self proxyDestinationSelector:handleEventsForBackgroundURLSessionSEL
|
||||
implementationsFromSourceSelector:handleEventsForBackgroundURLSessionSEL
|
||||
fromClass:[GULAppDelegateSwizzler class]
|
||||
@@ -411,8 +411,8 @@ static dispatch_once_t sProxyAppDelegateRemoteNotificationOnceToken;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
// For application:openURL:sourceApplication:annotation:
|
||||
SEL openURLSourceApplicationAnnotationSEL = @selector(application:
|
||||
openURL:sourceApplication:annotation:);
|
||||
SEL openURLSourceApplicationAnnotationSEL =
|
||||
@selector(application:openURL:sourceApplication:annotation:);
|
||||
|
||||
[self proxyDestinationSelector:openURLSourceApplicationAnnotationSEL
|
||||
implementationsFromSourceSelector:openURLSourceApplicationAnnotationSEL
|
||||
@@ -477,8 +477,8 @@ static dispatch_once_t sProxyAppDelegateRemoteNotificationOnceToken;
|
||||
// For application:didRegisterForRemoteNotificationsWithDeviceToken:
|
||||
SEL didRegisterForRemoteNotificationsSEL =
|
||||
NSSelectorFromString(kGULDidRegisterForRemoteNotificationsSEL);
|
||||
SEL didRegisterForRemoteNotificationsDonorSEL = @selector(application:
|
||||
donor_didRegisterForRemoteNotificationsWithDeviceToken:);
|
||||
SEL didRegisterForRemoteNotificationsDonorSEL =
|
||||
@selector(application:donor_didRegisterForRemoteNotificationsWithDeviceToken:);
|
||||
|
||||
[self proxyDestinationSelector:didRegisterForRemoteNotificationsSEL
|
||||
implementationsFromSourceSelector:didRegisterForRemoteNotificationsDonorSEL
|
||||
@@ -490,8 +490,8 @@ static dispatch_once_t sProxyAppDelegateRemoteNotificationOnceToken;
|
||||
// For application:didFailToRegisterForRemoteNotificationsWithError:
|
||||
SEL didFailToRegisterForRemoteNotificationsSEL =
|
||||
NSSelectorFromString(kGULDidFailToRegisterForRemoteNotificationsSEL);
|
||||
SEL didFailToRegisterForRemoteNotificationsDonorSEL = @selector(application:
|
||||
donor_didFailToRegisterForRemoteNotificationsWithError:);
|
||||
SEL didFailToRegisterForRemoteNotificationsDonorSEL =
|
||||
@selector(application:donor_didFailToRegisterForRemoteNotificationsWithError:);
|
||||
|
||||
[self proxyDestinationSelector:didFailToRegisterForRemoteNotificationsSEL
|
||||
implementationsFromSourceSelector:didFailToRegisterForRemoteNotificationsDonorSEL
|
||||
@@ -747,8 +747,8 @@ static dispatch_once_t sProxyAppDelegateRemoteNotificationOnceToken;
|
||||
handleEventsForBackgroundURLSession:(NSString *)identifier
|
||||
completionHandler:(void (^)())completionHandler {
|
||||
#pragma clang diagnostic pop
|
||||
SEL methodSelector = @selector(application:
|
||||
handleEventsForBackgroundURLSession:completionHandler:);
|
||||
SEL methodSelector =
|
||||
@selector(application:handleEventsForBackgroundURLSession:completionHandler:);
|
||||
NSValue *handleBackgroundSessionPointer =
|
||||
[GULAppDelegateSwizzler originalImplementationForSelector:methodSelector object:self];
|
||||
GULRealHandleEventsForBackgroundURLSessionIMP handleBackgroundSessionIMP =
|
||||
|
||||
@@ -273,12 +273,12 @@ static NSString *const kGULNetworkLogTag = @"Google/Utilities/Network";
|
||||
// Explicitly check whether the delegate responds to the methods because conformsToProtocol does
|
||||
// not work correctly even though the delegate does respond to the methods.
|
||||
if (!loggerDelegate ||
|
||||
![loggerDelegate respondsToSelector:@selector(GULNetwork_logWithLevel:
|
||||
messageCode:message:contexts:)] ||
|
||||
![loggerDelegate respondsToSelector:@selector(GULNetwork_logWithLevel:
|
||||
messageCode:message:context:)] ||
|
||||
![loggerDelegate respondsToSelector:@selector(GULNetwork_logWithLevel:
|
||||
messageCode:message:)]) {
|
||||
![loggerDelegate
|
||||
respondsToSelector:@selector(GULNetwork_logWithLevel:messageCode:message:contexts:)] ||
|
||||
![loggerDelegate
|
||||
respondsToSelector:@selector(GULNetwork_logWithLevel:messageCode:message:context:)] ||
|
||||
![loggerDelegate
|
||||
respondsToSelector:@selector(GULNetwork_logWithLevel:messageCode:message:)]) {
|
||||
GULOSLogError(
|
||||
kGULLogSubsystem, kGULLoggerNetwork, NO,
|
||||
[NSString stringWithFormat:@"I-NET%06ld", (long)kGULNetworkMessageCodeNetwork002],
|
||||
|
||||
@@ -107,8 +107,8 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
gRespondsToOpenURLHandler_iOS9 =
|
||||
[self instancesRespondToSelector:@selector(application:openURL:options:)];
|
||||
gRespondsToHandleBackgroundSession =
|
||||
[self instancesRespondToSelector:@selector(application:
|
||||
handleEventsForBackgroundURLSession:completionHandler:)];
|
||||
[self instancesRespondToSelector:
|
||||
@selector(application:handleEventsForBackgroundURLSession:completionHandler:)];
|
||||
gRespondsToContinueUserActivity = [self
|
||||
instancesRespondToSelector:@selector(application:continueUserActivity:restorationHandler:)];
|
||||
#pragma clang diagnostic pop
|
||||
@@ -292,22 +292,22 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
// Class size must stay the same.
|
||||
XCTAssertEqual(sizeBefore, sizeAfter);
|
||||
|
||||
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
|
||||
continueUserActivity:restorationHandler:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:continueUserActivity:restorationHandler:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:didFailToRegisterForRemoteNotificationsWithError:)]);
|
||||
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
|
||||
didReceiveRemoteNotification:)]);
|
||||
XCTAssertTrue(
|
||||
[realAppDelegate respondsToSelector:@selector(application:didReceiveRemoteNotification:)]);
|
||||
#if TARGET_OS_IOS || TARGET_OS_TV
|
||||
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:openURL:options:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
#endif // TARGET_OS_IOS || TARGET_OS_TV
|
||||
|
||||
// Make sure that the class has changed.
|
||||
@@ -343,25 +343,25 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
// Class size must stay the same.
|
||||
XCTAssertEqual(sizeBefore, sizeAfter);
|
||||
|
||||
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
|
||||
continueUserActivity:restorationHandler:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:continueUserActivity:restorationHandler:)]);
|
||||
// Remote notifications methods should be added only by
|
||||
// -proxyOriginalDelegateIncludingAPNSMethods
|
||||
XCTAssertFalse([realAppDelegate
|
||||
respondsToSelector:@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:)]);
|
||||
XCTAssertFalse([realAppDelegate
|
||||
respondsToSelector:@selector(application:didFailToRegisterForRemoteNotificationsWithError:)]);
|
||||
XCTAssertFalse([realAppDelegate respondsToSelector:@selector(application:
|
||||
didReceiveRemoteNotification:)]);
|
||||
XCTAssertFalse(
|
||||
[realAppDelegate respondsToSelector:@selector(application:didReceiveRemoteNotification:)]);
|
||||
#if TARGET_OS_IOS || TARGET_OS_TV
|
||||
// The implementation should not be added if there is no original implementation
|
||||
XCTAssertFalse([realAppDelegate respondsToSelector:@selector(application:openURL:options:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
XCTAssertFalse([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
#endif // TARGET_OS_IOS || TARGET_OS_TV
|
||||
|
||||
// Make sure that the class has changed.
|
||||
@@ -390,8 +390,8 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
// Class size must stay the same.
|
||||
XCTAssertEqual(sizeBefore, sizeAfter);
|
||||
|
||||
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
|
||||
continueUserActivity:restorationHandler:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:continueUserActivity:restorationHandler:)]);
|
||||
|
||||
// Remote notifications methods should be added only by
|
||||
// -proxyOriginalDelegateIncludingAPNSMethods
|
||||
@@ -405,12 +405,12 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
XCTAssertFalse([realAppDelegate respondsToSelector:@selector(application:openURL:options:)]);
|
||||
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
|
||||
#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
|
||||
|
||||
@@ -440,8 +440,8 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
// Class size must stay the same.
|
||||
XCTAssertEqual(sizeBefore, sizeAfter);
|
||||
|
||||
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
|
||||
continueUserActivity:restorationHandler:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:continueUserActivity:restorationHandler:)]);
|
||||
// Proxy remote notifications methods
|
||||
[GULAppDelegateSwizzler proxyOriginalDelegateIncludingAPNSMethods];
|
||||
|
||||
@@ -454,12 +454,12 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
// The implementation should not be added if there is no original implementation
|
||||
XCTAssertFalse([realAppDelegate respondsToSelector:@selector(application:openURL:options:)]);
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:handleEventsForBackgroundURLSession:completionHandler:)]);
|
||||
|
||||
XCTAssertTrue([realAppDelegate
|
||||
respondsToSelector:@selector(application:
|
||||
didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
respondsToSelector:@selector(
|
||||
application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
|
||||
|
||||
// Make sure that the class has changed.
|
||||
@@ -1004,13 +1004,15 @@ static BOOL gRespondsToHandleBackgroundSession;
|
||||
GULTestInterceptorAppDelegate *delegate = [[GULTestInterceptorAppDelegate alloc] init];
|
||||
OCMStub([self.mockSharedApplication delegate]).andReturn(delegate);
|
||||
|
||||
XCTAssertFalse([delegate respondsToSelector:@selector
|
||||
(application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
XCTAssertFalse([delegate
|
||||
respondsToSelector:@selector(
|
||||
application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
|
||||
[GULAppDelegateSwizzler proxyOriginalDelegateIncludingAPNSMethods];
|
||||
|
||||
XCTAssertTrue([delegate respondsToSelector:@selector
|
||||
(application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
XCTAssertTrue([delegate
|
||||
respondsToSelector:@selector(
|
||||
application:didReceiveRemoteNotification:fetchCompletionHandler:)]);
|
||||
}
|
||||
#endif // TARGET_OS_IOS || TARGET_OS_TV
|
||||
|
||||
|
||||
Reference in new issue
Block a user