Skip to content

Commit

Permalink
Fix detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
Mama1emon committed Oct 10, 2024
1 parent 03e9d3b commit f6fdc78
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,9 @@ class BackupService(
if (handleErrors && repo.data.accessCode == null && repo.data.passcode == null) {
throw TangemSdkError.AccessCodeOrPasscodeRequired()
}
val accessCode =
repo.data.accessCode ?: UserCodeType.AccessCode.defaultValue.calculateSha256()
val passcode =
repo.data.passcode ?: UserCodeType.Passcode.defaultValue.calculateSha256()
val primaryCard =
repo.data.primaryCard.guard { throw TangemSdkError.MissingPrimaryCard() }
val accessCode = repo.data.accessCode ?: UserCodeType.AccessCode.defaultValue.calculateSha256()
val passcode = repo.data.passcode ?: UserCodeType.Passcode.defaultValue.calculateSha256()
val primaryCard = repo.data.primaryCard.guard { throw TangemSdkError.MissingPrimaryCard() }

// val linkableBackupCards = repo.data.backupCards.map { card ->
// val certificate = repo.data.certificates[card.cardId]
Expand All @@ -328,9 +325,7 @@ class BackupService(

if (handleErrors) {
if (repo.data.backupCards.isEmpty()) throw TangemSdkError.EmptyBackupCards()
if (repo.data.backupCards.size > MAX_BACKUP_CARDS_COUNT) {
throw TangemSdkError.TooMuchBackupCards()
}
if (repo.data.backupCards.size > MAX_BACKUP_CARDS_COUNT) throw TangemSdkError.TooMuchBackupCards()
}

val task = FinalizePrimaryCardTask(
Expand All @@ -340,10 +335,7 @@ class BackupService(
readBackupStartIndex = repo.data.backupData.size,
attestSignature = repo.data.attestSignature,
onLink = {
repo.data = repo.data.copy(
attestSignature = it,
primaryCardFinalized = false,
)
repo.data = repo.data.copy(attestSignature = it, primaryCardFinalized = false)
},
onRead = { cardId, data ->
repo.data = repo.data.copy(
Expand All @@ -352,9 +344,7 @@ class BackupService(
)
},
onFinalize = {
repo.data = repo.data.copy(
primaryCardFinalized = true,
)
repo.data = repo.data.copy(primaryCardFinalized = true)
},
)

Expand Down

0 comments on commit f6fdc78

Please # to comment.