Skip to content

Commit

Permalink
Merge branch 'dev' into eric/webp-lag
Browse files Browse the repository at this point in the history
  • Loading branch information
EricBAndrews committed Dec 17, 2024
2 parents 8e27879 + 45ed9d0 commit ceca0da
Show file tree
Hide file tree
Showing 42 changed files with 756 additions and 174 deletions.
28 changes: 26 additions & 2 deletions Mlem.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
033FCB292C5E3933007B7CD1 /* IconSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033FCB252C5E3933007B7CD1 /* IconSettingsView.swift */; };
033FCB2A2C5E3933007B7CD1 /* AlternateIconCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033FCB232C5E3933007B7CD1 /* AlternateIconCell.swift */; };
033FCB3E2C5E7FA9007B7CD1 /* View+OutdatedFeedPopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033FCB3D2C5E7FA9007B7CD1 /* View+OutdatedFeedPopup.swift */; };
034690932D0F4D720073E664 /* RemovableProviding+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 034690922D0F4D720073E664 /* RemovableProviding+Extensions.swift */; };
034B947F2C091EDD00039AF4 /* ProfileHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 034B947E2C091EDD00039AF4 /* ProfileHeaderView.swift */; };
034B94812C09306D00039AF4 /* CommunityOrPersonStub+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 034B94802C09306D00039AF4 /* CommunityOrPersonStub+Extensions.swift */; };
034B94832C09340A00039AF4 /* MarkdownConfiguration+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 034B94822C09340A00039AF4 /* MarkdownConfiguration+Extensions.swift */; };
Expand Down Expand Up @@ -125,6 +126,10 @@
0369B3562BFA6824001EFEDF /* InboxView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0369B3552BFA6824001EFEDF /* InboxView.swift */; };
0369B35D2BFB86E3001EFEDF /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0369B35A2BFB86E3001EFEDF /* Account.swift */; };
036CC3AF2B8145C30098B6A1 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036CC3AE2B8145C30098B6A1 /* AppState.swift */; };
036ED6792D0AF3740018E5EA /* PinnedSortTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036ED6782D0AF3740018E5EA /* PinnedSortTracker.swift */; };
036ED67B2D0B004D0018E5EA /* AdvancedSortView+SortButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036ED67A2D0B004D0018E5EA /* AdvancedSortView+SortButton.swift */; };
036ED67D2D0B006C0018E5EA /* TopSortPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036ED67C2D0B006C0018E5EA /* TopSortPicker.swift */; };
036ED67F2D0B9A520018E5EA /* CommunitySearchSortPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036ED67E2D0B9A520018E5EA /* CommunitySearchSortPicker.swift */; };
036ED6832D0C483B0018E5EA /* Profile2Providing+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036ED6822D0C483B0018E5EA /* Profile2Providing+Extensions.swift */; };
037331A42C9CB12D00C826E1 /* EnvironmentValues+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 037331A32C9CB12D00C826E1 /* EnvironmentValues+Extensions.swift */; };
037386472BDAFE81007492B5 /* LemmyMarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = 037386462BDAFE81007492B5 /* LemmyMarkdownUI */; };
Expand Down Expand Up @@ -156,6 +161,7 @@
0389DDDB2C3AB6340005B808 /* ActionBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0389DDDA2C3AB6340005B808 /* ActionBuilder.swift */; };
0391E0F92CFF17AE0040CCA8 /* ProfileSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0391E0F82CFF17AE0040CCA8 /* ProfileSettingsView.swift */; };
0391E0FB2D0066240040CCA8 /* ImageUploadMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0391E0FA2D0066240040CCA8 /* ImageUploadMenu.swift */; };
0391E0FE2D05B2DF0040CCA8 /* AdvancedSortView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0391E0FD2D05B2DF0040CCA8 /* AdvancedSortView.swift */; };
0397D4602C66113F002C6CDC /* CommentBodyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0397D45F2C66113F002C6CDC /* CommentBodyView.swift */; };
0397D4622C676B46002C6CDC /* ApiSortType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0397D4612C676B46002C6CDC /* ApiSortType+Extensions.swift */; };
0397D4642C676CA8002C6CDC /* FeedSortPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0397D4632C676CA8002C6CDC /* FeedSortPicker.swift */; };
Expand Down Expand Up @@ -505,6 +511,7 @@
033FCB242C5E3933007B7CD1 /* AlternateIconLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlternateIconLabel.swift; sourceTree = "<group>"; };
033FCB252C5E3933007B7CD1 /* IconSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconSettingsView.swift; sourceTree = "<group>"; };
033FCB3D2C5E7FA9007B7CD1 /* View+OutdatedFeedPopup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+OutdatedFeedPopup.swift"; sourceTree = "<group>"; };
034690922D0F4D720073E664 /* RemovableProviding+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RemovableProviding+Extensions.swift"; sourceTree = "<group>"; };
034B947E2C091EDD00039AF4 /* ProfileHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileHeaderView.swift; sourceTree = "<group>"; };
034B94802C09306D00039AF4 /* CommunityOrPersonStub+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CommunityOrPersonStub+Extensions.swift"; sourceTree = "<group>"; };
034B94822C09340A00039AF4 /* MarkdownConfiguration+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MarkdownConfiguration+Extensions.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -551,6 +558,10 @@
0369B3552BFA6824001EFEDF /* InboxView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxView.swift; sourceTree = "<group>"; };
0369B35A2BFB86E3001EFEDF /* Account.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = "<group>"; };
036CC3AE2B8145C30098B6A1 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
036ED6782D0AF3740018E5EA /* PinnedSortTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedSortTracker.swift; sourceTree = "<group>"; };
036ED67A2D0B004D0018E5EA /* AdvancedSortView+SortButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AdvancedSortView+SortButton.swift"; sourceTree = "<group>"; };
036ED67C2D0B006C0018E5EA /* TopSortPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopSortPicker.swift; sourceTree = "<group>"; };
036ED67E2D0B9A520018E5EA /* CommunitySearchSortPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunitySearchSortPicker.swift; sourceTree = "<group>"; };
036ED6822D0C483B0018E5EA /* Profile2Providing+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Profile2Providing+Extensions.swift"; sourceTree = "<group>"; };
037331A32C9CB12D00C826E1 /* EnvironmentValues+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EnvironmentValues+Extensions.swift"; sourceTree = "<group>"; };
037658DE2BE7D9EF00F4DD4D /* Community1Providing+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Community1Providing+Extensions.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -581,6 +592,7 @@
0389DDDA2C3AB6340005B808 /* ActionBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionBuilder.swift; sourceTree = "<group>"; };
0391E0F82CFF17AE0040CCA8 /* ProfileSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileSettingsView.swift; sourceTree = "<group>"; };
0391E0FA2D0066240040CCA8 /* ImageUploadMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageUploadMenu.swift; sourceTree = "<group>"; };
0391E0FD2D05B2DF0040CCA8 /* AdvancedSortView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedSortView.swift; sourceTree = "<group>"; };
0397D45F2C66113F002C6CDC /* CommentBodyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentBodyView.swift; sourceTree = "<group>"; };
0397D4612C676B46002C6CDC /* ApiSortType+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ApiSortType+Extensions.swift"; sourceTree = "<group>"; };
0397D4632C676CA8002C6CDC /* FeedSortPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedSortPicker.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -990,6 +1002,10 @@
033FCAF32C59843E007B7CD1 /* CommunityView.swift */,
03049A212C650B2C00FF6889 /* CommunityDetailsView.swift */,
0397D4632C676CA8002C6CDC /* FeedSortPicker.swift */,
036ED67C2D0B006C0018E5EA /* TopSortPicker.swift */,
036ED67E2D0B9A520018E5EA /* CommunitySearchSortPicker.swift */,
0391E0FD2D05B2DF0040CCA8 /* AdvancedSortView.swift */,
036ED67A2D0B004D0018E5EA /* AdvancedSortView+SortButton.swift */,
);
path = Community;
sourceTree = "<group>";
Expand Down Expand Up @@ -1763,6 +1779,7 @@
03AFD0E42C3C14D50054B8AD /* InstanceStubProviding+Extensions.swift */,
035394962CA1AFAF00795AA5 /* InstanceStubProviding+Uptime.swift */,
CDC199E92BE449790077B4F1 /* Interactable1Providing+Extensions.swift */,
034690922D0F4D720073E664 /* RemovableProviding+Extensions.swift */,
0397D4852C6A24D2002C6CDC /* ReportableProviding+Extensions.swift */,
03CBD1922C61369A00E870BC /* Interactable2Providing+Extensions.swift */,
0389DDC22C38907C0005B808 /* Message1Providing+Extensions.swift */,
Expand Down Expand Up @@ -1896,6 +1913,7 @@
CDE1F18E2C63D75A008AF042 /* Settings.swift */,
CDE1F19B2C63E2EB008AF042 /* SettingPropertyWrapper.swift */,
0315B1C92C767847006D4F82 /* InteractionBarTracker.swift */,
036ED6782D0AF3740018E5EA /* PinnedSortTracker.swift */,
CDD4A09B2C8A122F0001AD1A /* CodableSettings.swift */,
);
path = "User Settings";
Expand Down Expand Up @@ -2191,6 +2209,7 @@
CD7928232C73CBA400FA712D /* TileScoreView.swift in Sources */,
03AF91E12C1B25DE00E56644 /* UIDevice+Extensions.swift in Sources */,
0389DDC52C38917A0005B808 /* InboxItemProviding+Extensions.swift in Sources */,
036ED67B2D0B004D0018E5EA /* AdvancedSortView+SortButton.swift in Sources */,
CD13CC5B2C588B34001AF428 /* WebView.swift in Sources */,
CDB41E8C2C84CED500BD2DE9 /* FixedImageLoader.swift in Sources */,
039EFEC32BEEBEE0003AC372 /* LoginInstancePickerView.swift in Sources */,
Expand All @@ -2201,6 +2220,7 @@
CDB41E8E2C84CFA200BD2DE9 /* FixedImageView.swift in Sources */,
033F84C12C2AD072002E3EDF /* CommentWrapper.swift in Sources */,
034B94832C09340A00039AF4 /* MarkdownConfiguration+Extensions.swift in Sources */,
034690932D0F4D720073E664 /* RemovableProviding+Extensions.swift in Sources */,
039F58952C7B618F00C61658 /* InboxSettingsView.swift in Sources */,
CD4D58CF2B86DDEC00B82964 /* AccountSortMode.swift in Sources */,
CDE1F18F2C63D75A008AF042 /* Settings.swift in Sources */,
Expand All @@ -2221,6 +2241,7 @@
03134A522BEAD69F002662CC /* SettingsPage.swift in Sources */,
03049A1C2C65039400FF6889 /* ActiveUserCountView.swift in Sources */,
0389DDDB2C3AB6340005B808 /* ActionBuilder.swift in Sources */,
036ED67F2D0B9A520018E5EA /* CommunitySearchSortPicker.swift in Sources */,
038028FA2CB097CB0091A8A2 /* SearchView+LocationPicker.swift in Sources */,
CDD8B94C2C8234BC00510EBB /* Form.swift in Sources */,
0320B6652C91DBD500D38548 /* NavigationPage+View.swift in Sources */,
Expand Down Expand Up @@ -2388,6 +2409,7 @@
CD4D58DA2B86E11D00B82964 /* Mockable.swift in Sources */,
034B94892C09360A00039AF4 /* Int+Extensions.swift in Sources */,
039D75642C4EEE69004F24C2 /* DeletableProviding+Extensions.swift in Sources */,
0391E0FE2D05B2DF0040CCA8 /* AdvancedSortView.swift in Sources */,
0315B1C82C7635D4006D4F82 /* ApiCommentSortType+Extensions.swift in Sources */,
035394972CA1AFAF00795AA5 /* InstanceStubProviding+Uptime.swift in Sources */,
CDB2EC882BFAE14800DBC0EF /* FullyQualifiedNameView.swift in Sources */,
Expand Down Expand Up @@ -2441,6 +2463,7 @@
03A82FA32C0D1F2400D01A5C /* View+ExternalApiWarning.swift in Sources */,
033F84C32C2B12AA002E3EDF /* InstanceSummary.swift in Sources */,
0369B3532BFA514B001EFEDF /* ToastLocation.swift in Sources */,
036ED6792D0AF3740018E5EA /* PinnedSortTracker.swift in Sources */,
0353948D2CA080EB00795AA5 /* FeedWelcomeView.swift in Sources */,
03049A202C650A8100FF6889 /* FormReadout.swift in Sources */,
0397D49A2C6EA6EE002C6CDC /* InteractionBarEditorView.swift in Sources */,
Expand All @@ -2464,6 +2487,7 @@
032C320C2C3482CA00595286 /* Person1Providing+Extensions.swift in Sources */,
038028D32CAB3D2D0091A8A2 /* ShareActivity.swift in Sources */,
CD09BA7F2CB4698E00C93926 /* OledPalette.swift in Sources */,
036ED67D2D0B006C0018E5EA /* TopSortPicker.swift in Sources */,
030FF67F2BC8544700F6BFAC /* CustomTabBarController.swift in Sources */,
CD4D58F82B87B0D100B82964 /* InternetSpeed.swift in Sources */,
0353949C2CA4B3E800795AA5 /* CrossPostListView.swift in Sources */,
Expand Down Expand Up @@ -2946,8 +2970,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mlemgroup/MlemMiddleware";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.52.0;
kind = upToNextMinorVersion;
minimumVersion = 0.53.0;
};
};
CDE4AC402CA3706400981010 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mlemgroup/MlemMiddleware",
"state" : {
"revision" : "51db2875046e216fb01c8233cc43eadd147dd240",
"version" : "0.52.0"
"revision" : "a4dc838d0ff82ea76b71ee9e9568743d957e15a0",
"version" : "0.53.0"
}
},
{
Expand Down
8 changes: 4 additions & 4 deletions Mlem/App/Configuration/User Settings/CodableSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct CodableSettings: Codable {
var links_readerMode: Bool
var links_tappableLinksDisplayMode: TappableLinksDisplayMode
var menus_allModActions: Bool
var menus_modActionGrouping: String // TODO: pending mod actions
var menus_modActionGrouping: ModeratorActionGrouping
var post_defaultSort: ApiSortType
var post_fallbackSort: ApiSortType
var post_limitImageHeight: Bool
Expand Down Expand Up @@ -132,7 +132,7 @@ struct CodableSettings: Codable {
self.links_readerMode = try container.decodeIfPresent(Bool.self, forKey: .links_readerMode) ?? false
self.links_tappableLinksDisplayMode = try container.decodeIfPresent(TappableLinksDisplayMode.self, forKey: .links_tappableLinksDisplayMode) ?? .contextual
self.menus_allModActions = try container.decodeIfPresent(Bool.self, forKey: .menus_allModActions) ?? false
self.menus_modActionGrouping = try container.decodeIfPresent(String.self, forKey: .menus_modActionGrouping) ?? "none"
self.menus_modActionGrouping = try container.decodeIfPresent(ModeratorActionGrouping.self, forKey: .menus_modActionGrouping) ?? .divider
self.post_defaultSort = try container.decodeIfPresent(ApiSortType.self, forKey: .post_defaultSort) ?? .hot
self.post_fallbackSort = try container.decodeIfPresent(ApiSortType.self, forKey: .post_fallbackSort) ?? .hot
self.post_limitImageHeight = try container.decodeIfPresent(Bool.self, forKey: .post_limitImageHeight) ?? true
Expand Down Expand Up @@ -209,8 +209,8 @@ struct CodableSettings: Codable {
self.links_openInBrowser = settings.openLinksInBrowser
self.links_readerMode = settings.openLinksInReaderMode
self.links_tappableLinksDisplayMode = settings.tappableLinksDisplayMode
self.menus_allModActions = false
self.menus_modActionGrouping = "none"
self.menus_allModActions = settings.showAllModActions
self.menus_modActionGrouping = settings.moderatorActionGrouping
self.post_defaultSort = settings.defaultPostSort
self.post_fallbackSort = settings.fallbackPostSort
self.post_limitImageHeight = true
Expand Down
29 changes: 29 additions & 0 deletions Mlem/App/Configuration/User Settings/PinnedSortTracker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// PinnedSortTracker.swift
// Mlem
//
// Created by Sjmarf on 2024-12-12.
//

import Dependencies
import Foundation
import MlemMiddleware
import Observation

@Observable
class PinnedSortTracker {
@ObservationIgnored @Dependency(\.persistenceRepository)
private var persistenceRepository

var pinnedSortTypes: Set<ApiSortType> {
didSet { Task.detached {
try await self.persistenceRepository.savePinnedSortTypes(self.pinnedSortTypes)
} }
}

init() {
self.pinnedSortTypes = PersistenceRepository.liveValue.loadPinnedSortTypes()
}

public static let main: PinnedSortTracker = .init()
}
3 changes: 3 additions & 0 deletions Mlem/App/Configuration/User Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Settings: ObservableObject {
@AppStorage("navigation.swipeAnywhere") var swipeAnywhereToNavigate: Bool = false

@AppStorage("menus.moderatorActionGrouping") var moderatorActionGrouping: ModeratorActionGrouping = .divider
@AppStorage("menus.allModActions") var showAllModActions: Bool = false

var codable: CodableSettings { .init(from: self) }

Expand Down Expand Up @@ -149,5 +150,7 @@ class Settings: ObservableObject {
autoBypassImageProxy = settings.privacy_autoBypassImageProxy
sidebarVisibleByDefault = settings.navigation_sidebarVisibleByDefault
swipeAnywhereToNavigate = settings.navigation_swipeAnywhere
moderatorActionGrouping = settings.menus_modActionGrouping
showAllModActions = settings.menus_allModActions
}
}
11 changes: 11 additions & 0 deletions Mlem/App/Globals/Definitions/PersistenceRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private enum Path {
static var easterFlags = root.appendingPathComponent("Easter eggs flags", conformingTo: .json)
static var instanceMetadata = root.appendingPathComponent("Instance Metadata", conformingTo: .json)
static var layoutWidgets = root.appendingPathComponent("Layout Widgets", conformingTo: .json)
static var pinnedSortTypes = root.appendingPathComponent("Sort Settings", conformingTo: .json)
static var systemSettings = root.appendingPathComponent("System Settings", conformingTo: .directory)
static var userSettings = root.appendingPathComponent("User Settings", conformingTo: .directory)
}
Expand Down Expand Up @@ -156,6 +157,16 @@ class PersistenceRepository {
try await save(value, to: Path.layoutWidgets)
}

func loadPinnedSortTypes() -> Set<ApiSortType> {
load(Set<ApiSortType>.self, from: Path.pinnedSortTypes) ?? [
.hot, .new, .topSixHour, .topDay, .topWeek, .topMonth, .topYear, .topAll
]
}

func savePinnedSortTypes(_ value: Set<ApiSortType>) async throws {
try await save(value, to: Path.pinnedSortTypes)
}

/// Saves the given user settings
func saveUserSettings(_ settings: CodableSettings, name: String) async throws {
try await save(settings, to: Path.userSettings.appendingPathComponent(name, conformingTo: .json))
Expand Down
1 change: 1 addition & 0 deletions Mlem/App/Models/Account/GuestAccount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class GuestAccount: Account {
try container.encode(api.baseUrl, forKey: .instanceLink)
}

@MainActor
func update(instance: Instance3) {
var shouldSave = false
if avatar != instance.avatar {
Expand Down
1 change: 1 addition & 0 deletions Mlem/App/Models/Account/UserAccount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class UserAccount: Account, CommunityOrPersonStub {
getKeychainId(actorId: actorId)
}

@MainActor
func update(person: Person4, instance: Instance3) {
var shouldSave = false
if avatar != person.avatar {
Expand Down
8 changes: 8 additions & 0 deletions Mlem/App/Models/Action/BasicAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,12 @@ struct BasicAction: Action {
}
}
}

func disabled(_ value: Bool) -> BasicAction {
var new = self
if value {
new.callback = nil
}
return new
}
}
2 changes: 1 addition & 1 deletion Mlem/App/Models/Session/UserSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class UserSession: Session {
try await self.api.fetchSiteVersion(task: Task {
let (person, instance, blocks) = try await self.api.getMyPerson()
if let person {
self.account.update(person: person, instance: instance)
await self.account.update(person: person, instance: instance)
self.person = person
}
self.blocks = blocks
Expand Down
Loading

0 comments on commit ceca0da

Please sign in to comment.