From bfab2d9fb6a4bccddc2517c6b991e7184839f1a5 Mon Sep 17 00:00:00 2001 From: Arturs Krumins Date: Thu, 1 Aug 2024 12:21:31 +0300 Subject: [PATCH] ios: fix alert reseting list position (#4554) Co-authored-by: Evgeny Poberezkin --- apps/ios/SimpleXChat/ErrorAlert.swift | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/ios/SimpleXChat/ErrorAlert.swift b/apps/ios/SimpleXChat/ErrorAlert.swift index 65ed4c6717..5b9acc4fca 100644 --- a/apps/ios/SimpleXChat/ErrorAlert.swift +++ b/apps/ios/SimpleXChat/ErrorAlert.swift @@ -72,25 +72,25 @@ extension View { _ errorAlert: Binding, @ViewBuilder actions: (ErrorAlert) -> A = { _ in EmptyView() } ) -> some View { - if let alert = errorAlert.wrappedValue { - self.alert( - alert.title, - isPresented: Binding( - get: { errorAlert.wrappedValue != nil }, - set: { if !$0 { errorAlert.wrappedValue = nil } } - ), - actions: { - if let actions_ = alert.actions { - actions_() - } else { - actions(alert) - } - }, - message: { - if let message = alert.message { Text(message) } + alert( + errorAlert.wrappedValue?.title ?? "", + isPresented: Binding( + get: { errorAlert.wrappedValue != nil }, + set: { if !$0 { errorAlert.wrappedValue = nil } } + ), + actions: { + if let actions_ = errorAlert.wrappedValue?.actions { + actions_() + } else { + if let alert = errorAlert.wrappedValue { actions(alert) } } - ) - } else { self } + }, + message: { + if let message = errorAlert.wrappedValue?.message { + Text(message) + } + } + ) } }