From 4c1a9fa4ecc08aa41a68e285967c93f3b515bc8d Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 18 Oct 2024 17:54:50 +0200 Subject: [PATCH] when using chatmail, the only reasonable delete-from-server-options are delete-once and automatic (as the chatmail server deletetes from server anyways at some point) --- .../AutodelOptionsViewController.swift | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/deltachat-ios/Controller/Settings/AutodelOptionsViewController.swift b/deltachat-ios/Controller/Settings/AutodelOptionsViewController.swift index fcd6078f9..8c071ba8e 100644 --- a/deltachat-ios/Controller/Settings/AutodelOptionsViewController.swift +++ b/deltachat-ios/Controller/Settings/AutodelOptionsViewController.swift @@ -21,20 +21,27 @@ class AutodelOptionsViewController: UITableViewController { ] }() - private static let autodelServerOptions: [Options] = { - return [ - Options(value: 0, descr: "never"), - Options(value: 1, descr: "autodel_at_once"), - Options(value: 60 * 60, descr: "autodel_after_1_hour"), - Options(value: 24 * 60 * 60, descr: "autodel_after_1_day"), - Options(value: 7 * 24 * 60 * 60, descr: "autodel_after_1_week"), - Options(value: 5 * 7 * 24 * 60 * 60, descr: "after_5_weeks"), - Options(value: 365 * 24 * 60 * 60, descr: "autodel_after_1_year"), - ] - }() + private static func autodelServerOptions(_ dcContext: DcContext) -> [Options] { + if dcContext.isChatmail { + return [ + Options(value: 0, descr: "automatic"), + Options(value: 1, descr: "autodel_at_once"), + ] + } else { + return [ + Options(value: 0, descr: "never"), + Options(value: 1, descr: "autodel_at_once"), + Options(value: 60 * 60, descr: "autodel_after_1_hour"), + Options(value: 24 * 60 * 60, descr: "autodel_after_1_day"), + Options(value: 7 * 24 * 60 * 60, descr: "autodel_after_1_week"), + Options(value: 5 * 7 * 24 * 60 * 60, descr: "after_5_weeks"), + Options(value: 365 * 24 * 60 * 60, descr: "autodel_after_1_year"), + ] + } + } private lazy var autodelOptions: [Options] = { - return fromServer ? AutodelOptionsViewController.autodelServerOptions : AutodelOptionsViewController.autodelDeviceOptions + return fromServer ? AutodelOptionsViewController.autodelServerOptions(dcContext) : AutodelOptionsViewController.autodelDeviceOptions }() var fromServer: Bool @@ -80,7 +87,7 @@ class AutodelOptionsViewController: UITableViewController { static public func getSummary(_ dcContext: DcContext, fromServer: Bool) -> String { let val = dcContext.getConfigInt(fromServer ? "delete_server_after" : "delete_device_after") - let options = fromServer ? AutodelOptionsViewController.autodelServerOptions : AutodelOptionsViewController.autodelDeviceOptions + let options = fromServer ? AutodelOptionsViewController.autodelServerOptions(dcContext) : AutodelOptionsViewController.autodelDeviceOptions for option in options { if option.value == val { return String.localized(option.descr)