mirror of
https://github.com/VernissageApp/Vernissage.git
synced 2024-12-27 09:23:45 +01:00
Fix image blinking after touch.
This commit is contained in:
parent
f10a32537c
commit
4c831a7f6a
@ -12,7 +12,7 @@ struct SignInView: View {
|
||||
|
||||
@State private var serverAddress: String = ""
|
||||
|
||||
var onSignInStateChenge: (_ applicationViewMode: ApplicationViewMode) -> Void?
|
||||
var onSignInStateChenge: ((_ applicationViewMode: ApplicationViewMode) -> Void)?
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
@ -32,7 +32,7 @@ struct SignInView: View {
|
||||
try await AuthorizationService.shared.signIn(serverAddress: serverAddress, { accountData in
|
||||
DispatchQueue.main.async {
|
||||
self.applicationState.accountData = accountData
|
||||
onSignInStateChenge(.mainView)
|
||||
onSignInStateChenge?(.mainView)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -47,6 +47,6 @@ struct SignInView: View {
|
||||
|
||||
struct SignInView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SignInView { applicationViewMode in }
|
||||
SignInView()
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,11 @@ struct StatusView: View {
|
||||
ScrollView {
|
||||
if let statusData = self.statusData {
|
||||
VStack (alignment: .leading) {
|
||||
ImagesCarousel(attachments: statusData.attachments()) { attachmentData in
|
||||
self.setAttachment(attachmentData)
|
||||
}
|
||||
ImagesCarousel(attachments: statusData.attachments(),
|
||||
exifCamera: $exifCamera,
|
||||
exifExposure: $exifExposure,
|
||||
exifCreatedDate: $exifCreatedDate,
|
||||
exifLens: $exifLens)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
NavigationLink(destination: UserProfileView(
|
||||
|
@ -15,7 +15,7 @@ struct CommentsSection: View {
|
||||
@State public var withDivider = true
|
||||
@State private var context: Context?
|
||||
|
||||
var onNewStatus: (_ context: Status) -> Void?
|
||||
var onNewStatus: ((_ context: Status) -> Void)?
|
||||
|
||||
private let contentWidth = Int(UIScreen.main.bounds.width) - 50
|
||||
|
||||
@ -122,7 +122,7 @@ struct CommentsSection: View {
|
||||
favourited: status.favourited,
|
||||
favouritesCount: status.favouritesCount,
|
||||
bookmarked: status.bookmarked) {
|
||||
onNewStatus(status)
|
||||
self.onNewStatus?(status)
|
||||
}
|
||||
.foregroundColor(self.getInteractionRowTextColor())
|
||||
.padding(.horizontal, 16)
|
||||
@ -133,7 +133,7 @@ struct CommentsSection: View {
|
||||
}
|
||||
|
||||
CommentsSection(statusId: status.id, withDivider: false) { context in
|
||||
onNewStatus(context)
|
||||
self.onNewStatus?(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -167,6 +167,6 @@ struct CommentsSection: View {
|
||||
|
||||
struct CommentsSection_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CommentsSection(statusId: "", withDivider: true) { context in }
|
||||
CommentsSection(statusId: "", withDivider: true)
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,13 @@ struct ImagesCarousel: View {
|
||||
@State private var height: Double = 0.0
|
||||
@State private var selectedAttachmentId = ""
|
||||
|
||||
var onAttachmentChange: (_ attachmentData: AttachmentData) -> Void?
|
||||
@Binding public var exifCamera: String?
|
||||
@Binding public var exifExposure: String?
|
||||
@Binding public var exifCreatedDate: String?
|
||||
@Binding public var exifLens: String?
|
||||
|
||||
var body: some View {
|
||||
TabView(selection: $selectedAttachmentId) {
|
||||
TabView() {
|
||||
ForEach(attachments, id: \.id) { attachment in
|
||||
if let image = UIImage(data: attachment.data) {
|
||||
Image(uiImage: image)
|
||||
@ -28,7 +31,10 @@ struct ImagesCarousel: View {
|
||||
.tabViewStyle(PageTabViewStyle())
|
||||
.onChange(of: selectedAttachmentId, perform: { index in
|
||||
if let attachment = attachments.first(where: { item in item.id == index }) {
|
||||
onAttachmentChange(attachment)
|
||||
self.exifCamera = attachment.exifCamera
|
||||
self.exifExposure = attachment.exifExposure
|
||||
self.exifCreatedDate = attachment.exifCreatedDate
|
||||
self.exifLens = attachment.exifLens
|
||||
}
|
||||
})
|
||||
.onAppear {
|
||||
@ -57,8 +63,7 @@ struct ImagesCarousel: View {
|
||||
|
||||
struct ImagesCarousel_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ImagesCarousel(attachments: []) { attachmentData in
|
||||
|
||||
}
|
||||
ImagesCarousel(attachments: [], exifCamera: .constant(""), exifExposure: .constant(""), exifCreatedDate: .constant(""), exifLens: .constant(""))
|
||||
// ImagesCarousel(attachments: [])
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ struct InteractionRow: View {
|
||||
@State var favouritesCount = 0
|
||||
@State var bookmarked = false
|
||||
|
||||
var onNewStatus: () -> Void?
|
||||
var onNewStatus: (() -> Void)?
|
||||
|
||||
var body: some View {
|
||||
HStack (alignment: .top) {
|
||||
Button {
|
||||
HapticService.shared.touch()
|
||||
onNewStatus()
|
||||
onNewStatus?()
|
||||
} label: {
|
||||
HStack(alignment: .center) {
|
||||
Image(systemName: "message")
|
||||
@ -127,7 +127,7 @@ struct InteractionRow: View {
|
||||
|
||||
struct InteractionRow_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
InteractionRow() { }
|
||||
InteractionRow()
|
||||
.previewLayout(.fixed(width: 300, height: 70))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user