From 58f01dc9a4858dbb39a139a0acdd90fa8d563e61 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Thu, 9 Apr 2026 20:20:12 -0700 Subject: [PATCH 1/2] Update style --- .../GULAppDelegateSwizzler.m | 20 +++--- GoogleUtilities/Network/GULNetwork.m | 12 ++-- .../Swizzler/GULAppDelegateSwizzlerTest.m | 70 ++++++++++--------- 3 files changed, 52 insertions(+), 50 deletions(-) diff --git a/GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m b/GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m index 3b7280e..1857001 100644 --- a/GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m +++ b/GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m @@ -399,8 +399,8 @@ + (nullable Class)createSubclassWithObject:(id)appDelega } // 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 @@ + (nullable Class)createSubclassWithObject:(id)appDelega #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 @@ + (void)proxyRemoteNotificationsMethodsWithAppDelegateSubClass:(Class)appDelegat // 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 @@ + (void)proxyRemoteNotificationsMethodsWithAppDelegateSubClass:(Class)appDelegat // 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 @@ - (void)application:(GULApplication *)application 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 = diff --git a/GoogleUtilities/Network/GULNetwork.m b/GoogleUtilities/Network/GULNetwork.m index 23b3bb0..1a7e4a1 100644 --- a/GoogleUtilities/Network/GULNetwork.m +++ b/GoogleUtilities/Network/GULNetwork.m @@ -273,12 +273,12 @@ - (void)setLoggerDelegate:(id)loggerDelegate { // 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], diff --git a/GoogleUtilities/Tests/Unit/Swizzler/GULAppDelegateSwizzlerTest.m b/GoogleUtilities/Tests/Unit/Swizzler/GULAppDelegateSwizzlerTest.m index 7ed61b7..1933987 100644 --- a/GoogleUtilities/Tests/Unit/Swizzler/GULAppDelegateSwizzlerTest.m +++ b/GoogleUtilities/Tests/Unit/Swizzler/GULAppDelegateSwizzlerTest.m @@ -107,8 +107,8 @@ + (void)load { 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 @@ - (void)testProxyAppDelegate { // 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 @@ - (void)testProxyEmptyAppDelegate { // 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 @@ - (void)testProxyRemoteNotificationsMethodsEmptyAppDelegate { // 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 @@ - (void)testProxyRemoteNotificationsMethodsEmptyAppDelegate { 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 @@ - (void)testProxyRemoteNotificationsMethodsEmptyAppDelegateAfterInitialProxy { // 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 @@ - (void)testProxyRemoteNotificationsMethodsEmptyAppDelegateAfterInitialProxy { // 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 @@ - (void)testApplicationDidReceiveRemoteNotificationWithCompletionImplementationI 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 From a3b437a1069c01109b45c759a07f2456f13598e9 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Thu, 9 Apr 2026 20:28:16 -0700 Subject: [PATCH 2/2] Update Mintfile to be consistent with firebase-ios-sdk --- Mintfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mintfile b/Mintfile index 4e60f1d..3eb1574 100644 --- a/Mintfile +++ b/Mintfile @@ -1 +1 @@ -nicklockwood/SwiftFormat@0.49.2 +nicklockwood/SwiftFormat@0.55.5