|
@@ -20,6 +20,7 @@ struct LoopAPNSBolusView: View {
|
|
|
@State private var lastLoopTime: TimeInterval? = nil
|
|
@State private var lastLoopTime: TimeInterval? = nil
|
|
|
@State private var otpTimeRemaining: Int? = nil
|
|
@State private var otpTimeRemaining: Int? = nil
|
|
|
@State private var showOldCalculationWarning = false
|
|
@State private var showOldCalculationWarning = false
|
|
|
|
|
+ @State private var showTOTPWarning = false
|
|
|
private let otpPeriod: TimeInterval = 30
|
|
private let otpPeriod: TimeInterval = 30
|
|
|
private var otpTimer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
|
|
private var otpTimer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
|
|
|
|
|
|
|
@@ -125,7 +126,7 @@ struct LoopAPNSBolusView: View {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// TOTP Blocking Warning Section
|
|
// TOTP Blocking Warning Section
|
|
|
- if isTOTPBlocked {
|
|
|
|
|
|
|
+ if isTOTPBlocked && showTOTPWarning {
|
|
|
Section {
|
|
Section {
|
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
|
HStack {
|
|
HStack {
|
|
@@ -187,6 +188,15 @@ struct LoopAPNSBolusView: View {
|
|
|
|
|
|
|
|
// Validate TOTP state when view appears
|
|
// Validate TOTP state when view appears
|
|
|
_ = isTOTPBlocked
|
|
_ = isTOTPBlocked
|
|
|
|
|
+
|
|
|
|
|
+ // Add delay before showing TOTP warning to prevent flash after successful send
|
|
|
|
|
+ if isTOTPBlocked {
|
|
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
|
|
|
+ showTOTPWarning = true
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ showTOTPWarning = false
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
.onReceive(otpTimer) { _ in
|
|
.onReceive(otpTimer) { _ in
|
|
|
let now = Date().timeIntervalSince1970
|
|
let now = Date().timeIntervalSince1970
|