Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Automation/capability-sync-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"schemaVersion": 1,
"upstreams": {
"nextcloud/server": {
"revision": "bcaf7e5646f6b4c37f76ea65cbe3d490fddacc8f"
"revision": "13ae34a4cd8ab2cfb4fc0215c2f99b3d7faf180c"
}
}
}
5 changes: 5 additions & 0 deletions Sources/NextcloudCapabilitiesKit/Theming.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand Down Expand Up @@ -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] ?? []
}
}
14 changes: 13 additions & 1 deletion Tests/NextcloudCapabilitiesKitTests/ThemingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"
)
}
}
Loading