From c76e7f3fcd32a62f06f4fc2e27d2f9610f55d382 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 21 May 2019 15:41:05 +0200 Subject: [PATCH 1/6] MOBILE-3039 message: Fix menu items shown after delete conversation --- src/addon/messages/pages/discussion/discussion.html | 4 ++-- src/addon/messages/pages/discussion/discussion.ts | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/addon/messages/pages/discussion/discussion.html b/src/addon/messages/pages/discussion/discussion.html index a3b2cee6f..8363436b7 100644 --- a/src/addon/messages/pages/discussion/discussion.html +++ b/src/addon/messages/pages/discussion/discussion.html @@ -17,8 +17,8 @@ - - + + diff --git a/src/addon/messages/pages/discussion/discussion.ts b/src/addon/messages/pages/discussion/discussion.ts index 853494ce1..1b0036998 100644 --- a/src/addon/messages/pages/discussion/discussion.ts +++ b/src/addon/messages/pages/discussion/discussion.ts @@ -1253,8 +1253,6 @@ export class AddonMessagesDiscussionPage implements OnDestroy { action: 'delete' }, this.siteId); - this.conversationId = undefined; - this.conversation = undefined; this.messages = []; }).finally(() => { this.deleteIcon = 'trash'; From 455b78d98f3cff1fbe50d4f6cbd5725f81197b7b Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 22 May 2019 09:07:04 +0200 Subject: [PATCH 2/6] MOBILE-3039 core: Wait a bit before displaying loading modal --- src/core/course/providers/default-format.ts | 5 ++++- src/providers/utils/dom.ts | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/core/course/providers/default-format.ts b/src/core/course/providers/default-format.ts index b445158a9..e03341376 100644 --- a/src/core/course/providers/default-format.ts +++ b/src/core/course/providers/default-format.ts @@ -167,7 +167,10 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { Object.assign(params, { course: course }); if (navCtrl) { - return navCtrl.push('CoreCourseSectionPage', params); + // Don't return the .push promise, we don't want to display a loading modal during the page transition. + navCtrl.push('CoreCourseSectionPage', params); + + return Promise.resolve(); } else { // Open the course in the "phantom" tab. this.loginHelper = this.loginHelper || this.injector.get(CoreLoginHelperProvider); diff --git a/src/providers/utils/dom.ts b/src/providers/utils/dom.ts index 1af9102c2..4f4fdab17 100644 --- a/src/providers/utils/dom.ts +++ b/src/providers/utils/dom.ts @@ -1250,11 +1250,14 @@ export class CoreDomUtilsProvider { content: text }), dismiss = loader.dismiss.bind(loader); - let isDismissed = false; + let isPresented = false, + isDismissed = false; // Override dismiss to prevent dismissing a modal twice (it can throw an error and cause problems). loader.dismiss = (data, role, navOptions): Promise => { - if (isDismissed) { + if (!isPresented || isDismissed) { + isDismissed = true; + return Promise.resolve(); } @@ -1263,7 +1266,13 @@ export class CoreDomUtilsProvider { return dismiss(data, role, navOptions); }; - loader.present(); + // Wait a bit before presenting the modal, to prevent it being displayed if dissmiss is called fast. + setTimeout(() => { + if (!isDismissed) { + isPresented = true; + loader.present(); + } + }, 40); return loader; } From 7d90773578ccf6e98776e1cf7f0386098efd5f83 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 22 May 2019 12:55:04 +0200 Subject: [PATCH 3/6] MOBILE-3039 ios: Make status bar not overlay content --- src/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.json b/src/config.json index 57216340b..7ad4f4a2b 100644 --- a/src/config.json +++ b/src/config.json @@ -75,8 +75,8 @@ "notificoncolor": "#f98012", "statusbarbg": false, "statusbarlighttext": false, - "statusbarbgios": false, - "statusbarlighttextios": false, + "statusbarbgios": "#f98012", + "statusbarlighttextios": true, "statusbarbgandroid": "#df7310", "statusbarlighttextandroid": true, "statusbarbgremotetheme": "#000000", From cc6b44db5d6eb13fdd20115b2fa5537dfbabca57 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 22 May 2019 12:55:34 +0200 Subject: [PATCH 4/6] MOBILE-3039 core: Don't hide left tabs when keyboard is opened --- src/app/app.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/app.scss b/src/app/app.scss index 5d129a009..1c9b9a924 100644 --- a/src/app/app.scss +++ b/src/app/app.scss @@ -1010,7 +1010,7 @@ body.keyboard-is-open { } } - core-ion-tabs .tabbar { + core-ion-tabs[tabsplacement="bottom"] .tabbar { display: none; } } From 6324e3edf0b7500acbc8168415779c686548994c Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 23 May 2019 12:59:52 +0200 Subject: [PATCH 5/6] MOBILE-3039 ios: Fix handling URL scheme in iOS --- src/providers/urlschemes.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/providers/urlschemes.ts b/src/providers/urlschemes.ts index 214a925c4..6617e627e 100644 --- a/src/providers/urlschemes.ts +++ b/src/providers/urlschemes.ts @@ -82,6 +82,7 @@ export interface CoreCustomURLSchemesParams { @Injectable() export class CoreCustomURLSchemesProvider { protected logger; + protected lastUrls = {}; constructor(logger: CoreLoggerProvider, private appProvider: CoreAppProvider, private utils: CoreUtilsProvider, private loginHelper: CoreLoginHelperProvider, private linksHelper: CoreContentLinksHelperProvider, @@ -107,6 +108,15 @@ export class CoreCustomURLSchemesProvider { isSSOToken = false, data: CoreCustomURLSchemesParams; + /* First check that this URL hasn't been treated a few seconds ago. The function that handles custom URL schemes already + does this, but this function is called from other places so we need to handle it in here too. */ + if (this.lastUrls[url] && Date.now() - this.lastUrls[url] < 3000) { + // Function called more than once, stop. + return; + } + + this.lastUrls[url] = Date.now(); + // Wait for app to be ready. return this.initDelegate.ready().then(() => { url = this.textUtils.decodeURIComponent(url); @@ -115,6 +125,10 @@ export class CoreCustomURLSchemesProvider { // Some sites add a # at the end of the URL. If it's there, remove it. url = url.replace(/\/?#?\/?$/, ''); + // In iOS, the protocol after the scheme doesn't have ":". Add it. + // E.g. "moodlemobile://https://..." is received as "moodlemobile://https//..." + url = url.replace(/\/\/(https?)\/\//, '//$1://'); + modal = this.domUtils.showModalLoading(); // Get the data from the URL. @@ -268,7 +282,9 @@ export class CoreCustomURLSchemesProvider { }); }).catch((error) => { - if (error && isSSOToken) { + if (error == 'Duplicated') { + // Duplicated request + } else if (error && isSSOToken) { // An error occurred, display the error and logout the user. this.loginHelper.treatUserTokenError(data.siteUrl, error); this.sitesProvider.logout(); @@ -426,7 +442,7 @@ export class CoreCustomURLSchemesProvider { if (this.appProvider.isSSOAuthenticationOngoing()) { // Authentication ongoing, probably duplicated request. - return Promise.reject(null); + return Promise.reject('Duplicated'); } if (this.appProvider.isDesktop()) { @@ -452,7 +468,7 @@ export class CoreCustomURLSchemesProvider { // Error decoding the parameter. this.logger.error('Error decoding parameter received for login SSO'); - return null; + return Promise.reject(null); } return this.loginHelper.validateBrowserSSOLogin(url); From ecc18974a33c7512ab061f5ec699e41839496779 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 23 May 2019 13:09:44 +0200 Subject: [PATCH 6/6] MOBILE-3039 core: Fix avatars in choose site page --- src/core/contentlinks/pages/choose-site/choose-site.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/contentlinks/pages/choose-site/choose-site.html b/src/core/contentlinks/pages/choose-site/choose-site.html index 9124e5e7c..c6a401175 100644 --- a/src/core/contentlinks/pages/choose-site/choose-site.html +++ b/src/core/contentlinks/pages/choose-site/choose-site.html @@ -10,10 +10,12 @@

{{ 'core.contentlinks.chooseaccounttoopenlink' | translate }}

{{ url }}

- - + + + {{ 'core.pictureof' | translate:{$a: site.fullname} }} +

{{site.fullName}}

-

+

{{site.siteUrl}}