master merged
This commit is contained in:
@@ -64,6 +64,10 @@ struct OtpView: View {
|
||||
if trimmed != newValue {
|
||||
otp = trimmed
|
||||
}
|
||||
if trimmed.count == 8 && !isLoading {
|
||||
isOtpFocused = false
|
||||
validateOtp()
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 204)
|
||||
@@ -84,6 +88,7 @@ struct OtpView: View {
|
||||
Button(resendButtonTitle) {
|
||||
resendOtp()
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.font(AppTypography.heading3)
|
||||
.foregroundStyle(AppColors.primary)
|
||||
.disabled(isResending || !canResend)
|
||||
@@ -93,6 +98,7 @@ struct OtpView: View {
|
||||
Button("Colar código") {
|
||||
pasteOtpFromClipboard()
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.font(AppTypography.heading3)
|
||||
.foregroundStyle(AppColors.primary)
|
||||
.padding(.top, 22)
|
||||
@@ -116,6 +122,7 @@ struct OtpView: View {
|
||||
.padding(.bottom, 18)
|
||||
}
|
||||
}
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
.background(AppColors.backgroundLight)
|
||||
.ignoresSafeArea()
|
||||
.onAppear {
|
||||
@@ -181,31 +188,20 @@ struct OtpView: View {
|
||||
}
|
||||
|
||||
private func pasteOtpFromClipboard() {
|
||||
#if canImport(UIKit)
|
||||
let raw = UIPasteboard.general.string ?? ""
|
||||
let raw = appReadClipboardText() ?? ""
|
||||
let digits = raw.filter(\.isNumber)
|
||||
let trimmed = String(digits.prefix(8))
|
||||
if trimmed.isEmpty == false {
|
||||
otp = trimmed
|
||||
}
|
||||
#elseif canImport(AppKit)
|
||||
let raw = NSPasteboard.general.string(forType: .string) ?? ""
|
||||
let digits = raw.filter(\.isNumber)
|
||||
let trimmed = String(digits.prefix(8))
|
||||
if trimmed.isEmpty == false {
|
||||
otp = trimmed
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private func autoFillOtpFromClipboardIfAvailable() {
|
||||
#if canImport(UIKit)
|
||||
guard otp.isEmpty else { return }
|
||||
let raw = UIPasteboard.general.string ?? ""
|
||||
let raw = appReadClipboardText() ?? ""
|
||||
let digits = raw.filter(\.isNumber)
|
||||
guard digits.count >= 8 else { return }
|
||||
otp = String(digits.prefix(8))
|
||||
#endif
|
||||
}
|
||||
|
||||
private var otpDeliveryMessage: String {
|
||||
|
||||
Reference in New Issue
Block a user