diff options
Diffstat (limited to 'ios/Operations/BlockCondition.swift')
| -rw-r--r-- | ios/Operations/BlockCondition.swift | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ios/Operations/BlockCondition.swift b/ios/Operations/BlockCondition.swift new file mode 100644 index 0000000000..e6aafa1e2d --- /dev/null +++ b/ios/Operations/BlockCondition.swift @@ -0,0 +1,30 @@ +// +// BlockCondition.swift +// Operations +// +// Created by pronebird on 25/09/2022. +// Copyright © 2022 Mullvad VPN AB. All rights reserved. +// + +import Foundation + +public final class BlockCondition: OperationCondition { + public typealias HandlerBlock = (Operation, @escaping (Bool) -> Void) -> Void + + public var name: String { + return "BlockCondition" + } + + public var isMutuallyExclusive: Bool { + return false + } + + public let block: HandlerBlock + public init(block: @escaping HandlerBlock) { + self.block = block + } + + public func evaluate(for operation: Operation, completion: @escaping (Bool) -> Void) { + block(operation, completion) + } +} |
