From 49c3a21dead2cf08fafd2def71ef615b8961020a Mon Sep 17 00:00:00 2001 From: mplorentz Date: Tue, 4 Jun 2024 10:01:11 -0400 Subject: [PATCH 1/4] merge fix-profile-not-loading-notes into fix-spinners --- CHANGELOG.md | 2 + Nos/Controller/PagedNoteDataSource.swift | 58 ++++++++++++++++++- .../Relay/PagedRelaySubscription.swift | 2 +- .../Relay/RelaySubscriptionManager.swift | 6 ++ 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d360845d..57ebce7fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Fixed a bug where some profiles wouldn't load old notes. + ## [0.1.16] - 2024-05-31Z - Added feedback to the copy button in Settings. diff --git a/Nos/Controller/PagedNoteDataSource.swift b/Nos/Controller/PagedNoteDataSource.swift index 61afa5a93..1dba573fa 100644 --- a/Nos/Controller/PagedNoteDataSource.swift +++ b/Nos/Controller/PagedNoteDataSource.swift @@ -70,6 +70,7 @@ class PagedNoteDataSource: NSObject, UICol var limitedFilter = relayFilter limitedFilter.limit = pageSize self.pager = await relayService.subscribeToPagedEvents(matching: limitedFilter) + loadMoreIfNeeded(for: IndexPath(row: 0, section: 0)) } } @@ -82,6 +83,7 @@ class PagedNoteDataSource: NSObject, UICol ) self.fetchedResultsController.delegate = self try? self.fetchedResultsController.performFetch() + loadMoreIfNeeded(for: IndexPath(row: 0, section: 0)) } // MARK: - UICollectionViewDataSource @@ -174,13 +176,63 @@ class PagedNoteDataSource: NSObject, UICol /// Instructs the pager to load more data if we are getting close to the end of the object in the list. /// - Parameter indexPath: the indexPath last loaded by the collection view. func loadMoreIfNeeded(for indexPath: IndexPath) { + largestLoadedRowIndex = max(largestLoadedRowIndex, indexPath.row) + Log.debug("loadingMoreIfNeeded \(indexPath)") let lastPageStartIndex = (fetchedResultsController.fetchedObjects?.count ?? 0) - pageSize if indexPath.row > lastPageStartIndex { - // we are at the end of the list, load aggressively - pager?.loadMore() + // we are on the last page, load aggressively + startAggressivePaging() + return } else if indexPath.row.isMultiple(of: pageSize / 2) { + Log.debug("loading next page") pager?.loadMore() - } + } + } + + /// A timer used for aggressive paging when we reach the end of the data. See `startAggressivePaging()`. + private var aggressivePagingTimer: Timer? + + /// The largest row index seen by `loadMoreIfNeeded(for:)` + private var largestLoadedRowIndex: Int = 0 + + /// This function puts the data source into "aggressive paging" mode, which basically changes the paging + /// code from executing when the user scrolls (more efficient) to executing on a repeating timer. This timer will + /// automatically call `stopAggressivePaging` when it has loaded enough data. + /// + /// We need to use this mode when we have an empty or nearly empty list of notes, or when the user reaches the end + /// of the results before more have loaded. We can't just wait on the existing paging requests to return (like a + /// normal REST paging API) because often we can't request exactly the notes we want from relays. For instance when + /// we are fetching root notes only on the profile screen we can only ask relays for all kind 1 notes. This means + /// we could get a page full of reply notes from the relays, none of which will match our NSFetchRequest and show + /// up in the UICollectionViewDataSource - meaning `cellForRowAtIndexPath` won't be called which means + /// `loadMoreIfNeeded(for:)` won't be called which means we'll never ask for the next page. So we need the timer. + private func startAggressivePaging() { + if aggressivePagingTimer == nil { + aggressivePagingTimer = Timer.scheduledTimer(withTimeInterval: 0.25, repeats: true) { [weak self] timer in + guard let self else { + timer.invalidate() + return + } + + let lastPageStartIndex = (self.fetchedResultsController.fetchedObjects?.count ?? 0) - self.pageSize + + if self.largestLoadedRowIndex > lastPageStartIndex { + // we are still on the last page of results, keep loading + self.pager?.loadMore() + } else { + // we've loaded enough, go back to normal paging + self.stopAggressivePaging() + } + } + } + } + + /// Takes this data source out of "aggressive paging" mode. See `startAggressivePaging()`. + private func stopAggressivePaging() { + if let aggressivePagingTimer { + aggressivePagingTimer.invalidate() + self.aggressivePagingTimer = nil + } } // MARK: - NSFetchedResultsControllerDelegate diff --git a/Nos/Service/Relay/PagedRelaySubscription.swift b/Nos/Service/Relay/PagedRelaySubscription.swift index abc60bb48..6ae555e6c 100644 --- a/Nos/Service/Relay/PagedRelaySubscription.swift +++ b/Nos/Service/Relay/PagedRelaySubscription.swift @@ -72,7 +72,7 @@ class PagedRelaySubscription { } newUntilDates[subscription.relayAddress] = newDate - await subscriptionManager.decrementSubscriptionCount(for: subscriptionID) + await relayService.decrementSubscriptionCount(for: subscriptionID) } } diff --git a/Nos/Service/Relay/RelaySubscriptionManager.swift b/Nos/Service/Relay/RelaySubscriptionManager.swift index b8488bbda..5bf215c71 100644 --- a/Nos/Service/Relay/RelaySubscriptionManager.swift +++ b/Nos/Service/Relay/RelaySubscriptionManager.swift @@ -81,6 +81,12 @@ actor RelaySubscriptionManagerActor: RelaySubscriptionManager { removeSubscription(with: subscriptionID) } + /// Lets the manager know that there is one less subscriber for the given subscription. If there are no + /// more subscribers this function returns `true`. + /// + /// Note that this does not send a close message on the websocket or close the socket. Right now those actions + /// are performed by the RelayService. It's yucky though. Maybe we should make the RelaySubscriptionManager + /// do that in the future. @discardableResult func decrementSubscriptionCount(for subscriptionID: RelaySubscription.ID) async -> Bool { if var subscription = subscription(from: subscriptionID) { From 9c16d2d8bf01c552d719927f0eb043504ea6493f Mon Sep 17 00:00:00 2001 From: mplorentz Date: Wed, 5 Jun 2024 11:02:12 -0400 Subject: [PATCH 2/4] Refactor navigationDestinations on the main tabs into NostrNavigationStack. --- Nos.xcodeproj/project.pbxproj | 4 ++ .../Components/NostrNavigationStack.swift | 43 +++++++++++++++++++ Nos/Views/Discover/DiscoverTab.swift | 15 +------ Nos/Views/Home/HomeTab.swift | 16 +------ Nos/Views/NotificationsView.swift | 15 +------ Nos/Views/Profile/ProfileTab.swift | 8 +--- Nos/Views/Profile/ProfileView.swift | 7 --- Nos/Views/SideMenuContent.swift | 8 +--- 8 files changed, 52 insertions(+), 64 deletions(-) create mode 100644 Nos/Views/Components/NostrNavigationStack.swift diff --git a/Nos.xcodeproj/project.pbxproj b/Nos.xcodeproj/project.pbxproj index 9b30ec34b..58974a321 100644 --- a/Nos.xcodeproj/project.pbxproj +++ b/Nos.xcodeproj/project.pbxproj @@ -240,6 +240,7 @@ C97A1C8C29E45B4E009D9E8D /* RawEventController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97A1C8A29E45B4E009D9E8D /* RawEventController.swift */; }; C97A1C8E29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97A1C8D29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift */; }; C97A1C8F29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97A1C8D29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift */; }; + C97B288A2C10B07100DC1FC0 /* NostrNavigationStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97B28892C10B07100DC1FC0 /* NostrNavigationStack.swift */; }; C981E2DB2AC6088900FBF4F6 /* UNSVerifyCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C981E2DA2AC6088900FBF4F6 /* UNSVerifyCodeView.swift */; }; C981E2DD2AC610D600FBF4F6 /* UNSStepImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C981E2DC2AC610D600FBF4F6 /* UNSStepImage.swift */; }; C98298332ADD7F9A0096C5B5 /* DeepLinkService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98298322ADD7F9A0096C5B5 /* DeepLinkService.swift */; }; @@ -654,6 +655,7 @@ C97A1C8729E45B3C009D9E8D /* RawEventView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawEventView.swift; sourceTree = ""; }; C97A1C8A29E45B4E009D9E8D /* RawEventController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawEventController.swift; sourceTree = ""; }; C97A1C8D29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Nos.swift"; sourceTree = ""; }; + C97B28892C10B07100DC1FC0 /* NostrNavigationStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NostrNavigationStack.swift; sourceTree = ""; }; C981E2DA2AC6088900FBF4F6 /* UNSVerifyCodeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UNSVerifyCodeView.swift; sourceTree = ""; }; C981E2DC2AC610D600FBF4F6 /* UNSStepImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UNSStepImage.swift; sourceTree = ""; }; C98298312ADD7EDB0096C5B5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; @@ -987,6 +989,7 @@ 5B79F6522BA11B08002DA9BE /* WizardSheetDescriptionText.swift */, 5B79F6542BA123D4002DA9BE /* WizardSheetBadgeText.swift */, 5B29B58D2BEC392B008F6008 /* ActivityPubBadgeView.swift */, + C97B28892C10B07100DC1FC0 /* NostrNavigationStack.swift */, ); path = Components; sourceTree = ""; @@ -1973,6 +1976,7 @@ CD2CF38E299E67F900332116 /* CardButtonStyle.swift in Sources */, A336DD3C299FD78000A0CBA0 /* Filter.swift in Sources */, DC2E54C82A700F1400C2CAAB /* UIDevice+Simulator.swift in Sources */, + C97B288A2C10B07100DC1FC0 /* NostrNavigationStack.swift in Sources */, C98CA9072B14FBBF00929141 /* PagedNoteDataSource.swift in Sources */, C9A0DAEA29C6A34200466635 /* ActivityView.swift in Sources */, CD2CF390299E68BE00332116 /* NoteButton.swift in Sources */, diff --git a/Nos/Views/Components/NostrNavigationStack.swift b/Nos/Views/Components/NostrNavigationStack.swift new file mode 100644 index 000000000..f1d84d7d7 --- /dev/null +++ b/Nos/Views/Components/NostrNavigationStack.swift @@ -0,0 +1,43 @@ +// +// NostrNavigationStack.swift +// Nos +// +// Created by Matthew Lorentz on 6/5/24. +// + +import SwiftUI + +/// A NavigationStack that knows how to present views to display Nostr entities like `Events` and `Authors`. +/// Take care not to nest these. +struct NostrNavigationStack: View { + + @Binding var path: NavigationPath + + var content: () -> Content + + var body: some View { + NavigationStack(path: $path) { + content() + .navigationDestination(for: Event.self) { note in + RepliesView(note: note) + } + .navigationDestination(for: URL.self) { url in + URLView(url: url) + } + .navigationDestination(for: ReplyToNavigationDestination.self) { destination in + RepliesView(note: destination.note, showKeyboard: true) + } + .navigationDestination(for: Author.self) { author in + ProfileView(author: author) + } + } + } +} + +#Preview { + @State var path = NavigationPath() + + return NostrNavigationStack(path: $path) { + Text("hello world") + } +} diff --git a/Nos/Views/Discover/DiscoverTab.swift b/Nos/Views/Discover/DiscoverTab.swift index 80b078234..08a0cfd86 100644 --- a/Nos/Views/Discover/DiscoverTab.swift +++ b/Nos/Views/Discover/DiscoverTab.swift @@ -27,7 +27,7 @@ struct DiscoverTab: View { // MARK: - View var body: some View { - NavigationStack(path: $router.discoverPath) { + NostrNavigationStack(path: $router.discoverPath) { ZStack { if performingInitialLoad && searchController.query.isEmpty { FullscreenProgressView( @@ -65,19 +65,6 @@ struct DiscoverTab: View { analytics.showedDiscover() } } - .navigationDestination(for: Event.self) { note in - RepliesView(note: note) - } - .navigationDestination(for: URL.self) { url in URLView(url: url) } - .navigationDestination(for: ReplyToNavigationDestination.self) { destination in - RepliesView(note: destination.note, showKeyboard: true) - } - .navigationDestination(for: Author.self) { author in - ProfileView(author: author) - } - .navigationDestination(for: EditProfileDestination.self) { destination in - ProfileEditView(author: destination.profile) - } .nosNavigationBar(title: .localizable.discover) .toolbarBackground(.visible, for: .navigationBar) .toolbarBackground(Color.cardBgBottom, for: .navigationBar) diff --git a/Nos/Views/Home/HomeTab.swift b/Nos/Views/Home/HomeTab.swift index e010c4a72..3809e696b 100644 --- a/Nos/Views/Home/HomeTab.swift +++ b/Nos/Views/Home/HomeTab.swift @@ -6,24 +6,10 @@ struct HomeTab: View { @ObservedObject var user: Author @EnvironmentObject private var router: Router - @Environment(CurrentUser.self) var currentUser var body: some View { - NavigationStack(path: $router.homeFeedPath) { + NostrNavigationStack(path: $router.homeFeedPath) { HomeFeedView(user: user) - .navigationDestination(for: Event.self) { note in - RepliesView(note: note) - } - .navigationDestination(for: Author.self) { author in - ProfileView(author: author) - } - .navigationDestination(for: EditProfileDestination.self) { destination in - ProfileEditView(author: destination.profile) - } - .navigationDestination(for: ReplyToNavigationDestination.self) { destination in - RepliesView(note: destination.note, showKeyboard: true) - } - .navigationDestination(for: URL.self) { url in URLView(url: url) } } } } diff --git a/Nos/Views/NotificationsView.swift b/Nos/Views/NotificationsView.swift index 5452af616..0f2c88972 100644 --- a/Nos/Views/NotificationsView.swift +++ b/Nos/Views/NotificationsView.swift @@ -63,7 +63,7 @@ struct NotificationsView: View { } var body: some View { - NavigationStack(path: $router.notificationsPath) { + NostrNavigationStack(path: $router.notificationsPath) { ScrollView(.vertical) { LazyVStack { /// The fetch request for events has a `fetchLimit` set but it doesn't work, so we limit the @@ -90,19 +90,6 @@ struct NotificationsView: View { .padding(.top, 1) .nosNavigationBar(title: .localizable.notifications) .navigationBarItems(leading: SideMenuButton()) - .navigationDestination(for: Event.self) { note in - RepliesView(note: note) - } - .navigationDestination(for: URL.self) { url in URLView(url: url) } - .navigationDestination(for: ReplyToNavigationDestination.self) { destination in - RepliesView(note: destination.note, showKeyboard: true) - } - .navigationDestination(for: Author.self) { author in - ProfileView(author: author) - } - .navigationDestination(for: EditProfileDestination.self) { destination in - ProfileEditView(author: destination.profile) - } .refreshable { await subscribeToNewEvents() } diff --git a/Nos/Views/Profile/ProfileTab.swift b/Nos/Views/Profile/ProfileTab.swift index d04750399..be5c96e98 100644 --- a/Nos/Views/Profile/ProfileTab.swift +++ b/Nos/Views/Profile/ProfileTab.swift @@ -10,15 +10,9 @@ struct ProfileTab: View { @Binding var path: NavigationPath var body: some View { - NavigationStack(path: $path) { + NostrNavigationStack(path: $path) { ProfileView(author: author, addDoubleTapToPop: true) .navigationBarItems(leading: SideMenuButton()) - .navigationDestination(for: Author.self) { profile in - ProfileView(author: profile) - } - .navigationDestination(for: EditProfileDestination.self) { destination in - ProfileEditView(author: destination.profile) - } } } } diff --git a/Nos/Views/Profile/ProfileView.swift b/Nos/Views/Profile/ProfileView.swift index e005c6fc9..aad6b3a61 100644 --- a/Nos/Views/Profile/ProfileView.swift +++ b/Nos/Views/Profile/ProfileView.swift @@ -108,13 +108,6 @@ struct ProfileView: View { } .background(Color.appBg) .nosNavigationBar(title: title) - .navigationDestination(for: Event.self) { note in - RepliesView(note: note) - } - .navigationDestination(for: URL.self) { url in URLView(url: url) } - .navigationDestination(for: ReplyToNavigationDestination.self) { destination in - RepliesView(note: destination.note, showKeyboard: true) - } .navigationDestination(for: MutesDestination.self) { _ in MutesView() } diff --git a/Nos/Views/SideMenuContent.swift b/Nos/Views/SideMenuContent.swift index 46a0ba4da..5f87fc1f5 100644 --- a/Nos/Views/SideMenuContent.swift +++ b/Nos/Views/SideMenuContent.swift @@ -58,7 +58,7 @@ struct SideMenuContent: View { } var body: some View { - NavigationStack(path: $router.sideMenuPath) { + NostrNavigationStack(path: $router.sideMenuPath) { VStack(alignment: .leading, spacing: 0) { profileHeader SideMenuRow( @@ -109,12 +109,6 @@ struct SideMenuContent: View { AboutView() } } - .navigationDestination(for: Author.self) { profile in - ProfileView(author: profile) - } - .navigationDestination(for: EditProfileDestination.self) { destination in - ProfileEditView(author: destination.profile) - } } } } From 71125f386663e317a54ccd988f90aa482b01d34c Mon Sep 17 00:00:00 2001 From: mplorentz Date: Wed, 5 Jun 2024 11:14:01 -0400 Subject: [PATCH 3/4] Fix swiftlint warning --- Nos/Views/Components/NostrNavigationStack.swift | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Nos/Views/Components/NostrNavigationStack.swift b/Nos/Views/Components/NostrNavigationStack.swift index f1d84d7d7..ca9fb4198 100644 --- a/Nos/Views/Components/NostrNavigationStack.swift +++ b/Nos/Views/Components/NostrNavigationStack.swift @@ -1,10 +1,3 @@ -// -// NostrNavigationStack.swift -// Nos -// -// Created by Matthew Lorentz on 6/5/24. -// - import SwiftUI /// A NavigationStack that knows how to present views to display Nostr entities like `Events` and `Authors`. From b0c8b1ee8b89ded3b158ee905de11fb889869dea Mon Sep 17 00:00:00 2001 From: mplorentz Date: Thu, 6 Jun 2024 10:19:51 -0400 Subject: [PATCH 4/4] Rename NostrNavigationStack to NosNavigationStack --- Nos.xcodeproj/project.pbxproj | 8 ++++---- ...ostrNavigationStack.swift => NosNavigationStack.swift} | 4 ++-- Nos/Views/Discover/DiscoverTab.swift | 2 +- Nos/Views/Home/HomeTab.swift | 2 +- Nos/Views/NotificationsView.swift | 2 +- Nos/Views/Profile/ProfileTab.swift | 2 +- Nos/Views/SideMenuContent.swift | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) rename Nos/Views/Components/{NostrNavigationStack.swift => NosNavigationStack.swift} (91%) diff --git a/Nos.xcodeproj/project.pbxproj b/Nos.xcodeproj/project.pbxproj index 0b3520bd2..c7c1ac3ea 100644 --- a/Nos.xcodeproj/project.pbxproj +++ b/Nos.xcodeproj/project.pbxproj @@ -240,7 +240,7 @@ C97A1C8C29E45B4E009D9E8D /* RawEventController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97A1C8A29E45B4E009D9E8D /* RawEventController.swift */; }; C97A1C8E29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97A1C8D29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift */; }; C97A1C8F29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97A1C8D29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift */; }; - C97B288A2C10B07100DC1FC0 /* NostrNavigationStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97B28892C10B07100DC1FC0 /* NostrNavigationStack.swift */; }; + C97B288A2C10B07100DC1FC0 /* NosNavigationStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C97B28892C10B07100DC1FC0 /* NosNavigationStack.swift */; }; C981E2DB2AC6088900FBF4F6 /* UNSVerifyCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C981E2DA2AC6088900FBF4F6 /* UNSVerifyCodeView.swift */; }; C981E2DD2AC610D600FBF4F6 /* UNSStepImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C981E2DC2AC610D600FBF4F6 /* UNSStepImage.swift */; }; C98298332ADD7F9A0096C5B5 /* DeepLinkService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98298322ADD7F9A0096C5B5 /* DeepLinkService.swift */; }; @@ -655,7 +655,7 @@ C97A1C8729E45B3C009D9E8D /* RawEventView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawEventView.swift; sourceTree = ""; }; C97A1C8A29E45B4E009D9E8D /* RawEventController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawEventController.swift; sourceTree = ""; }; C97A1C8D29E58EC7009D9E8D /* NSManagedObjectContext+Nos.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Nos.swift"; sourceTree = ""; }; - C97B28892C10B07100DC1FC0 /* NostrNavigationStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NostrNavigationStack.swift; sourceTree = ""; }; + C97B28892C10B07100DC1FC0 /* NosNavigationStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NosNavigationStack.swift; sourceTree = ""; }; C981E2DA2AC6088900FBF4F6 /* UNSVerifyCodeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UNSVerifyCodeView.swift; sourceTree = ""; }; C981E2DC2AC610D600FBF4F6 /* UNSStepImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UNSStepImage.swift; sourceTree = ""; }; C98298312ADD7EDB0096C5B5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; @@ -989,7 +989,7 @@ 5B79F6522BA11B08002DA9BE /* WizardSheetDescriptionText.swift */, 5B79F6542BA123D4002DA9BE /* WizardSheetBadgeText.swift */, 5B29B58D2BEC392B008F6008 /* ActivityPubBadgeView.swift */, - C97B28892C10B07100DC1FC0 /* NostrNavigationStack.swift */, + C97B28892C10B07100DC1FC0 /* NosNavigationStack.swift */, ); path = Components; sourceTree = ""; @@ -1976,7 +1976,7 @@ CD2CF38E299E67F900332116 /* CardButtonStyle.swift in Sources */, A336DD3C299FD78000A0CBA0 /* Filter.swift in Sources */, DC2E54C82A700F1400C2CAAB /* UIDevice+Simulator.swift in Sources */, - C97B288A2C10B07100DC1FC0 /* NostrNavigationStack.swift in Sources */, + C97B288A2C10B07100DC1FC0 /* NosNavigationStack.swift in Sources */, C98CA9072B14FBBF00929141 /* PagedNoteDataSource.swift in Sources */, C9A0DAEA29C6A34200466635 /* ActivityView.swift in Sources */, CD2CF390299E68BE00332116 /* NoteButton.swift in Sources */, diff --git a/Nos/Views/Components/NostrNavigationStack.swift b/Nos/Views/Components/NosNavigationStack.swift similarity index 91% rename from Nos/Views/Components/NostrNavigationStack.swift rename to Nos/Views/Components/NosNavigationStack.swift index ca9fb4198..4bf60a0bb 100644 --- a/Nos/Views/Components/NostrNavigationStack.swift +++ b/Nos/Views/Components/NosNavigationStack.swift @@ -2,7 +2,7 @@ import SwiftUI /// A NavigationStack that knows how to present views to display Nostr entities like `Events` and `Authors`. /// Take care not to nest these. -struct NostrNavigationStack: View { +struct NosNavigationStack: View { @Binding var path: NavigationPath @@ -30,7 +30,7 @@ struct NostrNavigationStack: View { #Preview { @State var path = NavigationPath() - return NostrNavigationStack(path: $path) { + return NosNavigationStack(path: $path) { Text("hello world") } } diff --git a/Nos/Views/Discover/DiscoverTab.swift b/Nos/Views/Discover/DiscoverTab.swift index 08a0cfd86..e9051c41f 100644 --- a/Nos/Views/Discover/DiscoverTab.swift +++ b/Nos/Views/Discover/DiscoverTab.swift @@ -27,7 +27,7 @@ struct DiscoverTab: View { // MARK: - View var body: some View { - NostrNavigationStack(path: $router.discoverPath) { + NosNavigationStack(path: $router.discoverPath) { ZStack { if performingInitialLoad && searchController.query.isEmpty { FullscreenProgressView( diff --git a/Nos/Views/Home/HomeTab.swift b/Nos/Views/Home/HomeTab.swift index 3809e696b..7a0892268 100644 --- a/Nos/Views/Home/HomeTab.swift +++ b/Nos/Views/Home/HomeTab.swift @@ -8,7 +8,7 @@ struct HomeTab: View { @EnvironmentObject private var router: Router var body: some View { - NostrNavigationStack(path: $router.homeFeedPath) { + NosNavigationStack(path: $router.homeFeedPath) { HomeFeedView(user: user) } } diff --git a/Nos/Views/NotificationsView.swift b/Nos/Views/NotificationsView.swift index 0f2c88972..6339a9aac 100644 --- a/Nos/Views/NotificationsView.swift +++ b/Nos/Views/NotificationsView.swift @@ -63,7 +63,7 @@ struct NotificationsView: View { } var body: some View { - NostrNavigationStack(path: $router.notificationsPath) { + NosNavigationStack(path: $router.notificationsPath) { ScrollView(.vertical) { LazyVStack { /// The fetch request for events has a `fetchLimit` set but it doesn't work, so we limit the diff --git a/Nos/Views/Profile/ProfileTab.swift b/Nos/Views/Profile/ProfileTab.swift index be5c96e98..05ab71b46 100644 --- a/Nos/Views/Profile/ProfileTab.swift +++ b/Nos/Views/Profile/ProfileTab.swift @@ -10,7 +10,7 @@ struct ProfileTab: View { @Binding var path: NavigationPath var body: some View { - NostrNavigationStack(path: $path) { + NosNavigationStack(path: $path) { ProfileView(author: author, addDoubleTapToPop: true) .navigationBarItems(leading: SideMenuButton()) } diff --git a/Nos/Views/SideMenuContent.swift b/Nos/Views/SideMenuContent.swift index 5f87fc1f5..9f5338638 100644 --- a/Nos/Views/SideMenuContent.swift +++ b/Nos/Views/SideMenuContent.swift @@ -58,7 +58,7 @@ struct SideMenuContent: View { } var body: some View { - NostrNavigationStack(path: $router.sideMenuPath) { + NosNavigationStack(path: $router.sideMenuPath) { VStack(alignment: .leading, spacing: 0) { profileHeader SideMenuRow(