Compare commits

...

8 Commits

5 changed files with 55 additions and 22 deletions

View File

@ -6682,7 +6682,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 427;
CURRENT_PROJECT_VERSION = 428;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@ -6706,7 +6706,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.4.3;
MARKETING_VERSION = 2.4.4;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -6754,7 +6754,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 427;
CURRENT_PROJECT_VERSION = 428;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = SUQ8J2PCT7;
ENABLE_NS_ASSERTIONS = NO;
@ -6783,7 +6783,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.4.3;
MARKETING_VERSION = 2.4.4;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -6819,7 +6819,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 427;
CURRENT_PROJECT_VERSION = 428;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@ -6842,7 +6842,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.4.3;
MARKETING_VERSION = 2.4.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
@ -6893,7 +6893,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 427;
CURRENT_PROJECT_VERSION = 428;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = SUQ8J2PCT7;
ENABLE_NS_ASSERTIONS = NO;
@ -6921,7 +6921,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.4.3;
MARKETING_VERSION = 2.4.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
@ -7853,7 +7853,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 427;
CURRENT_PROJECT_VERSION = 428;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -7891,7 +7891,7 @@
"$(SRCROOT)",
);
LLVM_LTO = NO;
MARKETING_VERSION = 2.4.3;
MARKETING_VERSION = 2.4.4;
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
@ -7924,7 +7924,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 427;
CURRENT_PROJECT_VERSION = 428;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -7962,7 +7962,7 @@
"$(SRCROOT)",
);
LLVM_LTO = NO;
MARKETING_VERSION = 2.4.3;
MARKETING_VERSION = 2.4.4;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
PRODUCT_NAME = Session;

View File

@ -494,13 +494,16 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
guard !Features.useNewDisappearingMessagesConfig else { return nil }
return UInt32(floor(updatedConfig.isEnabled ? updatedConfig.durationSeconds : 0))
}()
let expirationTimerUpdateMessage: ExpirationTimerUpdate = ExpirationTimerUpdate(
syncTarget: nil,
duration: duration
)
expirationTimerUpdateMessage.sentTimestamp = UInt64(currentTimestampMs)
try MessageSender.send(
db,
message: ExpirationTimerUpdate(
syncTarget: nil,
duration: duration
),
message: expirationTimerUpdateMessage,
interactionId: interactionId,
threadId: threadId,
threadVariant: threadVariant,

View File

@ -1,7 +1,5 @@
{
"urls": ["turn:freyr.getsession.org",
"turn:fenrir.getsession.org",
"turn:frigg.getsession.org",
"turn:angus.getsession.org",
"turn:hereford.getsession.org",
"turn:holstein.getsession.org",

View File

@ -276,6 +276,22 @@ public extension DisappearingMessagesConfiguration {
}
}
let expiresStartedAtMs: Double? = {
if updatedConfiguration.type == .disappearAfterSend ||
SessionUtil.timestampAlreadyRead(
threadId: threadId,
threadVariant: threadVariant,
timestampMs: timestampMs,
userPublicKey: getUserHexEncodedPublicKey(db),
openGroup: nil
)
{
return Double(timestampMs)
}
return nil
}()
let interaction = try Interaction(
serverHash: serverHash,
threadId: threadId,
@ -288,7 +304,7 @@ public extension DisappearingMessagesConfiguration {
),
timestampMs: timestampMs,
expiresInSeconds: updatedConfiguration.durationSeconds,
expiresStartedAtMs: (updatedConfiguration.type == .disappearAfterSend ? Double(timestampMs) : nil)
expiresStartedAtMs: expiresStartedAtMs
).inserted(db)
return interaction.id

View File

@ -72,7 +72,7 @@ public enum GetExpirationJob: JobExecutor {
result[next.key] = TimeInterval(next.value - UInt64(expiresInSeconds * 1000))
}
let hashesToUseDefault: Set<String> = Set(expirationInfo.keys)
var hashesWithNoExiprationInfo: Set<String> = Set(expirationInfo.keys)
.subtracting(serverSpecifiedExpirationStartTimesMs.keys)
dependencies.storage.write(using: dependencies) { db in
@ -85,8 +85,24 @@ public enum GetExpirationJob: JobExecutor {
)
}
let inferredExpiredMessageHashes: Set<String> = (try? Interaction
.select(Interaction.Columns.serverHash)
.filter(hashesWithNoExiprationInfo.contains(Interaction.Columns.serverHash))
.filter(Interaction.Columns.timestampMs + (Interaction.Columns.expiresInSeconds * 1000) <= details.startedAtTimestampMs)
.asRequest(of: String.self)
.fetchSet(db))
.defaulting(to: [])
hashesWithNoExiprationInfo = hashesWithNoExiprationInfo.subtracting(inferredExpiredMessageHashes)
if !inferredExpiredMessageHashes.isEmpty {
try Interaction
.filter(inferredExpiredMessageHashes.contains(Interaction.Columns.serverHash))
.deleteAll(db)
}
try Interaction
.filter(hashesToUseDefault.contains(Interaction.Columns.serverHash))
.filter(hashesWithNoExiprationInfo.contains(Interaction.Columns.serverHash))
.filter(Interaction.Columns.expiresStartedAtMs == nil)
.updateAll(
db,
@ -102,7 +118,7 @@ public enum GetExpirationJob: JobExecutor {
)
}
guard hashesToUseDefault.isEmpty else {
guard hashesWithNoExiprationInfo.isEmpty else {
let updatedJob: Job? = dependencies.storage.write(using: dependencies) { db in
try job
.with(nextRunTimestamp: dependencies.dateNow.timeIntervalSince1970 + minRunFrequency)