Skip to content

Commit 9921762

Browse files
committed
Cleaner non standard input handler invocation (#57)
1 parent 8358edc commit 9921762

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

Sources/MuxUploadSDK/PublicAPI/MuxUpload.swift

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -486,17 +486,11 @@ public final class MuxUpload : Hashable, Equatable {
486486

487487
switch inspectionResult {
488488
case .inspectionFailure:
489-
// TODO: Request upload confirmation
490-
// before proceeding
491-
492-
guard let nonStandardInputHandler = self.nonStandardInputHandler else {
493-
self.startNetworkTransport(
494-
videoFile: videoFile
495-
)
496-
return
497-
}
498-
499-
let shouldCancelUpload = nonStandardInputHandler()
489+
// Request upload confirmation
490+
// before proceeding. If handler unset,
491+
// by default do not cancel upload if
492+
// input standardization fails
493+
let shouldCancelUpload = self.nonStandardInputHandler?() ?? false
500494

501495
if !shouldCancelUpload {
502496
self.startNetworkTransport(
@@ -548,14 +542,11 @@ public final class MuxUpload : Hashable, Equatable {
548542
videoFile: outputURL
549543
)
550544
} else {
551-
guard let nonStandardInputHandler = self.nonStandardInputHandler else {
552-
self.startNetworkTransport(
553-
videoFile: videoFile
554-
)
555-
return
556-
}
557-
558-
let shouldCancelUpload = nonStandardInputHandler()
545+
// Request upload confirmation
546+
// before proceeding. If handler unset,
547+
// by default do not cancel upload if
548+
// input standardization fails
549+
let shouldCancelUpload = self.nonStandardInputHandler?() ?? false
559550

560551
if !shouldCancelUpload {
561552
self.startNetworkTransport(

0 commit comments

Comments
 (0)