-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media Preview Setting #1757
Closed
Closed
Media Preview Setting #1757
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On Tue, Nov 21, 2023 at 05:31:16PM -0700, ericholguin wrote:
+ if artifacts.media.count > 0 {
+ if !damus_state.settings.media_previews && !load_media {
+ Button(action: {
+ load_media = true
+ }, label: {
+ VStack(alignment: .leading) {
+ HStack {
+ Image("images")
+ Text("Load media", comment: "Button to show media in note.")
+ .fontWeight(.bold)
+ .font(eventviewsize_to_font(size, font_size: damus_state.settings.font_size))
+ }
+ .padding(EdgeInsets(top: 5, leading: 10, bottom: 0, trailing: 10))
+
+ ForEach(artifacts.media.indices, id: \.self) { index in
+ Divider()
+ .frame(height: 1)
+ switch artifacts.media[index] {
+ case .image(let url), .video(let url):
+ Text("\(url)")
+ .font(eventviewsize_to_font(size, font_size: damus_state.settings.font_size))
+ .foregroundStyle(DamusColors.neutral6)
+ .multilineTextAlignment(.leading)
+ .padding(EdgeInsets(top: 0, leading: 10, bottom: 5, trailing: 10))
+ }
+ }
}
+ .background(DamusColors.neutral1)
+ .frame(minWidth: 300, maxWidth: .infinity, alignment: .center)
+ .cornerRadius(8)
+ .overlay(
+ RoundedRectangle(cornerRadius: 8)
+ .stroke(DamusColors.neutral3, lineWidth: 1)
+ )
Please make this its own view!
…+ })
+ .padding(.horizontal)
+ } else if show_images || (show_images && !damus_state.settings.media_previews && load_media) {
+ ImageCarousel(state: damus_state, evid: event.id, urls: artifacts.media)
+ } else if !show_images || (!show_images && !damus_state.settings.media_previews && load_media) {
+ ZStack {
+ ImageCarousel(state: damus_state, evid: event.id, urls: artifacts.media)
+ Blur()
+ .onTapGesture {
+ show_images = true
+ }
+ }
}
- //.cornerRadius(10)
}
if artifacts.invoices.count > 0 {
@@ -155,10 +192,12 @@ struct NoteContentView: View {
}
}
- if with_padding {
- previewView(links: artifacts.links).padding(.horizontal)
- } else {
- previewView(links: artifacts.links)
+ if damus_state.settings.media_previews {
+ if with_padding {
+ previewView(links: artifacts.links).padding(.horizontal)
+ } else {
+ previewView(links: artifacts.links)
+ }
}
}
diff --git a/damus/Views/Settings/AppearanceSettingsView.swift b/damus/Views/Settings/AppearanceSettingsView.swift
index e1add45c1..93c9339c5 100644
--- a/damus/Views/Settings/AppearanceSettingsView.swift
+++ b/damus/Views/Settings/AppearanceSettingsView.swift
@@ -81,6 +81,9 @@ struct AppearanceSettingsView: View {
Toggle(NSLocalizedString("Always show images", comment: "Setting to always show and never blur images"), isOn: $settings.always_show_images)
.toggleStyle(.switch)
+ Toggle(NSLocalizedString("Media previews", comment: "Setting to show media"), isOn: $settings.media_previews)
+ .toggleStyle(.switch)
+
Picker(NSLocalizedString("Image uploader", comment: "Prompt selection of user's image uploader"),
selection: $settings.default_media_uploader) {
ForEach(MediaUploader.allCases, id: \.self) { uploader in
|
Changelog-Added: Media preview setting
ericholguin
force-pushed
the
media-previews-setting
branch
from
November 23, 2023 05:08
e58b497
to
d1ef4ee
Compare
Done! Separated to its own view |
On Wed, Nov 22, 2023 at 09:09:36PM -0800, Eric Holguin wrote:
Done! Separated to its own view
thanks! testing
|
Code looks good!
Reviewed-by: William Casarin ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the Media preview setting in order to allow users to toggle previewing media such as links, images, videos, gif, etc. or to only preview when tapped.
nostr:note1vm22g8xsv7lqggz7q490rm4n6kze6s8v4xjgfcgzj8rxm8xcwz4qnhr0cy