From 1e5c76ca43f9a9562b1cb68787a6dccc527a62a4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 03:55:11 +0000 Subject: [PATCH] feat: sync Nextcloud capabilities: theming toast timeout Add toastTimeout and toastTimeoutValues to the Theming capability model, reflecting a new public field added by nextcloud/server. Advance the capability-sync state to the latest reviewed upstream revision. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Automation/capability-sync-state.json | 2 +- Sources/NextcloudCapabilitiesKit/Theming.swift | 5 +++++ .../ThemingTests.swift | 14 +++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Automation/capability-sync-state.json b/Automation/capability-sync-state.json index 244f0db..049e4ec 100644 --- a/Automation/capability-sync-state.json +++ b/Automation/capability-sync-state.json @@ -4,7 +4,7 @@ "schemaVersion": 1, "upstreams": { "nextcloud/server": { - "revision": "bcaf7e5646f6b4c37f76ea65cbe3d490fddacc8f" + "revision": "13ae34a4cd8ab2cfb4fc0215c2f99b3d7faf180c" } } } diff --git a/Sources/NextcloudCapabilitiesKit/Theming.swift b/Sources/NextcloudCapabilitiesKit/Theming.swift index fdffe63..8d829b7 100644 --- a/Sources/NextcloudCapabilitiesKit/Theming.swift +++ b/Sources/NextcloudCapabilitiesKit/Theming.swift @@ -29,6 +29,8 @@ public struct Theming: Equatable, Sendable { public let inverted: Bool public let cacheBuster: String public let enabledThemes: [String] + public let toastTimeout: Int? + public let toastTimeoutValues: [Int] @available(*, deprecated, renamed: "logoURL") public var logoUrl: URL? { @@ -76,5 +78,8 @@ public struct Theming: Equatable, Sendable { inverted = capabilities["inverted"] as? Bool ?? false cacheBuster = capabilities["cacheBuster"] as? String ?? "" enabledThemes = capabilities["enabledThemes"] as? [String] ?? [] + // Absent on servers older than the toast timeout feature; treat as unset. + toastTimeout = capabilities["toastTimeout"] as? Int + toastTimeoutValues = capabilities["toastTimeoutValues"] as? [Int] ?? [] } } diff --git a/Tests/NextcloudCapabilitiesKitTests/ThemingTests.swift b/Tests/NextcloudCapabilitiesKitTests/ThemingTests.swift index dc1aab3..623a257 100644 --- a/Tests/NextcloudCapabilitiesKitTests/ThemingTests.swift +++ b/Tests/NextcloudCapabilitiesKitTests/ThemingTests.swift @@ -22,12 +22,19 @@ class ThemingTests: XCTestCase { "background-plain": true, "background-default": false, "logoheader": "https://example.com/logoheader", - "favicon": "https://example.com/favicon" + "favicon": "https://example.com/favicon", + "toastTimeout": 15000, + "toastTimeoutValues": [7000, 15000, 30000, -1] ] ] let theming = Theming(capabilities: capabilities) XCTAssertNotNil(theming, "Theming instance should be created with valid input") + XCTAssertEqual(theming?.toastTimeout, 15000, "Theming toastTimeout should match the provided value") + XCTAssertEqual( + theming?.toastTimeoutValues, [7000, 15000, 30000, -1], + "Theming toastTimeoutValues should match the provided value" + ) XCTAssertEqual(theming?.name, "Theme Name", "Theming name should match the provided value") XCTAssertEqual(theming?.url, URL(string: "https://example.com"), "Theming URL should match the provided URL") XCTAssertEqual(theming?.slogan, "Theme Slogan", "Theming slogan should match the provided value") @@ -71,5 +78,10 @@ class ThemingTests: XCTestCase { XCTAssertEqual(theming?.url, nil, "Theming URL should default to nil with partial input") XCTAssertEqual(theming?.logoUrl, nil, "Theming logo URL should default to nil with partial input") XCTAssertEqual(theming?.backgroundColor, "", "Theming backgroundColor should default to an empty string with partial input") + XCTAssertNil(theming?.toastTimeout, "Theming toastTimeout should default to nil without a value from the server") + XCTAssertEqual( + theming?.toastTimeoutValues, [], + "Theming toastTimeoutValues should default to an empty array without a value from the server" + ) } }