mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-06 07:57:42 +02:00
Option to autocomplete nicknames from their member info page
https://github.com/vector-im/vector-ios/issues/317
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
extern NSString *const kAppDelegateDidTapStatusBarNotification;
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate, MXKCallViewControllerDelegate, MXKContactDetailsViewControllerDelegate, MXKRoomMemberDetailsViewControllerDelegate, UISplitViewControllerDelegate, UINavigationControllerDelegate>
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate, MXKCallViewControllerDelegate, MXKContactDetailsViewControllerDelegate, UISplitViewControllerDelegate, UINavigationControllerDelegate>
|
||||
{
|
||||
BOOL isAPNSRegistered;
|
||||
|
||||
|
||||
@@ -1697,13 +1697,6 @@ NSString *const kAppDelegateDidTapStatusBarNotification = @"kAppDelegateDidTapSt
|
||||
[self startPrivateOneToOneRoomWithUserId:matrixId completion:completion];
|
||||
}
|
||||
|
||||
#pragma mark - MXKRoomMemberDetailsViewControllerDelegate
|
||||
|
||||
- (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)roomMemberDetailsViewController startChatWithMemberId:(NSString *)matrixId completion:(void (^)(void))completion
|
||||
{
|
||||
[self startPrivateOneToOneRoomWithUserId:matrixId completion:completion];
|
||||
}
|
||||
|
||||
#pragma mark - Call status handling
|
||||
|
||||
- (void)addCallStatusBar
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
"room_participants_action_start_chat" = "Start chat";
|
||||
"room_participants_action_start_voice_call" = "Start voice call";
|
||||
"room_participants_action_start_video_call" = "Start video call";
|
||||
"room_participants_action_mention" = "Mention";
|
||||
|
||||
// Chat
|
||||
"room_one_user_is_typing" = "%@ is typing...";
|
||||
|
||||
@@ -68,9 +68,6 @@
|
||||
self.enableBarTintColorStatusChange = NO;
|
||||
self.rageShakeManager = [RageShakeManager sharedManager];
|
||||
|
||||
// Set delegate to handle start chat option
|
||||
self.delegate = [AppDelegate theDelegate];
|
||||
|
||||
self.memberHeaderView.backgroundColor = kVectorColorLightGrey;
|
||||
self.roomMemberNameLabel.textColor = kVectorTextColorBlack;
|
||||
self.roomMemberStatusLabel.textColor = kVectorColorGreen;
|
||||
@@ -404,6 +401,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (self.enableMention)
|
||||
{
|
||||
// Add mention option
|
||||
[actionsArray addObject:@(MXKRoomMemberDetailsActionMention)];
|
||||
}
|
||||
|
||||
return actionsArray.count;
|
||||
}
|
||||
|
||||
@@ -452,6 +455,9 @@
|
||||
case MXKRoomMemberDetailsActionStartVideoCall:
|
||||
title = NSLocalizedStringFromTable(@"room_participants_action_start_video_call", @"Vector", nil);
|
||||
break;
|
||||
case MXKRoomMemberDetailsActionMention:
|
||||
title = NSLocalizedStringFromTable(@"room_participants_action_mention", @"Vector", nil);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -21,12 +21,30 @@
|
||||
#import "SegmentedViewController.h"
|
||||
|
||||
@class Contact;
|
||||
@class RoomParticipantsViewController;
|
||||
|
||||
/**
|
||||
`RoomParticipantsViewController` delegate.
|
||||
*/
|
||||
@protocol RoomParticipantsViewControllerDelegate <NSObject>
|
||||
|
||||
/**
|
||||
Tells the delegate that the user wants to mention a room member.
|
||||
|
||||
@discussion the `RoomParticipantsViewController` instance is withdrawn automatically.
|
||||
|
||||
@param roomParticipantsViewController the `RoomParticipantsViewController` instance.
|
||||
@param member the room member to mention.
|
||||
*/
|
||||
- (void)roomParticipantsViewController:(RoomParticipantsViewController *)roomParticipantsViewController mention:(MXRoomMember*)member;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
'RoomParticipantsViewController' instance is used to edit members of the room defined by the property 'mxRoom'.
|
||||
When this property is nil, the view controller is empty.
|
||||
*/
|
||||
@interface RoomParticipantsViewController : MXKViewController <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
|
||||
@interface RoomParticipantsViewController : MXKViewController <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, MXKRoomMemberDetailsViewControllerDelegate>
|
||||
{
|
||||
@protected
|
||||
/**
|
||||
@@ -72,5 +90,15 @@
|
||||
*/
|
||||
@property (nonatomic) SegmentedViewController *segmentedViewController;
|
||||
|
||||
/**
|
||||
Enable mention option in member details view. NO by default
|
||||
*/
|
||||
@property (nonatomic) BOOL enableMention;
|
||||
|
||||
/**
|
||||
The delegate for the view controller.
|
||||
*/
|
||||
@property (nonatomic) id<RoomParticipantsViewControllerDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -314,6 +314,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setEnableMention:(BOOL)enableMention
|
||||
{
|
||||
if (_enableMention != enableMention)
|
||||
{
|
||||
_enableMention = enableMention;
|
||||
|
||||
if (detailsViewController)
|
||||
{
|
||||
detailsViewController.enableMention = enableMention;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Internals
|
||||
|
||||
- (void)setNavBarButtons
|
||||
@@ -1020,6 +1033,11 @@
|
||||
if (contact.mxMember)
|
||||
{
|
||||
detailsViewController = [RoomMemberDetailsViewController roomMemberDetailsViewController];
|
||||
|
||||
// Set delegate to handle action on member (start chat, mention)
|
||||
detailsViewController.delegate = self;
|
||||
detailsViewController.enableMention = _enableMention;
|
||||
|
||||
[detailsViewController displayRoomMember:contact.mxMember withMatrixRoom:self.mxRoom];
|
||||
|
||||
// Check whether the view controller is displayed inside a segmented one.
|
||||
@@ -1065,6 +1083,30 @@
|
||||
return actions;
|
||||
}
|
||||
|
||||
#pragma mark - MXKRoomMemberDetailsViewControllerDelegate
|
||||
|
||||
- (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)roomMemberDetailsViewController startChatWithMemberId:(NSString *)matrixId completion:(void (^)(void))completion
|
||||
{
|
||||
[[AppDelegate theDelegate] startPrivateOneToOneRoomWithUserId:matrixId completion:completion];
|
||||
}
|
||||
|
||||
- (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)roomMemberDetailsViewController mention:(MXRoomMember*)member
|
||||
{
|
||||
if (_delegate)
|
||||
{
|
||||
id<RoomParticipantsViewControllerDelegate> delegate = _delegate;
|
||||
|
||||
// Check whether the current view controller is displayed inside a segmented view controller in order to withdraw the right item
|
||||
MXKViewController *viewController = _segmentedViewController ? _segmentedViewController : self;
|
||||
|
||||
// Withdraw the current view controller, and let the delegate mention the member
|
||||
[viewController withdrawViewControllerAnimated:YES completion:^{
|
||||
|
||||
[delegate roomParticipantsViewController:self mention:member];
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
|
||||
#import "RoomPreviewData.h"
|
||||
|
||||
#import "RoomParticipantsViewController.h"
|
||||
|
||||
#import "UIViewController+VectorSearch.h"
|
||||
|
||||
@interface RoomViewController : MXKRoomViewController <UISearchBarDelegate, RoomTitleViewTapGestureDelegate>
|
||||
@interface RoomViewController : MXKRoomViewController <UISearchBarDelegate, RoomTitleViewTapGestureDelegate, RoomParticipantsViewControllerDelegate, MXKRoomMemberDetailsViewControllerDelegate>
|
||||
|
||||
// The expanded header
|
||||
@property (weak, nonatomic) IBOutlet UIView *expandedHeaderContainer;
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#import "SimpleRoomTitleView.h"
|
||||
#import "PreviewRoomTitleView.h"
|
||||
|
||||
#import "RoomParticipantsViewController.h"
|
||||
#import "RoomMemberDetailsViewController.h"
|
||||
|
||||
#import "SegmentedViewController.h"
|
||||
@@ -1539,6 +1538,8 @@
|
||||
[titles addObject: NSLocalizedStringFromTable(@"room_details_people", @"Vector", nil)];
|
||||
|
||||
RoomParticipantsViewController* participantsViewController = [[RoomParticipantsViewController alloc] init];
|
||||
participantsViewController.delegate = self;
|
||||
participantsViewController.enableMention = YES;
|
||||
participantsViewController.mxRoom = [session roomWithRoomId:roomid];
|
||||
participantsViewController.segmentedViewController = segmentedViewController;
|
||||
[viewControllers addObject:participantsViewController];
|
||||
@@ -1576,10 +1577,10 @@
|
||||
if (selectedRoomMember)
|
||||
{
|
||||
RoomMemberDetailsViewController *memberViewController = pushedViewController;
|
||||
// Set rageShake handler
|
||||
memberViewController.rageShakeManager = [RageShakeManager sharedManager];
|
||||
// Set delegate to handle start chat option
|
||||
memberViewController.delegate = [AppDelegate theDelegate];
|
||||
|
||||
// Set delegate to handle action on member (start chat, memtion)
|
||||
memberViewController.delegate = self;
|
||||
memberViewController.enableMention = YES;
|
||||
|
||||
[memberViewController displayRoomMember:selectedRoomMember withMatrixRoom:self.roomDataSource.room];
|
||||
|
||||
@@ -1640,6 +1641,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - RoomParticipantsViewControllerDelegate
|
||||
|
||||
- (void)roomParticipantsViewController:(RoomParticipantsViewController *)roomParticipantsViewController mention:(MXRoomMember*)member
|
||||
{
|
||||
[self mention:member];
|
||||
}
|
||||
|
||||
#pragma mark - MXKRoomMemberDetailsViewControllerDelegate
|
||||
|
||||
- (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)roomMemberDetailsViewController startChatWithMemberId:(NSString *)matrixId completion:(void (^)(void))completion
|
||||
{
|
||||
[[AppDelegate theDelegate] startPrivateOneToOneRoomWithUserId:matrixId completion:completion];
|
||||
}
|
||||
|
||||
- (void)roomMemberDetailsViewController:(MXKRoomMemberDetailsViewController *)roomMemberDetailsViewController mention:(MXRoomMember*)member
|
||||
{
|
||||
[self mention:member];
|
||||
}
|
||||
|
||||
#pragma mark - Action
|
||||
|
||||
- (IBAction)onButtonPressed:(id)sender
|
||||
|
||||
Reference in New Issue
Block a user