Hide the Favourites feature behind a feature flag

Some issues were encountered with this feature. Disabling it for now.

Once we have the full Damus Labs UI, we will add the feature there.

Changelog-Changed: Placed the Favorites feature behind a feature flag
Closes: https://github.com/damus-io/damus/issues/3304
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
Daniel D’Aquino
2025-10-31 14:48:47 -07:00
parent 56a7d1ed78
commit 9ca6b5e9ab
5 changed files with 35 additions and 19 deletions

View File

@@ -150,7 +150,9 @@ struct ProfileActionSheetView: View {
ScrollView(.horizontal) { ScrollView(.horizontal) {
HStack(spacing: 20) { HStack(spacing: 20) {
followButton followButton
favoriteButton if damus_state.settings.enable_favourites_feature {
favoriteButton
}
zapButton zapButton
dmButton dmButton
if damus_state.keypair.pubkey != profile.pubkey && damus_state.keypair.privkey != nil { if damus_state.keypair.pubkey != profile.pubkey && damus_state.keypair.privkey != nil {

View File

@@ -270,7 +270,9 @@ struct ProfileView: View {
func actionSection(record: ProfileRecord?, pubkey: Pubkey) -> some View { func actionSection(record: ProfileRecord?, pubkey: Pubkey) -> some View {
return Group { return Group {
FavoriteButtonView(pubkey: profile.pubkey, damus_state: damus_state) if damus_state.settings.enable_favourites_feature {
FavoriteButtonView(pubkey: profile.pubkey, damus_state: damus_state)
}
if let record, if let record,
let profile = record.profile, let profile = record.profile,
let lnurl = record.lnurl, let lnurl = record.lnurl,

View File

@@ -253,6 +253,10 @@ class UserSettingsStore: ObservableObject {
@Setting(key: "enable_experimental_load_new_content_button", default_value: false) @Setting(key: "enable_experimental_load_new_content_button", default_value: false)
var enable_experimental_load_new_content_button: Bool var enable_experimental_load_new_content_button: Bool
/// Whether the app should show the Favourites feature (Damus Labs)
@Setting(key: "enable_favourites_feature", default_value: false)
var enable_favourites_feature: Bool
@StringSetting(key: "purple_environment", default_value: .production) @StringSetting(key: "purple_environment", default_value: .production)
var purple_enviroment: DamusPurpleEnvironment var purple_enviroment: DamusPurpleEnvironment

View File

@@ -599,13 +599,15 @@ class HomeModel: ContactsDelegate, ObservableObject {
} }
// Add filter for favorited users who we dont follow // Add filter for favorited users who we dont follow
let all_favorites = damus_state.contactCards.favorites if damus_state.settings.enable_favourites_feature {
let favorited_not_followed = Array(all_favorites.subtracting(Set(friends))) let all_favorites = damus_state.contactCards.favorites
if !favorited_not_followed.isEmpty { let favorited_not_followed = Array(all_favorites.subtracting(Set(friends)))
var favorites_filter = NostrFilter(kinds: home_filter_kinds) if !favorited_not_followed.isEmpty {
favorites_filter.authors = favorited_not_followed var favorites_filter = NostrFilter(kinds: home_filter_kinds)
favorites_filter.limit = 500 favorites_filter.authors = favorited_not_followed
home_filters.append(favorites_filter) favorites_filter.limit = 500
home_filters.append(favorites_filter)
}
} }
self.homeHandlerTask?.cancel() self.homeHandlerTask?.cancel()

View File

@@ -40,7 +40,11 @@ struct PostingTimelineView: View {
func content_filter(_ fstate: FilterState) -> ((NostrEvent) -> Bool) { func content_filter(_ fstate: FilterState) -> ((NostrEvent) -> Bool) {
var filters = ContentFilters.defaults(damus_state: damus_state) var filters = ContentFilters.defaults(damus_state: damus_state)
filters.append(fstate.filter) filters.append(fstate.filter)
switch timeline_source {
// If favourites feature is disabled, always use follows
let sourceToUse = damus_state.settings.enable_favourites_feature ? timeline_source : .follows
switch sourceToUse {
case .follows: case .follows:
filters.append(damus_state.contacts.friend_filter) filters.append(damus_state.contacts.friend_filter)
case .favorites: case .favorites:
@@ -67,15 +71,17 @@ struct PostingTimelineView: View {
HStack(alignment: .center) { HStack(alignment: .center) {
SignalView(state: damus_state, signal: home.signal) SignalView(state: damus_state, signal: home.signal)
let switchView = PostingTimelineSwitcherView( if damus_state.settings.enable_favourites_feature {
damusState: damus_state, let switchView = PostingTimelineSwitcherView(
timelineSource: $timeline_source damusState: damus_state,
) timelineSource: $timeline_source
if #available(iOS 17.0, *) { )
switchView if #available(iOS 17.0, *) {
.popoverTip(PostingTimelineSwitcherView.TimelineSwitcherTip.shared) switchView
} else { .popoverTip(PostingTimelineSwitcherView.TimelineSwitcherTip.shared)
switchView } else {
switchView
}
} }
} }
} }