Skip to content

Commit

Permalink
fix: assign self.deviceId correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
bgiori committed Apr 5, 2024
1 parent cdb622c commit 4a8978c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Amplitude/Amplitude.m
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ - (void)initializeDeviceInfo {
if (self.deviceId == nil) {
self.deviceId = [self.dbHelper getValue:DEVICE_ID];
if (![self isValidDeviceId:self.deviceId]) {
self.deviceId = [self _getDeviceId];
self->_deviceId = [self _getDeviceId];
[self.dbHelper insertOrReplaceKeyValue:DEVICE_ID value:self.deviceId];
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/AmplitudeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1708,9 +1708,9 @@ - (void)testOpenURLFiresDeepLinkEvent {
- (void)testGetDeviceIdBeforeInit {
NSString *instanceName = @"testGetDeviceIdBeforeAndAfterInit";

// Clear device ID from db
// Delete DB before running the test to start fresh
AMPDatabaseHelper *dbHelper = [AMPDatabaseHelper getDatabaseHelper:instanceName];
[dbHelper insertOrReplaceKeyValue:@"device_id" value:nil];
[dbHelper deleteDB];

// Device ID should get generated before api key init
Amplitude *client = [Amplitude instanceWithName:instanceName];
Expand Down

0 comments on commit 4a8978c

Please sign in to comment.