From 50e2a6bd07fa8cecaaf5b2a372940a077ed90c0d Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 24 Aug 2012 16:49:15 +0200 Subject: [PATCH] Add Console view --- Classes/ChatViewController.xib | 5 + Classes/ConsoleViewController.h | 10 +- Classes/ConsoleViewController.m | 129 ++++++++++---- Classes/ConsoleViewController.xib | 165 +++++------------- Classes/ContactDetailsLabelViewController.xib | 15 +- Classes/ContactDetailsViewController.xib | 16 ++ Classes/ContactsViewController.xib | 12 +- Classes/HistoryViewController.xib | 8 +- Classes/InCallViewController.xib | 124 ++++++++++++- Classes/LinphoneCoreSettingsStore.m | 11 +- Classes/LinphoneManager.h | 5 +- Classes/LinphoneManager.m | 49 ++++-- Classes/LinphoneUI/LogView.h | 27 --- Classes/PhoneMainView.h | 1 + Classes/PhoneMainView.m | 2 +- Classes/SettingsViewController.m | 17 ++ Settings/InAppSettings.bundle/Advanced.plist | 20 +++ linphone.xcodeproj/project.pbxproj | 6 +- 18 files changed, 401 insertions(+), 221 deletions(-) delete mode 100644 Classes/LinphoneUI/LogView.h diff --git a/Classes/ChatViewController.xib b/Classes/ChatViewController.xib index 395f02293..456aea221 100644 --- a/Classes/ChatViewController.xib +++ b/Classes/ChatViewController.xib @@ -148,6 +148,7 @@ {{0, 58}, {320, 402}} + _NS:9 1 @@ -160,6 +161,10 @@ 0.0 0.0 YES + 0.0 + 10 + 0.0 + 0.0 1 0 YES diff --git a/Classes/ConsoleViewController.h b/Classes/ConsoleViewController.h index 2512b8251..b1cc77e97 100644 --- a/Classes/ConsoleViewController.h +++ b/Classes/ConsoleViewController.h @@ -18,15 +18,11 @@ */ #import +#import "UICompositeViewController.h" -#import "LogView.h" - -@interface ConsoleViewController : UIViewController { +@interface ConsoleViewController : UIViewController { } --(void) doAction; - -@property (nonatomic, retain) IBOutlet UITextView* logs; -@property (nonatomic, retain) IBOutlet UIView* logsView; +@property (nonatomic, retain) IBOutlet UIWebView* logsView; @end diff --git a/Classes/ConsoleViewController.m b/Classes/ConsoleViewController.m index 46e8c8cb4..6e289805b 100644 --- a/Classes/ConsoleViewController.m +++ b/Classes/ConsoleViewController.m @@ -22,49 +22,110 @@ @implementation ConsoleViewController -NSMutableString* MoreViewController_logs; - -@synthesize logs; @synthesize logsView; -- (void)viewDidLoad { - [super viewDidLoad]; - UIBarButtonItem* clear = [[[UIBarButtonItem alloc] - initWithBarButtonSystemItem:UIBarButtonSystemItemTrash - target:self - action:@selector(doAction)] autorelease]; - [self.navigationItem setRightBarButtonItem:clear]; -} -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [logs setText:MoreViewController_logs]; -} -- (void)addLog:(NSString*) log { - @synchronized(self) { - if (!MoreViewController_logs) { - MoreViewController_logs = [[NSMutableString alloc] init]; - } - [MoreViewController_logs appendString:log]; - if (MoreViewController_logs.length > 50000) { - NSRange range = {0,log.length}; - [MoreViewController_logs deleteCharactersInRange:range]; - } - } -} +#pragma mark - Lifecycle Functions -- (void)doAction{ - @synchronized(self) { - NSMutableString* oldString = MoreViewController_logs; - MoreViewController_logs = [[NSMutableString alloc] init]; - [oldString release]; - [logs setText:@""]; - } +- (id)init { + return [super initWithNibName:@"ConsoleViewController" bundle:[NSBundle mainBundle]]; } - (void)dealloc { + // Remove observer + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [logsView release]; + [super dealloc]; } +#pragma mark - UICompositeViewDelegate Functions + +static UICompositeViewDescription *compositeDescription = nil; + ++ (UICompositeViewDescription *)compositeViewDescription { + if(compositeDescription == nil) { + compositeDescription = [[UICompositeViewDescription alloc] init:@"ConsoleView" + content:@"ConsoleViewController" + stateBar:@"UIStateBar" + stateBarEnabled:true + tabBar:@"UIMainBar" + tabBarEnabled:true + fullscreen:false + landscapeMode:[LinphoneManager runningOnIpad] + portraitMode:true]; + } + return compositeDescription; +} + + +#pragma mark - ViewController Functions + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + [logsView loadHTMLString:@"
" baseURL:nil];
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    
+    // Remove observer
+    [[NSNotificationCenter defaultCenter] removeObserver:self
+                                                    name:kLinphoneLogsUpdate
+                                                  object:nil];
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    [logsView setDelegate:self];
+    
+    UIEdgeInsets inset = {0, 0, 10, 0};
+    [logsView.scrollView setContentInset:inset];
+    [logsView.scrollView setScrollIndicatorInsets:inset];
+    
+    [logsView.scrollView setBounces:FALSE];
+}
+
+
+#pragma mark - UIWebViewDelegate Functions
+
+- (void)webViewDidFinishLoad:(UIWebView *)webView {
+    NSString *logs = [[LinphoneManager instance].logs componentsJoinedByString:@"\\n"];
+    [self addLog:logs scroll:TRUE];
+    
+    // Set observer
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(logsUpdateEvent:)
+                                                 name:kLinphoneLogsUpdate
+                                               object:nil];
+}
+
+
+#pragma mark - Event Functions
+
+- (void)logsUpdateEvent:(NSNotification*)notif {
+    NSString *log = [notif.userInfo objectForKey: @"log"];
+    [self addLog:log scroll:FALSE];
+}
+
+
+#pragma mark - 
+
+- (void)clear {
+    NSString *js = @"document.getElementById('content').innerHTML += ''";
+    [logsView stringByEvaluatingJavaScriptFromString:js];
+}
+
+- (void)addLog:(NSString*)log scroll:(BOOL)scroll {
+    NSMutableString *js = [NSMutableString stringWithFormat:@"document.getElementById('content').innerHTML += \"%@\\n\";", [log stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]];
+    if(scroll) {
+        [js appendString:@"window.scrollTo(0, document.body.scrollHeight);"];
+    }
+    [logsView stringByEvaluatingJavaScriptFromString:js];
+}
+
 @end
