refactoring in call... still lots to do

This commit is contained in:
Gautier Pelloux-Prayer 2015-09-10 17:28:44 +02:00
parent a943f59b0a
commit 0dfad497de
10 changed files with 122 additions and 199 deletions

View file

@ -40,13 +40,20 @@
<bool key="isElement" value="YES"/>
</accessibility>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="hjQ-4P-bKP" userLabel="nameLabel">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="19" id="hjQ-4P-bKP" userLabel="nameLabel">
<rect key="frame" x="46" y="359" width="283" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="37"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="john.doe@sip.linphone.org" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="8" id="78f-eb-xdx" userLabel="addressLabel">
<rect key="frame" x="90" y="399" width="194" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view tag="10" contentMode="scaleToFill" id="4" userLabel="tabBar">
<rect key="frame" x="0.0" y="562" width="375" height="63"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
@ -80,13 +87,6 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="john.doe@sip.linphone.org" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="8" id="78f-eb-xdx" userLabel="addressLabel">
<rect key="frame" x="90" y="399" width="194" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>

View file

@ -40,7 +40,7 @@
<bool key="isElement" value="YES"/>
</accessibility>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="d5s-yP-8VE" userLabel="nameLabel">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="19" id="d5s-yP-8VE" userLabel="nameLabel">
<rect key="frame" x="46" y="359" width="283" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="37"/>

View file

@ -7,13 +7,15 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CallView">
<connections>
<outlet property="callTableController" destination="162" id="167"/>
<outlet property="callTableView" destination="106" id="109"/>
<outlet property="addressLabel" destination="8bV-K4-3TY" id="aqZ-1x-isL"/>
<outlet property="avatarImage" destination="fZy-K5-yQp" id="hOl-IQ-c9B"/>
<outlet property="durationLabel" destination="Oy8-QO-Jwb" id="mUT-TX-gLp"/>
<outlet property="eightButton" destination="DRh-kc-UVM" id="BPp-sh-qBg"/>
<outlet property="fiveButton" destination="8Da-zK-V7e" id="URc-Ct-fu0"/>
<outlet property="fourButton" destination="653-Vb-YzA" id="x6R-Cq-7iJ"/>
<outlet property="hangupButton" destination="Xpw-A4-BZO" id="3hc-8p-CLb"/>
<outlet property="microButton" destination="pRH-Ao-h65" id="F5a-sf-J7B"/>
<outlet property="nameLabel" destination="KPa-Rm-Qni" id="KiX-oL-MUd"/>
<outlet property="nineButton" destination="b8R-7P-jHK" id="LNS-eb-9bc"/>
<outlet property="numpadButton" destination="SRu-dB-r3e" id="Y2q-lE-f89"/>
<outlet property="numpadView" destination="ukG-i4-YMY" id="f2R-OM-ahP"/>
@ -47,7 +49,7 @@
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewController id="162" userLabel="callTableController" customClass="CallTableView">
<tableViewController id="162" userLabel="pausedCallsTableController" customClass="PausedCallsTableView">
<extendedEdge key="edgesForExtendedLayout"/>
<connections>
<outlet property="view" destination="106" id="166"/>
@ -66,7 +68,36 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" showsHorizontalScrollIndicator="NO" style="grouped" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="106" userLabel="callTableView">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="john.doe@sip.linphone.org" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="8" id="8bV-K4-3TY" userLabel="addressLabel">
<rect key="frame" x="90" y="241" width="194" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" tag="7" contentMode="scaleAspectFit" image="avatar.png" id="fZy-K5-yQp" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="46" y="110" width="283" height="283"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact avatar">
<accessibilityTraits key="traits" none="YES" image="YES" notEnabled="YES"/>
<bool key="isElement" value="YES"/>
</accessibility>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="19" id="KPa-Rm-Qni" userLabel="nameLabel">
<rect key="frame" x="46" y="236" width="283" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="37"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="01:34" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Oy8-QO-Jwb" userLabel="durationLabel">
<rect key="frame" x="0.0" y="450" width="375" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" showsHorizontalScrollIndicator="NO" style="grouped" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="106" userLabel="pausedCallsTableView">
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@ -96,7 +127,7 @@
</accessibility>
</view>
<view contentMode="scaleAspectFit" id="127" userLabel="preview">
<rect key="frame" x="254.00000029960563" y="354.99999967643191" width="113" height="140"/>
<rect key="frame" x="254" y="354.99999934763446" width="113" height="140"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
@ -505,6 +536,7 @@
</view>
</objects>
<resources>
<image name="avatar.png" width="261" height="261"/>
<image name="call_hangup.png" width="42" height="37"/>
<image name="camera_default.png" width="33" height="19"/>
<image name="camera_selected.png" width="33" height="19"/>

