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) {
HStack(spacing: 20) {
followButton
favoriteButton
if damus_state.settings.enable_favourites_feature {
favoriteButton
}
zapButton
dmButton
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 {
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,
let profile = record.profile,
let lnurl = record.lnurl,

View File

@@ -253,6 +253,10 @@ class UserSettingsStore: ObservableObject {
@Setting(key: "enable_experimental_load_new_content_button", default_value: false)
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)
var purple_enviroment: DamusPurpleEnvironment

View File

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

View File

@@ -40,7 +40,11 @@ struct PostingTimelineView: View {
func content_filter(_ fstate: FilterState) -> ((NostrEvent) -> Bool) {
var filters = ContentFilters.defaults(damus_state: damus_state)
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:
filters.append(damus_state.contacts.friend_filter)
case .favorites:
@@ -67,15 +71,17 @@ struct PostingTimelineView: View {
HStack(alignment: .center) {
SignalView(state: damus_state, signal: home.signal)
let switchView = PostingTimelineSwitcherView(
damusState: damus_state,
timelineSource: $timeline_source
)
if #available(iOS 17.0, *) {
switchView
.popoverTip(PostingTimelineSwitcherView.TimelineSwitcherTip.shared)
} else {
switchView
if damus_state.settings.enable_favourites_feature {
let switchView = PostingTimelineSwitcherView(
damusState: damus_state,
timelineSource: $timeline_source
)
if #available(iOS 17.0, *) {
switchView
.popoverTip(PostingTimelineSwitcherView.TimelineSwitcherTip.shared)
} else {
switchView
}
}
}
}