diff --git a/Classes/ConsoleViewController.xib b/Classes/ConsoleViewController.xib
index 9b81061ea..2276a8ec7 100644
--- a/Classes/ConsoleViewController.xib
+++ b/Classes/ConsoleViewController.xib
@@ -13,9 +13,8 @@
 		
 			YES
 			IBProxyObject
-			IBUITextView
 			IBUIView
-			IBUIViewController
+			IBUIWebView
 		
 		
 			YES
@@ -35,86 +34,40 @@
 				IBFirstResponder
 				IBCocoaTouchFramework
 			
-			
-				
-					
-					292
-					
-						YES
-						
-							
-							274
-							{320, 450}
-							
-							
-							
-								1
-								MSAxIDEAA
-							
-							YES
-							YES
-							IBCocoaTouchFramework
-							NO
-							NO
-							NO
-							NO
-							NO
-							
-							
-								2
-								IBCocoaTouchFramework
-							
-							
-								1
-								17
-							
-							
-								Helvetica
-								17
-								16
-							
+			
+				
+				292
+				
+					YES
+					
+						
+						274
+						{320, 460}
+						
+						
+						_NS:9
+						
+							3
+							MQA
 						
+						IBCocoaTouchFramework
 					
-					{320, 460}
-					
-					
-					
-						3
-						MQA
-						
-							2
-						
-					
-					NO
-					IBCocoaTouchFramework
 				
