!369 Boolean generics fix

Merge pull request !369 from Maksim Khramov/boolean-generics-fix
This commit is contained in:
openharmony_ci 2023-06-08 11:54:33 +00:00 committed by Gitee
commit 4fa9c1a139
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 10 additions and 10 deletions

View File

@ -136,7 +136,7 @@ class ScreenManager {
}
}
const cbs: CallbackType[] = this.events.get(event);
if (!Boolean(cbs).valueOf()) {
if (!new Boolean(cbs).valueOf()) {
return;
}
if (fn == null || fn == undefined) {
@ -155,7 +155,7 @@ class ScreenManager {
private emit(event, argument: Object[]): void {
let _self = this;
if (!Boolean(this.events.get(event)).valueOf()) {
if (!new Boolean(this.events.get(event)).valueOf()) {
return;
}
@ -288,10 +288,10 @@ class ScreenManager {
this.onLeftBlankChanged(data);
let barColor = await getResourceString($r('app.color.default_background_color'));
let barContentColor = await getResourceString($r('app.color.default_bar_content_color'));
if (!Boolean(barColor).valueOf()) {
if (!new Boolean(barColor).valueOf()) {
barColor = '#00FFFFFF';
}
if (!Boolean(barContentColor).valueOf()) {
if (!new Boolean(barContentColor).valueOf()) {
barContentColor = '#FF000000';
}
let systemBarProperties: window.SystemBarProperties = {

View File

@ -20,7 +20,7 @@ const TAG = "SingleInstanceHelper";
let globalThis = GlobalContext.getContext();
export function stashOrGetObject<T>(objectClass: object, storageKey: string): T {
if (!Boolean(globalThis.getObject(storageKey)).valueOf()) {
if (! new Boolean(globalThis.getObject(storageKey)).valueOf()) {
globalThis.setObject(storageKey, objectClass);
Log.debug(TAG, "Create key of " + storageKey);
}

View File

@ -74,7 +74,7 @@ export class Save {
private static async createFileAsset(item: MediaDataItem, isReplace: Boolean): Promise<MediaLib.FileAsset> | null {
let fileAsset = await item.loadFileAsset();
if (!Boolean(fileAsset).valueOf()) {
if (!new Boolean(fileAsset).valueOf()) {
Log.warn(TAG, 'get file error');
return null;
}

View File

@ -102,7 +102,7 @@ struct ThirdSelectAlbumSetPage {
if (!Number.isNaN(param.remainingOfWallpapers)) {
this.maxSelectCount = new Number(param.remainingOfWallpapers).valueOf()
}
} else if (Boolean(param.maxSelectCount).valueOf() && param.maxSelectCount > 0) {
} else if (new Boolean(param.maxSelectCount).valueOf() && param.maxSelectCount > 0) {
let selectCount = new Number(param.maxSelectCount).valueOf();
this.maxSelectCount = selectCount > Constants.LIMIT_MAX_THIRD_SELECT_COUNT
? Constants.LIMIT_MAX_THIRD_SELECT_COUNT

View File

@ -131,7 +131,7 @@ struct ThirdSelectPhotoGridPage {
this.bundleName = new String(param.bundleName).valueOf();
this.isMultiPick = new Boolean(param.isMultiPick).valueOf();
this.isFromFa = new Boolean(param.isFromFa).valueOf();
if (Boolean(param.maxSelectCount).valueOf() && param.maxSelectCount > 0) {
if (new Boolean(param.maxSelectCount).valueOf() && param.maxSelectCount > 0) {
this.maxSelectCount = 0;
if (!Number.isNaN(param.maxSelectCount)) {
this.maxSelectCount = new Number(param.maxSelectCount).valueOf()

View File

@ -73,9 +73,9 @@ export class TimelinePageBarModel {
getMenuList(isSelectedMode: boolean, selectedCount: number, isAllSelected: boolean): Action[] {
let menuList: Action[] = [];
menuList.push(Boolean(selectedCount) ? Action.SHARE : Action.SHARE_INVALID)
menuList.push(new Boolean(selectedCount) ? Action.SHARE : Action.SHARE_INVALID)
menuList.push(isAllSelected ? Action.DESELECT_ALL : Action.SELECT_ALL)
menuList.push(Boolean(selectedCount) ? Action.DELETE : Action.DELETE_INVALID, Action.MORE)
menuList.push(new Boolean(selectedCount) ? Action.DELETE : Action.DELETE_INVALID, Action.MORE)
return menuList
}
}