View file

@ -23,7 +23,7 @@
#import "UICamSwitch.h"
#import "UICompositeView.h"
#import "CallTableView.h"
#import "PausedCallsTableView.h"
#import "UIMicroButton.h"
#import "UIPauseButton.h"
@ -31,6 +31,7 @@
#import "UIVideoButton.h"
#import "UIHangUpButton.h"
#import "UIDigitButton.h"
#import "UIRoundedImageView.h"
@class VideoView;
@ -42,8 +43,7 @@
VideoZoomHandler *videoZoomHandler;
}
@property(nonatomic, strong) IBOutlet CallTableView *callTableController;
@property(nonatomic, strong) IBOutlet UITableView *callTableView;
@property(nonatomic, strong) IBOutlet PausedCallsTableView *pausedCallsTableView;
@property(nonatomic, strong) IBOutlet UIView *videoGroup;
@property(nonatomic, strong) IBOutlet UIView *videoView;
@ -81,6 +81,10 @@
@property(nonatomic, strong) IBOutlet UIDigitButton *starButton;
@property(nonatomic, strong) IBOutlet UIDigitButton *zeroButton;
@property(nonatomic, strong) IBOutlet UIDigitButton *sharpButton;
@property(weak, nonatomic) IBOutlet UILabel *addressLabel;
@property(weak, nonatomic) IBOutlet UIRoundedImageView *avatarImage;
@property(weak, nonatomic) IBOutlet UILabel *nameLabel;
@property(weak, nonatomic) IBOutlet UILabel *durationLabel;
- (IBAction)onRoutesClick:(id)sender;
- (IBAction)onRoutesBluetoothClick:(id)sender;

View file

