                 .background(Color(theme.colors.baseBackground).edgesIgnoringSafeArea(.all))
             }
             .onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
-                if shouldShowModal {
+                if shouldShowModalOnForeground {
                     withAnimation(.linear(duration: 0.3)) {
-                        toggleModalVisibility.toggle()
-                        shouldShowModal.toggle()
+                        isModalVisible = true
+                        shouldShowModalOnForeground = false
                     }
                 }
             }
-            VanishAccountPopUpAlertView(theme:theme, isVisible: $toggleModalVisibility, userInput: $userInput.text)
+            VanishAccountPopUpAlertView(theme:theme, isVisible: $isModalVisible, userInput: $userInput.text)
         }
         
     }

            return
        }

        shouldShowModal = true
        UIApplication.shared.open(mailtoURL)
    }
    

    }
    
    @SwiftUI.ObservedObject var userInput: UserInput
    @SwiftUI.State var isModalVisible = false
    @SwiftUI.State var shouldShowModalOnForeground = false
    
    var theme: Theme
    var username: String
