This commit is contained in:
Gautier Pelloux-Prayer 2015-08-07 17:08:39 +02:00
parent 5f2e74c6ad
commit cd6f20f0a6
6 changed files with 92 additions and 67 deletions

View file

@ -97,9 +97,11 @@
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Wzg-i0-spp" userLabel="callButton" customClass="UIIconButton">
<rect key="frame" x="287" y="6" width="65" height="65"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" image="start_call_body_default.png">
<state key="normal" image="call_start_body_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled" image="call_start_body_disabled.png"/>
<state key="highlighted" image="call_start_body_over.png"/>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@ -136,9 +138,10 @@
<rect key="frame" x="0.0" y="2" width="72" height="63"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Send picture"/>
<state key="normal" image="chat_photo.png">
<state key="normal" image="chat_picture_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="chat_picture_over.png"/>
<connections>
<action selector="onPictureClick:" destination="-1" eventType="touchUpInside" id="87"/>
</connections>
@ -159,9 +162,10 @@
<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"/>
<state key="normal" image="chat_send.png">
<state key="normal" image="chat_send_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="chat_send_over.png"/>
<connections>
<action selector="onSendClick:" destination="-1" eventType="touchUpInside" id="25"/>
</connections>
@ -193,12 +197,16 @@
<resources>
<image name="avatar.png" width="261" height="261"/>
<image name="back.png" width="25" height="22"/>
<image name="chat_photo.png" width="72" height="56"/>
<image name="chat_send.png" width="71" height="71"/>
<image name="call_start_body_default.png" width="52" height="52"/>
<image name="call_start_body_disabled.png" width="52" height="52"/>
<image name="call_start_body_over.png" width="52" height="52"/>
<image name="chat_picture_default.png" width="25" height="19"/>
<image name="chat_picture_over.png" width="42" height="42"/>
<image name="chat_send_default.png" width="25" height="24"/>
<image name="chat_send_over.png" width="42" height="42"/>
<image name="color_E.png" width="1" height="1"/>
<image name="color_F.png" width="1" height="1"/>
<image name="edit_list.png" width="31" height="29"/>
<image name="start_call_body_default.png" width="151" height="151"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>

View file

@ -27,7 +27,7 @@
<subviews>
<view contentMode="scaleToFill" id="6" userLabel="navigationBar">
<rect key="frame" x="0.0" y="0.0" width="375" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<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="72" height="40"/>
@ -54,7 +54,7 @@
</view>
<view contentMode="scaleToFill" id="33" userLabel="headerView">
<rect key="frame" x="0.0" y="40" width="375" height="150"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="avatar.png" id="23" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="150" y="0.0" width="68" height="66"/>
@ -127,7 +127,7 @@
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="k6N-Av-eOu">
<rect key="frame" x="0.0" y="190" width="375" height="369"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="baU-d4-eu3" id="p7o-Mx-Kmc"/>
@ -140,12 +140,13 @@
</subviews>
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<point key="canvasLocation" x="254.5" y="288.5"/>
</view>
<tableViewController id="baU-d4-eu3" customClass="HistoryDetailsTableViewController">
<connections>
<outlet property="view" destination="k6N-Av-eOu" id="Dos-d4-5l5"/>
</connections>
<point key="canvasLocation" x="621" y="235"/>
<point key="canvasLocation" x="823" y="263"/>
</tableViewController>
</objects>
<resources>

View file

@ -77,9 +77,9 @@ static UICompositeViewDescription *compositeDescription = nil;
compositeDescription = [[UICompositeViewDescription alloc] init:@"ChatRoom"
content:@"ChatRoomViewController"
stateBar:@"UIStateBar"
tabBar:/*@"UIMainBar"*/ nil
tabBar:@"UIMainBar"
fullscreen:false
landscapeMode:true
landscapeMode:false
portraitMode:true];
}
return compositeDescription;

View file

@ -26,7 +26,7 @@
<rect key="frame" x="0.0" y="0.0" width="360" height="42"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="4" contentMode="center" image="call_quality_indicator_4.png" id="13" userLabel="callQualityImage">
<imageView hidden="YES" userInteractionEnabled="NO" tag="4" contentMode="center" image="call_quality_indicator_4.png" id="13" userLabel="callQualityImage">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Call quality"/>

View file

