mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 00:02:47 +00:00
commit
321eff5f39
3 changed files with 60 additions and 15 deletions
|
@ -26,7 +26,14 @@
|
||||||
|
|
||||||
#import <AudioToolbox/AudioToolbox.h>
|
#import <AudioToolbox/AudioToolbox.h>
|
||||||
|
|
||||||
|
#define MX_CALL_STACK_OPENWEBRTC
|
||||||
|
#ifdef MX_CALL_STACK_OPENWEBRTC
|
||||||
#import <MatrixOpenWebRTCWrapper/MatrixOpenWebRTCWrapper.h>
|
#import <MatrixOpenWebRTCWrapper/MatrixOpenWebRTCWrapper.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MX_CALL_STACK_ENDPOINT
|
||||||
|
#import <MatrixEndpointWrapper/MatrixEndpointWrapper.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAKE_STRING(x) #x
|
#define MAKE_STRING(x) #x
|
||||||
#define MAKE_NS_STRING(x) @MAKE_STRING(x)
|
#define MAKE_NS_STRING(x) @MAKE_STRING(x)
|
||||||
|
@ -530,11 +537,25 @@
|
||||||
// Use MXFileStore as MXStore to permanently store events.
|
// Use MXFileStore as MXStore to permanently store events.
|
||||||
accountManager.storeClass = [MXFileStore class];
|
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.
|
// Observers have been defined, we start now a matrix session for each enabled accounts.
|
||||||
[accountManager openSessionForActiveAccounts];
|
[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
|
// Check whether we're already logged in
|
||||||
NSArray *mxAccounts = accountManager.accounts;
|
NSArray *mxAccounts = accountManager.accounts;
|
||||||
|
@ -580,6 +601,17 @@
|
||||||
|
|
||||||
// Clear cache
|
// Clear cache
|
||||||
[MXKMediaManager clearCache];
|
[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
|
// Logout all matrix account
|
||||||
[[MXKAccountManager sharedManager] logout];
|
[[MXKAccountManager sharedManager] logout];
|
||||||
|
|
|
@ -86,13 +86,7 @@
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if (currentRoomViewController)
|
[self closeSelectedRoom];
|
||||||
{
|
|
||||||
[currentRoomViewController destroy];
|
|
||||||
currentRoomViewController = nil;
|
|
||||||
}
|
|
||||||
selectedRoomId = nil;
|
|
||||||
selectedRoomSession = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)destroy
|
- (void)destroy
|
||||||
|
@ -153,7 +147,6 @@
|
||||||
selectedRoomSession = nil;
|
selectedRoomSession = nil;
|
||||||
|
|
||||||
if (markAllAsReadAlert)
|
if (markAllAsReadAlert)
|
||||||
|
|
||||||
{
|
{
|
||||||
[markAllAsReadAlert dismiss:NO];
|
[markAllAsReadAlert dismiss:NO];
|
||||||
markAllAsReadAlert = nil;
|
markAllAsReadAlert = nil;
|
||||||
|
@ -211,7 +204,14 @@
|
||||||
|
|
||||||
if (currentRoomViewController)
|
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 destroy];
|
||||||
currentRoomViewController = nil;
|
currentRoomViewController = nil;
|
||||||
}
|
}
|
||||||
|
@ -333,9 +333,17 @@
|
||||||
|
|
||||||
if ([controller isKindOfClass:[RoomViewController class]])
|
if ([controller isKindOfClass:[RoomViewController class]])
|
||||||
{
|
{
|
||||||
// Release potential Room ViewController
|
// Release existing Room view controller (if any)
|
||||||
if (currentRoomViewController)
|
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 destroy];
|
||||||
currentRoomViewController = nil;
|
currentRoomViewController = nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,6 @@
|
||||||
|
|
||||||
- (IBAction)onButtonPressed:(id)sender
|
- (IBAction)onButtonPressed:(id)sender
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sender == allEventsSwitch)
|
if (sender == allEventsSwitch)
|
||||||
{
|
{
|
||||||
_settings.showAllEventsInRoomHistory = allEventsSwitch.on;
|
_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:UIControlStateNormal];
|
||||||
[logoutBtnCell.mxkButton setTitle:NSLocalizedStringFromTable(@"account_logout_all", @"MatrixConsole", nil) forState:UIControlStateHighlighted];
|
[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];
|
[logoutBtnCell.mxkButton addTarget:self action:@selector(logout:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
cell = logoutBtnCell;
|
cell = logoutBtnCell;
|
||||||
|
@ -483,7 +484,9 @@
|
||||||
[clearCacheBtnCell.mxkButton setTitle:btnTitle forState:UIControlStateHighlighted];
|
[clearCacheBtnCell.mxkButton setTitle:btnTitle forState:UIControlStateHighlighted];
|
||||||
|
|
||||||
clearCacheButton = clearCacheBtnCell.mxkButton;
|
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;
|
cell = clearCacheBtnCell;
|
||||||
}
|
}
|
||||||
|
@ -500,6 +503,8 @@
|
||||||
maxCacheSizeCell.mxkSlider.value = self.currentMaxCachesSize;
|
maxCacheSizeCell.mxkSlider.value = self.currentMaxCachesSize;
|
||||||
|
|
||||||
[self onSliderValueChange:maxCacheSizeCell.mxkSlider];
|
[self onSliderValueChange:maxCacheSizeCell.mxkSlider];
|
||||||
|
|
||||||
|
[maxCacheSizeCell.mxkSlider addTarget:self action:@selector(onSliderValueChange:) forControlEvents:UIControlEventValueChanged];
|
||||||
cell = maxCacheSizeCell;
|
cell = maxCacheSizeCell;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue