From fe9cb2e2f0b9b740eadda8ae636e910b70713c0d Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 9 Apr 2025 15:49:40 +0300 Subject: [PATCH] Setup the client media retention policy --- ElementX/Sources/Services/Client/ClientProxy.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 618a8bdd0..667fea153 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -215,6 +215,19 @@ class ClientProxy: ClientProxyProtocol { } } .store(in: &cancellables) + + Task { + do { + try await client.setMediaRetentionPolicy(policy: .init(maxCacheSize: nil, + maxFileSize: nil, + // 30 days in seconds + lastAccessExpiry: 30 * 24 * 60 * 60, + // 1 day in seconds + cleanupFrequency: 24 * 60 * 60)) + } catch { + MXLog.error("Failed setting media retention policy with error: \(error)") + } + } } var userID: String {