mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
WIP: message detail screen with swiftui
This commit is contained in:
parent
ddf4c5b5ad
commit
9bbd8f31cc
5 changed files with 138 additions and 74 deletions
|
@ -171,3 +171,4 @@ fi
|
|||
# Move the target-specific libSession-util build to the parent build directory (so XCode can have a reference to a single build)
|
||||
rm -rf "${BUILD_DIR}/libsession-util.xcframework"
|
||||
cp -r "${TARGET_BUILD_DIR}/libsession-util.xcframework" "${BUILD_DIR}/libsession-util.xcframework"
|
||||
#cp -r "${TARGET_BUILD_DIR}/libsession-util.xcframework" "${TEMP_ROOT}/Previews/Session/Products/libsession-util.xcframework"
|
||||
|
|
|
@ -5550,8 +5550,8 @@
|
|||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH,
|
||||
$TARGET_BUILD_DIR/$INFOPLIST_PATH,
|
||||
"$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH",
|
||||
"$TARGET_BUILD_DIR/$INFOPLIST_PATH",
|
||||
);
|
||||
name = "Add Commit Hash To Build Info Plist";
|
||||
outputFileListPaths = (
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "NO"
|
||||
codeCoverageEnabled = "YES"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
|
|
@ -2,79 +2,123 @@
|
|||
|
||||
import SwiftUI
|
||||
import SessionUIKit
|
||||
import SessionSnodeKit
|
||||
|
||||
struct MessageInfoView: View {
|
||||
var actions: [ContextMenuVC.Action]
|
||||
var messageViewModel: MessageViewModel
|
||||
|
||||
var body: some View {
|
||||
VStack(
|
||||
alignment: .center,
|
||||
spacing: 10
|
||||
) {
|
||||
// Message bubble snapshot
|
||||
Image("snapshot")
|
||||
ZStack {
|
||||
if #available(iOS 14.0, *) {
|
||||
Color.black.ignoresSafeArea()
|
||||
} else {
|
||||
Color.black
|
||||
}
|
||||
|
||||
// TODO: Attachment carousel view
|
||||
|
||||
// Message Info
|
||||
ZStack {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
VStack(
|
||||
alignment: .leading,
|
||||
spacing: 10
|
||||
) {
|
||||
VStack(
|
||||
alignment: .center,
|
||||
spacing: 10
|
||||
) {
|
||||
// Message bubble snapshot
|
||||
Image("snapshot")
|
||||
|
||||
// TODO: Attachment carousel view
|
||||
|
||||
// Message Info
|
||||
ZStack {
|
||||
RoundedRectangle(cornerRadius: 17)
|
||||
.fill(Color(red: 27.0/255, green: 27.0/255, blue: 27.0/255))
|
||||
|
||||
VStack(
|
||||
alignment: .leading
|
||||
alignment: .leading,
|
||||
spacing: 10
|
||||
) {
|
||||
Text("Sent:")
|
||||
.bold()
|
||||
Text(messageViewModel.dateForUI.fromattedForMessageInfo)
|
||||
}
|
||||
|
||||
VStack(
|
||||
alignment: .leading
|
||||
) {
|
||||
Text("Received:")
|
||||
.bold()
|
||||
Text(messageViewModel.receivedDateForUI.fromattedForMessageInfo)
|
||||
}
|
||||
|
||||
VStack(
|
||||
alignment: .leading
|
||||
) {
|
||||
Text("From:")
|
||||
.bold()
|
||||
HStack(
|
||||
spacing: 5
|
||||
VStack(
|
||||
alignment: .leading,
|
||||
spacing: 4
|
||||
) {
|
||||
ProfilePictureView(size: .message)
|
||||
VStack(
|
||||
alignment: .leading
|
||||
Text("Sent:")
|
||||
.bold()
|
||||
.foregroundColor(.white)
|
||||
Text(messageViewModel.dateForUI.fromattedForMessageInfo)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
|
||||
VStack(
|
||||
alignment: .leading,
|
||||
spacing: 4
|
||||
) {
|
||||
Text("Received:")
|
||||
.bold()
|
||||
.foregroundColor(.white)
|
||||
Text(messageViewModel.receivedDateForUI.fromattedForMessageInfo)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
|
||||
VStack(
|
||||
alignment: .leading,
|
||||
spacing: 4
|
||||
) {
|
||||
Text("From:")
|
||||
.bold()
|
||||
.foregroundColor(.white)
|
||||
HStack(
|
||||
spacing: 5
|
||||
) {
|
||||
Text(messageViewModel.authorName)
|
||||
.bold()
|
||||
Text(messageViewModel.authorId)
|
||||
VStack(
|
||||
alignment: .leading,
|
||||
spacing: 4
|
||||
) {
|
||||
Text(messageViewModel.senderName ?? "Tester")
|
||||
.bold()
|
||||
.foregroundColor(.white)
|
||||
Text(messageViewModel.authorId)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(
|
||||
maxWidth: .infinity,
|
||||
maxHeight: .infinity,
|
||||
alignment: .topLeading
|
||||
)
|
||||
.padding(
|
||||
EdgeInsets(
|
||||
top: 16,
|
||||
leading: 16,
|
||||
bottom: 16,
|
||||
trailing: 16
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
ZStack {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
VStack {
|
||||
ForEach(
|
||||
0...(actions.count - 1),
|
||||
id: \.self
|
||||
) { index in
|
||||
HStack {
|
||||
Image(uiImage: actions[index].icon!)
|
||||
Text(actions[index].title)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.padding(
|
||||
EdgeInsets(
|
||||
top: 10,
|
||||
leading: 30,
|
||||
bottom: 10,
|
||||
trailing: 30
|
||||
)
|
||||
)
|
||||
|
||||
// Actions
|
||||
// ZStack {
|
||||
// RoundedRectangle(cornerRadius: 8)
|
||||
// VStack {
|
||||
// ForEach(
|
||||
// 0...(actions.count - 1),
|
||||
// id: \.self
|
||||
// ) { index in
|
||||
// HStack {
|
||||
// Image(uiImage: actions[index].icon!)
|
||||
// Text(actions[index].title)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +128,28 @@ struct MessageInfoView_Previews: PreviewProvider {
|
|||
static var previews: some View {
|
||||
MessageInfoView(
|
||||
actions: [],
|
||||
messageViewModel: nil)
|
||||
messageViewModel: MessageViewModel(
|
||||
threadId: "d4f1g54sdf5g1d5f4g65ds4564df65f4g65d54gdfsg",
|
||||
threadVariant: .contact,
|
||||
threadHasDisappearingMessagesEnabled: false,
|
||||
threadOpenGroupServer: nil,
|
||||
threadOpenGroupPublicKey: nil,
|
||||
threadContactNameInternal: "Test",
|
||||
timestampMs: SnodeAPI.currentOffsetTimestampMs(),
|
||||
receivedAtTimestampMs: SnodeAPI.currentOffsetTimestampMs(),
|
||||
authorId: "d4f1g54sdf5g1d5f4g65ds4564df65f4g65d54gdfsg",
|
||||
authorNameInternal: "Test",
|
||||
body: "Test Message",
|
||||
expiresStartedAtMs: nil,
|
||||
expiresInSeconds: nil,
|
||||
isSenderOpenGroupModerator: false,
|
||||
currentUserProfile: Profile.fetchOrCreateCurrentUser(),
|
||||
quote: nil,
|
||||
quoteAttachment: nil,
|
||||
linkPreview: nil,
|
||||
linkPreviewAttachment: nil,
|
||||
attachments: nil
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,22 +2,20 @@
|
|||
|
||||
import SwiftUI
|
||||
|
||||
struct ProfilePictureView_SwiftUI: UIViewRepresentable {
|
||||
// typealias UIViewType = ProfilePictureView
|
||||
|
||||
@Binding var info: ProfilePictureView.Info
|
||||
@Binding var additionalInfo: ProfilePictureView.Info?
|
||||
|
||||
public struct ProfilePictureSwiftUI: UIViewRepresentable {
|
||||
public typealias UIViewType = ProfilePictureView
|
||||
|
||||
var size: ProfilePictureView.Size
|
||||
|
||||
func makeUIView(context: Context) -> ProfilePictureView {
|
||||
public init(size: ProfilePictureView.Size) {
|
||||
self.size = size
|
||||
}
|
||||
|
||||
public func makeUIView(context: Context) -> ProfilePictureView {
|
||||
ProfilePictureView(size: size)
|
||||
}
|
||||
|
||||
func updateUIView(_ uiView: ProfilePictureView, context: Context) {
|
||||
uiView.update(
|
||||
info,
|
||||
additionalInfo: additionalInfo
|
||||
)
|
||||
public func updateUIView(_ uiView: ProfilePictureView, context: Context) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue