summaryrefslogtreecommitdiffhomepage
path: root/ios/Operations/NoCancelledDependenciesCondition.swift
blob: 82cb259951e8d0e381275c305cb1c209325acdca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
//  NoCancelledDependenciesCondition.swift
//  Operations
//
//  Created by pronebird on 25/09/2022.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import Foundation

public final class NoCancelledDependenciesCondition: OperationCondition {
    public var name: String {
        "NoCancelledDependenciesCondition"
    }

    public var isMutuallyExclusive: Bool {
        false
    }

    public init() {}

    public func evaluate(for operation: Operation, completion: @escaping (Bool) -> Void) {
        let satisfy = operation.dependencies.allSatisfy { operation in
            !operation.isCancelled
        }

        completion(satisfy)
    }
}