MOBILE-2302 core: Pass undefined instead of null for missing params

TypeScript does not use the default value if it receives a null
main
Dani Palou 2017-12-18 10:22:04 +01:00
parent 5dab527836
commit 86a9d0dcea
7 changed files with 11 additions and 11 deletions

View File

@ -1061,7 +1061,7 @@ export class CoreSite {
}
if (alertMessage) {
let alert = this.domUtils.showAlert('core.notice', alertMessage, null, 3000);
let alert = this.domUtils.showAlert('core.notice', alertMessage, undefined, 3000);
alert.onDidDismiss(() => {
if (inApp) {
resolve(this.utils.openInApp(url, options));

View File

@ -262,7 +262,7 @@ export class SQLiteDB {
* @return {Promise<any>} Promise resolved when done.
*/
deleteRecords(table: string, conditions?: object) : Promise<any> {
if (conditions === null) {
if (conditions === null || typeof conditions == 'undefined') {
// No conditions, delete the whole table.
return this.execute(`DELETE FROM TABLE ${table}`);
}
@ -674,10 +674,10 @@ export class SQLiteDB {
*/
normaliseLimitFromNum(limitFrom: any, limitNum: any) : number[] {
// We explicilty treat these cases as 0.
if (limitFrom === null || limitFrom === '' || limitFrom === -1) {
if (typeof limitFrom == 'undefined' || limitFrom === null || limitFrom === '' || limitFrom === -1) {
limitFrom = 0;
}
if (limitNum === null || limitNum === '' || limitNum === -1) {
if (typeof limitNum == 'undefined' || limitNum === null || limitNum === '' || limitNum === -1) {
limitNum = 0;
}

View File

@ -261,7 +261,7 @@ export class LocalNotificationsMock extends LocalNotifications {
* @returns {Promise<Array<ILocalNotification>>}
*/
getAll(): Promise<Array<ILocalNotification>> {
return Promise.resolve(this.getNotifications(null, true, true));
return Promise.resolve(this.getNotifications(undefined, true, true));
}
/**
@ -292,7 +292,7 @@ export class LocalNotificationsMock extends LocalNotifications {
* @returns {Promise<Array<ILocalNotification>>}
*/
getAllScheduled(): Promise<Array<ILocalNotification>> {
return Promise.resolve(this.getNotifications(null, true, false));
return Promise.resolve(this.getNotifications(undefined, true, false));
}
/**
@ -301,7 +301,7 @@ export class LocalNotificationsMock extends LocalNotifications {
* @returns {Promise<Array<ILocalNotification>>}
*/
getAllTriggered(): Promise<Array<ILocalNotification>> {
return Promise.resolve(this.getNotifications(null, false, true));
return Promise.resolve(this.getNotifications(undefined, false, true));
}
/**

View File

@ -71,7 +71,7 @@ export class CoreLoginEmailSignupPage {
this.usernameErrors = this.loginHelper.getErrorMessages('core.login.usernamerequired');
this.passwordErrors = this.loginHelper.getErrorMessages('core.login.passwordrequired');
this.emailErrors = this.loginHelper.getErrorMessages('core.login.missingemail');
this.email2Errors = this.loginHelper.getErrorMessages('core.login.missingemail', null, 'core.login.emailnotmatch');
this.email2Errors = this.loginHelper.getErrorMessages('core.login.missingemail', undefined, 'core.login.emailnotmatch');
this.policyErrors = this.loginHelper.getErrorMessages('core.login.policyagree');
}

View File

@ -690,7 +690,7 @@ export class CoreLoginHelperProvider {
* @param {string} error Error message.
*/
openChangePassword(siteUrl: string, error: string) : void {
let alert = this.domUtils.showAlert(this.translate.instant('core.notice'), error, null, 3000);
let alert = this.domUtils.showAlert(this.translate.instant('core.notice'), error, undefined, 3000);
alert.onDidDismiss(() => {
this.utils.openInApp(siteUrl + '/login/change_password.php');
});

View File

@ -1043,7 +1043,7 @@ export class CoreSitesProvider {
return Promise.resolve();
}
return site.getConfig(null, true);
return site.getConfig(undefined, true);
}
/**

View File

@ -712,7 +712,7 @@ export class CoreDomUtilsProvider {
}
let message = this.textUtils.decodeHTML(needsTranslate ? this.translate.instant(error) : error);
return this.showAlert(this.getErrorTitle(message), message, null, autocloseTime);
return this.showAlert(this.getErrorTitle(message), message, undefined, autocloseTime);
}
/**