mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 07:28:28 +02:00
Composer Update - Typing and sending a message
This commit is contained in:
@@ -60,14 +60,11 @@
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
||||
_supportCallOption = YES;
|
||||
_sendMode = RoomInputToolbarViewSendModeSend;
|
||||
|
||||
self.rightInputToolbarButton.hidden = YES;
|
||||
|
||||
[self.rightInputToolbarButton setTitleColor:ThemeService.shared.theme.tintColor forState:UIControlStateNormal];
|
||||
[self.rightInputToolbarButton setTitleColor:ThemeService.shared.theme.tintColor forState:UIControlStateHighlighted];
|
||||
|
||||
[self.rightInputToolbarButton setTitle:nil forState:UIControlStateNormal];
|
||||
[self.rightInputToolbarButton setTitle:nil forState:UIControlStateHighlighted];
|
||||
|
||||
self.isEncryptionEnabled = _isEncryptionEnabled;
|
||||
}
|
||||
|
||||
@@ -80,8 +77,6 @@
|
||||
// Remove default toolbar background color
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
self.separatorView.backgroundColor = ThemeService.shared.theme.lineBreakColor;
|
||||
|
||||
// Custom the growingTextView display
|
||||
growingTextView.layer.cornerRadius = 0;
|
||||
growingTextView.layer.borderWidth = 0;
|
||||
@@ -99,35 +94,14 @@
|
||||
}
|
||||
|
||||
self.attachMediaButton.accessibilityLabel = NSLocalizedStringFromTable(@"room_accessibility_upload", @"Vector", nil);
|
||||
self.voiceCallButton.accessibilityLabel = NSLocalizedStringFromTable(@"room_accessibility_call", @"Vector", nil);
|
||||
self.hangupCallButton.accessibilityLabel = NSLocalizedStringFromTable(@"room_accessibility_hangup", @"Vector", nil);
|
||||
|
||||
self.hangupCallButton.tintColor = ThemeService.shared.theme.noticeColor;
|
||||
self.voiceCallButton.tintColor = ThemeService.shared.theme.tintColor;
|
||||
self.attachMediaButton.tintColor = ThemeService.shared.theme.tintColor;
|
||||
UIImage *image = [UIImage imageNamed:@"input_text_background"];
|
||||
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(9, 15, 10, 16)];
|
||||
self.inputTextBackgroundView.image = image;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setSupportCallOption:(BOOL)supportCallOption
|
||||
{
|
||||
if (_supportCallOption != supportCallOption)
|
||||
{
|
||||
_supportCallOption = supportCallOption;
|
||||
|
||||
if (supportCallOption)
|
||||
{
|
||||
self.voiceCallButtonWidthConstraint.constant = 46;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.voiceCallButtonWidthConstraint.constant = 0;
|
||||
}
|
||||
|
||||
[self setNeedsUpdateConstraints];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setIsEncryptionEnabled:(BOOL)isEncryptionEnabled
|
||||
{
|
||||
_isEncryptionEnabled = isEncryptionEnabled;
|
||||
@@ -140,28 +114,6 @@
|
||||
_sendMode = sendMode;
|
||||
|
||||
[self updatePlaceholder];
|
||||
[self updateToolbarButtonLabel];
|
||||
}
|
||||
|
||||
- (void)updateToolbarButtonLabel
|
||||
{
|
||||
NSString *title;
|
||||
|
||||
switch (_sendMode)
|
||||
{
|
||||
case RoomInputToolbarViewSendModeReply:
|
||||
title = NSLocalizedStringFromTable(@"room_action_reply", @"Vector", nil);
|
||||
break;
|
||||
case RoomInputToolbarViewSendModeEdit:
|
||||
title = NSLocalizedStringFromTable(@"save", @"Vector", nil);
|
||||
break;
|
||||
default:
|
||||
title = [NSBundle mxk_localizedStringForKey:@"send"];
|
||||
break;
|
||||
}
|
||||
|
||||
[self.rightInputToolbarButton setTitle:title forState:UIControlStateNormal];
|
||||
[self.rightInputToolbarButton setTitle:title forState:UIControlStateHighlighted];
|
||||
}
|
||||
|
||||
- (void)updatePlaceholder
|
||||
@@ -219,17 +171,6 @@
|
||||
self.placeholder = placeholder;
|
||||
}
|
||||
|
||||
- (void)setActiveCall:(BOOL)activeCall
|
||||
{
|
||||
if (_activeCall != activeCall)
|
||||
{
|
||||
_activeCall = activeCall;
|
||||
|
||||
self.voiceCallButton.hidden = (_activeCall || !self.rightInputToolbarButton.hidden);
|
||||
self.hangupCallButton.hidden = (!_activeCall || !self.rightInputToolbarButton.hidden);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - HPGrowingTextView delegate
|
||||
|
||||
- (void)growingTextViewDidChange:(HPGrowingTextView *)hpGrowingTextView
|
||||
@@ -242,23 +183,23 @@
|
||||
|
||||
[super growingTextViewDidChange:hpGrowingTextView];
|
||||
|
||||
if (self.rightInputToolbarButton.isEnabled && self.rightInputToolbarButton.isHidden)
|
||||
if (self.rightInputToolbarButton.isEnabled && !self.rightInputToolbarButton.alpha)
|
||||
{
|
||||
self.rightInputToolbarButton.hidden = NO;
|
||||
self.attachMediaButton.hidden = YES;
|
||||
self.voiceCallButton.hidden = YES;
|
||||
self.hangupCallButton.hidden = YES;
|
||||
|
||||
self.messageComposerContainerTrailingConstraint.constant = self.frame.size.width - self.rightInputToolbarButton.frame.origin.x + 4;
|
||||
[UIView animateWithDuration:.4 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:8 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
self.rightInputToolbarButton.alpha = 1;
|
||||
self.messageComposerContainerTrailingConstraint.constant = self.frame.size.width - self.rightInputToolbarButton.frame.origin.x + 4;
|
||||
[self layoutIfNeeded];
|
||||
} completion:^(BOOL finished) {
|
||||
}];
|
||||
}
|
||||
else if (!self.rightInputToolbarButton.isEnabled && !self.rightInputToolbarButton.isHidden)
|
||||
else if (!self.rightInputToolbarButton.isEnabled && self.rightInputToolbarButton.alpha)
|
||||
{
|
||||
self.rightInputToolbarButton.hidden = YES;
|
||||
self.attachMediaButton.hidden = NO;
|
||||
self.voiceCallButton.hidden = _activeCall;
|
||||
self.hangupCallButton.hidden = !_activeCall;
|
||||
|
||||
self.messageComposerContainerTrailingConstraint.constant = self.frame.size.width - self.attachMediaButton.frame.origin.x + 4;
|
||||
[UIView animateWithDuration:.4 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:8 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
self.rightInputToolbarButton.alpha = 0;
|
||||
self.messageComposerContainerTrailingConstraint.constant = 8;
|
||||
[self layoutIfNeeded];
|
||||
} completion:^(BOOL finished) {
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,66 +315,6 @@
|
||||
NSLog(@"[RoomInputToolbarView] Attach media is not supported");
|
||||
}
|
||||
}
|
||||
else if (button == self.voiceCallButton)
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:placeCallWithVideo:)])
|
||||
{
|
||||
// Ask the user the kind of the call: voice or video?
|
||||
actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"voice", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->actionSheet = nil;
|
||||
|
||||
[self.delegate roomInputToolbarView:self placeCallWithVideo:NO];
|
||||
}
|
||||
|
||||
}]];
|
||||
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"video", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->actionSheet = nil;
|
||||
|
||||
[self.delegate roomInputToolbarView:self placeCallWithVideo:YES];
|
||||
}
|
||||
|
||||
}]];
|
||||
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"]
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
self->actionSheet = nil;
|
||||
}
|
||||
|
||||
}]];
|
||||
|
||||
[actionSheet popoverPresentationController].sourceView = self.voiceCallButton;
|
||||
[actionSheet popoverPresentationController].sourceRect = self.voiceCallButton.bounds;
|
||||
[self.window.rootViewController presentViewController:actionSheet animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
else if (button == self.hangupCallButton)
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(roomInputToolbarViewHangupCall:)])
|
||||
{
|
||||
[self.delegate roomInputToolbarViewHangupCall:self];
|
||||
}
|
||||
}
|
||||
|
||||
[super onTouchUpInside:button];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user