mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 12:19:54 +00:00
ios: unblur media on tap, open/play on the second tap; handle link preview errors (#5886)
* ios: unblur media on tap, open/play on the second tap (Xcode 16 regression) * disable link preview spinner on link loading error
This commit is contained in:
parent
8d54acef92
commit
e1aa32952e
6 changed files with 33 additions and 26 deletions
|
@ -31,7 +31,9 @@ struct CIImageView: View {
|
|||
.if(!smallView) { view in
|
||||
view.modifier(PrivacyBlur(blurred: $blurred))
|
||||
}
|
||||
.simultaneousGesture(TapGesture().onEnded { showFullScreenImage = true })
|
||||
.if(!blurred) { v in
|
||||
v.simultaneousGesture(TapGesture().onEnded { showFullScreenImage = true })
|
||||
}
|
||||
.onChange(of: m.activeCallViewIsCollapsed) { _ in
|
||||
showFullScreenImage = false
|
||||
}
|
||||
|
|
|
@ -21,15 +21,15 @@ struct CILinkView: View {
|
|||
.resizable()
|
||||
.scaledToFit()
|
||||
.modifier(PrivacyBlur(blurred: $blurred))
|
||||
.if(!blurred) { v in
|
||||
v.simultaneousGesture(TapGesture().onEnded {
|
||||
openBrowserAlert(uri: linkPreview.uri)
|
||||
})
|
||||
}
|
||||
}
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
Text(linkPreview.title)
|
||||
.lineLimit(3)
|
||||
// if linkPreview.description != "" {
|
||||
// Text(linkPreview.description)
|
||||
// .font(.subheadline)
|
||||
// .lineLimit(12)
|
||||
// }
|
||||
Text(linkPreview.uri.absoluteString)
|
||||
.font(.caption)
|
||||
.lineLimit(1)
|
||||
|
@ -37,10 +37,10 @@ struct CILinkView: View {
|
|||
}
|
||||
.padding(.horizontal, 12)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.simultaneousGesture(TapGesture().onEnded {
|
||||
openBrowserAlert(uri: linkPreview.uri)
|
||||
})
|
||||
}
|
||||
.simultaneousGesture(TapGesture().onEnded {
|
||||
openBrowserAlert(uri: linkPreview.uri)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,18 +193,20 @@ struct CIVideoView: View {
|
|||
}
|
||||
}
|
||||
.modifier(PrivacyBlur(enabled: !videoPlaying, blurred: $blurred))
|
||||
.simultaneousGesture(TapGesture().onEnded {
|
||||
switch player.timeControlStatus {
|
||||
case .playing:
|
||||
player.pause()
|
||||
videoPlaying = false
|
||||
case .paused:
|
||||
if canBePlayed {
|
||||
showFullScreenPlayer = true
|
||||
.if(!blurred) { v in
|
||||
v.simultaneousGesture(TapGesture().onEnded {
|
||||
switch player.timeControlStatus {
|
||||
case .playing:
|
||||
player.pause()
|
||||
videoPlaying = false
|
||||
case .paused:
|
||||
if canBePlayed {
|
||||
showFullScreenPlayer = true
|
||||
}
|
||||
default: ()
|
||||
}
|
||||
default: ()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
.onChange(of: m.activeCallViewIsCollapsed) { _ in
|
||||
showFullScreenPlayer = false
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ struct ComposeLinkView: View {
|
|||
|
||||
var body: some View {
|
||||
HStack(alignment: .center, spacing: 8) {
|
||||
if let linkPreview = linkPreview {
|
||||
if let linkPreview {
|
||||
linkPreviewView(linkPreview)
|
||||
} else {
|
||||
ProgressView()
|
||||
|
|
|
@ -1254,11 +1254,14 @@ struct ComposeView: View {
|
|||
if pendingLinkUrl == url {
|
||||
composeState = composeState.copy(preview: .linkPreview(linkPreview: nil))
|
||||
getLinkPreview(url: url) { linkPreview in
|
||||
if let linkPreview = linkPreview,
|
||||
pendingLinkUrl == url {
|
||||
if let linkPreview, pendingLinkUrl == url {
|
||||
composeState = composeState.copy(preview: .linkPreview(linkPreview: linkPreview))
|
||||
pendingLinkUrl = nil
|
||||
} else {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
composeState = composeState.copy(preview: .noPreview)
|
||||
}
|
||||
}
|
||||
pendingLinkUrl = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ struct PrivacyBlur: ViewModifier {
|
|||
.overlay {
|
||||
if (blurred && enabled) {
|
||||
Color.clear.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
.simultaneousGesture(TapGesture().onEnded {
|
||||
blurred = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .chatViewWillBeginScrolling)) { _ in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue