mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Add discourage view when server doesn't support threads
This commit is contained in:
parent
8a687396df
commit
9348e11dc8
1 changed files with 49 additions and 3 deletions
|
@ -187,7 +187,8 @@ SingleImagePickerPresenterDelegate,
|
|||
SettingsDiscoveryTableViewSectionDelegate, SettingsDiscoveryViewModelCoordinatorDelegate,
|
||||
SettingsIdentityServerCoordinatorBridgePresenterDelegate,
|
||||
ServiceTermsModalCoordinatorBridgePresenterDelegate,
|
||||
TableViewSectionsDelegate>
|
||||
TableViewSectionsDelegate,
|
||||
ThreadsBetaCoordinatorBridgePresenterDelegate>
|
||||
{
|
||||
// Current alert (if any).
|
||||
__weak UIAlertController *currentAlert;
|
||||
|
@ -288,6 +289,8 @@ TableViewSectionsDelegate>
|
|||
|
||||
@property (nonatomic, strong) UserInteractiveAuthenticationService *userInteractiveAuthenticationService;
|
||||
|
||||
@property (nonatomic, strong) ThreadsBetaCoordinatorBridgePresenter *threadsBetaBridgePresenter;
|
||||
|
||||
/**
|
||||
Whether or not to check for contacts access after the user accepts the service terms. The value of this property is
|
||||
set automatically when calling `prepareIdentityServiceAndPresentTermsWithSession:checkingAccessForContactsOnAccept`
|
||||
|
@ -3254,8 +3257,31 @@ TableViewSectionsDelegate>
|
|||
|
||||
- (void)toggleEnableThreads:(UISwitch *)sender
|
||||
{
|
||||
RiotSettings.shared.enableThreads = sender.isOn;
|
||||
MXSDKOptions.sharedInstance.enableThreads = sender.isOn;
|
||||
if (sender.isOn && !self.mainSession.store.supportedMatrixVersions.supportsThreads)
|
||||
{
|
||||
// user wants to turn on the threads setting but the server does not support it
|
||||
if (self.threadsBetaBridgePresenter)
|
||||
{
|
||||
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:nil];
|
||||
self.threadsBetaBridgePresenter = nil;
|
||||
}
|
||||
|
||||
self.threadsBetaBridgePresenter = [[ThreadsBetaCoordinatorBridgePresenter alloc] initWithThreadId:@""
|
||||
infoText:VectorL10n.threadsDiscourageInformation1
|
||||
additionalText:VectorL10n.threadsDiscourageInformation2];
|
||||
self.threadsBetaBridgePresenter.delegate = self;
|
||||
|
||||
[self.threadsBetaBridgePresenter presentFrom:self.presentedViewController?:self animated:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
[self enableThreads:sender.isOn];
|
||||
}
|
||||
|
||||
- (void)enableThreads:(BOOL)enable
|
||||
{
|
||||
RiotSettings.shared.enableThreads = enable;
|
||||
MXSDKOptions.sharedInstance.enableThreads = enable;
|
||||
[[MXKRoomDataSourceManager sharedManagerForMatrixSession:self.mainSession] reset];
|
||||
[[AppDelegate theDelegate] restoreEmptyDetailsViewController];
|
||||
}
|
||||
|
@ -4724,4 +4750,24 @@ TableViewSectionsDelegate>
|
|||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - ThreadsBetaCoordinatorBridgePresenterDelegate
|
||||
|
||||
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapEnable:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter
|
||||
{
|
||||
MXWeakify(self);
|
||||
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:^{
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self enableThreads:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapCancel:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter
|
||||
{
|
||||
MXWeakify(self);
|
||||
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:^{
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self updateSections];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue