marinofaggiana 5 years ago
parent
commit
32f58f591a

+ 9 - 9
iOSClient/Notification/CCNotification.storyboard

@@ -1,11 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="eRR-MW-ghy">
-    <device id="retina4_7" orientation="portrait">
-        <adaptation id="fullscreen"/>
-    </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="eRR-MW-ghy">
+    <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -22,7 +20,7 @@
                                 <rect key="frame" x="0.0" y="28" width="375" height="187"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="R1c-h5-BOp" id="9Bv-1W-yVV">
-                                    <rect key="frame" x="0.0" y="0.0" width="375" height="186.5"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="375" height="187"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                     <subviews>
                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pg1-7p-7Rz" userLabel="subject">
@@ -72,7 +70,7 @@
                                             </connections>
                                         </button>
                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sMh-G7-FLo">
-                                            <rect key="frame" x="245" y="146.5" width="120" height="30"/>
+                                            <rect key="frame" x="245" y="147" width="120" height="30"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="30" id="n50-CF-ODl"/>
                                                 <constraint firstAttribute="width" constant="120" id="tiI-55-Qu5"/>
@@ -83,7 +81,7 @@
                                             </connections>
                                         </button>
                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="obR-h7-TUC">
-                                            <rect key="frame" x="115" y="146.5" width="120" height="30"/>
+                                            <rect key="frame" x="115" y="147" width="120" height="30"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="30" id="Vko-Ob-nuj"/>
                                                 <constraint firstAttribute="width" constant="120" id="sVc-6c-vO4"/>
@@ -109,6 +107,7 @@
                                             </userDefinedRuntimeAttributes>
                                         </imageView>
                                     </subviews>
+                                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                     <constraints>
                                         <constraint firstItem="j3P-Mn-NRk" firstAttribute="leading" secondItem="9Bv-1W-yVV" secondAttribute="leading" constant="10" id="05B-JK-v6T"/>
                                         <constraint firstAttribute="trailing" secondItem="sMh-G7-FLo" secondAttribute="trailing" constant="10" id="4W9-Xm-fxY"/>
@@ -131,6 +130,7 @@
                                         <constraint firstItem="YPu-No-c8x" firstAttribute="centerY" secondItem="YM1-uH-2Cz" secondAttribute="centerY" id="z8s-et-n4J"/>
                                     </constraints>
                                 </tableViewCellContentView>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
                                 <connections>
                                     <outlet property="avatar" destination="j3P-Mn-NRk" id="8uQ-4h-kI0"/>
@@ -165,7 +165,7 @@
                 <navigationController storyboardIdentifier="CCNotification" automaticallyAdjustsScrollViewInsets="NO" id="eRR-MW-ghy" sceneMemberID="viewController">
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="jDh-Ju-bUL">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <nil name="viewControllers"/>

+ 32 - 20
iOSClient/Notification/CCNotification.swift

@@ -80,7 +80,6 @@ class CCNotification: UITableViewController, CCNotificationCelllDelegate {
     
         let cell = self.tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! CCNotificationCell
         cell.delegate = self
-        cell.backgroundColor = NCBrandColor.sharedInstance.backgroundView
         
         let notification = appDelegate.listOfNotifications.object(at: indexPath.row) as! OCNotifications
         let urlIcon = URL(string: notification.icon)
@@ -144,14 +143,18 @@ class CCNotification: UITableViewController, CCNotificationCelllDelegate {
         cell.message.text = notification.message.replacingOccurrences(of: "<br />", with: "\n")
         cell.message.textColor = .gray
         
-        cell.remove.setImage(CCGraphics.changeThemingColorImage(UIImage(named: "exit")!, width: 40, height: 40, color: UIColor.gray), for: .normal)
+        cell.remove.setImage(CCGraphics.changeThemingColorImage(UIImage(named: "exit")!, width: 40, height: 40, color: .gray), for: .normal)
         
+        cell.primary.isEnabled = false
+        cell.primary.isHidden = true
         cell.primary.titleLabel?.font = .systemFont(ofSize: 14)
         cell.primary.setTitleColor(.white, for: .normal)
         cell.primary.layer.cornerRadius = 15
         cell.primary.layer.masksToBounds = true
         cell.primary.layer.backgroundColor = NCBrandColor.sharedInstance.brand.cgColor
         
+        cell.secondary.isEnabled = false
+        cell.secondary.isHidden = true
         cell.secondary.titleLabel?.font = .systemFont(ofSize: 14)
         cell.secondary.setTitleColor(.gray, for: .normal)
         cell.secondary.layer.cornerRadius = 15
@@ -160,28 +163,37 @@ class CCNotification: UITableViewController, CCNotificationCelllDelegate {
         cell.secondary.layer.borderWidth = 0.3
         cell.secondary.layer.borderColor = UIColor.gray.cgColor
         
+        cell.messageBottomMargin.constant = 10
+        
         // Action
-        if notification.actions.count == 0 {
-            
-            cell.primary.isEnabled = false
-            cell.primary.isHidden = true
-            
-            cell.secondary.isEnabled = false
-            cell.secondary.isHidden = true
-            
-            cell.messageBottomMargin.constant = 10
+        if notification.actions.count > 0  {
             
-        } else {
-            
-            for action in notification.actions {
+            if notification.actions.count == 1 {
+                
+                let action = notification.actions[0] as! OCNotificationsAction
+
+                cell.primary.isEnabled = true
+                cell.primary.isHidden = false
+                cell.primary.setTitle(action.label, for: .normal)
                 
-                let label = (action as! OCNotificationsAction).label
-                let primary = (action as! OCNotificationsAction).primary
+            } else if notification.actions.count == 2 {
+            
+                cell.primary.isEnabled = true
+                cell.primary.isHidden = false
                 
-                if primary {
-                    cell.primary.setTitle(label, for: .normal)
-                } else {
-                    cell.secondary.setTitle(label, for: .normal)
+                cell.secondary.isEnabled = true
+                cell.secondary.isHidden = false
+            
+                for action in notification.actions {
+                    
+                    let label = (action as! OCNotificationsAction).label
+                    let primary = (action as! OCNotificationsAction).primary
+                    
+                    if primary {
+                        cell.primary.setTitle(label, for: .normal)
+                    } else {
+                        cell.secondary.setTitle(label, for: .normal)
+                    }
                 }
             }