diff --git a/damus/Components/ImageCarousel.swift b/damus/Components/ImageCarousel.swift index 811b9ff2b..a4cbb3fff 100644 --- a/damus/Components/ImageCarousel.swift +++ b/damus/Components/ImageCarousel.swift @@ -190,7 +190,7 @@ struct ImageCarousel: View { } .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) .fullScreenCover(isPresented: $open_sheet) { - ImageView(video_controller: state.video, urls: urls, disable_animation: state.settings.disable_animation) + ImageView(video_controller: state.video, urls: urls, settings: state.settings) } .frame(height: height) .onChange(of: selectedIndex) { value in diff --git a/damus/Views/Images/ImageContainerView.swift b/damus/Views/Images/ImageContainerView.swift index 64396ad30..21578c1f4 100644 --- a/damus/Views/Images/ImageContainerView.swift +++ b/damus/Views/Images/ImageContainerView.swift @@ -12,12 +12,11 @@ import Kingfisher struct ImageContainerView: View { let video_controller: VideoController let url: MediaUrl + 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? @@ -29,13 +28,13 @@ struct ImageContainerView: View { func Img(url: URL) -> some View { KFAnimatedImage(url) - .imageContext(.note, disable_animation: disable_animation) + .imageContext(.note, disable_animation: settings.disable_animation) .configure { view in view.framePreloadCount = 3 } .imageModifier(ImageHandler(handler: $image)) .clipped() - .modifier(ImageContextMenuModifier(url: url, image: image, showShareSheet: $showShareSheet)) + .modifier(ImageContextMenuModifier(url: url, image: image, settings: settings, showShareSheet: $showShareSheet)) .sheet(isPresented: $showShareSheet) { ShareSheet(activityItems: [url]) } @@ -57,6 +56,6 @@ let test_image_url = URL(string: "https://jb55.com/red-me.jpg")! struct ImageContainerView_Previews: PreviewProvider { static var previews: some View { - ImageContainerView(video_controller: test_damus_state().video, url: .image(test_image_url), disable_animation: false) + ImageContainerView(video_controller: test_damus_state().video, url: .image(test_image_url), settings: test_damus_state().settings) } } diff --git a/damus/Views/Images/ImageView.swift b/damus/Views/Images/ImageView.swift index 862666fb3..d999dceb6 100644 --- a/damus/Views/Images/ImageView.swift +++ b/damus/Views/Images/ImageView.swift @@ -16,7 +16,7 @@ struct ImageView: View { @State private var selectedIndex = 0 @State var showMenu = true - let disable_animation: Bool + let settings: UserSettingsStore var tabViewIndicator: some View { HStack(spacing: 10) { @@ -42,7 +42,7 @@ struct ImageView: View { TabView(selection: $selectedIndex) { ForEach(urls.indices, id: \.self) { index in ZoomableScrollView { - ImageContainerView(video_controller: video_controller, url: urls[index], disable_animation: disable_animation) + ImageContainerView(video_controller: video_controller, url: urls[index], settings: settings) .aspectRatio(contentMode: .fit) .padding(.top, Theme.safeAreaInsets?.top) .padding(.bottom, Theme.safeAreaInsets?.bottom) @@ -85,6 +85,6 @@ struct ImageView: View { struct ImageView_Previews: PreviewProvider { static var previews: some View { let url: MediaUrl = .image(URL(string: "https://jb55.com/red-me.jpg")!) - ImageView(video_controller: test_damus_state().video, urls: [url], disable_animation: false) + ImageView(video_controller: test_damus_state().video, urls: [url], settings: test_damus_state().settings) } } diff --git a/damus/Views/Images/ProfilePicImageView.swift b/damus/Views/Images/ProfilePicImageView.swift index d36c181ee..2b30e0cea 100644 --- a/damus/Views/Images/ProfilePicImageView.swift +++ b/damus/Views/Images/ProfilePicImageView.swift @@ -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 ) } } diff --git a/damus/Views/Profile/ProfileView.swift b/damus/Views/Profile/ProfileView.swift index 6cab5c5e1..78c3175c6 100644 --- a/damus/Views/Profile/ProfileView.swift +++ b/damus/Views/Profile/ProfileView.swift @@ -318,7 +318,7 @@ struct ProfileView: View { is_zoomed.toggle() } .fullScreenCover(isPresented: $is_zoomed) { - ProfilePicImageView(pubkey: profile.pubkey, profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation) + ProfilePicImageView(pubkey: profile.pubkey, profiles: damus_state.profiles, settings: damus_state.settings) } Spacer()