Add button to re-hide sensitive media once expanded (#59)

* Add button to rehide sensitive media once expanded

* Update button style to make it easier to see the button depending on background

* Fixes

Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
This commit is contained in:
Tyler Baker 2023-01-11 12:35:06 -05:00 committed by GitHub
parent e37addc7d4
commit a5308730f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,6 +149,9 @@ public struct StatusMediaPreviewView: View {
.shimmering()
}
}
if sensitive {
cornerSensitiveButton
}
if let alt = attachement.description, !alt.isEmpty, !isNotifications {
Button {
altTextDisplayed = alt
@ -213,6 +216,9 @@ public struct StatusMediaPreviewView: View {
}
.frame(width: isNotifications ? imageMaxHeight : proxy.frame(in: .local).width)
.frame(height: imageMaxHeight)
if sensitive {
cornerSensitiveButton
}
if let alt = attachement.description, !alt.isEmpty, !isNotifications {
Button {
altTextDisplayed = alt
@ -280,4 +286,16 @@ public struct StatusMediaPreviewView: View {
}
}
}
private var cornerSensitiveButton: some View {
Button {
withAnimation {
isHidingMedia = true
}
} label: {
Image(systemName:"eye.slash")
}
.position(x: 30, y: 30)
.buttonStyle(.borderedProminent)
}
}