Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ _None._

### New Features

_None._
- Track whether Lockdown Mode is enabled as a device property (`device_info_lockdown_mode_enabled`).

### Bug Fixes

Expand Down
2 changes: 2 additions & 0 deletions Sources/Event Logging/TracksService.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ @interface TracksService ()
NSString *const DeviceInfoOrientation = @"device_info_orientation";
NSString *const DeviceInfoPreferredContentSizeCategory = @"device_info_preferred_content_size_category";
NSString *const DeviceInfoIsAccessibilityCategory = @"device_info_is_accessibility_category";
NSString *const DeviceInfoLockdownModeEnabledKey = @"device_info_lockdown_mode_enabled";

NSString *const TracksEventNameKey = @"_en";
NSString *const TracksUserAgentKey = @"_via_ua";
Expand Down Expand Up @@ -422,6 +423,7 @@ - (NSDictionary *)mutableDeviceProperties
DeviceInfoOrientation : self.deviceInformation.orientation ?: @"Unknown",
DeviceInfoPreferredContentSizeCategory : self.deviceInformation.preferredContentSizeCategory ?: @"Unknown",
DeviceInfoIsAccessibilityCategory : self.deviceInformation.isAccessibilityCategory ? @"YES" : @"NO",
DeviceInfoLockdownModeEnabledKey : self.deviceInformation.isLockdownModeEnabled ? @"YES" : @"NO",
};
}

Expand Down
1 change: 1 addition & 0 deletions Sources/Model/ObjC/Common/TracksDeviceInformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL isAppleWatchConnected;
@property (nonatomic, assign) BOOL isVoiceOverEnabled;
@property (nonatomic, readonly) NSString *orientation;
@property (nonatomic, readonly) BOOL isLockdownModeEnabled;

@end

Expand Down
10 changes: 10 additions & 0 deletions Sources/Model/ObjC/Common/TracksDeviceInformation.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ @interface TracksDeviceInformation ()
@property (nonatomic, assign) BOOL isReachable;
@property (nonatomic, assign) BOOL isReachableByWiFi;
@property (nonatomic, assign) BOOL isReachableByWWAN;
@property (nonatomic, assign) BOOL cachedLockdownModeEnabled;
@property (nonatomic, assign) BOOL hasReadLockdownMode;

#if TARGET_OS_IPHONE && !TARGET_OS_WATCH
@property (nonatomic, assign) UIDeviceOrientation lastKnownDeviceOrientation;
Expand Down Expand Up @@ -249,6 +251,14 @@ - (NSString *)preferredContentSizeCategory {
/// - Uses `UIContentSizeCategoryIsAccessibilityCategory` method.
/// - This will be `false` for Mac OS and watchOS.
///
- (BOOL)isLockdownModeEnabled {
if (!self.hasReadLockdownMode) {
self.cachedLockdownModeEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"LDMGlobalEnabled"];
self.hasReadLockdownMode = YES;
}
return self.cachedLockdownModeEnabled;
}

- (BOOL)isAccessibilityCategory {
#if TARGET_OS_WATCH
return NO;
Expand Down