Start to clean InCallView and add UICallCell

This commit is contained in:
Yann Diorcet 2012-06-18 15:18:00 +02:00
parent e03d37c6ed
commit 4b9ae080cd
22 changed files with 410 additions and 1200 deletions

View file

@ -151,8 +151,8 @@ NSTimer *callQualityRefresher;
[view removeFromSuperview];
}
}
UIImageView* callquality = (UIImageView*) [cell viewWithTag:3];
[InCallViewController updateIndicator:callquality withCallQuality:linphone_call_get_average_quality(call)];
//UIImageView* callquality = (UIImageView*) [cell viewWithTag:3];
//[InCallViewController updateIndicator:callquality withCallQuality:linphone_call_get_average_quality(call)];
tableView.rowHeight = 80;
return cell;

View file

@ -30,35 +30,9 @@
@class VideoViewController;
@interface InCallViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate, UITableViewDelegate, UITableViewDataSource, CallActionSheetDelegate> {
UIView* controlSubView, *hangUpView;
UIButton* endCtrl;
UIButton* dialer;
UIButton* contacts;
@interface InCallViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, CallActionSheetDelegate> {
UITableView* callTableView;
UIButton* addCall, *mergeCalls;
UIButton* transfer;
//key pad
UIView* padSubView;
UIDigitButton* one;
UIDigitButton* two;
UIDigitButton* three;
UIDigitButton* four;
UIDigitButton* five;
UIDigitButton* six;
UIDigitButton* seven;
UIDigitButton* eight;
UIDigitButton* nine;
UIDigitButton* star;
UIDigitButton* zero;
UIDigitButton* hash;
UIButton* close;
UIView* videoGroup;
UIView* videoView;
@ -67,13 +41,12 @@
UIView* testVideoView;
#endif
UICamSwitch* videoCameraSwitch;
UIActivityIndicatorView* videoUpdateIndicator;
UIActivityIndicatorView* videoWaitingForFirstImage;
bool dismissed;
NSTimer *durationRefreasher;
NSTimer * glowingTimer;
NSTimer *glowingTimer;
float glow;
NSIndexPath* activePath;
@ -89,45 +62,18 @@
BOOL mIncallViewIsReady;
UIImage* verified, *unverified;
UIImage* stat_sys_signal_0, *stat_sys_signal_1, *stat_sys_signal_2, *stat_sys_signal_3, *stat_sys_signal_4;
UIActionSheet* visibleActionSheet;
NSTimer* hideControlsTimer;
VideoZoomHandler* videoZoomHandler;
}
- (IBAction)doAction:(id)sender;
+ (LinphoneCall*)retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf;
+ (void)updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIView*)accessoryView withCall:(LinphoneCall*) call;
+(LinphoneCall*) retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf;
+ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIView*)accessoryView withCall:(LinphoneCall*) call;
+(void) updateIndicator:(UIImageView*) indicator withCallQuality:(float) quality;
@property (nonatomic, retain) IBOutlet UIView* controlSubView;
@property (nonatomic, retain) IBOutlet UIView* padSubView;
@property (nonatomic, retain) IBOutlet UIView* hangUpView;
@property (nonatomic, retain) IBOutlet UIViewController* conferenceDetail;
@property (nonatomic, retain) IBOutlet UIButton* endCtrl;
@property (nonatomic, retain) IBOutlet UIButton* dialer;
@property (nonatomic, retain) IBOutlet UIButton* contacts;
@property (nonatomic, retain) IBOutlet UITableView* callTableView;
@property (nonatomic, retain) IBOutlet UIButton* addCall;
@property (nonatomic, retain) IBOutlet UIButton* mergeCalls;
@property (nonatomic, retain) IBOutlet UIButton* transfer;
@property (nonatomic, retain) IBOutlet UIButton* one;
@property (nonatomic, retain) IBOutlet UIButton* two;
@property (nonatomic, retain) IBOutlet UIButton* three;
@property (nonatomic, retain) IBOutlet UIButton* four;
@property (nonatomic, retain) IBOutlet UIButton* five;
@property (nonatomic, retain) IBOutlet UIButton* six;
@property (nonatomic, retain) IBOutlet UIButton* seven;
@property (nonatomic, retain) IBOutlet UIButton* eight;
@property (nonatomic, retain) IBOutlet UIButton* nine;
@property (nonatomic, retain) IBOutlet UIButton* star;
@property (nonatomic, retain) IBOutlet UIButton* zero;
@property (nonatomic, retain) IBOutlet UIButton* hash;
@property (nonatomic, retain) IBOutlet UIButton* close;
@property (nonatomic, retain) IBOutlet VideoViewController* videoViewController;
@property (nonatomic, retain) IBOutlet UIView* videoGroup;
@ -136,9 +82,7 @@
@property (nonatomic, retain) IBOutlet UIView* testVideoView;
#endif
@property (nonatomic, retain) IBOutlet UIView* videoPreview;
@property (nonatomic, retain) IBOutlet UIImageView* videoCallQuality;
@property (nonatomic, retain) IBOutlet UICamSwitch* videoCameraSwitch;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView* videoUpdateIndicator;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView* videoWaitingForFirstImage;
@end

View file

@ -17,8 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "IncallViewController.h"
#import "LinphoneManager.h"
#import <AudioToolbox/AudioToolbox.h>
#import <AddressBook/AddressBook.h>
#import <QuartzCore/CAAnimation.h>
@ -26,85 +24,42 @@
#import <OpenGLES/EAGL.h>
#import <OpenGLES/EAGLDrawable.h>
#import "IncallViewController.h"
#import "UICallCell.h"
#import "LinphoneManager.h"
#include "linphonecore.h"
#include "private.h"
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define AT __FILE__ ":" TOSTRING(__LINE__)
const NSInteger SECURE_BUTTON_TAG=5;
@implementation InCallViewController
@synthesize controlSubView;
@synthesize padSubView;
@synthesize hangUpView;
@synthesize conferenceDetail;
@synthesize endCtrl;
@synthesize close;
@synthesize dialer;
@synthesize contacts;
@synthesize callTableView;
@synthesize addCall;
@synthesize mergeCalls;
@synthesize transfer;
@synthesize one;
@synthesize two;
@synthesize three;
@synthesize four;
@synthesize five;
@synthesize six;
@synthesize seven;
@synthesize eight;
@synthesize nine;
@synthesize star;
@synthesize zero;
@synthesize hash;
@synthesize videoViewController;
@synthesize videoGroup;
@synthesize videoView;
@synthesize videoPreview;
@synthesize videoCallQuality;
@synthesize videoCameraSwitch;
@synthesize videoUpdateIndicator;
@synthesize videoWaitingForFirstImage;
#ifdef TEST_VIDEO_VIEW_CHANGE
@synthesize testVideoView;
#endif
//@synthesize addVideo;
+(void) updateIndicator:(UIImageView*) indicator withCallQuality:(float) quality {
if (quality >= 4 || quality < 0) {
[indicator setImage:[UIImage imageNamed:@"stat_sys_signal_4.png"]];
} else if (quality >= 3) {
[indicator setImage:[UIImage imageNamed:@"stat_sys_signal_3.png"]];
} else if (quality >= 2) {
[indicator setImage:[UIImage imageNamed:@"stat_sys_signal_2.png"]];
} else if (quality >= 1) {
[indicator setImage:[UIImage imageNamed:@"stat_sys_signal_1.png"]];
} else {
[indicator setImage:[UIImage imageNamed:@"stat_sys_signal_0.png"]];
}
}
bool isInConference(LinphoneCall* call) {
+ (bool)isInConference:(LinphoneCall*) call {
if (!call)
return false;
return linphone_call_get_current_params(call)->in_conference;
}
int callCount(LinphoneCore* lc) {
+ (int)callCount:(LinphoneCore*) lc {
int count = 0;
const MSList* calls = linphone_core_get_calls(lc);
while (calls != 0) {
if (!isInConference((LinphoneCall*)calls->data)) {
if (![InCallViewController isInConference:((LinphoneCall*)calls->data)]) {
count++;
}
calls = calls->next;
@ -112,8 +67,6 @@ int callCount(LinphoneCore* lc) {
return count;
}
void addAnimationFadeTransition(UIView* view, float duration) {
CATransition* animation = [CATransition animation];
animation.type = kCATransitionFromBottom; // kCATransitionFade;
@ -121,7 +74,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[view.layer addAnimation:animation forKey:nil];
}
-(void) orientationChanged: (NSNotification*) notif {
- (void)orientationChanged: (NSNotification*) notif {
int oldLinphoneOrientation = linphone_core_get_device_rotation([LinphoneManager getLc]);
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
int newRotation = 0;
@ -162,22 +115,21 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.2f];
endCtrl.imageView.transform = transform;
//TODO
//TODO
//endCtrl.imageView.transform = transform;
//mute.imageView.transform = transform;
//speaker.imageView.transform = transform;
//pause.imageView.transform = transform;
contacts.imageView.transform = transform;
addCall.imageView.transform = transform;
//contacts.imageView.transform = transform;
//addCall.imageView.transform = transform;
//addVideo.imageView.transform = transform;
dialer.imageView.transform = transform;
videoCallQuality.transform = transform;
//dialer.imageView.transform = transform;
[UIView commitAnimations];
}
}
}
-(void) showControls:(id)sender {
- (void)showControls:(id)sender {
if (hideControlsTimer) {
[hideControlsTimer invalidate];
hideControlsTimer = nil;
@ -186,7 +138,6 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[[LinphoneManager instance] showTabBar: true];
[hangUpView setAlpha:1.0];
if ([LinphoneManager instance].frontCamId !=nil ) {
// only show camera switch button if we have more than 1 camera
[videoCameraSwitch setAlpha:1.0];
@ -194,56 +145,26 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[UIView commitAnimations];
// hide controls in 5 sec
hideControlsTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(hideControls:) userInfo:nil repeats:NO];
hideControlsTimer = [NSTimer scheduledTimerWithTimeInterval:5.0
target:self
selector:@selector(hideControls:)
userInfo:nil
repeats:NO];
}
-(void) hideControls:(id)sender {
- (void)hideControls:(id)sender {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[controlSubView setAlpha:0.0];
[hangUpView setAlpha:0.0];
[videoCameraSwitch setAlpha:0.0];
[UIView commitAnimations];
[[LinphoneManager instance] showTabBar: false];
[[LinphoneManager instance] showTabBar: false];
hideControlsTimer = nil;
}
-(void) batteryLevelChanged: (NSNotification*) notif {
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
if (!call || !linphone_call_params_video_enabled(linphone_call_get_current_params(call)))
return;
LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call);
if ([UIDevice currentDevice].batteryState == UIDeviceBatteryStateUnplugged) {
float level = [UIDevice currentDevice].batteryLevel;
ms_message("Video call is running. Battery level: %.2f", level);
if (level < 0.1 && !appData->batteryWarningShown) {
// notify user
CallDelegate* cd = [[CallDelegate alloc] init];
cd.eventType = CD_STOP_VIDEO_ON_LOW_BATTERY;
cd.delegate = self;
cd.call = call;
if (visibleActionSheet != nil) {
[visibleActionSheet dismissWithClickedButtonIndex:visibleActionSheet.cancelButtonIndex animated:TRUE];
}
NSString* title = NSLocalizedString(@"Battery is running low. Stop video ?",nil);
visibleActionSheet = [[UIActionSheet alloc] initWithTitle:title
delegate:cd
cancelButtonTitle:NSLocalizedString(@"Continue video",nil)
destructiveButtonTitle:NSLocalizedString(@"Stop video",nil)
otherButtonTitles:nil];
visibleActionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[visibleActionSheet showInView:self.view];
appData->batteryWarningShown = TRUE;
}
}
}
#ifdef TEST_VIDEO_VIEW_CHANGE
// Define TEST_VIDEO_VIEW_CHANGE in IncallViewController.h to enable video view switching testing
-(void) _debugChangeVideoView {
- (void)_debugChangeVideoView {
static bool normalView = false;
if (normalView) {
linphone_core_set_native_video_window_id([LinphoneManager getLc], (unsigned long)videoView);
@ -254,7 +175,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
}
#endif
-(void) enableVideoDisplay {
- (void)enableVideoDisplay {
[self orientationChanged:nil];
[videoZoomHandler resetZoom];
@ -262,8 +183,6 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[videoGroup setAlpha:1.0];
[hangUpView setAlpha:0.0];
[callTableView setAlpha:0.0];
[UIView commitAnimations];
@ -289,15 +208,14 @@ void addAnimationFadeTransition(UIView* view, float duration) {
#ifdef TEST_VIDEO_VIEW_CHANGE
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(_debugChangeVideoView) userInfo:nil repeats:YES];
#endif
[self batteryLevelChanged:nil];
// [self batteryLevelChanged:nil];
}
-(void) disableVideoDisplay {
- (void)disableVideoDisplay {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[videoGroup setAlpha:0.0];
[[LinphoneManager instance] showTabBar: true];
[hangUpView setAlpha:1.0];
[callTableView setAlpha:1.0];
[videoCameraSwitch setAlpha:0.0];
[UIView commitAnimations];
@ -308,22 +226,22 @@ void addAnimationFadeTransition(UIView* view, float duration) {
}
/* restore buttons orientation */
endCtrl.imageView.transform = CGAffineTransformIdentity;
//endCtrl.imageView.transform = CGAffineTransformIdentity;
//TODO
//mute.imageView.transform = CGAffineTransformIdentity;
//speaker.imageView.transform = CGAffineTransformIdentity;
//pause.imageView.transform = CGAffineTransformIdentity;
contacts.imageView.transform = CGAffineTransformIdentity;
addCall.imageView.transform = CGAffineTransformIdentity;
dialer.imageView.transform = CGAffineTransformIdentity;
videoCallQuality.transform = CGAffineTransformIdentity;
//contacts.imageView.transform = CGAffineTransformIdentity;
//addCall.imageView.transform = CGAffineTransformIdentity;
//dialer.imageView.transform = CGAffineTransformIdentity;
//videoCallQuality.transform = CGAffineTransformIdentity;
[[LinphoneManager instance] fullScreen:false];
}
/* Update in call view buttons (visibility, state, ...) and call duration text.
This is called periodically. The fullUpdate boolean is set when called after an event (call state change for instance) */
-(void) updateUIFromLinphoneState:(BOOL) fullUpdate {
- (void)updateUIFromLinphoneState:(BOOL) fullUpdate {
activeCallCell = nil;
// check LinphoneCore is initialized
@ -336,21 +254,6 @@ void addAnimationFadeTransition(UIView* view, float duration) {
// reload table (glow update + call duration)
[callTableView reloadData];
LinphoneCall* currentCall = linphone_core_get_current_call([LinphoneManager getLc]);
// hide pause/resume if in conference
if (currentCall) {
if (fullUpdate) {
videoUpdateIndicator.hidden = YES;
LinphoneCallState state = linphone_call_get_state(currentCall);
if (state == LinphoneCallStreamsRunning || state == LinphoneCallUpdated || state == LinphoneCallUpdatedByRemote) {
} else {
[videoCallQuality setImage:nil];
}
}
}
// [LinphoneManager set:mergeCalls hidden:!pause.hidden withName:"MERGE button" andReason:AT];
// update conference details view if displayed
if (self.presentedViewController == conferenceDetail) {
if (!linphone_core_is_in_conference(lc))
@ -375,7 +278,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
unverified = [[UIImage imageNamed:@"unverified.png"] retain];
//Dialer init
[zero initWithNumber:'0'];
/*[zero initWithNumber:'0'];
[one initWithNumber:'1'];
[two initWithNumber:'2'];
[three initWithNumber:'3'];
@ -390,7 +293,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[addCall addTarget:self action:@selector(addCallPressed) forControlEvents:UIControlEventTouchUpInside];
[mergeCalls addTarget:self action:@selector(mergeCallsPressed) forControlEvents:UIControlEventTouchUpInside];
[LinphoneManager set:mergeCalls hidden:YES withName:"MERGE button" andReason:"initialisation"];
[LinphoneManager set:mergeCalls hidden:YES withName:"MERGE button" andReason:"initialisation"];*/
if ([LinphoneManager runningOnIpad]) {
ms_message("Running on iPad");
@ -415,7 +318,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
mVideoIsPending=FALSE;
//selectedCall = nil;
callTableView.rowHeight = 80;
//callTableView.rowHeight = 80;
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
@ -425,7 +328,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[videoCameraSwitch setPreview:videoPreview];
//addVideo.videoUpdateIndicator = videoUpdateIndicator;
[transfer addTarget:self action:@selector(transferPressed) forControlEvents:UIControlEventTouchUpInside];
//[transfer addTarget:self action:@selector(transferPressed) forControlEvents:UIControlEventTouchUpInside];
// prevent buttons resizing
/*
@ -439,7 +342,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
}
-(void) transferPressed {
- (void)transferPressed {
/* allow only if call is active */
if (!linphone_core_get_current_call([LinphoneManager getLc]))
return;
@ -491,41 +394,25 @@ void addAnimationFadeTransition(UIView* view, float duration) {
}
visibleActionSheet.actionSheetStyle = UIActionSheetStyleDefault;
if ([LinphoneManager runningOnIpad])
[visibleActionSheet showFromRect:transfer.bounds inView:transfer animated:NO];
else
if ([LinphoneManager runningOnIpad]) {
//[visibleActionSheet showFromRect:transfer.bounds inView:transfer animated:NO];
} else
[visibleActionSheet showInView:self.view];
}
}
-(void) addCallPressed {
[LinphoneManager logUIElementPressed:"CALL button"];
[[LinphoneManager instance] changeView:PhoneView_Dialer];
}
-(void) mergeCallsPressed {
[LinphoneManager logUIElementPressed:"MERGE button"];
LinphoneCore* lc = [LinphoneManager getLc];
linphone_core_add_all_to_conference(lc);
}
-(void)updateCallsDurations {
- (void)updateCallsDurations {
[self updateUIFromLinphoneState: NO];
}
-(void) awakeFromNib
{
}
-(void)viewDidAppear:(BOOL)animated {
- (void)viewDidAppear:(BOOL)animated {
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
[super viewDidAppear:animated];
if (dismissed) {
[self dismissModalViewControllerAnimated:true];
} else {
[self updateCallsDurations];
durationRefreasher = [NSTimer scheduledTimerWithTimeInterval:1
durationRefreasher = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(updateCallsDurations)
userInfo:nil
@ -549,21 +436,21 @@ void addAnimationFadeTransition(UIView* view, float duration) {
UIDevice* device = [UIDevice currentDevice];
if ([device respondsToSelector:@selector(isMultitaskingSupported)]
&& [device isMultitaskingSupported]) {
bool enableVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_video_preference"];
//bool enableVideo = [[NSUserDefaults standardUserDefaults] boolForKey:@"enable_video_preference"];
[LinphoneManager set:contacts hidden:enableVideo withName:"CONTACT button" andReason:AT];
//[LinphoneManager set:contacts hidden:enableVideo withName:"CONTACT button" andReason:AT];
//[LinphoneManager set:addVideo hidden:!contacts.hidden withName:"ADD_VIDEO button" andReason:AT];
}
}
}
-(void) viewWillDisappear:(BOOL)animated {
- (void)viewWillDisappear:(BOOL)animated {
if (visibleActionSheet != nil) {
[visibleActionSheet dismissWithClickedButtonIndex:visibleActionSheet.cancelButtonIndex animated:NO];
}
}
- (void) viewDidDisappear:(BOOL)animated {
- (void)viewDidDisappear:(BOOL)animated {
if (durationRefreasher != nil) {
[durationRefreasher invalidate];
durationRefreasher=nil;
@ -581,14 +468,14 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
-(void) displayPad:(bool) enable {
if (videoView.hidden)
[LinphoneManager set:callTableView hidden:enable withName:"CALL_TABLE view" andReason:AT];
[LinphoneManager set:hangUpView hidden:enable withName:"HANG_UP view" andReason:AT];
- (void)displayPad:(bool) enable {
/*if (videoView.hidden)
[LinphoneManager set:callTableView hidden:enable withName:"CALL_TABLE view" andReason:AT];*/
/*[LinphoneManager set:hangUpView hidden:enable withName:"HANG_UP view" andReason:AT];
[LinphoneManager set:controlSubView hidden:enable withName:"CONTROL view" andReason:AT];
[LinphoneManager set:padSubView hidden:!enable withName:"PAD view" andReason:AT];
[LinphoneManager set:padSubView hidden:!enable withName:"PAD view" andReason:AT];*/
}
-(void) displayCall:(LinphoneCall*) call InProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
- (void)displayCall:(LinphoneCall*) call InProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
//restore view
[self displayPad:false];
dismissed = false;
@ -599,11 +486,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[self updateUIFromLinphoneState: YES];
}
-(void) displayIncomingCall:(LinphoneCall *)call NotificationFromUI:(UIViewController *)viewCtrl forUser:(NSString *)username withDisplayName:(NSString *)displayName {
}
-(void) displayInCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
- (void)displayInCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
dismissed = false;
UIDevice *device = [UIDevice currentDevice];
device.proximityMonitoringEnabled = YES;
@ -614,7 +497,8 @@ void addAnimationFadeTransition(UIView* view, float duration) {
[self disableVideoDisplay];
}
-(void) displayDialerFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
- (void)displayDialerFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
[self disableVideoDisplay];
UIViewController* modalVC = self.modalViewController;
UIDevice *device = [UIDevice currentDevice];
@ -638,7 +522,7 @@ void addAnimationFadeTransition(UIView* view, float duration) {
static void hideSpinner(LinphoneCall* lc, void* user_data);
-(void) hideSpinnerIndicator: (LinphoneCall*)call {
- (void)hideSpinnerIndicator: (LinphoneCall*)call {
if (!videoWaitingForFirstImage.hidden) {
videoWaitingForFirstImage.hidden = TRUE;
} /*else {
@ -660,12 +544,12 @@ static void hideSpinner(LinphoneCall* lc, void* user_data);
bool canHideInCallView = (linphone_core_get_calls([LinphoneManager getLc]) == NULL);
switch (state) {
case LinphoneCallIncomingReceived:
/*case LinphoneCallIncomingReceived:
[self displayIncomingCall:call
NotificationFromUI:nil
forUser:lUserName
withDisplayName:lDisplayName];
break;
break;*/
case LinphoneCallOutgoingInit:
[self displayCall:call
@ -713,31 +597,6 @@ static void hideSpinner(LinphoneCall* lc, void* user_data);
[self disableVideoDisplay];
break;
}
case LinphoneCallError: {
if (canHideInCallView) {
[self displayDialerFromUI:nil
forUser:@""
withDisplayName:@""];
} else {
[self displayInCall:call
FromUI:nil
forUser:lUserName
withDisplayName:lDisplayName];
}
break;
}
case LinphoneCallEnd:
if (canHideInCallView) {
[self displayDialerFromUI:nil
forUser:@""
withDisplayName:@""];
} else {
[self displayInCall:call
FromUI:nil
forUser:lUserName
withDisplayName:lDisplayName];
}
break;
case LinphoneCallStreamsRunning:
//check video
if (linphone_call_params_video_enabled(linphone_call_get_current_params(call))) {
@ -759,7 +618,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
[thiz hideSpinnerIndicator:call];
}
-(void) displayVideoCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
- (void)displayVideoCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {
[self enableVideoDisplay];
@ -772,14 +631,14 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
}
}
-(void) dismissActionSheet: (id)o {
- (void)dismissActionSheet: (id)o {
if (visibleActionSheet != nil) {
[visibleActionSheet dismissWithClickedButtonIndex:visibleActionSheet.cancelButtonIndex animated:TRUE];
visibleActionSheet = nil;
}
}
-(void) displayAskToEnableVideoCall:(LinphoneCall*) call forUser:(NSString*) username withDisplayName:(NSString*) displayName {
- (void)displayAskToEnableVideoCall:(LinphoneCall*) call forUser:(NSString*) username withDisplayName:(NSString*) displayName {
if (linphone_core_get_video_policy([LinphoneManager getLc])->automatically_accept)
return;
@ -807,64 +666,24 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
[visibleActionSheet release];
}
-(void) firstVideoFrameDecoded: (LinphoneCall*) call {
- (void)firstVideoFrameDecoded: (LinphoneCall*) call {
// hide video in progress view indicator
videoWaitingForFirstImage.hidden = TRUE;
}
- (IBAction)doAction:(id)sender {
if (sender == dialer) {
[self displayPad:true];
} else if (sender == contacts) {
// start people picker
myPeoplePickerController = [[[ABPeoplePickerNavigationController alloc] init] autorelease];
// TODO
//[myPeoplePickerController setPeoplePickerDelegate:[[ContactPickerDelegate alloc] init] ];
[self presentModalViewController: myPeoplePickerController animated:true];
} else if (sender == close) {
[self displayPad:false];
}
}
// handle people picker behavior
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person {
return true;
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier {
return false;
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
[self dismissModalViewControllerAnimated:true];
}
- (void)dealloc {
[super dealloc];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
+(LinphoneCall*) retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf{
+ (LinphoneCall*)retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf{
const MSList* calls = linphone_core_get_calls([LinphoneManager getLc]);
if (!conf && linphone_core_get_conference_size([LinphoneManager getLc]))
index--;
while (calls != 0) {
if (isInConference((LinphoneCall*)calls->data) == conf) {
if ([InCallViewController isInConference:(LinphoneCall*)calls->data] == conf) {
if (index == 0)
break;
index--;
@ -880,7 +699,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
}
}
-(void) updateActive:(bool_t)active cell:(UITableViewCell*) cell {
- (void)updateActive:(bool_t)active cell:(UITableViewCell*) cell {
if (!active) {
cell.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.2];
@ -897,7 +716,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
[cell.detailTextLabel setBackgroundColor:[UIColor clearColor]];
}
-(void) updateGlow {
- (void)updateGlow {
if (!activeCallCell)
return;
@ -909,11 +728,11 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
[callTableView setNeedsDisplay];
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
[self updateActive:(cell == activeCallCell) cell:cell];
}
+ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIView*)accessoryView withCall:(LinphoneCall*) call {
+ (void)updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIView*)accessoryView withCall:(LinphoneCall*) call {
if (call == NULL) {
ms_warning("UpdateCell called with null call");
[label setText:@""];
@ -999,7 +818,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
}
-(void) updateConferenceCell:(UITableViewCell*) cell at:(NSIndexPath*)indexPath {
- (void)updateConferenceCell:(UITableViewCell*) cell at:(NSIndexPath*)indexPath {
LinphoneCore* lc = [LinphoneManager getLc];
NSString* t= [NSString stringWithFormat:
@ -1021,7 +840,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
cell.imageView.image = nil;
}
-(void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
// show conference detail view
[self presentModalViewController:conferenceDetail animated:true];
@ -1029,32 +848,34 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
}
// UITableViewDataSource (required)
- (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [callTableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UICallCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UICallCell"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont systemFontOfSize:40];
cell.textLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight;
cell = [[UICallCell alloc] init];
}
if([indexPath row] == 0) {
[cell firstCell];
} else {
[cell otherCell];
}
LinphoneCore* lc = [LinphoneManager getLc];
if (indexPath.row == 0 && linphone_core_get_conference_size(lc) > 0) {
[self updateConferenceCell:cell at:indexPath];
/* [self updateConferenceCell:cell at:indexPath];
if (linphone_core_is_in_conference(lc))
activeCallCell = cell;
cell.accessoryView = nil;
if (linphone_core_is_in_conference(lc))
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
else
cell.accessoryType = UITableViewCellAccessoryNone;
cell.accessoryType = UITableViewCellAccessoryNone;*/
} else {
LinphoneCall* call = [InCallViewController retrieveCallAtIndex:indexPath.row inConference:NO];
/*LinphoneCall* call = [InCallViewController retrieveCallAtIndex:indexPath.row inConference:NO];
if (call == nil)
return cell; // return dummy cell
LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call));
if (cell.accessoryView == nil) {
UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)] autorelease];
cell.accessoryView = containerView;
@ -1066,20 +887,22 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
}
[InCallViewController updateCellImageView:cell.imageView Label:cell.textLabel DetailLabel:cell.detailTextLabel AndAccessoryView:(UIView*)cell.accessoryView withCall:call];
if (linphone_core_get_current_call(lc) == call)
activeCallCell = cell;
cell.accessoryType = UITableViewCellAccessoryNone;
activeCallCell = cell;*/
//cell.accessoryType = UITableViewCellAccessoryNone;
// Call Quality Indicator
UIImageView* callquality = [UIImageView new];
//TODO
/*UIImageView* callquality = [UIImageView new];
[callquality setFrame:CGRectMake(0, 0, 28, 28)];
if (call->state == LinphoneCallStreamsRunning)
if (call->state == LinphoneCallStreamsRunning)
{
[InCallViewController updateIndicator: callquality withCallQuality:linphone_call_get_average_quality(call)];
}
else {
[callquality setImage:nil];
}
}*/
/*LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call));
if (enc != LinphoneMediaEncryptionNone) {
cell.accessoryView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 28)] autorelease];
UIButton* accessoryBtn = [UIButton buttonWithType:UIButtonTypeCustom];
@ -1099,18 +922,18 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
if (((UIButton*)accessoryBtn).imageView.image != nil && linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) == LinphoneMediaEncryptionZRTP) {
[((UIButton*)accessoryBtn) addTarget:self action:@selector(secureIconPressed:withEvent:) forControlEvents:UIControlEventTouchUpInside];
}
}
} */
[cell.accessoryView addSubview:callquality];
[callquality release];
//[cell.accessoryView addSubview:callquality];
//[callquality release];
}
cell.userInteractionEnabled = YES;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
/*cell.userInteractionEnabled = YES;
cell.selectionStyle = UITableViewCellSelectionStyleNone;*/
return cell;
}
-(void) secureIconPressed:(UIControl*) button withEvent: (UIEvent*) evt {
- (void)secureIconPressed:(UIControl*) button withEvent: (UIEvent*) evt {
NSSet* touches = [evt allTouches];
UITouch* touch = [touches anyObject];
CGPoint currentTouchPos = [touch locationInView:self.callTableView];
@ -1141,7 +964,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
}
}
-(void) actionSheet:(UIActionSheet *)actionSheet ofType:(enum CallDelegateType)type clickedButtonAtIndex:(NSInteger)buttonIndex withUserDatas:(void *)datas {
- (void)actionSheet:(UIActionSheet *)actionSheet ofType:(enum CallDelegateType)type clickedButtonAtIndex:(NSInteger)buttonIndex withUserDatas:(void *)datas {
LinphoneCall* call = (LinphoneCall*)datas;
// maybe we could verify call validity
@ -1170,16 +993,6 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
visibleActionSheet = nil;
break;
}
case CD_STOP_VIDEO_ON_LOW_BATTERY: {
LinphoneCall* call = (LinphoneCall*)datas;
LinphoneCallParams* paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
if ([visibleActionSheet destructiveButtonIndex] == buttonIndex) {
// stop video
linphone_call_params_enable_video(paramsCopy, FALSE);
linphone_core_update_call([LinphoneManager getLc], call, paramsCopy);
}
break;
}
case CD_TRANSFER_CALL: {
LinphoneCall* call = (LinphoneCall*)datas;
// browse existing call and trasnfer to the one matching the btn id
@ -1209,26 +1022,19 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
}
}
// UITableViewDataSource (required)
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
LinphoneCore* lc = [LinphoneManager getLc];
return callCount(lc) + (int)(linphone_core_get_conference_size(lc) > 0);
if (section == 0 && linphone_core_get_conference_size(lc) > 0)
return linphone_core_get_conference_size(lc) - linphone_core_is_in_conference(lc);
return callCount(lc);
return [InCallViewController callCount:lc] + (int)(linphone_core_get_conference_size(lc) > 0);
}
// UITableViewDataSource
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
LinphoneCore* lc = [LinphoneManager getLc];
int count = 0;
if (callCount(lc) > 0)
if ([InCallViewController callCount:lc] > 0)
count++;
if (linphone_core_get_conference_size([LinphoneManager getLc]) > 0)
@ -1237,14 +1043,12 @@ static void hideSpinner(LinphoneCall* call, void* user_data) {
return count;
}
// UITableViewDataSource
- (NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return nil;
}
// UITableViewDataSource
- (NSString*) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
- (NSString*)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
return nil;
}

File diff suppressed because it is too large Load diff

View file

@ -43,6 +43,7 @@
//TODO
//[LinphoneManager set:mergeCalls hidden:!pause.hidden withName:"MERGE button" andReason:"call count"];
[speakerButton update];
[microButton update];
[pauseButton update];
[videoButton update];

View file

@ -236,21 +236,19 @@
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<bool key="IBUIAdjustsImageWhenHighlighted">NO</bool>
<reference key="IBUIHighlightedTitleColor" ref="707105299"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="838911807"/>
<object class="NSCustomResource" key="IBUIHighlightedBackgroundImage" id="509735403">
<object class="NSCustomResource" key="IBUIHighlightedBackgroundImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">pause-over.png</string>
</object>
<object class="NSCustomResource" key="IBUISelectedBackgroundImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">play-actif.png</string>
</object>
<object class="NSCustomResource" key="IBUINormalBackgroundImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">pause-actif.png</string>
</object>
<reference key="IBUINormalBackgroundImage" ref="509735403"/>
<reference key="IBUIFontDescription" ref="794091713"/>
<reference key="IBUIFont" ref="993152718"/>
</object>
@ -310,15 +308,15 @@
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="838911807"/>
<object class="NSCustomResource" key="IBUIHighlightedBackgroundImage" id="1031230911">
<object class="NSCustomResource" key="IBUIHighlightedBackgroundImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">dialer-meteo-sortir-over.png</string>
<string key="NSResourceName">clavier-secondaire-over.png</string>
</object>
<object class="NSCustomResource" key="IBUISelectedBackgroundImage">
<object class="NSCustomResource" key="IBUISelectedBackgroundImage" id="593667767">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">dialer-meteo-sortir-actif.png</string>
<string key="NSResourceName">clavier-secondaire-actif.png</string>
</object>
<reference key="IBUINormalBackgroundImage" ref="1031230911"/>
<reference key="IBUINormalBackgroundImage" ref="593667767"/>
<reference key="IBUIFontDescription" ref="794091713"/>
<reference key="IBUIFont" ref="993152718"/>
</object>
@ -604,13 +602,14 @@
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="add-call-actif.png">{160, 134}</string>
<string key="add-call-over.png">{160, 134}</string>
<string key="dialer-meteo-sortir-actif.png">{209, 136}</string>
<string key="dialer-meteo-sortir-over.png">{209, 136}</string>
<string key="clavier-secondaire-actif.png">{209, 136}</string>
<string key="clavier-secondaire-over.png">{209, 136}</string>
<string key="micro-OFF-actif.png">{160, 134}</string>
<string key="micro-ON-actif.png">{160, 134}</string>
<string key="micro-ON-over.png">{160, 134}</string>
<string key="pause-actif.png">{209, 136}</string>
<string key="pause-over.png">{209, 136}</string>
<string key="play-actif.png">{209, 136}</string>
<string key="raccrocher-actif.png">{222, 136}</string>
<string key="raccrocher-over.png">{222, 136}</string>
<string key="speacker-OFF-actif.png">{160, 134}</string>

View file

@ -0,0 +1,41 @@
/* UICallCell.h
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <UIKit/UIKit.h>
@interface UICallCell : UITableViewCell {
UIView *firstBackground;
UIView *otherBackground;
UILabel *numberLabel;
UILabel *timeLabel;
UIImageView *stateView;
}
@property (nonatomic, retain) IBOutlet UIView* firstBackground;
@property (nonatomic, retain) IBOutlet UIView* otherBackground;
@property (nonatomic, retain) IBOutlet UILabel* numberLabel;
@property (nonatomic, retain) IBOutlet UILabel* timeLabel;
@property (nonatomic, retain) IBOutlet UIImageView* stateView;
- (void)firstCell;
- (void)otherCell;
@end

View file

@ -0,0 +1,53 @@
/* UICallCell.m
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "UICallCell.h"
@implementation UICallCell
@synthesize firstBackground;
@synthesize otherBackground;
@synthesize stateView;
@synthesize numberLabel;
@synthesize timeLabel;
- (id)init {
if ((self = [super init]) != nil) {
NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"UICallCell"
owner:self
options:nil];
if ([arrayOfViews count] >= 1) {
[self addSubview:[[arrayOfViews objectAtIndex:0] retain]];
}
}
return self;
}
- (void)firstCell{
[firstBackground setHidden:false];
[otherBackground setHidden:true];
}
- (void)otherCell{
[firstBackground setHidden:true];
[otherBackground setHidden:false];
}
@end

View file

@ -50,6 +50,7 @@
ViewsDescription *currentViewDescription;
UIActionSheet *incomingCallActionSheet;
UIActionSheet *batteryActionSheet;
}
@property (nonatomic, retain) IBOutlet UIView* stateBarView;

View file

@ -219,8 +219,18 @@
// Set observers
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeView:) name:@"LinphoneMainViewChange" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callUpdate:) name:@"LinphoneCallUpdate" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(changeView:)
name:@"LinphoneMainViewChange"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(callUpdate:)
name:@"LinphoneCallUpdate"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(batteryLevelChanged:)
name:UIDeviceBatteryLevelDidChangeNotification
object:nil];
}
- (void)viewDidUnload {
@ -409,19 +419,69 @@
}
}
- (void)batteryLevelChanged: (NSNotification*) notif {
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
if (!call || !linphone_call_params_video_enabled(linphone_call_get_current_params(call)))
return;
LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call);
if ([UIDevice currentDevice].batteryState == UIDeviceBatteryStateUnplugged) {
float level = [UIDevice currentDevice].batteryLevel;
ms_message("Video call is running. Battery level: %.2f", level);
if (level < 0.1 && !appData->batteryWarningShown) {
// notify user
CallDelegate* cd = [[CallDelegate alloc] init];
cd.eventType = CD_STOP_VIDEO_ON_LOW_BATTERY;
cd.delegate = self;
cd.call = call;
if (batteryActionSheet != nil) {
[batteryActionSheet dismissWithClickedButtonIndex:batteryActionSheet.cancelButtonIndex animated:TRUE];
}
NSString* title = NSLocalizedString(@"Battery is running low. Stop video ?",nil);
batteryActionSheet = [[UIActionSheet alloc] initWithTitle:title
delegate:cd
cancelButtonTitle:NSLocalizedString(@"Continue video",nil)
destructiveButtonTitle:NSLocalizedString(@"Stop video",nil)
otherButtonTitles:nil];
batteryActionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[batteryActionSheet showInView: self.view];
[batteryActionSheet release];
appData->batteryWarningShown = TRUE;
}
}
}
- (void)actionSheet:(UIActionSheet *)actionSheet ofType:(enum CallDelegateType)type
clickedButtonAtIndex:(NSInteger)buttonIndex
withUserDatas:(void *)datas {
if (type != CD_NEW_CALL)
return;
LinphoneCall* call = (LinphoneCall*)datas;
if (buttonIndex == actionSheet.destructiveButtonIndex) {
linphone_core_accept_call([LinphoneManager getLc], call);
} else {
linphone_core_terminate_call([LinphoneManager getLc], call);
}
incomingCallActionSheet = nil;
switch(type) {
case CD_NEW_CALL:
{
LinphoneCall* call = (LinphoneCall*)datas;
if (buttonIndex == actionSheet.destructiveButtonIndex) {
linphone_core_accept_call([LinphoneManager getLc], call);
} else {
linphone_core_terminate_call([LinphoneManager getLc], call);
}
incomingCallActionSheet = nil;
break;
}
case CD_STOP_VIDEO_ON_LOW_BATTERY:
{
LinphoneCall* call = (LinphoneCall*)datas;
LinphoneCallParams* paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
if ([batteryActionSheet destructiveButtonIndex] == buttonIndex) {
// stop video
linphone_call_params_enable_video(paramsCopy, FALSE);
linphone_core_update_call([LinphoneManager getLc], call, paramsCopy);
}
break;
}
default:
break;
}
}
- (void)dealloc {

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
Resources/play-actif.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
Resources/play-over.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -255,6 +255,32 @@
D35498221587716B000081D8 /* UIStateBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D354981F1587716B000081D8 /* UIStateBar.m */; };
D35498231587716B000081D8 /* UIStateBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = D35498201587716B000081D8 /* UIStateBar.xib */; };
D35498241587716B000081D8 /* UIStateBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = D35498201587716B000081D8 /* UIStateBar.xib */; };
D36C43C6158F2E5A0048BA40 /* UICallCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C43C5158F2E5A0048BA40 /* UICallCell.m */; };
D36C43C7158F2E5A0048BA40 /* UICallCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C43C5158F2E5A0048BA40 /* UICallCell.m */; };
D36C43CA158F2EE50048BA40 /* UICallCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36C43C9158F2EE50048BA40 /* UICallCell.xib */; };
D36C43CB158F2EE50048BA40 /* UICallCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36C43C9158F2EE50048BA40 /* UICallCell.xib */; };
D36C43D1158F2F370048BA40 /* champ-courbe-autres-numeros.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CC158F2F370048BA40 /* champ-courbe-autres-numeros.png */; };
D36C43D2158F2F370048BA40 /* champ-courbe-autres-numeros.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CC158F2F370048BA40 /* champ-courbe-autres-numeros.png */; };
D36C43D3158F2F370048BA40 /* champ-courbe-participant-conf.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CD158F2F370048BA40 /* champ-courbe-participant-conf.png */; };
D36C43D4158F2F370048BA40 /* champ-courbe-participant-conf.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CD158F2F370048BA40 /* champ-courbe-participant-conf.png */; };
D36C43D5158F2F370048BA40 /* champ-titre-conference.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CE158F2F370048BA40 /* champ-titre-conference.png */; };
D36C43D6158F2F370048BA40 /* champ-titre-conference.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CE158F2F370048BA40 /* champ-titre-conference.png */; };
D36C43D7158F2F370048BA40 /* clavier-secondaire-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CF158F2F370048BA40 /* clavier-secondaire-actif.png */; };
D36C43D8158F2F370048BA40 /* clavier-secondaire-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43CF158F2F370048BA40 /* clavier-secondaire-actif.png */; };
D36C43D9158F2F370048BA40 /* clavier-secondaire-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43D0158F2F370048BA40 /* clavier-secondaire-over.png */; };
D36C43DA158F2F370048BA40 /* clavier-secondaire-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43D0158F2F370048BA40 /* clavier-secondaire-over.png */; };
D36C43E9158F3F7E0048BA40 /* play-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43E7158F3F7E0048BA40 /* play-actif.png */; };
D36C43EA158F3F7E0048BA40 /* play-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43E7158F3F7E0048BA40 /* play-actif.png */; };
D36C43EB158F3F7E0048BA40 /* play-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43E8158F3F7E0048BA40 /* play-over.png */; };
D36C43EC158F3F7E0048BA40 /* play-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43E8158F3F7E0048BA40 /* play-over.png */; };
D36C43F1158F61EA0048BA40 /* pause-champ-numero-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43ED158F61EA0048BA40 /* pause-champ-numero-actif.png */; };
D36C43F2158F61EA0048BA40 /* pause-champ-numero-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43ED158F61EA0048BA40 /* pause-champ-numero-actif.png */; };
D36C43F3158F61EA0048BA40 /* pause-champ-numero-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43EE158F61EA0048BA40 /* pause-champ-numero-over.png */; };
D36C43F4158F61EA0048BA40 /* pause-champ-numero-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43EE158F61EA0048BA40 /* pause-champ-numero-over.png */; };
D36C43F5158F61EA0048BA40 /* play-champ-numero-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43EF158F61EA0048BA40 /* play-champ-numero-actif.png */; };
D36C43F6158F61EA0048BA40 /* play-champ-numero-actif.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43EF158F61EA0048BA40 /* play-champ-numero-actif.png */; };
D36C43F7158F61EA0048BA40 /* play-champ-numero-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43F0158F61EA0048BA40 /* play-champ-numero-over.png */; };
D36C43F8158F61EA0048BA40 /* play-champ-numero-over.png in Resources */ = {isa = PBXBuildFile; fileRef = D36C43F0158F61EA0048BA40 /* play-champ-numero-over.png */; };
D36FB2D51589EF7C0036F6F2 /* UIPauseButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D36FB2D41589EF7C0036F6F2 /* UIPauseButton.m */; };
D36FB2D61589EF7C0036F6F2 /* UIPauseButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D36FB2D41589EF7C0036F6F2 /* UIPauseButton.m */; };
D37295CA158B1E2D00D2C0C7 /* registration_inprogress.png in Resources */ = {isa = PBXBuildFile; fileRef = D37295C9158B1E2D00D2C0C7 /* registration_inprogress.png */; };
@ -807,6 +833,20 @@
D354981E1587716B000081D8 /* UIStateBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIStateBar.h; sourceTree = "<group>"; };
D354981F1587716B000081D8 /* UIStateBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIStateBar.m; sourceTree = "<group>"; };
D35498201587716B000081D8 /* UIStateBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIStateBar.xib; sourceTree = "<group>"; };
D36C43C4158F2E5A0048BA40 /* UICallCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UICallCell.h; sourceTree = "<group>"; };
D36C43C5158F2E5A0048BA40 /* UICallCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UICallCell.m; sourceTree = "<group>"; };
D36C43C9158F2EE50048BA40 /* UICallCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UICallCell.xib; sourceTree = "<group>"; };
D36C43CC158F2F370048BA40 /* champ-courbe-autres-numeros.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "champ-courbe-autres-numeros.png"; path = "Resources/champ-courbe-autres-numeros.png"; sourceTree = "<group>"; };
D36C43CD158F2F370048BA40 /* champ-courbe-participant-conf.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "champ-courbe-participant-conf.png"; path = "Resources/champ-courbe-participant-conf.png"; sourceTree = "<group>"; };
D36C43CE158F2F370048BA40 /* champ-titre-conference.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "champ-titre-conference.png"; path = "Resources/champ-titre-conference.png"; sourceTree = "<group>"; };
D36C43CF158F2F370048BA40 /* clavier-secondaire-actif.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clavier-secondaire-actif.png"; path = "Resources/clavier-secondaire-actif.png"; sourceTree = "<group>"; };
D36C43D0158F2F370048BA40 /* clavier-secondaire-over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clavier-secondaire-over.png"; path = "Resources/clavier-secondaire-over.png"; sourceTree = "<group>"; };
D36C43E7158F3F7E0048BA40 /* play-actif.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "play-actif.png"; path = "Resources/play-actif.png"; sourceTree = "<group>"; };
D36C43E8158F3F7E0048BA40 /* play-over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "play-over.png"; path = "Resources/play-over.png"; sourceTree = "<group>"; };
D36C43ED158F61EA0048BA40 /* pause-champ-numero-actif.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "pause-champ-numero-actif.png"; path = "Resources/pause-champ-numero-actif.png"; sourceTree = "<group>"; };
D36C43EE158F61EA0048BA40 /* pause-champ-numero-over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "pause-champ-numero-over.png"; path = "Resources/pause-champ-numero-over.png"; sourceTree = "<group>"; };
D36C43EF158F61EA0048BA40 /* play-champ-numero-actif.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "play-champ-numero-actif.png"; path = "Resources/play-champ-numero-actif.png"; sourceTree = "<group>"; };
D36C43F0158F61EA0048BA40 /* play-champ-numero-over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "play-champ-numero-over.png"; path = "Resources/play-champ-numero-over.png"; sourceTree = "<group>"; };
D36FB2D31589EF7C0036F6F2 /* UIPauseButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPauseButton.h; sourceTree = "<group>"; };
D36FB2D41589EF7C0036F6F2 /* UIPauseButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPauseButton.m; sourceTree = "<group>"; };
D37295C9158B1E2D00D2C0C7 /* registration_inprogress.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = registration_inprogress.png; path = Resources/registration_inprogress.png; sourceTree = "<group>"; };
@ -1282,6 +1322,9 @@
D326483D1588950F00930C67 /* UICallBar.xib */,
2214EB7812F846B1002A5394 /* UICallButton.h */,
2214EB7912F846B1002A5394 /* UICallButton.m */,
D36C43C4158F2E5A0048BA40 /* UICallCell.h */,
D36C43C5158F2E5A0048BA40 /* UICallCell.m */,
D36C43C9158F2EE50048BA40 /* UICallCell.xib */,
22AA8AFF13D83F6300B30535 /* UICamSwitch.h */,
22AA8B0013D83F6300B30535 /* UICamSwitch.m */,
D3A55FBA15877E5E003FD403 /* UIContactCell.h */,
@ -1476,8 +1519,6 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
D37295DA158B3C9600D2C0C7 /* video-OFF-disabled.png */,
D37295C9158B1E2D00D2C0C7 /* registration_inprogress.png */,
D3F83F2C1582223B00336684 /* 0-actif.png */,
D3F83F2D1582223B00336684 /* 0-over.png */,
D3F83F2E1582223B00336684 /* 1-actif.png */,
@ -1521,7 +1562,12 @@
D354981915876FE7000081D8 /* bouton-detail-contact-over.png */,
D3F83F801582278D00336684 /* cancel-actif.png */,
D3F83F811582278D00336684 /* cancel-over.png */,
D36C43CC158F2F370048BA40 /* champ-courbe-autres-numeros.png */,
D36C43CD158F2F370048BA40 /* champ-courbe-participant-conf.png */,
D3ED3E441585FB8C006C0DE4 /* champ-saisie-numero.png */,
D36C43CE158F2F370048BA40 /* champ-titre-conference.png */,
D36C43CF158F2F370048BA40 /* clavier-secondaire-actif.png */,
D36C43D0158F2F370048BA40 /* clavier-secondaire-over.png */,
D3F83F821582278D00336684 /* contact-actif-add-call.png */,
D3F83F831582278D00336684 /* contact-over-add-call.png */,
D38327EB1580FE3A00FA0D23 /* contacts-actif.png */,
@ -1565,7 +1611,13 @@
2242E312125235120061DDCE /* oldphone-mono-30s.caf */,
2237D4081084D7A9001383EE /* oldphone-mono.wav */,
D3F83EF8158205A100336684 /* pause-actif.png */,
D36C43ED158F61EA0048BA40 /* pause-champ-numero-actif.png */,
D36C43EE158F61EA0048BA40 /* pause-champ-numero-over.png */,
D3F83EF9158205A100336684 /* pause-over.png */,
D36C43E7158F3F7E0048BA40 /* play-actif.png */,
D36C43EF158F61EA0048BA40 /* play-champ-numero-actif.png */,
D36C43F0158F61EA0048BA40 /* play-champ-numero-over.png */,
D36C43E8158F3F7E0048BA40 /* play-over.png */,
D3432A5E158A4446001C6B0B /* quality-call-0.png */,
D3432A5F158A4446001C6B0B /* quality-call-1.png */,
D3432A60158A4446001C6B0B /* quality-call-2.png */,
@ -1574,6 +1626,7 @@
D3F83EFB158205A100336684 /* raccrocher-over.png */,
D3F83F761582253100336684 /* refuser-actif.png */,
D3F83F771582253100336684 /* refuser-over.png */,
D37295C9158B1E2D00D2C0C7 /* registration_inprogress.png */,
22F254801073D99800AC9B3F /* ringback.wav */,
70571E1913FABCB000CDD3C2 /* rootca.pem */,
D38327EF1580FE3A00FA0D23 /* settings-actif.png */,
@ -1593,6 +1646,7 @@
D38327FF158100E400FA0D23 /* tchat-over.png */,
D38327F21580FE3A00FA0D23 /* tchat-selectionne.png */,
D3F83F00158205A100336684 /* video-OFF-actif.png */,
D37295DA158B3C9600D2C0C7 /* video-OFF-disabled.png */,
D3F83F01158205A100336684 /* video-OFF-over.png */,
D3F83F02158205A100336684 /* video-ON-actif.png */,
D3F83F03158205A100336684 /* video-ON-over.png */,
@ -1836,6 +1890,18 @@
D3432A73158A45AF001C6B0B /* status_disconnected.png in Resources */,
D37295CA158B1E2D00D2C0C7 /* registration_inprogress.png in Resources */,
D37295DB158B3C9600D2C0C7 /* video-OFF-disabled.png in Resources */,
D36C43CA158F2EE50048BA40 /* UICallCell.xib in Resources */,
D36C43D1158F2F370048BA40 /* champ-courbe-autres-numeros.png in Resources */,
D36C43D3158F2F370048BA40 /* champ-courbe-participant-conf.png in Resources */,
D36C43D5158F2F370048BA40 /* champ-titre-conference.png in Resources */,
D36C43D7158F2F370048BA40 /* clavier-secondaire-actif.png in Resources */,
D36C43D9158F2F370048BA40 /* clavier-secondaire-over.png in Resources */,
D36C43E9158F3F7E0048BA40 /* play-actif.png in Resources */,
D36C43EB158F3F7E0048BA40 /* play-over.png in Resources */,
D36C43F1158F61EA0048BA40 /* pause-champ-numero-actif.png in Resources */,
D36C43F3158F61EA0048BA40 /* pause-champ-numero-over.png in Resources */,
D36C43F5158F61EA0048BA40 /* play-champ-numero-actif.png in Resources */,
D36C43F7158F61EA0048BA40 /* play-champ-numero-over.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1971,6 +2037,18 @@
D3432A74158A45AF001C6B0B /* status_disconnected.png in Resources */,
D37295CB158B1E2D00D2C0C7 /* registration_inprogress.png in Resources */,
D37295DC158B3C9600D2C0C7 /* video-OFF-disabled.png in Resources */,
D36C43CB158F2EE50048BA40 /* UICallCell.xib in Resources */,
D36C43D2158F2F370048BA40 /* champ-courbe-autres-numeros.png in Resources */,
D36C43D4158F2F370048BA40 /* champ-courbe-participant-conf.png in Resources */,
D36C43D6158F2F370048BA40 /* champ-titre-conference.png in Resources */,
D36C43D8158F2F370048BA40 /* clavier-secondaire-actif.png in Resources */,
D36C43DA158F2F370048BA40 /* clavier-secondaire-over.png in Resources */,
D36C43EA158F3F7E0048BA40 /* play-actif.png in Resources */,
D36C43EC158F3F7E0048BA40 /* play-over.png in Resources */,
D36C43F2158F61EA0048BA40 /* pause-champ-numero-actif.png in Resources */,
D36C43F4158F61EA0048BA40 /* pause-champ-numero-over.png in Resources */,
D36C43F6158F61EA0048BA40 /* play-champ-numero-actif.png in Resources */,
D36C43F8158F61EA0048BA40 /* play-champ-numero-over.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2018,6 +2096,7 @@
D36FB2D51589EF7C0036F6F2 /* UIPauseButton.m in Sources */,
D31C9C98158A1CDF00756B45 /* UIHistoryCell.m in Sources */,
D32409C3158B49A600C8C119 /* UILongTouchButton.m in Sources */,
D36C43C6158F2E5A0048BA40 /* UICallCell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2062,6 +2141,7 @@
D36FB2D61589EF7C0036F6F2 /* UIPauseButton.m in Sources */,
D31C9C99158A1CDF00756B45 /* UIHistoryCell.m in Sources */,
D32409C4158B49A600C8C119 /* UILongTouchButton.m in Sources */,
D36C43C7158F2E5A0048BA40 /* UICallCell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};