fix table views

This commit is contained in:
Gautier Pelloux-Prayer 2015-07-27 15:22:51 +02:00
parent 60d4420e27
commit 20ed941884
35 changed files with 280 additions and 272 deletions

View file

@ -178,6 +178,7 @@
</view>
<tableViewController autoresizesArchivedViewToFullSize="NO" id="29" userLabel="tableController" customClass="ChatRoomTableViewController">
<extendedEdge key="edgesForExtendedLayout"/>
<nil key="simulatedStatusBarMetrics"/>
<connections>
<outlet property="view" destination="8" id="33"/>
</connections>
@ -191,7 +192,7 @@
<image name="chat_send.png" width="71" height="71"/>
<image name="color_E.png" width="1" height="1"/>
<image name="color_F.png" width="1" height="1"/>
<image name="edit_list.png" width="88" height="85"/>
<image name="edit_list.png" width="88" height="84"/>
<image name="start_call_body_default.png" width="151" height="151"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">

View file

@ -14,11 +14,11 @@
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="5">
<rect key="frame" x="0.0" y="0.0" width="360" height="537"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" id="7" userLabel="toolsBar">
<rect key="frame" x="0.0" y="0.0" width="360" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<rect key="frame" x="0.0" y="0.0" width="360.00000546735953" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="10" userLabel="backButton">
<rect key="frame" x="0.0" y="0.0" width="72" height="40"/>
@ -39,7 +39,7 @@
<accessibility key="accessibilityConfiguration" label="New Discussion"/>
<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="add_chat.png" backgroundImage="color_F.png">
<state key="normal" image="chat_add.png" backgroundImage="color_F.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@ -47,7 +47,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="9" userLabel="selectAllButton" customClass="UIToggleButton">
<rect key="frame" x="200.00000092562476" y="0.0" width="72" height="40"/>
<rect key="frame" x="200" y="0.0" width="72.000001447242141" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Edit"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -57,7 +57,7 @@
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="UxT-TB-Ri4" userLabel="editButton" customClass="UIToggleButton">
<rect key="frame" x="288" y="0.0" width="72" height="40"/>
<rect key="frame" x="288" y="0.0" width="72.000005467359557" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Edit"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -70,7 +70,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="e4g-nB-qYa" userLabel="deleteButton" customClass="UIToggleButton">
<rect key="frame" x="288" y="0.0" width="72" height="40"/>
<rect key="frame" x="288" y="0.0" width="72.000005467359557" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Edit"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@ -98,20 +98,22 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="953" y="347.5"/>
</view>
<tableViewController autoresizesArchivedViewToFullSize="NO" id="4" userLabel="tableController" customClass="ChatTableViewController">
<extendedEdge key="edgesForExtendedLayout"/>
<nil key="simulatedStatusBarMetrics"/>
<connections>
<outlet property="view" destination="6" id="13"/>
</connections>
</tableViewController>
</objects>
<resources>
<image name="add_chat.png" width="95" height="86"/>
<image name="back.png" width="71" height="64"/>
<image name="chat_add.png" width="96" height="86"/>
<image name="color_F.png" width="1" height="1"/>
<image name="delete.png" width="64" height="82"/>
<image name="edit_list.png" width="88" height="85"/>
<image name="delete.png" width="63" height="82"/>
<image name="edit_list.png" width="88" height="84"/>
<image name="select_all.png" width="79" height="79"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">

View file

@ -42,7 +42,7 @@
<accessibility key="accessibilityConfiguration" label="Edit"/>
<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="edit_detail.png">
<state key="normal" image="edit.png">
<color key="titleColor" red="0.35686274509999999" green="0.39607843139999999" blue="0.43529411759999997" alpha="1" colorSpace="deviceRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
@ -107,8 +107,8 @@
</objects>
<resources>
<image name="back.png" width="71" height="64"/>
<image name="delete.png" width="64" height="82"/>
<image name="edit_detail.png" width="84" height="85"/>
<image name="delete.png" width="63" height="82"/>
<image name="edit.png" width="85" height="85"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>

View file

