mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
ccb4a88742
git remote add ssk ../SignalServiceKit git remote update git merge -s ours --allow-unrelated-histories --no-commit ssk/master git read-tree --prefix=SignalServiceKit -u ssk/master git commit
78 lines
2.3 KiB
Objective-C
78 lines
2.3 KiB
Objective-C
// Created by Michael Kirk on 9/25/16.
|
|
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
|
|
|
#import "OWSNotifyRemoteOfUpdatedDisappearingConfigurationJob.h"
|
|
#import "OWSDisappearingMessagesConfigurationMessage.h"
|
|
#import "OWSMessageSender.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface OWSNotifyRemoteOfUpdatedDisappearingConfigurationJob ()
|
|
|
|
@property (nonatomic, readonly) OWSDisappearingMessagesConfiguration *configuration;
|
|
@property (nonatomic, readonly) OWSMessageSender *messageSender;
|
|
@property (nonatomic, readonly) TSThread *thread;
|
|
|
|
@end
|
|
|
|
@implementation OWSNotifyRemoteOfUpdatedDisappearingConfigurationJob
|
|
|
|
- (instancetype)initWithConfiguration:(OWSDisappearingMessagesConfiguration *)configuration
|
|
thread:(TSThread *)thread
|
|
messageSender:(OWSMessageSender *)messageSender
|
|
{
|
|
self = [super init];
|
|
if (!self) {
|
|
return self;
|
|
}
|
|
|
|
_thread = thread;
|
|
_configuration = configuration;
|
|
_messageSender = messageSender;
|
|
|
|
return self;
|
|
}
|
|
|
|
+ (void)runWithConfiguration:(OWSDisappearingMessagesConfiguration *)configuration
|
|
thread:(TSThread *)thread
|
|
messageSender:(OWSMessageSender *)messageSender
|
|
{
|
|
OWSNotifyRemoteOfUpdatedDisappearingConfigurationJob *job =
|
|
[[self alloc] initWithConfiguration:configuration thread:thread messageSender:messageSender];
|
|
[job run];
|
|
}
|
|
|
|
- (void)run
|
|
{
|
|
OWSDisappearingMessagesConfigurationMessage *message =
|
|
[[OWSDisappearingMessagesConfigurationMessage alloc] initWithConfiguration:self.configuration
|
|
thread:self.thread];
|
|
|
|
[self.messageSender sendMessage:message
|
|
success:^{
|
|
DDLogDebug(
|
|
@"%@ Successfully notified %@ of new disappearing messages configuration", self.tag, self.thread);
|
|
}
|
|
failure:^(NSError *error) {
|
|
DDLogError(@"%@ Failed to notify %@ of new disappearing messages configuration with error: %@",
|
|
self.tag,
|
|
self.thread,
|
|
error);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - Logging
|
|
|
|
+ (NSString *)tag
|
|
{
|
|
return [NSString stringWithFormat:@"[%@]", self.class];
|
|
}
|
|
|
|
- (NSString *)tag
|
|
{
|
|
return self.class.tag;
|
|
}
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|