mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Merge commit '3d672a05b2a7117ade2e4e87bd2b5762063d7922' into feature/3977_merge_element_1_9_13
# Conflicts: # Config/AppVersion.xcconfig # Podfile.lock # Riot/Modules/Application/LegacyAppDelegate.m # Riot/Modules/Authentication/AuthenticationCoordinator.swift # Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift # Riot/Modules/LaunchLoading/LaunchLoadingView.swift # Riot/Modules/LaunchLoading/LaunchLoadingView.xib # Riot/Modules/MatrixKit/Models/Account/MXKAccount.m # Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellData.m # Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomTimelineCellProvider.m # Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomTimelineCellProvider.m # Riot/Modules/TabBar/MasterTabBarController.m # fastlane/Fastfile
This commit is contained in:
@@ -374,11 +374,6 @@ typedef BOOL (^MXKAccountOnCertificateChange)(MXKAccount *mxAccount, NSData *cer
|
||||
- (void)resetDeviceId;
|
||||
|
||||
#pragma mark - Sync filter
|
||||
/**
|
||||
Check if the homeserver supports room members lazy loading.
|
||||
@param completion the check result.
|
||||
*/
|
||||
- (void)supportLazyLoadOfRoomMembers:(void (^)(BOOL supportLazyLoadOfRoomMembers))completion;
|
||||
|
||||
/**
|
||||
Call this method at an appropriate time to attempt dehydrating to a new backup device
|
||||
|
||||
@@ -897,6 +897,9 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
self->mxSession = nil;
|
||||
|
||||
NSString *myUserId = self.mxSession.myUser.userId;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kMXKErrorNotification object:error userInfo:myUserId ? @{kMXKErrorUserIdKey: myUserId} : nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self->sessionStateObserver];
|
||||
self->sessionStateObserver = nil;
|
||||
|
||||
@@ -1684,6 +1687,14 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
NSString *myUserId = self.mxSession.myUser.userId;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kMXKErrorNotification object:error userInfo:myUserId ? @{kMXKErrorUserIdKey: myUserId} : nil];
|
||||
}
|
||||
|
||||
// If we cannot resolve this error by retrying, exit early
|
||||
BOOL isRetryableError = [error.domain isEqualToString:NSURLErrorDomain] || [MXHTTPOperation urlResponseFromError:error] != nil;
|
||||
if (!isRetryableError)
|
||||
{
|
||||
MXLogDebug(@"[MXKAccount] Initial sync will not be retried");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if it is a network connectivity issue
|
||||
AFNetworkReachabilityManager *networkReachabilityManager = [AFNetworkReachabilityManager sharedManager];
|
||||
@@ -1691,7 +1702,6 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
|
||||
if (networkReachabilityManager.isReachable)
|
||||
{
|
||||
// The problem is not the network
|
||||
// If we have network, we retry immediately, otherwise the server may clear any cache it has computed thus far
|
||||
[self launchInitialServerSync];
|
||||
}
|
||||
@@ -2085,14 +2095,15 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
|
||||
#pragma mark - Sync filter
|
||||
|
||||
- (void)supportLazyLoadOfRoomMembers:(void (^)(BOOL supportLazyLoadOfRoomMembers))completion
|
||||
- (void)supportLazyLoadOfRoomMembersWithMatrixVersion:(MXMatrixVersions *)matrixVersions
|
||||
completion:(void (^)(BOOL supportLazyLoadOfRoomMembers))completion
|
||||
{
|
||||
void(^onUnsupportedLazyLoadOfRoomMembers)(NSError *) = ^(NSError *error) {
|
||||
completion(NO);
|
||||
};
|
||||
|
||||
// Check if the server supports LL sync filter
|
||||
MXFilterJSONModel *filter = [self syncFilterWithLazyLoadOfRoomMembers:YES];
|
||||
MXFilterJSONModel *filter = [self syncFilterWithLazyLoadOfRoomMembers:YES supportsNotificationsForThreads:NO];
|
||||
[mxSession.store filterIdForFilter:filter success:^(NSString * _Nullable filterId) {
|
||||
|
||||
if (filterId)
|
||||
@@ -2103,8 +2114,8 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
else
|
||||
{
|
||||
// Check the Matrix versions supported by the HS
|
||||
[self.mxSession supportedMatrixVersions:^(MXMatrixVersions *matrixVersions) {
|
||||
|
||||
if (matrixVersions)
|
||||
{
|
||||
if (matrixVersions.supportLazyLoadMembers)
|
||||
{
|
||||
// The HS supports LL
|
||||
@@ -2114,8 +2125,11 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
{
|
||||
onUnsupportedLazyLoadOfRoomMembers(nil);
|
||||
}
|
||||
|
||||
} failure:onUnsupportedLazyLoadOfRoomMembers];
|
||||
}
|
||||
else
|
||||
{
|
||||
completion(NO);
|
||||
}
|
||||
}
|
||||
} failure:onUnsupportedLazyLoadOfRoomMembers];
|
||||
}
|
||||
@@ -2130,28 +2144,42 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
// Check settings
|
||||
BOOL syncWithLazyLoadOfRoomMembersSetting = [MXKAppSettings standardAppSettings].syncWithLazyLoadOfRoomMembers;
|
||||
|
||||
if (syncWithLazyLoadOfRoomMembersSetting)
|
||||
{
|
||||
// Check if the server supports LL sync filter before enabling it
|
||||
[self supportLazyLoadOfRoomMembers:^(BOOL supportLazyLoadOfRoomMembers) {
|
||||
void(^buildSyncFilter)(MXMatrixVersions *) = ^(MXMatrixVersions *matrixVersions) {
|
||||
BOOL supportsNotificationsForThreads = matrixVersions ? matrixVersions.supportsNotificationsForThreads : NO;
|
||||
|
||||
if (syncWithLazyLoadOfRoomMembersSetting)
|
||||
{
|
||||
// Check if the server supports LL sync filter before enabling it
|
||||
[self supportLazyLoadOfRoomMembersWithMatrixVersion:matrixVersions completion:^(BOOL supportLazyLoadOfRoomMembers) {
|
||||
|
||||
|
||||
if (supportLazyLoadOfRoomMembers)
|
||||
{
|
||||
completion([self syncFilterWithLazyLoadOfRoomMembers:YES]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No support from the HS
|
||||
// Disable the setting. That will avoid to make a request at every startup
|
||||
[MXKAppSettings standardAppSettings].syncWithLazyLoadOfRoomMembers = NO;
|
||||
completion([self syncFilterWithLazyLoadOfRoomMembers:NO]);
|
||||
}
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
completion([self syncFilterWithLazyLoadOfRoomMembers:NO]);
|
||||
}
|
||||
if (supportLazyLoadOfRoomMembers)
|
||||
{
|
||||
completion([self syncFilterWithLazyLoadOfRoomMembers:YES
|
||||
supportsNotificationsForThreads:supportsNotificationsForThreads]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No support from the HS
|
||||
// Disable the setting. That will avoid to make a request at every startup
|
||||
[MXKAppSettings standardAppSettings].syncWithLazyLoadOfRoomMembers = NO;
|
||||
completion([self syncFilterWithLazyLoadOfRoomMembers:NO
|
||||
supportsNotificationsForThreads:supportsNotificationsForThreads]);
|
||||
}
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
completion([self syncFilterWithLazyLoadOfRoomMembers:NO supportsNotificationsForThreads:supportsNotificationsForThreads]);
|
||||
}
|
||||
};
|
||||
|
||||
[mxSession supportedMatrixVersions:^(MXMatrixVersions *matrixVersions) {
|
||||
buildSyncFilter(matrixVersions);
|
||||
} failure:^(NSError *error) {
|
||||
MXLogWarning(@"[MXAccount] buildSyncFilter: failed to get supported versions: %@", error);
|
||||
buildSyncFilter(nil);
|
||||
}];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2160,7 +2188,7 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
@param syncWithLazyLoadOfRoomMembers enable LL support.
|
||||
@return the sync filter to use.
|
||||
*/
|
||||
- (MXFilterJSONModel *)syncFilterWithLazyLoadOfRoomMembers:(BOOL)syncWithLazyLoadOfRoomMembers
|
||||
- (MXFilterJSONModel *)syncFilterWithLazyLoadOfRoomMembers:(BOOL)syncWithLazyLoadOfRoomMembers supportsNotificationsForThreads:(BOOL)supportsNotificationsForThreads
|
||||
{
|
||||
MXFilterJSONModel *syncFilter;
|
||||
NSUInteger limit = 10;
|
||||
@@ -2195,11 +2223,11 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
|
||||
// Set that limit in the filter
|
||||
if (syncWithLazyLoadOfRoomMembers)
|
||||
{
|
||||
syncFilter = [MXFilterJSONModel syncFilterForLazyLoadingWithMessageLimit:limit];
|
||||
syncFilter = [MXFilterJSONModel syncFilterForLazyLoadingWithMessageLimit:limit unreadThreadNotifications:supportsNotificationsForThreads];
|
||||
}
|
||||
else
|
||||
{
|
||||
syncFilter = [MXFilterJSONModel syncFilterWithMessageLimit:limit];
|
||||
syncFilter = [MXFilterJSONModel syncFilterWithMessageLimit:limit unreadThreadNotifications:supportsNotificationsForThreads];
|
||||
}
|
||||
|
||||
// TODO: We could extend the filter to match other settings (self.showAllEventsInRoomHistory,
|
||||
|
||||
Reference in New Issue
Block a user