-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPBDataSource.h
More file actions
51 lines (36 loc) · 1.55 KB
/
PBDataSource.h
File metadata and controls
51 lines (36 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// PBDataSource.h
// Pastie
//
// Created on 2025-06-08
// Copyright © 2025 Tanner Bennett. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PDBManager.h"
#import "PBURLPaste.h"
NS_ASSUME_NONNULL_BEGIN
@interface PBDataSource : NSObject <UITableViewDataSource>
@property (nonatomic, readonly) PDBManager *pasteDB;
@property (nonatomic, readonly) PBDataType type;
@property (nonatomic, copy) NSString *filterText;
/// May be stings or URLPaste objects depending on the data source type
@property (nonatomic, readonly) NSArray *data;
+ (void)open:(PBDataType)type
completion:(void (^)(PBDataSource * _Nullable, NSError * _Nullable))completion;
- (void)reloadDataWithTableView:(UITableView *)tableView
animated:(BOOL)animated
completion:(nullable void(^)(void))completion;
#pragma mark - Data Operations
/// Deletes specific items (strings or PBURLPastes) from the database
- (void)deleteItems:(NSArray *)items completion:(NS_NOESCAPE void (^)(void))completion;
- (void)deleteAllItems:(NS_NOESCAPE void(^)(NSError *error))callback;
- (void)addFromClipboard:(NS_NOESCAPE void (^)(BOOL didAdd))completion;
- (void)copyToClipboard:(id)item;
/// Filters the data source using the provided text
- (void)filterWithText:(nullable NSString *)text;
- (void)importDatabase:(NSURL *)fileURL
backupFirst:(BOOL)backup
completion:(NS_NOESCAPE void(^)(NSError * _Nullable error))completion;
- (void)destroyDatabase:(NS_NOESCAPE void(^)(NSError * _Nullable error))completion;
@end
NS_ASSUME_NONNULL_END