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:
@@ -150,7 +150,9 @@ struct ProfileActionSheetView: View {
|
|||||||
ScrollView(.horizontal) {
|
ScrollView(.horizontal) {
|
||||||
HStack(spacing: 20) {
|
HStack(spacing: 20) {
|
||||||
followButton
|
followButton
|
||||||
|
if damus_state.settings.enable_favourites_feature {
|
||||||
favoriteButton
|
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 {
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
if damus_state.settings.enable_favourites_feature {
|
||||||
FavoriteButtonView(pubkey: profile.pubkey, damus_state: damus_state)
|
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,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -599,6 +599,7 @@ class HomeModel: ContactsDelegate, ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add filter for favorited users who we dont follow
|
// Add filter for favorited users who we dont follow
|
||||||
|
if damus_state.settings.enable_favourites_feature {
|
||||||
let all_favorites = damus_state.contactCards.favorites
|
let all_favorites = damus_state.contactCards.favorites
|
||||||
let favorited_not_followed = Array(all_favorites.subtracting(Set(friends)))
|
let favorited_not_followed = Array(all_favorites.subtracting(Set(friends)))
|
||||||
if !favorited_not_followed.isEmpty {
|
if !favorited_not_followed.isEmpty {
|
||||||
@@ -607,6 +608,7 @@ class HomeModel: ContactsDelegate, ObservableObject {
|
|||||||
favorites_filter.limit = 500
|
favorites_filter.limit = 500
|
||||||
home_filters.append(favorites_filter)
|
home_filters.append(favorites_filter)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.homeHandlerTask?.cancel()
|
self.homeHandlerTask?.cancel()
|
||||||
self.homeHandlerTask = Task {
|
self.homeHandlerTask = Task {
|
||||||
|
|||||||
@@ -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,6 +71,7 @@ struct PostingTimelineView: View {
|
|||||||
|
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
SignalView(state: damus_state, signal: home.signal)
|
SignalView(state: damus_state, signal: home.signal)
|
||||||
|
if damus_state.settings.enable_favourites_feature {
|
||||||
let switchView = PostingTimelineSwitcherView(
|
let switchView = PostingTimelineSwitcherView(
|
||||||
damusState: damus_state,
|
damusState: damus_state,
|
||||||
timelineSource: $timeline_source
|
timelineSource: $timeline_source
|
||||||
@@ -79,6 +84,7 @@ struct PostingTimelineView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||||
.overlay {
|
.overlay {
|
||||||
Image("damus-home")
|
Image("damus-home")
|
||||||
|
|||||||
Reference in New Issue
Block a user