summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m')
-rw-r--r--StoneIsland/platforms/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m119
1 files changed, 119 insertions, 0 deletions
diff --git a/StoneIsland/platforms/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m b/StoneIsland/platforms/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m
new file mode 100644
index 00000000..c3d53e9a
--- /dev/null
+++ b/StoneIsland/platforms/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m
@@ -0,0 +1,119 @@
+// Copyright 2019 Google
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "Crashlytics/Shared/FIRCLSFABHost.h"
+
+#if TARGET_OS_WATCH
+#import <WatchKit/WatchKit.h>
+#elif TARGET_OS_IPHONE
+#import <UIKit/UIKit.h>
+#endif
+
+#include <sys/sysctl.h>
+
+#define FIRCLS_HOST_SYSCTL_BUFFER_SIZE (128)
+
+#pragma mark - OS Versions
+
+#pragma mark Private
+
+static NSString *FIRCLSHostSysctlEntry(const char *sysctlKey) {
+ char buffer[FIRCLS_HOST_SYSCTL_BUFFER_SIZE];
+ size_t bufferSize = FIRCLS_HOST_SYSCTL_BUFFER_SIZE;
+ if (sysctlbyname(sysctlKey, buffer, &bufferSize, NULL, 0) != 0) {
+ return nil;
+ }
+ return [NSString stringWithUTF8String:buffer];
+}
+
+#pragma mark Public
+
+NSOperatingSystemVersion FIRCLSHostGetOSVersion(void) {
+ // works on macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)
+ if ([NSProcessInfo.processInfo respondsToSelector:@selector(operatingSystemVersion)]) {
+ return [NSProcessInfo.processInfo operatingSystemVersion];
+ }
+
+ NSOperatingSystemVersion version = {0, 0, 0};
+
+#if TARGET_OS_IPHONE
+
+#if TARGET_OS_WATCH
+ NSString *versionString = [[WKInterfaceDevice currentDevice] systemVersion];
+#else
+ NSString *versionString = [[UIDevice currentDevice] systemVersion];
+#endif
+
+ NSArray *parts = [versionString componentsSeparatedByString:@"."];
+
+ if (parts.count > 0) {
+ version.majorVersion = [[parts objectAtIndex:0] integerValue];
+ }
+
+ if ([parts count] > 1) {
+ version.minorVersion = [[parts objectAtIndex:1] integerValue];
+ }
+
+ if ([parts count] > 2) {
+ version.patchVersion = [[parts objectAtIndex:2] integerValue];
+ }
+
+#endif
+
+ return version;
+}
+
+NSString *FIRCLSHostOSBuildVersion(void) {
+ return FIRCLSHostSysctlEntry("kern.osversion");
+}
+
+NSString *FIRCLSHostOSDisplayVersion(void) {
+ NSOperatingSystemVersion version = FIRCLSHostGetOSVersion();
+ return [NSString stringWithFormat:@"%ld.%ld.%ld", (long)version.majorVersion,
+ (long)version.minorVersion, (long)version.patchVersion];
+}
+
+#pragma mark - Host Models
+
+#pragma mark Public
+
+NSString *FIRCLSHostModelInfo(void) {
+ NSString *model = nil;
+
+#if TARGET_OS_SIMULATOR
+#if TARGET_OS_WATCH
+ model = @"watchOS Simulator";
+#elif TARGET_OS_TV
+ model = @"tvOS Simulator";
+#elif TARGET_OS_IPHONE
+ switch (UI_USER_INTERFACE_IDIOM()) {
+ case UIUserInterfaceIdiomPhone:
+ model = @"iOS Simulator (iPhone)";
+ break;
+ case UIUserInterfaceIdiomPad:
+ model = @"iOS Simulator (iPad)";
+ break;
+ default:
+ model = @"iOS Simulator (Unknown)";
+ break;
+ }
+#endif
+#elif TARGET_OS_EMBEDDED
+ model = FIRCLSHostSysctlEntry("hw.machine");
+#else
+ model = FIRCLSHostSysctlEntry("hw.model");
+#endif
+
+ return model;
+}