-				
-					1
-					1
+				{320, 460}
+				
+				
+				
+				
+					3
+					MCAwAA
 				
+				NO
 				IBCocoaTouchFramework
-				NO
 			
 		
 		
 			
 				YES
-				
-					
-						logs
-						
-						
-					
-					9
-				
-				
-					
-						logsView
-						
-						
-					
-					13
-				
 				
 					
 						view
@@ -123,6 +76,14 @@
 					
 					14
 				
+				
+					
+						logsView
+						
+						
+					
+					19
+				
 			
 			
 				
@@ -146,29 +107,20 @@
 						
 						
 					
-					
-						10
-						
-						
-							YES
-							
-						
-						
-					
 					
 						4
 						
 						
 							YES
-							
+							
 						
-						
-						logView
+						
 					
 					
-						7
-						
+						18
+						
 						
+						logsView
 					
 				
 			
@@ -180,10 +132,8 @@
 					-1.IBPluginDependency
 					-2.CustomClassName
 					-2.IBPluginDependency
-					10.CustomClassName
-					10.IBPluginDependency
+					18.IBPluginDependency
 					4.IBPluginDependency
-					7.IBPluginDependency
 				
 				
 					YES
@@ -191,8 +141,6 @@
 					com.apple.InterfaceBuilder.IBCocoaTouchPlugin
 					UIResponder
 					com.apple.InterfaceBuilder.IBCocoaTouchPlugin
-					ConsoleViewController
-					com.apple.InterfaceBuilder.IBCocoaTouchPlugin
 					com.apple.InterfaceBuilder.IBCocoaTouchPlugin
 					com.apple.InterfaceBuilder.IBCocoaTouchPlugin
 				
@@ -209,7 +157,7 @@
 				
 			
 			
-			14
+			19
 		
 		
 			
@@ -218,35 +166,14 @@
 					ConsoleViewController
 					UIViewController
 					
-						YES
-						
-							YES
-							logs
-							logsView
-						
-						
-							YES
-							UITextView
-							UIView
-						
+						logsView
+						UIWebView
 					
 					
-						YES
-						
-							YES
-							logs
-							logsView
-						
-						
-							YES
-							
-								logs
-								UITextView
-							
-							
-								logsView
-								UIView
-							
+						logsView
+						
+							logsView
+							UIWebView
 						
 					
 					
diff --git a/Classes/ContactDetailsLabelViewController.xib b/Classes/ContactDetailsLabelViewController.xib
index 838b54351..337923bac 100644
--- a/Classes/ContactDetailsLabelViewController.xib
+++ b/Classes/ContactDetailsLabelViewController.xib
@@ -133,6 +133,7 @@
 						{{0, 59}, {320, 401}}
 						
 						
+						
 						_NS:9
 						
 							10
@@ -201,6 +202,10 @@ AAgACAAIAAEAAQABAAE
 						0.0
 						YES
 						NO
+						0.0
+						10
+						0.0
+						0.0
 						1
 						2
 						0
@@ -350,7 +355,7 @@ AAgACAAIAAEAAQABAAE
 			
 				
 					ContactDetailsLabelViewController
-					UIModalViewController
+					UIViewController
 					
 						onBackClick:
 						id
@@ -378,14 +383,6 @@ AAgACAAIAAEAAQABAAE
 						./Classes/ContactDetailsLabelViewController.h
 					
 				
-				
-					UIModalViewController
-					UIViewController
-					
-						IBProjectSource
-						./Classes/UIModalViewController.h
-					
-				
 			
 		
 		0
diff --git a/Classes/ContactDetailsViewController.xib b/Classes/ContactDetailsViewController.xib
index 4f71c2019..3e234fe1f 100644
--- a/Classes/ContactDetailsViewController.xib
+++ b/Classes/ContactDetailsViewController.xib
@@ -177,6 +177,7 @@
 						{{0, 59}, {320, 401}}
 						
 						