@ -44,27 +44,35 @@
<rect key="frame" x="0.0" y="0.0" width="144" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="4" userLabel="allButton" customClass="UIIconButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="4" userLabel="allButton" customClass="UIIconButton">
<rect key="frame" x="0.0" y="0.0" width="72" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="All contacts filter"/>
<inset key="titleEdgeInsets" minX="0.0" minY="16" maxX="0.0" maxY="0.0"/>
<state key="normal" image="contacts_all.png" backgroundImage="color_F.png">
<inset key="titleEdgeInsets" minX="-86" minY="18" maxX="0.0" maxY="0.0"/>
<state key="normal" title="ALL" image="contacts_all_default.png" backgroundImage="color_F.png">
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected" image="contacts_all_selected.png">
<color key="titleColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="color_E.png"/>
<connections>
<action selector="onAllClick:" destination="-1" eventType="touchUpInside" id="29"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5" userLabel="linphoneButton" customClass="UIIconButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5" userLabel="sipButton" customClass="UIIconButton">
<rect key="frame" x="72" y="0.0" width="72" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Linphone contacts filter"/>
<inset key="titleEdgeInsets" minX="5" minY="14" maxX="10" maxY="0.0"/>
<state key="normal" image="contacts_linphone.png" backgroundImage="color_F.png">
<inset key="titleEdgeInsets" minX="-86" minY="18" maxX="0.0" maxY="0.0"/>
<state key="normal" title="SIP" image="contacts_sip_default.png" backgroundImage="color_F.png">
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected" image="contacts_sip_selected.png">
<color key="titleColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" backgroundImage="color_E.png"/>
<connections>
<action selector="onLinphoneClick:" destination="-1" eventType="touchUpInside" id="47"/>
@ -87,7 +95,7 @@
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Add contact"/>
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
<state key="normal" image="add_contact.png" backgroundImage="color_F.png">
<state key="normal" image="contact_add.png" backgroundImage="color_F.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" backgroundImage="color_E.png"/>
@ -142,14 +150,16 @@
</tableViewController>
</objects>
<resources>
<image name="add_contact.png" width="101" height="86"/>
<image name="back.png" width="71" height="64"/>
<image name="color_E.png" width="1" height="1"/>
<image name="color_F.png" width="1" height="1"/>
<image name="contacts_all.png" width="109" height="86"/>
<image name="contacts_linphone.png" width="110" height="86"/>
<image name="delete.png" width="64" height="82"/>
<image name="edit_list.png" width="88" height="85"/>
<image name="contact_add.png" width="100" height="86"/>
<image name="contacts_all_default.png" width="109" height="86"/>
<image name="contacts_all_selected.png" width="109" height="86"/>
<image name="contacts_sip_default.png" width="110" height="86"/>
<image name="contacts_sip_selected.png" width="109" height="86"/>
<image name="delete.png" width="63" height="82"/>
<image name="edit_list.png" width="88" height="84"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>

View file

@ -68,7 +68,7 @@
<rect key="frame" x="0.0" y="63" width="360" height="411"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="38" userLabel="1" customClass="UIDigitButtonLongVoiceMail">
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="38" userLabel="1" customClass="UIDigitButton">
<rect key="frame" x="0.0" y="0.0" width="120" height="102"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.40000001000000002" green="1" blue="1" alpha="0.0" colorSpace="calibratedRGB"/>
@ -189,7 +189,7 @@
<outlet property="addressField" destination="4" id="249"/>
</connections>
</button>
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="40" userLabel="0" customClass="UIDigitButtonLongPlus">
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="40" userLabel="0" customClass="UIDigitButton">
<rect key="frame" x="120" y="306" width="120" height="102"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<accessibility key="accessibilityConfiguration" label="0"/>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
@ -36,7 +35,7 @@
<rect key="frame" x="0.0" y="0.0" width="360" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="9" userLabel="backButton" customClass="UIButtonShrinkable">
<button opaque="NO" 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="160" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Back"/>
@ -53,7 +52,7 @@
<action selector="onBackClick:" destination="-1" eventType="touchUpInside" id="11"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="50" userLabel="addButton" customClass="UIButtonShrinkable">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="50" userLabel="addButton" customClass="UIIconButton">
<rect key="frame" x="200" y="0.0" width="160" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Add to contact"/>
@ -218,7 +217,7 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="37" userLabel="callButton" customClass="UIButtonShrinkable">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="37" userLabel="callButton" customClass="UIIconButton">
<rect key="frame" x="53" y="268" width="255" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Callback"/>
@ -233,7 +232,7 @@
<action selector="onCallClick:" destination="-1" eventType="touchUpInside" id="65"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="59" userLabel="messageButton" customClass="UIButtonShrinkable">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" adjustsImageWhenDisabled="NO" lineBreakMode="middleTruncation" id="59" userLabel="messageButton" customClass="UIIconButton">
<rect key="frame" x="53" y="326" width="255" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Send message"/>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="IncomingCallViewController">
@ -105,6 +104,8 @@
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
<view contentMode="scaleToFill" id="61" userLabel="Landscape View">
<rect key="frame" x="0.0" y="0.0" width="1024" height="768"/>
@ -196,6 +197,8 @@
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
@ -212,4 +215,9 @@
<image name="decline_over_landscape.png" width="1024" height="171"/>
<image name="header_incoming.png" width="640" height="135"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>

