Widgets: Display an error if the IM is disabled

#2843
This commit is contained in:
manuroe
2019-11-21 16:36:08 +01:00
parent 25eb1cbae2
commit aafc8e3acb
5 changed files with 48 additions and 2 deletions
@@ -69,15 +69,22 @@ NSString *const kIntegrationManagerAddIntegrationScreen = @"add_integ";
operation = nil;
}
- (void)viewDidLoad
- (void)viewWillAppear:(BOOL)animated
{
[super viewDidLoad];
[super viewWillAppear:animated];
[self loadData];
}
- (void)loadData
{
RiotSharedSettings *sharedSettings = [[RiotSharedSettings alloc] initWithSession:mxSession];
if (!sharedSettings.hasIntegrationProvisioningEnabled)
{
[self showDisabledIntegrationManagerError];
return;
}
if (!self.URL && !operation)
{
[self startActivityIndicator];
@@ -706,6 +713,24 @@ NSString *const kIntegrationManagerAddIntegrationScreen = @"add_integ";
}
#pragma mark - Disabled Integrations
- (void)showDisabledIntegrationManagerError
{
NSString *message = NSLocalizedStringFromTable(@"widget_integration_manager_disabled", @"Vector", nil);
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self withdrawViewControllerAnimated:YES completion:nil];
}]];
[self presentViewController:alert animated:YES completion:nil];
}
#pragma mark - Service terms
- (void)presentTerms