Signal-iOS/SignalMessaging/utils/BlockListUIUtils.h
Michael Kirk 45c4066a80 Fix deadlock with thread.name
For contact threads, thread.name opened a sneaky transaction, which would
sometimes cause a deadlock.

This commit moves the name method to the contact manager and offers an explicit
transaction flavor. There is still a sneaky transaction flavor used in some
places where it's deemed dangerous to plumb through a transaction without
further scrutiny.
2019-08-23 18:45:23 -06:00

78 lines
3.3 KiB
Objective-C

//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class Contact;
@class OWSBlockingManager;
@class OWSContactsManager;
@class OWSMessageSender;
@class SignalAccount;
@class SignalServiceAddress;
@class TSGroupModel;
@class TSThread;
typedef void (^BlockActionCompletionBlock)(BOOL isBlocked);
@interface BlockListUIUtils : NSObject
- (instancetype)init NS_UNAVAILABLE;
#pragma mark - Block
+ (void)showBlockThreadActionSheet:(TSThread *)thread
fromViewController:(UIViewController *)fromViewController
blockingManager:(OWSBlockingManager *)blockingManager
contactsManager:(OWSContactsManager *)contactsManager
messageSender:(OWSMessageSender *)messageSender
completionBlock:(nullable BlockActionCompletionBlock)completionBlock;
+ (void)showBlockAddressActionSheet:(SignalServiceAddress *)address
fromViewController:(UIViewController *)fromViewController
blockingManager:(OWSBlockingManager *)blockingManager
contactsManager:(OWSContactsManager *)contactsManager
completionBlock:(nullable BlockActionCompletionBlock)completionBlock;
+ (void)showBlockSignalAccountActionSheet:(SignalAccount *)signalAccount
fromViewController:(UIViewController *)fromViewController
blockingManager:(OWSBlockingManager *)blockingManager
contactsManager:(OWSContactsManager *)contactsManager
completionBlock:(nullable BlockActionCompletionBlock)completionBlock;
#pragma mark - Unblock
+ (void)showUnblockThreadActionSheet:(TSThread *)thread
fromViewController:(UIViewController *)fromViewController
blockingManager:(OWSBlockingManager *)blockingManager
contactsManager:(OWSContactsManager *)contactsManager
completionBlock:(nullable BlockActionCompletionBlock)completionBlock;
+ (void)showUnblockAddressActionSheet:(SignalServiceAddress *)address
fromViewController:(UIViewController *)fromViewController
blockingManager:(OWSBlockingManager *)blockingManager
contactsManager:(OWSContactsManager *)contactsManager
completionBlock:(nullable BlockActionCompletionBlock)completionBlock;
+ (void)showUnblockSignalAccountActionSheet:(SignalAccount *)signalAccount
fromViewController:(UIViewController *)fromViewController
blockingManager:(OWSBlockingManager *)blockingManager
contactsManager:(OWSContactsManager *)contactsManager
completionBlock:(nullable BlockActionCompletionBlock)completionBlock;
+ (void)showUnblockGroupActionSheet:(TSGroupModel *)groupModel
fromViewController:(UIViewController *)fromViewController
blockingManager:(OWSBlockingManager *)blockingManager
completionBlock:(nullable BlockActionCompletionBlock)completionBlock;
#pragma mark - UI Utils
+ (NSString *)formatDisplayNameForAlertTitle:(NSString *)displayName;
+ (NSString *)formatDisplayNameForAlertMessage:(NSString *)displayName;
@end
NS_ASSUME_NONNULL_END