mirror of https://github.com/oxen-io/session-ios
Merge branch 'charlesmchen/conversationViewModel1'
commit
cdafeb8388
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,108 @@
|
||||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class ConversationStyle;
|
||||
@class ConversationViewModel;
|
||||
@class OWSQuotedReplyModel;
|
||||
@class TSThread;
|
||||
@class ThreadDynamicInteractions;
|
||||
|
||||
@protocol ConversationViewItem;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, ConversationUpdateType) {
|
||||
// No view items in the load window were effected.
|
||||
ConversationUpdateType_Minor,
|
||||
// A subset of view items in the load window were effected;
|
||||
// the view should be updated using the update items.
|
||||
ConversationUpdateType_Diff,
|
||||
// Complicated or unexpected changes occurred in the load window;
|
||||
// the view should be reloaded.
|
||||
ConversationUpdateType_Reload,
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
|
||||
typedef NS_ENUM(NSUInteger, ConversationUpdateItemType) {
|
||||
ConversationUpdateItemType_Insert,
|
||||
ConversationUpdateItemType_Delete,
|
||||
ConversationUpdateItemType_Update,
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface ConversationUpdateItem : NSObject
|
||||
|
||||
@property (nonatomic, readonly) ConversationUpdateItemType updateItemType;
|
||||
// Only applies in the "delete" and "update" cases.
|
||||
@property (nonatomic, readonly) NSUInteger oldIndex;
|
||||
// Only applies in the "insert" and "update" cases.
|
||||
@property (nonatomic, readonly) NSUInteger newIndex;
|
||||
// Only applies in the "insert" and "update" cases.
|
||||
@property (nonatomic, readonly, nullable) id<ConversationViewItem> viewItem;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface ConversationUpdate : NSObject
|
||||
|
||||
@property (nonatomic, readonly) ConversationUpdateType conversationUpdateType;
|
||||
// Only applies in the "diff" case.
|
||||
@property (nonatomic, readonly, nullable) NSArray<ConversationUpdateItem *> *updateItems;
|
||||
//// Only applies in the "diff" case.
|
||||
@property (nonatomic, readonly) BOOL shouldAnimateUpdates;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@protocol ConversationViewModelDelegate <NSObject>
|
||||
|
||||
- (void)conversationViewModelWillUpdate;
|
||||
- (void)conversationViewModelDidUpdate:(ConversationUpdate *)conversationUpdate;
|
||||
|
||||
- (void)conversationViewModelWillLoadMoreItems;
|
||||
- (void)conversationViewModelDidLoadMoreItems;
|
||||
- (void)conversationViewModelDidLoadPrevPage;
|
||||
- (void)conversationViewModelRangeDidChange;
|
||||
|
||||
// TODO: It'd be nice to remove this.
|
||||
- (BOOL)shouldObserveDBModifications;
|
||||
|
||||
- (ConversationStyle *)conversationStyle;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface ConversationViewModel : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSArray<id<ConversationViewItem>> *viewItems;
|
||||
@property (nonatomic, nullable) NSString *focusMessageIdOnOpen;
|
||||
@property (nonatomic, readonly, nullable) ThreadDynamicInteractions *dynamicInteractions;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithThread:(TSThread *)thread
|
||||
focusMessageIdOnOpen:(nullable NSString *)focusMessageIdOnOpen
|
||||
delegate:(id<ConversationViewModelDelegate>)delegate NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (void)ensureDynamicInteractions;
|
||||
|
||||
- (void)clearUnreadMessagesIndicator;
|
||||
|
||||
- (void)loadAnotherPageOfMessages;
|
||||
|
||||
- (void)viewDidResetContentAndLayout;
|
||||
|
||||
- (void)viewDidLoad;
|
||||
|
||||
- (BOOL)canLoadMoreItems;
|
||||
|
||||
- (nullable NSIndexPath *)ensureLoadWindowContainsQuotedReply:(OWSQuotedReplyModel *)quotedReply;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue