Skip to content

Commit

Permalink
Merge branch 'release-8.0' into nc/merge-release-11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 committed Jul 8, 2024
2 parents 35d94ee + e9c341e commit da775b3
Show file tree
Hide file tree
Showing 57 changed files with 428 additions and 3,594 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# 8.0.0
- Remove swizzling support for `application:didReceiveRemoteNotification:`.
Use `application:didReceiveRemoteNotification:fetchCompletionHandler:` instead. (#162)
- Remove `GULHeartbeatDateStorable`, `GULHeartbeatDateStorage`,
`GULHeartbeatDateStorageUserDefaults` APIs. (#164)
- Remove '+ [GULAppEnvironmentUtil isIOS7OrHigher]' API. (#165)
- Remove '+ [GULAppEnvironmentUtil hasSwiftRuntime]' API. (#166)
- Fix an issue where ObjC associated objects were sometimes set with a
non-const key, potentially resulting in undefined behavior. (#141)
- Add nullabilty annotations to public headers. (#169)
- Remove references to deprecated CTCarrier. (#106)
- [changed] **Breaking change**: Minimum supported versions have
updated for the following platforms:
- | Platform | GoogleUtilities 8.0|
| ------------- | ------------- |
| iOS | **12.0** |
| tvOS | **13.0** |
| macOS | **10.15** |
| watchOS | 7.0 |
- Remove dependency on `FBLPromises`. The following public API have
been removed:
- `- [NSURLSession gul_dataTaskPromiseWithRequest:]`
- `GULURLSessionDataResponse`
The following promise-based public API have been replaced with
completion handler-based alternatives.
- `- [GULKeychainStorage getObjectForKey:objectClass:accessGroup:]`
- `- [GULKeychainStorage setObject:forKey:accessGroup:]`
- `- [GULKeychainStorage removeObjectForKey:accessGroup:]`

# 7.13.3
- Rename parameter placeholder in `GULSecureCoding` unarchiving API to avoid
conflict with keyword. (#152)
Expand Down
17 changes: 5 additions & 12 deletions GoogleUtilities.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GoogleUtilities'
s.version = '7.13.3'
s.version = '8.0.0'
s.summary = 'Google Utilities for Apple platform SDKs'

s.description = <<-DESC
Expand All @@ -17,10 +17,10 @@ other Google CocoaPods. They're not intended for direct public usage.
:tag => 'CocoaPods-' + s.version.to_s
}

ios_deployment_target = '9.0'
osx_deployment_target = '10.12'
tvos_deployment_target = '10.0'
watchos_deployment_target = '6.0'
ios_deployment_target = '12.0'
osx_deployment_target = '10.15'
tvos_deployment_target = '13.0'
watchos_deployment_target = '7.0'

s.ios.deployment_target = ios_deployment_target
s.osx.deployment_target = osx_deployment_target
Expand All @@ -47,7 +47,6 @@ other Google CocoaPods. They're not intended for direct public usage.
'third_party/IsAppEncrypted/**/*.[mh]'
]
es.public_header_files = 'GoogleUtilities/Environment/Public/GoogleUtilities/*.h'
es.dependency 'PromisesObjC', '>= 1.2', '< 3.0'
es.dependency 'GoogleUtilities/Privacy'
es.frameworks = [
'Security'
Expand Down Expand Up @@ -115,12 +114,6 @@ other Google CocoaPods. They're not intended for direct public usage.
adss.dependency 'GoogleUtilities/Environment'
end

s.subspec 'ISASwizzler' do |iss|
iss.source_files = 'GoogleUtilities/ISASwizzler/**/*.[mh]', 'GoogleUtilities/Common/*.h'
iss.public_header_files = 'GoogleUtilities/ISASwizzler/Public/GoogleUtilities/*.h'
iss.dependency 'GoogleUtilities/Privacy'
end

s.subspec 'MethodSwizzler' do |mss|
mss.source_files = 'GoogleUtilities/MethodSwizzler/**/*.[mh]', 'GoogleUtilities/Common/*.h'
mss.public_header_files = 'GoogleUtilities/MethodSwizzler/Public/GoogleUtilities/*.h'
Expand Down
63 changes: 6 additions & 57 deletions GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ typedef void (*GULRealDidReceiveRemoteNotificationWithCompletionIMP)(
@"application:didRegisterForRemoteNotificationsWithDeviceToken:";
static NSString *const kGULDidFailToRegisterForRemoteNotificationsSEL =
@"application:didFailToRegisterForRemoteNotificationsWithError:";
static NSString *const kGULDidReceiveRemoteNotificationSEL =
@"application:didReceiveRemoteNotification:";
static NSString *const kGULDidReceiveRemoteNotificationWithCompletionSEL =
@"application:didReceiveRemoteNotification:fetchCompletionHandler:";

Expand Down Expand Up @@ -499,38 +497,18 @@ + (void)proxyRemoteNotificationsMethodsWithAppDelegateSubClass:(Class)appDelegat
realClass:realClass
storeDestinationImplementationTo:realImplementationsBySelector];

// For application:didReceiveRemoteNotification:
SEL didReceiveRemoteNotificationSEL = NSSelectorFromString(kGULDidReceiveRemoteNotificationSEL);
SEL didReceiveRemoteNotificationDonorSEL = @selector(application:
donor_didReceiveRemoteNotification:);

[self proxyDestinationSelector:didReceiveRemoteNotificationSEL
implementationsFromSourceSelector:didReceiveRemoteNotificationDonorSEL
fromClass:[GULAppDelegateSwizzler class]
toClass:appDelegateSubClass
realClass:realClass
storeDestinationImplementationTo:realImplementationsBySelector];

// For application:didReceiveRemoteNotification:fetchCompletionHandler:
#if !TARGET_OS_WATCH && !TARGET_OS_OSX
SEL didReceiveRemoteNotificationWithCompletionSEL =
NSSelectorFromString(kGULDidReceiveRemoteNotificationWithCompletionSEL);
SEL didReceiveRemoteNotificationWithCompletionDonorSEL =
@selector(application:donor_didReceiveRemoteNotification:fetchCompletionHandler:);
if ([appDelegate respondsToSelector:didReceiveRemoteNotificationWithCompletionSEL]) {
// Only add the application:didReceiveRemoteNotification:fetchCompletionHandler: method if
// the original AppDelegate implements it.
// This fixes a bug if an app only implements application:didReceiveRemoteNotification:
// (if we add the method with completion, iOS sees that one exists and does not call
// the method without the completion, which in this case is the only one the app implements).

[self proxyDestinationSelector:didReceiveRemoteNotificationWithCompletionSEL
implementationsFromSourceSelector:didReceiveRemoteNotificationWithCompletionDonorSEL
fromClass:[GULAppDelegateSwizzler class]
toClass:appDelegateSubClass
realClass:realClass
storeDestinationImplementationTo:realImplementationsBySelector];
}
[self proxyDestinationSelector:didReceiveRemoteNotificationWithCompletionSEL
implementationsFromSourceSelector:didReceiveRemoteNotificationWithCompletionDonorSEL
fromClass:[GULAppDelegateSwizzler class]
toClass:appDelegateSubClass
realClass:realClass
storeDestinationImplementationTo:realImplementationsBySelector];
#endif // !TARGET_OS_WATCH && !TARGET_OS_OSX
}

Expand Down Expand Up @@ -954,35 +932,6 @@ - (void)application:(GULApplication *)application
}
#endif // !TARGET_OS_WATCH && !TARGET_OS_OSX

- (void)application:(GULApplication *)application
donor_didReceiveRemoteNotification:(NSDictionary *)userInfo {
SEL methodSelector = NSSelectorFromString(kGULDidReceiveRemoteNotificationSEL);
NSValue *didReceiveRemoteNotificationIMPPointer =
[GULAppDelegateSwizzler originalImplementationForSelector:methodSelector object:self];
GULRealDidReceiveRemoteNotificationIMP didReceiveRemoteNotificationIMP =
[didReceiveRemoteNotificationIMPPointer pointerValue];

// Notify interceptors.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[GULAppDelegateSwizzler
notifyInterceptorsWithMethodSelector:methodSelector
callback:^(id<GULApplicationDelegate> interceptor) {
NSInvocation *invocation = [GULAppDelegateSwizzler
appDelegateInvocationForSelector:methodSelector];
[invocation setTarget:interceptor];
[invocation setSelector:methodSelector];
[invocation setArgument:(void *)(&application) atIndex:2];
[invocation setArgument:(void *)(&userInfo) atIndex:3];
[invocation invoke];
}];
#pragma clang diagnostic pop
// Call the real implementation if the real App Delegate has any.
if (didReceiveRemoteNotificationIMP) {
didReceiveRemoteNotificationIMP(self, methodSelector, application, userInfo);
}
}

+ (nullable NSInvocation *)appDelegateInvocationForSelector:(SEL)selector {
struct objc_method_description methodDescription =
protocol_getMethodDescription(@protocol(GULApplicationDelegate), selector, NO, YES);
Expand Down
18 changes: 0 additions & 18 deletions GoogleUtilities/Environment/GULAppEnvironmentUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,6 @@ + (BOOL)isAppExtension {
#endif
}

+ (BOOL)isIOS7OrHigher {
return YES;
}

+ (BOOL)hasSwiftRuntime {
// The class
// [Swift._SwiftObject](https://github.com/apple/swift/blob/5eac3e2818eb340b11232aff83edfbd1c307fa03/stdlib/public/runtime/SwiftObject.h#L35)
// is a part of Swift runtime, so it should be present if Swift runtime is available.

BOOL hasSwiftRuntime =
objc_lookUpClass("Swift._SwiftObject") != nil ||
// Swift object class name before
// https://github.com/apple/swift/commit/9637b4a6e11ddca72f5f6dbe528efc7c92f14d01
objc_getClass("_TtCs12_SwiftObject") != nil;

return hasSwiftRuntime;
}

+ (NSString *)applePlatform {
NSString *applePlatform = @"unknown";

Expand Down
153 changes: 0 additions & 153 deletions GoogleUtilities/Environment/GULHeartbeatDateStorage.m

This file was deleted.

Loading

0 comments on commit da775b3

Please sign in to comment.