зеркало из https://github.com/nextcloud/talk-ios.git
Create QuotedMessageView.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
87fa560aa3
Коммит
54fe4a479a
|
@ -45,6 +45,7 @@
|
|||
2C5E957D227097E0009CA9BE /* NCUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C5E957B227097E0009CA9BE /* NCUtils.m */; };
|
||||
2C604BD9211988A700D34DCD /* SystemMessageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C604BD8211988A700D34DCD /* SystemMessageTableViewCell.m */; };
|
||||
2C6E74462386D33200AE396C /* ReplyMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C6E74452386D33200AE396C /* ReplyMessageView.m */; };
|
||||
2C6E7449238C1A0800AE396C /* QuotedMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C6E7448238C1A0800AE396C /* QuotedMessageView.m */; };
|
||||
2C7381562106136000CDB8DB /* NCChatTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C7381552106136000CDB8DB /* NCChatTitleView.m */; };
|
||||
2C738158210613A200CDB8DB /* NCChatTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2C738157210613A200CDB8DB /* NCChatTitleView.xib */; };
|
||||
2C78EF951F7E70EB008AFA74 /* NCPeerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C78EF941F7E70EB008AFA74 /* NCPeerConnection.m */; };
|
||||
|
@ -241,6 +242,8 @@
|
|||
2C6085C11FB1063700B36A6E /* VideoCalls.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = VideoCalls.entitlements; sourceTree = "<group>"; };
|
||||
2C6E74442386D33200AE396C /* ReplyMessageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReplyMessageView.h; sourceTree = "<group>"; };
|
||||
2C6E74452386D33200AE396C /* ReplyMessageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReplyMessageView.m; sourceTree = "<group>"; };
|
||||
2C6E7447238C1A0800AE396C /* QuotedMessageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QuotedMessageView.h; sourceTree = "<group>"; };
|
||||
2C6E7448238C1A0800AE396C /* QuotedMessageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QuotedMessageView.m; sourceTree = "<group>"; };
|
||||
2C7381542106136000CDB8DB /* NCChatTitleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCChatTitleView.h; sourceTree = "<group>"; };
|
||||
2C7381552106136000CDB8DB /* NCChatTitleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCChatTitleView.m; sourceTree = "<group>"; };
|
||||
2C738157210613A200CDB8DB /* NCChatTitleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCChatTitleView.xib; sourceTree = "<group>"; };
|
||||
|
@ -1118,6 +1121,8 @@
|
|||
2C43BA7521309A1000B3068A /* NCMessageParameter.m */,
|
||||
2CA15549208F2E5700CE8EF0 /* NCMessageTextView.h */,
|
||||
2CA1554A208F2E5700CE8EF0 /* NCMessageTextView.m */,
|
||||
2C6E7447238C1A0800AE396C /* QuotedMessageView.h */,
|
||||
2C6E7448238C1A0800AE396C /* QuotedMessageView.m */,
|
||||
2C6E74442386D33200AE396C /* ReplyMessageView.h */,
|
||||
2C6E74452386D33200AE396C /* ReplyMessageView.m */,
|
||||
2C604BD7211988A700D34DCD /* SystemMessageTableViewCell.h */,
|
||||
|
@ -1409,6 +1414,7 @@
|
|||
2CB304212264775E0053078A /* UIScrollView+SLKAdditions.m in Sources */,
|
||||
2C961E1C2216BF4B00F5C23F /* OCXMLListParser.m in Sources */,
|
||||
2CA1CCD61F1E664C002FE6A2 /* ContactsTableViewCell.m in Sources */,
|
||||
2C6E7449238C1A0800AE396C /* QuotedMessageView.m in Sources */,
|
||||
2C2026A42369F47400DFC89B /* AccountTableViewCell.m in Sources */,
|
||||
2C7A12422017872600864818 /* AddParticipantsTableViewController.m in Sources */,
|
||||
2C063318205ACB140043481A /* VideoResolutionsViewController.m in Sources */,
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// QuotedMessageView.h
|
||||
// VideoCalls
|
||||
//
|
||||
// Created by Ivan Sein on 25.11.19.
|
||||
// Copyright © 2019 struktur AG. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QuotedMessageView : UIView
|
||||
|
||||
@property (nonatomic, strong) UILabel *actorLabel;
|
||||
@property (nonatomic, strong) UILabel *messageLabel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,91 @@
|
|||
//
|
||||
// QuotedMessageView.m
|
||||
// VideoCalls
|
||||
//
|
||||
// Created by Ivan Sein on 25.11.19.
|
||||
// Copyright © 2019 struktur AG. All rights reserved.
|
||||
//
|
||||
|
||||
#import "QuotedMessageView.h"
|
||||
|
||||
@interface QuotedMessageView ()
|
||||
@property (nonatomic, strong) UIView *quoteView;
|
||||
@end
|
||||
|
||||
@implementation QuotedMessageView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super initWithFrame:CGRectMake(0, 0, 50, 50)];
|
||||
if (self) {
|
||||
[self configureSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)configureSubviews
|
||||
{
|
||||
self.backgroundColor = [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1.0]; //Default toolbar color
|
||||
|
||||
[self addSubview:self.quoteView];
|
||||
[self addSubview:self.actorLabel];
|
||||
[self addSubview:self.messageLabel];
|
||||
|
||||
NSDictionary *views = @{@"quoteView": self.quoteView,
|
||||
@"actorLabel": self.actorLabel,
|
||||
@"messageLabel": self.messageLabel
|
||||
};
|
||||
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[quoteView(4)]-[actorLabel]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[quoteView(4)]-[messageLabel]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[quoteView(50)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-5-[actorLabel(18)]-4-[messageLabel(18)]-5-|" options:0 metrics:nil views:views]];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Getters
|
||||
|
||||
- (UIView *)quoteView
|
||||
{
|
||||
if (!_quoteView) {
|
||||
_quoteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 4, 50)];
|
||||
_quoteView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
_quoteView.backgroundColor = [UIColor colorWithRed:0.00 green:0.51 blue:0.79 alpha:1]; //#0082C9
|
||||
}
|
||||
return _quoteView;
|
||||
}
|
||||
|
||||
- (UILabel *)actorLabel
|
||||
{
|
||||
if (!_actorLabel) {
|
||||
_actorLabel = [UILabel new];
|
||||
_actorLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
_actorLabel.backgroundColor = [UIColor clearColor];
|
||||
_actorLabel.userInteractionEnabled = NO;
|
||||
_actorLabel.numberOfLines = 1;
|
||||
_actorLabel.contentMode = UIViewContentModeLeft;
|
||||
|
||||
_actorLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
_actorLabel.textColor = [UIColor lightGrayColor];
|
||||
}
|
||||
return _actorLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)messageLabel
|
||||
{
|
||||
if (!_messageLabel) {
|
||||
_messageLabel = [UILabel new];
|
||||
_messageLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
_messageLabel.backgroundColor = [UIColor clearColor];
|
||||
_messageLabel.userInteractionEnabled = NO;
|
||||
_messageLabel.numberOfLines = 1;
|
||||
_messageLabel.contentMode = UIViewContentModeLeft;
|
||||
|
||||
_messageLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
_messageLabel.textColor = [UIColor darkGrayColor];
|
||||
}
|
||||
return _messageLabel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -12,10 +12,12 @@
|
|||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class NCChatMessage;
|
||||
@class QuotedMessageView;
|
||||
|
||||
@interface ReplyMessageView : UIView <SLKTypingIndicatorProtocol>
|
||||
|
||||
@property (nonatomic, strong) NCChatMessage *message;
|
||||
@property (nonatomic, strong) QuotedMessageView *quotedMessageView;
|
||||
|
||||
- (void)presentReplyViewWithMessage:(NCChatMessage *)message;
|
||||
- (void)dismiss;
|
||||
|
|
|
@ -9,11 +9,10 @@
|
|||
#import "ReplyMessageView.h"
|
||||
#import "SLKUIConstants.h"
|
||||
#import "NCChatMessage.h"
|
||||
#import "QuotedMessageView.h"
|
||||
|
||||
@interface ReplyMessageView ()
|
||||
@property (nonatomic, strong) UIView *quoteView;
|
||||
@property (nonatomic, strong) UILabel *actorLabel;
|
||||
@property (nonatomic, strong) UILabel *messageLabel;
|
||||
@property (nonatomic, strong) UIView *quoteContainerView;
|
||||
@property (nonatomic, strong) UIButton *cancelButton;
|
||||
@property (nonatomic, strong) CALayer *topBorder;
|
||||
@end
|
||||
|
@ -33,25 +32,22 @@
|
|||
- (void)configureSubviews
|
||||
{
|
||||
self.backgroundColor = [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1.0]; //Default toolbar color
|
||||
self.quoteView.backgroundColor = [UIColor colorWithRed:0.00 green:0.51 blue:0.79 alpha:1]; //#0082C9
|
||||
|
||||
[self addSubview:self.quoteView];
|
||||
[self addSubview:self.actorLabel];
|
||||
[self addSubview:self.messageLabel];
|
||||
[self addSubview:self.quoteContainerView];
|
||||
[self addSubview:self.cancelButton];
|
||||
[self.layer addSublayer:self.topBorder];
|
||||
|
||||
NSDictionary *views = @{@"quoteView": self.quoteView,
|
||||
@"actorLabel": self.actorLabel,
|
||||
@"messageLabel": self.messageLabel,
|
||||
[_quoteContainerView addSubview:self.quotedMessageView];
|
||||
|
||||
NSDictionary *views = @{@"quoteContainerView": self.quoteContainerView,
|
||||
@"quotedMessageView": self.quotedMessageView,
|
||||
@"cancelButton": self.cancelButton
|
||||
};
|
||||
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[quoteView(4)]-[actorLabel]-(>=0)-[cancelButton(44)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[quoteView(4)]-[messageLabel]-(>=0)-[cancelButton(44)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[quoteView(50)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[quoteContainerView]-[cancelButton(44)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[quotedMessageView(quoteContainerView)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[quoteContainerView(50)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[cancelButton(50)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-5-[actorLabel(18)]-4-[messageLabel(18)]-5-|" options:0 metrics:nil views:views]];
|
||||
}
|
||||
|
||||
#pragma mark - UIView
|
||||
|
@ -76,44 +72,23 @@
|
|||
|
||||
#pragma mark - Getters
|
||||
|
||||
- (UIView *)quoteView
|
||||
- (UIView *)quoteContainerView
|
||||
{
|
||||
if (!_quoteView) {
|
||||
_quoteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 4, 50)];
|
||||
if (!_quoteContainerView) {
|
||||
_quoteContainerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
|
||||
_quoteContainerView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
}
|
||||
return _quoteView;
|
||||
return _quoteContainerView;
|
||||
}
|
||||
|
||||
- (UILabel *)actorLabel
|
||||
{
|
||||
if (!_actorLabel) {
|
||||
_actorLabel = [UILabel new];
|
||||
_actorLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
_actorLabel.backgroundColor = [UIColor clearColor];
|
||||
_actorLabel.userInteractionEnabled = NO;
|
||||
_actorLabel.numberOfLines = 1;
|
||||
_actorLabel.contentMode = UIViewContentModeLeft;
|
||||
|
||||
_actorLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
_actorLabel.textColor = [UIColor lightGrayColor];
|
||||
}
|
||||
return _actorLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)messageLabel
|
||||
- (QuotedMessageView *)quotedMessageView
|
||||
{
|
||||
if (!_messageLabel) {
|
||||
_messageLabel = [UILabel new];
|
||||
_messageLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
_messageLabel.backgroundColor = [UIColor clearColor];
|
||||
_messageLabel.userInteractionEnabled = NO;
|
||||
_messageLabel.numberOfLines = 1;
|
||||
_messageLabel.contentMode = UIViewContentModeLeft;
|
||||
|
||||
_messageLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
_messageLabel.textColor = [UIColor darkGrayColor];
|
||||
if (!_quotedMessageView) {
|
||||
_quotedMessageView = [[QuotedMessageView alloc] init];
|
||||
_quotedMessageView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
}
|
||||
return _messageLabel;
|
||||
return _quotedMessageView;
|
||||
}
|
||||
|
||||
- (UIButton *)cancelButton
|
||||
|
@ -148,9 +123,8 @@
|
|||
}
|
||||
|
||||
self.message = message;
|
||||
|
||||
self.actorLabel.text = message.actorDisplayName;
|
||||
self.messageLabel.text = message.parsedMessage.string;
|
||||
self.quotedMessageView.actorLabel.text = message.actorDisplayName;
|
||||
self.quotedMessageView.messageLabel.text = message.parsedMessage.string;
|
||||
|
||||
self.visible = YES;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче