From eca3ad72785abf9de6ebbd21b7e0dafe5b9d784c Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 20 Nov 2019 11:13:47 +0100 Subject: [PATCH] Widgets permission: Some cleaning --- Riot/Modules/Integrations/Widgets/WidgetViewController.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Integrations/Widgets/WidgetViewController.m b/Riot/Modules/Integrations/Widgets/WidgetViewController.m index b0f062ac8..4ded0d177 100644 --- a/Riot/Modules/Integrations/Widgets/WidgetViewController.m +++ b/Riot/Modules/Integrations/Widgets/WidgetViewController.m @@ -35,6 +35,8 @@ NSString *const kJavascriptSendResponseToPostMessageAPI = @"riotIOS.sendResponse - (instancetype)initWithUrl:(NSString*)widgetUrl forWidget:(Widget*)theWidget { + // The opening of the url is delayed in viewWillAppear where we will check + // the widget permission self = [super initWithURL:nil]; if (self) { @@ -59,9 +61,9 @@ NSString *const kJavascriptSendResponseToPostMessageAPI = @"riotIOS.sendResponse } } -- (void)viewDidAppear:(BOOL)animated +- (void)viewWillAppear:(BOOL)animated { - [super viewDidAppear:animated]; + [super viewWillAppear:animated]; // Check widget permission before opening the widget [self checkWidgetPermissionWithCompletion:^(BOOL granted) {