From e389a03405d4d270ffb2973ead56c8f4682452d1 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 10:36:13 +0100 Subject: [PATCH 01/13] Update linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index d282ec6ad..c1443751e 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit d282ec6ad9c05e1e18c2cb9a917cb6b4f417e56d +Subproject commit c1443751eca8d1ae5da981d286ef551869c5ba69 From 6a82937bbddc4a2cc153a2d5a7a66023d5e9e5f1 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 10:47:05 +0100 Subject: [PATCH 02/13] Fix crashes when sending chats to strange addresses --- Classes/ChatRoomViewController.m | 5 ++++- Classes/LinphoneUI/UIChatCell.m | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index 9e1c36f49..480d99e11 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -292,7 +292,10 @@ static UICompositeViewDescription *compositeDescription = nil; // Display name if(displayName == nil) { - displayName = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)]; + const char* username = linphone_address_get_username(linphoneAddress); + char* address = linphone_address_as_string(linphoneAddress); + displayName = [NSString stringWithUTF8String:username?:address]; + ms_free(address); } [addressLabel setText:displayName]; diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 6662669ac..5fcf753ad 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -99,7 +99,10 @@ // Display name if(displayName == nil) { - displayName = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)]; + const char* username = linphone_address_get_username(linphoneAddress); + char* address = linphone_address_as_string(linphoneAddress); + displayName = [NSString stringWithUTF8String:username?:address]; + ms_free(address); } [addressLabel setText:displayName]; From 49afcfd45b83cbc9acc9805d0657852bdfd1697f Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 11:03:19 +0100 Subject: [PATCH 03/13] Update Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98c82f6ee..3bc98b5b4 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ You will NOT be able to build the SDK if you did not read liblinphone README fir * Using HomeBrew: - brew install imagemagick + brew install imagemagick yasm nasm * Using MacPorts: - sudo port install ImageMagick optipng + sudo port install ImageMagick optipng yasm nasm ### System linking From 5b1c65120cf82d9ba30b537215d437be0254a362 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 14:08:06 +0100 Subject: [PATCH 04/13] Update linphone for arm64 downscale routines --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index c1443751e..25b40de1b 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit c1443751eca8d1ae5da981d286ef551869c5ba69 +Subproject commit 25b40de1ba6b8ba434ac9d5589784b40a46b4c3d From d5db95f16f0555823ada6a9b155028e35eb5a4ad Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 14:49:09 +0100 Subject: [PATCH 05/13] x86_64 details in README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 3bc98b5b4..84bf68afc 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,11 @@ After the SDK is built, just open the Linphone Xcode project with Xcode, and pre * Video capture does not work in simulator (not implemented by simulator?). +* Link errors with x86_64: this happens when you try to run linphone on the iPhone 5S/6/6+ simulators. + This is due to the fact that we're not building the SDK for the x86_64 architecture, due to it being redundant with i386 (and increasing dramatically the compile time and build size). + The solution (temporary) is to force the acceptable architectures to be 'armv7' only (remove 'arm64') and disable the "build active architecture" flag in the linphone, XMLRPC and NinePatch projects. + Don't forget to re-enable them when archiving your project. + ## DEBUGING THE SDK Sometime it can be useful to step into liblinphone SDK functions. To allow Xcode to enable breakpoint within liblinphone, SDK must be built with debug symbols. From c97760034dbf315f7be435b17c647fbeda8c8336 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 14:49:57 +0100 Subject: [PATCH 06/13] Update liblinphone xcodeproj --- .../liblinphone.xcodeproj/project.pbxproj | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/submodules/liblinphone.xcodeproj/project.pbxproj b/submodules/liblinphone.xcodeproj/project.pbxproj index 80f0b6ea7..082a585aa 100644 --- a/submodules/liblinphone.xcodeproj/project.pbxproj +++ b/submodules/liblinphone.xcodeproj/project.pbxproj @@ -183,7 +183,6 @@ 225D65871521C009008B2E81 /* telephonyevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 222CA6D711F6CF9F00621220 /* telephonyevents.c */; }; 225D65881521C009008B2E81 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 222CA6F211F6CF9F00621220 /* utils.c */; }; 225D65B81521C009008B2E81 /* netsim.c in Sources */ = {isa = PBXBuildFile; fileRef = F4D9F23D145710540035B0D0 /* netsim.c */; }; - 225D65B91521C009008B2E81 /* ortp_srtp.c in Sources */ = {isa = PBXBuildFile; fileRef = F4D9F23E145710540035B0D0 /* ortp_srtp.c */; }; 225D65BF1521C009008B2E81 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; 225D65CC1521C195008B2E81 /* libmediastreamer_base.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 225D64F81521BFA6008B2E81 /* libmediastreamer_base.a */; }; 225D65CD1521C19A008B2E81 /* libortp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 225D65C51521C009008B2E81 /* libortp.a */; }; @@ -346,6 +345,8 @@ F02538F7197948C9002C30F3 /* rtcp_xr.c in Sources */ = {isa = PBXBuildFile; fileRef = F02538F3197948BE002C30F3 /* rtcp_xr.c */; }; F02538F919794908002C30F3 /* flowcontrol.c in Sources */ = {isa = PBXBuildFile; fileRef = F02538F819794908002C30F3 /* flowcontrol.c */; }; F02538FB1979491B002C30F3 /* videostarter.c in Sources */ = {isa = PBXBuildFile; fileRef = F02538FA1979491B002C30F3 /* videostarter.c */; }; + F0340ADD1A6D13BD002E4BF1 /* ms_srtp.c in Sources */ = {isa = PBXBuildFile; fileRef = F0340ADC1A6D13BD002E4BF1 /* ms_srtp.c */; }; + F0340ADF1A6D13FF002E4BF1 /* zrtp.c in Sources */ = {isa = PBXBuildFile; fileRef = F0340ADE1A6D13FF002E4BF1 /* zrtp.c */; }; F0497F021A1652F100B67112 /* mediastreamer2_neon_tester.c in Sources */ = {isa = PBXBuildFile; fileRef = F0ED9B981A164D7200A788CE /* mediastreamer2_neon_tester.c */; }; F0497F0C1A1B483E00B67112 /* zrtp.c in Sources */ = {isa = PBXBuildFile; fileRef = F0497F0B1A1B483E00B67112 /* zrtp.c */; }; F0497F0E1A1B4C1700B67112 /* mediastreamer2_tester_ios.m in Sources */ = {isa = PBXBuildFile; fileRef = F0497F0D1A1B4C1700B67112 /* mediastreamer2_tester_ios.m */; }; @@ -366,9 +367,7 @@ F0ED99471A1645C200A788CE /* hello8000-1s.wav in Resources */ = {isa = PBXBuildFile; fileRef = F0ED992B1A1645C200A788CE /* hello8000-1s.wav */; }; F0ED99481A1645C200A788CE /* hello8000.wav in Resources */ = {isa = PBXBuildFile; fileRef = F0ED992C1A1645C200A788CE /* hello8000.wav */; }; F0ED99491A1645C200A788CE /* hello_opus.mka in Resources */ = {isa = PBXBuildFile; fileRef = F0ED992D1A1645C200A788CE /* hello_opus.mka */; }; - F0ED994A1A1645C200A788CE /* hello_opus_h264.mkv in Resources */ = {isa = PBXBuildFile; fileRef = F0ED992E1A1645C200A788CE /* hello_opus_h264.mkv */; }; F0ED994B1A1645C200A788CE /* hello_pcmu.mka in Resources */ = {isa = PBXBuildFile; fileRef = F0ED992F1A1645C200A788CE /* hello_pcmu.mka */; }; - F0ED994C1A1645C200A788CE /* hello_pcmu_h264.mkv in Resources */ = {isa = PBXBuildFile; fileRef = F0ED99301A1645C200A788CE /* hello_pcmu_h264.mkv */; }; F0ED994D1A1645C200A788CE /* laserrocket_16000_mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = F0ED99311A1645C200A788CE /* laserrocket_16000_mono.wav */; }; F0ED994E1A1645C200A788CE /* nylon_48000_mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = F0ED99321A1645C200A788CE /* nylon_48000_mono.wav */; }; F0ED994F1A1645C200A788CE /* owl_44100_mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = F0ED99331A1645C200A788CE /* owl_44100_mono.wav */; }; @@ -765,6 +764,8 @@ F02538F3197948BE002C30F3 /* rtcp_xr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtcp_xr.c; sourceTree = ""; }; F02538F819794908002C30F3 /* flowcontrol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = flowcontrol.c; sourceTree = ""; }; F02538FA1979491B002C30F3 /* videostarter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = videostarter.c; sourceTree = ""; }; + F0340ADC1A6D13BD002E4BF1 /* ms_srtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ms_srtp.c; sourceTree = ""; }; + F0340ADE1A6D13FF002E4BF1 /* zrtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zrtp.c; sourceTree = ""; }; F0497F0B1A1B483E00B67112 /* zrtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zrtp.c; sourceTree = ""; }; F0497F0D1A1B4C1700B67112 /* mediastreamer2_tester_ios.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = mediastreamer2_tester_ios.m; sourceTree = ""; }; F0497F151A1C9F8700B67112 /* mediastream-tester-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "mediastream-tester-Info.plist"; sourceTree = ""; }; @@ -804,7 +805,6 @@ F0ED9B961A164A4800A788CE /* msmediaplayer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msmediaplayer.c; sourceTree = ""; }; F0ED9B981A164D7200A788CE /* mediastreamer2_neon_tester.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mediastreamer2_neon_tester.c; sourceTree = ""; }; F4D9F23D145710540035B0D0 /* netsim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = netsim.c; sourceTree = ""; }; - F4D9F23E145710540035B0D0 /* ortp_srtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ortp_srtp.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1040,20 +1040,21 @@ 222CA5DC11F6CF7600621220 /* src */ = { isa = PBXGroup; children = ( - F0ED99161A1645C200A788CE /* tester */, + 222CA5DD11F6CF7600621220 /* .gitignore */, + 222CA5F911F6CF7600621220 /* Makefile.am */, + 2252935A12F6CA4700DD9BFB /* ec-calibrator.c */, + 2203127413A249F70049A2ED /* filter-template.c */, + 221DCB6A153584410025E54D /* yuv2rgb.fs */, + 222CA5FA11F6CF7600621220 /* Makefile.in */, + 221DCB6B153584410025E54D /* yuv2rgb.vs */, 223CA7EF16D9268D00EF1BEC /* audiofilters */, 223CA81116D9268D00EF1BEC /* base */, + F0340ADB1A6D13BD002E4BF1 /* crypto */, 223CA81A16D9268D00EF1BEC /* otherfilters */, + F0ED99161A1645C200A788CE /* tester */, 223CA82016D9268D00EF1BEC /* utils */, 223CA83316D9268D00EF1BEC /* videofilters */, 223CA84E16D9268D00EF1BEC /* voip */, - 222CA5DD11F6CF7600621220 /* .gitignore */, - 2252935A12F6CA4700DD9BFB /* ec-calibrator.c */, - 2203127413A249F70049A2ED /* filter-template.c */, - 222CA5F911F6CF7600621220 /* Makefile.am */, - 222CA5FA11F6CF7600621220 /* Makefile.in */, - 221DCB6A153584410025E54D /* yuv2rgb.fs */, - 221DCB6B153584410025E54D /* yuv2rgb.vs */, ); path = src; sourceTree = ""; @@ -1110,7 +1111,6 @@ 222CA6C011F6CF9F00621220 /* master */, F4D9F23D145710540035B0D0 /* netsim.c */, 222CA6C211F6CF9F00621220 /* ortp.c */, - F4D9F23E145710540035B0D0 /* ortp_srtp.c */, 222CA6C311F6CF9F00621220 /* payloadtype.c */, 222CA6C411F6CF9F00621220 /* port.c */, 222CA6C511F6CF9F00621220 /* posixtimer.c */, @@ -1278,6 +1278,7 @@ 223CA86616D9268D00EF1BEC /* videostream.c */, F02538E71979481D002C30F3 /* vp8rtpfmt.c */, F02538E81979481D002C30F3 /* vp8rtpfmt.h */, + F0340ADE1A6D13FF002E4BF1 /* zrtp.c */, F0497F0B1A1B483E00B67112 /* zrtp.c */, ); path = voip; @@ -1312,6 +1313,14 @@ name = "Supporting Files"; sourceTree = ""; }; + F0340ADB1A6D13BD002E4BF1 /* crypto */ = { + isa = PBXGroup; + children = ( + F0340ADC1A6D13BD002E4BF1 /* ms_srtp.c */, + ); + path = crypto; + sourceTree = ""; + }; F0ED99161A1645C200A788CE /* tester */ = { isa = PBXGroup; children = ( @@ -1783,12 +1792,10 @@ F0ED99441A1645C200A788CE /* chimes_48000_stereo.wav in Resources */, F0ED99361A1645C200A788CE /* Makefile.am in Resources */, F0ED99431A1645C200A788CE /* bird_44100_stereo.wav in Resources */, - F0ED994C1A1645C200A788CE /* hello_pcmu_h264.mkv in Resources */, F0ED99471A1645C200A788CE /* hello8000-1s.wav in Resources */, 2206D2E1177ACF5700C40726 /* nowebcamCIF.jpg in Resources */, F0ED99501A1645C200A788CE /* piano_8000_stereo.wav in Resources */, F0ED99461A1645C200A788CE /* hello16000.wav in Resources */, - F0ED994A1A1645C200A788CE /* hello_opus_h264.mkv in Resources */, F0ED994B1A1645C200A788CE /* hello_pcmu.mka in Resources */, F0ED99491A1645C200A788CE /* hello_opus.mka in Resources */, F0ED99421A1645C200A788CE /* arpeggio_8000_mono.wav in Resources */, @@ -1886,7 +1893,6 @@ 225D65871521C009008B2E81 /* telephonyevents.c in Sources */, 225D65881521C009008B2E81 /* utils.c in Sources */, 225D65B81521C009008B2E81 /* netsim.c in Sources */, - 225D65B91521C009008B2E81 /* ortp_srtp.c in Sources */, 22405EE51600671D00B92522 /* logging.c in Sources */, 22405EE61600671D00B92522 /* rtpprofile.c in Sources */, ); @@ -1912,6 +1918,7 @@ 22C8D0A61769F8FF00DAFB4E /* msfileplayer.c in Sources */, 22C8D0A71769F8FF00DAFB4E /* msfilerec.c in Sources */, 22C8D0A81769F8FF00DAFB4E /* msg722.c in Sources */, + F0340ADD1A6D13BD002E4BF1 /* ms_srtp.c in Sources */, 22C8D0A91769F8FF00DAFB4E /* msiounit.m in Sources */, 22C8D0AA1769F8FF00DAFB4E /* msresample.c in Sources */, 22C8D0AB1769F8FF00DAFB4E /* msspeex.c in Sources */, @@ -1950,6 +1957,7 @@ 22C8D0D11769F8FF00DAFB4E /* bitratecontrol.c in Sources */, 22C8D0D21769F8FF00DAFB4E /* bitratedriver.c in Sources */, 22C8D0D31769F8FF00DAFB4E /* ice.c in Sources */, + F0340ADF1A6D13FF002E4BF1 /* zrtp.c in Sources */, 22C8D0D41769F8FF00DAFB4E /* layouts.c in Sources */, 22C8D0D51769F8FF00DAFB4E /* mediastream.c in Sources */, 22C8D0D61769F8FF00DAFB4E /* msvideo.c in Sources */, From d30ccafcb74a860748d9f5fb8704d0583acf70d3 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 15:05:47 +0100 Subject: [PATCH 07/13] Fix #2004: imagepicker statusbar --- Classes/ImagePickerViewController.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/ImagePickerViewController.m b/Classes/ImagePickerViewController.m index 36761a778..af021d52d 100644 --- a/Classes/ImagePickerViewController.m +++ b/Classes/ImagePickerViewController.m @@ -67,6 +67,7 @@ static UICompositeViewDescription *compositeDescription = nil; fullscreen:false landscapeMode:[LinphoneManager runningOnIpad] portraitMode:true]; + compositeDescription.darkBackground = false; } return compositeDescription; } @@ -93,7 +94,7 @@ static UICompositeViewDescription *compositeDescription = nil; [popoverController presentPopoverFromRect:CGRectZero inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:FALSE]; } [[UIApplication sharedApplication] setStatusBarHidden:NO]; //Fix UIImagePickerController status bar hide - [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque]; //Fix UIImagePickerController status bar style change + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]; //Fix UIImagePickerController status bar style change } From 59978a1de2f40d87afbee7669a63b213e5a8d2c0 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 16:00:17 +0100 Subject: [PATCH 08/13] Fix #2000: video preview not enabled at first launch (iPad) --- Classes/DialerViewController.m | 16 ++++++++++++---- Resources/linphonerc~ipad | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index e9cd810ff..652e42947 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -144,15 +144,23 @@ static UICompositeViewDescription *compositeDescription = nil; [callButton setEnabled:TRUE]; // Update on show - LinphoneManager *mgr=[LinphoneManager instance]; - LinphoneCore* lc = [LinphoneManager getLc]; - LinphoneCall* call = linphone_core_get_current_call(lc); + LinphoneManager *mgr = [LinphoneManager instance]; + LinphoneCore* lc = [LinphoneManager getLc]; + LinphoneCall* call = linphone_core_get_current_call(lc); LinphoneCallState state = (call != NULL)?linphone_call_get_state(call): 0; [self callUpdate:call state:state]; if([LinphoneManager runningOnIpad]) { - if(linphone_core_video_enabled(lc) && [mgr lpConfigBoolForKey:@"preview_preference"]) { + BOOL videoEnabled = linphone_core_video_enabled(lc); + BOOL previewPref = [mgr lpConfigBoolForKey:@"preview_preference"]; + + if( videoEnabled && previewPref ) { linphone_core_set_native_preview_window_id(lc, (unsigned long)videoPreview); + + if( !linphone_core_video_preview_enabled(lc)){ + linphone_core_enable_video_preview(lc, TRUE); + } + [backgroundView setHidden:FALSE]; [videoCameraSwitch setHidden:FALSE]; } else { diff --git a/Resources/linphonerc~ipad b/Resources/linphonerc~ipad index c19045ae8..1b6ff9d07 100644 --- a/Resources/linphonerc~ipad +++ b/Resources/linphonerc~ipad @@ -30,6 +30,7 @@ capture_dev_id=AU: Audio Unit Receiver eq_active=0 [app] +preview_preference=1 animations_preference=1 edge_opt_preference=0 use_system_contacts=0 From a5810fdc20497008d58c02dad521f8ee258db372 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Mon, 19 Jan 2015 17:00:06 +0100 Subject: [PATCH 09/13] Try to mitigate crash and memory leak when changing the contact image multiple times. --- Classes/LinphoneUI/UIContactDetailsHeader.h | 2 ++ Classes/LinphoneUI/UIContactDetailsHeader.m | 31 ++++++++++++++------- Classes/Utils/FastAddressBook.h | 1 + Classes/Utils/FastAddressBook.m | 9 ++++++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Classes/LinphoneUI/UIContactDetailsHeader.h b/Classes/LinphoneUI/UIContactDetailsHeader.h index af82ed75a..e76058bad 100644 --- a/Classes/LinphoneUI/UIContactDetailsHeader.h +++ b/Classes/LinphoneUI/UIContactDetailsHeader.h @@ -39,6 +39,8 @@ @property (nonatomic, retain) IBOutlet UITableView *tableView; @property (nonatomic, retain) IBOutlet id contactDetailsDelegate; +@property (retain, nonatomic) ImagePickerViewController* popoverController; + @property(nonatomic,getter=isEditing) BOOL editing; - (IBAction)onAvatarClick:(id)event; diff --git a/Classes/LinphoneUI/UIContactDetailsHeader.m b/Classes/LinphoneUI/UIContactDetailsHeader.m index be4d05af9..f3787a4f8 100644 --- a/Classes/LinphoneUI/UIContactDetailsHeader.m +++ b/Classes/LinphoneUI/UIContactDetailsHeader.m @@ -36,6 +36,7 @@ @synthesize editView; @synthesize tableView; @synthesize contactDetailsDelegate; +@synthesize popoverController; #pragma mark - Lifecycle Functions @@ -243,11 +244,13 @@ - (IBAction)onAvatarClick:(id)event { if(self.isEditing) { - void (^block)(UIImagePickerControllerSourceType) = ^(UIImagePickerControllerSourceType type) { + void (^showAppropriateController)(UIImagePickerControllerSourceType) = ^(UIImagePickerControllerSourceType type) { UICompositeViewDescription *description = [ImagePickerViewController compositeViewDescription]; ImagePickerViewController *controller; if([LinphoneManager runningOnIpad]) { controller = DYNAMIC_CAST([[PhoneMainView instance].mainViewController getCachedController:description.content], ImagePickerViewController); + // keep a reference to this controller so that in case of memory pressure we keep it + self.popoverController = controller; } else { controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:description push:TRUE], ImagePickerViewController); } @@ -271,12 +274,12 @@ DTActionSheet *sheet = [[[DTActionSheet alloc] initWithTitle:NSLocalizedString(@"Select picture source",nil)] autorelease]; if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { [sheet addButtonWithTitle:NSLocalizedString(@"Camera",nil) block:^(){ - block(UIImagePickerControllerSourceTypeCamera); + showAppropriateController(UIImagePickerControllerSourceTypeCamera); }]; } if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { [sheet addButtonWithTitle:NSLocalizedString(@"Photo library",nil) block:^(){ - block(UIImagePickerControllerSourceTypePhotoLibrary); + showAppropriateController(UIImagePickerControllerSourceTypePhotoLibrary); }]; } if([FastAddressBook getContactImage:contact thumbnail:true] != nil) { @@ -288,8 +291,10 @@ [self update]; }]; } - [sheet addCancelButtonWithTitle:NSLocalizedString(@"Cancel",nil) block:nil]; - + [sheet addCancelButtonWithTitle:NSLocalizedString(@"Cancel",nil) block:^{ + self.popoverController = nil; + }]; + [sheet showInView:[PhoneMainView instance].view]; } } @@ -304,19 +309,25 @@ ImagePickerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance].mainViewController getCachedController:description.content], ImagePickerViewController); if(controller != nil) { [controller.popoverController dismissPopoverAnimated:TRUE]; + self.popoverController = nil; } } + FastAddressBook* fab = [LinphoneManager instance].fastAddressBook; NSError* error = NULL; if(!ABPersonRemoveImageData(contact, (CFErrorRef*)error)) { [LinphoneLogger log:LinphoneLoggerLog format:@"Can't remove entry: %@", [error localizedDescription]]; } NSData *dataRef = UIImageJPEGRepresentation(image, 0.9f); CFDataRef cfdata = CFDataCreate(NULL,[dataRef bytes], [dataRef length]); - - if(!ABPersonSetImageData(contact, cfdata, (CFErrorRef*)error)) { - [LinphoneLogger log:LinphoneLoggerLog format:@"Can't add entry: %@", [error localizedDescription]]; - } - + + [fab saveAddressBook]; + + if(!ABPersonSetImageData(contact, cfdata, (CFErrorRef*)error)) { + [LinphoneLogger log:LinphoneLoggerLog format:@"Can't add entry: %@", [error localizedDescription]]; + } else { + [fab saveAddressBook]; + } + CFRelease(cfdata); [self update]; diff --git a/Classes/Utils/FastAddressBook.h b/Classes/Utils/FastAddressBook.h index d93549dae..34723eecc 100644 --- a/Classes/Utils/FastAddressBook.h +++ b/Classes/Utils/FastAddressBook.h @@ -31,6 +31,7 @@ + (UIImage*)getContactImage:(ABRecordRef)contact thumbnail:(BOOL)thumbnail; - (ABRecordRef)getContact:(NSString*)address; - (void)reload; +- (void)saveAddressBook; + (BOOL)isAuthorized; + (NSString*)appendCountryCodeIfPossible:(NSString*)number; + (NSString*)normalizePhoneNumber:(NSString*)number; diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 35fb6d6ec..47e5a5b05 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -161,6 +161,15 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf return self; } +- (void)saveAddressBook { + if( addressBook != nil ){ + NSError* err = nil; + if( !ABAddressBookSave(addressBook, (CFErrorRef*)err) ){ + Linphone_warn(@"Couldn't save Address Book"); + } + } +} + - (void)reload { if(addressBook != nil) { ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self); From 333612f73d3639c88856f89924d17a5590db5b99 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 20 Jan 2015 10:32:31 +0100 Subject: [PATCH 10/13] update polarssl --- submodules/externals/polarssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/externals/polarssl b/submodules/externals/polarssl index 18040383b..e46939b25 160000 --- a/submodules/externals/polarssl +++ b/submodules/externals/polarssl @@ -1 +1 @@ -Subproject commit 18040383bd13a5c683934df6744d99aee4a1231b +Subproject commit e46939b25c990d825d94c2d526c350a1380db67f From 4fe78b84ebcf37b9fb4b35d1a47dc88ec37a0cf1 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Tue, 20 Jan 2015 10:49:01 +0100 Subject: [PATCH 11/13] Update linphone for libz --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 25b40de1b..b4dc7b386 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 25b40de1ba6b8ba434ac9d5589784b40a46b4c3d +Subproject commit b4dc7b3868a6fe6f5aa9ece5c08d28393ba0e8dd From 2833a0f55b87c54f35130e57f99c0c45239d9fc5 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Tue, 20 Jan 2015 11:11:59 +0100 Subject: [PATCH 12/13] Reverse bad commit on wizard views --- Classes/Base.lproj/WizardViews.xib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Base.lproj/WizardViews.xib b/Classes/Base.lproj/WizardViews.xib index a493a34eb..e94a3c355 100644 --- a/Classes/Base.lproj/WizardViews.xib +++ b/Classes/Base.lproj/WizardViews.xib @@ -115,7 +115,7 @@