developp UI to support group chat

This commit is contained in:
Benjamin Reis 2017-11-03 14:13:03 +01:00
parent 17418714c9
commit e6cf85c050
12 changed files with 279 additions and 153 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<device id="retina4_7" orientation="landscape">
<adaptation id="fullscreen"/>
</device>
<dependencies>
@ -35,23 +35,23 @@
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="v2I-ka-LYa" userLabel="iphone6MetricsView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="375"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view tag="1" contentMode="scaleToFill" id="6">
<rect key="frame" x="0.0" y="42" width="375" height="559"/>
<rect key="frame" x="0.0" y="42" width="667" height="267"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view tag="2" contentMode="scaleToFill" id="7" userLabel="topBar">
<rect key="frame" x="0.0" y="0.0" width="375" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_F.png" id="v5G-Qf-X82" userLabel="backgroundColor">
<rect key="frame" x="0.0" y="0.0" width="375" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
</imageView>
<button opaque="NO" tag="4" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="9" userLabel="backButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="75" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="133" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Back"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -66,7 +66,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="11" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="bci-3K-AcG" userLabel="cancelButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="75" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="133" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Cancel"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
@ -81,7 +81,7 @@
</connections>
</button>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="5" contentMode="left" misplaced="YES" text="Contact1" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="40" userLabel="addressLabel">
<rect key="frame" x="75" y="0.0" width="142" height="66"/>
<rect key="frame" x="133" y="0.0" width="253" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name">
<accessibilityTraits key="traits" none="YES"/>
@ -91,7 +91,7 @@
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="6" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Wzg-i0-spp" userLabel="callButton" customClass="UIIconButton">
<rect key="frame" x="225" y="0.0" width="75" height="66"/>
<rect key="frame" x="400" y="0.0" width="134" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<state key="normal" image="call_alt_start_default.png">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -103,7 +103,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="7" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Hc0-GX-fC5" userLabel="backToCallButton" customClass="UIBackToCallButton">
<rect key="frame" x="225" y="0.0" width="75" height="66"/>
<rect key="frame" x="400" y="0.0" width="134" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<state key="normal" image="call_back_default.png">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -116,7 +116,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="8" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Wag-Nx-kd6" userLabel="deleteButton" customClass="UIIconButton">
<rect key="frame" x="300" y="0.0" width="75" height="66"/>
<rect key="frame" x="534" y="0.0" width="133" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Delete all"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
@ -130,7 +130,7 @@
</connections>
</button>
<button opaque="NO" tag="9" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="FqM-Ud-i58" userLabel="editButton" customClass="UIIconButton">
<rect key="frame" x="300" y="0.0" width="75" height="66"/>
<rect key="frame" x="534" y="0.0" width="133" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Edit"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
@ -145,7 +145,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="10" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" reversesTitleShadowWhenHighlighted="YES" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" id="c9z-aq-2UP" userLabel="toggleSelectionButton" customClass="UIIconButton">
<rect key="frame" x="225" y="0.0" width="75" height="66"/>
<rect key="frame" x="400" y="0.0" width="134" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Select all"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -161,7 +161,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="10" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" reversesTitleShadowWhenHighlighted="YES" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" id="Vqb-Un-4xv" userLabel="infoButton" customClass="UIIconButton">
<rect key="frame" x="225" y="0.0" width="75" height="66"/>
<rect key="frame" x="400" y="0.0" width="134" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Select all"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -176,8 +176,8 @@
<action selector="onInfoClick:" destination="-1" eventType="touchUpInside" id="VfD-K7-V15"/>
</connections>
</button>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="5" contentMode="left" misplaced="YES" text="addresses" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="Ncq-Zc-X6j" userLabel="addressLabel">
<rect key="frame" x="75" y="41" width="142" height="25"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="5" contentMode="left" misplaced="YES" text="addresses" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="Ncq-Zc-X6j" userLabel="participantsLabel">
<rect key="frame" x="133" y="41" width="253" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name">
<accessibilityTraits key="traits" none="YES"/>
@ -189,11 +189,11 @@
</subviews>
</view>
<view tag="12" contentMode="scaleToFill" id="49" userLabel="contentView">
<rect key="frame" x="0.0" y="66" width="375" height="493"/>
<rect key="frame" x="0.0" y="66" width="667" height="201"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<tableView clipsSubviews="YES" tag="13" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" allowsSelection="NO" allowsSelectionDuringEditing="YES" allowsMultipleSelectionDuringEditing="YES" rowHeight="60" sectionHeaderHeight="22" sectionFooterHeight="22" id="8" userLabel="messagesTableView">
<rect key="frame" x="0.0" y="0.0" width="375" height="405"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="113"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
@ -205,11 +205,11 @@
</connections>
</tableView>
<view hidden="YES" tag="14" contentMode="scaleToFill" id="fx4-ao-53M" userLabel="composeIndicatorView">
<rect key="frame" x="0.0" y="405" width="375" height="22"/>
<rect key="frame" x="0.0" y="113" width="667" height="22"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="15" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="%@ is composing..." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="fpY-Fv-ht2" userLabel="composeLabel">
<rect key="frame" x="0.0" y="1" width="375" height="22"/>
<rect key="frame" x="0.0" y="1" width="667" height="22"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label=""/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
@ -219,7 +219,7 @@
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" tag="16" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="No conversation." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="p7C-WH-uR1" userLabel="emptyTableLabel">
<rect key="frame" x="0.0" y="0.0" width="375" height="427"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="174"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
@ -227,11 +227,11 @@
<nil key="highlightedColor"/>
</label>
<view tag="17" contentMode="scaleToFill" id="14" userLabel="messageView">
<rect key="frame" x="0.0" y="427" width="375" height="66"/>
<rect key="frame" x="0.0" y="135" width="667" height="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="18" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_F.png" id="pGT-LQ-zpg" userLabel="backgroundColor">
<rect key="frame" x="0.0" y="0.0" width="375" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
<button opaque="NO" tag="19" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="73" userLabel="pictureButton">
@ -248,7 +248,7 @@
</connections>
</button>
<button opaque="NO" tag="21" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="15" userLabel="sendButton">
<rect key="frame" x="310" y="0.0" width="66" height="66"/>
<rect key="frame" x="602" y="0.0" width="66" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Send"/>
<inset key="titleEdgeInsets" minX="0.0" minY="30" maxX="0.0" maxY="0.0"/>
@ -262,7 +262,7 @@
</connections>
</button>
<view tag="20" contentMode="scaleToFill" id="pqa-tg-5ml" userLabel="messageField" customClass="HPGrowingTextView">
<rect key="frame" x="66" y="13" width="243" height="40"/>
<rect key="frame" x="117" y="13" width="433" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" label="Message field"/>
@ -280,23 +280,23 @@
<point key="canvasLocation" x="228.5" y="-40.5"/>
</view>
<view contentMode="scaleToFill" id="680-UL-sil" userLabel="iphone6MetricsView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="375"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view tag="1" contentMode="scaleToFill" id="VoU-7Q-fgp">
<rect key="frame" x="90" y="42" width="285" height="625"/>
<rect key="frame" x="90" y="42" width="577" height="333"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view tag="2" contentMode="scaleToFill" id="Z3y-hY-5xp" userLabel="topBar">
<rect key="frame" x="0.0" y="0.0" width="285" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="577" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_F.png" id="Uvs-m3-GPj" userLabel="backgroundColor">
<rect key="frame" x="0.0" y="0.0" width="285" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="577" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
</imageView>
<button opaque="NO" tag="4" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="N2g-vL-3x8" userLabel="backButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="33" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="67" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Back"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -311,7 +311,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="11" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Bqf-Gg-2Rw" userLabel="cancelButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="33" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="67" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Cancel"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
@ -325,9 +325,9 @@
<action selector="onEditionChangeClick:" destination="-1" eventType="touchUpInside" id="hGj-xz-K5n"/>
</connections>
</button>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="5" contentMode="left" text="Contact1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="uEp-mD-eik" userLabel="addressLabel">
<rect key="frame" x="33" y="0.0" width="185" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="5" contentMode="left" misplaced="YES" text="Contact1" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="uEp-mD-eik" userLabel="addressLabel">
<rect key="frame" x="67" y="1" width="366" height="57"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name">
<accessibilityTraits key="traits" none="YES"/>
</accessibility>
@ -336,7 +336,7 @@
<nil key="highlightedColor"/>
</label>
<button hidden="YES" opaque="NO" tag="8" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="RDW-7W-25T" userLabel="deleteButton" customClass="UIIconButton">
<rect key="frame" x="251" y="0.0" width="34" height="66"/>
<rect key="frame" x="508" y="0.0" width="69" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Delete all"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
@ -350,7 +350,7 @@
</connections>
</button>
<button opaque="NO" tag="9" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="KeL-Ej-92j" userLabel="editButton" customClass="UIIconButton">
<rect key="frame" x="251" y="0.0" width="34" height="66"/>
<rect key="frame" x="508" y="0.0" width="69" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Edit"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
@ -364,8 +364,24 @@
<action selector="onEditionChangeClick:" destination="-1" eventType="touchUpInside" id="fNp-ya-dag"/>
</connections>
</button>
<button hidden="YES" opaque="NO" tag="10" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" reversesTitleShadowWhenHighlighted="YES" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" id="uVy-PC-gn9" userLabel="infoButton" customClass="UIIconButton">
<rect key="frame" x="441" y="0.0" width="67" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Select all"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
<state key="normal" image="chat_group_informations.png">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="disabled" image="select_all_disabled.png"/>
<state key="selected" image="select_all_default.png"/>
<state key="highlighted" backgroundImage="color_E.png"/>
<connections>
<action selector="onInfoClick:" destination="-1" eventType="touchUpInside" id="HQo-52-fEq"/>
</connections>
</button>
<button opaque="NO" tag="6" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="wag-QV-oUD" userLabel="callButton" customClass="UIIconButton">
<rect key="frame" x="218" y="0.0" width="33" height="66"/>
<rect key="frame" x="441" y="0.0" width="67" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<state key="normal" image="call_alt_start_default.png">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -377,7 +393,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="7" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="t25-en-4LP" userLabel="backToCallButton" customClass="UIBackToCallButton">
<rect key="frame" x="218" y="0.0" width="33" height="66"/>
<rect key="frame" x="441" y="0.0" width="67" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<state key="normal" image="call_back_default.png">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -389,7 +405,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" tag="10" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" reversesTitleShadowWhenHighlighted="YES" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" id="4RV-US-Kr1" userLabel="toggleSelectionButton" customClass="UIIconButton">
<rect key="frame" x="218" y="0.0" width="33" height="66"/>
<rect key="frame" x="441" y="0.0" width="67" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Select all"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -404,14 +420,24 @@
<action selector="onSelectionToggle:" destination="29" eventType="touchUpInside" id="17V-y4-JHi"/>
</connections>
</button>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="5" contentMode="left" misplaced="YES" text="addresses" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="tyU-Wy-rLs" userLabel="participantsLabel">
<rect key="frame" x="67" y="37" width="366" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name">
<accessibilityTraits key="traits" none="YES"/>
</accessibility>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.33333333329999998" green="0.33333333329999998" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
<view tag="12" contentMode="scaleToFill" id="OTt-fc-941" userLabel="contentView">
<rect key="frame" x="0.0" y="66" width="285" height="559"/>
<rect key="frame" x="0.0" y="66" width="577" height="267"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<tableView clipsSubviews="YES" tag="13" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" allowsSelection="NO" allowsSelectionDuringEditing="YES" allowsMultipleSelectionDuringEditing="YES" rowHeight="60" sectionHeaderHeight="22" sectionFooterHeight="22" id="CU7-Za-RwN" userLabel="messagesTableView">
<rect key="frame" x="0.0" y="0.0" width="285" height="471"/>
<rect key="frame" x="0.0" y="0.0" width="577" height="179"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
@ -421,7 +447,7 @@
</connections>
</tableView>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" tag="16" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="No conversation." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="pzm-tk-LH0" userLabel="emptyTableLabel">
<rect key="frame" x="0.0" y="0.0" width="285" height="438"/>
<rect key="frame" x="0.0" y="0.0" width="577" height="209"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
@ -429,11 +455,11 @@
<nil key="highlightedColor"/>
</label>
<view hidden="YES" tag="14" contentMode="scaleToFill" id="nTf-7h-Z4z" userLabel="composeIndicatorView">
<rect key="frame" x="0.0" y="471" width="285" height="22"/>
<rect key="frame" x="0.0" y="179" width="577" height="22"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="15" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="%@ is composing..." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="I34-aL-yuS" userLabel="composeLabel">
<rect key="frame" x="0.0" y="0.0" width="285" height="22"/>
<rect key="frame" x="0.0" y="0.0" width="577" height="22"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label=""/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
@ -443,11 +469,11 @@
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view tag="17" contentMode="scaleToFill" id="LA5-wD-ftj" userLabel="messageView">
<rect key="frame" x="0.0" y="493" width="285" height="66"/>
<rect key="frame" x="0.0" y="201" width="577" height="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="18" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_F.png" id="kKc-DG-gwg" userLabel="backgroundColor">
<rect key="frame" x="0.0" y="0.0" width="285" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="577" height="66"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
<button opaque="NO" tag="19" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="gSL-jE-GYO" userLabel="pictureButton">
@ -464,13 +490,13 @@
</connections>
</button>
<view tag="20" contentMode="scaleToFill" id="C02-2r-vXK" userLabel="messageField" customClass="HPGrowingTextView">
<rect key="frame" x="29" y="13" width="226" height="40"/>
<rect key="frame" x="59" y="13" width="457" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" label="Message field"/>
</view>
<button opaque="NO" tag="21" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="nV9-xZ-oSM" userLabel="sendButton">
<rect key="frame" x="219" y="0.0" width="66" height="66"/>
<rect key="frame" x="511" y="0.0" width="66" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Send"/>
<inset key="titleEdgeInsets" minX="0.0" minY="30" maxX="0.0" maxY="0.0"/>
@ -493,7 +519,7 @@
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<point key="canvasLocation" x="252" y="-176"/>
<point key="canvasLocation" x="-546.5" y="-152.5"/>
</view>
<tableViewController autoresizesArchivedViewToFullSize="NO" id="29" userLabel="messagesTableView" customClass="ChatConversationTableView">
<extendedEdge key="edgesForExtendedLayout"/>