+						
 						_NS:9
 						
 							10
@@ -244,6 +245,10 @@ AAgACAAIAAEAAQABAAE
 						0.0
 						0.0
 						YES
+						0.0
+						10
+						0.0
+						0.0
 						1
 						2
 						0
@@ -661,6 +666,17 @@ AAgACAAIAAEAAQABAAE
 				
 					UIContactDetailsHeader
 					UIViewController
+					
+						onAvatarClick:
+						id
+					
+					
+						onAvatarClick:
+						
+							onAvatarClick:
+							id
+						
+					
 					
 						UILabel
 						UIImageView
diff --git a/Classes/ContactsViewController.xib b/Classes/ContactsViewController.xib
index 1a98f54c2..33412ac1a 100644
--- a/Classes/ContactsViewController.xib
+++ b/Classes/ContactsViewController.xib
@@ -48,6 +48,7 @@
 								{320, 58}
 								
 								
+								
 								_NS:9
 								NO
 								IBCocoaTouchFramework
@@ -101,7 +102,7 @@
 								{{214, 0}, {106, 58}}
 								
 								
-								
+								
 								_NS:9
 								NO
 								
@@ -158,7 +159,7 @@
 								{108, 58}
 								
 								
-								
+								
 								_NS:9
 								NO
 								
@@ -184,7 +185,7 @@
 						{320, 58}
 						
 						
-						
+						
 						_NS:9
 						
 							3
@@ -201,6 +202,7 @@
 						{{0, 58}, {320, 402}}
 						
 						
+						
 						_NS:10
 						
 							1
@@ -214,6 +216,10 @@
 						0.0
 						YES
 						NO
+						0.0
+						10
+						0.0
+						0.0
 						1
 						0
 						YES
diff --git a/Classes/HistoryViewController.xib b/Classes/HistoryViewController.xib
index 832f4cb67..8761d07bb 100644
--- a/Classes/HistoryViewController.xib
+++ b/Classes/HistoryViewController.xib
@@ -48,6 +48,7 @@
 								{320, 58}
 								
 								
+								
 								_NS:9
 								NO
 								IBCocoaTouchFramework
@@ -160,7 +161,7 @@
 						{320, 58}
 						
 						
-						
+						
 						_NS:9
 						
 							3
@@ -177,6 +178,7 @@
 						{{0, 58}, {320, 402}}
 						
 						
+						
 						_NS:9
 						
 							1
@@ -189,6 +191,10 @@
 						0.0
 						0.0
 						YES
+						0.0
+						10
+						0.0
+						0.0
 						1
 						0
 						YES
diff --git a/Classes/InCallViewController.xib b/Classes/InCallViewController.xib
index d02849967..61b54f0d5 100644
--- a/Classes/InCallViewController.xib
+++ b/Classes/InCallViewController.xib
@@ -52,6 +52,7 @@
 								301
 								{{-1000, -1000}, {2000, 2000}}
 								
+								
 								
 								_NS:9
 								
@@ -65,6 +66,7 @@
 								274
 								{320, 460}
 								
+								
 								
 								_NS:196
 								
@@ -78,6 +80,7 @@
 								283
 								{{220, 360}, {100, 100}}
 								
+								
 								
 								
 								1
@@ -88,6 +91,7 @@
 								301
 								{{141, 212}, {37, 37}}
 								
+								
 								
 								_NS:1030
 								NO
@@ -99,6 +103,7 @@
 						
 						{320, 460}
 						
+						
 						
 						_NS:196
 						
@@ -109,6 +114,7 @@
 						274
 						{{0, -10}, {320, 480}}
 						
+						
 						
 						_NS:418
 						
@@ -139,7 +145,7 @@
 						-2147483356
 						{{0, 23}, {85, 33}}
 						
-						
+						
 						_NS:9
 						NO
 						IBCocoaTouchFramework
@@ -172,6 +178,7 @@
 				
 				{320, 460}
 				
