IOS-1737 specific segue for iphone and ipad showing a message IOS-1737
authorXavier Algarra <xavier@pep-project.org>
Mon, 05 Aug 2019 15:08:20 +0200
branchIOS-1737
changeset 9534d401fb21020b
parent 9527 a7cdb6c72cc4
child 9535 cfc972409286
IOS-1737 specific segue for iphone and ipad showing a message
pEpForiOS/Base.lproj/Main.storyboard
pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift
     1.1 --- a/pEpForiOS/Base.lproj/Main.storyboard	Wed Jul 31 12:15:58 2019 +0200
     1.2 +++ b/pEpForiOS/Base.lproj/Main.storyboard	Mon Aug 05 15:08:20 2019 +0200
     1.3 @@ -165,10 +165,11 @@
     1.4                          <segue destination="NY2-HI-4ou" kind="presentation" identifier="segueReply" id="I15-Dm-oo1"/>
     1.5                          <segue destination="NY2-HI-4ou" kind="presentation" identifier="segueEditDraft" id="fJ0-cY-ZEb"/>
     1.6                          <segue destination="WY0-yJ-1SU" kind="presentation" identifier="segueShowMoveToFolder" id="d5O-Wk-gjZ"/>
     1.7 -                        <segue destination="lPr-gi-BrG" kind="showDetail" identifier="segueShowEmail" id="63y-AC-Fyu"/>
     1.8 +                        <segue destination="lPr-gi-BrG" kind="showDetail" identifier="segueShowEmailIpad" id="63y-AC-Fyu"/>
     1.9                          <segue destination="wwj-Sj-78N" kind="showDetail" identifier="showNoMessage" id="a9I-b0-iqU"/>
    1.10                          <segue destination="eLD-PA-Nmx" kind="showDetail" identifier="segueShowThreadedEmail" id="rUh-Ai-iWA"/>
    1.11                          <segue destination="nc4-kR-K9D" kind="show" identifier="segueShowFilter" id="kQS-uu-oHl"/>
    1.12 +                        <segue destination="3bx-34-vLD" kind="show" identifier="segueShowEmailIphone" id="5Kn-pc-9Jc"/>
    1.13                      </connections>
    1.14                  </tableViewController>
    1.15                  <placeholder placeholderIdentifier="IBFirstResponder" id="d8T-vB-XpT" userLabel="First Responder" sceneMemberID="firstResponder"/>
    1.16 @@ -917,9 +918,9 @@
    1.17          <image name="unread-icon" width="25" height="25"/>
    1.18      </resources>
    1.19      <inferredMetricsTieBreakers>
    1.20 -        <segue reference="RTR-We-Kc1"/>
    1.21 +        <segue reference="d5O-Wk-gjZ"/>
    1.22          <segue reference="0zl-tV-6Kr"/>
    1.23 -        <segue reference="anx-J8-OKE"/>
    1.24 -        <segue reference="Usl-iS-7fo"/>
    1.25 +        <segue reference="5Kn-pc-9Jc"/>
    1.26 +        <segue reference="I15-Dm-oo1"/>
    1.27      </inferredMetricsTieBreakers>
    1.28  </document>
     2.1 --- a/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Wed Jul 31 12:15:58 2019 +0200
     2.2 +++ b/pEpForiOS/UI/EmailDisplayList/EmailListViewController.swift	Mon Aug 05 15:08:20 2019 +0200
     2.3 @@ -218,7 +218,14 @@
     2.4      }
     2.5  
     2.6      private func showEmail(forCellAt indexPath: IndexPath) {
     2.7 -        performSegue(withIdentifier: SegueIdentifier.segueShowEmail, sender: self)
     2.8 +        guard let splitViewController = self.splitViewController else {
     2.9 +            return
    2.10 +        }
    2.11 +        if splitViewController.isCollapsed {
    2.12 +            performSegue(withIdentifier: SegueIdentifier.segueShowEmailIphone, sender: self)
    2.13 +        } else {
    2.14 +            performSegue(withIdentifier: SegueIdentifier.segueShowEmailIpad, sender: self)
    2.15 +        }
    2.16      }
    2.17  
    2.18      private func showNoMessageSelectedIfNeeded() {
    2.19 @@ -1055,7 +1062,8 @@
    2.20      
    2.21      enum SegueIdentifier: String {
    2.22          case segueAddNewAccount
    2.23 -        case segueShowEmail
    2.24 +        case segueShowEmailIpad
    2.25 +        case segueShowEmailIphone
    2.26          case segueCompose
    2.27          case segueReply
    2.28          case segueReplyAll
    2.29 @@ -1078,7 +1086,7 @@
    2.30               .segueCompose,
    2.31               .segueEditDraft:
    2.32              setupComposeViewController(for: segue)
    2.33 -        case .segueShowEmail:
    2.34 +        case .segueShowEmailIpad:
    2.35              guard let nav = segue.destination as? UINavigationController,
    2.36                  let vc = nav.rootViewController as? EmailViewController,
    2.37                  let indexPath = lastSelectedIndexPath,
    2.38 @@ -1093,6 +1101,21 @@
    2.39              vc.delegate = model
    2.40              model?.currentDisplayedMessage = vc
    2.41              model?.indexPathShown = indexPath
    2.42 +        case .segueShowEmailIphone:
    2.43 +            guard let vc = segue.destination as? EmailViewController,
    2.44 +                let indexPath = lastSelectedIndexPath,
    2.45 +                let message = model?.message(representedByRowAt: indexPath) else {
    2.46 +                    Log.shared.errorAndCrash("Segue issue")
    2.47 +                    return
    2.48 +            }
    2.49 +            vc.appConfig = appConfig
    2.50 +            vc.message = message
    2.51 +            //vc.folderShow = model?.getFolderToShow()
    2.52 +            vc.messageId = indexPath.row //!!!: that looks wrong
    2.53 +            vc.delegate = model
    2.54 +            model?.currentDisplayedMessage = vc
    2.55 +            model?.indexPathShown = indexPath
    2.56 +
    2.57        //  case .segueShowThreadedEmail:
    2.58          /*    guard let nav = segue.destination as? UINavigationController,
    2.59                  let vc = nav.rootViewController as? ThreadViewController,