Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device_info_app_build_configuration property to all events #182

Merged
merged 3 commits into from
Jun 25, 2021
Merged
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 Automattic-Tracks-iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Automattic-Tracks-iOS'
s.version = '0.8.5'
s.version = '0.9.0-beta.1'

s.summary = 'Simple way to track events in an iOS app with Automattic Tracks internal service'
s.description = <<-DESC
Expand Down
17 changes: 11 additions & 6 deletions Automattic-Tracks-iOS/Model/TracksDeviceInformation.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>

NS_ASSUME_NONNULL_BEGIN

@interface TracksDeviceInformation : NSObject

@property (nonatomic, readonly) NSString *os;
@property (nonatomic, readonly) NSString *version;
@property (nonatomic, readonly) NSString *manufacturer;
@property (nonatomic, readonly) NSString *brand;
@property (nonatomic, readonly) NSString *model;
@property (nullable, nonatomic, readonly) NSString *model;

@property (nonatomic, readonly) NSString *appName;
@property (nonatomic, readonly) NSString *appVersion;
@property (nonatomic, readonly) NSString *appBuild;
@property (nullable, nonatomic, readonly) NSString *appName;
@property (nullable, nonatomic, readonly) NSString *appVersion;
@property (nullable, nonatomic, readonly) NSString *appBuild;
@property (nonatomic, readonly) NSString *appBuildConfiguration;

// This information has the tendency to change
@property (nonatomic, readonly) NSString *deviceLanguage;
@property (nonatomic, readonly) NSString *currentNetworkOperator;
@property (nonatomic, readonly) NSString *currentNetworkRadioType;
@property (nullable, nonatomic, readonly) NSString *currentNetworkOperator;
@property (nullable, nonatomic, readonly) NSString *currentNetworkRadioType;
@property (nonatomic, assign) BOOL isWiFiConnected;
/**
* Indicates whether the device has an Internet connection.
Expand All @@ -28,3 +31,5 @@
@property (nonatomic, readonly) NSString *orientation;

@end

NS_ASSUME_NONNULL_END
16 changes: 16 additions & 0 deletions Automattic-Tracks-iOS/Model/TracksDeviceInformation.m
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,20 @@ - (NSString *)appBuild
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
}

- (NSString *)appBuildConfiguration
{
#if defined(DEBUG)
return @"Debug";
#elif defined(ALPHA)
return @"Alpha"
#endif

// This little trick is the only way we can differentiate TestFlight from App Store, since the built app is identical
if ([[[[NSBundle mainBundle] appStoreReceiptURL] lastPathComponent] isEqualToString:@"sandboxReceipt"]) {
return @"Beta";
} else {
return @"Production";
}
}

@end
16 changes: 9 additions & 7 deletions Automattic-Tracks-iOS/Services/TracksService.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ @interface TracksService ()
NSString *const DeviceInfoAppNameKey = @"device_info_app_name";
NSString *const DeviceInfoAppVersionKey = @"device_info_app_version";
NSString *const DeviceInfoAppBuildKey = @"device_info_app_version_code";
NSString *const DeviceInfoAppBuildConfigurationKey = @"device_info_app_build_configuration";
NSString *const DeviceInfoOSKey = @"device_info_os";
NSString *const DeviceInfoOSVersionKey = @"device_info_os_version";
NSString *const DeviceInfoBrandKey = @"device_info_brand";
Expand Down Expand Up @@ -328,16 +329,17 @@ - (NSDictionary *)immutableDeviceProperties

return @{ RequestTimestampKey : @(since1970millis),
DeviceInfoAppBuildKey : self.deviceInformation.appBuild ?: @"Unknown",
DeviceInfoAppBuildConfigurationKey: self.deviceInformation.appBuildConfiguration,
DeviceInfoAppNameKey : self.deviceInformation.appName ?: @"Unknown",
DeviceInfoAppVersionKey : self.deviceInformation.appVersion ?: @"Unknown",
DeviceInfoBrandKey : self.deviceInformation.brand ?: @"Unknown",
DeviceInfoManufacturerKey : self.deviceInformation.manufacturer ?: @"Unknown",
DeviceInfoBrandKey : self.deviceInformation.brand,
DeviceInfoManufacturerKey : self.deviceInformation.manufacturer,
DeviceInfoModelKey : self.deviceInformation.model ?: @"Unknown",
DeviceInfoOSKey : self.deviceInformation.os ?: @"Unknown",
DeviceInfoOSVersionKey : self.deviceInformation.version ?: @"Unknown",
DeviceInfoHeightKey : @(screenSize.height) ?: @0,
DeviceInfoWidthKey : @(screenSize.width) ?: @0,
DeviceLanguageKey : self.deviceInformation.deviceLanguage ?: @"Unknown",
DeviceInfoOSKey : self.deviceInformation.os,
DeviceInfoOSVersionKey : self.deviceInformation.version,
DeviceInfoHeightKey : @(screenSize.height),
DeviceInfoWidthKey : @(screenSize.width),
DeviceLanguageKey : self.deviceInformation.deviceLanguage,
TracksUserAgentKey : self.userAgent,
};
}
Expand Down
2 changes: 1 addition & 1 deletion Automattic-Tracks-iOS/TracksConstants.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "TracksConstants.h"

NSString *const TracksErrorDomain = @"TracksErrorDomain";
NSString *const TracksLibraryVersion = @"0.8.5";
NSString *const TracksLibraryVersion = @"0.9.0-beta.1";
4 changes: 2 additions & 2 deletions TracksDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- Automattic-Tracks-iOS (0.8.3):
- Automattic-Tracks-iOS (0.9.0-beta.1):
- CocoaLumberjack (~> 3)
- Reachability (~> 3)
- Sentry (~> 6)
Expand Down Expand Up @@ -34,7 +34,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
Automattic-Tracks-iOS: d2b08d823912bfd8be65b5b8f932f023d0478c64
Automattic-Tracks-iOS: 59b9722299d6adbb2e4bc643553d84b41170d075
CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
Sentry: 3a6c3aeb258b297a4be08d8960955ecc722331f3
Expand Down