images: add scan for qr code to image context menu
Closes: https://github.com/damus-io/damus/pull/1566 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
a06be64894
commit
5d90b497f0
@@ -9,12 +9,11 @@ import Kingfisher
|
||||
|
||||
struct ProfileImageContainerView: View {
|
||||
let url: URL?
|
||||
let settings: UserSettingsStore
|
||||
|
||||
@State private var image: UIImage?
|
||||
@State private var showShareSheet = false
|
||||
|
||||
let disable_animation: Bool
|
||||
|
||||
private struct ImageHandler: ImageModifier {
|
||||
@Binding var handler: UIImage?
|
||||
|
||||
@@ -27,13 +26,13 @@ struct ProfileImageContainerView: View {
|
||||
var body: some View {
|
||||
|
||||
KFAnimatedImage(url)
|
||||
.imageContext(.pfp, disable_animation: disable_animation)
|
||||
.imageContext(.pfp, disable_animation: settings.disable_animation)
|
||||
.configure { view in
|
||||
view.framePreloadCount = 3
|
||||
}
|
||||
.imageModifier(ImageHandler(handler: $image))
|
||||
.clipShape(Circle())
|
||||
.modifier(ImageContextMenuModifier(url: url, image: image, showShareSheet: $showShareSheet))
|
||||
.modifier(ImageContextMenuModifier(url: url, image: image, settings: settings, showShareSheet: $showShareSheet))
|
||||
.sheet(isPresented: $showShareSheet) {
|
||||
ShareSheet(activityItems: [url])
|
||||
}
|
||||
@@ -64,7 +63,7 @@ struct NavDismissBarView: View {
|
||||
struct ProfilePicImageView: View {
|
||||
let pubkey: Pubkey
|
||||
let profiles: Profiles
|
||||
let disable_animation: Bool
|
||||
let settings: UserSettingsStore
|
||||
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
|
||||
@@ -74,7 +73,7 @@ struct ProfilePicImageView: View {
|
||||
.ignoresSafeArea()
|
||||
|
||||
ZoomableScrollView {
|
||||
ProfileImageContainerView(url: get_profile_url(picture: nil, pubkey: pubkey, profiles: profiles), disable_animation: disable_animation)
|
||||
ProfileImageContainerView(url: get_profile_url(picture: nil, pubkey: pubkey, profiles: profiles), settings: settings)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.padding(.top, Theme.safeAreaInsets?.top)
|
||||
.padding(.bottom, Theme.safeAreaInsets?.bottom)
|
||||
@@ -94,7 +93,7 @@ struct ProfileZoomView_Previews: PreviewProvider {
|
||||
ProfilePicImageView(
|
||||
pubkey: test_pubkey,
|
||||
profiles: make_preview_profiles(test_pubkey),
|
||||
disable_animation: false
|
||||
settings: test_damus_state.settings
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user