View file

@ -98,9 +98,6 @@ static UICompositeViewDescription *compositeDescription = nil;
listSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
[tableController.tableView addGestureRecognizer:listSwipeGestureRecognizer];
listSwipeGestureRecognizer.enabled = TRUE;
[tableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[tableController.tableView setBackgroundView:nil];
}
- (void)viewWillAppear:(BOOL)animated {

View file

@ -148,9 +148,7 @@ static void chatTable_free_chatrooms(void *data) {
ChatRoomViewController *controller = DYNAMIC_CAST(
[[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE],
ChatRoomViewController);
if (controller != nil) {
[controller setChatRoom:chatRoom];
}
[controller setChatRoom:chatRoom];
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView

View file

@ -32,19 +32,8 @@
return [super initWithNibName:@"ChatViewController" bundle:[NSBundle mainBundle]];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - ViewController Functions
- (void)viewDidLoad {
[super viewDidLoad];
[tableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[tableController.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self

View file

@ -30,16 +30,6 @@
@synthesize selectedData;
@synthesize delegate;
#pragma mark - Lifecycle Functions
#pragma mark - ViewController Functions
- (void)viewDidLoad {
[super viewDidLoad];
[tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4
}
#pragma mark - UICompositeViewDelegate Functions
static UICompositeViewDescription *compositeDescription = nil;

View file

@ -191,13 +191,6 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
#pragma mark - ViewController Functions
- (void)viewDidLoad {
[super viewDidLoad];
[tableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[tableController.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if ([ContactSelection getSelectionMode] == ContactSelectionModeEdit ||

View file

@ -175,9 +175,17 @@ static UICompositeViewDescription *compositeDescription = nil;
}
}
- (void)centerTextOnIcon:(UIButton *)button {
UIEdgeInsets inset = button.titleEdgeInsets;
inset.left = -(button.imageView.frame.size.width + button.titleLabel.frame.size.width / 2);
button.titleEdgeInsets = inset;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self changeView:History_All];
[self centerTextOnIcon:allButton];
[self centerTextOnIcon:linphoneButton];
}
#pragma mark -

View file

@ -447,13 +447,14 @@ static UICompositeViewDescription *compositeDescription = nil;
[addressField setText:@""];
}
- (void)onOneLongClick:(id)sender {
- (void)onZeroLongClick:(id)sender {
// replace last character with a '+'
NSString *newAddress =
[[self.addressField.text substringToIndex:[self.addressField.text length] - 1] stringByAppendingString:@"+"];
[self.addressField setText:newAddress];
}
- (void)onZeroLongClick:(id)sender {
- (void)onOneLongClick:(id)sender {
LinphoneManager *lm = [LinphoneManager instance];
NSString *voiceMail = [lm lpConfigStringForKey:@"voice_mail_uri"];
if (voiceMail != nil) {

View file

@ -81,9 +81,6 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewDidLoad {
[super viewDidLoad];
[self changeView:History_All];
[tableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[tableController.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4
}
#pragma mark -

View file

@ -161,9 +161,6 @@ static UICompositeViewDescription *compositeDescription = nil;
[videoCameraSwitch setPreview:videoPreview];
[callTableController.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[callTableController.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4
UIPanGestureRecognizer *dragndrop =
[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(moveVideoPreview:)];
dragndrop.minimumNumberOfTouches = 1;

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>

View file

@ -10,48 +10,64 @@
<outlet property="addressLabel" destination="20" id="38"/>
<outlet property="avatarImage" destination="19" id="30"/>
<outlet property="chatContentLabel" destination="21" id="24"/>
<outlet property="chatLatestTimeLabel" destination="r7A-Mk-LQX" id="J0r-yr-YLk"/>
<outlet property="unreadCountButton" destination="VDt-hI-meD" id="YO9-Vz-JKy"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="17">
<rect key="frame" x="0.0" y="0.0" width="360" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<rect key="frame" x="0.0" y="0.0" width="360" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="11:15" lineBreakMode="tailTruncation" minimumFontSize="1" id="r7A-Mk-LQX" userLabel="chatLatestTimeLabel">
<rect key="frame" x="10" y="32" width="44" height="12"/>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" image="avatar.png" id="19" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="8" y="2" width="44" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="11:15" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" minimumFontSize="1" id="r7A-Mk-LQX" userLabel="chatLatestTimeLabel">
<rect key="frame" x="8" y="44" width="44" height="15"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="John" lineBreakMode="tailTruncation" minimumFontSize="10" adjustsFontSizeToFit="NO" id="20" userLabel="addressLabel">
<rect key="frame" x="62" y="0.0" width="258" height="22"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" usesAttributedText="YES" lineBreakMode="tailTruncation" minimumFontSize="10" adjustsFontSizeToFit="NO" id="20" userLabel="addressLabel">
<rect key="frame" x="60" y="0.0" width="260" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<attributedString key="attributedText">
<fragment content="John ">
<attributes>
<color key="NSColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="25" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="Doe">
<attributes>
<color key="NSColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="25" name="HelveticaNeue-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="This is a message" lineBreakMode="tailTruncation" numberOfLines="2" minimumFontSize="3" id="21" userLabel="chatContentLabel">
<rect key="frame" x="62" y="22" width="298" height="22"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="This is a placeholder message" lineBreakMode="tailTruncation" numberOfLines="3" adjustsFontSizeToFit="NO" id="21" userLabel="chatContentLabel">
<rect key="frame" x="60" y="31" width="300" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Message"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="VDt-hI-meD" userLabel="unreadCount" customClass="UIButtonShrinkable">
<rect key="frame" x="332" y="3" width="20" height="20"/>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="VDt-hI-meD" userLabel="unreadCountButton" customClass="UIIconButton">
<rect key="frame" x="332" y="4" width="27" height="27"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<state key="normal" title="0" backgroundImage="chat_list_indicator.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" image="avatar.png" id="19" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="16" y="0.0" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>

View file

@ -54,7 +54,7 @@
<object class="IBUILabel" id="505648338">
<reference key="NSNextResponder" ref="675878782"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{46, 0}, {261, 44}}</string>
<string key="NSFrame">{{79, 0}, {281, 44}}</string>
<reference key="NSSuperview" ref="675878782"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="647977481"/>
@ -113,7 +113,7 @@
<object class="IBUIImageView" id="647977481">
<reference key="NSNextResponder" ref="675878782"/>
<int key="NSvFlags">300</int>
<string key="NSFrame">{{315, 12}, {37, 20}}</string>
<string key="NSFrame">{{46, 11}, {25, 22}}</string>
<reference key="NSSuperview" ref="675878782"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
@ -122,7 +122,7 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">incoming_call_icon.png</string>
<string key="NSResourceName">linphone_user.png</string>
</object>
</object>
</array>
@ -341,7 +341,7 @@
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="avatar.png">{751, 751}</string>
<string key="incoming_call_icon.png">{111, 62}</string>
<string key="linphone_user.png">{77, 66}</string>
</dictionary>
</data>
</archive>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>

View file

@ -7,69 +7,60 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIHistoryCell">
<connections>
<outlet property="addressLabel" destination="5" id="25"/>
<outlet property="deleteButton" destination="15" id="16"/>
<outlet property="detailsButton" destination="7" id="17"/>
<outlet property="imageView" destination="6" id="11"/>
<outlet property="avatarImage" destination="J9B-Wl-Qgm" id="Jbc-9j-K4Q"/>
<outlet property="displayNameLabel" destination="zG2-Kg-0jD" id="ykw-Vp-7VP"/>
<outlet property="historyStateButton" destination="Lfl-dI-bSt" id="jHC-d1-Ye0"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="12">
<view contentMode="scaleToFill" id="luQ-A2-XD1">
<rect key="frame" x="0.0" y="0.0" width="360" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="6" userLabel="imageView">
<rect key="frame" x="10" y="8" width="27" height="27"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Call type">
<bool key="isElement" value="YES"/>
</accessibility>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="avatar.png" id="J9B-Wl-Qgm" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="6" y="6" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="John" lineBreakMode="tailTruncation" minimumFontSize="10" adjustsFontSizeToFit="NO" id="5" userLabel="displayNameLabel">
<rect key="frame" x="45" y="0.0" width="276" height="44"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" usesAttributedText="YES" lineBreakMode="tailTruncation" minimumFontSize="10" id="zG2-Kg-0jD" userLabel="displayNameLabel">
<rect key="frame" x="86" y="0.0" width="274" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<accessibility key="accessibilityConfiguration" label="Firstname"/>
<attributedString key="attributedText">
<fragment content="John ">
<attributes>
<color key="NSColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<font key="NSFont" size="25" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="truncatingTail" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="Doe">
<attributes>
<color key="NSColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<font key="NSFont" size="25" name="HelveticaNeue-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="truncatingTail" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="7" userLabel="detailsButton">
<rect key="frame" x="316" y="0.0" width="44" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<inset key="imageEdgeInsets" minX="11" minY="11" maxX="11" maxY="11"/>
<state key="normal" image="list_details_default.png">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Lfl-dI-bSt" userLabel="stateButton">
<rect key="frame" x="46" y="6" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button" image="history_missed_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="list_details_over.png"/>
<connections>
<action selector="onDetails:" destination="-1" eventType="touchUpInside" id="19"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="15" userLabel="deleteButton">
<rect key="frame" x="316" y="0.0" width="44" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<inset key="imageEdgeInsets" minX="11" minY="11" maxX="11" maxY="11"/>
<state key="normal" image="list_delete_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="list_delete_over.png"/>
<connections>
<action selector="onDelete:" destination="-1" eventType="touchUpInside" id="18"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="257" y="299"/>
</view>
</objects>
<resources>
<image name="list_delete_default.png" width="45" height="45"/>
<image name="list_delete_over.png" width="45" height="45"/>
<image name="list_details_default.png" width="45" height="45"/>
<image name="list_details_over.png" width="45" height="45"/>
<image name="avatar.png" width="751" height="751"/>
<image name="history_missed_default.png" width="96" height="96"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>

View file

@ -20,6 +20,8 @@
#import <UIKit/UIKit.h>
#import "UITransparentTVCell.h"
#import "UIRoundedImageView.h"
#import "UIIconButton.h"
#include "linphone/linphonecore.h"
@ -27,12 +29,12 @@
LinphoneChatRoom* chatRoom;
}
@property (nonatomic, strong) IBOutlet UIImageView *avatarImage;
@property(nonatomic, strong) IBOutlet UIRoundedImageView *avatarImage;
@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
@property (nonatomic, strong) IBOutlet UILabel* chatContentLabel;
@property (nonatomic, strong) IBOutlet UIButton * deleteButton;
@property (nonatomic, strong) IBOutlet UIView * unreadMessageView;
@property (nonatomic, strong) IBOutlet UILabel * unreadMessageLabel;
@property(weak, nonatomic) IBOutlet UILabel *chatLatestTimeLabel;
@property(weak, nonatomic) IBOutlet UIIconButton *unreadCountButton;
- (id)initWithIdentifier:(NSString*)identifier;

View file

@ -28,8 +28,7 @@
@synthesize addressLabel;
@synthesize chatContentLabel;
@synthesize deleteButton;
@synthesize unreadMessageLabel;
@synthesize unreadMessageView;
@synthesize unreadCountButton;
#pragma mark - Lifecycle Functions
@ -57,58 +56,31 @@
- (NSString *)accessibilityValue {
if (chatContentLabel.text) {
return [NSString stringWithFormat:@"%@ - %@ (%li)", addressLabel.text, chatContentLabel.text,
(long)[unreadMessageLabel.text integerValue]];
(long)[unreadCountButton.titleLabel.text integerValue]];
} else {
return [NSString stringWithFormat:@"%@ (%li)", addressLabel.text, (long)[unreadMessageLabel.text integerValue]];
return [NSString
stringWithFormat:@"%@ (%li)", addressLabel.text, (long)[unreadCountButton.titleLabel.text integerValue]];
}
}
- (void)update {
NSString *displayName = nil;
UIImage *image = nil;
if (chatRoom == nil) {
LOGW(@"Cannot update chat cell: null chat");
return;
}
const LinphoneAddress *linphoneAddress = linphone_chat_room_get_peer_address(chatRoom);
if (linphoneAddress == NULL)
return;
char *tmp = linphone_address_as_string_uri_only(linphoneAddress);
NSString *normalizedSipAddress = [NSString stringWithUTF8String:tmp];
ms_free(tmp);
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
if (contact != nil) {
displayName = [FastAddressBook getContactDisplayName:contact];
image = [FastAddressBook getContactImage:contact thumbnail:true];
}
// Display name
if (displayName == nil) {
const char *username = linphone_address_get_username(linphoneAddress);
char *address = linphone_address_as_string(linphoneAddress);
displayName = [NSString stringWithUTF8String:username ?: address];
ms_free(address);
}
[addressLabel setText:displayName];
// Avatar
if (image == nil) {
image = [UIImage imageNamed:@"avatar_unknown_small.png"];
}
[avatarImage setImage:image];
[FastAddressBook setDisplayNameLabel:addressLabel forAddress:linphoneAddress];
avatarImage.image = [FastAddressBook avatarForAddress:linphoneAddress];
LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom);
if (last_message) {
const char *text = linphone_chat_message_get_text(last_message);
const char *url = linphone_chat_message_get_external_body_url(last_message);
const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(last_message);
// Message
// Last message was a file transfer (image) so display a picture...
if (url || last_content) {
[chatContentLabel setText:@"🗻"];
chatContentLabel.text = @"🗻";
// otherwise show beginning of the text message
} else if (text) {
NSString *message = [NSString stringWithUTF8String:text];
// shorten long messages
@ -118,14 +90,17 @@
chatContentLabel.text = message;
}
int count = linphone_chat_room_get_unread_messages_count(chatRoom);
unreadMessageLabel.text = [NSString stringWithFormat:@"%i", count];
[unreadMessageView setHidden:(count <= 0)];
_chatLatestTimeLabel.text = [LinphoneUtils timeToString:linphone_chat_message_get_time(last_message)
withStyle:NSDateFormatterShortStyle];
_chatLatestTimeLabel.hidden = NO;
} else {
chatContentLabel.text = nil;
unreadMessageLabel.text = [NSString stringWithFormat:@"0"];
[unreadMessageView setHidden:TRUE];
_chatLatestTimeLabel.hidden = YES;
}
int count = linphone_chat_room_get_unread_messages_count(chatRoom);
[unreadCountButton setTitle:[NSString stringWithFormat:@"%i", count] forState:UIControlStateNormal];
unreadCountButton.hidden = (count <= 0);
}
- (void)setEditing:(BOOL)editing {

View file

@ -218,14 +218,8 @@ static UIFont *CELL_FONT = nil;
}
// Date
time_t chattime = linphone_chat_message_get_time(chat);
NSDate *message_date = (chattime == 0) ? [[NSDate alloc] init] : [NSDate dateWithTimeIntervalSince1970:chattime];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSLocale *locale = [NSLocale currentLocale];
[dateFormatter setLocale:locale];
[dateLabel setText:[dateFormatter stringFromDate:message_date]];
dateLabel.text =
[LinphoneUtils timeToString:linphone_chat_message_get_time(chat) withStyle:NSDateFormatterMediumStyle];
LinphoneChatMessageState state = linphone_chat_message_get_state(chat);
BOOL outgoing = linphone_chat_message_is_outgoing(chat);

View file

@ -45,25 +45,8 @@
- (void)setContact:(ABRecordRef)acontact {
contact = acontact;
if (contact != nil) {
NSString *lFirstName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonFirstNameProperty));
NSString *lLocalizedFirstName = [FastAddressBook localizedLabel:lFirstName];
NSString *lLastName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonLastNameProperty));
NSString *lLocalizedLastName = [FastAddressBook localizedLabel:lLastName];
NSString *lOrganization = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonOrganizationProperty));
NSString *lLocalizedOrganization = [FastAddressBook localizedLabel:lOrganization];
if (lLocalizedFirstName == nil && lLocalizedLastName == nil) {
[nameLabel setText:(NSString *)(lLocalizedOrganization)];
} else {
nameLabel.text = [NSString stringWithFormat:@"%@ %@", lLocalizedFirstName, lLocalizedLastName];
[nameLabel boldSubstring:lLocalizedLastName];
}
_linphoneImage.hidden = !([FastAddressBook contactHasValidSipDomain:contact]);
}
[FastAddressBook setDisplayNameLabel:nameLabel forContact:contact];
_linphoneImage.hidden = !([FastAddressBook contactHasValidSipDomain:contact]);
}
#pragma mark -

View file

@ -75,8 +75,6 @@
- (void)viewDidLoad {
[super viewDidLoad];
[tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4
[normalView setAlpha:1.0f];
[editView setAlpha:0.0f];
[tableView setEditing:TRUE animated:false];

View file

@ -20,6 +20,8 @@
#import <UIKit/UIKit.h>
#import "UITransparentTVCell.h"
#import "UIRoundedImageView.h"
#include "linphone/linphonecore.h"
@interface UIHistoryCell : UITransparentTVCell {
@ -27,14 +29,10 @@
@property (nonatomic, assign) LinphoneCallLog *callLog;
@property (nonatomic, strong) IBOutlet UIImageView* imageView;
@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
@property (nonatomic, strong) IBOutlet UIButton* detailsButton;
@property (nonatomic, strong) IBOutlet UIButton* deleteButton;
@property(weak, nonatomic) IBOutlet UIRoundedImageView *avatarImage;
@property(nonatomic, strong) IBOutlet UIButton *historyStateButton;
@property(nonatomic, strong) IBOutlet UILabel *displayNameLabel;
- (id)initWithIdentifier:(NSString*)identifier;
- (IBAction)onDetails:(id) event;
- (IBAction)onDelete:(id) event;
@end

View file

@ -25,10 +25,8 @@
@implementation UIHistoryCell
@synthesize callLog;
@synthesize addressLabel;
@synthesize imageView;
@synthesize deleteButton;
@synthesize detailsButton;
@synthesize displayNameLabel;
@synthesize historyStateButton;
#pragma mark - Lifecycle Functions
@ -95,7 +93,7 @@
call_type = missed ? @"Missed" : @"Incoming";
}
return [NSString stringWithFormat:@"%@ from %@", call_type, addressLabel.text];
return [NSString stringWithFormat:@"%@ from %@", call_type, displayNameLabel.text];
}
- (void)update {
@ -105,7 +103,7 @@
}
// Set up the cell...
LinphoneAddress *addr;
const LinphoneAddress *addr;
UIImage *image;
if (linphone_call_log_get_dir(callLog) == LinphoneCallIncoming) {
if (linphone_call_log_get_status(callLog) != LinphoneCallMissed) {
@ -113,41 +111,15 @@
} else {
image = [UIImage imageNamed:@"call_status_missed.png"];
}
addr = linphone_call_log_get_from(callLog);
addr = linphone_call_log_get_from_address(callLog);
} else {
image = [UIImage imageNamed:@"call_status_outgoing.png"];
addr = linphone_call_log_get_to(callLog);
addr = linphone_call_log_get_to_address(callLog);
}
NSString *address = nil;
if (addr != NULL) {
BOOL useLinphoneAddress = true;
// contact name
char *lAddress = linphone_address_as_string_uri_only(addr);
if (lAddress) {
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]];
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
if (contact) {
address = [FastAddressBook getContactDisplayName:contact];
useLinphoneAddress = false;
}
ms_free(lAddress);
}
if (useLinphoneAddress) {
const char *lDisplayName = linphone_address_get_display_name(addr);
const char *lUserName = linphone_address_get_username(addr);
if (lDisplayName)
address = [NSString stringWithUTF8String:lDisplayName];
else if (lUserName)
address = [NSString stringWithUTF8String:lUserName];
}
}
if (address == nil) {
address = NSLocalizedString(@"Unknown", nil);
}
[addressLabel setText:address];
[imageView setImage:image];
[FastAddressBook setDisplayNameLabel:displayNameLabel forAddress:addr];
[_avatarImage setImage:[FastAddressBook avatarForAddress:addr]];
[historyStateButton setImage:image forState:UIControlStateNormal];
}
- (void)setEditing:(BOOL)editing {
@ -159,6 +131,7 @@
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
}
#if 0
if (editing) {
[deleteButton setAlpha:1.0f];
[detailsButton setAlpha:0.0f];
@ -166,6 +139,7 @@
[detailsButton setAlpha:1.0f];
[deleteButton setAlpha:0.0f];
}
#endif
if (animated) {
[UIView commitAnimations];
}

View file

@ -219,13 +219,6 @@
return r;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self.tableView setBackgroundColor:[UIColor clearColor]]; // Can't do it in Xib: issue with ios4
[self.tableView setBackgroundView:nil]; // Can't do it in Xib: issue with ios4
}
- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:style];
if (self != nil) {

View file

@ -20,6 +20,8 @@
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
#include "linphone/linphonecore.h"
@interface FastAddressBook : NSObject {
NSMutableDictionary* addressBookMap;
@ -36,10 +38,12 @@
+ (NSString*)appendCountryCodeIfPossible:(NSString*)number;
+ (NSString*)normalizePhoneNumber:(NSString*)number;
+ (NSString*)normalizeSipURI:(NSString*)address;
+ (BOOL)contactHasValidSipDomain:(ABRecordRef)person;
// TOOLS
+(NSString*)localizedLabel:(NSString*)label;
+ (UIImage *)avatarForAddress:(const LinphoneAddress *)addr;
+ (BOOL)contactHasValidSipDomain:(ABRecordRef)person;
+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr;
+ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact;
@end

View file

@ -20,6 +20,7 @@
#import "FastAddressBook.h"
#import "LinphoneManager.h"
#import "ContactsViewController.h"
#import "UILabel+Boldify.h"
@implementation FastAddressBook
@ -270,6 +271,9 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
}
+ (BOOL)contactHasValidSipDomain:(ABRecordRef)person {
if (person == nil)
return NO;
// Check if one of the contact' sip URI matches the expected SIP filter
ABMultiValueRef personSipAddresses = ABRecordCopyValue(person, kABPersonInstantMessageProperty);
BOOL match = false;
@ -307,4 +311,67 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
return match;
}
+ (void)setDisplayNameLabel:(UILabel *)label forContact:(ABRecordRef)contact {
if (contact != nil) {
NSString *lFirstName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonFirstNameProperty));
NSString *lLocalizedFirstName = [FastAddressBook localizedLabel:lFirstName];
NSString *lLastName = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonLastNameProperty));
NSString *lLocalizedLastName = [FastAddressBook localizedLabel:lLastName];
NSString *lOrganization = CFBridgingRelease(ABRecordCopyValue(contact, kABPersonOrganizationProperty));
NSString *lLocalizedOrganization = [FastAddressBook localizedLabel:lOrganization];
if (lLocalizedFirstName == nil && lLocalizedLastName == nil) {
label.text = (NSString *)lLocalizedOrganization;
} else {
label.text = [NSString stringWithFormat:@"%@ %@", lLocalizedFirstName, lLocalizedLastName];
[label boldSubstring:lLocalizedLastName];
}
}
}
+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr {
label.text = NSLocalizedString(@"Unknown", nil);
if (addr != NULL) {
char *lAddress = linphone_address_as_string_uri_only(addr);
if (lAddress) {
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]];
ms_free(lAddress);
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
if (contact) {
[FastAddressBook setDisplayNameLabel:label forContact:contact];
return;
}
}
const char *lDisplayName = linphone_address_get_display_name(addr);
const char *lUserName = linphone_address_get_username(addr);
if (lDisplayName) {
label.text = [NSString stringWithUTF8String:lDisplayName];
} else if (lUserName) {
label.text = [NSString stringWithUTF8String:lUserName];
}
}
}
+ (UIImage *)avatarForAddress:(const LinphoneAddress *)addr {
UIImage *avatar = nil;
if (addr != NULL) {
// contact name
char *lAddress = linphone_address_as_string_uri_only(addr);
if (lAddress) {
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]];
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
if (contact) {
avatar = [FastAddressBook getContactImage:contact thumbnail:TRUE];
}
ms_free(lAddress);
}
}
if (avatar == nil) {
avatar = [UIImage imageNamed:@"avatar"];
}
return avatar;
}
@end

