Merge pull request #7817 from element-hq/release/1.11.15/release

This commit is contained in:
Mauro
2024-06-18 16:53:19 +02:00
committed by GitHub
8 changed files with 37 additions and 29 deletions

View File

@@ -1,8 +1,15 @@
## Changes in 1.11.14 (2024-06-17)
## Changes in 1.11.15 (2024-06-18)
No significant changes.
## Changes in 1.11.14 (2024-06-17)
🙌 Improvements
- Room retention event implementation ([#7809](https://github.com/element-hq/element-ios/pull/7809))
## Changes in 1.11.13 (2024-06-12)
Others

View File

@@ -15,5 +15,5 @@
//
// Version
MARKETING_VERSION = 1.11.14
CURRENT_PROJECT_VERSION = 1.11.14
MARKETING_VERSION = 1.11.15
CURRENT_PROJECT_VERSION = 1.11.15

View File

@@ -39,9 +39,9 @@ PODS:
- LoggerAPI (1.9.200):
- Logging (~> 1.1)
- Logging (1.4.0)
- MatrixSDK (0.27.9):
- MatrixSDK/Core (= 0.27.9)
- MatrixSDK/Core (0.27.9):
- MatrixSDK (0.27.10):
- MatrixSDK/Core (= 0.27.10)
- MatrixSDK/Core (0.27.10):
- AFNetworking (~> 4.0.0)
- GZIP (~> 1.3.0)
- libbase58 (~> 0.1.4)
@@ -49,7 +49,7 @@ PODS:
- OLMKit (~> 3.2.5)
- Realm (= 10.27.0)
- SwiftyBeaver (= 1.9.5)
- MatrixSDK/JingleCallStack (0.27.9):
- MatrixSDK/JingleCallStack (0.27.10):
- JitsiMeetSDKLite (= 8.1.2-lite)
- MatrixSDK/Core
- MatrixSDKCrypto (0.4.2)
@@ -187,7 +187,7 @@ SPEC CHECKSUMS:
libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75
LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d
Logging: beeb016c9c80cf77042d62e83495816847ef108b
MatrixSDK: 246fd1d3620afcbf8cb76794e9343ebf3cbf881b
MatrixSDK: c805f9306d60955215f4b15043ed0f96fd4867b3
MatrixSDKCrypto: 736069ee0a5ec12852ab3498bf2242acecc443fc
OLMKit: da115f16582e47626616874e20f7bb92222c7a51
ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d

View File

@@ -23,22 +23,21 @@ extension Notification.Name {
extension MXRoomSummary {
@objc static let roomSummaryDidRemoveExpiredDataFromStore = "roomSummaryDidRemoveExpiredDataFromStore"
@objc static let roomRetentionStateEventType = "m.room.retention"
@objc static let roomRetentionEventMaxLifetimeKey = "max_lifetime"
@objc static let roomRetentionMaxLifetime = "roomRetentionMaxLifetime"
private enum Constants {
static let roomRetentionInDaysKey = "roomRetentionInDays"
}
/// Get the room messages retention period in days
func roomRetentionPeriodInDays() -> uint {
if let period = self.others[Constants.roomRetentionInDaysKey] as? uint {
private func roomRetentionPeriodInMillis() -> UInt64 {
if let period = self.others[MXRoomSummary.roomRetentionMaxLifetime] as? UInt64 {
return period
} else {
return 365
return Tools.durationInMs(fromDays: 365)
}
}
/// Get the timestamp below which the received messages must be removed from the store, and the display
@objc func minimumTimestamp() -> UInt64 {
let periodInMs = Tools.durationInMs(fromDays: self.roomRetentionPeriodInDays())
let periodInMs = self.roomRetentionPeriodInMillis()
let currentTs = (UInt64)(Date().timeIntervalSince1970 * 1000)
return (currentTs - periodInMs)
}

View File

@@ -632,7 +632,14 @@ withVoiceBroadcastInfoStateEvent:lastVoiceBroadcastInfoEvent
- (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary withStateEvents:(NSArray<MXEvent *> *)stateEvents roomState:(MXRoomState *)roomState
{
BOOL updated = [super session:session updateRoomSummary:summary withStateEvents:stateEvents roomState:roomState];
MXEvent* lastRoomRetentionEvent = [self roomRetentionEventFromStateEvents:stateEvents];
if (lastRoomRetentionEvent)
{
summary.others[MXRoomSummary.roomRetentionMaxLifetime] = lastRoomRetentionEvent.content[MXRoomSummary.roomRetentionEventMaxLifetimeKey];
updated = YES;
}
// Customisation for EMS Functional Members in direct rooms
if (BuildSettings.supportFunctionalMembers && summary.room.isDirect)
{
@@ -645,7 +652,7 @@ withVoiceBroadcastInfoStateEvent:lastVoiceBroadcastInfoEvent
// room name which we'll do twice more in updateRoomSummary:withServerRoomSummary:roomState: anyway.
//
// So return YES and let that happen there.
return YES;
updated = YES;
}
}
@@ -801,6 +808,12 @@ withVoiceBroadcastInfoStateEvent:lastVoiceBroadcastInfoEvent
return [stateEvents filteredArrayUsingPredicate:functionalMembersPredicate].lastObject;
}
- (MXEvent *)roomRetentionEventFromStateEvents:(NSArray<MXEvent *> *)stateEvents
{
NSPredicate *functionalMembersPredicate = [NSPredicate predicateWithFormat:@"type == %@", kMXEventTypeStringRoomRetention];
return [stateEvents filteredArrayUsingPredicate:functionalMembersPredicate].lastObject;
}
#pragma mark - Timestamp formatting
- (NSString*)dateStringFromDate:(NSDate *)date withTime:(BOOL)time

View File

@@ -55,10 +55,4 @@
*/
+ (uint64_t)durationInMsFromDays:(uint)days;
/**
* Convert a duration in ms to a number of days.
*/
+ (uint)numberOfDaysFromDurationInMs:(uint64_t)duration;
@end

View File

@@ -124,9 +124,4 @@
return days * (uint64_t)(86400000);
}
+ (uint)numberOfDaysFromDurationInMs:(uint64_t)duration
{
return (uint)(duration / 86400000);
}
@end