mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Render image and video in galleries as a grid (#5929)
This commit is contained in:
@@ -11,15 +11,20 @@ struct ContentScannerServiceMockConfiguration {
|
||||
/// The verdict reported for every source: `true` when safe, `false` when unsafe, or `nil` to
|
||||
/// never resolve the scan so that the scanning state remains visible.
|
||||
var scanResult: Bool?
|
||||
/// Overrides `scanResult` on a per-source basis, using the same `true`/`false`/`nil` semantics.
|
||||
var perSourceScanResult: (@Sendable (MediaSourceProxy) -> Bool?)?
|
||||
}
|
||||
|
||||
extension ContentScannerServiceMock {
|
||||
convenience init(_ configuration: ContentScannerServiceMockConfiguration) {
|
||||
self.init()
|
||||
|
||||
scanResultFromSourceReturnValue = configuration.scanResult
|
||||
loadScanResultFromSourceClosure = { _ in
|
||||
guard let scanResult = configuration.scanResult else {
|
||||
let blanketScanResult = configuration.scanResult
|
||||
let resolve: @Sendable (MediaSourceProxy) -> Bool? = configuration.perSourceScanResult ?? { _ in blanketScanResult }
|
||||
|
||||
scanResultFromSourceClosure = { resolve($0) }
|
||||
loadScanResultFromSourceClosure = { source in
|
||||
guard let scanResult = resolve(source) else {
|
||||
try? await Task.sleep(for: .seconds(3600))
|
||||
return .failure(.failedScanning)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user