ui: Add setting that allows users to optionally disable profile action sheets.
Tested on iOS 17.0.1 on an iPhone 15 Pro simulator. Closes: https://github.com/damus-io/damus/issues/1641 Changelog-Added: Add setting that allows users to optionally disable the new profile action sheet feature Signed-off-by: Daniel D’Aquino <daniel@daquino.me> Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
9969e70b5f
commit
bbccc27a26
@@ -113,6 +113,9 @@ class UserSettingsStore: ObservableObject {
|
|||||||
@Setting(key: "hide_nsfw_tagged_content", default_value: false)
|
@Setting(key: "hide_nsfw_tagged_content", default_value: false)
|
||||||
var hide_nsfw_tagged_content: Bool
|
var hide_nsfw_tagged_content: Bool
|
||||||
|
|
||||||
|
@Setting(key: "show_profile_action_sheet_on_pfp_click", default_value: true)
|
||||||
|
var show_profile_action_sheet_on_pfp_click: Bool
|
||||||
|
|
||||||
@Setting(key: "zap_vibration", default_value: true)
|
@Setting(key: "zap_vibration", default_value: true)
|
||||||
var zap_vibration: Bool
|
var zap_vibration: Bool
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ struct EventProfile: View {
|
|||||||
HStack(alignment: .center, spacing: 10) {
|
HStack(alignment: .center, spacing: 10) {
|
||||||
ProfilePicView(pubkey: pubkey, size: pfp_size, highlight: .none, profiles: damus_state.profiles, disable_animation: disable_animation, show_zappability: true)
|
ProfilePicView(pubkey: pubkey, size: pfp_size, highlight: .none, profiles: damus_state.profiles, disable_animation: disable_animation, show_zappability: true)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
notify(.present_sheet(Sheets.profile_action(pubkey)))
|
show_profile_action_sheet_if_enabled(damus_state: damus_state, pubkey: pubkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ struct MaybeAnonPfpView: View {
|
|||||||
} else {
|
} else {
|
||||||
ProfilePicView(pubkey: pubkey, size: size, highlight: .none, profiles: state.profiles, disable_animation: state.settings.disable_animation, show_zappability: true)
|
ProfilePicView(pubkey: pubkey, size: size, highlight: .none, profiles: state.profiles, disable_animation: state.settings.disable_animation, show_zappability: true)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
notify(.present_sheet(Sheets.profile_action(pubkey)))
|
show_profile_action_sheet_if_enabled(damus_state: state, pubkey: pubkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,6 +334,15 @@ struct InnerHeightPreferenceKey: PreferenceKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func show_profile_action_sheet_if_enabled(damus_state: DamusState, pubkey: Pubkey) {
|
||||||
|
if damus_state.settings.show_profile_action_sheet_on_pfp_click {
|
||||||
|
notify(.present_sheet(Sheets.profile_action(pubkey)))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
damus_state.nav.push(route: Route.ProfileByKey(pubkey: pubkey))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
ProfileActionSheetView(damus_state: test_damus_state, pubkey: test_pubkey)
|
ProfileActionSheetView(damus_state: test_damus_state, pubkey: test_pubkey)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,15 @@ struct AppearanceSettingsView: View {
|
|||||||
.toggleStyle(.switch)
|
.toggleStyle(.switch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Profiles
|
||||||
|
Section(
|
||||||
|
header: Text(NSLocalizedString("Profiles", comment: "Section title for profile view configuration.")),
|
||||||
|
footer: Text(NSLocalizedString("Profile action sheets allow you to follow, zap, or DM profiles more quickly without having to view their full profile", comment: "Section footer clarifying what the profile action sheet feature does"))
|
||||||
|
) {
|
||||||
|
Toggle(NSLocalizedString("Show profile action sheets", comment: "Setting to show profile action sheets when clicking on a user's profile picture"), isOn: $settings.show_profile_action_sheet_on_pfp_click)
|
||||||
|
.toggleStyle(.switch)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.navigationTitle(NSLocalizedString("Appearance", comment: "Navigation title for text and appearance settings."))
|
.navigationTitle(NSLocalizedString("Appearance", comment: "Navigation title for text and appearance settings."))
|
||||||
|
|||||||
Reference in New Issue
Block a user