mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
Merge remote-tracking branch 'origin/ismail/4384_room_summary_store' into ismail/4384_room_summary_store
This commit is contained in:
commit
bb1845acce
10 changed files with 104 additions and 90 deletions
2
Podfile
2
Podfile
|
@ -56,7 +56,6 @@ abstract_target 'RiotPods' do
|
|||
# Remove warnings from "bad" pods
|
||||
pod 'OLMKit', :inhibit_warnings => true
|
||||
pod 'zxcvbn-ios', :inhibit_warnings => true
|
||||
pod 'HPGrowingTextView', :inhibit_warnings => true
|
||||
|
||||
# Tools
|
||||
pod 'SwiftGen', '~> 6.3'
|
||||
|
@ -74,6 +73,7 @@ abstract_target 'RiotPods' do
|
|||
pod 'SideMenu', '~> 6.5'
|
||||
pod 'DSWaveformImage', '~> 6.1.1'
|
||||
pod 'ffmpeg-kit-ios-audio', '~> 4.5'
|
||||
pod 'GrowingTextView', '~> 0.7.2'
|
||||
|
||||
pod 'FLEX', '~> 4.5.0', :configurations => ['Debug']
|
||||
|
||||
|
|
|
@ -1843,13 +1843,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
|||
[self checkLocalPrivateKeysInSession:mxSession];
|
||||
|
||||
[self.pushNotificationService checkPushKitPushersInSession:mxSession];
|
||||
|
||||
// Validate the availability of local contact sync for any changes to the
|
||||
// authorization of contacts access that may have occurred since the last launch.
|
||||
if (BuildSettings.allowLocalContactsAccess)
|
||||
{
|
||||
[MXKContactManager.sharedManager validateSyncLocalContactsState];
|
||||
}
|
||||
}
|
||||
else if (mxSession.state == MXSessionStateClosed)
|
||||
{
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
Copyright 2015 OpenMarket Ltd
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <HPGrowingTextView/HPGrowingTextView.h>
|
||||
#import "RoomInputToolbarView.h"
|
||||
|
||||
@interface KeyboardGrowingTextView: HPGrowingTextView
|
||||
- (NSArray<UIKeyCommand *> *)keyCommands;
|
||||
@end
|
||||
|
||||
@implementation KeyboardGrowingTextView
|
||||
|
||||
- (NSArray<UIKeyCommand *> *)keyCommands {
|
||||
return @[
|
||||
[UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:0 action:@selector(keyCommandSelector:)]
|
||||
];
|
||||
}
|
||||
|
||||
- (void)keyCommandSelector:(UIKeyCommand *)sender {
|
||||
if ([sender.input isEqualToString:@"\r"] && [self.delegate isKindOfClass: RoomInputToolbarView.class]){
|
||||
RoomInputToolbarView *ritv = (RoomInputToolbarView *)self.delegate;
|
||||
[ritv onTouchUpInside:ritv.rightInputToolbarButton]; // touch the Send button.
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import GrowingTextView
|
||||
|
||||
class RoomInputToolbarTextView: GrowingTextView {
|
||||
|
||||
override var keyCommands: [UIKeyCommand]? {
|
||||
return [UIKeyCommand(input: "\r", modifierFlags: [], action: #selector(keyCommandSelector(_:)))]
|
||||
}
|
||||
|
||||
@objc private func keyCommandSelector(_ keyCommand: UIKeyCommand) {
|
||||
guard keyCommand.input == "\r", let delegate = (self.delegate as? RoomInputToolbarView) else {
|
||||
return
|
||||
}
|
||||
|
||||
delegate.onTouchUp(inside: delegate.rightInputToolbarButton)
|
||||
}
|
||||
}
|
|
@ -46,7 +46,7 @@ typedef enum : NSUInteger
|
|||
`RoomInputToolbarView` instance is a view used to handle all kinds of available inputs
|
||||
for a room (message composer, attachments selection...).
|
||||
*/
|
||||
@interface RoomInputToolbarView : MXKRoomInputToolbarViewWithHPGrowingText
|
||||
@interface RoomInputToolbarView : MXKRoomInputToolbarView
|
||||
|
||||
/**
|
||||
The delegate notified when inputs are ready.
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#import "WidgetManager.h"
|
||||
#import "IntegrationManagerViewController.h"
|
||||
|
||||
@import GrowingTextView;
|
||||
|
||||
const double kContextBarHeight = 24;
|
||||
const NSTimeInterval kSendModeAnimationDuration = .15;
|
||||
const NSTimeInterval kActionMenuAttachButtonAnimationDuration = .4;
|
||||
|
@ -36,12 +38,15 @@ const NSTimeInterval kActionMenuContentAlphaAnimationDuration = .2;
|
|||
const NSTimeInterval kActionMenuComposerHeightAnimationDuration = .3;
|
||||
const CGFloat kComposerContainerTrailingPadding = 12;
|
||||
|
||||
@interface RoomInputToolbarView()
|
||||
@interface RoomInputToolbarView() <GrowingTextViewDelegate>
|
||||
{
|
||||
// The intermediate action sheet
|
||||
UIAlertController *actionSheet;
|
||||
}
|
||||
|
||||
@property (nonatomic, weak) IBOutlet RoomInputToolbarTextView *textView;
|
||||
@property (nonatomic, assign) CGFloat expandedMainToolbarHeight;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomInputToolbarView
|
||||
|
@ -102,21 +107,21 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
// Custom the growingTextView display
|
||||
growingTextView.layer.cornerRadius = 0;
|
||||
growingTextView.layer.borderWidth = 0;
|
||||
growingTextView.backgroundColor = [UIColor clearColor];
|
||||
self.textView.layer.cornerRadius = 0;
|
||||
self.textView.layer.borderWidth = 0;
|
||||
self.textView.backgroundColor = [UIColor clearColor];
|
||||
|
||||
self.textView.font = [UIFont systemFontOfSize:15];
|
||||
self.textView.textColor = ThemeService.shared.theme.textPrimaryColor;
|
||||
self.textView.tintColor = ThemeService.shared.theme.tintColor;
|
||||
self.textView.placeholderColor = ThemeService.shared.theme.textTertiaryColor;
|
||||
self.textView.showsVerticalScrollIndicator = NO;
|
||||
|
||||
growingTextView.font = [UIFont systemFontOfSize:15];
|
||||
growingTextView.textColor = ThemeService.shared.theme.textPrimaryColor;
|
||||
growingTextView.tintColor = ThemeService.shared.theme.tintColor;
|
||||
growingTextView.placeholderColor = ThemeService.shared.theme.textTertiaryColor;
|
||||
growingTextView.internalTextView.showsVerticalScrollIndicator = NO;
|
||||
|
||||
growingTextView.internalTextView.keyboardAppearance = ThemeService.shared.theme.keyboardAppearance;
|
||||
if (growingTextView.isFirstResponder)
|
||||
self.textView.keyboardAppearance = ThemeService.shared.theme.keyboardAppearance;
|
||||
if (self.textView.isFirstResponder)
|
||||
{
|
||||
[growingTextView resignFirstResponder];
|
||||
[growingTextView becomeFirstResponder];
|
||||
[self.textView resignFirstResponder];
|
||||
[self.textView becomeFirstResponder];
|
||||
}
|
||||
|
||||
self.attachMediaButton.accessibilityLabel = [VectorL10n roomAccessibilityUpload];
|
||||
|
@ -148,8 +153,15 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
|
||||
- (void)setTextMessage:(NSString *)textMessage
|
||||
{
|
||||
[self updateUIWithTextMessage:textMessage animated:YES];
|
||||
[super setTextMessage:textMessage];
|
||||
|
||||
self.textView.text = textMessage;
|
||||
[self updateUIWithTextMessage:textMessage animated:YES];
|
||||
}
|
||||
|
||||
- (NSString *)textMessage
|
||||
{
|
||||
return self.textView.text;
|
||||
}
|
||||
|
||||
- (void)setIsEncryptionEnabled:(BOOL)isEncryptionEnabled
|
||||
|
@ -184,7 +196,7 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
|
||||
self.inputContextViewHeightConstraint.constant = kContextBarHeight;
|
||||
updatedHeight += kContextBarHeight;
|
||||
self->growingTextView.maxHeight -= kContextBarHeight;
|
||||
self.textView.maxHeight -= kContextBarHeight;
|
||||
break;
|
||||
case RoomInputToolbarViewSendModeEdit:
|
||||
buttonImage = [UIImage imageNamed:@"save_icon"];
|
||||
|
@ -193,7 +205,7 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
|
||||
self.inputContextViewHeightConstraint.constant = kContextBarHeight;
|
||||
updatedHeight += kContextBarHeight;
|
||||
self->growingTextView.maxHeight -= kContextBarHeight;
|
||||
self.textView.maxHeight -= kContextBarHeight;
|
||||
break;
|
||||
default:
|
||||
buttonImage = [UIImage imageNamed:@"send_icon"];
|
||||
|
@ -201,7 +213,7 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
if (previousMode != _sendMode)
|
||||
{
|
||||
updatedHeight -= kContextBarHeight;
|
||||
self->growingTextView.maxHeight += kContextBarHeight;
|
||||
self.textView.maxHeight += kContextBarHeight;
|
||||
}
|
||||
self.inputContextViewHeightConstraint.constant = 0;
|
||||
break;
|
||||
|
@ -211,7 +223,7 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
|
||||
if (self.maxHeight && updatedHeight > self.maxHeight)
|
||||
{
|
||||
growingTextView.maxHeight -= updatedHeight - self.maxHeight;
|
||||
self.textView.maxHeight -= updatedHeight - self.maxHeight;
|
||||
updatedHeight = self.maxHeight;
|
||||
}
|
||||
|
||||
|
@ -290,6 +302,12 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
self.placeholder = placeholder;
|
||||
}
|
||||
|
||||
- (void)setPlaceholder:(NSString *)inPlaceholder
|
||||
{
|
||||
[super setPlaceholder:inPlaceholder];
|
||||
self.textView.placeholder = inPlaceholder;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)cancelAction:(id)sender
|
||||
|
@ -300,17 +318,17 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark - HPGrowingTextView delegate
|
||||
#pragma mark - GrowingTextViewDelegate
|
||||
|
||||
- (BOOL)growingTextView:(HPGrowingTextView *)growingTextView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
|
||||
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
|
||||
{
|
||||
NSString *newText = [growingTextView.text stringByReplacingCharactersInRange:range withString:text];
|
||||
NSString *newText = [textView.text stringByReplacingCharactersInRange:range withString:text];
|
||||
[self updateUIWithTextMessage:newText animated:YES];
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)growingTextViewDidChange:(HPGrowingTextView *)hpGrowingTextView
|
||||
- (void)textViewDidChange:(UITextView *)textView
|
||||
{
|
||||
// Clean the carriage return added on return press
|
||||
if ([self.textMessage isEqualToString:@"\n"])
|
||||
|
@ -318,17 +336,20 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
self.textMessage = nil;
|
||||
}
|
||||
|
||||
[super growingTextViewDidChange:hpGrowingTextView];
|
||||
if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:isTyping:)])
|
||||
{
|
||||
[self.delegate roomInputToolbarView:self isTyping:(self.textMessage.length > 0 ? YES : NO)];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)growingTextView:(HPGrowingTextView *)hpGrowingTextView willChangeHeight:(float)height
|
||||
- (void)textViewDidChangeHeight:(GrowingTextView *)textView height:(CGFloat)height
|
||||
{
|
||||
// Update height of the main toolbar (message composer)
|
||||
CGFloat updatedHeight = height + (self.messageComposerContainerTopConstraint.constant + self.messageComposerContainerBottomConstraint.constant) + self.inputContextViewHeightConstraint.constant;
|
||||
|
||||
|
||||
if (self.maxHeight && updatedHeight > self.maxHeight)
|
||||
{
|
||||
hpGrowingTextView.maxHeight -= updatedHeight - self.maxHeight;
|
||||
textView.maxHeight -= updatedHeight - self.maxHeight;
|
||||
updatedHeight = self.maxHeight;
|
||||
}
|
||||
|
||||
|
@ -336,9 +357,9 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
{
|
||||
updatedHeight = self.mainToolbarMinHeightConstraint.constant;
|
||||
}
|
||||
|
||||
|
||||
self.mainToolbarHeightConstraint.constant = updatedHeight;
|
||||
|
||||
|
||||
// Update toolbar superview
|
||||
if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:heightDidChanged:completion:)])
|
||||
{
|
||||
|
@ -377,12 +398,12 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
{
|
||||
_actionMenuOpened = actionMenuOpened;
|
||||
|
||||
if (self->growingTextView.internalTextView.selectedRange.length > 0)
|
||||
if (self.textView.selectedRange.length > 0)
|
||||
{
|
||||
NSRange range = self->growingTextView.internalTextView.selectedRange;
|
||||
NSRange range = self.textView.selectedRange;
|
||||
range.location = range.location + range.length;
|
||||
range.length = 0;
|
||||
self->growingTextView.internalTextView.selectedRange = range;
|
||||
self.textView.selectedRange = range;
|
||||
}
|
||||
|
||||
if (_actionMenuOpened) {
|
||||
|
@ -402,18 +423,19 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
|
||||
[UIView animateWithDuration:kActionMenuContentAlphaAnimationDuration delay:_actionMenuOpened ? 0 : .1 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
self->messageComposerContainer.alpha = actionMenuOpened ? 0 : 1;
|
||||
self.rightInputToolbarButton.alpha = self->growingTextView.text.length == 0 || actionMenuOpened ? 0 : 1;
|
||||
self.voiceMessageToolbarView.alpha = self->growingTextView.text.length > 0 || actionMenuOpened ? 0 : 1;
|
||||
self.rightInputToolbarButton.alpha = self.textView.text.length == 0 || actionMenuOpened ? 0 : 1;
|
||||
self.voiceMessageToolbarView.alpha = self.textView.text.length > 0 || actionMenuOpened ? 0 : 1;
|
||||
} completion:nil];
|
||||
|
||||
[UIView animateWithDuration:kActionMenuComposerHeightAnimationDuration animations:^{
|
||||
if (actionMenuOpened)
|
||||
{
|
||||
self.expandedMainToolbarHeight = self.mainToolbarHeightConstraint.constant;
|
||||
self.mainToolbarHeightConstraint.constant = self.mainToolbarMinHeightConstraint.constant;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self->growingTextView refreshHeight];
|
||||
self.mainToolbarHeightConstraint.constant = self.expandedMainToolbarHeight;
|
||||
}
|
||||
[self layoutIfNeeded];
|
||||
[self.delegate roomInputToolbarView:self heightDidChanged:self.mainToolbarHeightConstraint.constant completion:nil];
|
||||
|
@ -438,6 +460,8 @@ const CGFloat kComposerContainerTrailingPadding = 12;
|
|||
|
||||
[UIView animateWithDuration:(animated ? 0.15f : 0.0f) animations:^{
|
||||
self.rightInputToolbarButton.alpha = textMessage.length ? 1.0f : 0.0f;
|
||||
self.rightInputToolbarButton.enabled = textMessage.length;
|
||||
|
||||
self.voiceMessageToolbarView.alpha = textMessage.length ? 0.0f : 1.0;
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
@ -77,10 +77,13 @@
|
|||
<constraint firstItem="48y-kn-7b5" firstAttribute="centerY" secondItem="dVr-ZM-kkX" secondAttribute="centerY" id="z5v-Vy-6tc"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wgb-ON-N29" customClass="KeyboardGrowingTextView">
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wgb-ON-N29" customClass="RoomInputToolbarTextView" customModule="Riot" customModuleProvider="target">
|
||||
<rect key="frame" x="5" y="33" width="474" height="4"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="GrowingTextView"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="iN0-l3-epB" id="CV3-Fk-GFg"/>
|
||||
</connections>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
|
@ -138,7 +141,6 @@
|
|||
<connections>
|
||||
<outlet property="actionsBar" destination="ESv-9w-KJF" id="h7H-vz-yzO"/>
|
||||
<outlet property="attachMediaButton" destination="Hga-l8-Wua" id="Osr-ek-c91"/>
|
||||
<outlet property="growingTextView" destination="wgb-ON-N29" id="nwF-uV-Ng9"/>
|
||||
<outlet property="inputContextButton" destination="48y-kn-7b5" id="yRn-1S-96w"/>
|
||||
<outlet property="inputContextImageView" destination="PZ4-0Y-TmL" id="PMS-K7-aMr"/>
|
||||
<outlet property="inputContextLabel" destination="dVr-ZM-kkX" id="ve6-gY-cV9"/>
|
||||
|
@ -152,6 +154,7 @@
|
|||
<outlet property="messageComposerContainerTopConstraint" destination="WyZ-3i-OHi" id="OcO-1f-bNA"/>
|
||||
<outlet property="messageComposerContainerTrailingConstraint" destination="hXO-cY-Jgz" id="0m7-AB-90i"/>
|
||||
<outlet property="rightInputToolbarButton" destination="G8Z-CM-tGs" id="NCk-5m-aNF"/>
|
||||
<outlet property="textView" destination="wgb-ON-N29" id="ySl-IB-xvn"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="137.59999999999999" y="151.12443778110946"/>
|
||||
</view>
|
||||
|
|
|
@ -43,4 +43,5 @@
|
|||
#import "RoomViewController.h"
|
||||
#import "ContactDetailsViewController.h"
|
||||
#import "GroupDetailsViewController.h"
|
||||
#import "RoomInputToolbarView.h"
|
||||
#import "NSArray+Element.h"
|
||||
|
|
1
changelog.d/4976.misc
Normal file
1
changelog.d/4976.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Replaced deprecated HPGrowingTextView with GrowingTextView.
|
1
changelog.d/4989.bugfix
Normal file
1
changelog.d/4989.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Contacts Sync: Move call to validateSyncLocalContactsState into MatrixKit.
|
Loading…
Reference in a new issue