View file

@ -100,13 +100,9 @@ void create_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState
}
- (void)createChatRoom {
LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, "dummy subject");
NSString *addr = _tableController.contactsDict.allKeys[0];
NSString* name = [_tableController.contactsDict objectForKey:addr];
LinphoneAddress *linphoneAddress = linphone_address_new(addr.UTF8String);
LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, name.UTF8String);
if(!room) {
return;
}
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(room);
linphone_chat_room_cbs_set_state_changed(cbs, create_chat_room_state_changed);
linphone_chat_room_cbs_set_user_data(cbs, (__bridge void*)self);

View file

@ -35,15 +35,15 @@
@interface ChatConversationTableView : UICheckBoxTableView {
@private
MSList *messageList;
MSList *eventList;
}
@property(nonatomic) LinphoneChatRoom *chatRoom;
@property(nonatomic, strong) id<ChatConversationDelegate> chatRoomDelegate;
- (void)addChatEntry:(LinphoneChatMessage *)chat;
- (void)addEventEntry:(LinphoneEventLog *)event;
- (void)scrollToBottom:(BOOL)animated;
- (void)scrollToLastUnread:(BOOL)animated;
- (void)updateChatEntry:(LinphoneChatMessage *)chat;
- (void)updateEventEntry:(LinphoneEventLog *)event;
@end

