Fix list of accounts after add new account (previously list has not been refreshed after signing).
Also check new statuses 5 seconds after application start (not imediatelly).
This commit is contained in:
parent
b0873f2d1a
commit
a89abc06db
|
@ -80,9 +80,11 @@ struct VernissageApp: App {
|
|||
}
|
||||
.navigationViewStyle(.stack)
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)) { _ in
|
||||
Task {
|
||||
// Refresh indicator of new photos when application is become active.
|
||||
await self.calculateNewPhotosInBackground()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
|
||||
Task {
|
||||
// Refresh indicator of new photos when application is become active.
|
||||
await self.calculateNewPhotosInBackground()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(timer) { time in
|
||||
|
|
|
@ -10,14 +10,9 @@ struct AccountsSectionView: View {
|
|||
@EnvironmentObject var applicationState: ApplicationState
|
||||
@EnvironmentObject var client: Client
|
||||
|
||||
@State private var accounts: [AccountModel]
|
||||
private var dbAccounts: [AccountData]
|
||||
|
||||
init() {
|
||||
self.dbAccounts = AccountDataHandler.shared.getAccountsData()
|
||||
self.accounts = self.dbAccounts.map({ AccountModel(accountData: $0) })
|
||||
}
|
||||
|
||||
@State private var accounts: [AccountModel] = []
|
||||
@State private var dbAccounts: [AccountData] = []
|
||||
|
||||
var body: some View {
|
||||
Section("Accounts") {
|
||||
ForEach(self.accounts) { account in
|
||||
|
@ -44,6 +39,10 @@ struct AccountsSectionView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
self.dbAccounts = AccountDataHandler.shared.getAccountsData()
|
||||
self.accounts = self.dbAccounts.map({ AccountModel(accountData: $0) })
|
||||
}
|
||||
}
|
||||
|
||||
private func deleteDisabled(for account: AccountModel) -> Bool {
|
||||
|
|
Loading…
Reference in New Issue