wip
This commit is contained in:
parent
1e27b8643c
commit
b0ef155be8
|
@ -120,6 +120,7 @@ final class XMPPService: ObservableObject {
|
||||||
switch res {
|
switch res {
|
||||||
case .success:
|
case .success:
|
||||||
completion(true)
|
completion(true)
|
||||||
|
|
||||||
case .failure:
|
case .failure:
|
||||||
completion(false)
|
completion(false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,7 @@ private struct ConversationMessageRow: View {
|
||||||
@EnvironmentObject var store: AppStore
|
@EnvironmentObject var store: AppStore
|
||||||
|
|
||||||
let message: Message
|
let message: Message
|
||||||
|
@State private var offset: CGSize = .zero
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
|
@ -143,6 +144,27 @@ private struct ConversationMessageRow: View {
|
||||||
}
|
}
|
||||||
.padding(.vertical, 10)
|
.padding(.vertical, 10)
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 16)
|
||||||
|
.background(Color.clearTappable)
|
||||||
|
.offset(offset)
|
||||||
|
.gesture(
|
||||||
|
DragGesture(minimumDistance: 20, coordinateSpace: .local)
|
||||||
|
.onEnded { value in
|
||||||
|
withAnimation(.easeOut(duration: 0.1)) {
|
||||||
|
if value.translation.width < 0 {
|
||||||
|
offset = CGSize(width: -50, height: 0)
|
||||||
|
// TODO: Quick message replay here
|
||||||
|
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
||||||
|
withAnimation(.easeOut(duration: 0.1)) {
|
||||||
|
offset = .zero
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
offset = .zero
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.sharedListRow()
|
.sharedListRow()
|
||||||
}
|
}
|
||||||
|
@ -200,6 +222,22 @@ struct MessageAttr: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// self.conversationLogController?.getTextOfSelectedRows(paths: [indexPath], withTimestamps: false, handler: { [weak self] texts in
|
||||||
|
// let text: String = texts.flatMap { $0.split(separator: "\n")}.map {
|
||||||
|
// if $0.starts(with: ">") {
|
||||||
|
// return ">\($0)";
|
||||||
|
// } else {
|
||||||
|
// return "> \($0)"
|
||||||
|
// }
|
||||||
|
// }.joined(separator: "\n");
|
||||||
|
//
|
||||||
|
// if let current = self?.messageText, !current.isEmpty {
|
||||||
|
// self?.messageText = "\(current)\n\(text)\n";
|
||||||
|
// } else {
|
||||||
|
// self?.messageText = "\(text)\n";
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
// Preview
|
// Preview
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
struct ConversationScreen_Previews: PreviewProvider {
|
struct ConversationScreen_Previews: PreviewProvider {
|
||||||
|
@ -234,9 +272,35 @@ struct MessageAttr: View {
|
||||||
date: Date(),
|
date: Date(),
|
||||||
pending: true, sentError: false
|
pending: true, sentError: false
|
||||||
),
|
),
|
||||||
Message(id: "2", type: .chat, contentType: .text, from: contact, to: acc, body: "this is for testsdfsdf sdfsdf sdfs sdf sdffsdf sdf sdf sdf sdf sdf sdff sdfffwwe ", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: false),
|
Message(
|
||||||
|
id: "2",
|
||||||
|
type: .chat,
|
||||||
|
contentType: .text,
|
||||||
|
from: contact,
|
||||||
|
to: acc,
|
||||||
|
body: "this is for testsdfsdf sdfsdf sdfs sdf sdffsdf sdf sdf sdf sdf sdf sdff sdfffwwe ",
|
||||||
|
subject: nil,
|
||||||
|
thread: nil,
|
||||||
|
oobUrl: nil,
|
||||||
|
date: Date(),
|
||||||
|
pending: false,
|
||||||
|
sentError: false
|
||||||
|
),
|
||||||
Message(id: "3", type: .chat, contentType: .text, from: contact, to: acc, body: "this is for test", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: true),
|
Message(id: "3", type: .chat, contentType: .text, from: contact, to: acc, body: "this is for test", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: true),
|
||||||
Message(id: "4", type: .chat, contentType: .text, from: acc, to: contact, body: "this is for test sdfkjwek jwkjfh jwerf jdfhskjdhf jsdhfjhwefh sjdhfh fsdjhfh sd ", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: false),
|
Message(
|
||||||
|
id: "4",
|
||||||
|
type: .chat,
|
||||||
|
contentType: .text,
|
||||||
|
from: acc,
|
||||||
|
to: contact,
|
||||||
|
body: "this is for test sdfkjwek jwkjfh jwerf jdfhskjdhf jsdhfjhwefh sjdhfh fsdjhfh sd ",
|
||||||
|
subject: nil,
|
||||||
|
thread: nil,
|
||||||
|
oobUrl: nil,
|
||||||
|
date: Date(),
|
||||||
|
pending: false,
|
||||||
|
sentError: false
|
||||||
|
),
|
||||||
Message(id: "5", type: .chat, contentType: .text, from: contact, to: acc, body: "this is for test sdfjkkeke kekkddjw;; w;edkdjfj l kjwekrjfk wef", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: false),
|
Message(id: "5", type: .chat, contentType: .text, from: contact, to: acc, body: "this is for test sdfjkkeke kekkddjw;; w;edkdjfj l kjwekrjfk wef", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: false),
|
||||||
Message(id: "6", type: .chat, contentType: .text, from: acc, to: contact, body: "this is for testsdf dsdkkekkddn wejkjfj ", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: false),
|
Message(id: "6", type: .chat, contentType: .text, from: acc, to: contact, body: "this is for testsdf dsdkkekkddn wejkjfj ", subject: nil, thread: nil, oobUrl: nil, date: Date(), pending: false, sentError: false),
|
||||||
Message(
|
Message(
|
||||||
|
|
13
ConversationsClassic/View/UIToolkit/Colors+Tappable.swift
Normal file
13
ConversationsClassic/View/UIToolkit/Colors+Tappable.swift
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
public extension Color {
|
||||||
|
static let clearTappable = Color.white.opacity(0.0001)
|
||||||
|
// static func random(randomOpacity: Bool = false) -> Color {
|
||||||
|
// Color(
|
||||||
|
// red: .random(in: 0 ... 1),
|
||||||
|
// green: .random(in: 0 ... 1),
|
||||||
|
// blue: .random(in: 0 ... 1),
|
||||||
|
// opacity: randomOpacity ? .random(in: 0 ... 1) : 1
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
}
|
Loading…
Reference in a new issue