View file

@ -46,6 +46,8 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
+ (void)buttonMultiViewAddAttributes:(NSMutableDictionary*)attributes button:(UIButton*)button;
+ (void)buttonMultiViewApplyAttributes:(NSDictionary*)attributes button:(UIButton*)button;
+ (NSString *)timeToString:(time_t)time withStyle:(NSDateFormatterStyle)style;
@end
@interface NSNumber (HumanReadableSize)

View file

@ -81,6 +81,31 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
@implementation LinphoneUtils
+ (NSString *)timeToString:(time_t)time withStyle:(NSDateFormatterStyle)style {
NSDate *todayDate = [[NSDate alloc] init];
NSDate *messageDate = (time == 0) ? todayDate : [NSDate dateWithTimeIntervalSince1970:time];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:style];
if (style == NSDateFormatterShortStyle) {
// UGLY but single line code!
BOOL sameDay =
[[dateFormatter stringFromDate:todayDate] isEqualToString:[dateFormatter stringFromDate:messageDate]];
if (sameDay) {
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:style];
} else {
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
}
} else {
[dateFormatter setTimeStyle:style];
}
NSLocale *locale = [NSLocale currentLocale];
[dateFormatter setLocale:locale];
return [dateFormatter stringFromDate:messageDate];
}
+ (BOOL)findAndResignFirstResponder:(UIView *)view {
if (view.isFirstResponder) {
[view resignFirstResponder];