Skip to content

Commit

Permalink
Inbox tab reselect action (#1698)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf authored Feb 3, 2025
1 parent 5af95c2 commit 88c23f1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Mlem/App/Views/Root/Tabs/Inbox/InboxView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ struct InboxView: View {
@Setting(\.showReadInInbox) var showRead

let inboxFeedLoaders = InboxFeedLoader.setup(
api: AppState.main.firstApi,
pageSize: internetSpeed.pageSize,
sortType: .new,
showRead: showRead
api: AppState.main.firstApi,
pageSize: internetSpeed.pageSize,
sortType: .new,
showRead: showRead
)

self._replyFeedLoader = .init(wrappedValue: inboxFeedLoaders.replyFeedLoader)
Expand Down Expand Up @@ -151,7 +151,7 @@ struct InboxView: View {

@ViewBuilder
var content: some View {
FancyScrollView {
FancyScrollView(reselectAction: toggleFeed) {
VStack(spacing: 0) {
headerView
GeometryReader { geo in
Expand Down Expand Up @@ -185,6 +185,10 @@ struct InboxView: View {
handleError(error)
}
}

private func toggleFeed() {
selectedFeed = selectedFeed == .inbox ? .modMail : .inbox
}
}

private struct ScrollOffsetKey: PreferenceKey {
Expand Down

0 comments on commit 88c23f1

Please sign in to comment.