forked from mirrors/linphone-iphone
99 lines
3 KiB
Objective-C
99 lines
3 KiB
Objective-C
/* ChatViewController.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 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 "ChatsListView.h"
|
|
#import "PhoneMainView.h"
|
|
|
|
#import "ChatConversationCreateView.h"
|
|
@implementation ChatsListView
|
|
|
|
#pragma mark - ViewController Functions
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
[super viewWillAppear:animated];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
selector:@selector(textReceivedEvent:)
|
|
name:kLinphoneMessageReceived
|
|
object:nil];
|
|
[_backToCallButton update];
|
|
[self setEditing:NO];
|
|
}
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated {
|
|
[super viewWillDisappear:animated];
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneMessageReceived object:nil];
|
|
}
|
|
|
|
#pragma mark - Event Functions
|
|
|
|
- (void)textReceivedEvent:(NSNotification *)notif {
|
|
[_tableController loadData];
|
|
}
|
|
|
|
#pragma mark - UICompositeViewDelegate Functions
|
|
|
|
static UICompositeViewDescription *compositeDescription = nil;
|
|
|
|
+ (UICompositeViewDescription *)compositeViewDescription {
|
|
if (compositeDescription == nil) {
|
|
compositeDescription = [[UICompositeViewDescription alloc] init:self.class
|
|
statusBar:StatusBarView.class
|
|
tabBar:TabBarView.class
|
|
sideMenu:SideMenuView.class
|
|
fullscreen:false
|
|
isLeftFragment:YES
|
|
fragmentWith:ChatConversationCreateView.class];
|
|
}
|
|
return compositeDescription;
|
|
}
|
|
|
|
- (UICompositeViewDescription *)compositeViewDescription {
|
|
return self.class.compositeViewDescription;
|
|
}
|
|
|
|
#pragma mark - Action Functions
|
|
|
|
- (IBAction)onAddClick:(id)event {
|
|
ChatConversationCreateView *view = VIEW(ChatConversationCreateView);
|
|
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:YES];
|
|
}
|
|
|
|
- (IBAction)onEditionChangeClick:(id)sender {
|
|
_addButton.hidden = self.tableController.isEditing;
|
|
[_backToCallButton update];
|
|
}
|
|
|
|
- (IBAction)onDeleteClick:(id)sender {
|
|
NSString *msg =
|
|
[NSString stringWithFormat:NSLocalizedString(@"Do you want to delete selected conversations?", nil)];
|
|
[UIConfirmationDialog ShowWithMessage:msg
|
|
cancelMessage:nil
|
|
confirmMessage:nil
|
|
onCancelClick:^() {
|
|
[self onEditionChangeClick:nil];
|
|
}
|
|
onConfirmationClick:^() {
|
|
[_tableController removeSelectionUsing:nil];
|
|
[_tableController loadData];
|
|
[self onEditionChangeClick:nil];
|
|
}];
|
|
}
|
|
|
|
@end
|