Skip to content

Commit

Permalink
MOBILE-4680 chore: Fix some jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Jan 8, 2025
1 parent 6af9840 commit ae1c719
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 33 deletions.
26 changes: 9 additions & 17 deletions src/core/classes/sites/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ export class CoreSite extends CoreAuthenticatedSite {
*
* @param component Component name.
* @param componentId Component id.
* @returns Promise resolved when the entries are deleted.
*/
async deleteComponentFromCache(component: string, componentId?: number): Promise<void> {
if (!component) {
Expand All @@ -284,7 +283,7 @@ export class CoreSite extends CoreAuthenticatedSite {
await this.cacheTable.delete(params);
}

/*
/**
* Uploads a file using Cordova File API.
*
* @param filePath File path.
Expand Down Expand Up @@ -366,13 +365,17 @@ export class CoreSite extends CoreAuthenticatedSite {
* @param url The url to be fixed.
* @returns Promise resolved with the fixed URL.
*/
checkAndFixPluginfileURL(url: string): Promise<string> {
return this.checkTokenPluginFile(url).then(() => this.fixPluginfileURL(url));
async checkAndFixPluginfileURL(url: string): Promise<string> {
// 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.
* Uses CoreUtilsProvider.fixPluginfileURL, passing site's token.
* Uses CoreUrl.fixPluginfileURL, passing site's token.
*
* @param url The url to be fixed.
* @returns Fixed URL.
Expand All @@ -386,17 +389,13 @@ export class CoreSite extends CoreAuthenticatedSite {

/**
* Deletes site's DB.
*
* @returns Promise to be resolved when the DB is deleted.
*/
async deleteDB(): Promise<void> {
await CoreDB.deleteDB('Site-' + this.id);
}

/**
* Deletes site's folder.
*
* @returns Promise to be resolved when the DB is deleted.
*/
async deleteFolder(): Promise<void> {
if (!CoreFile.isAvailable() || !this.id) {
Expand Down Expand Up @@ -466,7 +465,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* @param url The URL to open.
* @param alertMessage If defined, an alert will be shown before opening the browser.
* @param options Other options.
* @returns Promise resolved when done, rejected otherwise.
*/
async openInBrowserWithAutoLogin(
url: string,
Expand Down Expand Up @@ -598,8 +596,6 @@ export class CoreSite extends CoreAuthenticatedSite {

/**
* Invalidates config WS call.
*
* @returns Promise resolved when the data is invalidated.
*/
async invalidateConfig(): Promise<void> {
await this.invalidateWsCacheForKey(this.getConfigCacheKey());
Expand Down Expand Up @@ -728,7 +724,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* Deletes a site setting.
*
* @param name The config name.
* @returns Promise resolved when done.
*/
async deleteSiteConfig(name: string): Promise<void> {
await this.configTable.deleteByPrimaryKey({ name });
Expand Down Expand Up @@ -760,13 +755,12 @@ export class CoreSite extends CoreAuthenticatedSite {
*
* @param name The config name.
* @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> {
await this.configTable.insert({ name, value });
}

/*
/**
* Check if tokenpluginfile script works in the site.
*
* @param url URL to check.
Expand Down Expand Up @@ -802,7 +796,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* Deletes last viewed records based on some conditions.
*
* @param conditions Conditions.
* @returns Promise resolved when done.
*/
async deleteLastViewed(conditions?: Partial<CoreSiteLastViewedDBRecord>): Promise<void> {
await this.lastViewedTable.delete(conditions);
Expand Down Expand Up @@ -853,7 +846,6 @@ export class CoreSite extends CoreAuthenticatedSite {
* @param id ID.
* @param value Last viewed item value.
* @param options Options.
* @returns Promise resolved when done.
*/
async storeLastViewed(
component: string,
Expand Down
15 changes: 2 additions & 13 deletions src/core/features/login/services/login-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export class CoreLoginHelperProvider {
* @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 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.
*/
async confirmAndOpenBrowserForSSOLogin(
Expand Down Expand Up @@ -393,7 +392,7 @@ export class CoreLoginHelperProvider {
siteConfig.identityproviders.forEach((provider) => {
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)) {
validProviders.push(provider);
}
Expand All @@ -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 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> {
if (CoreSites.isLoggedIn()) {
Expand Down Expand Up @@ -462,6 +460,7 @@ export class CoreLoginHelperProvider {
* @param privateToken User's private token.
* @param oauthId OAuth ID. Only if the authentication was using an OAuth method.
* @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> {
// Always create a new site to prevent overriding data if another user credentials were introduced.
Expand Down Expand Up @@ -682,7 +681,6 @@ export class CoreLoginHelperProvider {
*
* @param siteUrl Site URL to construct change password URL.
* @param error Error message.
* @returns Promise resolved when done.
*/
async openChangePassword(siteUrl: string, error: string): Promise<void> {
const alert = await CoreDomUtils.showAlert(Translate.instant('core.notice'), error, undefined, 3000);
Expand All @@ -708,7 +706,6 @@ export class CoreLoginHelperProvider {
* @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 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> {
if (!siteId || siteId !== CoreSites.getCurrentSiteId()) {
Expand Down Expand Up @@ -840,7 +837,6 @@ export class CoreLoginHelperProvider {
* Function that should be called when the session expires. Reserved for core use.
*
* @param data Data received by the SESSION_EXPIRED event.
* @returns Promise resolved when done.
*/
async sessionExpired(data: CoreEventSessionExpiredData & CoreEventSiteData): Promise<void> {
const siteId = data?.siteId;
Expand Down Expand Up @@ -1214,8 +1210,6 @@ export class CoreLoginHelperProvider {

/**
* Start waiting when opening a browser/IAB.
*
* @returns Promise resolved when the app is resumed.
*/
async waitForBrowser(): Promise<void> {
if (!this.waitingForBrowser) {
Expand Down Expand Up @@ -1268,8 +1262,6 @@ export class CoreLoginHelperProvider {

/**
* Show instructions to scan QR code.
*
* @returns Promise resolved if the user accepts to scan QR.
*/
async showScanQRInstructions(): Promise<void> {
const dontShowWarning = await CoreConfig.get(FAQ_QRCODE_INFO_DONE, 0);
Expand Down Expand Up @@ -1303,8 +1295,6 @@ export class CoreLoginHelperProvider {

/**
* Scan a QR code and tries to authenticate the user using custom URL scheme.
*
* @returns Promise resolved when done.
*/
async scanQR(): Promise<void> {
// Scan for a QR code.
Expand Down Expand Up @@ -1375,7 +1365,6 @@ export class CoreLoginHelperProvider {
*
* @param accountsList Account list.
* @param site Site to be deleted.
* @returns Resolved when done.
*/
async deleteAccountFromList(accountsList: CoreAccountsList, site: CoreSiteBasicInfo): Promise<void> {
await CoreSites.deleteSite(site.id);
Expand Down
1 change: 0 additions & 1 deletion src/core/services/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,6 @@ export class CoreSitesProvider {
* @param siteId Site Id.
* @param token User's new 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> {
const site = await this.getSite(siteId);
Expand Down
1 change: 0 additions & 1 deletion src/core/singletons/opener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export class CoreOpener {
*
* @param path The local path of the file to be open.
* @param options Options.
* @returns Promise resolved when done.
*/
static async openFile(path: string, options: CoreOpenerOpenFileOptions = {}): Promise<void> {
// Convert the path to a native path if needed.
Expand Down
1 change: 0 additions & 1 deletion src/core/singletons/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class CoreWindow {
*
* @param url URL to open.
* @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> {
if (CoreUrl.isLocalFileUrl(url)) {
Expand Down

0 comments on commit ae1c719

Please sign in to comment.