mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Clean
This commit is contained in:
parent
6686122461
commit
b4d4522e99
|
@ -252,7 +252,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|||
}
|
||||
*/
|
||||
if (requiresSync) {
|
||||
[LKSyncMessagesProtocol syncProfileUpdate];
|
||||
[LKSyncMessagesProtocol syncProfile];
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
@ -271,7 +271,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|||
}
|
||||
*/
|
||||
if (requiresSync) {
|
||||
[LKSyncMessagesProtocol syncProfileUpdate];
|
||||
[LKSyncMessagesProtocol syncProfile];
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
|
|
@ -24,14 +24,14 @@ public final class SyncMessagesProtocol : NSObject {
|
|||
return !UserDefaults.standard[.hasLaunchedOnce]
|
||||
}
|
||||
|
||||
@objc(syncProfileUpdate)
|
||||
public static func syncProfileUpdate() {
|
||||
storage.dbReadWriteConnection.readWrite{ transaction in
|
||||
let userHexEncodedPublicKey = getUserHexEncodedPublicKey()
|
||||
let linkedDevices = LokiDatabaseUtilities.getLinkedDeviceHexEncodedPublicKeys(for: userHexEncodedPublicKey, in: transaction)
|
||||
for hexEncodedPublicKey in linkedDevices {
|
||||
guard hexEncodedPublicKey != userHexEncodedPublicKey else { continue }
|
||||
let thread = TSContactThread.getOrCreateThread(withContactId: hexEncodedPublicKey, transaction: transaction)
|
||||
@objc(syncProfile)
|
||||
public static func syncProfile() {
|
||||
try! Storage.writeSync { transaction in
|
||||
let userPublicKey = getUserHexEncodedPublicKey()
|
||||
let linkedDevices = LokiDatabaseUtilities.getLinkedDeviceHexEncodedPublicKeys(for: userPublicKey, in: transaction)
|
||||
for publicKey in linkedDevices {
|
||||
guard publicKey != userPublicKey else { continue }
|
||||
let thread = TSContactThread.getOrCreateThread(withContactId: publicKey, transaction: transaction)
|
||||
let syncMessage = OWSOutgoingSyncMessage.init(in: thread, messageBody: "", attachmentId: nil)
|
||||
syncMessage.save(with: transaction)
|
||||
let messageSenderJobQueue = SSKEnvironment.shared.messageSenderJobQueue
|
||||
|
|
|
@ -1126,8 +1126,9 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
|
|||
|
||||
- (SSKProtoContentBuilder *)prepareCustomContentBuilder:(SignalRecipient *)recipient {
|
||||
SSKProtoDataMessage *_Nullable dataMessage = [self buildDataMessage:recipient.recipientId];
|
||||
|
||||
if (!dataMessage) {
|
||||
OWSFailDebug(@"could not build protobuf");
|
||||
OWSFailDebug(@"Couldn't build protobuf.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -1140,11 +1141,11 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
|
|||
- (nullable NSData *)buildPlainTextData:(SignalRecipient *)recipient
|
||||
{
|
||||
SSKProtoContentBuilder *contentBuilder = [self prepareCustomContentBuilder:recipient];
|
||||
|
||||
NSError *error;
|
||||
|
||||
NSData *_Nullable contentData = [contentBuilder buildSerializedDataAndReturnError:&error];
|
||||
if (error || !contentData) {
|
||||
OWSFailDebug(@"could not serialize protobuf: %@", error);
|
||||
OWSFailDebug(@"Couldn't serialize protobuf due to error: %@.", error);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue