зеркало из https://github.com/nextcloud/talk-ios.git
Highlight quotes of own messages.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
3a106a1688
Коммит
1cab27c4ee
|
@ -255,9 +255,11 @@
|
|||
}
|
||||
|
||||
// This check is just a workaround to fix the issue with the deleted parents returned by the API.
|
||||
if (message.parent.message) {
|
||||
self.quotedMessageView.actorLabel.text = ([message.parent.actorDisplayName isEqualToString:@""]) ? NSLocalizedString(@"Guest", nil) : message.parent.actorDisplayName;
|
||||
self.quotedMessageView.messageLabel.text = message.parent.parsedMessage.string;
|
||||
NCChatMessage *parent = message.parent;
|
||||
if (parent.message) {
|
||||
self.quotedMessageView.actorLabel.text = ([parent.actorDisplayName isEqualToString:@""]) ? NSLocalizedString(@"Guest", nil) : parent.actorDisplayName;
|
||||
self.quotedMessageView.messageLabel.text = parent.parsedMessage.string;
|
||||
self.quotedMessageView.highlighted = [parent isMessageFromUser:activeAccount.userId];
|
||||
}
|
||||
|
||||
if (message.isDeleting) {
|
||||
|
@ -266,7 +268,7 @@
|
|||
[self setDeliveryState:ChatMessageDeliveryStateFailed];
|
||||
} else if (message.isTemporary){
|
||||
[self setDeliveryState:ChatMessageDeliveryStateSending];
|
||||
} else if ([message.actorId isEqualToString:activeAccount.userId] && [message.actorType isEqualToString:@"users"] && shouldShowReadStatus) {
|
||||
} else if ([message isMessageFromUser:activeAccount.userId] && shouldShowReadStatus) {
|
||||
if (lastCommonRead >= message.messageId) {
|
||||
[self setDeliveryState:ChatMessageDeliveryStateRead];
|
||||
} else {
|
||||
|
|
|
@ -63,6 +63,7 @@ extern NSString * const kMessageTypeCommand;
|
|||
|
||||
- (BOOL)isSystemMessage;
|
||||
- (BOOL)isEmojiMessage;
|
||||
- (BOOL)isMessageFromUser:(NSString *)userId;
|
||||
- (BOOL)isDeletableForAccount:(TalkAccount *)account andParticipantType:(NCParticipantType)participantType;
|
||||
- (NCMessageFileParameter *)file;
|
||||
- (NSDictionary *)messageParameters;
|
||||
|
|
|
@ -957,8 +957,9 @@ NSString * const NCChatViewControllerReplyPrivatelyNotification = @"NCChatViewCo
|
|||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
BOOL isAtBottom = [self shouldScrollOnNewMessages];
|
||||
|
||||
TalkAccount *activeAccount = [[NCDatabaseManager sharedInstance] activeAccount];
|
||||
self.replyMessageView = (ReplyMessageView *)self.typingIndicatorProxyView;
|
||||
[self.replyMessageView presentReplyViewWithMessage:message];
|
||||
[self.replyMessageView presentReplyViewWithMessage:message withUserId:activeAccount.userId];
|
||||
[self presentKeyboard:YES];
|
||||
|
||||
// Make sure we're really at the bottom after showing the replyMessageView
|
||||
|
|
|
@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@property (nonatomic, strong) UILabel *actorLabel;
|
||||
@property (nonatomic, strong) UILabel *messageLabel;
|
||||
@property (nonatomic, assign) BOOL highlighted;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -70,7 +70,10 @@
|
|||
if (!_quoteView) {
|
||||
_quoteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 4, 50)];
|
||||
_quoteView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
_quoteView.backgroundColor = [NCAppBranding themeColor];
|
||||
_quoteView.backgroundColor = [UIColor lightGrayColor];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
_quoteView.backgroundColor = [UIColor systemFillColor];
|
||||
}
|
||||
}
|
||||
return _quoteView;
|
||||
}
|
||||
|
@ -115,5 +118,21 @@
|
|||
return _messageLabel;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
- (void)setHighlighted:(BOOL)highlighted
|
||||
{
|
||||
_highlighted = highlighted;
|
||||
|
||||
if (_highlighted) {
|
||||
_quoteView.backgroundColor = [NCAppBranding themeColor];
|
||||
} else {
|
||||
_quoteView.backgroundColor = [UIColor lightGrayColor];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
_quoteView.backgroundColor = [UIColor systemFillColor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic, strong) NCChatMessage *message;
|
||||
@property (nonatomic, strong) QuotedMessageView *quotedMessageView;
|
||||
|
||||
- (void)presentReplyViewWithMessage:(NCChatMessage *)message;
|
||||
- (void)presentReplyViewWithMessage:(NCChatMessage *)message withUserId:(NSString *)userId;
|
||||
- (void)dismiss;
|
||||
|
||||
@end
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
|
||||
#pragma mark - ReplyMessageView
|
||||
|
||||
- (void)presentReplyViewWithMessage:(NCChatMessage *)message
|
||||
- (void)presentReplyViewWithMessage:(NCChatMessage *)message withUserId:(NSString *)userId
|
||||
{
|
||||
if (!message) {
|
||||
return;
|
||||
|
@ -163,6 +163,7 @@
|
|||
self.message = message;
|
||||
self.quotedMessageView.actorLabel.text = ([message.actorDisplayName isEqualToString:@""]) ? NSLocalizedString(@"Guest", nil) : message.actorDisplayName;
|
||||
self.quotedMessageView.messageLabel.text = message.parsedMessage.string;
|
||||
self.quotedMessageView.highlighted = [message isMessageFromUser:userId];
|
||||
|
||||
self.visible = YES;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче