mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 23:18:27 +02:00
Merge pull request #5293 from vector-im/langleyd/5292_refresh_tokens
App: Refresh Tokens Implementation
This commit is contained in:
@@ -81,8 +81,11 @@
|
||||
|
||||
NSMutableArray *cellData = [NSMutableArray array];
|
||||
|
||||
MXRestClient *mxRestClient = [[MXRestClient alloc] initWithCredentials:self.credentials andOnUnrecognizedCertificateBlock:nil andPersistentTokenDataHandler:^(void (^handler)(NSArray<MXCredentials *> *credentials, void (^completion)(BOOL didUpdateCredentials))) {
|
||||
[[MXKAccountManager sharedManager] readAndWriteCredentials:handler];
|
||||
} andUnauthenticatedHandler:nil];
|
||||
// Add a fake matrix session to each room summary to provide it a REST client (used to handle correctly the room avatar).
|
||||
MXSession *session = [[MXSession alloc] initWithMatrixRestClient:[[MXRestClient alloc] initWithCredentials:self.credentials andOnUnrecognizedCertificateBlock:nil]];
|
||||
MXSession *session = [[MXSession alloc] initWithMatrixRestClient:mxRestClient];
|
||||
|
||||
for (id<MXRoomSummaryProtocol> summary in summaries)
|
||||
{
|
||||
|
||||
@@ -78,7 +78,14 @@
|
||||
|
||||
- (void)shareViewController:(ShareViewController *)shareViewController didRequestShareForRoomIdentifiers:(NSSet<NSString *> *)roomIdentifiers
|
||||
{
|
||||
MXSession *session = [[MXSession alloc] initWithMatrixRestClient:[[MXRestClient alloc] initWithCredentials:self.userAccount.mxCredentials andOnUnrecognizedCertificateBlock:nil]];
|
||||
MXWeakify(self);
|
||||
MXRestClient *restClient = [[MXRestClient alloc] initWithCredentials:self.userAccount.mxCredentials andOnUnrecognizedCertificateBlock:nil andPersistentTokenDataHandler:^(void (^handler)(NSArray<MXCredentials *> *credentials, void (^completion)(BOOL didUpdateCredentials))) {
|
||||
[[MXKAccountManager sharedManager] readAndWriteCredentials:handler];
|
||||
} andUnauthenticatedHandler:^(MXError *error, BOOL isSoftLogout, BOOL isRefreshTokenAuth, void (^completion)(void)) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self.userAccount handleUnauthenticatedWithError:error isSoftLogout:isSoftLogout isRefreshTokenAuth:isRefreshTokenAuth andCompletion:completion];
|
||||
}];
|
||||
MXSession *session = [[MXSession alloc] initWithMatrixRestClient:restClient];
|
||||
[MXFileStore setPreloadOptions:0];
|
||||
|
||||
MXWeakify(session);
|
||||
@@ -147,7 +154,7 @@
|
||||
- (void)checkUserAccount
|
||||
{
|
||||
// Force account manager to reload account from the local storage.
|
||||
[[MXKAccountManager sharedManager] forceReloadAccounts];
|
||||
[MXKAccountManager sharedManagerWithReload:YES];
|
||||
|
||||
if (self.userAccount)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user