+				
 				
 				
 				NO
@@ -438,7 +445,120 @@
 			
 			173
 		
-		
+		
+			
+				YES
+				
+					InCallTableViewController
+					UITableViewController
+					
+						IBProjectSource
+						./Classes/InCallTableViewController.h
+					
+				
+				
+					InCallViewController
+					UIViewController
+					
+						YES
+						
+							YES
+							callTableController
+							callTableView
+							testVideoView
+							videoCameraSwitch
+							videoGroup
+							videoPreview
+							videoView
+							videoWaitingForFirstImage
+						
+						
+							YES
+							InCallTableViewController
+							UITableView
+							UIView
+							UICamSwitch
+							UIView
+							UIView
+							UIView
+							UIActivityIndicatorView
+						
+					
+					
+						YES
+						
+							YES
+							callTableController
+							callTableView
+							testVideoView
+							videoCameraSwitch
+							videoGroup
+							videoPreview
+							videoView
+							videoWaitingForFirstImage
+						
+						
+							YES
+							
+								callTableController
+								InCallTableViewController
+							
+							
+								callTableView
+								UITableView
+							
+							
+								testVideoView
+								UIView
+							
+							
+								videoCameraSwitch
+								UICamSwitch
+							
+							
+								videoGroup
+								UIView
+							
+							
+								videoPreview
+								UIView
+							
+							
+								videoView
+								UIView
+							
+							
+								videoWaitingForFirstImage
+								UIActivityIndicatorView
+							
+						
+					
+					
+						IBProjectSource
+						./Classes/InCallViewController.h
+					
+				
+				
+					UICamSwitch
+					UIButton
+					
+						preview
+						UIView
+					
+					
+						preview
+						
+							preview
+							UIView
+						
+					
+					
+						IBProjectSource
+						./Classes/UICamSwitch.h
+					
+				
+			
+		
 		0
 		IBCocoaTouchFramework
 		
diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index 4046c724b..328980635 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -225,7 +225,11 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
 		linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
 	
 	[changedDict release];
-	changedDict=[[NSMutableDictionary alloc] init];
+	changedDict = [[NSMutableDictionary alloc] init];
+    
+    // Post event
+    NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"];
+    [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic];
 }
 
 - (void)setObject:(id)value forKey:(NSString *)key {
@@ -516,6 +520,11 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
     
 	[changedDict release];
 	changedDict = [[NSMutableDictionary alloc] init];
+    
+    // Post event
+    NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"];
+    [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic];
+    
     return YES;
 }
 
diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h
index f242163f9..0b435917a 100644
--- a/Classes/LinphoneManager.h
+++ b/Classes/LinphoneManager.h
@@ -23,7 +23,6 @@
 #import 
 #import 
 
-#import "LogView.h"
 #import "IASKSettingsReader.h"
 #import "IASKSettingsStore.h"
 #import "IASKAppSettingsViewController.h"
@@ -32,12 +31,15 @@
 
 #include "linphonecore.h"
 
+extern NSString *const kLinphoneDisplayStatusUpdate;
 extern NSString *const kLinphoneTextReceived;
 extern NSString *const kLinphoneTextReceivedSound;
 extern NSString *const kLinphoneCallUpdate;
 extern NSString *const kLinphoneRegistrationUpdate;
 extern NSString *const kLinphoneMainViewChange;
 extern NSString *const kLinphoneAddressBookUpdate;
+extern NSString *const kLinphoneLogsUpdate;
+extern NSString *const kLinphoneSettingsUpdate;
 
 extern NSString *const kContactSipField;
 