View file

@ -29,7 +29,7 @@
#pragma mark - Lifecycle Functions
- (void)dealloc {
[self clearMessageList];
[self clearEventList];
}
#pragma mark - ViewController Functions
@ -41,24 +41,23 @@
#pragma mark -
- (void)clearMessageList {
messageList = bctbx_list_free_with_data(messageList, (void (*)(void *))linphone_chat_message_unref);
- (void)clearEventList {
eventList = bctbx_list_free_with_data(eventList, (void (*)(void *))linphone_event_log_unref);
}
- (void)updateData {
if (!_chatRoom)
return;
[self clearMessageList];
messageList = linphone_chat_room_get_history(_chatRoom, 0);
[self clearEventList];
eventList = linphone_chat_room_get_history_events(_chatRoom, 0);
// also append transient upload messages because they are not in history yet!
for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
const LinphoneAddress *ftd_peer =
linphone_chat_room_get_peer_address(linphone_chat_message_get_chat_room(ftd.message));
const LinphoneAddress *peer = linphone_chat_room_get_peer_address(_chatRoom);
if (linphone_address_equal(ftd_peer, peer) && linphone_chat_message_is_outgoing(ftd.message)) {
LOGI(@"Appending transient upload message %p", ftd.message);
messageList = bctbx_list_append(messageList, linphone_chat_message_ref(ftd.message));
//TODO : eventList = bctbx_list_append(eventList, linphone_chat_message_ref(ftd.event));
}
}
}
@ -69,18 +68,9 @@
[self scrollToLastUnread:false];
}
- (void)addChatEntry:(LinphoneChatMessage *)chat {
// do not add the same message multiple times. It can happen on iPad since in fragment
// mode, "message received" notification will reload tabledata, retrieving all history
// and THEN addChatEntry will be called, requesting the newest message to be added again
if (messageList &&
(linphone_chat_message_get_storage_id(chat) == linphone_chat_message_get_storage_id(bctbx_list_nth_data(
messageList, (int)bctbx_list_size(messageList) - 1)))) {
return;
}
messageList = bctbx_list_append(messageList, linphone_chat_message_ref(chat));
int pos = (int)bctbx_list_size(messageList) - 1;
- (void)addEventEntry:(LinphoneEventLog *)event {
eventList = bctbx_list_append(eventList, linphone_event_log_ref(event));
int pos = (int)bctbx_list_size(eventList) - 1;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:pos inSection:0];
[self.tableView beginUpdates];
@ -88,10 +78,10 @@
[self.tableView endUpdates];
}
- (void)updateChatEntry:(LinphoneChatMessage *)chat {
NSInteger index = bctbx_list_index(messageList, chat);
- (void)updateEventEntry:(LinphoneEventLog *)event {
NSInteger index = bctbx_list_index(eventList, event);
if (index < 0) {
LOGW(@"chat entry doesn't exist");
LOGW(@"event entry doesn't exist");
return;
}
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:index inSection:0]]
@ -101,7 +91,7 @@
- (void)scrollToBottom:(BOOL)animated {
[self.tableView reloadData];
size_t count = bctbx_list_size(messageList);
size_t count = bctbx_list_size(eventList);
if (count) {
[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:(count - 1) inSection:0]];
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:(count - 1) inSection:0]
@ -111,15 +101,20 @@
}
- (void)scrollToLastUnread:(BOOL)animated {
if (messageList == nil || _chatRoom == nil) {
if (eventList == nil || _chatRoom == nil) {
return;
}
int index = -1;
size_t count = bctbx_list_size(messageList);
size_t count = bctbx_list_size(eventList);
// Find first unread & set all entry read
for (int i = 0; i < count; ++i) {
int read = linphone_chat_message_is_read(bctbx_list_nth_data(messageList, i));
LinphoneChatMessageState state = linphone_chat_message_get_state(bctbx_list_nth_data(messageList, i));
LinphoneEventLog *event = bctbx_list_nth_data(eventList, i);
if (!(linphone_event_log_get_type(event) == LinphoneEventLogTypeConferenceChatMessage))
break;
LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event);
int read = linphone_chat_message_is_read(chat);
LinphoneChatMessageState state = linphone_chat_message_get_state(chat);
if (read == 0 &&
!(state == LinphoneChatMessageStateFileTransferError || state == LinphoneChatMessageStateNotDelivered)) {
if (index == -1) {
@ -161,14 +156,14 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return bctbx_list_size(messageList);
return bctbx_list_size(eventList);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *kCellId = nil;
//LinphoneEventLog *event = bctbx_list_nth_data(messageList, (int)[indexPath row]);
//if (linphone_event_log_get_type(event) == LinphoneEventLogTypeConferenceChatMessage) {
LinphoneChatMessage *chat = bctbx_list_nth_data(messageList, (int)[indexPath row]); //linphone_event_log_get_chat_message(event);
LinphoneEventLog *event = bctbx_list_nth_data(eventList, (int)[indexPath row]);
if (linphone_event_log_get_type(event) == LinphoneEventLogTypeConferenceChatMessage) {
LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event);
if (linphone_chat_message_get_file_transfer_information(chat) ||
linphone_chat_message_get_external_body_url(chat)) {
kCellId = NSStringFromClass(UIChatBubblePhotoCell.class);
@ -187,14 +182,17 @@
[super accessoryForCell:cell atPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
/*} else {
} else {
kCellId = NSStringFromClass(UIChatNotifiedEventCell.class);
UIChatNotifiedEventCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
if (cell == nil) {
cell = [[NSClassFromString(kCellId) alloc] initWithIdentifier:kCellId];
}
[cell setEvent:event];
[super accessoryForCell:cell atPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}*/
}
}
#pragma mark - UITableViewDelegate Functions
@ -204,8 +202,13 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
LinphoneChatMessage *chat = bctbx_list_nth_data(messageList, (int)[indexPath row]);
return [UIChatBubbleTextCell ViewHeightForMessage:chat withWidth:self.view.frame.size.width].height;
LinphoneEventLog *event = bctbx_list_nth_data(eventList, (int)[indexPath row]);
if (linphone_event_log_get_type(event) == LinphoneEventLogTypeConferenceChatMessage) {
LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event);
return [UIChatBubbleTextCell ViewHeightForMessage:chat withWidth:self.view.frame.size.width].height;
} else {
return [UIChatNotifiedEventCell height];
}
}
- (void)tableView:(UITableView *)tableView
@ -213,9 +216,9 @@
forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[tableView beginUpdates];
LinphoneChatMessage *chat = bctbx_list_nth_data(messageList, (int)[indexPath row]);
linphone_chat_room_delete_message(_chatRoom, chat);
messageList = bctbx_list_remove(messageList, chat);
LinphoneEventLog *event = bctbx_list_nth_data(eventList, (int)[indexPath row]);
//linphone_chat_room_delete_message(_chatRoom, chat);
eventList = bctbx_list_remove(eventList, event);
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationBottom];
@ -225,9 +228,9 @@
- (void)removeSelectionUsing:(void (^)(NSIndexPath *))remover {
[super removeSelectionUsing:^(NSIndexPath *indexPath) {
LinphoneChatMessage *chat = bctbx_list_nth_data(messageList, (int)[indexPath row]);
linphone_chat_room_delete_message(_chatRoom, chat);
messageList = bctbx_list_remove(messageList, chat);
LinphoneEventLog *event = bctbx_list_nth_data(eventList, (int)[indexPath row]);
//linphone_chat_room_delete_message(_chatRoom, chat);
eventList = bctbx_list_remove(eventList, event);
}];
}

View file

@ -122,9 +122,9 @@ static UICompositeViewDescription *compositeDescription = nil;
[self updateSuperposedButtons];
if (_tableController.isEditing) {
if (_tableController.isEditing)
[_tableController setEditing:NO];
}
[[_tableController tableView] reloadData];
BOOL fileSharingEnabled = linphone_core_get_file_transfer_server(LC) != NULL;
@ -132,7 +132,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[self callUpdateEvent:nil];
PhoneMainView.instance.currentRoom = self.chatRoom;
if (linphone_chat_room_get_subject(_chatRoom))
if (linphone_chat_room_get_subject(_chatRoom) && strcmp(linphone_chat_room_get_subject(_chatRoom), "dummy subject") != 0)
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(_chatRoom)];
[self updateParticipantLabel];
@ -167,6 +167,10 @@ static UICompositeViewDescription *compositeDescription = nil;
composingVisible = !composingVisible;
[self setComposingVisible:!composingVisible withDelay:0];
[self updateSuperposedButtons];
_backButton.hidden = _tableController.isEditing;
if (_tableController.isEditing)
[_tableController setEditing:YES];
[_tableController scrollToBottom:true];
}
@ -365,12 +369,12 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)updateSuperposedButtons {
[_backToCallButton update];
_infoButton.hidden = !linphone_chat_room_can_handle_participants(_chatRoom) || !_backToCallButton.hidden;
_callButton.hidden = !_backToCallButton.hidden || !_infoButton.hidden;
_infoButton.hidden = (linphone_chat_room_get_nb_participants(_chatRoom) == 1) || !_backToCallButton.hidden || _tableController.tableView.isEditing;
_callButton.hidden = !_backToCallButton.hidden || !_infoButton.hidden || _tableController.tableView.isEditing;
}
- (void)updateParticipantLabel {
if (!linphone_chat_room_can_handle_participants(_chatRoom)) {
if (linphone_chat_room_get_nb_participants(_chatRoom) == 1) {
_particpantsLabel.hidden = TRUE;
} else {
_particpantsLabel.hidden = FALSE;
@ -381,9 +385,8 @@ static UICompositeViewDescription *compositeDescription = nil;
if (![_particpantsLabel.text isEqualToString:@""])
_particpantsLabel.text = [_particpantsLabel.text stringByAppendingString:@", "];
_particpantsLabel.text = [_particpantsLabel.text stringByAppendingString:[NSString stringWithUTF8String:linphone_address_get_display_name(linphone_participant_get_address(participant))
? linphone_address_get_display_name(linphone_participant_get_address(participant))
: linphone_address_get_username(linphone_participant_get_address(participant))]];
_particpantsLabel.text = [_particpantsLabel.text stringByAppendingString:
[FastAddressBook displayNameForAddress:linphone_participant_get_address(participant)]];
participants = participants->next;
}
}
@ -451,6 +454,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onEditClick:(id)event {
[_tableController setEditing:![_tableController isEditing] animated:TRUE];
[_messageField resignFirstResponder];
[self updateSuperposedButtons];
}
- (IBAction)onSendClick:(id)event {
@ -536,7 +540,6 @@ static UICompositeViewDescription *compositeDescription = nil;
- (BOOL)startImageUpload:(UIImage *)image url:(NSURL *)url withQuality:(float)quality {
FileTransferDelegate *fileTransfer = [[FileTransferDelegate alloc] init];
[fileTransfer upload:image withURL:url forChatRoom:_chatRoom withQuality:quality];
[_tableController addChatEntry:linphone_chat_message_ref(fileTransfer.message)];
[_tableController scrollToBottom:true];
return TRUE;
}
@ -702,21 +705,32 @@ void on_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState newS
void on_chat_room_subject_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
ChatConversationView *view = (__bridge ChatConversationView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr));
view.addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(cr)];
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
[view.tableController.tableView reloadData];
}
void on_chat_room_participant_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
ChatConversationView *view = (__bridge ChatConversationView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr));
[view updateParticipantLabel];
if (strcmp(linphone_chat_room_get_subject(view.chatRoom), "dummy subject") == 0) {
const LinphoneAddress *addr = linphone_participant_get_address(linphone_chat_room_get_participants(view.chatRoom)->data);
view.addressLabel.text = [FastAddressBook displayNameForAddress:addr];
}
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
[view.tableController.tableView reloadData];
}
void on_chat_room_participant_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
ChatConversationView *view = (__bridge ChatConversationView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr));
[view updateParticipantLabel];
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
[view.tableController.tableView reloadData];
}
void on_chat_room_participant_admin_status_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
ChatConversationView *view = (__bridge ChatConversationView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr));
if (view) {};
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
[view.tableController.tableView reloadData];
}
void on_chat_room_chat_message_received(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
@ -729,29 +743,19 @@ void on_chat_room_chat_message_received(LinphoneChatRoom *cr, const LinphoneEven
return;
}
char *fromStr = linphone_address_as_string_uri_only(from);
const LinphoneAddress *cr_from = linphone_chat_room_get_peer_address(view.chatRoom);
char *cr_from_string = linphone_address_as_string_uri_only(cr_from);
if (fromStr && cr_from_string) {
if (strcasecmp(cr_from_string, fromStr) == 0) {
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
linphone_chat_room_mark_as_read(view.chatRoom);
}
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:view];
[view.tableController addChatEntry:chat];
[view setComposingVisible:FALSE withDelay:0];
[view.tableController scrollToLastUnread:TRUE];
}
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
linphone_chat_room_mark_as_read(view.chatRoom);
}
ms_free(fromStr);
ms_free(cr_from_string);
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:view];
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
[view setComposingVisible:FALSE withDelay:0];
//[view.tableController.tableView reloadData];
[view.tableController scrollToLastUnread:TRUE];
}
void on_chat_room_chat_message_sent(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
ChatConversationView *view = (__bridge ChatConversationView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr));
LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event_log);
[view.tableController addChatEntry:chat];
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
[view.tableController scrollToBottom:true];
}

