Skip to content

Commit 6a5d0a7

Browse files
committed
ref
1 parent 365146e commit 6a5d0a7

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

Recommend/Sources/Core/RECCore.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,11 @@ final class RECCore {
5555
let storedKeychainDeviceId = RECKeychainService.getItem(service: Self.keychainService, account: Self.keychainAccount)
5656
let storedDefaultsDeviceId = userDefaults.deviceId
5757

58-
if let storedDefaultsDeviceId {
59-
if !storedDefaultsDeviceId.isEmpty{
60-
deviceId = storedDefaultsDeviceId
61-
} else {
62-
userDefaults.deviceId = nil
63-
}
58+
if let storedDefaultsDeviceId,
59+
!storedDefaultsDeviceId.isEmpty {
60+
deviceId = storedDefaultsDeviceId
6461
} else if let storedKeychainDeviceId,
65-
!storedKeychainDeviceId.isEmpty{
62+
!storedKeychainDeviceId.isEmpty {
6663
deviceId = storedKeychainDeviceId
6764
} else {
6865
deviceId = device.identifierForVendor?.uuidString ?? UUID().uuidString
@@ -73,6 +70,7 @@ final class RECCore {
7370
throw RECInvalidDeviceIdError(deviceId: deviceId)
7471
}
7572

73+
userDefaults.deviceId = nil
7674
RECKeychainService.removeItem(service: Self.keychainService, account: Self.keychainAccount)
7775
RECKeychainService.saveItem(service: Self.keychainService, account: Self.keychainAccount, data: deviceId)
7876

0 commit comments

Comments
 (0)