From 39799eeaae405dc505d5087c8821331857ef73d7 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 7 Jan 2016 12:04:35 +0100 Subject: [PATCH] call: fix stats view being refreshed twice when opened --- Classes/CallSideMenuView.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Classes/CallSideMenuView.m b/Classes/CallSideMenuView.m index a8bb1cdb8..cd46d4ba8 100644 --- a/Classes/CallSideMenuView.m +++ b/Classes/CallSideMenuView.m @@ -18,9 +18,16 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - updateTimer = - [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updateStats) userInfo:nil repeats:YES]; - [self updateStats]; + if (updateTimer != nil) { + [updateTimer invalidate]; + } + updateTimer = [NSTimer scheduledTimerWithTimeInterval:1 + target:self + selector:@selector(updateStats:) + userInfo:nil + repeats:YES]; + + [self updateStats:nil]; } - (void)viewWillDisappear:(BOOL)animated { @@ -126,7 +133,7 @@ return result; } -- (void)updateStats { +- (void)updateStats:(NSTimer *)timer { LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]); if (!call) {