Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into it/127-follow-notific…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
pelumy committed Jan 9, 2025
2 parents dd9e6b4 + 33cfcea commit 5175b64
Show file tree
Hide file tree
Showing 15 changed files with 283 additions and 36 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Release Notes
- Fixed: adding/removing relays not reflected on feed filter. [#119](https://github.com/verse-pbc/issues/issues/119)

### Internal Changes
- Added function for creating a new list and a test verifying list editing. [#112](https://github.com/verse-pbc/issues/issues/112)
- Localized strings on the feed filter drop-down view.

## [1.1] - 2025-01-03Z

### Release Notes
Expand All @@ -34,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Download and parse an author’s lists when viewing their profile. [#49](https://github.com/verse-pbc/issues/issues/49)
- Updated fastlane scripts to fix the TestFlight deployment pipeline. [#97](https://github.com/verse-pbc/issues/issues/97)
- Removed inactive accounts from Discover tab. [#94](https://github.com/verse-pbc/issues/issues/94)
- Added the Inject framework for hot reloading. [#1710](https://github.com/planetary-social/nos/pull/1710)

## [1.0.3] - 2024-12-04Z

Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ For now `main` is the main branch and code improvements are made in topic branch

A maintainer will review your code and merge it when it has the required number of approvals.

## Hot Reloading

We make use of the [Inject](https://github.com/krzysztofzablocki/Inject) framework for hot reloading debug builds. To set up hot reloading, follow the [documentation](https://github.com/krzysztofzablocki/Inject?tab=readme-ov-file#individual-developer-setup-once-per-machine).

## Dependency Management

We prefer to install dependencies using the Swift Package Manager.
Expand Down
30 changes: 30 additions & 0 deletions Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
50E2EB7B2C8617C800D4B360 /* NSRegularExpression+Replacement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E2EB712C86175900D4B360 /* NSRegularExpression+Replacement.swift */; };
50EA86D42D28150F001E62CC /* FeedSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50EA86D32D28150D001E62CC /* FeedSource.swift */; };
50EA86D52D28150F001E62CC /* FeedSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50EA86D32D28150D001E62CC /* FeedSource.swift */; };
50EA885C2D2D523F001E62CC /* follow_set_with_unknown_tag.json in Resources */ = {isa = PBXBuildFile; fileRef = 50EA885B2D2D5235001E62CC /* follow_set_with_unknown_tag.json */; };
50F695072C6392C4000E4C74 /* zap_receipt.json in Resources */ = {isa = PBXBuildFile; fileRef = 50F695062C6392C4000E4C74 /* zap_receipt.json */; };
5B098DBC2BDAF6CB00500A1B /* NoteParserTests+NIP08.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B098DBB2BDAF6CB00500A1B /* NoteParserTests+NIP08.swift */; };
5B098DC62BDAF73500500A1B /* AttributedString+Links.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B098DC52BDAF73500500A1B /* AttributedString+Links.swift */; };
Expand Down Expand Up @@ -446,6 +447,7 @@
C987F85429BA951E00B44E7A /* ClarityCity-Thin.otf in Resources */ = {isa = PBXBuildFile; fileRef = C987F83129BA951E00B44E7A /* ClarityCity-Thin.otf */; };
C987F85529BA951E00B44E7A /* ClarityCity-Thin.otf in Resources */ = {isa = PBXBuildFile; fileRef = C987F83129BA951E00B44E7A /* ClarityCity-Thin.otf */; };
C987F85B29BA9ED800B44E7A /* Font+Clarity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C987F85729BA981800B44E7A /* Font+Clarity.swift */; };
C9887D812D1EF3C400CF9101 /* Inject in Frameworks */ = {isa = PBXBuildFile; productRef = C98905A12CD3B8CF00C17EE0 /* Inject */; };
C98A32272A05795E00E3FA13 /* Task+Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98A32262A05795E00E3FA13 /* Task+Timeout.swift */; };
C98A32282A05795E00E3FA13 /* Task+Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98A32262A05795E00E3FA13 /* Task+Timeout.swift */; };
C98B8B4029FBF83B009789C8 /* NotificationCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98B8B3F29FBF83B009789C8 /* NotificationCard.swift */; };
Expand Down Expand Up @@ -791,6 +793,7 @@
50DE6B1A2C6B88FE0065665D /* View+StyledBorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+StyledBorder.swift"; sourceTree = "<group>"; };
50E2EB712C86175900D4B360 /* NSRegularExpression+Replacement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSRegularExpression+Replacement.swift"; sourceTree = "<group>"; };
50EA86D32D28150D001E62CC /* FeedSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedSource.swift; sourceTree = "<group>"; };
50EA885B2D2D5235001E62CC /* follow_set_with_unknown_tag.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = follow_set_with_unknown_tag.json; sourceTree = "<group>"; };
50F695062C6392C4000E4C74 /* zap_receipt.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = zap_receipt.json; sourceTree = "<group>"; };
5B098DBB2BDAF6CB00500A1B /* NoteParserTests+NIP08.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NoteParserTests+NIP08.swift"; sourceTree = "<group>"; };
5B098DC52BDAF73500500A1B /* AttributedString+Links.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AttributedString+Links.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1075,6 +1078,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C9887D812D1EF3C400CF9101 /* Inject in Frameworks */,
C9DEC068298965270078B43A /* Starscream in Frameworks */,
C9FD35132BCED5A6008F8D95 /* NostrSDK in Frameworks */,
C9B71DC02A8E9BAD0031ED9F /* SentrySwiftUI in Frameworks */,
Expand Down Expand Up @@ -1281,6 +1285,7 @@
03C853C52D03A50900164D6C /* follow_set.json */,
5022F9452D2186300012FF4B /* follow_set_private.json */,
03FFCA582D075E2800D6F0F1 /* follow_set_updated.json */,
50EA885B2D2D5235001E62CC /* follow_set_with_unknown_tag.json */,
039C96282C48321E00A8EB39 /* long_form_data.json */,
C95057B02CC6986E0024EC9C /* mute_list_2.json */,
C95057C42CC69A770024EC9C /* mute_list_self.json */,
Expand Down Expand Up @@ -2134,6 +2139,7 @@
C9FD35122BCED5A6008F8D95 /* NostrSDK */,
03C49ABF2C938A9C00502321 /* SwiftSoup */,
039389222CA4985C00698978 /* SDWebImageWebPCoder */,
C98905A12CD3B8CF00C17EE0 /* Inject */,
);
productName = Nos;
productReference = C9DEBFCE298941000078B43A /* Nos.app */;
Expand Down Expand Up @@ -2230,6 +2236,7 @@
C9FD35112BCED5A6008F8D95 /* XCRemoteSwiftPackageReference "nostr-sdk-ios" */,
03C49ABE2C938A9C00502321 /* XCRemoteSwiftPackageReference "SwiftSoup" */,
039389212CA4985C00698978 /* XCRemoteSwiftPackageReference "SDWebImageWebPCoder" */,
C98905A02CD3B8CF00C17EE0 /* XCRemoteSwiftPackageReference "Inject" */,
);
productRefGroup = C9DEBFCF298941000078B43A /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -2303,6 +2310,7 @@
C987F83329BA951E00B44E7A /* ClarityCity-ExtraLight.otf in Resources */,
C987F83D29BA951E00B44E7A /* ClarityCity-Bold.otf in Resources */,
C987F84529BA951E00B44E7A /* ClarityCity-ExtraBoldItalic.otf in Resources */,
50EA885C2D2D523F001E62CC /* follow_set_with_unknown_tag.json in Resources */,
038196F72CA36797002A94E3 /* elmo-animated.webp in Resources */,
9DB106002C650DDE00F98A30 /* Colors.xcassets in Resources */,
C987F84329BA951E00B44E7A /* ClarityCity-Black.otf in Resources */,
Expand Down Expand Up @@ -2963,6 +2971,7 @@
MACOSX_DEPLOYMENT_TARGET = 13.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
Expand Down Expand Up @@ -3134,6 +3143,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand Down Expand Up @@ -3184,6 +3194,11 @@
LOCALIZED_STRING_SWIFTUI_SUPPORT = NO;
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 1.1.1;
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"-Xlinker",
"-interposable",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.verse.Nos-dev";
PRODUCT_MODULE_NAME = Nos;
PRODUCT_NAME = "$(TARGET_NAME) Dev";
Expand Down Expand Up @@ -3352,6 +3367,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand Down Expand Up @@ -3410,6 +3426,7 @@
MACOSX_DEPLOYMENT_TARGET = 13.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
Expand Down Expand Up @@ -3709,6 +3726,14 @@
minimumVersion = 1.0.0;
};
};
C98905A02CD3B8CF00C17EE0 /* XCRemoteSwiftPackageReference "Inject" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/krzysztofzablocki/Inject.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.5.2;
};
};
C99DBF7C2A9E81CF00F7068F /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI";
Expand Down Expand Up @@ -3860,6 +3885,11 @@
package = C96CB98A2A6040C500498C4E /* XCRemoteSwiftPackageReference "swift-collections" */;
productName = DequeModule;
};
C98905A12CD3B8CF00C17EE0 /* Inject */ = {
isa = XCSwiftPackageProductDependency;
package = C98905A02CD3B8CF00C17EE0 /* XCRemoteSwiftPackageReference "Inject" */;
productName = Inject;
};
C99DBF7D2A9E81CF00F7068F /* SDWebImageSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
package = C99DBF7C2A9E81CF00F7068F /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "f8bae06dbeb84f5992ca8659ee3a2a75550fe8b31994d37a658183a21f1c8131",
"originHash" : "62d037ae150ed2e6e150f06b42119c5158134318243e742971b3ccfa3a3a5323",
"pins" : [
{
"identity" : "bech32",
Expand Down Expand Up @@ -37,6 +37,15 @@
"version" : "1.8.2"
}
},
{
"identity" : "inject",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzysztofzablocki/Inject.git",
"state" : {
"revision" : "728c56639ecb3df441d51d5bc6747329afabcfc9",
"version" : "1.5.2"
}
},
{
"identity" : "libwebp-xcode",
"kind" : "remoteSourceControl",
Expand Down
55 changes: 55 additions & 0 deletions Nos/Assets/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,17 @@
}
}
},
"addListsDescription" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add lists to your feed to filter by topic."
}
}
}
},
"addRelay" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -10412,6 +10423,17 @@
}
}
},
"lists" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Lists"
}
}
}
},
"loading" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -12403,6 +12425,17 @@
}
}
},
"noLists" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "It doesn’t look like you have created any lists."
}
}
}
},
"noNotifications" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -12492,6 +12525,17 @@
}
}
},
"noRelays" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "It doesn’t look like you have any relays."
}
}
}
},
"noRelaysMessage" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -16789,6 +16833,17 @@
}
}
},
"selectRelaysDescription" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Select relays to show on your feed."
}
}
}
},
"send" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
62 changes: 35 additions & 27 deletions Nos/Controller/FeedController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI

let author: Author

var enabledSources: [FeedSource] = [.following]
private(set) var enabledSources: [FeedSource] = [.following]

private(set) var selectedList: AuthorList?
private(set) var selectedRelay: Relay?
Expand Down Expand Up @@ -37,6 +37,38 @@ import SwiftUI
}
}

@ObservationIgnored private lazy var listsPublisher = {
let request = NSFetchRequest<AuthorList>(entityName: "AuthorList")
request.sortDescriptors = [NSSortDescriptor(keyPath: \Event.createdAt, ascending: false)]
request.predicate = NSPredicate(
format: "kind = %i AND author = %@ AND title != nil",
EventKind.followSet.rawValue,
author
)

let listWatcher = NSFetchedResultsController(
fetchRequest: request,
managedObjectContext: persistenceController.viewContext,
sectionNameKeyPath: nil,
cacheName: "FeedController.listWatcher"
)

return FetchedResultsControllerPublisher(fetchedResultsController: listWatcher)
}()

@ObservationIgnored private lazy var relaysPublisher = {
let request = Relay.relays(for: author)

let relayWatcher = NSFetchedResultsController(
fetchRequest: request,
managedObjectContext: persistenceController.viewContext,
sectionNameKeyPath: nil,
cacheName: "FeedController.relayWatcher"
)

return FetchedResultsControllerPublisher(fetchedResultsController: relayWatcher)
}()

private var cancellables = Set<AnyCancellable>()

init(author: Author) {
Expand All @@ -54,22 +86,7 @@ import SwiftUI
}

private func observeLists() {
let request = NSFetchRequest<AuthorList>(entityName: "AuthorList")
request.sortDescriptors = [NSSortDescriptor(keyPath: \Event.createdAt, ascending: false)]
request.predicate = NSPredicate(
format: "kind = %i AND author = %@ AND title != nil",
EventKind.followSet.rawValue,
author
)

let listWatcher = NSFetchedResultsController(
fetchRequest: request,
managedObjectContext: persistenceController.viewContext,
sectionNameKeyPath: nil,
cacheName: "FeedController.listWatcher"
)

FetchedResultsControllerPublisher(fetchedResultsController: listWatcher)
listsPublisher
.publisher
.receive(on: DispatchQueue.main)
.sink(receiveValue: { [weak self] lists in
Expand All @@ -79,16 +96,7 @@ import SwiftUI
}

private func observeRelays() {
let request = Relay.relays(for: author)

let relayWatcher = NSFetchedResultsController(
fetchRequest: request,
managedObjectContext: persistenceController.viewContext,
sectionNameKeyPath: nil,
cacheName: "FeedController.relayWatcher"
)

FetchedResultsControllerPublisher(fetchedResultsController: relayWatcher)
relaysPublisher
.publisher
.receive(on: DispatchQueue.main)
.sink(receiveValue: { [weak self] relays in
Expand Down
Loading

0 comments on commit 5175b64

Please sign in to comment.