2014-10-02 15:02:47 +00:00
|
|
|
/*
|
2015-04-03 13:02:16 +00:00
|
|
|
Copyright 2015 OpenMarket Ltd
|
2017-04-07 09:52:53 +00:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2014-10-02 15:02:47 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2015-04-03 13:02:16 +00:00
|
|
|
#import <MatrixKit/MatrixKit.h>
|
2014-10-02 15:02:47 +00:00
|
|
|
|
2017-04-27 10:06:13 +00:00
|
|
|
@interface RecentsViewController : MXKRecentListViewController <MXKRecentListViewControllerDelegate>
|
2017-04-06 12:27:45 +00:00
|
|
|
{
|
|
|
|
@protected
|
2017-07-09 16:32:40 +00:00
|
|
|
/**
|
|
|
|
The room identifier related to the cell which is in editing mode (if any).
|
|
|
|
*/
|
|
|
|
NSString *editedRoomId;
|
|
|
|
|
2017-04-06 12:27:45 +00:00
|
|
|
/**
|
2017-05-05 15:08:44 +00:00
|
|
|
The image view of the (+) button.
|
2017-04-06 12:27:45 +00:00
|
|
|
*/
|
2017-05-05 15:08:44 +00:00
|
|
|
UIImageView* plusButtonImageView;
|
2017-04-06 12:27:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Current alert (if any).
|
|
|
|
*/
|
2017-07-14 14:41:25 +00:00
|
|
|
UIAlertController *currentAlert;
|
2017-04-14 09:49:14 +00:00
|
|
|
|
|
|
|
/**
|
2017-04-18 08:32:14 +00:00
|
|
|
The list of the section headers currently displayed in the recents table.
|
2017-04-14 09:49:14 +00:00
|
|
|
*/
|
2017-04-18 08:32:14 +00:00
|
|
|
NSMutableArray<UIView*> *displayedSectionHeaders;
|
2017-04-14 09:49:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The current vertical position of the first displayed section header.
|
|
|
|
*/
|
|
|
|
CGFloat firstDisplayedSectionHeaderPosY;
|
2017-04-06 12:27:45 +00:00
|
|
|
}
|
2014-10-02 15:02:47 +00:00
|
|
|
|
2017-04-11 15:58:59 +00:00
|
|
|
@property (weak, nonatomic) IBOutlet UIView *stickyHeadersTopContainer;
|
|
|
|
@property (weak, nonatomic) IBOutlet UIView *stickyHeadersBottomContainer;
|
|
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *stickyHeadersTopContainerHeightConstraint;
|
|
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *stickyHeadersBottomContainerHeightConstraint;
|
|
|
|
|
2015-12-21 10:13:46 +00:00
|
|
|
/**
|
|
|
|
If YES, the table view will scroll at the top on the next data source refresh.
|
|
|
|
It comes back to NO after each refresh.
|
|
|
|
*/
|
|
|
|
@property (nonatomic) BOOL shouldScrollToTopOnRefresh;
|
|
|
|
|
2017-05-11 09:51:42 +00:00
|
|
|
/**
|
|
|
|
Tell whether the search bar at the top of the recents table is enabled. YES by default.
|
|
|
|
*/
|
|
|
|
@property (nonatomic) BOOL enableSearchBar;
|
|
|
|
|
2017-05-05 13:30:35 +00:00
|
|
|
/**
|
|
|
|
Tell whether the drag and drop option are enabled. NO by default.
|
|
|
|
This option is used to move a room from a section to another.
|
|
|
|
*/
|
|
|
|
@property (nonatomic) BOOL enableDragging;
|
|
|
|
|
2017-04-11 15:58:59 +00:00
|
|
|
/**
|
|
|
|
Tell whether the sticky headers are enabled. NO by default.
|
|
|
|
*/
|
|
|
|
@property (nonatomic) BOOL enableStickyHeaders;
|
|
|
|
|
2017-04-20 08:38:13 +00:00
|
|
|
/**
|
|
|
|
Define the height of each sticky headers (30.0 by default).
|
|
|
|
*/
|
|
|
|
@property (nonatomic) CGFloat stickyHeaderHeight;
|
|
|
|
|
2017-04-06 12:27:45 +00:00
|
|
|
/**
|
2018-06-27 07:55:06 +00:00
|
|
|
The analytics instance screen name (Default is "RecentsScreen").
|
2017-04-06 12:27:45 +00:00
|
|
|
*/
|
|
|
|
@property (nonatomic) NSString *screenName;
|
|
|
|
|
2017-04-11 15:58:59 +00:00
|
|
|
/**
|
2017-04-14 09:49:14 +00:00
|
|
|
Return the sticky header for the specified section of the table view
|
|
|
|
|
|
|
|
@param tableView the table view object asking for the view object.
|
|
|
|
@param section an index number identifying a section of tableView .
|
|
|
|
@return the sticky header.
|
|
|
|
*/
|
|
|
|
- (UIView *)tableView:(UITableView *)tableView viewForStickyHeaderInSection:(NSInteger)section;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Release the resources used to display the sticky headers.
|
|
|
|
*/
|
|
|
|
- (void)resetStickyHeaders;
|
|
|
|
|
|
|
|
/**
|
2017-05-23 19:15:38 +00:00
|
|
|
Prepare the sticky headers display.
|
2017-04-11 15:58:59 +00:00
|
|
|
*/
|
2017-05-23 19:15:38 +00:00
|
|
|
- (void)prepareStickyHeaders;
|
2017-04-11 15:58:59 +00:00
|
|
|
|
2015-12-09 15:48:43 +00:00
|
|
|
/**
|
|
|
|
Refresh the cell selection in the table.
|
|
|
|
|
2017-04-07 09:52:53 +00:00
|
|
|
This must be done accordingly to the currently selected room in the master tabbar of the application.
|
2015-12-09 15:48:43 +00:00
|
|
|
|
|
|
|
@param forceVisible if YES and if the corresponding cell is not visible, scroll the table view to make it visible.
|
|
|
|
*/
|
|
|
|
- (void)refreshCurrentSelectedCell:(BOOL)forceVisible;
|
|
|
|
|
2017-07-09 16:32:40 +00:00
|
|
|
/**
|
|
|
|
Leave the edition mode
|
|
|
|
|
|
|
|
@param forceRefresh force table view refresh
|
|
|
|
*/
|
|
|
|
- (void)cancelEditionMode:(BOOL)forceRefresh;
|
2017-04-06 12:27:45 +00:00
|
|
|
|
2017-05-05 15:08:44 +00:00
|
|
|
#pragma mark - Room handling
|
2017-04-06 12:27:45 +00:00
|
|
|
/**
|
2017-05-05 15:08:44 +00:00
|
|
|
Add the (+) button at the right bottom corner of the view.
|
2017-04-06 12:27:45 +00:00
|
|
|
*/
|
2017-05-05 15:08:44 +00:00
|
|
|
- (void)addPlusButton;
|
2017-04-06 12:27:45 +00:00
|
|
|
|
|
|
|
/**
|
2017-05-05 15:08:44 +00:00
|
|
|
Action triggered when the user taps on the (+) button.
|
2017-04-06 12:27:45 +00:00
|
|
|
Create an empty room by default.
|
|
|
|
*/
|
2017-05-05 15:08:44 +00:00
|
|
|
- (void)onPlusButtonPressed;
|
2017-04-06 12:27:45 +00:00
|
|
|
|
|
|
|
/**
|
2020-09-11 13:12:12 +00:00
|
|
|
Open screen to create a new room.
|
2017-04-06 12:27:45 +00:00
|
|
|
*/
|
2020-09-11 13:12:12 +00:00
|
|
|
- (void)createNewRoom;
|
2017-04-06 12:27:45 +00:00
|
|
|
|
2017-05-02 13:54:50 +00:00
|
|
|
/**
|
|
|
|
Join a room by alias or id.
|
|
|
|
*/
|
|
|
|
- (void)joinARoom;
|
|
|
|
|
2017-07-09 16:32:40 +00:00
|
|
|
/**
|
|
|
|
Leave the selected room.
|
|
|
|
*/
|
|
|
|
- (void)leaveEditedRoom;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Update the selected room tag.
|
|
|
|
*/
|
|
|
|
- (void)updateEditedRoomTag:(NSString*)tag;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Enable/disable the direct flag of the selected room.
|
|
|
|
*/
|
|
|
|
- (void)makeDirectEditedRoom:(BOOL)isDirect;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Enable/disable the notifications for the selected room.
|
|
|
|
*/
|
|
|
|
- (void)muteEditedRoomNotifications:(BOOL)mute;
|
|
|
|
|
|
|
|
#pragma mark - Scrolling
|
|
|
|
|
|
|
|
/**
|
|
|
|
Scroll to the top of the recents list.
|
|
|
|
*/
|
|
|
|
- (void)scrollToTop:(BOOL)animated;
|
|
|
|
|
2017-06-16 14:55:54 +00:00
|
|
|
/**
|
|
|
|
Scroll the next room with missed notifications to the top.
|
|
|
|
|
|
|
|
@param section the table section in which the operation must be applied.
|
|
|
|
*/
|
|
|
|
- (void)scrollToTheTopTheNextRoomWithMissedNotificationsInSection:(NSInteger)section;
|
|
|
|
|
2017-04-27 10:06:13 +00:00
|
|
|
#pragma mark - Actions
|
|
|
|
|
|
|
|
- (void)didTapOnSectionHeader:(UIGestureRecognizer*)gestureRecognizer;
|
|
|
|
- (void)didSwipeOnSectionHeader:(UISwipeGestureRecognizer*)gestureRecognizer;
|
|
|
|
|
2014-10-02 15:02:47 +00:00
|
|
|
@end
|
|
|
|
|