WIP: message detail screen with swiftui

pull/874/head
Ryan Zhao 2 years ago
parent ddf4c5b5ad
commit 9bbd8f31cc

@ -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) # 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" 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" "${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 = ( inputFileListPaths = (
); );
inputPaths = ( inputPaths = (
$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH, "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH",
$TARGET_BUILD_DIR/$INFOPLIST_PATH, "$TARGET_BUILD_DIR/$INFOPLIST_PATH",
); );
name = "Add Commit Hash To Build Info Plist"; name = "Add Commit Hash To Build Info Plist";
outputFileListPaths = ( outputFileListPaths = (

@ -59,7 +59,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO" shouldUseLaunchSchemeArgsEnv = "NO"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES"> onlyGenerateCoverageForSpecifiedTargets = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference

@ -2,79 +2,123 @@
import SwiftUI import SwiftUI
import SessionUIKit import SessionUIKit
import SessionSnodeKit
struct MessageInfoView: View { struct MessageInfoView: View {
var actions: [ContextMenuVC.Action] var actions: [ContextMenuVC.Action]
var messageViewModel: MessageViewModel var messageViewModel: MessageViewModel
var body: some View { var body: some View {
VStack( ZStack {
alignment: .center, if #available(iOS 14.0, *) {
spacing: 10 Color.black.ignoresSafeArea()
) { } else {
// Message bubble snapshot Color.black
Image("snapshot") }
// TODO: Attachment carousel view
// Message Info VStack(
ZStack { alignment: .center,
RoundedRectangle(cornerRadius: 8) spacing: 10
VStack( ) {
alignment: .leading, // Message bubble snapshot
spacing: 10 Image("snapshot")
) {
VStack( // TODO: Attachment carousel view
alignment: .leading
) { // Message Info
Text("Sent:") ZStack {
.bold() RoundedRectangle(cornerRadius: 17)
Text(messageViewModel.dateForUI.fromattedForMessageInfo) .fill(Color(red: 27.0/255, green: 27.0/255, blue: 27.0/255))
}
VStack(
alignment: .leading
) {
Text("Received:")
.bold()
Text(messageViewModel.receivedDateForUI.fromattedForMessageInfo)
}
VStack( VStack(
alignment: .leading alignment: .leading,
spacing: 10
) { ) {
Text("From:") VStack(
.bold() alignment: .leading,
HStack( spacing: 4
spacing: 5 ) {
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
) { ) {
ProfilePictureView(size: .message) Text("From:")
VStack( .bold()
alignment: .leading .foregroundColor(.white)
HStack(
spacing: 5
) { ) {
Text(messageViewModel.authorName) VStack(
.bold() alignment: .leading,
Text(messageViewModel.authorId) 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
)
)
} }
} .frame(maxHeight: .infinity)
.fixedSize(horizontal: false, vertical: true)
// Actions .padding(
ZStack { EdgeInsets(
RoundedRectangle(cornerRadius: 8) top: 10,
VStack { leading: 30,
ForEach( bottom: 10,
0...(actions.count - 1), trailing: 30
id: \.self )
) { index in )
HStack {
Image(uiImage: actions[index].icon!) // Actions
Text(actions[index].title) // 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 { static var previews: some View {
MessageInfoView( MessageInfoView(
actions: [], 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 import SwiftUI
struct ProfilePictureView_SwiftUI: UIViewRepresentable { public struct ProfilePictureSwiftUI: UIViewRepresentable {
// typealias UIViewType = ProfilePictureView public typealias UIViewType = ProfilePictureView
@Binding var info: ProfilePictureView.Info
@Binding var additionalInfo: ProfilePictureView.Info?
var size: ProfilePictureView.Size 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) ProfilePictureView(size: size)
} }
func updateUIView(_ uiView: ProfilePictureView, context: Context) { public func updateUIView(_ uiView: ProfilePictureView, context: Context) {
uiView.update(
info,
additionalInfo: additionalInfo
)
} }
} }

Loading…
Cancel
Save