@ -38,18 +38,6 @@ const NSInteger SECURE_BUTTON_TAG = 5;
BOOL hiddenVolume;
}
@synthesize callTableController;
@synthesize callTableView;
@synthesize videoGroup;
@synthesize videoView;
@synthesize videoPreview;
@synthesize videoCameraSwitch;
@synthesize videoWaitingForFirstImage;
#ifdef TEST_VIDEO_VIEW_CHANGE
@synthesize testVideoView;
#endif
#pragma mark - Lifecycle Functions
- (id)init {
@ -136,8 +124,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[self showSpeaker];
// Set windows (warn memory leaks)
linphone_core_set_native_video_window_id([LinphoneManager getLc], (__bridge void *)(videoView));
linphone_core_set_native_preview_window_id([LinphoneManager getLc], (__bridge void *)(videoPreview));
linphone_core_set_native_video_window_id([LinphoneManager getLc], (__bridge void *)(_videoView));
linphone_core_set_native_preview_window_id([LinphoneManager getLc], (__bridge void *)(_videoPreview));
// Enable tap
[singleFingerTap setEnabled:TRUE];
@ -150,6 +138,14 @@ static UICompositeViewDescription *compositeDescription = nil;
selector:@selector(bluetoothAvailabilityUpdateEvent:)
name:kLinphoneBluetoothAvailabilityUpdate
object:nil];
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
char *uri = linphone_address_as_string_uri_only(addr);
_addressLabel.text = [NSString stringWithUTF8String:uri];
ms_free(uri);
_avatarImage.image =
[FastAddressBook getContactImage:[FastAddressBook getContactWithLinphoneAddress:addr] thumbnail:NO];
}
- (void)viewDidDisappear:(BOOL)animated {
@ -178,15 +174,15 @@ static UICompositeViewDescription *compositeDescription = nil;
[singleFingerTap setCancelsTouchesInView:FALSE];
[PhoneMainView.instance.view addGestureRecognizer:singleFingerTap];
[videoZoomHandler setup:videoGroup];
videoGroup.alpha = 0;
[videoZoomHandler setup:_videoGroup];
_videoGroup.alpha = 0;
[videoCameraSwitch setPreview:videoPreview];
[_videoCameraSwitch setPreview:_videoPreview];
UIPanGestureRecognizer *dragndrop =
[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(moveVideoPreview:)];
dragndrop.minimumNumberOfTouches = 1;
[self.videoPreview addGestureRecognizer:dragndrop];
[_videoPreview addGestureRecognizer:dragndrop];
[_pauseButton setType:UIPauseButtonType_CurrentCall call:nil];
@ -243,7 +239,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
// Update table
[callTableView reloadData];
[_pausedCallsTableView.tableView reloadData];
// Fake call update
if (call == NULL) {
@ -252,11 +248,7 @@ static UICompositeViewDescription *compositeDescription = nil;
switch (state) {
case LinphoneCallIncomingReceived:
case LinphoneCallOutgoingInit: {
if (linphone_core_get_calls_nb(lc) > 1) {
[callTableController minimizeAll];
}
}
case LinphoneCallOutgoingInit:
case LinphoneCallConnected:
case LinphoneCallStreamsRunning: {
// check video
@ -306,12 +298,7 @@ static UICompositeViewDescription *compositeDescription = nil;
break;
}
case LinphoneCallEnd:
case LinphoneCallError: {
if (linphone_core_get_calls_nb(lc) <= 2 && !videoShown) {
[callTableController maximizeAll];
}
break;
}
case LinphoneCallError:
default:
break;
}
@ -395,8 +382,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[UIView setAnimationDuration:0.3];
[PhoneMainView.instance showTabBar:true];
[PhoneMainView.instance showStatusBar:true];
[callTableView setAlpha:1.0];
[videoCameraSwitch setAlpha:1.0];
[_pausedCallsTableView.tableView setAlpha:1.0];
[_videoCameraSwitch setAlpha:1.0];
[UIView commitAnimations];
// hide controls in 5 sec
@ -417,8 +404,8 @@ static UICompositeViewDescription *compositeDescription = nil;
if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription] && videoShown) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[videoCameraSwitch setAlpha:0.0];
[callTableView setAlpha:0.0];
[_videoCameraSwitch setAlpha:0.0];
[_pausedCallsTableView.tableView setAlpha:0.0];
[UIView commitAnimations];
[PhoneMainView.instance showTabBar:false];
@ -426,19 +413,6 @@ static UICompositeViewDescription *compositeDescription = nil;
}
}
#ifdef TEST_VIDEO_VIEW_CHANGE
// Define TEST_VIDEO_VIEW_CHANGE in IncallViewController.h to enable video view switching testing
- (void)_debugChangeVideoView {
static bool normalView = false;
if (normalView) {
linphone_core_set_native_video_window_id([LinphoneManager getLc], (unsigned long)videoView);
} else {
linphone_core_set_native_video_window_id([LinphoneManager getLc], (unsigned long)testVideoView);
}
normalView = !normalView;
}
#endif
- (void)enableVideoDisplay:(BOOL)animation {
if (videoShown && animation)
return;
@ -452,29 +426,28 @@ static UICompositeViewDescription *compositeDescription = nil;
[UIView setAnimationDuration:1.0];
}
[videoGroup setAlpha:1.0];
[callTableView setAlpha:0.0];
[_videoGroup setAlpha:1.0];
[_pausedCallsTableView.tableView setAlpha:0.0];
UIEdgeInsets insets = {33, 0, 25, 0};
[callTableView setContentInset:insets];
[callTableView setScrollIndicatorInsets:insets];
[callTableController minimizeAll];
[_pausedCallsTableView.tableView setContentInset:insets];
[_pausedCallsTableView.tableView setScrollIndicatorInsets:insets];
if (animation) {
[UIView commitAnimations];
}
if (linphone_core_self_view_enabled([LinphoneManager getLc])) {
[videoPreview setHidden:FALSE];
[_videoPreview setHidden:FALSE];
} else {
[videoPreview setHidden:TRUE];
[_videoPreview setHidden:TRUE];
}
if ([LinphoneManager instance].frontCamId != nil) {
// only show camera switch button if we have more than 1 camera
[videoCameraSwitch setHidden:FALSE];
[_videoCameraSwitch setHidden:FALSE];
}
[videoCameraSwitch setAlpha:0.0];
[_videoCameraSwitch setAlpha:0.0];
[PhoneMainView.instance fullScreen:true];
[PhoneMainView.instance showTabBar:false];
@ -489,8 +462,8 @@ static UICompositeViewDescription *compositeDescription = nil;
#endif
// [self batteryLevelChanged:nil];
[videoWaitingForFirstImage setHidden:NO];
[videoWaitingForFirstImage startAnimating];
[_videoWaitingForFirstImage setHidden:NO];
[_videoWaitingForFirstImage startAnimating];
LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
// linphone_call_params_get_used_video_codec return 0 if no video stream enabled
@ -509,19 +482,16 @@ static UICompositeViewDescription *compositeDescription = nil;
[UIView setAnimationDuration:1.0];
}
[videoGroup setAlpha:0.0];
[_videoGroup setAlpha:0.0];
[PhoneMainView.instance showTabBar:true];
UIEdgeInsets insets = {10, 0, 25, 0};
[callTableView setContentInset:insets];
[callTableView setScrollIndicatorInsets:insets];
[callTableView setAlpha:1.0];
if (linphone_core_get_calls_nb([LinphoneManager getLc]) <= 2) {
[callTableController maximizeAll];
}
[_pausedCallsTableView.tableView setContentInset:insets];
[_pausedCallsTableView.tableView setScrollIndicatorInsets:insets];
[_pausedCallsTableView.tableView setAlpha:1.0];
[callTableView setAlpha:1.0];
[videoCameraSwitch setHidden:TRUE];
[_pausedCallsTableView.tableView setAlpha:1.0];
[_videoCameraSwitch setHidden:TRUE];
if (animation) {
[UIView commitAnimations];
@ -546,7 +516,7 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark - Spinner Functions
- (void)hideSpinnerIndicator:(LinphoneCall *)call {
videoWaitingForFirstImage.hidden = TRUE;
_videoWaitingForFirstImage.hidden = TRUE;
}
static void hideSpinner(LinphoneCall *call, void *user_data) {
@ -727,8 +697,8 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
#pragma mark VideoPreviewMoving
- (void)moveVideoPreview:(UIPanGestureRecognizer *)dragndrop {
CGPoint center = [dragndrop locationInView:videoPreview.superview];
self.videoPreview.center = center;
CGPoint center = [dragndrop locationInView:_videoPreview.superview];
_videoPreview.center = center;
if (dragndrop.state == UIGestureRecognizerStateEnded) {
[self previewTouchLift];
}
@ -745,7 +715,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
}
- (void)previewTouchLift {
CGRect previewFrame = self.videoPreview.frame;
CGRect previewFrame = _videoPreview.frame;
previewFrame.origin.x = [self coerce:previewFrame.origin.x
betweenMin:5
andMax:(self.view.frame.size.width - previewFrame.size.width - 5)];
@ -753,12 +723,12 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
betweenMin:5
andMax:(self.view.frame.size.height - previewFrame.size.height - 5)];
if (!CGRectEqualToRect(previewFrame, self.videoPreview.frame)) {
if (!CGRectEqualToRect(previewFrame, _videoPreview.frame)) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.3
animations:^{
LOGI(@"Recentering preview to %@", NSStringFromCGRect(previewFrame));
self.videoPreview.frame = previewFrame;
_videoPreview.frame = previewFrame;
}];
});
}