@ -49,20 +49,6 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// Set callQualityTimer
callQualityTimer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(callQualityUpdate)
userInfo:nil
repeats:YES];
// Set callQualityTimer
callSecurityTimer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(callSecurityUpdate)
userInfo:nil
repeats:YES];
// Set observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(registrationUpdate:)
@ -91,6 +77,7 @@
lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count", 0);
[self proxyConfigUpdate:config];
[self updateUI:linphone_core_get_calls_nb([LinphoneManager getLc])];
[self updateVoicemail];
}
@ -222,8 +209,37 @@
#pragma mark -
- (void)updateUI:(BOOL)inCall {
_outcallView.hidden = (inCall);
_incallView.hidden = !_outcallView.hidden;
// nothing changed
if (_outcallView.hidden == inCall)
return;
_outcallView.hidden = inCall;
_incallView.hidden = !inCall;
// always hide icons at start since they are not ready yet
callQualityImage.hidden = callSecurityButton.hidden = YES;
if (callQualityTimer) {
[callQualityTimer invalidate];
callQualityTimer = nil;
}
if (callSecurityTimer) {
[callSecurityTimer invalidate];
callSecurityTimer = nil;
}
// if we are in call, we have to update quality and security icons every sec
if (inCall) {
callQualityTimer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(callQualityUpdate)
userInfo:nil
repeats:YES];
callSecurityTimer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(callSecurityUpdate)
userInfo:nil
repeats:YES];
}
}
- (void)callSecurityUpdate {
@ -236,7 +252,7 @@
[securitySheet dismissWithClickedButtonIndex:securitySheet.destructiveButtonIndex animated:TRUE];
}
} else {
[self updateUI:YES];
callSecurityButton.hidden = NO;
while (list != NULL) {
LinphoneCall *call = (LinphoneCall *)list->data;
LinphoneMediaEncryption enc =
@ -256,26 +272,18 @@
}
- (void)callQualityUpdate {
UIImage *image = nil;
LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
if (call != NULL) {
[self updateUI:YES];
// FIXME double check call state before computing, may cause core dump
float quality = linphone_call_get_average_quality(call);
callQualityImage.hidden = (quality == -1.f);
if (quality < 1) {
image = [UIImage imageNamed:@"call_quality_indicator_0.png"];
} else if (quality < 2) {
image = [UIImage imageNamed:@"call_quality_indicator_1.png"];
} else if (quality < 3) {
image = [UIImage imageNamed:@"call_quality_indicator_2.png"];
} else if (quality < 4) {
image = [UIImage imageNamed:@"call_quality_indicator_3.png"];
} else {
image = [UIImage imageNamed:@"call_quality_indicator_4.png"];
int quality = MIN(4, floor(linphone_call_get_average_quality(call)));
NSString *accessibilityValue = [NSString stringWithFormat:NSLocalizedString(@"Call quality: %d", nil), quality];
if (![accessibilityValue isEqualToString:callQualityImage.accessibilityValue]) {
callQualityImage.accessibilityValue = accessibilityValue;
callQualityImage.hidden = (quality == -1.f);
callQualityImage.image =
(quality == -1.f)
? nil
: [UIImage imageNamed:[NSString stringWithFormat:@"call_quality_indicator_%d.png", quality]];
}
[callQualityImage setImage:image];
}
}

View file

@ -66,26 +66,6 @@
[tester tapViewWithAccessibilityLabel:@"Back"];
}
#pragma mark - Tests
- (void)testDeleteContact {
NSString *contactName = [self getUUID];
[self createContact:contactName lastName:@"dummy" phoneNumber:@"0102030405" SIPAddress:[self me]];
NSString *fullName = [contactName stringByAppendingString:@" dummy"];
[tester tapViewWithAccessibilityLabel:fullName traits:UIAccessibilityTraitStaticText];
[tester tapViewWithAccessibilityLabel:@"Edit"];
[tester scrollViewWithAccessibilityIdentifier:@"Contact numbers table" byFractionOfSizeHorizontal:0 vertical:-0.9];
[tester tapViewWithAccessibilityLabel:@"Remove"];
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Firstname, Lastname"
value:fullName
traits:UIAccessibilityTraitStaticText];
}
- (void)tapCellForRowAtIndexPath:(NSInteger)idx inSection:(NSInteger)section atX:(CGFloat)x {
UITableView *tv = [self findTableView:@"Contact numbers table"];
NSIndexPath *path = [NSIndexPath indexPathForRow:idx inSection:section];
@ -133,6 +113,34 @@
}
}
#pragma mark - Tests
- (void)testCallContactWithInvalidPhoneNumber {
NSString *contactName = [self getUUID];
[self createContact:contactName lastName:@"dummy" phoneNumber:@"5 15 #0664;447*46" SIPAddress:nil];
NSString *fullName = [contactName stringByAppendingString:@" dummy"];
[tester tapViewWithAccessibilityLabel:fullName traits:UIAccessibilityTraitStaticText];
[tester tapViewWithAccessibilityLabel:@"Chat"];
}
- (void)testDeleteContact {
NSString *contactName = [self getUUID];
[self createContact:contactName lastName:@"dummy" phoneNumber:@"0102030405" SIPAddress:[self me]];
NSString *fullName = [contactName stringByAppendingString:@" dummy"];
[tester tapViewWithAccessibilityLabel:fullName traits:UIAccessibilityTraitStaticText];
[tester tapViewWithAccessibilityLabel:@"Edit"];
[tester scrollViewWithAccessibilityIdentifier:@"Contact numbers table" byFractionOfSizeHorizontal:0 vertical:-0.9];
[tester tapViewWithAccessibilityLabel:@"Remove"];
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Firstname, Lastname"
value:fullName
traits:UIAccessibilityTraitStaticText];
}
- (void)testEditContact {
NSString *contactName = [self getUUID];
NSString *fullName = [contactName stringByAppendingString:@" dummy"];