File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
LoopFollow/Remote/LoopAPNS Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ struct LoopAPNSBolusView: View {
2020 @State private var lastLoopTime : TimeInterval ? = nil
2121 @State private var otpTimeRemaining : Int ? = nil
2222 @State private var showOldCalculationWarning = false
23+ @State private var showTOTPWarning = false
2324 private let otpPeriod : TimeInterval = 30
2425 private var otpTimer = Timer . publish ( every: 1 , on: . main, in: . common) . autoconnect ( )
2526
@@ -125,7 +126,7 @@ struct LoopAPNSBolusView: View {
125126 }
126127
127128 // TOTP Blocking Warning Section
128- if isTOTPBlocked {
129+ if isTOTPBlocked && showTOTPWarning {
129130 Section {
130131 VStack ( alignment: . leading, spacing: 8 ) {
131132 HStack {
@@ -187,6 +188,15 @@ struct LoopAPNSBolusView: View {
187188
188189 // Validate TOTP state when view appears
189190 _ = isTOTPBlocked
191+
192+ // Add delay before showing TOTP warning to prevent flash after successful send
193+ if isTOTPBlocked {
194+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.5 ) {
195+ showTOTPWarning = true
196+ }
197+ } else {
198+ showTOTPWarning = false
199+ }
190200 }
191201 . onReceive ( otpTimer) { _ in
192202 let now = Date ( ) . timeIntervalSince1970
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ struct LoopAPNSCarbsView: View {
1616 @State private var alertMessage = " "
1717 @State private var alertType : AlertType = . success
1818 @State private var otpTimeRemaining : Int ? = nil
19+ @State private var showTOTPWarning = false
1920 private let otpPeriod : TimeInterval = 30
2021 private var otpTimer = Timer . publish ( every: 1 , on: . main, in: . common) . autoconnect ( )
2122
@@ -178,7 +179,7 @@ struct LoopAPNSCarbsView: View {
178179 }
179180
180181 // TOTP Blocking Warning Section
181- if isTOTPBlocked {
182+ if isTOTPBlocked && showTOTPWarning {
182183 Section {
183184 VStack ( alignment: . leading, spacing: 8 ) {
184185 HStack {
@@ -250,6 +251,15 @@ struct LoopAPNSCarbsView: View {
250251
251252 // Validate TOTP state when view appears
252253 _ = isTOTPBlocked
254+
255+ // Add delay before showing TOTP warning to prevent flash after successful send
256+ if isTOTPBlocked {
257+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.5 ) {
258+ showTOTPWarning = true
259+ }
260+ } else {
261+ showTOTPWarning = false
262+ }
253263 }
254264 . onReceive ( otpTimer) { _ in
255265 let now = Date ( ) . timeIntervalSince1970
You can’t perform that action at this time.
0 commit comments