2015-12-07 03:31:43 +01:00
|
|
|
//
|
2017-05-23 16:12:04 +02:00
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
2015-12-07 03:31:43 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <YapDatabase/YapDatabaseViewTransaction.h>
|
|
|
|
|
2017-06-15 19:37:10 +02:00
|
|
|
extern NSString *const kNSNotificationName_DatabaseViewRegistrationComplete;
|
|
|
|
|
|
|
|
extern NSString *const TSInboxGroup;
|
|
|
|
extern NSString *const TSArchiveGroup;
|
|
|
|
extern NSString *const TSUnreadIncomingMessagesGroup;
|
|
|
|
extern NSString *const TSSecondaryDevicesGroup;
|
|
|
|
|
|
|
|
extern NSString *const TSThreadDatabaseViewExtensionName;
|
|
|
|
|
|
|
|
extern NSString *const TSMessageDatabaseViewExtensionName;
|
|
|
|
extern NSString *const TSUnreadDatabaseViewExtensionName;
|
|
|
|
|
|
|
|
extern NSString *const TSSecondaryDevicesDatabaseViewExtensionName;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
@interface TSDatabaseView : NSObject
|
|
|
|
|
2017-06-15 19:37:10 +02:00
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
2017-06-15 19:37:10 +02:00
|
|
|
+ (BOOL)hasPendingViewRegistrations;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
2017-06-15 19:37:10 +02:00
|
|
|
+ (void)registerThreadDatabaseView;
|
|
|
|
|
|
|
|
+ (void)registerThreadInteractionsDatabaseView;
|
|
|
|
+ (void)asyncRegisterThreadOutgoingMessagesDatabaseView;
|
2017-05-26 16:32:13 +02:00
|
|
|
|
2017-05-25 18:17:45 +02:00
|
|
|
// Instances of OWSReadTracking for wasRead is NO and shouldAffectUnreadCounts is YES.
|
|
|
|
//
|
|
|
|
// Should be used for "unread message counts".
|
2017-06-15 19:37:10 +02:00
|
|
|
+ (void)registerUnreadDatabaseView;
|
2017-05-26 16:32:13 +02:00
|
|
|
|
2017-05-25 18:17:45 +02:00
|
|
|
// Should be used for "unread indicator".
|
|
|
|
//
|
|
|
|
// Instances of OWSReadTracking for wasRead is NO.
|
2017-06-15 19:37:10 +02:00
|
|
|
+ (void)asyncRegisterUnseenDatabaseView;
|
|
|
|
|
|
|
|
+ (void)asyncRegisterThreadSpecialMessagesDatabaseView;
|
2017-05-26 16:32:13 +02:00
|
|
|
|
2016-09-28 06:07:42 +02:00
|
|
|
+ (void)asyncRegisterSecondaryDevicesDatabaseView;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
2017-06-15 19:37:10 +02:00
|
|
|
// Returns the "unseen" database view if it is ready;
|
|
|
|
// otherwise it returns the "unread" database view.
|
|
|
|
+ (id)unseenDatabaseViewExtension:(YapDatabaseReadTransaction *)transaction;
|
|
|
|
|
2017-06-15 21:36:21 +02:00
|
|
|
// NOTE: It is not safe to call this method while hasPendingViewRegistrations is YES.
|
2017-06-15 19:37:10 +02:00
|
|
|
+ (id)threadOutgoingMessageDatabaseView:(YapDatabaseReadTransaction *)transaction;
|
|
|
|
|
2017-06-15 21:36:21 +02:00
|
|
|
// NOTE: It is not safe to call this method while hasPendingViewRegistrations is YES.
|
2017-06-15 19:37:10 +02:00
|
|
|
+ (id)threadSpecialMessagesDatabaseView:(YapDatabaseReadTransaction *)transaction;
|
|
|
|
|
2017-06-20 18:04:59 +02:00
|
|
|
// This method should be called _after_ all async database registrations have been started.
|
|
|
|
+ (void)asyncRegistrationCompletion;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
@end
|