diff --git a/Classes/AboutView.m b/Classes/AboutView.m
index fad3e915a..2255b82aa 100644
--- a/Classes/AboutView.m
+++ b/Classes/AboutView.m
@@ -45,7 +45,7 @@
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"],
linphone_core_get_version()]];
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
[LinphoneUtils adjustFontSize:self.view mult:2.22f];
}
diff --git a/Classes/Base.lproj/CallView.xib b/Classes/Base.lproj/CallView.xib
index 9944932dc..0919e44d9 100644
--- a/Classes/Base.lproj/CallView.xib
+++ b/Classes/Base.lproj/CallView.xib
@@ -634,7 +634,7 @@
-
+
@@ -1227,7 +1227,7 @@
-
+
diff --git a/Classes/Base.lproj/CallView~ipad.xib b/Classes/Base.lproj/CallView~ipad.xib
index 195d3f1f3..24873d4a0 100644
--- a/Classes/Base.lproj/CallView~ipad.xib
+++ b/Classes/Base.lproj/CallView~ipad.xib
@@ -634,7 +634,7 @@
-
+
@@ -1227,7 +1227,7 @@
-
+
diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m
index d9780f84d..35af6e569 100644
--- a/Classes/ChatConversationView.m
+++ b/Classes/ChatConversationView.m
@@ -72,7 +72,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[super viewDidLoad];
// if we use fragments, remove back button
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
_backButton.hidden = YES;
_backButton.alpha = 0;
}
@@ -557,7 +557,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)imagePickerDelegateImage:(UIImage *)image info:(NSDictionary *)info {
// Dismiss popover on iPad
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
[VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE];
}
diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m
index 2a79a50cd..fdb622216 100644
--- a/Classes/ChatsListTableView.m
+++ b/Classes/ChatsListTableView.m
@@ -109,14 +109,16 @@ static void chatTable_free_chatrooms(void *data) {
data = [self sortChatRooms];
[super loadData];
- // reset conversation view since in fragment mode, conversations are relative to current data
- // select first conversation if any
- if ([self totalNumberOfItems] > 0) {
- ChatConversationView *view = VIEW(ChatConversationView);
- [view setChatRoom:(LinphoneChatRoom *)ms_list_nth_data(data, 0)];
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
- } else {
- [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription];
+ if (IPAD) {
+ // reset conversation view since in fragment mode, conversations are relative to current data
+ // select first conversation if any
+ if ([self totalNumberOfItems] > 0) {
+ ChatConversationView *view = VIEW(ChatConversationView);
+ [view setChatRoom:(LinphoneChatRoom *)ms_list_nth_data(data, 0)];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
+ } else {
+ [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription];
+ }
}
}
diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m
index a5a2e4122..24c25748c 100644
--- a/Classes/ContactDetailsView.m
+++ b/Classes/ContactDetailsView.m
@@ -175,7 +175,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
[super viewDidLoad];
// if we use fragments, remove back button
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
_backButton.hidden = YES;
_backButton.alpha = 0;
}
@@ -314,7 +314,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)imagePickerDelegateImage:(UIImage *)image info:(NSDictionary *)info {
// Dismiss popover on iPad
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
[VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE];
}
diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m
index 6fdaea794..9396d6915 100644
--- a/Classes/ContactsListTableView.m
+++ b/Classes/ContactsListTableView.m
@@ -144,12 +144,15 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) {
}
}
[super loadData];
- // reset details view since in fragment mode, details are relative to current data
- // select first contact if any
- ABRecordRef contact =
- ([self totalNumberOfItems] > 0) ? [self contactForIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] : nil;
- ContactDetailsView *view = VIEW(ContactDetailsView);
- [view setContact:contact];
+ if (IPAD) {
+ // reset details view since in fragment mode, details are relative to current data
+ // select first contact if any
+ ABRecordRef contact = ([self totalNumberOfItems] > 0)
+ ? [self contactForIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]
+ : nil;
+ ContactDetailsView *view = VIEW(ContactDetailsView);
+ [view setContact:contact];
+ }
}
static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void *context) {
diff --git a/Classes/DialerView.m b/Classes/DialerView.m
index 1c7d57903..de83c6fbe 100644
--- a/Classes/DialerView.m
+++ b/Classes/DialerView.m
@@ -118,7 +118,7 @@ static UICompositeViewDescription *compositeDescription = nil;
LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0;
[self callUpdate:call state:state];
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
BOOL videoEnabled = linphone_core_video_display_enabled(lc);
BOOL previewPref = [mgr lpConfigBoolForKey:@"preview_preference"];
@@ -176,7 +176,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onOneLongClick:)];
[oneButton addGestureRecognizer:oneLongGesture];
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
if ([LinphoneManager instance].frontCamId != nil) {
// only show camera switch button if we have more than 1 camera
[videoCameraSwitch setHidden:FALSE];
@@ -217,7 +217,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)coreUpdateEvent:(NSNotification *)notif {
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
LinphoneCore *lc = [LinphoneManager getLc];
if (linphone_core_video_display_enabled(lc) && linphone_core_video_preview_enabled(lc)) {
linphone_core_set_native_preview_window_id(lc, (__bridge void *)(videoPreview));
diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m
index 1d92a47b5..02216d51c 100644
--- a/Classes/HistoryDetailsView.m
+++ b/Classes/HistoryDetailsView.m
@@ -57,7 +57,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[super viewDidLoad];
// if we use fragments, remove back button
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
_backButton.hidden = YES;
_backButton.alpha = 0;
}
diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m
index 70583ebf6..d65cd98d1 100644
--- a/Classes/HistoryListTableView.m
+++ b/Classes/HistoryListTableView.m
@@ -144,16 +144,18 @@
[super loadData];
- // reset details view since in fragment mode, details are relative to current data
- // select first log if any
- NSString *callId = nil;
- if ([self totalNumberOfItems] > 0) {
- id logId = [_sections objectForKey:_sortedDays[0]][0];
- LinphoneCallLog *log = [logId pointerValue];
- callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(log) ?: ""];
+ if (IPAD) {
+ // reset details view since in fragment mode, details are relative to current data
+ // select first log if any
+ NSString *callId = nil;
+ if ([self totalNumberOfItems] > 0) {
+ id logId = [_sections objectForKey:_sortedDays[0]][0];
+ LinphoneCallLog *log = [logId pointerValue];
+ callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(log) ?: ""];
+ }
+ HistoryDetailsView *view = VIEW(HistoryDetailsView);
+ [view setCallLogId:callId];
}
- HistoryDetailsView *view = VIEW(HistoryDetailsView);
- [view setCallLogId:callId];
}
- (void)computeSections {
@@ -221,7 +223,7 @@
id log = [_sections objectForKey:_sortedDays[indexPath.section]][indexPath.row];
LinphoneCallLog *callLog = [log pointerValue];
if (callLog != NULL && linphone_call_log_get_call_id(callLog) != NULL) {
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
UIHistoryCell *cell = (UIHistoryCell *)[self tableView:tableView cellForRowAtIndexPath:indexPath];
[cell onDetails:self];
} else {
diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m
index d20c87566..bf13f0773 100644
--- a/Classes/ImagePickerView.m
+++ b/Classes/ImagePickerView.m
@@ -36,7 +36,7 @@
self = [super init];
if (self != nil) {
pickerController = [[UIImagePickerController alloc] init];
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
popoverController = [[UIPopoverController alloc] initWithContentViewController:pickerController];
}
}
@@ -172,7 +172,7 @@ static UICompositeViewDescription *compositeDescription = nil;
inView:(UIView *)ipadView {
void (^block)(UIImagePickerControllerSourceType) = ^(UIImagePickerControllerSourceType type) {
ImagePickerView *view = VIEW(ImagePickerView);
- if (!(LinphoneManager.runningOnIpad && ipadView && ipadPopoverView)) {
+ if (!(IPAD && ipadView && ipadPopoverView)) {
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
}
view.sourceType = type;
@@ -186,7 +186,7 @@ static UICompositeViewDescription *compositeDescription = nil;
view.allowsEditing = NO;
view.imagePickerDelegate = delegate;
- if (LinphoneManager.runningOnIpad && ipadView && ipadPopoverView) {
+ if (IPAD && ipadView && ipadPopoverView) {
UIView *iterview = ipadPopoverView;
CGRect ipadPopoverPosition = iterview.frame;
do {
diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index bea52ff95..3221f8448 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -1712,7 +1712,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
linphone_core_start_dtmf_stream(theLinphoneCore);
/*start the video preview in case we are in the main view*/
- if (LinphoneManager.runningOnIpad && linphone_core_video_display_enabled(theLinphoneCore) &&
+ if (IPAD && linphone_core_video_display_enabled(theLinphoneCore) &&
[self lpConfigBoolForKey:@"preview_preference"]) {
linphone_core_enable_video_preview(theLinphoneCore, TRUE);
}
@@ -1770,7 +1770,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (void)copyDefaultSettings {
NSString *src = [LinphoneManager bundleFile:@"linphonerc"];
NSString *srcIpad = [LinphoneManager bundleFile:@"linphonerc~ipad"];
- if (LinphoneManager.runningOnIpad && [[NSFileManager defaultManager] fileExistsAtPath:srcIpad]) {
+ if (IPAD && [[NSFileManager defaultManager] fileExistsAtPath:srcIpad]) {
src = srcIpad;
}
NSString *dst = [LinphoneManager documentFile:@"linphonerc"];
@@ -1780,7 +1780,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (void)overrideDefaultSettings {
NSString *factory = [LinphoneManager bundleFile:@"linphonerc-factory"];
NSString *factoryIpad = [LinphoneManager bundleFile:@"linphonerc-factory~ipad"];
- if (LinphoneManager.runningOnIpad && [[NSFileManager defaultManager] fileExistsAtPath:factoryIpad]) {
+ if (IPAD && [[NSFileManager defaultManager] fileExistsAtPath:factoryIpad]) {
factory = factoryIpad;
}
NSString *confiFileName = [LinphoneManager documentFile:@"linphonerc"];
@@ -1797,7 +1797,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
NSString *route = (__bridge NSString *)lNewRoute;
notallow = [route isEqualToString:@"Headset"] || [route isEqualToString:@"Headphone"] ||
[route isEqualToString:@"HeadphonesAndMicrophone"] || [route isEqualToString:@"HeadsetInOut"] ||
- [route isEqualToString:@"Lineout"] || LinphoneManager.runningOnIpad;
+ [route isEqualToString:@"Lineout"] || IPAD;
CFRelease(lNewRoute);
}
return !notallow;
@@ -1821,7 +1821,7 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
LOGI(@"Current audio route is [%s]", [route UTF8String]);
speakerEnabled = [route isEqualToString:@"Speaker"] || [route isEqualToString:@"SpeakerAndMicrophone"];
- if (!LinphoneManager.runningOnIpad && [route isEqualToString:@"HeadsetBT"] && !speakerEnabled) {
+ if (!IPAD && [route isEqualToString:@"HeadsetBT"] && !speakerEnabled) {
lm.bluetoothEnabled = TRUE;
lm.bluetoothAvailable = TRUE;
NSDictionary *dict = [NSDictionary
diff --git a/Classes/LinphoneUI/Base.lproj/UIChatCell.xib b/Classes/LinphoneUI/Base.lproj/UIChatCell.xib
index a3782140b..8d8b5f97b 100644
--- a/Classes/LinphoneUI/Base.lproj/UIChatCell.xib
+++ b/Classes/LinphoneUI/Base.lproj/UIChatCell.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -23,12 +23,10 @@
-
-
diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m
index ccfb9b78b..1971ff6c6 100644
--- a/Classes/LinphoneUI/UIChatCell.m
+++ b/Classes/LinphoneUI/UIChatCell.m
@@ -116,9 +116,9 @@
[UIView setAnimationDuration:0.3];
}
if (editing) {
- [_unreadCountButton setAlpha:0.0f];
+ [_unreadCountView setAlpha:0.0f];
} else {
- [_unreadCountButton setAlpha:1.0f];
+ [_unreadCountView setAlpha:1.0f];
}
if (animated) {
[UIView commitAnimations];
diff --git a/Classes/LinphoneUI/UICompositeView.m b/Classes/LinphoneUI/UICompositeView.m
index 7aacb6fe5..e61b17e28 100644
--- a/Classes/LinphoneUI/UICompositeView.m
+++ b/Classes/LinphoneUI/UICompositeView.m
@@ -64,7 +64,7 @@
self.fullscreen = fullscreen;
self.landscapeMode = YES;
self.portraitMode = YES;
- self.otherFragment = LinphoneManager.runningOnIpad ? NSStringFromClass(otherFragment) : nil;
+ self.otherFragment = IPAD ? NSStringFromClass(otherFragment) : nil;
self.isLeftFragment = isLeftFragment || (self.otherFragment == nil);
self.darkBackground = true;
diff --git a/Classes/LinphoneUI/UIContactCell.m b/Classes/LinphoneUI/UIContactCell.m
index d41fba729..0fdd62a12 100644
--- a/Classes/LinphoneUI/UIContactCell.m
+++ b/Classes/LinphoneUI/UIContactCell.m
@@ -38,7 +38,7 @@
[self addSubview:sub];
// Sections are wider on iPad and overlap linphone image - let's move it a bit
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
CGRect frame = _linphoneImage.frame;
frame.origin.x -= frame.size.width / 2;
_linphoneImage.frame = frame;
diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m
index 003e4799c..f34708b5b 100644
--- a/Classes/LinphoneUI/UIHistoryCell.m
+++ b/Classes/LinphoneUI/UIHistoryCell.m
@@ -39,7 +39,7 @@
UIView *sub = ((UIView *)[arrayOfViews objectAtIndex:0]);
[self setFrame:CGRectMake(0, 0, sub.frame.size.width, sub.frame.size.height)];
[self addSubview:sub];
- _detailsButton.hidden = LinphoneManager.runningOnIpad;
+ _detailsButton.hidden = IPAD;
callLog = NULL;
}
return self;
diff --git a/Classes/LinphoneUI/UITextField+DoneButton.m b/Classes/LinphoneUI/UITextField+DoneButton.m
index 08d76f944..b90f0ec6d 100644
--- a/Classes/LinphoneUI/UITextField+DoneButton.m
+++ b/Classes/LinphoneUI/UITextField+DoneButton.m
@@ -14,7 +14,7 @@
- (void)addDoneButton {
// actually on iPad there is a done button
- if (!LinphoneManager.runningOnIpad) {
+ if (!IPAD) {
UIToolbar *numberToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
numberToolbar.items = [NSArray
arrayWithObjects:[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil)
diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m
index e974a35b3..5d90e7b69 100644
--- a/Classes/PhoneMainView.m
+++ b/Classes/PhoneMainView.m
@@ -65,7 +65,7 @@ static RootViewManager *rootViewManagerInstance = nil;
// not sure what this code was doing... but since iphone does support rotation as well now...
#if 0
- if (LinphoneManager.runningOnIpad)
+ if (IPAD)
return currentViewController;
PhoneMainView *newMainView = description.landscapeMode ? self.rotatingViewController : self.portraitViewController;
diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m
index 3a6037d7a..3a1634f87 100644
--- a/Classes/SettingsView.m
+++ b/Classes/SettingsView.m
@@ -583,7 +583,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"console_button"];
}
- if (!LinphoneManager.runningOnIpad) {
+ if (!IPAD) {
[hiddenKeys addObject:@"preview_preference"];
}
if ([lm lpConfigBoolForKey:@"hide_run_assistant_preference"]) {
diff --git a/Classes/SideMenuView.m b/Classes/SideMenuView.m
index e8577eb4d..08f4f5fa6 100644
--- a/Classes/SideMenuView.m
+++ b/Classes/SideMenuView.m
@@ -76,7 +76,7 @@
- (IBAction)onAvatarClick:(id)sender {
// hide ourself because we are on top of image picker
- if (!LinphoneManager.runningOnIpad) {
+ if (!IPAD) {
[PhoneMainView.instance.mainViewController hideSideMenu:YES];
}
[ImagePickerView SelectImageFromDevice:self atPosition:_avatarImage inView:self.view];
@@ -95,7 +95,7 @@
- (void)imagePickerDelegateImage:(UIImage *)image info:(NSDictionary *)info {
// Dismiss popover on iPad
- if (LinphoneManager.runningOnIpad) {
+ if (IPAD) {
[VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE];
} else {
[PhoneMainView.instance.mainViewController hideSideMenu:NO];
diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h
index a451b6208..179a77c6c 100644
--- a/Classes/Utils/Utils.h
+++ b/Classes/Utils/Utils.h
@@ -19,6 +19,15 @@
#import "LinphoneManager.h"
+#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
+#define LOGD(...) LOGV(ORTP_DEBUG, __VA_ARGS__)
+#define LOGI(...) LOGV(ORTP_MESSAGE, __VA_ARGS__)
+#define LOGW(...) LOGV(ORTP_WARNING, __VA_ARGS__)
+#define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__)
+#define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__)
+
+#define IPAD (LinphoneManager.runningOnIpad)
+
@interface LinphoneLogger : NSObject {
}
@@ -58,13 +67,6 @@ typedef enum {
@end
-#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
-#define LOGD(...) LOGV(ORTP_DEBUG, __VA_ARGS__)
-#define LOGI(...) LOGV(ORTP_MESSAGE, __VA_ARGS__)
-#define LOGW(...) LOGV(ORTP_WARNING, __VA_ARGS__)
-#define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__)
-#define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__)
-
@interface NSString(md5)
- (NSString *)md5;
diff --git a/linphone_Prefix.pch b/linphone_Prefix.pch
index 445419d21..a684971e5 100644
--- a/linphone_Prefix.pch
+++ b/linphone_Prefix.pch
@@ -5,4 +5,6 @@
#ifdef __OBJC__
#import
#import
-#endif
\ No newline at end of file
+#endif
+
+#import "Utils.h"