@@ -126,6 +128,7 @@ typedef struct _LinphoneManagerSounds {
 @property (readonly) sqlite3* database;
 @property (nonatomic, retain) NSData *pushNotificationToken;
 @property (readonly) LinphoneManagerSounds sounds;
+@property (readonly) NSMutableArray *logs;
 
 @end
 
diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index 01d6a5aec..86bc26ace 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -38,12 +38,15 @@
 static LinphoneCore* theLinphoneCore = nil;
 static LinphoneManager* theLinphoneManager = nil;
 
+NSString *const kLinphoneDisplayStatusUpdate = @"LinphoneDisplayStatusUpdate";
 NSString *const kLinphoneTextReceived = @"LinphoneTextReceived";
 NSString *const kLinphoneTextReceivedSound = @"LinphoneTextReceivedSound";
 NSString *const kLinphoneCallUpdate = @"LinphoneCallUpdate";
 NSString *const kLinphoneRegistrationUpdate = @"LinphoneRegistrationUpdate";
 NSString *const kLinphoneAddressBookUpdate = @"LinphoneAddressBookUpdate";
 NSString *const kLinphoneMainViewChange = @"LinphoneMainViewChange";
+NSString *const kLinphoneLogsUpdate = @"LinphoneLogsUpdate";
+NSString *const kLinphoneSettingsUpdate = @"LinphoneSettingsUpdate";
 NSString *const kContactSipField = @"SIP";
 
 extern void libmsilbc_init();
@@ -76,6 +79,7 @@ extern  void libmsbcg729_init();
 @synthesize fastAddressBook;
 @synthesize pushNotificationToken;
 @synthesize sounds;
+@synthesize logs;
 
 struct codec_name_pref_table{
     const char *name;
@@ -195,6 +199,7 @@ struct codec_name_pref_table codec_pref_table[]={
             }
         }
         inhibitedEvent = [[NSMutableArray alloc] init];
+        logs = [[NSMutableArray alloc] init];
         database = NULL;
         settingsStore = nil;
 		self.defaultExpires = 600;
@@ -216,6 +221,7 @@ struct codec_name_pref_table codec_pref_table[]={
     [fastAddressBook release];
     [self closeDatabase];
     [settingsStore release];
+    [logs release];
     
     [super dealloc];
 }
@@ -263,7 +269,15 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args){
 	NSString* format = [[NSString alloc] initWithUTF8String:fmt];
 	NSLogv(format, args);
 	NSString* formatedString = [[NSString alloc] initWithFormat:format arguments:args];
-	//[[LinphoneManager instance] addLog:formatedString];
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[LinphoneManager instance].logs addObject:formatedString];
+        
+        // Post event
+        NSDictionary *dict = [NSDictionary dictionaryWithObject:formatedString forKey:@"log"];
+        [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:[LinphoneManager instance] userInfo:dict];
+    });
+    
 	[formatedString release];
     [format release];
 }
@@ -272,7 +286,14 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args){
 static void linphone_iphone_log(struct _LinphoneCore * lc, const char * message) {
 	NSString* log = [NSString stringWithCString:message encoding:[NSString defaultCStringEncoding]]; 
 	NSLog(log, NULL);
-	//[[LinphoneManager instance] addLog:log];
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[LinphoneManager instance].logs addObject:log];
+        
+        // Post event
+        NSDictionary *dict = [NSDictionary dictionaryWithObject:log forKey:@"log"];
+        [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:[LinphoneManager instance] userInfo:dict];
+    });
 }
 
 
@@ -280,10 +301,10 @@ static void linphone_iphone_log(struct _LinphoneCore * lc, const char * message)
 
 - (void)displayStatus:(NSString*) message {
     // Post event
-    NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: 
+    NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
                            message, @"message", 
-                           nil] autorelease];
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneDisplayStatus" object:self userInfo:dict];
+                           nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneDisplayStatusUpdate object:self userInfo:dict];
 }
 
 
@@ -330,11 +351,11 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
     }
     
     // Post event
-    NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: 
+    NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSValue valueWithPointer:call], @"call",
                            [NSNumber numberWithInt:state], @"state", 
