mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			182 lines
		
	
	
		
			6.8 KiB
		
	
	
	
		
			C
		
	
		
		
			
		
	
	
			182 lines
		
	
	
		
			6.8 KiB
		
	
	
	
		
			C
		
	
| 
											9 years ago
										 | //
 | ||
| 
											7 years ago
										 | //  Copyright (c) 2019 Open Whisper Systems. All rights reserved.
 | ||
| 
											9 years ago
										 | //
 | ||
|  | 
 | ||
| 
											5 years ago
										 | #import <SignalUtilitiesKit/OWSViewController.h>
 | ||
| 
											9 years ago
										 | 
 | ||
| 
											9 years ago
										 | NS_ASSUME_NONNULL_BEGIN | ||
|  | 
 | ||
| 
											9 years ago
										 | extern const CGFloat kOWSTable_DefaultCellHeight; | ||
|  | 
 | ||
| 
											9 years ago
										 | @class OWSTableItem; | ||
|  | @class OWSTableSection; | ||
|  | 
 | ||
|  | @interface OWSTableContents : NSObject | ||
|  | 
 | ||
|  | @property (nonatomic) NSString *title; | ||
| 
											8 years ago
										 | @property (nonatomic, nullable) NSInteger (^sectionForSectionIndexTitleBlock)(NSString *title, NSInteger index); | ||
|  | @property (nonatomic, nullable) NSArray<NSString *> * (^sectionIndexTitlesForTableViewBlock)(void); | ||
| 
											9 years ago
										 | 
 | ||
| 
											8 years ago
										 | @property (nonatomic, readonly) NSArray<OWSTableSection *> *sections; | ||
| 
											9 years ago
										 | - (void)addSection:(OWSTableSection *)section; | ||
|  | 
 | ||
|  | @end | ||
|  | 
 | ||
|  | #pragma mark -
 | ||
|  | 
 | ||
|  | @interface OWSTableSection : NSObject | ||
|  | 
 | ||
| 
											9 years ago
										 | @property (nonatomic, nullable) NSString *headerTitle; | ||
|  | @property (nonatomic, nullable) NSString *footerTitle; | ||
| 
											9 years ago
										 | 
 | ||
| 
											9 years ago
										 | @property (nonatomic, nullable) UIView *customHeaderView; | ||
|  | @property (nonatomic, nullable) UIView *customFooterView; | ||
|  | @property (nonatomic, nullable) NSNumber *customHeaderHeight; | ||
|  | @property (nonatomic, nullable) NSNumber *customFooterHeight; | ||
|  | 
 | ||
| 
											9 years ago
										 | + (OWSTableSection *)sectionWithTitle:(nullable NSString *)title items:(NSArray<OWSTableItem *> *)items; | ||
| 
											9 years ago
										 | 
 | ||
|  | - (void)addItem:(OWSTableItem *)item; | ||
|  | 
 | ||
| 
											9 years ago
										 | - (NSUInteger)itemCount; | ||
|  | 
 | ||
| 
											9 years ago
										 | @end | ||
|  | 
 | ||
|  | #pragma mark -
 | ||
|  | 
 | ||
| 
											8 years ago
										 | typedef void (^OWSTableActionBlock)(void); | ||
| 
											8 years ago
										 | typedef void (^OWSTableSubPageBlock)(UIViewController *viewController); | ||
| 
											8 years ago
										 | typedef UITableViewCell *_Nonnull (^OWSTableCustomCellBlock)(void); | ||
| 
											7 years ago
										 | typedef BOOL (^OWSTableSwitchBlock)(void); | ||
| 
											9 years ago
										 | 
 | ||
|  | @interface OWSTableItem : NSObject | ||
|  | 
 | ||
| 
											8 years ago
										 | @property (nonatomic, weak) UIViewController *tableViewController; | ||
|  | 
 | ||
| 
											7 years ago
										 | + (UITableViewCell *)newCell; | ||
| 
											7 years ago
										 | + (void)configureCell:(UITableViewCell *)cell; | ||
| 
											7 years ago
										 | 
 | ||
| 
											7 years ago
										 | + (OWSTableItem *)itemWithTitle:(NSString *)title | ||
|  |                     actionBlock:(nullable OWSTableActionBlock)actionBlock NS_SWIFT_NAME(init(title:actionBlock:)); | ||
| 
											9 years ago
										 | 
 | ||
|  | + (OWSTableItem *)itemWithCustomCell:(UITableViewCell *)customCell | ||
|  |                      customRowHeight:(CGFloat)customRowHeight | ||
| 
											9 years ago
										 |                          actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
| 
											9 years ago
										 | 
 | ||
|  | + (OWSTableItem *)itemWithCustomCellBlock:(OWSTableCustomCellBlock)customCellBlock | ||
|  |                           customRowHeight:(CGFloat)customRowHeight | ||
| 
											9 years ago
										 |                               actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
| 
											9 years ago
										 | 
 | ||
|  | + (OWSTableItem *)itemWithCustomCellBlock:(OWSTableCustomCellBlock)customCellBlock | ||
| 
											9 years ago
										 |                               actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
| 
											9 years ago
										 | 
 | ||
| 
											9 years ago
										 | + (OWSTableItem *)disclosureItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											7 years ago
										 | + (OWSTableItem *)disclosureItemWithText:(NSString *)text | ||
|  |                  accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier | ||
|  |                              actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
|  | + (OWSTableItem *)disclosureItemWithText:(NSString *)text | ||
|  |                               detailText:(NSString *)detailText | ||
|  |                              actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)disclosureItemWithText:(NSString *)text | ||
|  |                               detailText:(NSString *)detailText | ||
| 
											7 years ago
										 |                  accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier | ||
