Be more explicit about expire timer.
This commit is contained in:
parent
3f9eb603eb
commit
71972ebe2f
@ -54,6 +54,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
[contactBuilder setProfileKey:profileKeyData];
|
||||
}
|
||||
|
||||
// Always ensure the "expire timer" property is set so that desktop
|
||||
// can easily distinguish between a modern client declaring "off" vs a
|
||||
// legacy client "not specifying".
|
||||
[contactBuilder setExpireTimer:0];
|
||||
|
||||
TSContactThread *_Nullable contactThread = [TSContactThread getThreadWithContactId:signalAccount.recipientId];
|
||||
if (contactThread) {
|
||||
OWSDisappearingMessagesConfiguration *_Nullable disappearingMessagesConfiguration =
|
||||
@ -61,11 +66,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
if (disappearingMessagesConfiguration && disappearingMessagesConfiguration.isEnabled) {
|
||||
[contactBuilder setExpireTimer:disappearingMessagesConfiguration.durationSeconds];
|
||||
} else {
|
||||
// Rather than *not* set the field, we expicitly set it to 0 so desktop
|
||||
// can easily distinguish between a modern client declaring "off" vs a
|
||||
// legacy client "not specifying".
|
||||
[contactBuilder setExpireTimer:0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,12 +6,12 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class TSGroupModel;
|
||||
@class TSGroupThread;
|
||||
@class YapDatabaseReadTransaction;
|
||||
|
||||
@interface OWSGroupsOutputStream : OWSChunkedOutputStream
|
||||
|
||||
- (void)writeGroup:(TSGroupModel *)group transaction:(YapDatabaseReadTransaction *)transaction;
|
||||
- (void)writeGroup:(TSGroupThread *)groupThread transaction:(YapDatabaseReadTransaction *)transaction;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -14,11 +14,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation OWSGroupsOutputStream
|
||||
|
||||
- (void)writeGroup:(TSGroupModel *)group transaction:(YapDatabaseReadTransaction *)transaction
|
||||
- (void)writeGroup:(TSGroupThread *)groupThread transaction:(YapDatabaseReadTransaction *)transaction
|
||||
{
|
||||
OWSAssert(group);
|
||||
OWSAssert(groupThread);
|
||||
OWSAssert(transaction);
|
||||
|
||||
TSGroupModel *group = groupThread.groupModel;
|
||||
OWSAssert(group);
|
||||
|
||||
OWSSignalServiceProtosGroupDetailsBuilder *groupBuilder = [OWSSignalServiceProtosGroupDetailsBuilder new];
|
||||
[groupBuilder setId:group.groupId];
|
||||
[groupBuilder setName:group.groupName];
|
||||
@ -35,19 +38,16 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
[groupBuilder setAvatarBuilder:avatarBuilder];
|
||||
}
|
||||
|
||||
TSGroupThread *_Nullable groupThread = [TSGroupThread threadWithGroupId:group.groupId transaction:transaction];
|
||||
if (groupThread) {
|
||||
OWSDisappearingMessagesConfiguration *_Nullable disappearingMessagesConfiguration =
|
||||
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:groupThread.uniqueId transaction:transaction];
|
||||
OWSDisappearingMessagesConfiguration *_Nullable disappearingMessagesConfiguration =
|
||||
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:groupThread.uniqueId transaction:transaction];
|
||||
|
||||
if (disappearingMessagesConfiguration && disappearingMessagesConfiguration.isEnabled) {
|
||||
[groupBuilder setExpireTimer:disappearingMessagesConfiguration.durationSeconds];
|
||||
} else {
|
||||
// Rather than *not* set the field, we expicitly set it to 0 so desktop
|
||||
// can easily distinguish between a modern client declaring "off" vs a
|
||||
// legacy client "not specifying".
|
||||
[groupBuilder setExpireTimer:0];
|
||||
}
|
||||
if (disappearingMessagesConfiguration && disappearingMessagesConfiguration.isEnabled) {
|
||||
[groupBuilder setExpireTimer:disappearingMessagesConfiguration.durationSeconds];
|
||||
} else {
|
||||
// Rather than *not* set the field, we expicitly set it to 0 so desktop
|
||||
// can easily distinguish between a modern client declaring "off" vs a
|
||||
// legacy client "not specifying".
|
||||
[groupBuilder setExpireTimer:0];
|
||||
}
|
||||
|
||||
NSData *groupData = [[groupBuilder build] data];
|
||||
|
||||
@ -56,8 +56,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
DDLogVerbose(@"Ignoring non group thread in thread collection: %@", obj);
|
||||
return;
|
||||
}
|
||||
TSGroupModel *group = ((TSGroupThread *)obj).groupModel;
|
||||
[groupsOutputStream writeGroup:group transaction:transaction];
|
||||
TSGroupThread *groupThread = (TSGroupThread *)obj;
|
||||
[groupsOutputStream writeGroup:groupThread transaction:transaction];
|
||||
}];
|
||||
|
||||
[groupsOutputStream flush];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user