Explorar el Código

Firebase user agent: add iOS on mac platform (#6799)

* Firebase user agent: add iOS on mac platform

* Older Xcode compatibility

* Fix check iOS version

* changelog
Maksym Malyhin hace 5 años
padre
commit
b6ad6aea39

+ 1 - 0
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

+ 11 - 1
GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m

@@ -272,14 +272,24 @@ static BOOL HasEmbeddedMobileProvision() {
 #if TARGET_OS_MACCATALYST
   applePlatform = @"maccatalyst";
 #elif TARGET_OS_IOS
+
+#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_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
   applePlatform = @"ios";
+#endif // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
+
 #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;
 }