View file

@ -32,12 +32,11 @@ typedef enum _UICallCellOtherView {
@interface UICallCellData : NSObject {
@public
bool minimize;
UICallCellOtherView view;
LinphoneCall *call;
}
}
- (id)init:(LinphoneCall*) call minimized:(BOOL)minimized;
- (id)init:(LinphoneCall *)call;
@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) NSString *address;
@ -111,6 +110,5 @@ typedef enum _UICallCellOtherView {
- (IBAction)doDetailsSwipe:(UISwipeGestureRecognizer *)sender;
+ (int)getMaximizedHeight;
+ (int)getMinimizedHeight;
@end

View file

@ -24,17 +24,16 @@
#import "FastAddressBook.h"
#import "Utils.h"
#import "PhoneMainView.h"
#import "CallTableView.h"
#import "PausedCallsTableView.h"
@implementation UICallCellData
@synthesize address;
@synthesize image;
- (id)init:(LinphoneCall *)acall minimized:(BOOL)minimized {
- (id)init:(LinphoneCall *)acall {
self = [super init];
if (self != nil) {
self->minimize = minimized;
self->view = UICallCellOtherView_Avatar;
self->call = acall;
image = [UIImage imageNamed:@"avatar_unknown.png"];
@ -202,10 +201,6 @@
#pragma mark - Static Functions
+ (int)getMaximizedHeight {
return LinphoneManager.runningOnIpad ? 600 : 300;
}
+ (int)getMinimizedHeight {
return LinphoneManager.runningOnIpad ? 126 : 63;
}
@ -370,20 +365,13 @@
int duration = linphone_call_get_duration(call);
[stateLabel setText:[NSString stringWithFormat:@"%02i:%02i", (duration / 60), (duration % 60), nil]];
if (!data->minimize) {
CGRect frame = [self frame];
frame.size.height = [UICallCell getMaximizedHeight];
[self setFrame:frame];
frame = otherView.frame;
frame.size.height = [UICallCell getMaximizedHeight];
[otherView setHidden:false];
otherView.frame = frame;
} else {
CGRect frame = [self frame];
frame.size.height = [headerView frame].size.height;
[self setFrame:frame];
[otherView setHidden:true];
}
CGRect frame = [self frame];
frame.size.height = [UICallCell getMaximizedHeight];
[self setFrame:frame];
frame = otherView.frame;
frame.size.height = [UICallCell getMaximizedHeight];
[otherView setHidden:false];
otherView.frame = frame;
[self updateStats];
@ -474,7 +462,7 @@
}
- (void)selfUpdate {
UITableView *tableView = VIEW(CallView).callTableView;
UITableView *tableView = VIEW(CallView).pausedCallsTableView.tableView;
NSIndexPath *index = [tableView indexPathForCell:self];
[tableView reloadRowsAtIndexPaths:@[ index ] withRowAnimation:false];
}
@ -483,7 +471,6 @@
- (IBAction)doHeaderClick:(id)sender {
if (data) {
data->minimize = !data->minimize;
[self selfUpdate];
}
}

View file

@ -23,13 +23,9 @@
#include "linphone/linphonecore.h"
@interface CallTableView : UITableViewController {
@interface PausedCallsTableView : UITableViewController {
@private
NSTimer *updateTime;
BOOL minimized;
}
- (void)minimizeAll;
- (void)maximizeAll;
@end

View file

@ -17,48 +17,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "CallTableView.h"
#import "PausedCallsTableView.h"
#import "UICallCell.h"
#import "UIConferenceHeader.h"
#import "LinphoneManager.h"
#import "Utils.h"
@implementation CallTableView
@implementation PausedCallsTableView
static NSString *const kLinphoneInCallCellData = @"LinphoneInCallCellData";
enum TableSection { ConferenceSection = 0, CallSection = 1 };
#pragma mark - Lifecycle Functions
- (void)initInCallTableViewController {
minimized = false;
}
- (id)init {
self = [super init];
if (self) {
[self initInCallTableViewController];
}
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[self initInCallTableViewController];
}
return self;
}
- (id)initWithCoder:(NSCoder *)decoder {
self = [super initWithCoder:decoder];
if (self) {
[self initInCallTableViewController];
}
return self;
}
#pragma mark - ViewController Functions
- (void)viewWillAppear:(BOOL)animated {
@ -88,7 +58,7 @@ enum TableSection { ConferenceSection = 0, CallSection = 1 };
const MSList *calls = linphone_core_get_calls(lc);
while (calls != 0) {
if (![CallTableView isInConference:((LinphoneCall *)calls->data)]) {
if (![PausedCallsTableView isInConference:((LinphoneCall *)calls->data)]) {
count++;
}
calls = calls->next;
@ -100,7 +70,7 @@ enum TableSection { ConferenceSection = 0, CallSection = 1 };
const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]);
while (calls != 0) {
if ([CallTableView isInConference:(LinphoneCall *)calls->data] == conf) {
if ([PausedCallsTableView isInConference:(LinphoneCall *)calls->data] == conf) {
if (index == 0)
break;
index--;
@ -136,7 +106,7 @@ enum TableSection { ConferenceSection = 0, CallSection = 1 };
if (appData != NULL) {
data = [appData->userInfos objectForKey:kLinphoneInCallCellData];
if (data == nil) {
data = [[UICallCellData alloc] init:call minimized:minimized];
data = [[UICallCellData alloc] init:call];
[appData->userInfos setObject:data forKey:kLinphoneInCallCellData];
}
}
@ -166,35 +136,6 @@ enum TableSection { ConferenceSection = 0, CallSection = 1 };
}
}
}
- (void)minimizeAll {
const MSList *list = linphone_core_get_calls([LinphoneManager getLc]);
minimized = true;
while (list != NULL) {
UICallCellData *data = [self getCallData:(LinphoneCall *)list->data];
if (data) {
data->minimize = true;
} else {
}
list = list->next;
}
[[self tableView] reloadData];
}
- (void)maximizeAll {
const MSList *list = linphone_core_get_calls([LinphoneManager getLc]);
minimized = false;
while (list != NULL) {
UICallCellData *data = [self getCallData:(LinphoneCall *)list->data];
if (data) {
data->minimize = false;
}
list = list->next;
}
[[self tableView] reloadData];
}
#pragma mark - UITableViewDataSource Functions
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@ -208,7 +149,7 @@ enum TableSection { ConferenceSection = 0, CallSection = 1 };
LinphoneCore *lc = [LinphoneManager getLc];
LinphoneCall *currentCall = linphone_core_get_current_call(lc);
LinphoneCall *call = [CallTableView retrieveCallAtIndex:indexPath.row inConference:inConference];
LinphoneCall *call = [PausedCallsTableView retrieveCallAtIndex:indexPath.row inConference:inConference];
[cell setData:[self addCallData:call]];
// Update cell
@ -235,7 +176,7 @@ enum TableSection { ConferenceSection = 0, CallSection = 1 };
LinphoneCore *lc = [LinphoneManager getLc];
if (section == CallSection) {
count = [CallTableView callCount:lc];
count = [PausedCallsTableView callCount:lc];
} else {
count = linphone_core_get_conference_size(lc);
if (linphone_core_is_in_conference(lc)) {
@ -305,11 +246,6 @@ enum TableSection { ConferenceSection = 0, CallSection = 1 };
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
bool inConference = indexPath.section == ConferenceSection;
LinphoneCall *call = [CallTableView retrieveCallAtIndex:indexPath.row inConference:inConference];
UICallCellData *data = [self getCallData:call];
if (data != nil && data->minimize)
return [UICallCell getMinimizedHeight];
return [UICallCell getMaximizedHeight];
}

View file

@ -322,7 +322,7 @@
D306459E1611EC2A00BB571E /* UILoadingImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D306459D1611EC2900BB571E /* UILoadingImageView.m */; };
D3128FE115AABC7E00A2147A /* ContactDetailsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3128FDF15AABC7E00A2147A /* ContactDetailsView.m */; };
D3196D3E15A32BD8007FEEBA /* UITransferButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D3196D3D15A32BD8007FEEBA /* UITransferButton.m */; };
D31AAF5E159B3919002C6B02 /* CallTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D31AAF5D159B3919002C6B02 /* CallTableView.m */; };
D31AAF5E159B3919002C6B02 /* PausedCallsTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D31AAF5D159B3919002C6B02 /* PausedCallsTableView.m */; };
D31B4B21159876C0002E6C72 /* UICompositeView.m in Sources */ = {isa = PBXBuildFile; fileRef = D31B4B1F159876C0002E6C72 /* UICompositeView.m */; };
D31C9C98158A1CDF00756B45 /* UIHistoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D31C9C97158A1CDE00756B45 /* UIHistoryCell.m */; };
D3211BB0159C4EF10098460B /* UIConferenceHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3211BAE159C4EF00098460B /* UIConferenceHeader.m */; };
@ -921,8 +921,8 @@
D3128FDF15AABC7E00A2147A /* ContactDetailsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailsView.m; sourceTree = "<group>"; };
D3196D3C15A32BD7007FEEBA /* UITransferButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITransferButton.h; sourceTree = "<group>"; };
D3196D3D15A32BD8007FEEBA /* UITransferButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITransferButton.m; sourceTree = "<group>"; };
D31AAF5C159B3919002C6B02 /* CallTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallTableView.h; sourceTree = "<group>"; };
D31AAF5D159B3919002C6B02 /* CallTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CallTableView.m; sourceTree = "<group>"; };
D31AAF5C159B3919002C6B02 /* PausedCallsTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PausedCallsTableView.h; sourceTree = "<group>"; };
D31AAF5D159B3919002C6B02 /* PausedCallsTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PausedCallsTableView.m; sourceTree = "<group>"; };
D31B4B1E159876C0002E6C72 /* UICompositeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UICompositeView.h; sourceTree = "<group>"; };
D31B4B1F159876C0002E6C72 /* UICompositeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UICompositeView.m; sourceTree = "<group>"; };
D31C9C96158A1CDE00756B45 /* UIHistoryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIHistoryCell.h; sourceTree = "<group>"; };
@ -1293,8 +1293,8 @@
6346100D1B61409800548952 /* CallOutgoingView.h */,
6346100E1B61409800548952 /* CallOutgoingView.m */,
634610101B6140A500548952 /* CallOutgoingView.xib */,
D31AAF5C159B3919002C6B02 /* CallTableView.h */,
D31AAF5D159B3919002C6B02 /* CallTableView.m */,
D31AAF5C159B3919002C6B02 /* PausedCallsTableView.h */,
D31AAF5D159B3919002C6B02 /* PausedCallsTableView.m */,
D3F83EE91582021700336684 /* CallView.h */,
D3F83EEA1582021700336684 /* CallView.m */,
D381881C15FE3FCA00C3EDCA /* CallView.xib */,
@ -2594,7 +2594,7 @@
D3EA5411159853750037DC6B /* UIChatCell.m in Sources */,
D3F26BF115986B73005F9CAB /* CallIncomingView.m in Sources */,
D31B4B21159876C0002E6C72 /* UICompositeView.m in Sources */,
D31AAF5E159B3919002C6B02 /* CallTableView.m in Sources */,
D31AAF5E159B3919002C6B02 /* PausedCallsTableView.m in Sources */,
D3211BB0159C4EF10098460B /* UIConferenceHeader.m in Sources */,
D32460E6159D9AAD00BA7F3A /* UITransparentView.m in Sources */,
D32B9DFC15A2F131000B6DEC /* FastAddressBook.m in Sources */,