2015-11-20 17:14:15 +00:00
|
|
|
/*
|
|
|
|
Copyright 2015 OpenMarket Ltd
|
2017-04-06 12:27:45 +00:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2015-11-20 17:14:15 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <MatrixKit/MatrixKit.h>
|
|
|
|
|
2017-04-06 12:27:45 +00:00
|
|
|
#import "PublicRoomsDirectoryDataSource.h"
|
2015-12-18 16:17:03 +00:00
|
|
|
|
2015-11-20 17:14:15 +00:00
|
|
|
/**
|
2017-04-06 12:27:45 +00:00
|
|
|
List the different modes used to prepare the recents data source.
|
|
|
|
Each mode corresponds to an application tab: Home, Favourites, People and Rooms.
|
2015-11-20 17:14:15 +00:00
|
|
|
*/
|
2017-04-06 12:27:45 +00:00
|
|
|
typedef enum : NSUInteger
|
|
|
|
{
|
|
|
|
RecentsDataSourceModeHome,
|
|
|
|
RecentsDataSourceModeFavourites,
|
|
|
|
RecentsDataSourceModePeople,
|
|
|
|
RecentsDataSourceModeRooms
|
|
|
|
|
|
|
|
} RecentsDataSourceMode;
|
2015-11-20 17:14:15 +00:00
|
|
|
|
2015-12-11 13:59:55 +00:00
|
|
|
/**
|
2017-04-06 12:27:45 +00:00
|
|
|
'RecentsDataSource' class inherits from 'MXKInterleavedRecentsDataSource' to define the Riot recents source
|
|
|
|
shared between all the applications tabs.
|
2015-12-14 09:47:10 +00:00
|
|
|
*/
|
2017-04-06 12:27:45 +00:00
|
|
|
@interface RecentsDataSource : MXKInterleavedRecentsDataSource
|
|
|
|
{
|
|
|
|
@protected
|
|
|
|
NSInteger directorySection;
|
|
|
|
NSInteger invitesSection;
|
|
|
|
NSInteger favoritesSection;
|
|
|
|
NSInteger conversationSection;
|
|
|
|
NSInteger lowPrioritySection;
|
|
|
|
|
|
|
|
NSInteger sectionsCount;
|
|
|
|
}
|
2015-12-11 13:59:55 +00:00
|
|
|
|
|
|
|
/**
|
2017-04-06 12:27:45 +00:00
|
|
|
Set the delegate by specifying the selected display mode.
|
2015-12-11 13:59:55 +00:00
|
|
|
*/
|
2017-04-06 12:27:45 +00:00
|
|
|
- (void)setDelegate:(id<MXKDataSourceDelegate>)delegate andRecentsDataSourceMode:(RecentsDataSourceMode)recentsDataSourceMode;
|
2015-12-11 13:59:55 +00:00
|
|
|
|
2015-12-18 16:17:03 +00:00
|
|
|
/**
|
2017-04-06 12:27:45 +00:00
|
|
|
The current mode (RecentsDataSourceModeHome by default).
|
2015-12-18 16:17:03 +00:00
|
|
|
*/
|
2017-04-06 12:27:45 +00:00
|
|
|
@property (nonatomic, readonly) RecentsDataSourceMode recentsDataSourceMode;
|
2015-12-18 16:17:03 +00:00
|
|
|
|
2016-05-30 11:42:45 +00:00
|
|
|
/**
|
2017-04-06 12:27:45 +00:00
|
|
|
The data source used to manage the rooms from directory.
|
2016-05-30 11:42:45 +00:00
|
|
|
*/
|
2017-04-06 12:27:45 +00:00
|
|
|
@property (nonatomic) PublicRoomsDirectoryDataSource *publicRoomsDirectoryDataSource;
|
2016-05-30 11:42:45 +00:00
|
|
|
|
|
|
|
/**
|
2017-04-06 12:27:45 +00:00
|
|
|
Refresh the recents data source and notify its delegate.
|
2016-05-30 11:42:45 +00:00
|
|
|
*/
|
2017-04-06 12:27:45 +00:00
|
|
|
- (void)forceRefresh;
|
2016-05-30 11:42:45 +00:00
|
|
|
|
2015-12-02 16:18:55 +00:00
|
|
|
/**
|
2017-04-06 12:27:45 +00:00
|
|
|
Tell whether the sections are shrinkable. NO by default.
|
2015-12-02 16:18:55 +00:00
|
|
|
*/
|
2017-04-06 12:27:45 +00:00
|
|
|
@property (nonatomic) BOOL areSectionsShrinkable;
|
2015-12-02 16:18:55 +00:00
|
|
|
|
2017-04-06 12:27:45 +00:00
|
|
|
#pragma mark - Drag & Drop handling
|
2015-12-11 10:50:13 +00:00
|
|
|
/**
|
|
|
|
Return true of the cell can be moved from a section to another one.
|
|
|
|
*/
|
|
|
|
- (BOOL)isDraggableCellAt:(NSIndexPath*)path;
|
|
|
|
|
2015-12-11 15:20:26 +00:00
|
|
|
/**
|
|
|
|
Return true of the cell can be moved from a section to another one.
|
|
|
|
*/
|
|
|
|
- (BOOL)canCellMoveFrom:(NSIndexPath*)oldPath to:(NSIndexPath*)newPath;
|
|
|
|
|
2017-04-06 12:27:45 +00:00
|
|
|
/**
|
|
|
|
There is a pending drag and drop cell.
|
|
|
|
It defines its path of the source cell.
|
|
|
|
*/
|
|
|
|
@property (nonatomic) NSIndexPath* hiddenCellIndexPath;
|
|
|
|
|
|
|
|
/**
|
|
|
|
There is a pending drag and drop cell.
|
|
|
|
It defines its path of the destination cell.
|
|
|
|
*/
|
|
|
|
@property (nonatomic) NSIndexPath* droppingCellIndexPath;
|
|
|
|
|
|
|
|
/**
|
|
|
|
The movingCellBackgroundImage.
|
|
|
|
*/
|
|
|
|
@property (nonatomic) UIImageView* droppingCellBackGroundView;
|
|
|
|
|
2015-12-11 10:50:13 +00:00
|
|
|
/**
|
|
|
|
Move a cell from a path to another one.
|
|
|
|
It is based on room Tag.
|
|
|
|
*/
|
2015-12-15 07:34:46 +00:00
|
|
|
- (void)moveRoomCell:(MXRoom*)room from:(NSIndexPath*)oldPath to:(NSIndexPath*)newPath success:(void (^)())moveSuccess failure:(void (^)(NSError *error))moveFailure;
|
2015-12-11 10:50:13 +00:00
|
|
|
|
2015-11-20 17:14:15 +00:00
|
|
|
@end
|