Skip to content

Commit

Permalink
Merge branch 'release/1.11.15/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Jun 18, 2024
2 parents cd1b5a5 + 0c07ae2 commit 942c85e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 29 deletions.
9 changes: 8 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Config/AppVersion.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ 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)
- MatrixSDKCrypto (= 0.4.2)
- 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)
Expand Down Expand Up @@ -187,7 +187,7 @@ SPEC CHECKSUMS:
libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75
LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d
Logging: beeb016c9c80cf77042d62e83495816847ef108b
MatrixSDK: 246fd1d3620afcbf8cb76794e9343ebf3cbf881b
MatrixSDK: c805f9306d60955215f4b15043ed0f96fd4867b3
MatrixSDKCrypto: 736069ee0a5ec12852ab3498bf2242acecc443fc
OLMKit: da115f16582e47626616874e20f7bb92222c7a51
ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d
Expand Down
13 changes: 6 additions & 7 deletions Riot/Categories/MXRoomSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
17 changes: 15 additions & 2 deletions Riot/Utils/EventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,14 @@ - (MXEvent *)voiceBroadcastInfoStartedEventWithEvent:(MXEvent *)voiceBroadcastIn
- (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)
{
Expand All @@ -645,7 +652,7 @@ - (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary
// 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;
}
}

Expand Down Expand Up @@ -801,6 +808,12 @@ - (MXEvent *)functionalMembersEventFromStateEvents:(NSArray<MXEvent *> *)stateEv
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
Expand Down
6 changes: 0 additions & 6 deletions Riot/Utils/Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions Riot/Utils/Tools.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,4 @@ + (uint64_t)durationInMsFromDays:(uint)days
return days * (uint64_t)(86400000);
}

+ (uint)numberOfDaysFromDurationInMs:(uint64_t)duration
{
return (uint)(duration / 86400000);
}

@end

0 comments on commit 942c85e

Please sign in to comment.