IOS-827 uses switch to assure all cases are handled.
authorbuff <andreas@pep-project.org>
Mon, 04 Dec 2017 17:14:26 +0100
changeset 3520029110350584
parent 3519 b3f8285c5551
child 3521 2628538df4d5
IOS-827 uses switch to assure all cases are handled.
pEpForiOS/UI/Compose/ComposeTableViewController.swift
     1.1 --- a/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Mon Dec 04 16:31:42 2017 +0100
     1.2 +++ b/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Mon Dec 04 17:14:26 2017 +0100
     1.3 @@ -154,11 +154,12 @@
     1.4              return
     1.5          }
     1.6          origin = om.parent.account.user
     1.7 -        if composeMode == .replyFrom {
     1.8 +        switch composeMode {
     1.9 +        case .replyFrom:
    1.10              if let from = om.from {
    1.11                  destinyTo.append(from)
    1.12              }
    1.13 -        } else if composeMode == .replyAll {
    1.14 +        case .replyAll:
    1.15              if let from = om.from {
    1.16                  destinyTo.append(from)
    1.17              }
    1.18 @@ -171,7 +172,14 @@
    1.19              for id in om.cc {
    1.20                  destinyCc.append(id)
    1.21              }
    1.22 -        } else if composeMode == .draft {
    1.23 +            case .normal:
    1.24 +                // Do nothing, has no recipient by definition, can not be send.
    1.25 +            break
    1.26 +        case .forward:
    1.27 +            // Do nothing. A initial forwarded message has no recipient by definition and thus
    1.28 +            // can not be send.
    1.29 +            break
    1.30 +        case .draft:
    1.31              for id in om.to {
    1.32                  destinyTo.append(id)
    1.33              }
    1.34 @@ -181,9 +189,6 @@
    1.35              for id in om.bcc {
    1.36                  destinyBcc.append(id)
    1.37              }
    1.38 -        } else {
    1.39 -            Log.shared.errorAndCrash(component: #function,
    1.40 -                                     errorString: "Unhadled case for having an original message")
    1.41          }
    1.42  
    1.43          if (!destinyCc.isEmpty || !destinyTo.isEmpty || !destinyBcc.isEmpty) {