-                           [NSString stringWithUTF8String:message], @"message", nil] autorelease];
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneCallUpdate" object:self userInfo:dict];
+                           [NSString stringWithUTF8String:message], @"message", nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self userInfo:dict];
 }
 
 static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall* call, LinphoneCallState state,const char* message) {
@@ -354,12 +375,12 @@ static void linphone_iphone_transfer_state_changed(LinphoneCore* lc, LinphoneCal
     [LinphoneLogger logc:LinphoneLoggerLog format:"NEW REGISTRATION STATE: '%s' (message: '%s')", linphone_registration_state_to_string(state), message];
     
     // Post event
-    NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: 
+    NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
                           [NSNumber numberWithInt:state], @"state", 
                           [NSValue valueWithPointer:cfg], @"cfg",
                           [NSString stringWithUTF8String:message], @"message", 
-                          nil] autorelease];
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneRegistrationUpdate" object:self userInfo:dict];
+                          nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneRegistrationUpdate object:self userInfo:dict];
 }
 
 static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyConfig* cfg, LinphoneRegistrationState state,const char* message) {
@@ -388,13 +409,13 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo
     ms_free(fromStr);
     
     // Post event
-    NSDictionary* dict = [[[NSDictionary alloc] initWithObjectsAndKeys: 
+    NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSValue valueWithPointer:room], @"room", 
                            [NSValue valueWithPointer:from], @"from",
                            [NSString stringWithUTF8String:message], @"message", 
                            chat, @"chat", 
-                           nil] autorelease];
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self userInfo:dict]; 
+                           nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextReceived object:self userInfo:dict];
     [chat release];
 }
 
diff --git a/Classes/LinphoneUI/LogView.h b/Classes/LinphoneUI/LogView.h
deleted file mode 100644
index ea2eddaaa..000000000
--- a/Classes/LinphoneUI/LogView.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* LogView.h
- *
- * Copyright (C) 2011  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 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 
-
-
-@protocol LogView
--(void) addLog:(NSString*) log;
-
-@end
-
diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h
index a80b60d92..c3aee2c38 100644
--- a/Classes/PhoneMainView.h
+++ b/Classes/PhoneMainView.h
@@ -38,6 +38,7 @@
 #import "FirstLoginViewController.h"
 #import "WizardViewController.h"
 #import "IncomingCallViewController.h"
+#import "ConsoleViewController.h"
 
 @interface PhoneMainView : UIViewController {
     @private
diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m
index b8aa97e46..7f05ae5e2 100644
--- a/Classes/PhoneMainView.m
+++ b/Classes/PhoneMainView.m
@@ -479,7 +479,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
 }
 
 - (UIViewController*)_changeCurrentView:(UICompositeViewDescription*)view transition:(CATransition*)transition force:(BOOL)force {
-    [LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: change view %d", [view name]];
+    [LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: Change current view to %@", [view name]];
     
     if(force || ![view equal: currentView]) {
         if(transition == nil)
diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m
index 25936e47f..8939bcc41 100644
--- a/Classes/SettingsViewController.m
+++ b/Classes/SettingsViewController.m
@@ -451,6 +451,15 @@ static UICompositeViewDescription *compositeDescription = nil;
             [hiddenKeys addObject:@"ice_preference"];
         }
         [settingsController setHiddenKeys:hiddenKeys animated:TRUE];
+    } else if ([@"debugenable_preference" compare: notif.object] == NSOrderedSame) {
+        NSMutableSet *hiddenKeys = [NSMutableSet setWithSet:[settingsController hiddenKeys]];
+        BOOL debugEnable = [[notif.userInfo objectForKey:@"debugenable_preference"] boolValue];
+        if (debugEnable) {
+            [hiddenKeys removeObject:@"console_button"];
+        } else {
+            [hiddenKeys addObject:@"console_button"];
+        }
+        [settingsController setHiddenKeys:hiddenKeys animated:TRUE];
     }
 }
 
@@ -493,6 +502,7 @@ static UICompositeViewDescription *compositeDescription = nil;
         [hiddenKeys addObject:@"video_menu"];
     }
     
