mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Content Scanning View (#5831)
* implement a MediaView to delegate at the view level the usage of the content scanner service, to determine how to render the media. * fix for a small design mismatch * fix for greedy error state * updated naming * just making some screenshot that have been affected by a string change on Localazy * pr suggestions + updated strings
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
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?
|
||||
}
|
||||
|
||||
extension ContentScannerServiceMock {
|
||||
convenience init(_ configuration: ContentScannerServiceMockConfiguration) {
|
||||
self.init()
|
||||
|
||||
scanResultFromSourceReturnValue = configuration.scanResult
|
||||
loadScanResultFromSourceClosure = { _ in
|
||||
guard let scanResult = configuration.scanResult else {
|
||||
try? await Task.sleep(for: .seconds(3600))
|
||||
return .failure(.failedScanning)
|
||||
}
|
||||
return .success(scanResult)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user