@@ -47,7 +47,13 @@ class EditAccountViewModel: ObservableObject {
4747 }
4848
4949
50+ @MainActor
51+ private func showDeleteProgressView( _ showDeleteProgressView: Bool ) {
52+ self . showDeleteProgressView = showDeleteProgressView
53+ }
54+
5055 /// Updates the `EditViews`'s state like the name based on the `id`
56+ @MainActor
5157 func updateStates( ) {
5258 guard let account = model? . account ( id) else {
5359 self . name = " "
@@ -65,12 +71,12 @@ class EditAccountViewModel: ObservableObject {
6571
6672 let account = Account ( id: self . id, name: self . name, userID: userId)
6773
68- self . showSaveProgressView = true
74+ await showDeleteProgressView ( true )
6975
7076 try await model. save ( account)
7177
72- self . updateStates ( )
73- self . showSaveProgressView = false
78+ await self . updateStates ( )
79+ await showDeleteProgressView ( false )
7480 }
7581
7682 /// Deletes the `Account` that is currently edited
@@ -79,12 +85,12 @@ class EditAccountViewModel: ObservableObject {
7985 throw XpenseServiceError . deleteFailed ( Account . self)
8086 }
8187
82- self . showDeleteProgressView = true
88+ await showDeleteProgressView ( true )
8389
8490 try await model. delete ( account: id)
8591
86- self . updateStates ( )
87- self . showDeleteProgressView = false
92+ await self . updateStates ( )
93+ await showDeleteProgressView ( false )
8894 }
8995}
9096
0 commit comments