From 731bfcdf9f6c5854a9e470f476facfe3c9232b4d Mon Sep 17 00:00:00 2001 From: Maksym Malyhin Date: Wed, 21 Oct 2020 16:38:24 -0400 Subject: [PATCH 1/4] Firebase user agent: add iOS on mac platform --- .../Environment/third_party/GULAppEnvironmentUtil.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m index b003ad5ea79..3cdec8ed5d3 100644 --- a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m +++ b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m @@ -272,7 +272,11 @@ + (NSString *)applePlatform { #if TARGET_OS_MACCATALYST applePlatform = @"maccatalyst"; #elif TARGET_OS_IOS - applePlatform = @"ios"; + if (@available(iOS 14.0, *)) { + applePlatform = [NSProcessInfo processInfo].isiOSAppOnMac ? @"ios_on_mac" : @"ios"; + } else { + applePlatform = @"ios"; + } #elif TARGET_OS_TV applePlatform = @"tvos"; #elif TARGET_OS_OSX From 8531408592c10c98f223dfa486e80df8bee5120c Mon Sep 17 00:00:00 2001 From: Maksym Malyhin Date: Wed, 21 Oct 2020 17:27:24 -0400 Subject: [PATCH 2/4] Older Xcode compatibility --- .../Environment/third_party/GULAppEnvironmentUtil.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m index 3cdec8ed5d3..6fd1aedec2b 100644 --- a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m +++ b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m @@ -272,18 +272,24 @@ + (NSString *)applePlatform { #if TARGET_OS_MACCATALYST applePlatform = @"maccatalyst"; #elif TARGET_OS_IOS + +#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 if (@available(iOS 14.0, *)) { applePlatform = [NSProcessInfo processInfo].isiOSAppOnMac ? @"ios_on_mac" : @"ios"; } else { applePlatform = @"ios"; } +#else // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 + applePlatform = @"ios"; +#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 + #elif TARGET_OS_TV applePlatform = @"tvos"; #elif TARGET_OS_OSX applePlatform = @"macos"; #elif TARGET_OS_WATCH applePlatform = @"watchos"; -#endif +#endif // TARGET_OS_MACCATALYST return applePlatform; } From 0e1897eafcdd90c5ece91aa0a272406572ac97b5 Mon Sep 17 00:00:00 2001 From: Maksym Malyhin Date: Fri, 23 Oct 2020 15:02:54 -0400 Subject: [PATCH 3/4] Fix check iOS version --- .../Environment/third_party/GULAppEnvironmentUtil.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m index 6fd1aedec2b..7bcf308c1c1 100644 --- a/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m +++ b/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m @@ -273,15 +273,15 @@ + (NSString *)applePlatform { applePlatform = @"maccatalyst"; #elif TARGET_OS_IOS -#if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 +#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 if (@available(iOS 14.0, *)) { applePlatform = [NSProcessInfo processInfo].isiOSAppOnMac ? @"ios_on_mac" : @"ios"; } else { applePlatform = @"ios"; } -#else // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 +#else // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 applePlatform = @"ios"; -#endif // defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 +#endif // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 #elif TARGET_OS_TV applePlatform = @"tvos"; From 600adb8fefb7acded2f21f669ccfca21c05465fb Mon Sep 17 00:00:00 2001 From: Maksym Malyhin Date: Fri, 23 Oct 2020 15:41:24 -0400 Subject: [PATCH 4/4] changelog --- GoogleUtilities/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/GoogleUtilities/CHANGELOG.md b/GoogleUtilities/CHANGELOG.md index 48c0ab17ed7..30ce7e425c5 100644 --- a/GoogleUtilities/CHANGELOG.md +++ b/GoogleUtilities/CHANGELOG.md @@ -1,5 +1,6 @@ # 7.1.0 -- Unreleased - Added `NSURLSession` promise extension. (#6753) +- `ios_on_mac` option added to `GULAppEnvironmentUtil.applePlatform()`. (#6799) # 7.0.0 - All APIs are now public. All CocoaPods private headers are transitioned to public. Note that