Merge branch 'dev' of https://github.com/oxen-io/session-ios into fix-open-group-message-timestamp

pull/390/head
Ryan ZHAO 4 years ago
commit fbf269131b

@ -149,7 +149,8 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
Storage.read { transaction in Storage.read { transaction in
unreadCount = self.thread.unreadMessageCount(transaction: transaction) unreadCount = self.thread.unreadMessageCount(transaction: transaction)
} }
unreadViewItems = unreadCount != 0 ? [ConversationViewItem](viewItems[viewItems.endIndex - Int(unreadCount) ..< viewItems.endIndex]) : [] let clampedUnreadCount = min(unreadCount, UInt(kConversationInitialMaxRangeSize))
unreadViewItems = clampedUnreadCount != 0 ? [ConversationViewItem](viewItems[viewItems.endIndex - Int(clampedUnreadCount) ..< viewItems.endIndex]) : []
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {

@ -91,6 +91,24 @@ typedef NS_ENUM(NSUInteger, ConversationUpdateItemType) {
#pragma mark - #pragma mark -
// Always load up to n messages when user arrives.
//
// The smaller this number is, the faster the conversation can display.
// To test, shrink you accessibility font as much as possible, then count how many 1-line system info messages (our
// shortest cells) can fit on screen at a time on an iPhoneX
//
// PERF: we could do less messages on shorter (older, slower) devices
// PERF: we could cache the cell height, since some messages will be much taller.
static const int kYapDatabasePageSize = 250;
// Never show more than n messages in conversation view when user arrives.
static const int kConversationInitialMaxRangeSize = 250;
// Never show more than n messages in conversation view at a time.
static const int kYapDatabaseRangeMaxLength = 250;
#pragma mark -
@interface ConversationViewModel : NSObject @interface ConversationViewModel : NSObject
@property (nonatomic, readonly) ConversationViewState *viewState; @property (nonatomic, readonly) ConversationViewState *viewState;

@ -162,24 +162,6 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - #pragma mark -
// Always load up to n messages when user arrives.
//
// The smaller this number is, the faster the conversation can display.
// To test, shrink you accessibility font as much as possible, then count how many 1-line system info messages (our
// shortest cells) can fit on screen at a time on an iPhoneX
//
// PERF: we could do less messages on shorter (older, slower) devices
// PERF: we could cache the cell height, since some messages will be much taller.
static const int kYapDatabasePageSize = 25000;
// Never show more than n messages in conversation view when user arrives.
static const int kConversationInitialMaxRangeSize = 25000;
// Never show more than n messages in conversation view at a time.
static const int kYapDatabaseRangeMaxLength = 25000;
#pragma mark -
@interface ConversationViewModel () @interface ConversationViewModel ()
@property (nonatomic, weak) id<ConversationViewModelDelegate> delegate; @property (nonatomic, weak) id<ConversationViewModelDelegate> delegate;

@ -198,6 +198,14 @@ NS_ASSUME_NONNULL_BEGIN
visibleUnseenMessageCount++; visibleUnseenMessageCount++;
interactionAfterUnreadIndicator = interaction; interactionAfterUnreadIndicator = interaction;
if (visibleUnseenMessageCount + 1 >= maxRangeSize) {
// If there are more unseen messages than can be displayed in the
// messages view, show the unread indicator at the top of the
// displayed messages.
*stop = YES;
hasMoreUnseenMessages = YES;
}
}]; }];
if (!interactionAfterUnreadIndicator) { if (!interactionAfterUnreadIndicator) {

Loading…
Cancel
Save