+    
     [hiddenKeys addObjectsFromArray:[[LinphoneManager unsupportedCodecs] allObjects]];
     
     if([[[[LinphoneManager instance] settingsStore] objectForKey:@"random_port_preference"] boolValue]) {
@@ -503,6 +513,10 @@ static UICompositeViewDescription *compositeDescription = nil;
         [hiddenKeys addObject:@"ice_preference"];
     }
 
+    if(![[[[LinphoneManager instance] settingsStore] objectForKey:@"debugenable_preference"] boolValue]) {
+        [hiddenKeys addObject:@"console_button"];
+    }
+    
     return hiddenKeys;
 }
 
@@ -524,5 +538,8 @@ static UICompositeViewDescription *compositeDescription = nil;
         [[PhoneMainView instance].mainViewController clearCache];
     }
 #endif
+    if([key isEqual:@"console_button"]) {
+        [[PhoneMainView instance] changeCurrentView:[ConsoleViewController compositeViewDescription] push:TRUE];
+    }
 }
 @end
diff --git a/Settings/InAppSettings.bundle/Advanced.plist b/Settings/InAppSettings.bundle/Advanced.plist
index 675b6f29c..5daa482cb 100644
--- a/Settings/InAppSettings.bundle/Advanced.plist
+++ b/Settings/InAppSettings.bundle/Advanced.plist
@@ -4,6 +4,12 @@
 
 	PreferenceSpecifiers
 	
+		
+			Title
+			Debug
+			Type
+			PSGroupSpecifier
+		
 		
 			DefaultValue
 			
@@ -14,6 +20,20 @@
 			Type
 			PSToggleSwitchSpecifier
 		
+		
+			Key
+			console_button
+			Title
+			Console
+			Type
+			IASKButtonSpecifier
+		
+		
+			Title
+			
+			Type
+			PSGroupSpecifier
+		
 		
 			DefaultValue
 			
diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj
index 33fbf5011..b8316ada6 100755
--- a/linphone.xcodeproj/project.pbxproj
+++ b/linphone.xcodeproj/project.pbxproj
@@ -1329,7 +1329,6 @@
 		2214EB8812F84EBB002A5394 /* UIHangUpButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIHangUpButton.m; sourceTree = ""; };
 		2214EBF112F86360002A5394 /* UIMicroButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIMicroButton.h; sourceTree = ""; };
 		2214EBF212F86360002A5394 /* UIMicroButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIMicroButton.m; sourceTree = ""; };
-		2218A5CE12F973450088A667 /* LogView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogView.h; sourceTree = ""; };
 		2218A92212FBE1340088A667 /* FirstLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FirstLoginViewController.h; sourceTree = ""; };
 		2218A92312FBE1340088A667 /* FirstLoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = FirstLoginViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
 		2218A92412FBE1340088A667 /* FirstLoginViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FirstLoginViewController.xib; sourceTree = ""; };
@@ -2428,7 +2427,6 @@
 		2214EB7012F84668002A5394 /* LinphoneUI */ = {
 			isa = PBXGroup;
 			children = (
-				2218A5CE12F973450088A667 /* LogView.h */,
 				D35E757F159328EA0066B1C1 /* UIAddressTextField.h */,
 				D35E7580159328EB0066B1C1 /* UIAddressTextField.m */,
 				22C7555E1317E59C007BC101 /* UIBluetoothButton.h */,
@@ -4589,6 +4587,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				COMPRESS_PNG_FILES = NO;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_C_LANGUAGE_STANDARD = c99;
@@ -4637,6 +4636,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				COMPRESS_PNG_FILES = NO;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_C_LANGUAGE_STANDARD = c99;
@@ -4685,6 +4685,7 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CODE_SIGN_ENTITLEMENTS = "";
+				COMPRESS_PNG_FILES = NO;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_C_LANGUAGE_STANDARD = c99;
@@ -4733,6 +4734,7 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CODE_SIGN_ENTITLEMENTS = "";
+				COMPRESS_PNG_FILES = NO;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_C_LANGUAGE_STANDARD = c99;