mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 20:29:53 +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
|
.if(!smallView) { view in
|
||||||
view.modifier(PrivacyBlur(blurred: $blurred))
|
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
|
.onChange(of: m.activeCallViewIsCollapsed) { _ in
|
||||||
showFullScreenImage = false
|
showFullScreenImage = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,15 @@ struct CILinkView: View {
|
||||||
.resizable()
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.modifier(PrivacyBlur(blurred: $blurred))
|
.modifier(PrivacyBlur(blurred: $blurred))
|
||||||
|
.if(!blurred) { v in
|
||||||
|
v.simultaneousGesture(TapGesture().onEnded {
|
||||||
|
openBrowserAlert(uri: linkPreview.uri)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
VStack(alignment: .leading, spacing: 6) {
|
VStack(alignment: .leading, spacing: 6) {
|
||||||
Text(linkPreview.title)
|
Text(linkPreview.title)
|
||||||
.lineLimit(3)
|
.lineLimit(3)
|
||||||
// if linkPreview.description != "" {
|
|
||||||
// Text(linkPreview.description)
|
|
||||||
// .font(.subheadline)
|
|
||||||
// .lineLimit(12)
|
|
||||||
// }
|
|
||||||
Text(linkPreview.uri.absoluteString)
|
Text(linkPreview.uri.absoluteString)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
|
@ -37,11 +37,11 @@ struct CILinkView: View {
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 12)
|
.padding(.horizontal, 12)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
|
||||||
.simultaneousGesture(TapGesture().onEnded {
|
.simultaneousGesture(TapGesture().onEnded {
|
||||||
openBrowserAlert(uri: linkPreview.uri)
|
openBrowserAlert(uri: linkPreview.uri)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func openBrowserAlert(uri: URL) {
|
func openBrowserAlert(uri: URL) {
|
||||||
|
|
|
@ -193,7 +193,8 @@ struct CIVideoView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.modifier(PrivacyBlur(enabled: !videoPlaying, blurred: $blurred))
|
.modifier(PrivacyBlur(enabled: !videoPlaying, blurred: $blurred))
|
||||||
.simultaneousGesture(TapGesture().onEnded {
|
.if(!blurred) { v in
|
||||||
|
v.simultaneousGesture(TapGesture().onEnded {
|
||||||
switch player.timeControlStatus {
|
switch player.timeControlStatus {
|
||||||
case .playing:
|
case .playing:
|
||||||
player.pause()
|
player.pause()
|
||||||
|
@ -205,6 +206,7 @@ struct CIVideoView: View {
|
||||||
default: ()
|
default: ()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
.onChange(of: m.activeCallViewIsCollapsed) { _ in
|
.onChange(of: m.activeCallViewIsCollapsed) { _ in
|
||||||
showFullScreenPlayer = false
|
showFullScreenPlayer = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ struct ComposeLinkView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .center, spacing: 8) {
|
HStack(alignment: .center, spacing: 8) {
|
||||||
if let linkPreview = linkPreview {
|
if let linkPreview {
|
||||||
linkPreviewView(linkPreview)
|
linkPreviewView(linkPreview)
|
||||||
} else {
|
} else {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
|
|
|
@ -1254,12 +1254,15 @@ struct ComposeView: View {
|
||||||
if pendingLinkUrl == url {
|
if pendingLinkUrl == url {
|
||||||
composeState = composeState.copy(preview: .linkPreview(linkPreview: nil))
|
composeState = composeState.copy(preview: .linkPreview(linkPreview: nil))
|
||||||
getLinkPreview(url: url) { linkPreview in
|
getLinkPreview(url: url) { linkPreview in
|
||||||
if let linkPreview = linkPreview,
|
if let linkPreview, pendingLinkUrl == url {
|
||||||
pendingLinkUrl == url {
|
|
||||||
composeState = composeState.copy(preview: .linkPreview(linkPreview: linkPreview))
|
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 {
|
.overlay {
|
||||||
if (blurred && enabled) {
|
if (blurred && enabled) {
|
||||||
Color.clear.contentShape(Rectangle())
|
Color.clear.contentShape(Rectangle())
|
||||||
.onTapGesture {
|
.simultaneousGesture(TapGesture().onEnded {
|
||||||
blurred = false
|
blurred = false
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onReceive(NotificationCenter.default.publisher(for: .chatViewWillBeginScrolling)) { _ in
|
.onReceive(NotificationCenter.default.publisher(for: .chatViewWillBeginScrolling)) { _ in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue