merge
authorDirk Zimmermann <dirk@pep-project.org>
Fri, 03 Feb 2017 15:32:25 +0100
changeset 162730628bec098c
parent 1626 cd601d49c7d9
parent 1623 de640fc8295f
child 1628 dc16245bcd30
merge
     1.1 --- a/pEpForiOS/Base.lproj/Main.storyboard	Fri Feb 03 14:46:28 2017 +0100
     1.2 +++ b/pEpForiOS/Base.lproj/Main.storyboard	Fri Feb 03 15:32:25 2017 +0100
     1.3 @@ -139,6 +139,7 @@
     1.4                      <connections>
     1.5                          <outlet property="searchDisplayController" destination="wi1-9j-AQt" id="5ik-CT-83m"/>
     1.6                          <segue destination="Efv-29-FEv" kind="presentation" identifier="segueAddNewAccount" id="Na7-CM-lbe"/>
     1.7 +                        <segue destination="NY2-HI-4ou" kind="presentation" identifier="segueReplyAll" id="xmi-xn-p8T"/>
     1.8                      </connections>
     1.9                  </tableViewController>
    1.10                  <placeholder placeholderIdentifier="IBFirstResponder" id="d8T-vB-XpT" userLabel="First Responder" sceneMemberID="firstResponder"/>
    1.11 @@ -1752,7 +1753,7 @@
    1.12              <objects>
    1.13                  <navigationController automaticallyAdjustsScrollViewInsets="NO" id="C7k-Jh-fNo" sceneMemberID="viewController">
    1.14                      <toolbarItems/>
    1.15 -                    <navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" id="IxL-Z3-iil">
    1.16 +                    <navigationBar key="navigationBar" contentMode="scaleToFill" id="IxL-Z3-iil">
    1.17                          <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
    1.18                          <autoresizingMask key="autoresizingMask"/>
    1.19                      </navigationBar>
    1.20 @@ -1765,7 +1766,7 @@
    1.21              </objects>
    1.22              <point key="canvasLocation" x="4185" y="-982"/>
    1.23          </scene>
    1.24 -        <!--Title-->
    1.25 +        <!--Show email-->
    1.26          <scene sceneID="fxT-br-VYt">
    1.27              <objects>
    1.28                  <tableViewController title="Show email" id="3bx-34-vLD" customClass="EmailViewController" customModule="pEpForiOS" customModuleProvider="target" sceneMemberID="viewController">
    1.29 @@ -2145,7 +2146,7 @@
    1.30                                                      <rect key="frame" x="0.0" y="0.0" width="375" height="156"/>
    1.31                                                      <subviews>
    1.32                                                          <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fUP-bg-t0G">
    1.33 -                                                            <rect key="frame" x="0.0" y="0.0" width="188" height="156"/>
    1.34 +                                                            <rect key="frame" x="0.0" y="0.0" width="187.5" height="156"/>
    1.35                                                              <subviews>
    1.36                                                                  <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="contact-icon" translatesAutoresizingMaskIntoConstraints="NO" id="APS-zq-VWj">
    1.37                                                                      <rect key="frame" x="61" y="10" width="65" height="65"/>
    1.38 @@ -2155,13 +2156,13 @@
    1.39                                                                      </constraints>
    1.40                                                                  </imageView>
    1.41                                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Myself" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z0V-0b-LLx">
    1.42 -                                                                    <rect key="frame" x="0.0" y="80" width="188" height="18"/>
    1.43 +                                                                    <rect key="frame" x="0.0" y="80" width="187.5" height="18"/>
    1.44                                                                      <fontDescription key="fontDescription" type="system" pointSize="15"/>
    1.45                                                                      <nil key="textColor"/>
    1.46                                                                      <nil key="highlightedColor"/>
    1.47                                                                  </label>
    1.48                                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="lksdjsdlkj;sdlkj;sdalkfjk" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dii-kS-R66">
    1.49 -                                                                    <rect key="frame" x="20" y="103" width="148" height="36"/>
    1.50 +                                                                    <rect key="frame" x="20" y="103" width="147.5" height="36"/>
    1.51                                                                      <fontDescription key="fontDescription" type="system" pointSize="15"/>
    1.52                                                                      <nil key="textColor"/>
    1.53                                                                      <nil key="highlightedColor"/>
    1.54 @@ -2180,23 +2181,23 @@
    1.55                                                              </constraints>
    1.56                                                          </view>
    1.57                                                          <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gph-tE-tcn">
    1.58 -                                                            <rect key="frame" x="188" y="0.0" width="187" height="156"/>
    1.59 +                                                            <rect key="frame" x="187.5" y="0.0" width="187.5" height="156"/>
    1.60                                                              <subviews>
    1.61                                                                  <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="contact-icon" translatesAutoresizingMaskIntoConstraints="NO" id="tl0-Lm-Zaz">
    1.62 -                                                                    <rect key="frame" x="61" y="10" width="65" height="65"/>
    1.63 +                                                                    <rect key="frame" x="61.5" y="10" width="65" height="65"/>
    1.64                                                                      <constraints>
    1.65                                                                          <constraint firstAttribute="width" constant="65" id="1uq-Vm-aRr"/>
    1.66                                                                          <constraint firstAttribute="height" constant="65" id="KDz-pJ-lyw"/>
    1.67                                                                      </constraints>
    1.68                                                                  </imageView>
    1.69                                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Partner" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mib-gb-Ctp">
    1.70 -                                                                    <rect key="frame" x="0.0" y="80" width="187" height="18"/>
    1.71 +                                                                    <rect key="frame" x="0.0" y="80" width="187.5" height="18"/>
    1.72                                                                      <fontDescription key="fontDescription" type="system" pointSize="15"/>
    1.73                                                                      <nil key="textColor"/>
    1.74                                                                      <nil key="highlightedColor"/>
    1.75                                                                  </label>
    1.76                                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="sfdakljhfdsa" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mGo-7p-j8J">
    1.77 -                                                                    <rect key="frame" x="20" y="103" width="147" height="37"/>
    1.78 +                                                                    <rect key="frame" x="20" y="103" width="147.5" height="37"/>
    1.79                                                                      <fontDescription key="fontDescription" type="system" pointSize="15"/>
    1.80                                                                      <nil key="textColor"/>
    1.81                                                                      <nil key="highlightedColor"/>
    1.82 @@ -2429,7 +2430,7 @@
    1.83                                                      <rect key="frame" x="15" y="15" width="345" height="45"/>
    1.84                                                      <subviews>
    1.85                                                          <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IIV-5W-Waa" customClass="RoundedButton" customModule="pEpForiOS" customModuleProvider="target">
    1.86 -                                                            <rect key="frame" x="0.0" y="0.0" width="169" height="45"/>
    1.87 +                                                            <rect key="frame" x="0.0" y="0.0" width="168.5" height="45"/>
    1.88                                                              <color key="backgroundColor" red="0.01176470588" green="0.66666666669999997" blue="0.29411764709999999" alpha="1" colorSpace="calibratedRGB"/>
    1.89                                                              <constraints>
    1.90                                                                  <constraint firstAttribute="height" constant="45" id="nEg-kT-Xah"/>
    1.91 @@ -2454,7 +2455,7 @@
    1.92                                                              </connections>
    1.93                                                          </button>
    1.94                                                          <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ASC-Uk-nLV" customClass="RoundedButton" customModule="pEpForiOS" customModuleProvider="target">
    1.95 -                                                            <rect key="frame" x="177" y="0.0" width="168" height="45"/>
    1.96 +                                                            <rect key="frame" x="176.5" y="0.0" width="168.5" height="45"/>
    1.97                                                              <color key="backgroundColor" red="0.81568627449999997" green="0.0078431372550000003" blue="0.1058823529" alpha="1" colorSpace="calibratedRGB"/>
    1.98                                                              <constraints>
    1.99                                                                  <constraint firstAttribute="height" constant="45" id="yqe-z9-MNv"/>
   1.100 @@ -2793,7 +2794,7 @@
   1.101              <objects>
   1.102                  <navigationController automaticallyAdjustsScrollViewInsets="NO" id="JYd-mR-vle" sceneMemberID="viewController">
   1.103                      <toolbarItems/>
   1.104 -                    <navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" id="LQ5-EO-Adp">
   1.105 +                    <navigationBar key="navigationBar" contentMode="scaleToFill" id="LQ5-EO-Adp">
   1.106                          <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   1.107                          <autoresizingMask key="autoresizingMask"/>
   1.108                      </navigationBar>
   1.109 @@ -2820,8 +2821,8 @@
   1.110          <image name="unread-icon" width="22" height="22"/>
   1.111      </resources>
   1.112      <inferredMetricsTieBreakers>
   1.113 +        <segue reference="FBd-9l-9Iu"/>
   1.114 +        <segue reference="xmi-xn-p8T"/>
   1.115          <segue reference="Na7-CM-lbe"/>
   1.116 -        <segue reference="FBd-9l-9Iu"/>
   1.117 -        <segue reference="1zD-EW-3fN"/>
   1.118      </inferredMetricsTieBreakers>
   1.119  </document>
     2.1 --- a/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Fri Feb 03 14:46:28 2017 +0100
     2.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Fri Feb 03 15:32:25 2017 +0100
     2.3 @@ -30,7 +30,7 @@
     2.4  
     2.5      override func viewDidLoad() {
     2.6          super.viewDidLoad()
     2.7 -        
     2.8 +
     2.9          title = "EmailList.title".localized
    2.10          UIHelper.emailListTableHeight(self.tableView)
    2.11          addSearchBar()
    2.12 @@ -38,7 +38,7 @@
    2.13  
    2.14      override func viewWillAppear(_ animated: Bool) {
    2.15          super.viewWillAppear(animated)
    2.16 -        
    2.17 +
    2.18          if MiscUtil.isUnitTest() {
    2.19              return
    2.20          }
    2.21 @@ -53,7 +53,7 @@
    2.22          super.viewWillDisappear(animated)
    2.23          MessageModelConfig.messageFolderDelegate = nil
    2.24      }
    2.25 -    
    2.26 +
    2.27      func initialConfig() {
    2.28          guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
    2.29              return
    2.30 @@ -66,7 +66,7 @@
    2.31              performSegue(withIdentifier:.segueAddNewAccount, sender: self)
    2.32          }
    2.33      }
    2.34 -    
    2.35 +
    2.36      func addSearchBar() {
    2.37          searchController.searchResultsUpdater = self
    2.38          searchController.dimsBackgroundDuringPresentation = false
    2.39 @@ -76,9 +76,9 @@
    2.40          tableView.setContentOffset(CGPoint(x: 0.0, y: 40.0), animated: false)
    2.41      }
    2.42  
    2.43 -    
    2.44 +
    2.45      @IBAction func showUnreadButtonTapped(_ sender: UIBarButtonItem) {}
    2.46 -    
    2.47 +
    2.48      func updateModel() {
    2.49          tableView.reloadData()
    2.50      }
    2.51 @@ -134,7 +134,7 @@
    2.52  
    2.53      override func tableView(_ tableView: UITableView, editActionsForRowAt
    2.54          indexPath: IndexPath)-> [UITableViewRowAction]? {
    2.55 -        
    2.56 +
    2.57          let cell = tableView.cellForRow(at: indexPath) as! EmailListViewCell
    2.58          if let email = cell.messageAt(indexPath: indexPath, config: config) {
    2.59              let flagAction = createFlagAction(message: email, cell: cell)
    2.60 @@ -148,8 +148,8 @@
    2.61      // MARK: - Misc
    2.62  
    2.63      func createRowAction(cell: EmailListViewCell,
    2.64 -        image: UIImage?, action: @escaping (UITableViewRowAction, IndexPath) -> Void,
    2.65 -        title: String) -> UITableViewRowAction {
    2.66 +                         image: UIImage?, action: @escaping (UITableViewRowAction, IndexPath) -> Void,
    2.67 +                         title: String) -> UITableViewRowAction {
    2.68          let rowAction = UITableViewRowAction(
    2.69              style: .normal, title: title, handler: action)
    2.70  
    2.71 @@ -189,7 +189,7 @@
    2.72              guard let message = cell.messageAt(indexPath: indexPath, config: self.config) else {
    2.73                  return
    2.74              }
    2.75 -            
    2.76 +
    2.77              message.imapFlags?.deleted = true
    2.78              message.save()
    2.79              self.tableView.reloadData()
    2.80 @@ -223,7 +223,7 @@
    2.81  
    2.82          return isReadAction
    2.83      }
    2.84 -    
    2.85 +
    2.86      func createMoreAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
    2.87          func action(action: UITableViewRowAction, indexPath: IndexPath) -> Void {
    2.88              self.showMoreActionSheet(cell: cell)
    2.89 @@ -233,15 +233,15 @@
    2.90              cell: cell, image: UIImage(named: "swipe-more"), action: action,
    2.91              title: "\n\nMore".localized)
    2.92      }
    2.93 -    
    2.94 +
    2.95      // MARK: - Action Sheet
    2.96 -    
    2.97 +
    2.98      func showMoreActionSheet(cell: EmailListViewCell) {
    2.99          let alertControler = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
   2.100          alertControler.view.tintColor = .pEpGreen
   2.101          let cancelAction = createCancelAction()
   2.102          let replyAction = createReplyAction(cell: cell)
   2.103 -        let replyAllAction = createReplyAction(cell: cell)
   2.104 +        let replyAllAction = createReplyAllAction(cell: cell)
   2.105          let forwardAction = createForwardAction(cell: cell)
   2.106          let markAction = createMarkAction()
   2.107          alertControler.addAction(cancelAction)
   2.108 @@ -254,23 +254,23 @@
   2.109          }
   2.110          present(alertControler, animated: true, completion: nil)
   2.111      }
   2.112 -    
   2.113 +
   2.114      // MARK: - Action Sheet Actions
   2.115  
   2.116      func createCancelAction() -> UIAlertAction {
   2.117 -      return  UIAlertAction(title: "Cancel", style: .cancel) { (action) in}
   2.118 +        return  UIAlertAction(title: "Cancel", style: .cancel) { (action) in}
   2.119      }
   2.120 -    
   2.121 +
   2.122      func createReplyAction(cell: EmailListViewCell) ->  UIAlertAction {
   2.123          return UIAlertAction(title: "Reply", style: .default) { (action) in
   2.124 -           // self.performSegue(withIdentifier: self.segueCompose, sender: cell)
   2.125 +            // self.performSegue(withIdentifier: self.segueCompose, sender: cell)
   2.126              self.performSegue(withIdentifier: .segueCompose, sender: cell)
   2.127          }
   2.128      }
   2.129  
   2.130      func createReplyAllAction(cell: EmailListViewCell) ->  UIAlertAction {
   2.131 -        return UIAlertAction(title: "ReplyAll", style: .default) { (action) in
   2.132 -            self.performSegue(withIdentifier: .segueCompose, sender: cell)
   2.133 +        return UIAlertAction(title: "Reply All", style: .default) { (action) in
   2.134 +            self.performSegue(withIdentifier: .segueReplyAll, sender: cell)
   2.135          }
   2.136      }
   2.137  
   2.138 @@ -280,30 +280,30 @@
   2.139              self.performSegue(withIdentifier: .segueCompose, sender: cell)
   2.140          }
   2.141      }
   2.142 -    
   2.143 +
   2.144      func createMarkAction() -> UIAlertAction {
   2.145          return UIAlertAction(title: "Mark", style: .default) { (action) in
   2.146          }
   2.147      }
   2.148 -    
   2.149 +
   2.150      // MARK: - Content Search
   2.151 -    
   2.152 +
   2.153      func filterContentForSearchText(searchText: String) {
   2.154 -        
   2.155 +
   2.156      }
   2.157 - 
   2.158 +
   2.159      // MARK: - Actions
   2.160 -//    @IBAction func unwindToEmailList(for unwindSegue: UIStoryboardSegue) {
   2.161 -//        
   2.162 -//    }
   2.163 -   
   2.164 +    //    @IBAction func unwindToEmailList(for unwindSegue: UIStoryboardSegue) {
   2.165 +    //
   2.166 +    //    }
   2.167 +
   2.168  }
   2.169  
   2.170  extension EmailListViewController: UISearchResultsUpdating, UISearchControllerDelegate {
   2.171      public func updateSearchResults(for searchController: UISearchController) {
   2.172          filterContentForSearchText(searchText: searchController.searchBar.text!)
   2.173      }
   2.174 -    
   2.175 +
   2.176      func didDismissSearchController(_ searchController: UISearchController) {
   2.177      }
   2.178  }
   2.179 @@ -311,17 +311,18 @@
   2.180  // MARK: - Navigation
   2.181  
   2.182  extension EmailListViewController: SegueHandlerType {
   2.183 -    
   2.184 +
   2.185      // MARK: - SegueHandlerType
   2.186 -    
   2.187 +
   2.188      enum SegueIdentifier: String {
   2.189          case segueAddNewAccount
   2.190          case segueEditAccounts
   2.191          case segueShowEmail
   2.192          case segueCompose
   2.193 +        case segueReplyAll
   2.194          case noSegue
   2.195      }
   2.196 -    
   2.197 +
   2.198      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
   2.199          switch segueIdentifier(for: segue) {
   2.200          case .segueCompose:
   2.201 @@ -332,15 +333,26 @@
   2.202              //
   2.203              //                destination.originalMessage = draft
   2.204              //                destination.composeMode = .draft
   2.205 -        //            }
   2.206 +            //            }
   2.207 +            break
   2.208 +        case .segueReplyAll:
   2.209 +            if let nav = segue.destination as? UINavigationController,
   2.210 +                let destination = nav.topViewController as? ComposeTableViewController,
   2.211 +                let cell = sender as? EmailListViewCell,
   2.212 +                let indexPath = self.tableView.indexPath(for: cell),
   2.213 +                let email = cell.messageAt(indexPath: indexPath, config: config) {
   2.214 +                destination.composeMode = .replyAll
   2.215 +                destination.appConfig = config?.appConfig
   2.216 +                destination.originalMessage = email
   2.217 +            }
   2.218              break
   2.219          case .segueShowEmail:
   2.220              if let vc = segue.destination as? EmailViewController,
   2.221                  let cell = sender as? EmailListViewCell,
   2.222                  let indexPath = self.tableView.indexPath(for: cell),
   2.223                  let email = cell.messageAt(indexPath: indexPath, config: config) {
   2.224 -                    vc.appConfig = config?.appConfig
   2.225 -                    vc.message = email
   2.226 +                vc.appConfig = config?.appConfig
   2.227 +                vc.message = email
   2.228              }
   2.229              break
   2.230          default: ()