Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOB-1841 Added ability to reply in group chat #397

Merged
merged 21 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions unstoppable-ios-app/domains-manager-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,10 @@
C6F6AF6328A35FB900A7B571 /* CNavigationBarScrollingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F6AF6228A35FB900A7B571 /* CNavigationBarScrollingController.swift */; };
C6F6AF6928A4D20A00A7B571 /* TitleVisibilityAfterLimitNavBarScrollingBehaviour.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F6AF6828A4D20A00A7B571 /* TitleVisibilityAfterLimitNavBarScrollingBehaviour.swift */; };
C6F6AF6E28A4D4BA00A7B571 /* BlurVisibilityAfterLimitNavBarScrollingBehaviour.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F6AF6D28A4D4BA00A7B571 /* BlurVisibilityAfterLimitNavBarScrollingBehaviour.swift */; };
C6F7D9CF2B8D6EFC00764708 /* MessageActionReplyButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F7D9CE2B8D6EFC00764708 /* MessageActionReplyButtonView.swift */; };
C6F7D9D02B8D6EFC00764708 /* MessageActionReplyButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F7D9CE2B8D6EFC00764708 /* MessageActionReplyButtonView.swift */; };
C6F7D9D32B8D766500764708 /* ChatReplyInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F7D9D22B8D766500764708 /* ChatReplyInfoView.swift */; };
C6F7D9D42B8D766500764708 /* ChatReplyInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F7D9D22B8D766500764708 /* ChatReplyInfoView.swift */; };
C6F946DB2A6788E0008043AC /* MockEntitiesFabric.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F946DA2A6788E0008043AC /* MockEntitiesFabric.swift */; };
C6F9FBB82A25C30C00102F81 /* MessagingWebSocketsServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F9FBB72A25C30C00102F81 /* MessagingWebSocketsServiceProtocol.swift */; };
C6F9FBBE2A25C32700102F81 /* MessagingWebSocketEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F9FBBD2A25C32700102F81 /* MessagingWebSocketEvent.swift */; };
Expand All @@ -2254,6 +2258,8 @@
C6FAED842B8C5C1200CC1844 /* ChatMentionSuggestionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FAED822B8C5C1200CC1844 /* ChatMentionSuggestionsView.swift */; };
C6FAED862B8C684700CC1844 /* MessageMentionString.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FAED852B8C684700CC1844 /* MessageMentionString.swift */; };
C6FAED872B8C684700CC1844 /* MessageMentionString.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FAED852B8C684700CC1844 /* MessageMentionString.swift */; };
C6FAED892B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FAED882B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift */; };
C6FAED8A2B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FAED882B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift */; };
C6FAFDE628119E0400734E0F /* TextButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FAFDE528119E0400734E0F /* TextButton.swift */; };
C6FE49D6285CBAA50058F9D1 /* CoreAppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FE49D5285CBAA50058F9D1 /* CoreAppCoordinator.swift */; };
C6FE49DB285CBAB10058F9D1 /* CoreAppCoordinatorProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FE49DA285CBAB10058F9D1 /* CoreAppCoordinatorProtocol.swift */; };
Expand Down Expand Up @@ -3585,6 +3591,8 @@
C6F6AF6228A35FB900A7B571 /* CNavigationBarScrollingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNavigationBarScrollingController.swift; sourceTree = "<group>"; };
C6F6AF6828A4D20A00A7B571 /* TitleVisibilityAfterLimitNavBarScrollingBehaviour.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleVisibilityAfterLimitNavBarScrollingBehaviour.swift; sourceTree = "<group>"; };
C6F6AF6D28A4D4BA00A7B571 /* BlurVisibilityAfterLimitNavBarScrollingBehaviour.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurVisibilityAfterLimitNavBarScrollingBehaviour.swift; sourceTree = "<group>"; };
C6F7D9CE2B8D6EFC00764708 /* MessageActionReplyButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageActionReplyButtonView.swift; sourceTree = "<group>"; };
C6F7D9D22B8D766500764708 /* ChatReplyInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatReplyInfoView.swift; sourceTree = "<group>"; };
C6F946DA2A6788E0008043AC /* MockEntitiesFabric.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockEntitiesFabric.swift; sourceTree = "<group>"; };
C6F9FBB72A25C30C00102F81 /* MessagingWebSocketsServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagingWebSocketsServiceProtocol.swift; sourceTree = "<group>"; };
C6F9FBBD2A25C32700102F81 /* MessagingWebSocketEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagingWebSocketEvent.swift; sourceTree = "<group>"; };
Expand All @@ -3599,6 +3607,7 @@
C6FAED7F2B8C5B4C00CC1844 /* ChatMentionSuggestionRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMentionSuggestionRowView.swift; sourceTree = "<group>"; };
C6FAED822B8C5C1200CC1844 /* ChatMentionSuggestionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMentionSuggestionsView.swift; sourceTree = "<group>"; };
C6FAED852B8C684700CC1844 /* MessageMentionString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageMentionString.swift; sourceTree = "<group>"; };
C6FAED882B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagingChatMessageReplyTypeDisplayInfo.swift; sourceTree = "<group>"; };
C6FAFDE528119E0400734E0F /* TextButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextButton.swift; sourceTree = "<group>"; };
C6FE49D5285CBAA50058F9D1 /* CoreAppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreAppCoordinator.swift; sourceTree = "<group>"; };
C6FE49DA285CBAB10058F9D1 /* CoreAppCoordinatorProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreAppCoordinatorProtocol.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5439,6 +5448,7 @@
C603D7992A56B11800CEC696 /* MessagingChatMessageUnknownTypeDisplayInfo.swift */,
C6157AFD2A7108B400081574 /* MessagingChatMessageRemoteContentTypeDisplayInfo.swift */,
C623967B2A288A8A00363F60 /* MessagingChatMessageDisplayType.swift */,
C6FAED882B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift */,
C631DFA62B7B530800040221 /* MessagingChatMessageReactionTypeDisplayInfo.swift */,
C62396802A288A9400363F60 /* MessagingChatMessageDisplayInfo.swift */,
C62396852A288A9E00363F60 /* MessagingChatMessage.swift */,
Expand Down Expand Up @@ -6207,6 +6217,7 @@
isa = PBXGroup;
children = (
C684A0232B85990600B751A5 /* MessageActionBlockUserButtonView.swift */,
C6F7D9CE2B8D6EFC00764708 /* MessageActionReplyButtonView.swift */,
);
path = "Message Action Buttons";
sourceTree = "<group>";
Expand Down Expand Up @@ -6301,6 +6312,7 @@
children = (
C630E4A82B7F4959008F3269 /* ChatViewModel.swift */,
C630E4A52B7F4918008F3269 /* ChatView.swift */,
C6F7D9D22B8D766500764708 /* ChatReplyInfoView.swift */,
C6FAED822B8C5C1200CC1844 /* ChatMentionSuggestionsView.swift */,
C6FAED7F2B8C5B4C00CC1844 /* ChatMentionSuggestionRowView.swift */,
C6D8FF2E2B8307E70094A21E /* ChatNavTitleView.swift */,
Expand Down Expand Up @@ -7314,10 +7326,7 @@
children = (
C6D8FF1A2B82E7A80094A21E /* MessageRowView.swift */,
C684A0272B85A8E500B751A5 /* MessageReactionSelectionView.swift */,
C6D8FF262B82FAFB0094A21E /* UnknownMessageRowView.swift */,
C6D8FF202B82F3DC0094A21E /* ImageMessageRowView.swift */,
C6D8FF232B82F8FE0094A21E /* RemoteContentMessageRowView.swift */,
C6D8FF1D2B82EB740094A21E /* TextMessageRowView.swift */,
C6F7D9D12B8D6F7E00764708 /* Rows */,
C684A0262B859AAC00B751A5 /* Message Action Buttons */,
);
path = Messages;
Expand Down Expand Up @@ -7571,6 +7580,17 @@
path = CustomScrollingBehaviourProtocols;
sourceTree = "<group>";
};
C6F7D9D12B8D6F7E00764708 /* Rows */ = {
isa = PBXGroup;
children = (
C6D8FF202B82F3DC0094A21E /* ImageMessageRowView.swift */,
C6D8FF232B82F8FE0094A21E /* RemoteContentMessageRowView.swift */,
C6D8FF1D2B82EB740094A21E /* TextMessageRowView.swift */,
C6D8FF262B82FAFB0094A21E /* UnknownMessageRowView.swift */,
);
path = Rows;
sourceTree = "<group>";
};
C6F9FBB62A25C2F900102F81 /* SubServices */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -8437,6 +8457,7 @@
C64939F82B6373EC00457363 /* DeviceShakeViewModifier.swift in Sources */,
C6BA746E2AD4FE1800628DC6 /* PullUpViewService+Tools.swift in Sources */,
C6124CF029253BB0005E6537 /* ImportExistingExternalWalletPresenter.swift in Sources */,
C6F7D9CF2B8D6EFC00764708 /* MessageActionReplyButtonView.swift in Sources */,
299713C828F692D700743003 /* ABIError.swift in Sources */,
C6C8F8552B217EAE00A9834D /* NetworkReachabilityServiceProtocol.swift in Sources */,
C61B3E90283E708500500B6D /* EnterEmailVerificationCodeViewController.swift in Sources */,
Expand Down Expand Up @@ -8643,6 +8664,7 @@
C6D6E5452819388D008C66BB /* BaseCollectionViewPresenterProtocol.swift in Sources */,
C685D81A2AA978DE00212879 /* UDBTSearchView.swift in Sources */,
C61002EA2940936F00462983 /* UIGestureRecognizer.swift in Sources */,
C6FAED892B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift in Sources */,
29EDB61E28FED24D00A0BD08 /* NetworkService+ProfilesApi.swift in Sources */,
C689C1772ADE693900AA0186 /* LaunchDarklyService.swift in Sources */,
C66804C9280D9EC8007E6390 /* PasscodeInputView.swift in Sources */,
Expand Down Expand Up @@ -8770,6 +8792,7 @@
C63095EB2B0DA66400205054 /* UDWalletSigner.swift in Sources */,
C6526DCF29D2DDFD00D6F2EB /* LoadingParkedDomainsInAppViewPresenter.swift in Sources */,
C6C75C692848E82000DD8E3F /* Sequence.swift in Sources */,
C6F7D9D32B8D766500764708 /* ChatReplyInfoView.swift in Sources */,
C686BF172A5FE8870036C7C1 /* MessagingFilesService.swift in Sources */,
C6098322282B8BA300546392 /* WalletViewTransactionsAction.swift in Sources */,
C695C2682A57F99700B94DA8 /* PushChatsSecretKeysStorage.swift in Sources */,
Expand Down Expand Up @@ -9353,6 +9376,7 @@
C6D646062B1DC02300D724AC /* UDTitleLabel.swift in Sources */,
C60CB4F12B2020DD007FD3CF /* UIImage+Preview.swift in Sources */,
C6C8F9A72B2191CC00A9834D /* PreviewGIFAnimationsService.swift in Sources */,
C6F7D9D02B8D6EFC00764708 /* MessageActionReplyButtonView.swift in Sources */,
C6C8F92C2B2183C700A9834D /* DomainsCollectionListCell.swift in Sources */,
C618080F2B19AA420032E543 /* UserDataServiceProtocol.swift in Sources */,
C618083A2B19AF800032E543 /* PreviewExternalEventsService.swift in Sources */,
Expand Down Expand Up @@ -9493,6 +9517,7 @@
C6D647422B1EDA2F00D724AC /* Chat.swift in Sources */,
C6C8F8E42B21836400A9834D /* LoadingParkedDomainsOnboardingViewPresenter.swift in Sources */,
C6C8F96D2B21880E00A9834D /* ExternalWalletConnectionService.swift in Sources */,
C6F7D9D42B8D766500764708 /* ChatReplyInfoView.swift in Sources */,
C6C8F8BD2B2182E400A9834D /* SetupReverseResolutionViewController.swift in Sources */,
C6DA0B792B7C9DBA009920B5 /* MessageReactionDescription.swift in Sources */,
C61808372B19AF120032E543 /* UITextField.swift in Sources */,
Expand Down Expand Up @@ -10007,6 +10032,7 @@
C6D645C02B1DBD2500D724AC /* KeyboardService.swift in Sources */,
C6C8F9462B2184E000A9834D /* MockEntitiesFabric.swift in Sources */,
C6D646E12B1ED49300D724AC /* ShareDomainImagePullUpView.swift in Sources */,
C6FAED8A2B8C717100CC1844 /* MessagingChatMessageReplyTypeDisplayInfo.swift in Sources */,
C688C1992B84840700BD233A /* ChatCommonEmptyView.swift in Sources */,
C6C8F8802B21827700A9834D /* LoginViewPresenter.swift in Sources */,
C6C8F8882B21829000A9834D /* SettingsFooterView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ extension MockEntitiesFabric {
image: UIImage?,
isThisUser: Bool,
deliveryState: MessagingChatMessageDisplayInfo.DeliveryState = .delivered) -> MessagingChatMessageDisplayInfo {
let sender = chatSenderFor(isThisUser: isThisUser)
let sender = chatSenderFor(isThisUser: false)

var imageDetails = MessagingChatMessageImageBase64TypeDisplayInfo(base64: "")
imageDetails.image = image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ extension String {
static let more = "MORE"
static let home = "HOME"
static let messages = "MESSAGES"
static let reply = "REPLY"

//Onboarding
static let alreadyMintedDomain = "ALREADY_MINTED_DOMAIN"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ extension Chat {
case sendReaction(content: String, toMessage: MessagingChatMessageDisplayInfo)
case saveImage(UIImage)
case blockUserInGroup(MessagingChatUserDisplayInfo)
case reply(MessagingChatMessageDisplayInfo)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
//
// ChatReplyInfoView.swift
// domains-manager-ios
//
// Created by Oleg Kuplin on 27.02.2024.
//

import SwiftUI

struct ChatReplyInfoView: View {

@EnvironmentObject var viewModel: ChatViewModel

let messageToReply: MessagingChatMessageDisplayInfo

var body: some View {
HStack(spacing: 20) {
replyIndicatorView()
Line(direction: .vertical)
.stroke(style: StrokeStyle(lineWidth: 1))
.frame(width: 1)
.padding(.init(vertical: 4))
clickableMessageDescriptionView()
Spacer()
removeReplyView()
}
.foregroundStyle(Color.foregroundAccent)
.frame(height: 40)
.padding(.init(horizontal: 16))
.background(.regularMaterial)
}
}

// MARK: - Private methods
private extension ChatReplyInfoView {
func getNameOfMessageSender() -> String {
messageToReply.senderType.userDisplayInfo.displayName
}

func getMessageContentDescription() -> String {
messageToReply.type.getContentDescriptionText()
}
}

// MARK: - Private methods
private extension ChatReplyInfoView {
@ViewBuilder
func clickableMessageDescriptionView() -> some View {
Button {
UDVibration.buttonTap.vibrate()
withAnimation {
viewModel.didTapJumpToReplyButton()
}
} label: {
messageDescriptionView()
}
.buttonStyle(.plain)
}

@ViewBuilder
func messageDescriptionView() -> some View {
VStack(alignment: .leading) {
HStack {
Text("Reply to \(getNameOfMessageSender())")
.font(.currentFont(size: 14, weight: .medium))
Spacer()
}
HStack {
Text(getMessageContentDescription())
.foregroundStyle(Color.foregroundDefault)
.font(.currentFont(size: 14))
Spacer()
}
}
.multilineTextAlignment(.leading)
.lineLimit(1)
}

@ViewBuilder
func replyIndicatorView() -> some View {
Image(systemName: "arrowshape.turn.up.left")
.font(.title2)
}

@ViewBuilder
func removeReplyView() -> some View {
Button {
UDVibration.buttonTap.vibrate()
withAnimation {
viewModel.didTapRemoveReplyButton()
}
} label: {
Image(systemName: "xmark")
}
.buttonStyle(.plain)
}
}

#Preview {
ChatReplyInfoView(messageToReply: MockEntitiesFabric.Messaging.createTextMessage(text: "Hello kjsdfh dflj hsdfkjhsdkf hsdkj fh skdjfh sdkjfh", isThisUser: false))
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,14 @@ private extension ChatView {
if !viewModel.suggestingUsers.isEmpty {
mentionSuggestionsView()
}
messageInputView()
.background(.regularMaterial)

VStack(spacing: 0) {
if let messageToReply = viewModel.messageToReply {
ChatReplyInfoView(messageToReply: messageToReply)
}
messageInputView()
.background(.regularMaterial)
}
}
}

Expand Down
Loading