-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IOS-8509 Update auth flow #4283
Conversation
if accessCode.count < 4 { | ||
throw ValidationError.accessCodeTooShort | ||
} | ||
try accessCodeValidator.validateAccessCode(accessCode: accessCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше валидировать ошибки в одном месте, поэтому перенес в TangemVisa
viewModel.log("Failed to use selected access code. Reason: \(error)") | ||
/// We need to show alert in parent view, otherwise it won't be shown | ||
await viewModel.delegate?.showAlert(error.alertBinder) | ||
if !error.isCancellationError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
если была отмена - можно ничего не показывать
@@ -250,10 +228,18 @@ extension VisaOnboardingViewModel { | |||
onboardingStepsBuilderFactory: cardMockConfig, | |||
pushNotificationsInteractor: PushNotificationsInteractorMock() | |||
) | |||
guard let cardInput = inputFactory.makeOnboardingInput() else { | |||
fatalError("Failed to generate card input for visa onboarding") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
моки, ничего страшного что тут будет фалаточка
@@ -16,6 +17,16 @@ public struct VisaUtilities { | |||
self.isTestnet = isTestnet | |||
} | |||
|
|||
public var batchId: [String] { | |||
[ | |||
"AF05", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мой бы батч сразу добавить
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ошибся, изменил на правильный
|
||
enum DefaultWalletData: Codable { | ||
case file(WalletData) | ||
case legacy(WalletData) | ||
case twin(WalletData, TwinData) | ||
case visa(accessToken: String, refreshToken: String) | ||
case visa(activationInput: VisaCardActivationInput, tokens: VisaAuthorizationTokens?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это все с карты считывается?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это все результат сканирования карточки, токены конечно не с карты читаются. Но не знаю куда приложить это. Складывать в AppScanTaskResponse
- странно что у всех будет это поле, оно супер-специфично. Создавать и где-то хранить какую-то сущность по активации - тоже не канает, т.к. это не обязательно ведет на активацию, при сканировании виза карты можно получить сразу боевые токены авторизации, когда карта активирована полностью.
) | ||
return CommonVisaActivationManager(authorizationTokenHandler: tokenHandler) | ||
do { | ||
cardSession = try await startCardSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
жестко конфузит, cardSession у нас в сдк, а тут еще и TangemSdkError внизу, может visaactivationsession или что-то типа того?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
обновил
let challenge = try await getAuthorizationChallenge(for: input) | ||
|
||
log("Attempting to start NFC session") | ||
let cardSession: CardSession = try await withCheckedThrowingContinuation { continuation in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я не знаю, чет с асинками прям сильно хуже все выглядит
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
обновил
Tangem/Modules/Onboarding/Visa/Pages/AccessCode/VisaOnboardingAccessCodeSetupViewModel.swift
Show resolved
Hide resolved
Tangem/Modules/Onboarding/Visa/Pages/AccessCode/VisaOnboardingAccessCodeSetupViewModel.swift
Show resolved
Hide resolved
TangemVisa/APIService/CustomerInfoService/CustomerInfoService.swift
Outdated
Show resolved
Hide resolved
guard card.cardId.caseInsensitiveCompare(activationInput.cardId) == .orderedSame else { | ||
completion(.failure(.underlying(error: VisaActivationError.wrongCard))) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
думаю пока так ок, но в целом это можно будет вынести в кастомный префлайт фильтр
Изменился порядок запроса токенов доступа, теперь они запрашиваются перед стартом сессии в онбординге, подписываются и отправляются.
Сделал почти все на протоколах, чтобы потом можно было покрыть по максимуму юнитами, думаю тут это очень понадобится. Пока что добавляю логи везде где тестирую, думаю ближе к финалу подчищу и наведу марафет, но сейчас надо по максимуму чтобы все было покрыто логами