login patch

This commit is contained in:
cheykrym 2025-12-04 02:41:45 +03:00
parent 0a162a5b2d
commit 98ea7bcf02
2 changed files with 12 additions and 1 deletions

View File

@ -219,6 +219,7 @@ class LoginViewModel: ObservableObject {
self.loadStoredUser()
self.isLoggedIn = true
self.socketService.connectForCurrentUser()
self.verificationCode = ""
} else {
self.errorMessage = message ?? NSLocalizedString("Проверьте введённый код и попробуйте снова.", comment: "")
self.showError = true

View File

@ -681,7 +681,17 @@ private struct OTPInputView: View {
get: { code },
set: { newValue in
let filtered = newValue.filter { $0.isNumber }
code = String(filtered.prefix(length))
let trimmed = String(filtered.prefix(length))
// избегаем nested updates
if code != trimmed {
// отключаем анимации и делаем обновление вне view update фазы
var transaction = Transaction()
transaction.disablesAnimations = true
withTransaction(transaction) {
code = trimmed
}
}
}
)
}