diff --git a/Classes/BITChannel.m b/Classes/BITChannel.m index 382bf90846..85a5ea4738 100644 --- a/Classes/BITChannel.m +++ b/Classes/BITChannel.m @@ -115,7 +115,7 @@ static NSInteger const schemaVersion = 2; envelope.appId = bit_mainBundleIdentifier(); envelope.appVer = _telemetryContext.application.version; envelope.time = bit_utcDateString([NSDate date]); - envelope.iKey = _telemetryContext.instrumentationKey; + envelope.iKey = _telemetryContext.appIdentifier; BITDevice *deviceContext = _telemetryContext.device; if (deviceContext.deviceId) { diff --git a/Classes/BITTelemetryContext.h b/Classes/BITTelemetryContext.h index 545ca82a08..02d4c9f033 100644 --- a/Classes/BITTelemetryContext.h +++ b/Classes/BITTelemetryContext.h @@ -17,24 +17,24 @@ NS_ASSUME_NONNULL_BEGIN FOUNDATION_EXPORT NSString *const kBITApplicationWasLaunched; + /** * Context object which contains information about the device, user, session etc. */ @interface BITTelemetryContext : NSObject +///----------------------------------------------------------------------------- +/// @name Initialisation +///----------------------------------------------------------------------------- + /** - * The instrumentation key of the app. */ @property(nonatomic, strong) BITPersistence *persistence; /** * The instrumentation key of the app. */ -@property(nonatomic, copy) NSString *instrumentationKey; - -///----------------------------------------------------------------------------- -/// @name Initialisation -///----------------------------------------------------------------------------- +@property(nonatomic, copy) NSString *appIdentifier; /** * A queue which makes array operations thread safe. @@ -79,12 +79,12 @@ FOUNDATION_EXPORT NSString *const kBITApplicationWasLaunched; /** * Initializes a telemetry context. * - * @param instrumentationKey the instrumentation key of the app. + * @param appIdentifier the appIdentifier of the app * @param persistence the persistence used to save and load metadata * * @return the telemetry context */ -- (instancetype)initWithInstrumentationKey:(NSString *)instrumentationKey persistence:(BITPersistence *)persistence; +- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier persistence:(BITPersistence *)persistence; ///----------------------------------------------------------------------------- /// @name Network status diff --git a/Classes/BITTelemetryContext.m b/Classes/BITTelemetryContext.m index de2ba0c589..adcf19f4fe 100644 --- a/Classes/BITTelemetryContext.m +++ b/Classes/BITTelemetryContext.m @@ -16,7 +16,7 @@ static char *const BITContextOperationsQueue = "net.hockeyapp.telemetryContextQu @implementation BITTelemetryContext -@synthesize instrumentationKey = _instrumentationKey; +@synthesize appIdentifier = _appIdentifier; @synthesize persistence = _persistence; #pragma mark - Initialisation @@ -29,11 +29,11 @@ static char *const BITContextOperationsQueue = "net.hockeyapp.telemetryContextQu return self; } -- (instancetype)initWithInstrumentationKey:(NSString *)instrumentationKey persistence:(BITPersistence *)persistence { +- (instancetype)initWithAppIdentifier:(NSString *)appIdentifier persistence:(BITPersistence *)persistence { if ((self = [self init])) { _persistence = persistence; - _instrumentationKey = instrumentationKey; + _appIdentifier = appIdentifier; BITDevice *deviceContext = [BITDevice new]; deviceContext.model = bit_devicePlatform(); deviceContext.type = bit_deviceType(); @@ -115,18 +115,18 @@ static char *const BITContextOperationsQueue = "net.hockeyapp.telemetryContextQu #pragma mark - Getter/Setter properties -- (NSString *)instrumentationKey { +- (NSString *)appIdentifier { __block NSString *tmp; dispatch_sync(_operationsQueue, ^{ - tmp = _instrumentationKey; + tmp = _appIdentifier; }); return tmp; } -- (void)setInstrumentationKey:(NSString *)instrumentationKey { - NSString* tmp = [instrumentationKey copy]; +- (void)setAppIdentifier:(NSString *)appIdentifier { + NSString* tmp = [appIdentifier copy]; dispatch_barrier_async(_operationsQueue, ^{ - _instrumentationKey = tmp; + _appIdentifier = tmp; }); } diff --git a/Classes/BITTelemetryManager.m b/Classes/BITTelemetryManager.m index 564e88c04d..786919a708 100644 --- a/Classes/BITTelemetryManager.m +++ b/Classes/BITTelemetryManager.m @@ -137,13 +137,9 @@ NSString *const kBITApplicationWasLaunched = @"BITApplicationWasLaunched"; #pragma mark - Track telemetry - (void)trackSessionWithState:(BITSessionState) state { - __weak typeof(self) weakSelf = self; - dispatch_async(_telemetryEventQueue, ^{ - typeof(self) strongSelf = weakSelf; - BITSessionStateData *sessionStateData = [BITSessionStateData new]; - sessionStateData.state = state; - [[strongSelf channel] enqueueTelemetryItem:sessionStateData]; - }); + BITSessionStateData *sessionStateData = [BITSessionStateData new]; + sessionStateData.state = state; + [self.channel enqueueTelemetryItem:sessionStateData]; } #pragma mark - Custom getter @@ -157,7 +153,7 @@ NSString *const kBITApplicationWasLaunched = @"BITApplicationWasLaunched"; - (BITTelemetryContext *)telemetryContext { if(!_telemetryContext){ - _telemetryContext = [[BITTelemetryContext alloc] initWithInstrumentationKey:self.appIdentifier persistence:self.persistence]; + _telemetryContext = [[BITTelemetryContext alloc] initWithAppIdentifier:self.appIdentifier persistence:self.persistence]; } return _telemetryContext; }