View file

@ -232,7 +232,7 @@
_fileTransferProgress.hidden = _cancelButton.hidden = (_fileTransferProgress.progress == 1.f);
} else {
ChatConversationView *view = VIEW(ChatConversationView);
[view.tableController updateChatEntry:self.message];
[view.tableController updateEventEntry:self.event];
}
}
- (void)onFileTransferRecvUpdate:(NSNotification *)notif {
@ -243,7 +243,7 @@
_fileTransferProgress.hidden = _cancelButton.hidden = (_fileTransferProgress.progress == 1.f);
} else {
ChatConversationView *view = VIEW(ChatConversationView);
[view.tableController updateChatEntry:self.message];
[view.tableController updateEventEntry:self.event];
}
}

View file

@ -25,6 +25,7 @@
@interface UIChatBubbleTextCell : UITableViewCell
@property(readonly, nonatomic) LinphoneEventLog *event;
@property(readonly, nonatomic) LinphoneChatMessage *message;
@property(nonatomic, weak) IBOutlet UIImageView *backgroundColorImage;
@property(nonatomic, weak) IBOutlet UIRoundedImageView *avatarImage;
@ -42,6 +43,7 @@
+ (CGSize)ViewSizeForMessage:(LinphoneChatMessage *)chat withWidth:(int)width;
- (void)setEvent:(LinphoneEventLog *)event;
- (void)setChatMessage:(LinphoneChatMessage *)message;
- (IBAction)onDeleteClick:(id)event;

