diff --git a/CHANGELOG.md b/CHANGELOG.md index 74848137d6..ea8b65a5a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [FIX] Propagate global Tracer tags to OpenTelemetry span attributes. See [#2000][] - [FEATURE] Add Logs event mapper to ObjC API. See [#2008][] - [IMPROVEMENT] Send retry information with network requests (eg. retry_count, last_failure_status and idempotency key). See [#1991][] +- [IMPROVEMENT] Enable app launch time on mac, macCatalyst and visionOS. See [#1888][] (Thanks [@Hengyu][]) - [FIX] Ignore network reachability on watchOS . See [#2005][] (Thanks [@jfiser-paylocity][]) # 2.16.0 / 20-08-2024 @@ -755,6 +756,7 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO [#1988]: https://github.com/DataDog/dd-sdk-ios/pull/1988 [#2000]: https://github.com/DataDog/dd-sdk-ios/pull/2000 [#1991]: https://github.com/DataDog/dd-sdk-ios/pull/1991 +[#1888]: https://github.com/DataDog/dd-sdk-ios/pull/1888 [#2008]: https://github.com/DataDog/dd-sdk-ios/pull/2008 [#2005]: https://github.com/DataDog/dd-sdk-ios/pull/2005 [#1998]: https://github.com/DataDog/dd-sdk-ios/pull/1998 @@ -791,3 +793,4 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO [@alexfanatics]: https://github.com/alexfanatics [@changm4n]: https://github.com/changm4n [@jfiser-paylocity]: https://github.com/jfiser-paylocity +[@Hengyu]: https://github.com/Hengyu diff --git a/DatadogCore/Private/ObjcAppLaunchHandler.m b/DatadogCore/Private/ObjcAppLaunchHandler.m index 3239d61391..bea30ced2a 100644 --- a/DatadogCore/Private/ObjcAppLaunchHandler.m +++ b/DatadogCore/Private/ObjcAppLaunchHandler.m @@ -9,8 +9,10 @@ #import "ObjcAppLaunchHandler.h" -#if TARGET_OS_IOS || TARGET_OS_TV +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_MACCATALYST || TARGET_OS_VISION #import +#elif TARGET_OS_OSX +#import #endif // A very long application launch time is most-likely the result of a pre-warmed process. @@ -42,9 +44,17 @@ + (void)load { // This is called at the `DatadogPrivate` load time, keep the work minimal _shared = [[self alloc] initWithProcessInfo:NSProcessInfo.processInfo loadTime:CFAbsoluteTimeGetCurrent()]; -#if TARGET_OS_IOS || TARGET_OS_TV + + NSString *notificationName; +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_MACCATALYST || TARGET_OS_VISION + notificationName = UIApplicationDidBecomeActiveNotification; +#elif TARGET_OS_OSX + notificationName = NSApplicationDidBecomeActiveNotification; +#endif + +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_MACCATALYST || TARGET_OS_VISION || TARGET_OS_OSX NSNotificationCenter * __weak center = NSNotificationCenter.defaultCenter; - id __block __unused token = [center addObserverForName:UIApplicationDidBecomeActiveNotification + id __block __unused token = [center addObserverForName:notificationName object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *_){