Skip to content

Commit

Permalink
IOS-2464 Keep explicit reference
Browse files Browse the repository at this point in the history
  • Loading branch information
tureck1y committed Nov 2, 2022
1 parent ecf1205 commit de192dd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions TangemSdk/TangemSdk/Operations/Backup/BackupService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,15 @@ public class BackupService: ObservableObject {
Message(header: nil,
body: "backup_finalize_primary_card_message_format".localized($0))
}

currentCommand = task

sdk.startSession(with: task,
cardId: primaryCard.cardId,
initialMessage: initialMessage,
completion: completion)
initialMessage: initialMessage) {[weak self] result in
completion(result)
self?.currentCommand = nil
}

} catch {
completion(.failure(error.toTangemSdkError()))
Expand Down Expand Up @@ -332,17 +336,23 @@ public class BackupService: ObservableObject {
Message(header: nil,
body: "backup_finalize_backup_card_message_format".localized($0))
}

currentCommand = command

sdk.startSession(with: command,
cardId: backupCard.cardId,
initialMessage: initialMessage) { result in
initialMessage: initialMessage) {[weak self] result in
guard let self = self else { return }

switch result {
case .success(let card):
self.repo.data.finalizedBackupCardsCount += 1
completion(.success(card))
case .failure(let error):
completion(.failure(error))
}

self.currentCommand = nil
}

} catch {
Expand Down

0 comments on commit de192dd

Please sign in to comment.