Merge pull request #2 from matrix-org/develop

Develop
This commit is contained in:
giomfo 2015-08-10 11:47:50 +02:00
commit 321eff5f39
3 changed files with 60 additions and 15 deletions

View file

@ -26,7 +26,14 @@
#import <AudioToolbox/AudioToolbox.h>
#define MX_CALL_STACK_OPENWEBRTC
#ifdef MX_CALL_STACK_OPENWEBRTC
#import <MatrixOpenWebRTCWrapper/MatrixOpenWebRTCWrapper.h>
#endif
#ifdef MX_CALL_STACK_ENDPOINT
#import <MatrixEndpointWrapper/MatrixEndpointWrapper.h>
#endif
#define MAKE_STRING(x) #x
#define MAKE_NS_STRING(x) @MAKE_STRING(x)
@ -530,11 +537,25 @@
// Use MXFileStore as MXStore to permanently store events.
accountManager.storeClass = [MXFileStore class];
// Use OpenWebRTC as call stack
accountManager.callStackClass = [MXOpenWebRTCCallStack class];
// Observers have been defined, we start now a matrix session for each enabled accounts.
[accountManager openSessionForActiveAccounts];
// Set the VoIP call stack
for (MXKAccount *account in accountManager.accounts)
{
id<MXCallStack> callStack;
#ifdef MX_CALL_STACK_OPENWEBRTC
callStack = [[MXOpenWebRTCCallStack alloc] init];
#endif
#ifdef MX_CALL_STACK_ENDPOINT
callStack = [[MXEndpointCallStack alloc] initWithMatrixId:account.mxSession.myUser.userId];
#endif
if (callStack)
{
[account.mxSession enableVoIPWithCallStack:callStack];
}
}
// Check whether we're already logged in
NSArray *mxAccounts = accountManager.accounts;
@ -580,6 +601,17 @@
// Clear cache
[MXKMediaManager clearCache];
#ifdef MX_CALL_STACK_ENDPOINT
// Erase all created certificates and private keys by MXEndpointCallStack
for (MXKAccount *account in MXKAccountManager.sharedManager.accounts)
{
if ([account.mxSession.callManager.callStack isKindOfClass:MXEndpointCallStack.class])
{
[(MXEndpointCallStack*)account.mxSession.callManager.callStack deleteData:account.mxSession.myUser.userId];
}
}
#endif
// Logout all matrix account
[[MXKAccountManager sharedManager] logout];

View file

@ -86,13 +86,7 @@
- (void)dealloc
{
if (currentRoomViewController)
{
[currentRoomViewController destroy];
currentRoomViewController = nil;
}
selectedRoomId = nil;
selectedRoomSession = nil;
[self closeSelectedRoom];
}
- (void)destroy
@ -153,7 +147,6 @@
selectedRoomSession = nil;
if (markAllAsReadAlert)
{
[markAllAsReadAlert dismiss:NO];
markAllAsReadAlert = nil;
@ -211,7 +204,14 @@
if (currentRoomViewController)
{
// Release the current selected room
if (currentRoomViewController.roomDataSource)
{
// Let the manager release this room data source
MXSession *mxSession = currentRoomViewController.roomDataSource.mxSession;
MXKRoomDataSourceManager *roomDataSourceManager = [MXKRoomDataSourceManager sharedManagerForMatrixSession:mxSession];
[roomDataSourceManager closeRoomDataSource:currentRoomViewController.roomDataSource forceClose:NO];
}
[currentRoomViewController destroy];
currentRoomViewController = nil;
}
@ -333,9 +333,17 @@
if ([controller isKindOfClass:[RoomViewController class]])
{
// Release potential Room ViewController
// Release existing Room view controller (if any)
if (currentRoomViewController)
{
if (currentRoomViewController.roomDataSource)
{
// Let the manager release this room data source
MXSession *mxSession = currentRoomViewController.roomDataSource.mxSession;
MXKRoomDataSourceManager *roomDataSourceManager = [MXKRoomDataSourceManager sharedManagerForMatrixSession:mxSession];
[roomDataSourceManager closeRoomDataSource:currentRoomViewController.roomDataSource forceClose:NO];
}
[currentRoomViewController destroy];
currentRoomViewController = nil;
}

View file

@ -238,7 +238,6 @@
- (IBAction)onButtonPressed:(id)sender
{
if (sender == allEventsSwitch)
{
_settings.showAllEventsInRoomHistory = allEventsSwitch.on;
@ -390,6 +389,8 @@
}
[logoutBtnCell.mxkButton setTitle:NSLocalizedStringFromTable(@"account_logout_all", @"MatrixConsole", nil) forState:UIControlStateNormal];
[logoutBtnCell.mxkButton setTitle:NSLocalizedStringFromTable(@"account_logout_all", @"MatrixConsole", nil) forState:UIControlStateHighlighted];
[logoutBtnCell.mxkButton removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[logoutBtnCell.mxkButton addTarget:self action:@selector(logout:) forControlEvents:UIControlEventTouchUpInside];
cell = logoutBtnCell;
@ -483,7 +484,9 @@
[clearCacheBtnCell.mxkButton setTitle:btnTitle forState:UIControlStateHighlighted];
clearCacheButton = clearCacheBtnCell.mxkButton;
[clearCacheBtnCell.mxkButton addTarget:self action:@selector(onButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[clearCacheButton removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[clearCacheButton addTarget:self action:@selector(onButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
cell = clearCacheBtnCell;
}
@ -500,6 +503,8 @@
maxCacheSizeCell.mxkSlider.value = self.currentMaxCachesSize;
[self onSliderValueChange:maxCacheSizeCell.mxkSlider];
[maxCacheSizeCell.mxkSlider addTarget:self action:@selector(onSliderValueChange:) forControlEvents:UIControlEventValueChanged];
cell = maxCacheSizeCell;
}
else