Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf committed Dec 30, 2023
1 parent be9fbc6 commit 765c25f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Mlem/Models/Trackers/SiteInformationTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ class SiteInformationTracker: ObservableObject {
version = account.siteVersion
Task {
do {

let response = try await apiClient.loadSiteInformation()
enableDownvotes = response.siteView.localSite.enableDownvotes
version = SiteVersion(response.version)
if version != account.siteVersion {
let avatarUrl = response.myUser?.localUserView.person.avatarUrl
accountsTracker.update(with: .init(from: account, avatarUrl: avatarUrl, siteVersion: version))
DispatchQueue.main.async {
self.accountsTracker.update(with: .init(from: account, avatarUrl: avatarUrl, siteVersion: self.version))
}
}
myUserInfo = response.myUser
allLanguages = response.allLanguages
Expand Down
2 changes: 2 additions & 0 deletions Mlem/Views/Tabs/Settings/Components/AccountButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct AccountButtonView: View {
@EnvironmentObject var appState: AppState
@Dependency(\.accountsTracker) var accountsTracker: SavedAccountTracker
@Environment(\.setAppFlow) private var setFlow
@Environment(\.dismiss) var dismiss

@State var showingSignOutConfirmation: Bool = false

Expand Down Expand Up @@ -126,6 +127,7 @@ struct AccountButtonView: View {

private func setFlow(using account: SavedAccount?) {
if let account {
dismiss()
setFlow(.account(account))
return
}
Expand Down

0 comments on commit 765c25f

Please sign in to comment.