MOBILE-4680 chore: Fix some jsdocs

main
Pau Ferrer Ocaña 2024-12-19 13:05:04 +01:00
parent 6af98407c1
commit ae1c719f19
5 changed files with 11 additions and 33 deletions

View File

@ -268,7 +268,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* *
* @param component Component name. * @param component Component name.
* @param componentId Component id. * @param componentId Component id.
* @returns Promise resolved when the entries are deleted.
*/ */
async deleteComponentFromCache(component: string, componentId?: number): Promise<void> { async deleteComponentFromCache(component: string, componentId?: number): Promise<void> {
if (!component) { if (!component) {
@ -284,7 +283,7 @@ export class CoreSite extends CoreAuthenticatedSite {
await this.cacheTable.delete(params); await this.cacheTable.delete(params);
} }
/* /**
* Uploads a file using Cordova File API. * Uploads a file using Cordova File API.
* *
* @param filePath File path. * @param filePath File path.
@ -366,13 +365,17 @@ export class CoreSite extends CoreAuthenticatedSite {
* @param url The url to be fixed. * @param url The url to be fixed.
* @returns Promise resolved with the fixed URL. * @returns Promise resolved with the fixed URL.
*/ */
checkAndFixPluginfileURL(url: string): Promise<string> { async checkAndFixPluginfileURL(url: string): Promise<string> {
return this.checkTokenPluginFile(url).then(() => this.fixPluginfileURL(url)); // Resolve the checking promise to make sure it's finished.
await this.checkTokenPluginFile(url);
// The previous promise (tokenPluginFileWorks) result will be used here.
return this.fixPluginfileURL(url);
} }
/** /**
* Generic function for adding the wstoken to Moodle urls and for pointing to the correct script. * Generic function for adding the wstoken to Moodle urls and for pointing to the correct script.
* Uses CoreUtilsProvider.fixPluginfileURL, passing site's token. * Uses CoreUrl.fixPluginfileURL, passing site's token.
* *
* @param url The url to be fixed. * @param url The url to be fixed.
* @returns Fixed URL. * @returns Fixed URL.
@ -386,8 +389,6 @@ export class CoreSite extends CoreAuthenticatedSite {
/** /**
* Deletes site's DB. * Deletes site's DB.
*
* @returns Promise to be resolved when the DB is deleted.
*/ */
async deleteDB(): Promise<void> { async deleteDB(): Promise<void> {
await CoreDB.deleteDB('Site-' + this.id); await CoreDB.deleteDB('Site-' + this.id);
@ -395,8 +396,6 @@ export class CoreSite extends CoreAuthenticatedSite {
/** /**
* Deletes site's folder. * Deletes site's folder.
*
* @returns Promise to be resolved when the DB is deleted.
*/ */
async deleteFolder(): Promise<void> { async deleteFolder(): Promise<void> {
if (!CoreFile.isAvailable() || !this.id) { if (!CoreFile.isAvailable() || !this.id) {
@ -466,7 +465,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* @param url The URL to open. * @param url The URL to open.
* @param alertMessage If defined, an alert will be shown before opening the browser. * @param alertMessage If defined, an alert will be shown before opening the browser.
* @param options Other options. * @param options Other options.
* @returns Promise resolved when done, rejected otherwise.
*/ */
async openInBrowserWithAutoLogin( async openInBrowserWithAutoLogin(
url: string, url: string,
@ -598,8 +596,6 @@ export class CoreSite extends CoreAuthenticatedSite {
/** /**
* Invalidates config WS call. * Invalidates config WS call.
*
* @returns Promise resolved when the data is invalidated.
*/ */
async invalidateConfig(): Promise<void> { async invalidateConfig(): Promise<void> {
await this.invalidateWsCacheForKey(this.getConfigCacheKey()); await this.invalidateWsCacheForKey(this.getConfigCacheKey());
@ -728,7 +724,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* Deletes a site setting. * Deletes a site setting.
* *
* @param name The config name. * @param name The config name.
* @returns Promise resolved when done.
*/ */
async deleteSiteConfig(name: string): Promise<void> { async deleteSiteConfig(name: string): Promise<void> {
await this.configTable.deleteByPrimaryKey({ name }); await this.configTable.deleteByPrimaryKey({ name });
@ -760,13 +755,12 @@ export class CoreSite extends CoreAuthenticatedSite {
* *
* @param name The config name. * @param name The config name.
* @param value The config value. Can only store number or strings. * @param value The config value. Can only store number or strings.
* @returns Promise resolved when done.
*/ */
async setLocalSiteConfig(name: string, value: number | string): Promise<void> { async setLocalSiteConfig(name: string, value: number | string): Promise<void> {
await this.configTable.insert({ name, value }); await this.configTable.insert({ name, value });
} }
/* /**
* Check if tokenpluginfile script works in the site. * Check if tokenpluginfile script works in the site.
* *
* @param url URL to check. * @param url URL to check.
@ -802,7 +796,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* Deletes last viewed records based on some conditions. * Deletes last viewed records based on some conditions.
* *
* @param conditions Conditions. * @param conditions Conditions.
* @returns Promise resolved when done.
*/ */
async deleteLastViewed(conditions?: Partial<CoreSiteLastViewedDBRecord>): Promise<void> { async deleteLastViewed(conditions?: Partial<CoreSiteLastViewedDBRecord>): Promise<void> {
await this.lastViewedTable.delete(conditions); await this.lastViewedTable.delete(conditions);
@ -853,7 +846,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* @param id ID. * @param id ID.
* @param value Last viewed item value. * @param value Last viewed item value.
* @param options Options. * @param options Options.
* @returns Promise resolved when done.
*/ */
async storeLastViewed( async storeLastViewed(
component: string, component: string,

View File

@ -151,7 +151,6 @@ export class CoreLoginHelperProvider {
* @param service The service to use. If not defined, core service will be used. * @param service The service to use. If not defined, core service will be used.
* @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used. * @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used.
* @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page. * @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page.
* @returns Promise resolved when done or if user cancelled.
* @deprecated since 4.3. Use openBrowserForSSOLogin instead. * @deprecated since 4.3. Use openBrowserForSSOLogin instead.
*/ */
async confirmAndOpenBrowserForSSOLogin( async confirmAndOpenBrowserForSSOLogin(
@ -393,7 +392,7 @@ export class CoreLoginHelperProvider {
siteConfig.identityproviders.forEach((provider) => { siteConfig.identityproviders.forEach((provider) => {
const urlParams = CoreUrl.extractUrlParams(provider.url); const urlParams = CoreUrl.extractUrlParams(provider.url);
if (provider.url && (provider.url.indexOf(httpsUrl) != -1 || provider.url.indexOf(httpUrl) != -1) && if (provider.url && (provider.url.indexOf(httpsUrl) !== -1 || provider.url.indexOf(httpUrl) !== -1) &&
!site.isFeatureDisabled(IDENTITY_PROVIDER_FEATURE_NAME_PREFIX + urlParams.id)) { !site.isFeatureDisabled(IDENTITY_PROVIDER_FEATURE_NAME_PREFIX + urlParams.id)) {
validProviders.push(provider); validProviders.push(provider);
} }
@ -409,7 +408,6 @@ export class CoreLoginHelperProvider {
* *
* @param setRoot True to set the new page as root, false to add it to the stack. * @param setRoot True to set the new page as root, false to add it to the stack.
* @param showKeyboard Whether to show keyboard in the new page. Only if no fixed URL set. * @param showKeyboard Whether to show keyboard in the new page. Only if no fixed URL set.
* @returns Promise resolved when done.
*/ */
async goToAddSite(setRoot = false, showKeyboard = false): Promise<void> { async goToAddSite(setRoot = false, showKeyboard = false): Promise<void> {
if (CoreSites.isLoggedIn()) { if (CoreSites.isLoggedIn()) {
@ -462,6 +460,7 @@ export class CoreLoginHelperProvider {
* @param privateToken User's private token. * @param privateToken User's private token.
* @param oauthId OAuth ID. Only if the authentication was using an OAuth method. * @param oauthId OAuth ID. Only if the authentication was using an OAuth method.
* @returns Promise resolved when the user is authenticated with the token. * @returns Promise resolved when the user is authenticated with the token.
* @deprecated since 5.0. This is now handled by CoreCustomURLSchemes.
*/ */
handleSSOLoginAuthentication(siteUrl: string, token: string, privateToken?: string, oauthId?: number): Promise<string> { handleSSOLoginAuthentication(siteUrl: string, token: string, privateToken?: string, oauthId?: number): Promise<string> {
// Always create a new site to prevent overriding data if another user credentials were introduced. // Always create a new site to prevent overriding data if another user credentials were introduced.
@ -682,7 +681,6 @@ export class CoreLoginHelperProvider {
* *
* @param siteUrl Site URL to construct change password URL. * @param siteUrl Site URL to construct change password URL.
* @param error Error message. * @param error Error message.
* @returns Promise resolved when done.
*/ */
async openChangePassword(siteUrl: string, error: string): Promise<void> { async openChangePassword(siteUrl: string, error: string): Promise<void> {
const alert = await CoreDomUtils.showAlert(Translate.instant('core.notice'), error, undefined, 3000); const alert = await CoreDomUtils.showAlert(Translate.instant('core.notice'), error, undefined, 3000);
@ -708,7 +706,6 @@ export class CoreLoginHelperProvider {
* @param path The relative path of the URL to open. * @param path The relative path of the URL to open.
* @param alertMessage The key of the message to display before opening the in app browser. * @param alertMessage The key of the message to display before opening the in app browser.
* @param invalidateCache Whether to invalidate site's cache (e.g. when the user is forced to change password). * @param invalidateCache Whether to invalidate site's cache (e.g. when the user is forced to change password).
* @returns Promise resolved when done.
*/ */
async openInAppForEdit(siteId: string, path: string, alertMessage?: string, invalidateCache?: boolean): Promise<void> { async openInAppForEdit(siteId: string, path: string, alertMessage?: string, invalidateCache?: boolean): Promise<void> {
if (!siteId || siteId !== CoreSites.getCurrentSiteId()) { if (!siteId || siteId !== CoreSites.getCurrentSiteId()) {
@ -840,7 +837,6 @@ export class CoreLoginHelperProvider {
* Function that should be called when the session expires. Reserved for core use. * Function that should be called when the session expires. Reserved for core use.
* *
* @param data Data received by the SESSION_EXPIRED event. * @param data Data received by the SESSION_EXPIRED event.
* @returns Promise resolved when done.
*/ */
async sessionExpired(data: CoreEventSessionExpiredData & CoreEventSiteData): Promise<void> { async sessionExpired(data: CoreEventSessionExpiredData & CoreEventSiteData): Promise<void> {
const siteId = data?.siteId; const siteId = data?.siteId;
@ -1214,8 +1210,6 @@ export class CoreLoginHelperProvider {
/** /**
* Start waiting when opening a browser/IAB. * Start waiting when opening a browser/IAB.
*
* @returns Promise resolved when the app is resumed.
*/ */
async waitForBrowser(): Promise<void> { async waitForBrowser(): Promise<void> {
if (!this.waitingForBrowser) { if (!this.waitingForBrowser) {
@ -1268,8 +1262,6 @@ export class CoreLoginHelperProvider {
/** /**
* Show instructions to scan QR code. * Show instructions to scan QR code.
*
* @returns Promise resolved if the user accepts to scan QR.
*/ */
async showScanQRInstructions(): Promise<void> { async showScanQRInstructions(): Promise<void> {
const dontShowWarning = await CoreConfig.get(FAQ_QRCODE_INFO_DONE, 0); const dontShowWarning = await CoreConfig.get(FAQ_QRCODE_INFO_DONE, 0);
@ -1303,8 +1295,6 @@ export class CoreLoginHelperProvider {
/** /**
* Scan a QR code and tries to authenticate the user using custom URL scheme. * Scan a QR code and tries to authenticate the user using custom URL scheme.
*
* @returns Promise resolved when done.
*/ */
async scanQR(): Promise<void> { async scanQR(): Promise<void> {
// Scan for a QR code. // Scan for a QR code.
@ -1375,7 +1365,6 @@ export class CoreLoginHelperProvider {
* *
* @param accountsList Account list. * @param accountsList Account list.
* @param site Site to be deleted. * @param site Site to be deleted.
* @returns Resolved when done.
*/ */
async deleteAccountFromList(accountsList: CoreAccountsList, site: CoreSiteBasicInfo): Promise<void> { async deleteAccountFromList(accountsList: CoreAccountsList, site: CoreSiteBasicInfo): Promise<void> {
await CoreSites.deleteSite(site.id); await CoreSites.deleteSite(site.id);

View File

@ -1611,7 +1611,6 @@ export class CoreSitesProvider {
* @param siteId Site Id. * @param siteId Site Id.
* @param token User's new token. * @param token User's new token.
* @param privateToken User's private token. * @param privateToken User's private token.
* @returns A promise resolved when the site is updated.
*/ */
async updateSiteTokenBySiteId(siteId: string, token: string, privateToken: string = ''): Promise<void> { async updateSiteTokenBySiteId(siteId: string, token: string, privateToken: string = ''): Promise<void> {
const site = await this.getSite(siteId); const site = await this.getSite(siteId);

View File

@ -82,7 +82,6 @@ export class CoreOpener {
* *
* @param path The local path of the file to be open. * @param path The local path of the file to be open.
* @param options Options. * @param options Options.
* @returns Promise resolved when done.
*/ */
static async openFile(path: string, options: CoreOpenerOpenFileOptions = {}): Promise<void> { static async openFile(path: string, options: CoreOpenerOpenFileOptions = {}): Promise<void> {
// Convert the path to a native path if needed. // Convert the path to a native path if needed.

View File

@ -49,7 +49,6 @@ export class CoreWindow {
* *
* @param url URL to open. * @param url URL to open.
* @param name Name of the browsing context into which to load the URL. * @param name Name of the browsing context into which to load the URL.
* @returns Promise resolved when done.
*/ */
static async open(url: string, name?: string): Promise<void> { static async open(url: string, name?: string): Promise<void> {
if (CoreUrl.isLocalFileUrl(url)) { if (CoreUrl.isLocalFileUrl(url)) {