| 
											8 years ago
										 |                              actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)disclosureItemWithText:(NSString *)text | ||
|  |                          customRowHeight:(CGFloat)customRowHeight | ||
|  |                              actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											7 years ago
										 | + (OWSTableItem *)disclosureItemWithText:(NSString *)text | ||
|  |                  accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier | ||
|  |                          customRowHeight:(CGFloat)customRowHeight | ||
|  |                              actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)checkmarkItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											7 years ago
										 | + (OWSTableItem *)checkmarkItemWithText:(NSString *)text | ||
|  |                 accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier | ||
|  |                             actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)itemWithText:(NSString *)text | ||
|  |                    actionBlock:(nullable OWSTableActionBlock)actionBlock | ||
|  |                  accessoryType:(UITableViewCellAccessoryType)accessoryType; | ||
|  | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)subPageItemWithText:(NSString *)text actionBlock:(nullable OWSTableSubPageBlock)actionBlock; | ||
|  | 
 | ||
|  | + (OWSTableItem *)subPageItemWithText:(NSString *)text | ||
|  |                       customRowHeight:(CGFloat)customRowHeight | ||
|  |                           actionBlock:(nullable OWSTableSubPageBlock)actionBlock; | ||
|  | 
 | ||
| 
											9 years ago
										 | + (OWSTableItem *)actionItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
| 
											7 years ago
										 | 
 | ||
|  | + (OWSTableItem *)actionItemWithText:(NSString *)text | ||
|  |              accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier | ||
|  |                          actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
| 
											9 years ago
										 | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)softCenterLabelItemWithText:(NSString *)text; | ||
|  | 
 | ||
|  | + (OWSTableItem *)softCenterLabelItemWithText:(NSString *)text customRowHeight:(CGFloat)customRowHeight; | ||
|  | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)labelItemWithText:(NSString *)text; | ||
|  | 
 | ||
| 
											8 years ago
										 | + (OWSTableItem *)labelItemWithText:(NSString *)text accessoryText:(NSString *)accessoryText; | ||
|  | 
 | ||
| 
											7 years ago
										 | + (OWSTableItem *)longDisclosureItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock; | ||
|  | 
 | ||
| 
											7 years ago
										 | + (OWSTableItem *)switchItemWithText:(NSString *)text | ||
|  |                            isOnBlock:(OWSTableSwitchBlock)isOnBlock | ||
|  |                               target:(id)target | ||
|  |                             selector:(SEL)selector; | ||
| 
											8 years ago
										 | 
 | ||
|  | + (OWSTableItem *)switchItemWithText:(NSString *)text | ||
| 
											7 years ago
										 |                            isOnBlock:(OWSTableSwitchBlock)isOnBlock | ||
|  |                       isEnabledBlock:(OWSTableSwitchBlock)isEnabledBlock | ||
| 
											8 years ago
										 |                               target:(id)target | ||
|  |                             selector:(SEL)selector; | ||
|  | 
 | ||
| 
											7 years ago
										 | + (OWSTableItem *)switchItemWithText:(NSString *)text | ||
|  |              accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier | ||
|  |                            isOnBlock:(OWSTableSwitchBlock)isOnBlock | ||
|  |                       isEnabledBlock:(OWSTableSwitchBlock)isEnabledBlock | ||
|  |                               target:(id)target | ||
|  |                             selector:(SEL)selector; | ||
|  | 
 | ||
| 
											9 years ago
										 | - (nullable UITableViewCell *)customCell; | ||
| 
											9 years ago
										 | - (NSNumber *)customRowHeight; | ||
| 
											9 years ago
										 | 
 | ||
|  | @end | ||
|  | 
 | ||
|  | #pragma mark -
 | ||
|  | 
 | ||
| 
											9 years ago
										 | @protocol OWSTableViewControllerDelegate <NSObject> | ||
|  | 
 | ||
| 
											8 years ago
										 | - (void)tableViewWillBeginDragging; | ||
| 
											9 years ago
										 | 
 | ||
|  | @end | ||
|  | 
 | ||
|  | #pragma mark -
 | ||
|  | 
 | ||
| 
											8 years ago
										 | @interface OWSTableViewController : OWSViewController | ||
| 
											9 years ago
										 | 
 | ||
| 
											9 years ago
										 | @property (nonatomic, weak) id<OWSTableViewControllerDelegate> delegate; | ||
|  | 
 | ||
| 
											9 years ago
										 | @property (nonatomic) OWSTableContents *contents; | ||
| 
											9 years ago
										 | @property (nonatomic, readonly) UITableView *tableView; | ||
| 
											9 years ago
										 | 
 | ||
| 
											9 years ago
										 | @property (nonatomic) UITableViewStyle tableViewStyle; | ||
|  | 
 | ||
| 
											7 years ago
										 | - (instancetype)init NS_DESIGNATED_INITIALIZER; | ||
|  | 
 | ||
| 
											9 years ago
										 | #pragma mark - Presentation
 | ||
|  | 
 | ||
|  | - (void)presentFromViewController:(UIViewController *)fromViewController; | ||
|  | 
 | ||
| 
											7 years ago
										 | - (void)applyTheme; | ||
|  | 
 | ||
| 
											9 years ago
										 | @end | ||
| 
											9 years ago
										 | 
 | ||
|  | NS_ASSUME_NONNULL_END |