View file

@ -49,6 +49,18 @@
#pragma mark -
- (void)setEvent:(LinphoneEventLog *)event {
if(!event)
return;
_event = event;
if (!(linphone_event_log_get_type(event) == LinphoneEventLogTypeConferenceChatMessage)) {
LOGE(@"Impossible to create a ChatBubbleText whit a non message event");
return;
}
[self setChatMessage:linphone_event_log_get_chat_message(event)];
}
- (void)setChatMessage:(LinphoneChatMessage *)amessage {
if (amessage == _message) {
return;
@ -65,7 +77,9 @@
if (amessage) {
linphone_chat_message_ref(_message);
linphone_chat_message_set_user_data(_message, (void *)CFBridgingRetain(self));
linphone_chat_message_cbs_set_msg_state_changed(linphone_chat_message_get_callbacks(_message), message_status);
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(_message);
linphone_chat_message_cbs_set_msg_state_changed(cbs, message_status);
linphone_chat_message_cbs_set_user_data(cbs, (__bridge void *)self);
}
}
@ -249,8 +263,9 @@
#pragma mark - State changed handling
static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState state) {
LOGI(@"State for message [%p] changed to %s", msg, linphone_chat_message_state_to_string(state));
UIChatBubbleTextCell *data = (__bridge UIChatBubbleTextCell *)linphone_chat_message_cbs_get_user_data(linphone_chat_message_get_callbacks(msg));
ChatConversationView *view = VIEW(ChatConversationView);
[view.tableController updateChatEntry:msg];
[view.tableController updateEventEntry:data.event];
}
- (void)displayImdmStatus:(LinphoneChatMessageState)state {
@ -286,21 +301,13 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st
if (!text || text.length == 0)
return CGSizeMake(0, 0);
#pragma deploymate push "ignored-api-availability"
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 7) {
return [text boundingRectWithSize:size
options:(NSStringDrawingUsesLineFragmentOrigin |
NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading)
attributes:@{
NSFontAttributeName : font
}
context:nil]
.size;
}
#endif
#pragma deploymate pop
{ return [text sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping]; }
return [text boundingRectWithSize:size
options:(NSStringDrawingUsesLineFragmentOrigin |
NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading)
attributes:@{
NSFontAttributeName : font
}
context:nil].size;
}
static const CGFloat CELL_MIN_HEIGHT = 60.0f;

