mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Improve history and chat
This commit is contained in:
parent
c396151632
commit
e352543273
30 changed files with 805 additions and 630 deletions
|
|
@ -19,13 +19,16 @@
|
|||
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ChatModel.h"
|
||||
|
||||
@interface ChatRoomTableViewController : UITableViewController {
|
||||
@private
|
||||
NSArray *data;
|
||||
NSString *remoteContact;
|
||||
NSMutableArray *data;
|
||||
NSString *remoteAddress;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSString *remoteContact;
|
||||
@property (nonatomic, retain) NSString *remoteAddress;
|
||||
|
||||
- (void)addChatEntry:(ChatModel*)chat;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
#import "ChatRoomTableViewController.h"
|
||||
#import "UIChatRoomCell.h"
|
||||
#import "UIChatRoomHeader.h"
|
||||
#import "Utils.h"
|
||||
|
||||
#import <NinePatch.h>
|
||||
|
||||
@implementation ChatRoomTableViewController
|
||||
|
||||
@synthesize remoteContact;
|
||||
@synthesize remoteAddress;
|
||||
|
||||
|
||||
#pragma mark - ViewController
|
||||
|
|
@ -38,27 +38,75 @@
|
|||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[TUNinePatchCache flushCache]; // Clear cache
|
||||
if(data != nil) {
|
||||
[data removeAllObjects];
|
||||
[data release];
|
||||
data = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)loadData {
|
||||
if(data != nil)
|
||||
if(data != nil) {
|
||||
[data removeAllObjects];
|
||||
[data release];
|
||||
data = [[ChatModel listMessages:remoteContact] retain];
|
||||
}
|
||||
data = [[ChatModel listMessages:remoteAddress] retain];
|
||||
[[self tableView] reloadData];
|
||||
[self scrollToLastUnread:false];
|
||||
}
|
||||
|
||||
- (void)addChatEntry:(ChatModel*)chat {
|
||||
if(data == nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot add entry: null data"];
|
||||
return;
|
||||
}
|
||||
[self.tableView beginUpdates];
|
||||
int pos = [data count];
|
||||
[data insertObject:chat atIndex:pos];
|
||||
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:pos inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
|
||||
[self.tableView endUpdates];
|
||||
[self scrollToLastUnread:true];
|
||||
}
|
||||
|
||||
- (void)scrollToLastUnread:(BOOL)animated {
|
||||
if(data == nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot add entry: null data"];
|
||||
return;
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
// Find first unread & set all entry read
|
||||
for(int i = 0; i <[data count]; ++i) {
|
||||
ChatModel *chat = [data objectAtIndex:i];
|
||||
if([[chat read] intValue] == 0) {
|
||||
[chat setRead:[NSNumber numberWithInt:1]];
|
||||
if(index == -1)
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if(index == -1) {
|
||||
index = [data count] - 1;
|
||||
}
|
||||
|
||||
// Scroll to unread
|
||||
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:animated];
|
||||
}
|
||||
|
||||
#pragma mark - Property Functions
|
||||
|
||||
- (void)setRemoteContact:(NSString *)aremoteContact {
|
||||
self->remoteContact = aremoteContact;
|
||||
[ChatModel readConversation:aremoteContact];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self];
|
||||
- (void)setRemoteAddress:(NSString *)aremoteAddress {
|
||||
if(remoteAddress != nil) {
|
||||
[remoteAddress release];
|
||||
}
|
||||
self->remoteAddress = [aremoteAddress copy];
|
||||
[self loadData];
|
||||
[ChatModel readConversation:remoteAddress];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UITableViewDataSource Functions
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
|
|
@ -82,20 +130,20 @@
|
|||
}
|
||||
|
||||
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if(editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
[tableView beginUpdates];
|
||||
ChatModel *chat = [data objectAtIndex:[indexPath row]];
|
||||
[data removeObjectAtIndex:[indexPath row]];
|
||||
[chat delete];
|
||||
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
||||
[tableView endUpdates];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UITableViewDelegate Functions
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
UIChatRoomHeader *headerController = [[UIChatRoomHeader alloc] init];
|
||||
UIView *headerView = [headerController view];
|
||||
[headerController setContact:remoteContact];
|
||||
[headerController release];
|
||||
return headerView;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
return [UIChatRoomHeader height];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
ChatModel *chat = [data objectAtIndex:[indexPath row]];
|
||||
return [UIChatRoomCell height:chat];
|
||||
|
|
|
|||
|
|
@ -24,20 +24,27 @@
|
|||
#import "ChatRoomTableViewController.h"
|
||||
#import "ChatModel.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
|
||||
@interface ChatRoomViewController : UIViewController<UITextFieldDelegate, UICompositeViewDelegate> {
|
||||
ChatRoomTableViewController *tableController;
|
||||
UITextField *messageField;
|
||||
UIButton *sendButton;
|
||||
NSString *remoteContact;
|
||||
NSString *remoteAddress;
|
||||
UIToggleButton *editButton;
|
||||
LinphoneChatRoom *chatRoom;
|
||||
UILabel *addressLabel;
|
||||
UIImageView *avatarImage;
|
||||
}
|
||||
|
||||
- (void) setRemoteContact:(NSString*)remoteContact;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet ChatRoomTableViewController* tableController;
|
||||
@property (nonatomic, retain) IBOutlet UIToggleButton *editButton;
|
||||
@property (nonatomic, retain) IBOutlet UITextField* messageField;
|
||||
@property (nonatomic, retain) IBOutlet UIButton* sendButton;
|
||||
@property (nonatomic, retain) IBOutlet UILabel *addressLabel;
|
||||
@property (nonatomic, retain) IBOutlet UIImageView *avatarImage;
|
||||
@property (nonatomic, copy) NSString *remoteAddress;
|
||||
|
||||
- (IBAction)onBackClick:(id)event;
|
||||
- (IBAction)onEditClick:(id)event;
|
||||
|
|
|
|||
|
|
@ -24,16 +24,22 @@
|
|||
|
||||
@implementation ChatRoomViewController
|
||||
|
||||
|
||||
@synthesize tableController;
|
||||
@synthesize sendButton;
|
||||
@synthesize messageField;
|
||||
@synthesize editButton;
|
||||
@synthesize remoteAddress;
|
||||
@synthesize addressLabel;
|
||||
@synthesize avatarImage;
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
- (id)init {
|
||||
return [super initWithNibName:@"ChatRoomViewController" bundle:[NSBundle mainBundle]];
|
||||
self = [super initWithNibName:@"ChatRoomViewController" bundle:[NSBundle mainBundle]];
|
||||
if (self != nil) {
|
||||
self->chatRoom = NULL;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
|
|
@ -42,9 +48,13 @@
|
|||
[messageField release];
|
||||
[sendButton release];
|
||||
[editButton release];
|
||||
[remoteAddress release];
|
||||
[addressLabel release];
|
||||
[avatarImage release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
|
|
@ -73,6 +83,14 @@
|
|||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillShow:)
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(keyboardWillHide:)
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(textReceivedEvent:)
|
||||
name:@"LinphoneTextReceived"
|
||||
|
|
@ -85,6 +103,16 @@
|
|||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
if(chatRoom != NULL) {
|
||||
linphone_chat_room_destroy(chatRoom);
|
||||
chatRoom = NULL;
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIKeyboardWillShowNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIKeyboardWillHideNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:@"LinphoneTextReceived"
|
||||
object:nil];
|
||||
|
|
@ -97,9 +125,66 @@
|
|||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setRemoteContact:(NSString*)aRemoteContact {
|
||||
remoteContact = aRemoteContact;
|
||||
[tableController setRemoteContact: remoteContact];
|
||||
- (void)setRemoteAddress:(NSString*)aRemoteAddress {
|
||||
if(remoteAddress != nil) {
|
||||
[remoteAddress release];
|
||||
}
|
||||
remoteAddress = [aRemoteAddress copy];
|
||||
[tableController setRemoteAddress: remoteAddress];
|
||||
|
||||
if(remoteAddress == NULL) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat room header: null contact"];
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *displayName = nil;
|
||||
UIImage *image = nil;
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:remoteAddress];
|
||||
ABRecordRef acontact =[[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(acontact != nil) {
|
||||
displayName = [FastAddressBook getContactDisplayName:acontact];
|
||||
image = [FastAddressBook getContactImage:acontact thumbnail:true];
|
||||
}
|
||||
|
||||
// Display name
|
||||
if(displayName == nil) {
|
||||
displayName = remoteAddress;
|
||||
}
|
||||
[addressLabel setText:displayName];
|
||||
|
||||
// Avatar
|
||||
if(image == nil) {
|
||||
image = [UIImage imageNamed:@"avatar_unknown_small.png"];
|
||||
}
|
||||
[avatarImage setImage:image];
|
||||
}
|
||||
|
||||
- (BOOL)sendMessage:(NSString *)message {
|
||||
if(![LinphoneManager isLcReady]) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot send message: Linphone core not ready"];
|
||||
return FALSE;
|
||||
}
|
||||
if(remoteAddress == nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot send message: Null remoteAddress"];
|
||||
return FALSE;
|
||||
}
|
||||
if(chatRoom == NULL) {
|
||||
chatRoom = linphone_core_create_chat_room([LinphoneManager getLc], [remoteAddress UTF8String]);
|
||||
}
|
||||
|
||||
// Save message in database
|
||||
ChatModel *chat = [[ChatModel alloc] init];
|
||||
[chat setRemoteContact:remoteAddress];
|
||||
[chat setMessage:message];
|
||||
[chat setDirection:[NSNumber numberWithInt:0]];
|
||||
[chat setTime:[NSDate date]];
|
||||
[chat setRead:[NSNumber numberWithInt:1]];
|
||||
[chat create];
|
||||
[tableController addChatEntry:chat];
|
||||
[chat release];
|
||||
|
||||
linphone_chat_room_send_message(chatRoom, [message UTF8String]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,13 +192,19 @@
|
|||
|
||||
- (void)textReceivedEvent:(NSNotification *)notif {
|
||||
//LinphoneChatRoom *room = [[[notif userInfo] objectForKey:@"room"] pointerValue];
|
||||
//NSString *message = [[notif userInfo] objectForKey:@"message"];
|
||||
LinphoneAddress *from = [[[notif userInfo] objectForKey:@"from"] pointerValue];
|
||||
if(from != NULL) {
|
||||
//NSString *message = [[notif userInfo] objectForKey:@"message"];
|
||||
if([[NSString stringWithUTF8String:linphone_address_get_username(from)]
|
||||
caseInsensitiveCompare:remoteContact] == NSOrderedSame) {
|
||||
[[tableController tableView] reloadData];
|
||||
ChatModel *chat = [[notif userInfo] objectForKey:@"chat"];
|
||||
if(from != NULL && chat != NULL) {
|
||||
if([[NSString stringWithUTF8String:linphone_address_as_string_uri_only(from)]
|
||||
caseInsensitiveCompare:remoteAddress] == NSOrderedSame) {
|
||||
[chat setRead:[NSNumber numberWithInt:1]];
|
||||
[chat update];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self];
|
||||
[tableController addChatEntry:chat];
|
||||
}
|
||||
} else {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Invalid textReceivedEvent"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +228,9 @@
|
|||
}
|
||||
|
||||
- (IBAction)onSendClick:(id)event {
|
||||
[messageField endEditing:TRUE];
|
||||
if([self sendMessage:[messageField text]]) {
|
||||
[messageField setText:@""];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onMessageChange:(id)sender {
|
||||
|
|
@ -148,4 +241,44 @@
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark - Keyboard Event Functions
|
||||
|
||||
- (void)keyboardWillHide:(NSNotification *)notif {
|
||||
CGRect beginFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
|
||||
UIViewAnimationCurve curve = [[[notif userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue];
|
||||
NSTimeInterval duration = [[[notif userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
||||
[UIView beginAnimations:@"resize" context:nil];
|
||||
[UIView setAnimationDuration:duration];
|
||||
[UIView setAnimationCurve:curve];
|
||||
[UIView setAnimationBeginsFromCurrentState:TRUE];
|
||||
CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
CGRect frame = [[self view] frame];
|
||||
/*
|
||||
CGPoint pos = {0, 0};
|
||||
CGPoint gPos = [[self view] convertPoint:pos toView:nil];
|
||||
frame.size.height = endFrame.origin.y - gPos.y;
|
||||
*/
|
||||
frame.origin.y += endFrame.origin.y - beginFrame.origin.y;
|
||||
[[self view] setFrame:frame];
|
||||
[UIView commitAnimations];
|
||||
}
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notif {
|
||||
CGRect beginFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
|
||||
UIViewAnimationCurve curve = [[[notif userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue];
|
||||
NSTimeInterval duration = [[[notif userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
||||
[UIView beginAnimations:@"resize" context:nil];
|
||||
[UIView setAnimationDuration:duration];
|
||||
[UIView setAnimationCurve:curve];
|
||||
[UIView setAnimationBeginsFromCurrentState:TRUE];
|
||||
CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
CGRect frame = [[self view] frame];
|
||||
/*CGPoint pos = {0, 0};
|
||||
CGPoint gPos = [[self view] convertPoint:pos toView:nil];
|
||||
frame.size.height = endFrame.origin.y - gPos.y;*/
|
||||
frame.origin.y += endFrame.origin.y - beginFrame.origin.y;
|
||||
[[self view] setFrame:frame];
|
||||
[UIView commitAnimations];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<string>IBUIView</string>
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUITextField</string>
|
||||
<string>IBUITableViewController</string>
|
||||
<string>IBUITableView</string>
|
||||
|
|
@ -87,7 +88,7 @@
|
|||
<string key="NSFrame">{{160, 0}, {160, 58}}</string>
|
||||
<reference key="NSSuperview" ref="333187864"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="879615756"/>
|
||||
<reference key="NSNextKeyView" ref="414508017"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<object class="IBUIAccessibilityConfiguration" key="IBUIAccessibilityConfiguration">
|
||||
|
|
@ -128,83 +129,104 @@
|
|||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="414508017">
|
||||
<reference key="NSNextResponder" ref="589117993"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIImageView" id="934483770">
|
||||
<reference key="NSNextResponder" ref="414508017"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{-13, -5}, {131, 107}}</string>
|
||||
<reference key="NSSuperview" ref="414508017"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="495119736"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">avatar_shadow_small.png</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIImageView" id="495119736">
|
||||
<reference key="NSNextResponder" ref="414508017"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{20, 6}, {65, 65}}</string>
|
||||
<reference key="NSSuperview" ref="414508017"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="578164845"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">avatar_unknown_small.png</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUILabel" id="578164845">
|
||||
<reference key="NSNextResponder" ref="414508017"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{101, 37}, {199, 43}}</string>
|
||||
<reference key="NSSuperview" ref="414508017"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="879615756"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Contact1</string>
|
||||
<object class="NSColor" key="IBUITextColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">22</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">22</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 58}, {320, 80}}</string>
|
||||
<reference key="NSSuperview" ref="589117993"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="934483770"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor" id="460939904">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MCAwAA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUITableView" id="879615756">
|
||||
<reference key="NSNextResponder" ref="589117993"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{0, 58}, {320, 344}}</string>
|
||||
<string key="NSFrame">{{0, 138}, {320, 263}}</string>
|
||||
<reference key="NSSuperview" ref="589117993"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="833509359"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">10</int>
|
||||
<object class="NSImage" key="NSImage">
|
||||
<int key="NSImageFlags">549453824</int>
|
||||
<string key="NSSize">{512, 1}</string>
|
||||
<array class="NSMutableArray" key="NSReps">
|
||||
<array>
|
||||
<integer value="0"/>
|
||||
<object class="NSBitmapImageRep">
|
||||
<object class="NSData" key="NSTIFFRepresentation">
|
||||
<bytes key="NS.bytes">TU0AKgAACAjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
|
||||
y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
|
||||
xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
|
||||
xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
|
||||
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
|
||||
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
|
||||
xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
|
||||
y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
|
||||
y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
|
||||
xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
|
||||
xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
|
||||
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
|
||||
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
|
||||
xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
|
||||
y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
|
||||
y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
|
||||
xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
|
||||
xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
|
||||
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
|
||||
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
|
||||
xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
|
||||
y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
|
||||
y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
|
||||
xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
|
||||
xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
|
||||
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
|
||||
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
|
||||
xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
|
||||
y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
|
||||
y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
|
||||
xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
|
||||
xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
|
||||
xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
|
||||
xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
|
||||
xczS/8vS2P/L0tj/xczU/wANAQAAAwAAAAECAAAAAQEAAwAAAAEAAQAAAQIAAwAAAAQAAAiqAQMAAwAA
|
||||
AAEAAQAAAQYAAwAAAAEAAgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEABAAAARYAAwAA
|
||||
AAEAAQAAARcABAAAAAEAAAgAARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAQAAAiyAAAAAAAI
|
||||
AAgACAAIAAEAAQABAAE</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</array>
|
||||
<object class="NSColor" key="NSColor" id="460939904">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MCAwAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<string key="IBUIColorCocoaTouchKeyPath">groupTableViewBackgroundColor</string>
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBUIAlwaysBounceVertical">YES</bool>
|
||||
<int key="IBUIStyle">1</int>
|
||||
<int key="IBUISeparatorStyle">2</int>
|
||||
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
|
||||
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
|
||||
<float key="IBUIRowHeight">44</float>
|
||||
<float key="IBUISectionHeaderHeight">10</float>
|
||||
<float key="IBUISectionFooterHeight">10</float>
|
||||
<float key="IBUISectionHeaderHeight">22</float>
|
||||
<float key="IBUISectionFooterHeight">22</float>
|
||||
</object>
|
||||
<object class="IBUIView" id="833509359">
|
||||
<reference key="NSNextResponder" ref="589117993"/>
|
||||
|
|
@ -216,7 +238,6 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<string key="NSFrame">{{250, 0}, {70, 59}}</string>
|
||||
<reference key="NSSuperview" ref="833509359"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<object class="IBUIAccessibilityConfiguration" key="IBUIAccessibilityConfiguration">
|
||||
|
|
@ -368,6 +389,22 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
</object>
|
||||
<int key="connectionID">35</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">addressLabel</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="578164845"/>
|
||||
</object>
|
||||
<int key="connectionID">43</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">avatarImage</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="495119736"/>
|
||||
</object>
|
||||
<int key="connectionID">44</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
|
|
@ -463,6 +500,7 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<reference ref="333187864"/>
|
||||
<reference ref="879615756"/>
|
||||
<reference ref="833509359"/>
|
||||
<reference ref="414508017"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
|
|
@ -474,7 +512,7 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<reference ref="602867427"/>
|
||||
</array>
|
||||
<reference key="parent" ref="589117993"/>
|
||||
<string key="objectName">header</string>
|
||||
<string key="objectName">toolsView</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
|
|
@ -530,6 +568,35 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">tableController</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">39</int>
|
||||
<reference key="object" ref="414508017"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="934483770"/>
|
||||
<reference ref="495119736"/>
|
||||
<reference ref="578164845"/>
|
||||
</array>
|
||||
<reference key="parent" ref="589117993"/>
|
||||
<string key="objectName">headerView</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">42</int>
|
||||
<reference key="object" ref="934483770"/>
|
||||
<reference key="parent" ref="414508017"/>
|
||||
<string key="objectName">avatarShadowBackground</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">41</int>
|
||||
<reference key="object" ref="495119736"/>
|
||||
<reference key="parent" ref="414508017"/>
|
||||
<string key="objectName">avatarImage</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">40</int>
|
||||
<reference key="object" ref="578164845"/>
|
||||
<reference key="parent" ref="414508017"/>
|
||||
<string key="objectName">addressLabel</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
|
@ -547,6 +614,10 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<string key="21.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="29.CustomClassName">ChatRoomTableViewController</string>
|
||||
<string key="29.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="39.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="40.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="41.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="42.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="8.CustomClassName">TPKeyboardAvoidingTableView</string>
|
||||
|
|
@ -558,7 +629,7 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">35</int>
|
||||
<int key="maxID">44</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
@ -598,12 +669,22 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="addressLabel">UILabel</string>
|
||||
<string key="avatarImage">UIImageView</string>
|
||||
<string key="editButton">UIToggleButton</string>
|
||||
<string key="messageField">UITextField</string>
|
||||
<string key="sendButton">UIButton</string>
|
||||
<string key="tableController">ChatRoomTableViewController</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="addressLabel">
|
||||
<string key="name">addressLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="avatarImage">
|
||||
<string key="name">avatarImage</string>
|
||||
<string key="candidateClassName">UIImageView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="editButton">
|
||||
<string key="name">editButton</string>
|
||||
<string key="candidateClassName">UIToggleButton</string>
|
||||
|
|
@ -653,6 +734,8 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="avatar_shadow_small.png">{262, 214}</string>
|
||||
<string key="avatar_unknown_small.png">{131, 131}</string>
|
||||
<string key="chat_back_default.png">{320, 117}</string>
|
||||
<string key="chat_back_over.png">{320, 117}</string>
|
||||
<string key="chat_edit_default.png">{320, 117}</string>
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@
|
|||
NSMutableArray *data;
|
||||
}
|
||||
|
||||
- (void)loadData;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@
|
|||
ChatModel *chat = [data objectAtIndex:[indexPath row]];
|
||||
|
||||
// Go to ChatRoom view
|
||||
ChatRoomTableViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomTableViewController);
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomViewController);
|
||||
if(controller != nil) {
|
||||
[controller setRemoteContact:[chat remoteContact]];
|
||||
[controller setRemoteAddress:[chat remoteContact]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
if([tableController isEditing])
|
||||
[tableController setEditing:FALSE animated:FALSE];
|
||||
[editButton setOff];
|
||||
[[tableController tableView] reloadData];
|
||||
[tableController loadData];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
#pragma mark - Event Functions
|
||||
|
||||
- (void)textReceivedEvent:(NSNotification *)notif {
|
||||
[[tableController tableView] reloadData];
|
||||
[tableController loadData];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -215,12 +215,11 @@
|
|||
// Date
|
||||
NSDate *startData = [NSDate dateWithTimeIntervalSince1970:callLog->start_date_time];
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
|
||||
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
|
||||
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
|
||||
NSLocale *locale = [NSLocale currentLocale];
|
||||
[dateFormatter setLocale:locale];
|
||||
[dateLabel setText:[dateFormatter stringFromDate:startData]];
|
||||
[locale release];
|
||||
[dateFormatter release];
|
||||
|
||||
// Duration
|
||||
|
|
|
|||
|
|
@ -42,10 +42,9 @@
|
|||
<string key="NSFrameSize">{320, 480}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MSAxIDEAA</bytes>
|
||||
<bytes key="NSRGB">MCAxIDAuMTkxOTQ1NDc1NQA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
|
|
|
|||
|
|
@ -209,13 +209,22 @@ int __aeabi_idiv(int a, int b) {
|
|||
}
|
||||
|
||||
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
|
||||
LinphoneCall* call;
|
||||
[(NSData*)([notification.userInfo objectForKey:@"call"]) getBytes:&call];
|
||||
if (!call) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Local notification received with nil call"];
|
||||
return;
|
||||
if([notification.userInfo objectForKey:@"call"] != nil) {
|
||||
LinphoneCall* call;
|
||||
[(NSData*)[notification.userInfo objectForKey:@"call"] getBytes:&call];
|
||||
if (!call) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Local notification received with nil call"];
|
||||
return;
|
||||
}
|
||||
linphone_core_accept_call([LinphoneManager getLc], call);
|
||||
} else if([notification.userInfo objectForKey:@"chat"] != nil) {
|
||||
NSString *remoteContact = (NSString*)[notification.userInfo objectForKey:@"chat"];
|
||||
// Go to ChatRoom view
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomViewController);
|
||||
if(controller != nil) {
|
||||
[controller setRemoteAddress:remoteContact];
|
||||
}
|
||||
}
|
||||
linphone_core_accept_call([LinphoneManager getLc], call);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ struct NetworkReachabilityContext {
|
|||
|
||||
typedef struct _LinphoneCallAppData {
|
||||
bool_t batteryWarningShown;
|
||||
// transfer data
|
||||
int transferButtonIndex;
|
||||
UILocalNotification *notification;
|
||||
} LinphoneCallAppData;
|
||||
|
||||
@interface LinphoneManager : NSObject <AVAudioSessionDelegate> {
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
|
|||
if (!linphone_call_get_user_pointer(call)) {
|
||||
LinphoneCallAppData* data = (LinphoneCallAppData*) malloc(sizeof(LinphoneCallAppData));
|
||||
data->batteryWarningShown = FALSE;
|
||||
data->notification = nil;
|
||||
linphone_call_set_user_pointer(call, data);
|
||||
}
|
||||
|
||||
|
|
@ -317,7 +318,7 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo
|
|||
|
||||
// Save message in database
|
||||
ChatModel *chat = [[ChatModel alloc] init];
|
||||
[chat setRemoteContact:[NSString stringWithUTF8String:linphone_address_get_username(from)]];
|
||||
[chat setRemoteContact:[NSString stringWithUTF8String:linphone_address_as_string_uri_only(from)]];
|
||||
[chat setMessage:[NSString stringWithUTF8String:message]];
|
||||
[chat setDirection:[NSNumber numberWithInt:1]];
|
||||
[chat setTime:[NSDate date]];
|
||||
|
|
@ -329,8 +330,10 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo
|
|||
[NSValue valueWithPointer:room], @"room",
|
||||
[NSValue valueWithPointer:from], @"from",
|
||||
[NSString stringWithUTF8String:message], @"message",
|
||||
chat, @"chat",
|
||||
nil] autorelease];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self userInfo:dict];
|
||||
[chat release];
|
||||
}
|
||||
|
||||
static void linphone_iphone_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
@interface UIChatCell : UITableViewCell {
|
||||
UIImageView *avatarImage;
|
||||
UILabel *displayNameLabel;
|
||||
UILabel *addressLabel;
|
||||
UILabel *chatContentLabel;
|
||||
UIButton *detailsButton;
|
||||
UIButton *deleteButton;
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
@property (nonatomic, retain) ChatModel *chat;
|
||||
@property (nonatomic, retain) IBOutlet UIImageView *avatarImage;
|
||||
@property (nonatomic, retain) IBOutlet UILabel* displayNameLabel;
|
||||
@property (nonatomic, retain) IBOutlet UILabel* addressLabel;
|
||||
@property (nonatomic, retain) IBOutlet UILabel* chatContentLabel;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *detailsButton;
|
||||
@property (nonatomic, retain) IBOutlet UIButton * deleteButton;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
|
||||
#import "UIChatCell.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "LinphoneManager.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation UIChatCell
|
||||
|
||||
@synthesize avatarImage;
|
||||
@synthesize displayNameLabel;
|
||||
@synthesize addressLabel;
|
||||
@synthesize chatContentLabel;
|
||||
@synthesize detailsButton;
|
||||
@synthesize deleteButton;
|
||||
|
|
@ -47,7 +48,7 @@
|
|||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[displayNameLabel release];
|
||||
[addressLabel release];
|
||||
[chatContentLabel release];
|
||||
[avatarImage release];
|
||||
[detailsButton release];
|
||||
|
|
@ -75,30 +76,50 @@
|
|||
return;
|
||||
}
|
||||
|
||||
[avatarImage setImage:[UIImage imageNamed:@"avatar_unknown_small.png"]];
|
||||
[displayNameLabel setText:[chat remoteContact]];
|
||||
NSString *displayName = nil;
|
||||
UIImage *image = nil;
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[chat remoteContact]];
|
||||
ABRecordRef contact =[[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(contact != nil) {
|
||||
displayName = [FastAddressBook getContactDisplayName:contact];
|
||||
image = [FastAddressBook getContactImage:contact thumbnail:true];
|
||||
}
|
||||
|
||||
// Display name
|
||||
if(displayName == nil) {
|
||||
displayName = [chat remoteContact];
|
||||
}
|
||||
[addressLabel setText:displayName];
|
||||
|
||||
// Avatar
|
||||
if(image == nil) {
|
||||
image = [UIImage imageNamed:@"avatar_unknown_small.png"];
|
||||
}
|
||||
[avatarImage setImage:image];
|
||||
|
||||
// Message
|
||||
[chatContentLabel setText:[chat message]];
|
||||
|
||||
//
|
||||
// Adapt size
|
||||
//
|
||||
CGRect displayNameFrame = [displayNameLabel frame];
|
||||
CGRect displayNameFrame = [addressLabel frame];
|
||||
CGRect chatContentFrame = [chatContentLabel frame];
|
||||
|
||||
chatContentFrame.origin.x -= displayNameFrame.size.width;
|
||||
|
||||
// Compute firstName size
|
||||
CGSize contraints;
|
||||
contraints.height = [displayNameLabel frame].size.height;
|
||||
contraints.width = ([chatContentLabel frame].size.width + [chatContentLabel frame].origin.x) - [displayNameLabel frame].origin.x;
|
||||
CGSize firstNameSize = [[displayNameLabel text] sizeWithFont:[displayNameLabel font] constrainedToSize: contraints];
|
||||
contraints.height = [addressLabel frame].size.height;
|
||||
contraints.width = ([chatContentLabel frame].size.width + [chatContentLabel frame].origin.x) - [addressLabel frame].origin.x;
|
||||
CGSize firstNameSize = [[addressLabel text] sizeWithFont:[addressLabel font] constrainedToSize: contraints];
|
||||
displayNameFrame.size.width = firstNameSize.width;
|
||||
|
||||
// Compute lastName size & position
|
||||
chatContentFrame.origin.x += displayNameFrame.size.width;
|
||||
chatContentFrame.size.width = (contraints.width + [displayNameLabel frame].origin.x) - chatContentFrame.origin.x;
|
||||
chatContentFrame.size.width = (contraints.width + [addressLabel frame].origin.x) - chatContentFrame.origin.x;
|
||||
|
||||
[displayNameLabel setFrame: displayNameFrame];
|
||||
[addressLabel setFrame: displayNameFrame];
|
||||
[chatContentLabel setFrame: chatContentFrame];
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +150,7 @@
|
|||
// Go to Chat room view
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomViewController);
|
||||
if(controller !=nil) {
|
||||
[controller setRemoteContact:[chat remoteContact]];
|
||||
[controller setRemoteAddress:[chat remoteContact]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@
|
|||
<string key="NSFrame">{{276, 0}, {44, 44}}</string>
|
||||
<reference key="NSSuperview" ref="316763236"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
|
|
@ -203,14 +204,6 @@
|
|||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">displayNameLabel</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="394118737"/>
|
||||
</object>
|
||||
<int key="connectionID">23</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">chatContentLabel</string>
|
||||
|
|
@ -243,6 +236,14 @@
|
|||
</object>
|
||||
<int key="connectionID">35</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">addressLabel</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="394118737"/>
|
||||
</object>
|
||||
<int key="connectionID">38</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">onDetailsClick:</string>
|
||||
|
|
@ -309,7 +310,7 @@
|
|||
<int key="objectID">20</int>
|
||||
<reference key="object" ref="394118737"/>
|
||||
<reference key="parent" ref="316763236"/>
|
||||
<string key="objectName">displayNameLabel</string>
|
||||
<string key="objectName">addressLabel</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">21</int>
|
||||
|
|
@ -345,7 +346,7 @@
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">37</int>
|
||||
<int key="maxID">38</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
@ -367,13 +368,17 @@
|
|||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="addressLabel">UILabel</string>
|
||||
<string key="avatarImage">UIImageView</string>
|
||||
<string key="chatContentLabel">UILabel</string>
|
||||
<string key="deleteButton">UIButton</string>
|
||||
<string key="detailsButton">UIButton</string>
|
||||
<string key="displayNameLabel">UILabel</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="addressLabel">
|
||||
<string key="name">addressLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="avatarImage">
|
||||
<string key="name">avatarImage</string>
|
||||
<string key="candidateClassName">UIImageView</string>
|
||||
|
|
@ -390,10 +395,6 @@
|
|||
<string key="name">detailsButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="displayNameLabel">
|
||||
<string key="name">displayNameLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
|
|
|
|||
|
|
@ -24,17 +24,21 @@
|
|||
@interface UIChatRoomCell : UITableViewCell {
|
||||
UIImageView *backgroundImage;
|
||||
UIView *contentView;
|
||||
UIView *messageView;
|
||||
UILabel *messageLabel;
|
||||
UIButton *deleteButton;
|
||||
UILabel *dateLabel;
|
||||
|
||||
ChatModel *chat;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) ChatModel *chat;
|
||||
@property (nonatomic, retain) IBOutlet UIView *contentView;
|
||||
@property (nonatomic, retain) IBOutlet UIView *messageView;
|
||||
@property (nonatomic, retain) IBOutlet UIImageView* backgroundImage;
|
||||
@property (nonatomic, retain) IBOutlet UILabel *messageLabel;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *deleteButton;
|
||||
@property (nonatomic, retain) IBOutlet UILabel *dateLabel;
|
||||
|
||||
- (id)initWithIdentifier:(NSString*)identifier;
|
||||
+ (CGFloat)height:(ChatModel*)chat;
|
||||
|
|
|
|||
|
|
@ -25,9 +25,11 @@
|
|||
@implementation UIChatRoomCell
|
||||
|
||||
@synthesize contentView;
|
||||
@synthesize messageView;
|
||||
@synthesize backgroundImage;
|
||||
@synthesize messageLabel;
|
||||
@synthesize deleteButton;
|
||||
@synthesize dateLabel;
|
||||
@synthesize chat;
|
||||
|
||||
static const CGFloat CELL_MIN_HEIGHT = 65.0f;
|
||||
|
|
@ -50,8 +52,10 @@ static UIFont *CELL_FONT = nil;
|
|||
- (void)dealloc {
|
||||
[backgroundImage release];
|
||||
[contentView release];
|
||||
[messageView release];
|
||||
[messageLabel release];
|
||||
[deleteButton release];
|
||||
[dateLabel release];
|
||||
|
||||
[chat release];
|
||||
|
||||
|
|
@ -69,8 +73,10 @@ static UIFont *CELL_FONT = nil;
|
|||
[self update];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
- (void)prepareForReuse {
|
||||
[super prepareForReuse];
|
||||
self->chat = nil;
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
if(chat == nil) {
|
||||
|
|
@ -78,6 +84,15 @@ static UIFont *CELL_FONT = nil;
|
|||
return;
|
||||
}
|
||||
[messageLabel setText:[chat message]];
|
||||
|
||||
// Date
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
|
||||
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
|
||||
NSLocale *locale = [NSLocale currentLocale];
|
||||
[dateFormatter setLocale:locale];
|
||||
[dateLabel setText:[dateFormatter stringFromDate:[chat time]]];
|
||||
[dateFormatter release];
|
||||
}
|
||||
|
||||
- (void)setEditing:(BOOL)editing {
|
||||
|
|
@ -110,20 +125,24 @@ static UIFont *CELL_FONT = nil;
|
|||
}
|
||||
|
||||
if(chat != nil) {
|
||||
if([chat direction]) {
|
||||
CGPoint center = [contentView center];
|
||||
if(![[chat direction] intValue]) { // Inverted
|
||||
[backgroundImage setImage:[TUNinePatchCache imageOfSize:[backgroundImage bounds].size
|
||||
forNinePatchNamed:@"chat_bubble_incoming"]];
|
||||
center.y += 6;
|
||||
} else {
|
||||
[backgroundImage setImage:[TUNinePatchCache imageOfSize:[backgroundImage bounds].size
|
||||
forNinePatchNamed:@"chat_bubble_outgoing"]];
|
||||
center.y -= 6;
|
||||
}
|
||||
[messageView setCenter:center];
|
||||
}
|
||||
|
||||
// Resize message
|
||||
// Resize messageView
|
||||
{
|
||||
CGRect frame = [messageLabel frame];
|
||||
frame.size.height = [UIChatRoomCell messageHeight:[chat message]];
|
||||
[messageLabel setFrame:frame];
|
||||
CGRect frame = [messageView frame];
|
||||
frame.size.height = [UIChatRoomCell messageHeight:[chat message]] + 10;
|
||||
[messageView setFrame:frame];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +158,7 @@ static UIFont *CELL_FONT = nil;
|
|||
|
||||
+ (CGFloat)height:(ChatModel*)chat {
|
||||
CGFloat height = [UIChatRoomCell messageHeight:[chat message]];
|
||||
height += 20;
|
||||
height += 40;
|
||||
if(height < CELL_MIN_HEIGHT)
|
||||
height = CELL_MIN_HEIGHT;
|
||||
return height;
|
||||
|
|
@ -158,9 +177,14 @@ static UIFont *CELL_FONT = nil;
|
|||
|
||||
- (IBAction)onDeleteClick: (id) event {
|
||||
if(chat != NULL) {
|
||||
[chat delete];
|
||||
UITableView *parentTable = (UITableView *)self.superview;
|
||||
[parentTable reloadData];
|
||||
UIView *view = [self superview];
|
||||
// Find TableViewCell
|
||||
if(view != nil && ![view isKindOfClass:[UITableView class]]) view = [view superview];
|
||||
if(view != nil) {
|
||||
UITableView *tableView = (UITableView*) view;
|
||||
NSIndexPath *indexPath = [tableView indexPathForCell:self];
|
||||
[[tableView dataSource] tableView:tableView commitEditingStyle:UITableViewCellEditingStyleDelete forRowAtIndexPath:indexPath];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
<object class="IBUILabel" id="281972462">
|
||||
<reference key="NSNextResponder" ref="456806949"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrameSize">{280, 100}</string>
|
||||
<string key="NSFrameSize">{280, 90}</string>
|
||||
<reference key="NSSuperview" ref="456806949"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="859609488"/>
|
||||
|
|
@ -91,21 +91,22 @@
|
|||
</object>
|
||||
<object class="IBUIButton" id="859609488">
|
||||
<reference key="NSNextResponder" ref="456806949"/>
|
||||
<int key="NSvFlags">297</int>
|
||||
<string key="NSFrame">{{236, 28}, {44, 44}}</string>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{236, 0}, {44, 44}}</string>
|
||||
<reference key="NSSuperview" ref="456806949"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="504194589"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<bool key="IBUIAdjustsImageWhenHighlighted">NO</bool>
|
||||
<double key="IBUIImageEdgeInsets.top">11</double>
|
||||
<double key="IBUIImageEdgeInsets.bottom">11</double>
|
||||
<double key="IBUIImageEdgeInsets.left">11</double>
|
||||
<double key="IBUIImageEdgeInsets.right">11</double>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor">
|
||||
<double key="IBUIImageEdgeInsets.top">2</double>
|
||||
<double key="IBUIImageEdgeInsets.bottom">20</double>
|
||||
<double key="IBUIImageEdgeInsets.left">20</double>
|
||||
<double key="IBUIImageEdgeInsets.right">2</double>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor" id="479423909">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
</object>
|
||||
|
|
@ -127,8 +128,37 @@
|
|||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUILabel" id="504194589">
|
||||
<reference key="NSNextResponder" ref="456806949"/>
|
||||
<int key="NSvFlags">265</int>
|
||||
<string key="NSFrame">{{0, 90}, {280, 10}}</string>
|
||||
<reference key="NSSuperview" ref="456806949"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">09/09/2009 at 09:09</string>
|
||||
<reference key="IBUITextColor" ref="479423909"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<int key="IBUITextAlignment">2</int>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">12</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">12</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{20, 25}, {280, 100}}</string>
|
||||
<string key="NSFrame">{{20, 20}, {280, 100}}</string>
|
||||
<reference key="NSSuperview" ref="579600281"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="281972462"/>
|
||||
|
|
@ -152,21 +182,17 @@
|
|||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="369753676">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{100, 100}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<reference key="IBUIBackgroundColor" ref="765717609"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="111268450">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{100, 100}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<reference key="IBUIBackgroundColor" ref="765717609"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
|
|
@ -222,6 +248,22 @@
|
|||
</object>
|
||||
<int key="connectionID">19</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">messageView</string>
|
||||
<reference key="source" ref="841351856"/>
|
||||
<reference key="destination" ref="456806949"/>
|
||||
</object>
|
||||
<int key="connectionID">21</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dateLabel</string>
|
||||
<reference key="source" ref="841351856"/>
|
||||
<reference key="destination" ref="504194589"/>
|
||||
</object>
|
||||
<int key="connectionID">24</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">onDeleteClick:</string>
|
||||
|
|
@ -285,6 +327,7 @@
|
|||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="281972462"/>
|
||||
<reference ref="859609488"/>
|
||||
<reference ref="504194589"/>
|
||||
</array>
|
||||
<reference key="parent" ref="579600281"/>
|
||||
<string key="objectName">messageView</string>
|
||||
|
|
@ -301,6 +344,12 @@
|
|||
<reference key="parent" ref="456806949"/>
|
||||
<string key="objectName">deleteButton</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">22</int>
|
||||
<reference key="object" ref="504194589"/>
|
||||
<reference key="parent" ref="456806949"/>
|
||||
<string key="objectName">timestampLabel</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
|
@ -314,6 +363,7 @@
|
|||
<real value="2" key="18.IBUIButtonInspectorSelectedEdgeInsetMetadataKey"/>
|
||||
<real value="1" key="18.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="22.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
|
|
@ -322,7 +372,7 @@
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">20</int>
|
||||
<int key="maxID">24</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
@ -343,8 +393,10 @@
|
|||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="backgroundImage">UIImageView</string>
|
||||
<string key="contentView">UIView</string>
|
||||
<string key="dateLabel">UILabel</string>
|
||||
<string key="deleteButton">UIButton</string>
|
||||
<string key="messageLabel">UILabel</string>
|
||||
<string key="messageView">UIView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="backgroundImage">
|
||||
|
|
@ -355,6 +407,10 @@
|
|||
<string key="name">contentView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="dateLabel">
|
||||
<string key="name">dateLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="deleteButton">
|
||||
<string key="name">deleteButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
|
|
@ -363,6 +419,10 @@
|
|||
<string key="name">messageLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="messageView">
|
||||
<string key="name">messageView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
/* UIChatRoomHeader.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>
|
||||
#import "ChatModel.h"
|
||||
|
||||
@interface UIChatRoomHeader : UIViewController {
|
||||
UILabel *addressLabel;
|
||||
UIImageView *avatarImage;
|
||||
|
||||
NSString *contact;
|
||||
}
|
||||
|
||||
@property (nonatomic, copy) NSString *contact;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UILabel *addressLabel;
|
||||
@property (nonatomic, retain) IBOutlet UIImageView *avatarImage;
|
||||
|
||||
+ (CGFloat)height;
|
||||
|
||||
@end
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/* UIChatRoomHeader.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 "UIChatRoomHeader.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation UIChatRoomHeader
|
||||
|
||||
@synthesize avatarImage;
|
||||
@synthesize addressLabel;
|
||||
@synthesize contact;
|
||||
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
- (id)init {
|
||||
return [super initWithNibName:@"UIChatRoomHeader" bundle:[NSBundle mainBundle]];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[avatarImage release];
|
||||
[addressLabel release];
|
||||
[contact release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Property Functions
|
||||
|
||||
- (void)setContact:(NSString *)acontact {
|
||||
if(contact != nil) {
|
||||
[contact release];
|
||||
}
|
||||
contact = [acontact copy];
|
||||
[self update];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)update {
|
||||
if(contact == NULL) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat room header: null contact"];
|
||||
return;
|
||||
}
|
||||
|
||||
[avatarImage setImage:[UIImage imageNamed:@"avatar_unknown_small.png"]];
|
||||
[addressLabel setText:contact];
|
||||
}
|
||||
|
||||
+ (CGFloat)height {
|
||||
return 80.0f;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">11D50</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.32</string>
|
||||
<string key="IBDocument.HIToolboxVersion">568.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUIView</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBProxyObject</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="1033790597">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIImageView" id="452773126">
|
||||
<reference key="NSNextResponder" ref="1033790597"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{-13, -5}, {131, 107}}</string>
|
||||
<reference key="NSSuperview" ref="1033790597"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="906825234"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">avatar_shadow_small.png</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIImageView" id="906825234">
|
||||
<reference key="NSNextResponder" ref="1033790597"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{20, 6}, {65, 65}}</string>
|
||||
<reference key="NSSuperview" ref="1033790597"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="683404399"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">avatar_unknown_small.png</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUILabel" id="683404399">
|
||||
<reference key="NSNextResponder" ref="1033790597"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{101, 37}, {199, 43}}</string>
|
||||
<reference key="NSSuperview" ref="1033790597"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Contact1</string>
|
||||
<object class="NSColor" key="IBUITextColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">22</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">22</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrameSize">{320, 80}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="452773126"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MCAwAA</bytes>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="1033790597"/>
|
||||
</object>
|
||||
<int key="connectionID">5</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">avatarImage</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="906825234"/>
|
||||
</object>
|
||||
<int key="connectionID">9</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">addressLabel</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="683404399"/>
|
||||
</object>
|
||||
<int key="connectionID">12</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="1033790597"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="452773126"/>
|
||||
<reference ref="906825234"/>
|
||||
<reference ref="683404399"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="906825234"/>
|
||||
<reference key="parent" ref="1033790597"/>
|
||||
<string key="objectName">avatarImage</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="452773126"/>
|
||||
<reference key="parent" ref="1033790597"/>
|
||||
<string key="objectName">avatarShadowBackground</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
<reference key="object" ref="683404399"/>
|
||||
<reference key="parent" ref="1033790597"/>
|
||||
<string key="objectName">addressLabel</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">UIChatRoomHeader</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">12</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIChatRoomHeader</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="addressLabel">UILabel</string>
|
||||
<string key="avatarImage">UIImageView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="addressLabel">
|
||||
<string key="name">addressLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="avatarImage">
|
||||
<string key="name">avatarImage</string>
|
||||
<string key="candidateClassName">UIImageView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/UIChatRoomHeader.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<real value="1296" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="avatar_shadow_small.png">{262, 214}</string>
|
||||
<string key="avatar_unknown_small.png">{131, 131}</string>
|
||||
</dictionary>
|
||||
<string key="IBCocoaTouchPluginVersion">1181</string>
|
||||
</data>
|
||||
</archive>
|
||||
|
|
@ -97,6 +97,38 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - ViewController Functions
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[contentViewController viewWillAppear:animated];
|
||||
[tabBarViewController viewWillAppear:animated];
|
||||
[stateBarViewController viewWillAppear:animated];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
[contentViewController viewDidAppear:animated];
|
||||
[tabBarViewController viewDidAppear:animated];
|
||||
[stateBarViewController viewDidAppear:animated];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[contentViewController viewWillDisappear:animated];
|
||||
[tabBarViewController viewWillDisappear:animated];
|
||||
[stateBarViewController viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
[contentViewController viewDidDisappear:animated];
|
||||
[tabBarViewController viewDidDisappear:animated];
|
||||
[stateBarViewController viewDidDisappear:animated];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
+ (void)addSubView:(UIViewController*)controller view:(UIView*)view {
|
||||
|
|
|
|||
|
|
@ -136,6 +136,9 @@
|
|||
address = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
}
|
||||
if(address == nil) {
|
||||
address = @"Unknown";
|
||||
}
|
||||
|
||||
[addressLabel setText:address];
|
||||
[imageView setImage: image];
|
||||
|
|
|
|||
|
|
@ -73,15 +73,11 @@
|
|||
selector:@selector(textReceived:)
|
||||
name:@"LinphoneTextReceived"
|
||||
object:nil];
|
||||
|
||||
// Update current view
|
||||
[self updateView:[[PhoneMainView instance] currentView]];
|
||||
if([LinphoneManager isLcReady]) {
|
||||
[self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc])];
|
||||
} else {
|
||||
[self updateMissedCall:0];
|
||||
}
|
||||
[self updateUnreadMessage:[ChatModel unreadMessages]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(applicationWillResignActive:)
|
||||
name:UIApplicationWillResignActiveNotification
|
||||
object:nil];
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
|
@ -96,75 +92,82 @@
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:@"LinphoneTextReceived"
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIApplicationWillResignActiveNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Event Functions
|
||||
|
||||
- (void)callUpdate: (NSNotification*) notif {
|
||||
- (void)applicationWillResignActive:(NSNotification*)notif {
|
||||
// Refresh notifications
|
||||
[historyNotificationView setHidden:TRUE];
|
||||
[chatNotificationView setHidden:TRUE];
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (void)callUpdate:(NSNotification*)notif {
|
||||
//LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue];
|
||||
//LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue];
|
||||
[self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc])];
|
||||
}
|
||||
|
||||
- (void)changeViewEvent: (NSNotification*) notif {
|
||||
- (void)changeViewEvent:(NSNotification*)notif {
|
||||
NSNumber *viewNumber = [notif.userInfo objectForKey: @"view"];
|
||||
if(viewNumber != nil)
|
||||
[self updateView:[viewNumber intValue]];
|
||||
}
|
||||
|
||||
- (void)textReceived: (NSNotification*) notif {
|
||||
- (void)textReceived:(NSNotification*)notif {
|
||||
[self updateUnreadMessage:[ChatModel unreadMessages]];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)updateUnreadMessage:(int)unreadMessage {
|
||||
- (void)update {
|
||||
[self updateView:[[PhoneMainView instance] currentView]];
|
||||
if([LinphoneManager isLcReady]) {
|
||||
[self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc])];
|
||||
} else {
|
||||
[self updateMissedCall:0];
|
||||
}
|
||||
[self updateUnreadMessage:[ChatModel unreadMessages]];
|
||||
}
|
||||
|
||||
- (void)updateUnreadMessage:(int)unreadMessage{
|
||||
if (unreadMessage > 0) {
|
||||
if([chatNotificationView isHidden]) {
|
||||
chatNotificationView.transform = CGAffineTransformIdentity;
|
||||
[self startBounceAnimation:@"Bounce" target:chatNotificationView];
|
||||
[chatNotificationView setHidden:FALSE];
|
||||
[self appearAnimation:@"Appear" target:chatNotificationView completion:^(BOOL finished){
|
||||
[self startBounceAnimation:@"Bounce" target:chatNotificationView];
|
||||
}];
|
||||
}
|
||||
[chatNotificationLabel setText:[NSString stringWithFormat:@"%i", unreadMessage]];
|
||||
} else {
|
||||
if(![chatNotificationView isHidden]) {
|
||||
[self stopBounceAnimation:@"Bounce" target:chatNotificationView];
|
||||
CGAffineTransform startCGA = [chatNotificationView transform];
|
||||
[UIView animateWithDuration:0.4
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
|
||||
animations:^{
|
||||
chatNotificationView.transform = CGAffineTransformConcat(startCGA, CGAffineTransformMakeScale(0.01f, 0.01f));
|
||||
}
|
||||
completion:^(BOOL finished){
|
||||
[chatNotificationView setHidden:TRUE];
|
||||
}
|
||||
];
|
||||
[self disappearAnimation:@"Disappear" target:chatNotificationView completion:^(BOOL finished){
|
||||
[chatNotificationView setHidden:TRUE];
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateMissedCall:(int)missedCall {
|
||||
- (void)updateMissedCall:(int)missedCall{
|
||||
if (missedCall > 0) {
|
||||
if([historyNotificationView isHidden]) {
|
||||
historyNotificationView.transform = CGAffineTransformIdentity;
|
||||
[self startBounceAnimation:@"Bounce" target:historyNotificationView];
|
||||
[historyNotificationView setHidden:FALSE];
|
||||
[self appearAnimation:@"Appear" target:historyNotificationView completion:^(BOOL finished){
|
||||
[self startBounceAnimation:@"Bounce" target:historyNotificationView];
|
||||
}];
|
||||
}
|
||||
[historyNotificationLabel setText:[NSString stringWithFormat:@"%i", missedCall]];
|
||||
} else {
|
||||
if(![historyNotificationView isHidden]) {
|
||||
[self stopBounceAnimation:@"Bounce" target:historyNotificationView];
|
||||
CGAffineTransform startCGA = [historyNotificationView transform];
|
||||
[UIView animateWithDuration:0.4
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
|
||||
animations:^{
|
||||
historyNotificationView.transform = CGAffineTransformConcat(startCGA, CGAffineTransformMakeScale(0.01f, 0.01f));
|
||||
}
|
||||
completion:^(BOOL finished){
|
||||
[self disappearAnimation:@"Disappear" target:historyNotificationView completion:^(BOOL finished){
|
||||
[historyNotificationView setHidden:TRUE];
|
||||
}
|
||||
];
|
||||
|
|
@ -172,8 +175,30 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)startBounceAnimation:(NSString *)animationID target:(UIView *)target {
|
||||
[target setTransform:CGAffineTransformMakeTranslation(0, -4)];
|
||||
- (void)appearAnimation:(NSString*)animationID target:(UIView*)target completion:(void (^)(BOOL finished))completion {
|
||||
target.transform = CGAffineTransformMakeScale(0.01f, 0.01f);
|
||||
[UIView animateWithDuration:0.4
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
|
||||
animations:^{
|
||||
target.transform = CGAffineTransformIdentity;
|
||||
}
|
||||
completion:completion];
|
||||
}
|
||||
|
||||
- (void)disappearAnimation:(NSString*)animationID target:(UIView*)target completion:(void (^)(BOOL finished))completion {
|
||||
CGAffineTransform startCGA = [target transform];
|
||||
[UIView animateWithDuration:0.4
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
|
||||
animations:^{
|
||||
target.transform = CGAffineTransformConcat(startCGA, CGAffineTransformMakeScale(0.01f, 0.01f));
|
||||
}
|
||||
completion:completion];
|
||||
}
|
||||
|
||||
- (void)startBounceAnimation:(NSString *)animationID target:(UIView *)target {
|
||||
CGAffineTransform startCGA = [target transform];
|
||||
[UIView animateWithDuration: 0.3
|
||||
delay: 0
|
||||
options: UIViewAnimationOptionRepeat |
|
||||
|
|
@ -181,7 +206,7 @@
|
|||
UIViewAnimationOptionAllowUserInteraction |
|
||||
UIViewAnimationOptionCurveEaseIn
|
||||
animations:^{
|
||||
[target setTransform:CGAffineTransformMakeTranslation(0, 4)];
|
||||
[target setTransform: CGAffineTransformConcat(startCGA, CGAffineTransformMakeTranslation(0, 8))];
|
||||
}
|
||||
completion:^(BOOL finished){
|
||||
}];
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@
|
|||
</object>
|
||||
<object class="IBUILabel" id="364959328">
|
||||
<reference key="NSNextResponder" ref="698962606"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{21, 21}</string>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{2, 2}, {17, 17}}</string>
|
||||
<reference key="NSSuperview" ref="698962606"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="617445003"/>
|
||||
|
|
@ -150,7 +150,7 @@
|
|||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{38, 5}, {21, 21}}</string>
|
||||
<string key="NSFrame">{{38, 1}, {21, 21}}</string>
|
||||
<reference key="NSSuperview" ref="1018893129"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="307047814"/>
|
||||
|
|
@ -309,10 +309,11 @@
|
|||
</object>
|
||||
<object class="IBUILabel" id="540244639">
|
||||
<reference key="NSNextResponder" ref="154031566"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{21, 21}</string>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{2, 2}, {17, 17}}</string>
|
||||
<reference key="NSSuperview" ref="154031566"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
|
|
@ -329,7 +330,7 @@
|
|||
<reference key="IBUIFont" ref="422037577"/>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{261, 5}, {21, 21}}</string>
|
||||
<string key="NSFrame">{{261, 1}, {21, 21}}</string>
|
||||
<reference key="NSSuperview" ref="1018893129"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="651674302"/>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
self.direction = [NSNumber numberWithInt:sqlite3_column_int(sqlStatement, 3)];
|
||||
self.message = [NSString stringWithUTF8String: (const char*) sqlite3_column_text(sqlStatement, 4)];
|
||||
self.time = [NSDate dateWithTimeIntervalSince1970:sqlite3_column_int(sqlStatement, 5)];
|
||||
self.read = [NSDate dateWithTimeIntervalSince1970:sqlite3_column_int(sqlStatement, 6)];
|
||||
self.read = [NSNumber numberWithInt:sqlite3_column_int(sqlStatement, 6)];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
@ -80,6 +80,12 @@
|
|||
[LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
sqlite3_finalize(sqlStatement);
|
||||
}
|
||||
|
||||
if([self chatId] != nil) {
|
||||
[self->chatId release];
|
||||
}
|
||||
self->chatId = [[NSNumber alloc] initWithInt:sqlite3_last_insert_rowid(database)];
|
||||
sqlite3_finalize(sqlStatement);
|
||||
}
|
||||
|
||||
+ (ChatModel*)read:(NSNumber*)chatId {
|
||||
|
|
@ -89,8 +95,8 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
const char *sql = [[NSString stringWithFormat:@"SELECT id, localContact, remoteContact, direction, message, time, read FROM chat WHERE id=%@",
|
||||
chatId] UTF8String];
|
||||
const char *sql = [[NSString stringWithFormat:@"SELECT id, localContact, remoteContact, direction, message, time, read FROM chat WHERE id=%i",
|
||||
[chatId intValue]] UTF8String];
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -118,8 +124,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const char *sql = [[NSString stringWithFormat:@"UPDATE chat SET localContact=\"%@\", remoteContact=\"%@\", direction=%i, message=\"%@\", time=%f, read=%i WHERE id=%@",
|
||||
localContact, remoteContact, [direction intValue], message, [time timeIntervalSince1970], read, [chatId intValue]] UTF8String];
|
||||
const char *sql = [[NSString stringWithFormat:@"UPDATE chat SET localContact=\"%@\", remoteContact=\"%@\", direction=%i, message=\"%@\", time=%f, read=%i WHERE id=%i",
|
||||
localContact, remoteContact, [direction intValue], message, [time timeIntervalSince1970], [read intValue], [chatId intValue]] UTF8String];
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -142,8 +148,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const char *sql = [[NSString stringWithFormat:@"DELETE FROM chat WHERE id=%@",
|
||||
chatId] UTF8String];
|
||||
const char *sql = [[NSString stringWithFormat:@"DELETE FROM chat WHERE id=%i",
|
||||
[chatId intValue]] UTF8String];
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -201,7 +207,7 @@
|
|||
return array;
|
||||
}
|
||||
|
||||
const char *sql = [[NSString stringWithFormat:@"SELECT id, localContact, remoteContact, direction, message, time, read FROM chat WHERE remoteContact=\"%@\" ORDER BY time DESC",
|
||||
const char *sql = [[NSString stringWithFormat:@"SELECT id, localContact, remoteContact, direction, message, time, read FROM chat WHERE remoteContact=\"%@\" ORDER BY time ASC",
|
||||
contact] UTF8String];
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <AudioToolbox/AudioServices.h>
|
||||
|
||||
#import "PhoneMainView.h"
|
||||
#import "Utils.h"
|
||||
|
|
@ -108,6 +109,10 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {
|
||||
[mainViewController viewWillAppear:NO];
|
||||
}
|
||||
|
||||
// Set observers
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(callUpdate:)
|
||||
|
|
@ -117,7 +122,10 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
selector:@selector(registrationUpdate:)
|
||||
name:@"LinphoneRegistrationUpdate"
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(textReceived:)
|
||||
name:@"LinphoneTextReceived"
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(batteryLevelChanged:)
|
||||
name:UIDeviceBatteryLevelDidChangeNotification
|
||||
|
|
@ -127,6 +135,10 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {
|
||||
[mainViewController viewWillDisappear:NO];
|
||||
}
|
||||
|
||||
// Remove observers
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:@"LinphoneCallUpdate"
|
||||
|
|
@ -134,11 +146,28 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:@"LinphoneRegistrationUpdate"
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:@"LinphoneTextReceived"
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIDeviceBatteryLevelDidChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {
|
||||
[mainViewController viewDidAppear:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {
|
||||
[mainViewController viewDidDisappear:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[super viewDidUnload];
|
||||
|
||||
|
|
@ -149,6 +178,13 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
|
||||
#pragma mark - Event Functions
|
||||
|
||||
- (void)textReceived:(NSNotification*)notif {
|
||||
ChatModel *chat = [[notif userInfo] objectForKey:@"chat"];
|
||||
if(chat != nil) {
|
||||
[self displayMessage:chat];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registrationUpdate:(NSNotification*)notif {
|
||||
LinphoneRegistrationState state = [[notif.userInfo objectForKey: @"state"] intValue];
|
||||
LinphoneProxyConfig *cfg = [[notif.userInfo objectForKey: @"cfg"] pointerValue];
|
||||
|
|
@ -396,40 +432,89 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
}
|
||||
|
||||
- (void)dismissIncomingCall:(LinphoneCall*)call {
|
||||
//cancel local notification, just in case
|
||||
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]
|
||||
&& [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
|
||||
// cancel local notif if needed
|
||||
[[UIApplication sharedApplication] cancelAllLocalNotifications];
|
||||
}
|
||||
}
|
||||
LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call);
|
||||
|
||||
if(appData != nil && appData->notification != nil) {
|
||||
// cancel local notif if needed
|
||||
[[UIApplication sharedApplication] cancelLocalNotification:appData->notification];
|
||||
[appData->notification release];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - ActionSheet Functions
|
||||
|
||||
- (void)displayIncomingCall:(LinphoneCall*) call{
|
||||
|
||||
const char* userNameChars=linphone_address_get_username(linphone_call_get_remote_address(call));
|
||||
NSString* userName = userNameChars?[[[NSString alloc] initWithUTF8String:userNameChars] autorelease]:NSLocalizedString(@"Unknown",nil);
|
||||
const char* displayNameChars = linphone_address_get_display_name(linphone_call_get_remote_address(call));
|
||||
NSString* displayName = [displayNameChars?[[NSString alloc] initWithUTF8String:displayNameChars]:@"" autorelease];
|
||||
|
||||
//TODO
|
||||
//[mMainScreenWithVideoPreview showPreview:NO];
|
||||
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]
|
||||
- (void)displayMessage:(ChatModel*)chat {
|
||||
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]
|
||||
&& [UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
|
||||
|
||||
NSString* address = [chat remoteContact];
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:address];
|
||||
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(contact) {
|
||||
address = [FastAddressBook getContactDisplayName:contact];
|
||||
}
|
||||
if(address == nil) {
|
||||
address = @"Unknown";
|
||||
}
|
||||
|
||||
// Create a new notification
|
||||
UILocalNotification* notif = [[[UILocalNotification alloc] init] autorelease];
|
||||
if (notif)
|
||||
{
|
||||
if (notif) {
|
||||
notif.repeatInterval = 0;
|
||||
notif.alertBody =[NSString stringWithFormat:NSLocalizedString(@" %@ is calling you",nil),[displayName length]>0?displayName:userName];
|
||||
notif.alertAction = @"Answer";
|
||||
notif.soundName = @"oldphone-mono-30s.caf";
|
||||
NSData *callData = [NSData dataWithBytes:&call length:sizeof(call)];
|
||||
notif.userInfo = [NSDictionary dictionaryWithObject:callData forKey:@"call"];
|
||||
notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"%@ sent you a message",nil), address];
|
||||
notif.alertAction = NSLocalizedString(@"Show", nil);
|
||||
notif.soundName = UILocalNotificationDefaultSoundName;
|
||||
notif.userInfo = [NSDictionary dictionaryWithObject:[chat remoteContact] forKey:@"chat"];
|
||||
|
||||
[[UIApplication sharedApplication] presentLocalNotificationNow:notif];
|
||||
[[UIApplication sharedApplication] presentLocalNotificationNow:notif];
|
||||
}
|
||||
} else {
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)displayIncomingCall:(LinphoneCall*) call{
|
||||
LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call);
|
||||
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]
|
||||
&& [UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
|
||||
|
||||
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
|
||||
NSString* address = nil;
|
||||
if(addr != NULL) {
|
||||
BOOL useLinphoneAddress = true;
|
||||
// contact name
|
||||
const char* lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if(lAddress) {
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]];
|
||||
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(contact) {
|
||||
address = [FastAddressBook getContactDisplayName:contact];
|
||||
useLinphoneAddress = false;
|
||||
}
|
||||
}
|
||||
if(useLinphoneAddress) {
|
||||
const char* lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char* lUserName = linphone_address_get_username(addr);
|
||||
if (lDisplayName)
|
||||
address = [NSString stringWithUTF8String:lDisplayName];
|
||||
else if(lUserName)
|
||||
address = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
}
|
||||
if(address == nil) {
|
||||
address = @"Unknown";
|
||||
}
|
||||
|
||||
// Create a new notification
|
||||
appData->notification = [[UILocalNotification alloc] init];
|
||||
if (appData->notification) {
|
||||
appData->notification.repeatInterval = 0;
|
||||
appData->notification.alertBody =[NSString stringWithFormat:NSLocalizedString(@" %@ is calling you",nil), address];
|
||||
appData->notification.alertAction = NSLocalizedString(@"Answer", nil);
|
||||
appData->notification.soundName = @"oldphone-mono-30s.caf";
|
||||
appData->notification.userInfo = [NSDictionary dictionaryWithObject:[NSData dataWithBytes:&call length:sizeof(call)] forKey:@"call"];
|
||||
|
||||
[[UIApplication sharedApplication] presentLocalNotificationNow:appData->notification];
|
||||
}
|
||||
} else {
|
||||
IncomingCallViewController *controller = [[IncomingCallViewController alloc] init];
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
<string key="NSFrameSize">{320, 460}</string>
|
||||
<reference key="NSSuperview" ref="891400674"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
|
|
@ -62,11 +61,8 @@
|
|||
<reference key="NSNextKeyView" ref="130212555"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MSAwLjI4MzE1ODM3MjYgMC4wNTY3ODY4OTE2MQA</bytes>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
|
|
@ -132,7 +128,6 @@
|
|||
<reference ref="130212555"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">root</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">208</int>
|
||||
|
|
@ -276,7 +271,7 @@
|
|||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="NS.key.0">background.png</string>
|
||||
<string key="NS.object.0">{16, 16}</string>
|
||||
<string key="NS.object.0">{640, 523}</string>
|
||||
</object>
|
||||
<string key="IBCocoaTouchPluginVersion">1181</string>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -531,10 +531,6 @@
|
|||
D3C6526E15AC228A0092A874 /* contact_ok_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3C6526A15AC228A0092A874 /* contact_ok_over.png */; };
|
||||
D3C714B3159DB84400705B8E /* toy-mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = D3C714B2159DB84400705B8E /* toy-mono.wav */; };
|
||||
D3C714B4159DB84400705B8E /* toy-mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = D3C714B2159DB84400705B8E /* toy-mono.wav */; };
|
||||
D3D14E7715A70EE30074A527 /* UIChatRoomHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D14E7515A70EE20074A527 /* UIChatRoomHeader.m */; };
|
||||
D3D14E7815A70EE30074A527 /* UIChatRoomHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D14E7515A70EE20074A527 /* UIChatRoomHeader.m */; };
|
||||
D3D14E7915A70EE30074A527 /* UIChatRoomHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3D14E7615A70EE30074A527 /* UIChatRoomHeader.xib */; };
|
||||
D3D14E7A15A70EE30074A527 /* UIChatRoomHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3D14E7615A70EE30074A527 /* UIChatRoomHeader.xib */; };
|
||||
D3D14E7C15A711700074A527 /* avatar_shadow_small.png in Resources */ = {isa = PBXBuildFile; fileRef = D3D14E7B15A711700074A527 /* avatar_shadow_small.png */; };
|
||||
D3D14E7D15A711700074A527 /* avatar_shadow_small.png in Resources */ = {isa = PBXBuildFile; fileRef = D3D14E7B15A711700074A527 /* avatar_shadow_small.png */; };
|
||||
D3D6A39E159B0EEF005F692C /* add_call_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3D6A39B159B0EEF005F692C /* add_call_default.png */; };
|
||||
|
|
@ -1334,9 +1330,6 @@
|
|||
D3C6526915AC228A0092A874 /* contact_ok_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contact_ok_default.png; path = Resources/contact_ok_default.png; sourceTree = "<group>"; };
|
||||
D3C6526A15AC228A0092A874 /* contact_ok_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contact_ok_over.png; path = Resources/contact_ok_over.png; sourceTree = "<group>"; };
|
||||
D3C714B2159DB84400705B8E /* toy-mono.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "toy-mono.wav"; path = "Resources/toy-mono.wav"; sourceTree = "<group>"; };
|
||||
D3D14E7415A70EE20074A527 /* UIChatRoomHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIChatRoomHeader.h; sourceTree = "<group>"; };
|
||||
D3D14E7515A70EE20074A527 /* UIChatRoomHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIChatRoomHeader.m; sourceTree = "<group>"; };
|
||||
D3D14E7615A70EE30074A527 /* UIChatRoomHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIChatRoomHeader.xib; sourceTree = "<group>"; };
|
||||
D3D14E7B15A711700074A527 /* avatar_shadow_small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = avatar_shadow_small.png; path = Resources/avatar_shadow_small.png; sourceTree = "<group>"; };
|
||||
D3D6A39B159B0EEF005F692C /* add_call_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = add_call_default.png; path = Resources/add_call_default.png; sourceTree = "<group>"; };
|
||||
D3D6A39C159B0EEF005F692C /* add_call_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = add_call_disabled.png; path = Resources/add_call_disabled.png; sourceTree = "<group>"; };
|
||||
|
|
@ -1881,9 +1874,6 @@
|
|||
D3A8BB6E15A6C7D500F96BE5 /* UIChatRoomCell.h */,
|
||||
D3A8BB6F15A6C7D500F96BE5 /* UIChatRoomCell.m */,
|
||||
D3A8BB7315A6C81A00F96BE5 /* UIChatRoomCell.xib */,
|
||||
D3D14E7415A70EE20074A527 /* UIChatRoomHeader.h */,
|
||||
D3D14E7515A70EE20074A527 /* UIChatRoomHeader.m */,
|
||||
D3D14E7615A70EE30074A527 /* UIChatRoomHeader.xib */,
|
||||
D31B4B1E159876C0002E6C72 /* UICompositeViewController.h */,
|
||||
D31B4B1F159876C0002E6C72 /* UICompositeViewController.m */,
|
||||
D31B4B20159876C0002E6C72 /* UICompositeViewController.xib */,
|
||||
|
|
@ -2798,7 +2788,6 @@
|
|||
D3A8BB8315A6CC3200F96BE5 /* setup_start_disabled.png in Resources */,
|
||||
D389363915A6D53200A3A3AA /* chat_bubble_incoming.9.png in Resources */,
|
||||
D389363B15A6D53200A3A3AA /* chat_bubble_outgoing.9.png in Resources */,
|
||||
D3D14E7915A70EE30074A527 /* UIChatRoomHeader.xib in Resources */,
|
||||
D3D14E7C15A711700074A527 /* avatar_shadow_small.png in Resources */,
|
||||
D3128FE315AABC7E00A2147A /* ContactDetailsViewController.xib in Resources */,
|
||||
D3128FEF15AABE4E00A2147A /* contact_back_default.png in Resources */,
|
||||
|
|
@ -3049,7 +3038,6 @@
|
|||
D3A8BB8415A6CC3200F96BE5 /* setup_start_disabled.png in Resources */,
|
||||
D389363A15A6D53200A3A3AA /* chat_bubble_incoming.9.png in Resources */,
|
||||
D389363C15A6D53200A3A3AA /* chat_bubble_outgoing.9.png in Resources */,
|
||||
D3D14E7A15A70EE30074A527 /* UIChatRoomHeader.xib in Resources */,
|
||||
D3D14E7D15A711700074A527 /* avatar_shadow_small.png in Resources */,
|
||||
D3128FE415AABC7E00A2147A /* ContactDetailsViewController.xib in Resources */,
|
||||
D3128FF015AABE4E00A2147A /* contact_back_default.png in Resources */,
|
||||
|
|
@ -3165,7 +3153,6 @@
|
|||
D3A8BB7015A6C7D500F96BE5 /* UIChatRoomCell.m in Sources */,
|
||||
D389362615A6D19800A3A3AA /* CPAnimationSequence.m in Sources */,
|
||||
D389362815A6D19800A3A3AA /* CPAnimationStep.m in Sources */,
|
||||
D3D14E7715A70EE30074A527 /* UIChatRoomHeader.m in Sources */,
|
||||
D3128FE115AABC7E00A2147A /* ContactDetailsViewController.m in Sources */,
|
||||
D37C639515AADDAF009D0BAC /* UIContactDetailsHeader.m in Sources */,
|
||||
D37C639B15AADEF6009D0BAC /* ContactDetailsTableViewController.m in Sources */,
|
||||
|
|
@ -3255,7 +3242,6 @@
|
|||
D3A8BB7115A6C7D500F96BE5 /* UIChatRoomCell.m in Sources */,
|
||||
D389362715A6D19800A3A3AA /* CPAnimationSequence.m in Sources */,
|
||||
D389362915A6D19800A3A3AA /* CPAnimationStep.m in Sources */,
|
||||
D3D14E7815A70EE30074A527 /* UIChatRoomHeader.m in Sources */,
|
||||
D3128FE215AABC7E00A2147A /* ContactDetailsViewController.m in Sources */,
|
||||
D37C639615AADDAF009D0BAC /* UIContactDetailsHeader.m in Sources */,
|
||||
D37C639C15AADEF6009D0BAC /* ContactDetailsTableViewController.m in Sources */,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue