Signal-iOS/SignalServiceKit/Protocols/NotificationsProtocol.h
2024-03-27 12:22:52 -05:00

86 lines
3.7 KiB
Objective-C

//
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
NS_ASSUME_NONNULL_BEGIN
@class OWSReaction;
@class SDSAnyReadTransaction;
@class SDSAnyWriteTransaction;
@class StoryMessage;
@class TSErrorMessage;
@class TSIncomingMessage;
@class TSInteraction;
@class TSMessage;
@class TSOutgoingMessage;
@class TSThread;
@class ThreadlessErrorMessage;
@protocol ContactsManagerProtocol;
@protocol OWSPreviewText;
@protocol NotificationsProtocol <NSObject>
- (void)notifyUserForIncomingMessage:(TSIncomingMessage *)incomingMessage
thread:(TSThread *)thread
transaction:(SDSAnyReadTransaction *)transaction
NS_SWIFT_NAME(notifyUser(forIncomingMessage:thread:transaction:));
- (void)notifyUserForIncomingMessage:(TSIncomingMessage *)incomingMessage
editTarget:(TSIncomingMessage *)editTarget
thread:(TSThread *)thread
transaction:(SDSAnyReadTransaction *)transaction
NS_SWIFT_NAME(notifyUser(forIncomingMessage:editTarget:thread:transaction:));
- (void)notifyUserForReaction:(OWSReaction *)reaction
onOutgoingMessage:(TSOutgoingMessage *)message
thread:(TSThread *)thread
transaction:(SDSAnyReadTransaction *)transaction
NS_SWIFT_NAME(notifyUser(forReaction:onOutgoingMessage:thread:transaction:));
- (void)notifyUserForErrorMessage:(TSErrorMessage *)errorMessage
thread:(TSThread *)thread
transaction:(SDSAnyWriteTransaction *)transaction
NS_SWIFT_NAME(notifyUser(forErrorMessage:thread:transaction:));
- (void)notifyUserForTSMessage:(TSMessage *)message
thread:(TSThread *)thread
wantsSound:(BOOL)wantsSound
transaction:(SDSAnyWriteTransaction *)transaction
NS_SWIFT_NAME(notifyUser(forTSMessage:thread:wantsSound:transaction:));
- (void)notifyUserForPreviewableInteraction:(TSInteraction<OWSPreviewText> *)previewableInteraction
thread:(TSThread *)thread
wantsSound:(BOOL)wantsSound
transaction:(SDSAnyWriteTransaction *)transaction
NS_SWIFT_NAME(notifyUser(forPreviewableInteraction:thread:wantsSound:transaction:));
- (void)notifyTestPopulationOfErrorMessage:(NSString *)errorString;
- (void)notifyUserForFailedStorySend:(StoryMessage *)storyMessage
toThread:(TSThread *)thread
transaction:(SDSAnyWriteTransaction *)transaction
NS_SWIFT_NAME(notifyUser(forFailedStorySend:to:transaction:));
/// Notify user to relaunch the app after we deliberately terminate when an incoming device transfer completes.
- (void)notifyUserToRelaunchAfterTransferWithCompletion:(void (^__nullable)(void))completion;
/// Notify user of an auth error that has caused their device to be logged out (e.g. a 403 from the chat server).
- (void)notifyUserOfDeregistration:(SDSAnyWriteTransaction *)transaction
NS_SWIFT_NAME(notifyUserOfDeregistration(transaction:));
- (void)clearAllNotifications;
- (void)cancelNotificationsForThreadId:(NSString *)uniqueMessageId NS_SWIFT_NAME(cancelNotifications(threadId:));
- (void)cancelNotificationsForMessageIds:(NSArray<NSString *> *)uniqueMessageIds
NS_SWIFT_NAME(cancelNotifications(messageIds:));
- (void)cancelNotificationsForReactionId:(NSString *)uniqueReactionId NS_SWIFT_NAME(cancelNotifications(reactionId:));
- (void)cancelNotificationsForMissedCallsInThreadWithUniqueId:(NSString *)threadUniqueId
NS_SWIFT_NAME(cancelNotificationsForMissedCalls(threadUniqueId:));
- (void)cancelNotificationsForStoryMessage:(StoryMessage *)storyMessage;
@end
NS_ASSUME_NONNULL_END