View file

@ -64,14 +64,19 @@
return;
}
if(linphone_chat_room_can_handle_participants(chatRoom)) {
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(chatRoom) ? linphone_chat_room_get_subject(chatRoom) : "No subject"];
if(linphone_chat_room_get_nb_participants(chatRoom) > 1) {
_addressLabel.text = [NSString stringWithUTF8String:linphone_chat_room_get_subject(chatRoom) ? linphone_chat_room_get_subject(chatRoom) : "dummy subject"];
[_avatarImage setImage:[UIImage imageNamed:@"chat_group_avatar.png"] bordered:NO withRoundedRadius:YES];
} else {
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
if(addr) {
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
if(linphone_chat_room_get_participants(chatRoom) != NULL) {
LinphoneParticipant *participant = linphone_chat_room_get_participants(chatRoom)->data;
const LinphoneAddress *addr = linphone_participant_get_address(participant);
if(addr) {
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
}
} else {
_addressLabel.text = [NSString stringWithUTF8String:"dummy subject"];
}
}

View file

@ -16,8 +16,14 @@
@property(readonly, nonatomic) LinphoneEventLog *event;
@property (weak, nonatomic) IBOutlet UILabel *contactDateLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightBar;
@property (weak, nonatomic) IBOutlet UIImageView *leftBar;
@property (weak, nonatomic) IBOutlet UITableViewCell *eventView;
+ (CGFloat)height;
- (void)setEvent:(LinphoneEventLog *)event;
@end
#endif /* UIChatNotifiedEventCell_h */

View file

@ -15,6 +15,13 @@
@implementation UIChatNotifiedEventCell
#pragma mark - Class methods
static const CGFloat NOTIFIED_CELL_HEIGHT = 44;
+ (CGFloat)height {
return NOTIFIED_CELL_HEIGHT;
}
#pragma mark - Lifecycle Functions
- (id)initWithIdentifier:(NSString *)identifier {
@ -29,6 +36,7 @@
[self addSubview:sub];
}
}
_event = NULL;
return self;
}
@ -36,10 +44,76 @@
_event = NULL;
}
- (void)setEditing:(BOOL)editing {
[self setEditing:editing animated:FALSE];
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
_leftBar.hidden = _rightBar.hidden = editing;
if (editing)
[_contactDateLabel setFrame:CGRectMake(1, 1, _contactDateLabel.frame.size.width, NOTIFIED_CELL_HEIGHT)];
}
#pragma mark -
- (void)setEvent:(LinphoneEventLog *)event {
_event = event;
NSString *eventString;
switch (linphone_event_log_get_type(event)) {
case LinphoneEventLogTypeConferenceSubjectChanged: {
NSString *subject = [NSString stringWithUTF8String:linphone_event_log_get_subject(event)];
NSString *formatedString = [NSString stringWithFormat:@"Chat room subject changed to : %@", subject];
eventString = NSLocalizedString(formatedString, nil);
break;
}
case LinphoneEventLogTypeConferenceParticipantAdded: {
NSString *participant = [FastAddressBook displayNameForAddress:linphone_event_log_get_participant_address(event)];
NSString *formatedString = [NSString stringWithFormat:@"%@ was added to the chat room", participant];
eventString = NSLocalizedString(formatedString, nil);
break;
}
case LinphoneEventLogTypeConferenceParticipantRemoved: {
NSString *participant = [FastAddressBook displayNameForAddress:linphone_event_log_get_participant_address(event)];
NSString *formatedString = [NSString stringWithFormat:@"%@ was removed to the chat room", participant];
eventString = NSLocalizedString(formatedString, nil);
break;
}
case LinphoneEventLogTypeConferenceParticipantSetAdmin: {
NSString *participant = [FastAddressBook displayNameForAddress:linphone_event_log_get_participant_address(event)];
NSString *formatedString = [NSString stringWithFormat:@"%@ was set admin of the chat room", participant];
eventString = NSLocalizedString(formatedString, nil);
break;
}
case LinphoneEventLogTypeConferenceParticipantUnsetAdmin: {
NSString *participant = [FastAddressBook displayNameForAddress:linphone_event_log_get_participant_address(event)];
NSString *formatedString = [NSString stringWithFormat:@"%@ is no more an admin of the chat room", participant];
eventString = NSLocalizedString(formatedString, nil);
break;
}
default:
return;
}
NSString *timeString = [LinphoneUtils timeToString:linphone_event_log_get_time(event)
withFormat:LinphoneDateChatBubble];
_contactDateLabel.text = [NSString stringWithFormat:@"%@ - %@", timeString, eventString];
CGSize newSize = [_contactDateLabel.text boundingRectWithSize:CGSizeZero
options:(NSStringDrawingUsesLineFragmentOrigin |
NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading)
attributes:@{NSFontAttributeName :_contactDateLabel.font}
context:nil].size;
float delta = (_contactDateLabel.frame.size.width - newSize.width) / 2;
[_contactDateLabel setFrame:CGRectMake((_eventView.frame.size.width - newSize.width) / 2, 1, newSize.width, NOTIFIED_CELL_HEIGHT)];
[_leftBar setFrame:CGRectMake(0,
_leftBar.frame.origin.y,
_contactDateLabel.frame.origin.x - 5,
1)];
[_rightBar setFrame:CGRectMake(_contactDateLabel.frame.origin.x + newSize.width + 5,
_rightBar.frame.origin.y,
_rightBar.frame.size.width + delta,
1)];
}
- (void)layoutSubviews {

View file

@ -12,6 +12,9 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIChatNotifiedEventCell">
<connections>
<outlet property="contactDateLabel" destination="t5k-5N-iBU" id="b6X-2a-1jl"/>
<outlet property="eventView" destination="vAS-G5-9nz" id="4DB-Nl-8bN"/>
<outlet property="leftBar" destination="hk1-mC-xLF" id="hax-Ji-XpZ"/>
<outlet property="rightBar" destination="nHs-Ev-fGT" id="vvz-5w-tIh"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>