@@ -195,6 +195,7 @@ export class CoreSite extends CoreAuthenticatedSite {
195195 * Check if the user authenticated in the site using an OAuth method.
196196 *
197197 * @returns Whether the user authenticated in the site using an OAuth method.
198+ * @deprecated since 5.0. Use getOAuthId instead.
198199 */
199200 isOAuth ( ) : boolean {
200201 return this . oauthId != null && this . oauthId !== undefined ;
@@ -268,7 +269,6 @@ export class CoreSite extends CoreAuthenticatedSite {
268269 *
269270 * @param component Component name.
270271 * @param componentId Component id.
271- * @returns Promise resolved when the entries are deleted.
272272 */
273273 async deleteComponentFromCache ( component : string , componentId ?: number ) : Promise < void > {
274274 if ( ! component ) {
@@ -284,7 +284,7 @@ export class CoreSite extends CoreAuthenticatedSite {
284284 await this . cacheTable . delete ( params ) ;
285285 }
286286
287- /*
287+ /**
288288 * Uploads a file using Cordova File API.
289289 *
290290 * @param filePath File path.
@@ -366,13 +366,17 @@ export class CoreSite extends CoreAuthenticatedSite {
366366 * @param url The url to be fixed.
367367 * @returns Promise resolved with the fixed URL.
368368 */
369- checkAndFixPluginfileURL ( url : string ) : Promise < string > {
370- return this . checkTokenPluginFile ( url ) . then ( ( ) => this . fixPluginfileURL ( url ) ) ;
369+ async checkAndFixPluginfileURL ( url : string ) : Promise < string > {
370+ // Resolve the checking promise to make sure it's finished.
371+ await this . checkTokenPluginFile ( url ) ;
372+
373+ // The previous promise (tokenPluginFileWorks) result will be used here.
374+ return this . fixPluginfileURL ( url ) ;
371375 }
372376
373377 /**
374378 * Generic function for adding the wstoken to Moodle urls and for pointing to the correct script.
375- * Uses CoreUtilsProvider .fixPluginfileURL, passing site's token.
379+ * Uses CoreUrl .fixPluginfileURL, passing site's token.
376380 *
377381 * @param url The url to be fixed.
378382 * @returns Fixed URL.
@@ -386,17 +390,13 @@ export class CoreSite extends CoreAuthenticatedSite {
386390
387391 /**
388392 * Deletes site's DB.
389- *
390- * @returns Promise to be resolved when the DB is deleted.
391393 */
392394 async deleteDB ( ) : Promise < void > {
393395 await CoreDB . deleteDB ( 'Site-' + this . id ) ;
394396 }
395397
396398 /**
397399 * Deletes site's folder.
398- *
399- * @returns Promise to be resolved when the DB is deleted.
400400 */
401401 async deleteFolder ( ) : Promise < void > {
402402 if ( ! CoreFile . isAvailable ( ) || ! this . id ) {
@@ -466,7 +466,6 @@ export class CoreSite extends CoreAuthenticatedSite {
466466 * @param url The URL to open.
467467 * @param alertMessage If defined, an alert will be shown before opening the browser.
468468 * @param options Other options.
469- * @returns Promise resolved when done, rejected otherwise.
470469 */
471470 async openInBrowserWithAutoLogin (
472471 url : string ,
@@ -598,8 +597,6 @@ export class CoreSite extends CoreAuthenticatedSite {
598597
599598 /**
600599 * Invalidates config WS call.
601- *
602- * @returns Promise resolved when the data is invalidated.
603600 */
604601 async invalidateConfig ( ) : Promise < void > {
605602 await this . invalidateWsCacheForKey ( this . getConfigCacheKey ( ) ) ;
@@ -728,7 +725,6 @@ export class CoreSite extends CoreAuthenticatedSite {
728725 * Deletes a site setting.
729726 *
730727 * @param name The config name.
731- * @returns Promise resolved when done.
732728 */
733729 async deleteSiteConfig ( name : string ) : Promise < void > {
734730 await this . configTable . deleteByPrimaryKey ( { name } ) ;
@@ -760,13 +756,12 @@ export class CoreSite extends CoreAuthenticatedSite {
760756 *
761757 * @param name The config name.
762758 * @param value The config value. Can only store number or strings.
763- * @returns Promise resolved when done.
764759 */
765760 async setLocalSiteConfig ( name : string , value : number | string ) : Promise < void > {
766761 await this . configTable . insert ( { name, value } ) ;
767762 }
768763
769- /*
764+ /**
770765 * Check if tokenpluginfile script works in the site.
771766 *
772767 * @param url URL to check.
@@ -802,7 +797,6 @@ export class CoreSite extends CoreAuthenticatedSite {
802797 * Deletes last viewed records based on some conditions.
803798 *
804799 * @param conditions Conditions.
805- * @returns Promise resolved when done.
806800 */
807801 async deleteLastViewed ( conditions ?: Partial < CoreSiteLastViewedDBRecord > ) : Promise < void > {
808802 await this . lastViewedTable . delete ( conditions ) ;
@@ -853,7 +847,6 @@ export class CoreSite extends CoreAuthenticatedSite {
853847 * @param id ID.
854848 * @param value Last viewed item value.
855849 * @param options Options.
856- * @returns Promise resolved when done.
857850 */
858851 async storeLastViewed (
859852 component : string ,
0 commit comments