File tree Expand file tree Collapse file tree 5 files changed +65
-3
lines changed Expand file tree Collapse file tree 5 files changed +65
-3
lines changed Original file line number Diff line number Diff line change 22
33Pod ::Spec . new do |s |
44 s . name = 'Automattic-Tracks-iOS'
5- s . version = '0.11 .1'
5+ s . version = '0.12.0-beta .1'
66
77 s . summary = 'Simple way to track events in an iOS app with Automattic Tracks internal service'
88 s . description = <<-DESC
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ @interface TracksService ()
6262NSString *const DeviceInfoVoiceOverEnabledKey = @" device_info_voiceover_enabled" ;
6363NSString *const DeviceInfoStatusBarHeightKey = @" device_info_status_bar_height" ;
6464NSString *const DeviceInfoOrientation = @" device_info_orientation" ;
65+ NSString *const DeviceInfoPreferredContentSizeCategory = @" device_info_preferred_content_size_category" ;
66+ NSString *const DeviceInfoIsAccessibilityCategory = @" device_info_is_accessibility_category" ;
6567
6668NSString *const TracksEventNameKey = @" _en" ;
6769NSString *const TracksUserAgentKey = @" _via_ua" ;
@@ -398,7 +400,9 @@ - (NSDictionary *)mutableDeviceProperties
398400 DeviceInfoAppleWatchConnectedKey : self.deviceInformation .isAppleWatchConnected ? @" YES" : @" NO" ,
399401 DeviceInfoStatusBarHeightKey : [NSNumber numberWithFloat: self .deviceInformation.statusBarHeight],
400402 DeviceInfoOrientation : self.deviceInformation .orientation ?: @" Unknown" ,
401- };
403+ DeviceInfoPreferredContentSizeCategory : self.deviceInformation .preferredContentSizeCategory ?: @" Unknown" ,
404+ DeviceInfoIsAccessibilityCategory : self.deviceInformation .isAccessibilityCategory ? @" YES" : @" NO" ,
405+ };
402406}
403407
404408- (NSDictionary *)dictionaryForTracksEvent : (TracksEvent *)tracksEvent withParentCommonProperties : (NSDictionary *)parentCommonProperties
Original file line number Diff line number Diff line change @@ -21,6 +21,19 @@ NS_ASSUME_NONNULL_BEGIN
2121@property (nullable , nonatomic , readonly ) NSString *currentNetworkOperator;
2222@property (nullable , nonatomic , readonly ) NSString *currentNetworkRadioType;
2323@property (nonatomic , assign ) BOOL isWiFiConnected;
24+
25+ // / Preferred reading content size based on the accessibility setting of the iOS device.
26+ // / - This will be NULL for Mac OS.
27+ // /
28+ @property (nullable , nonatomic , readonly ) NSString *preferredContentSizeCategory;
29+
30+ // / Returns `true` if the preferred reading content size falls under accessibility category.
31+ // /
32+ // / - Uses `UIContentSizeCategoryIsAccessibilityCategory` method.
33+ // / - This will be `false` for Mac OS.
34+ // /
35+ @property (nonatomic , readonly ) BOOL isAccessibilityCategory;
36+
2437/* *
2538 * Indicates whether the device has an Internet connection.
2639 */
Original file line number Diff line number Diff line change @@ -206,6 +206,51 @@ - (UIInterfaceOrientation)statusBarOrientation {
206206}
207207#endif
208208
209+ // / Preferred reading content size based on the accessibility setting of the iOS device.
210+ // /
211+ // / - This will be NULL for Mac OS.
212+ // /
213+ - (NSString *)preferredContentSizeCategory {
214+ #if TARGET_OS_IPHONE
215+ if ([NSThread isMainThread ]) {
216+ return UIApplication.sharedIfAvailable .preferredContentSizeCategory ;
217+ }
218+
219+ __block NSString *preferredContentSizeCategory;
220+
221+ dispatch_sync (dispatch_get_main_queue (), ^{
222+ preferredContentSizeCategory = UIApplication.sharedIfAvailable .preferredContentSizeCategory ;
223+ });
224+
225+ return preferredContentSizeCategory;
226+ #else // Mac
227+ return NULL ;
228+ #endif
229+ }
230+
231+ // / Returns `true` if the preferred reading content size falls under accessibility category.
232+ // /
233+ // / - Uses `UIContentSizeCategoryIsAccessibilityCategory` method.
234+ // / - This will be `false` for Mac OS.
235+ // /
236+ - (BOOL )isAccessibilityCategory {
237+ #if TARGET_OS_IPHONE
238+ __block NSString *preferredContentSizeCategory;
239+
240+ if ([NSThread isMainThread ]) {
241+ preferredContentSizeCategory = UIApplication.sharedIfAvailable .preferredContentSizeCategory ;
242+ } else {
243+ dispatch_sync (dispatch_get_main_queue (), ^{
244+ preferredContentSizeCategory = UIApplication.sharedIfAvailable .preferredContentSizeCategory ;
245+ });
246+ }
247+
248+ return UIContentSizeCategoryIsAccessibilityCategory (preferredContentSizeCategory);
249+ #else // Mac
250+ return NO ;
251+ #endif
252+ }
253+
209254#pragma mark - App Specific Information
210255
211256- (NSString *)appName
Original file line number Diff line number Diff line change 11#import " TracksConstants.h"
22
33NSString *const TracksErrorDomain = @" TracksErrorDomain" ;
4- NSString *const TracksLibraryVersion = @" 0.11 .1" ;
4+ NSString *const TracksLibraryVersion = @" 0.12.0-beta .1" ;
You can’t perform that action at this time.
0 commit comments