mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-23 15:10:25 +00:00
fix #8 "Use explicit types instead of undefined"
Signed-off-by: Andrey Smykov <smykov.andrei@huawei.com>
This commit is contained in:
parent
568af0fabd
commit
6fe9b87540
@ -113,7 +113,7 @@ class MediaModel {
|
||||
async deleteAll(fetchOption: MediaLib.MediaFetchOptions): Promise<void> {
|
||||
Log.info(TAG, 'deleteAll');
|
||||
startTrace('deleteAll');
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
fetchFileResult = await this.media.getFileAssets(fetchOption);
|
||||
Log.debug(TAG, "deleteAll getFileAssets");
|
||||
@ -139,7 +139,7 @@ class MediaModel {
|
||||
Log.info(TAG, 'getAllMediaItems');
|
||||
startTrace('getAllMediaItems');
|
||||
let fileAssets: MediaLib.FileAsset[] = [];
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
fetchFileResult = await this.media.getFileAssets(fetchOption);
|
||||
Log.debug(TAG, "getAllMediaItems getFileAssets:" + fetchFileResult.getCount());
|
||||
@ -163,7 +163,7 @@ class MediaModel {
|
||||
Log.info(TAG, 'getAllFavorMediaItems');
|
||||
startTrace('getAllFavorMediaItems');
|
||||
let fileAssets: MediaLib.FileAsset[] = [];
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
let getPrivateAlbumGetAllFavors = hiSysEventDataQueryTimedOut('getPrivateAlbumGetAllFavors')
|
||||
let albums = await this.media.getPrivateAlbum(MediaLib.PrivateAlbumType.TYPE_FAVORITE);
|
||||
@ -192,7 +192,7 @@ class MediaModel {
|
||||
Log.info(TAG, 'getAllTrashMediaItems');
|
||||
startTrace('getAllTrashMediaItems');
|
||||
let fileAssets: MediaLib.FileAsset[] = [];
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
let getPrivateAlbumGetAllTrashItems = hiSysEventDataQueryTimedOut('getPrivateAlbumGetAllTrashItems')
|
||||
let albums = await this.media.getPrivateAlbum(MediaLib.PrivateAlbumType.TYPE_TRASH);
|
||||
@ -231,7 +231,7 @@ class MediaModel {
|
||||
Log.info(TAG, 'getAllCommonMediaItem');
|
||||
startTrace('getAllCommonMediaItem');
|
||||
let item: MediaModelItem = new MediaModelItem();
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
fetchFileResult = await this.media.getFileAssets(fetchOption);
|
||||
Log.debug(TAG, "getAllCommonMediaItem getFileAssets");
|
||||
@ -258,7 +258,7 @@ class MediaModel {
|
||||
Log.info(TAG, 'getAllFavorMediaItem');
|
||||
startTrace('getAllFavorMediaItem');
|
||||
let item: MediaModelItem = new MediaModelItem();
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
let getPrivateAlbumGetAllFavorItem = hiSysEventDataQueryTimedOut('getPrivateAlbumGetAllFavorItem')
|
||||
let albums = await this.media.getPrivateAlbum(MediaLib.PrivateAlbumType.TYPE_FAVORITE);
|
||||
@ -290,7 +290,7 @@ class MediaModel {
|
||||
Log.info(TAG, 'getAllTrashMediaItem');
|
||||
startTrace('getAllTrashMediaItem');
|
||||
let item: MediaModelItem = new MediaModelItem();
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
let getPrivateAlbumGetAllTrashItem = hiSysEventDataQueryTimedOut('getPrivateAlbumGetAllTrashItem')
|
||||
let albums = await this.media.getPrivateAlbum(MediaLib.PrivateAlbumType.TYPE_TRASH);
|
||||
@ -322,7 +322,7 @@ class MediaModel {
|
||||
Log.info(TAG, 'getAlbumCount');
|
||||
startTrace('getAlbumCount');
|
||||
let count = 0;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
let getAlbumsGetAlbumCount = hiSysEventDataQueryTimedOut('getAlbumsGetAlbumCount')
|
||||
let albums: MediaLib.Album[] = await this.media.getAlbums(fetchOption);
|
||||
@ -380,8 +380,8 @@ class MediaModel {
|
||||
async getTrashMedia(fetchOption: MediaLib.MediaFetchOptions): Promise<MediaLib.FileAsset> {
|
||||
Log.info(TAG, 'getTrashMedia');
|
||||
startTrace('getTrashMedia');
|
||||
let fileAsset: MediaLib.FileAsset = undefined;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = undefined;
|
||||
let fileAsset: MediaLib.FileAsset = null;
|
||||
let fetchFileResult: MediaLib.FetchFileResult = null;
|
||||
try {
|
||||
let getPrivateAlbumGetTrash = hiSysEventDataQueryTimedOut('getPrivateAlbumGetTrash')
|
||||
let albums = await this.media.getPrivateAlbum(MediaLib.PrivateAlbumType.TYPE_TRASH);
|
||||
|
@ -72,8 +72,8 @@ export class AlbumsDataSource extends ItemDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
getAlbumDataItemById(id: string): AlbumDataItem {
|
||||
let albumDataItem: AlbumDataItem = undefined;
|
||||
getAlbumDataItemById(id: string): AlbumDataItem | null {
|
||||
let albumDataItem: AlbumDataItem = null;
|
||||
for (let i = 0;i < this.albumDataItems.length; i++) {
|
||||
if (this.albumDataItems[i].id == id) {
|
||||
albumDataItem = this.albumDataItems[i];
|
||||
|
@ -252,10 +252,10 @@ export struct AlbumSetPage {
|
||||
this.appBroadcast.off(BroadcastConstants.RESET_STATE_EVENT, (index: number): void => this.onStateResetBindImpl(index));
|
||||
this.appBroadcast.off(BroadcastConstants.RESET_ZERO, (pageNumber: number): void => this.onResetZeroBindImpl(pageNumber));
|
||||
mediaObserver.unregisterObserver(this.dataObserver);
|
||||
this.dataObserver = undefined;
|
||||
this.scroller = undefined;
|
||||
this.tabsController = undefined;
|
||||
this.barModel = undefined;
|
||||
this.dataObserver = null;
|
||||
this.scroller = null;
|
||||
this.tabsController = null;
|
||||
this.barModel = null;
|
||||
}
|
||||
|
||||
// Callback when the page is show.
|
||||
|
@ -82,7 +82,7 @@ struct AlbumSelect {
|
||||
} else {
|
||||
AppStorage.SetOrCreate<boolean>(Constants.APP_KEY_NEW_ALBUM, false);
|
||||
}
|
||||
let albumInfo: SimpleAlbumDataItem = undefined;
|
||||
let albumInfo: SimpleAlbumDataItem = null;
|
||||
if(param.albumInfo != null) {
|
||||
albumInfo = JSON.parse(param.albumInfo.toString());
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ export class PhotoEditorManager {
|
||||
this.editors[this.currentMode].exit();
|
||||
}
|
||||
|
||||
this.item = undefined;
|
||||
this.item = null;
|
||||
if(this.origin != null) this.origin.release();
|
||||
this.origin = undefined;
|
||||
this.historyManager.setOriginPixelMap(undefined);
|
||||
this.origin = null;
|
||||
this.historyManager.setOriginPixelMap(null);
|
||||
this.historyManager.releaseAll();
|
||||
this.currentMode = PhotoEditMode.EDIT_MODE_MAIN;
|
||||
}
|
||||
@ -98,7 +98,7 @@ export class PhotoEditorManager {
|
||||
// exit current edit mode
|
||||
if (this.editors[this.currentMode] != undefined) {
|
||||
const filter = this.editors[this.currentMode].exit();
|
||||
if (filter != undefined) {
|
||||
if (filter != null) {
|
||||
// save cache
|
||||
if (!filter.isCached()) {
|
||||
const prePixelMap = this.getLastPixelMap();
|
||||
@ -150,7 +150,7 @@ export class PhotoEditorManager {
|
||||
Log.info(this.TAG, "save enter isReplace = " + isReplace);
|
||||
this.isSaving = true;
|
||||
const filter = this.editors[this.currentMode].exit();
|
||||
if (filter != undefined) {
|
||||
if (filter != null) {
|
||||
this.historyManager.push(filter);
|
||||
}
|
||||
return await Save.save(this.item, this.historyManager, isReplace);
|
||||
|
@ -18,7 +18,7 @@ import { PixelMapWrapper } from './PixelMapWrapper'
|
||||
|
||||
export abstract class ImageFilterBase implements Releasable {
|
||||
private filterName: string;
|
||||
private cache: PixelMapWrapper = undefined;
|
||||
private cache: PixelMapWrapper = null;
|
||||
|
||||
constructor(name: string) {
|
||||
this.filterName = name;
|
||||
|
@ -99,16 +99,16 @@ export class PhotoEditCrop extends PhotoEditBase {
|
||||
this.cropShow.setMaxScaleFactor(scaleFactorW, scaleFactorH);
|
||||
}
|
||||
|
||||
exit(): ImageFilterBase {
|
||||
exit(): ImageFilterBase | null {
|
||||
Log.info(this.TAG, 'exit');
|
||||
if(this.filter != null) this.saveFinalOperation();
|
||||
this.isCropShowInitialized = false;
|
||||
this.input = undefined;
|
||||
this.input = null;
|
||||
this.clearCanvas();
|
||||
if (this.couldReset()) {
|
||||
this.clear();
|
||||
} else {
|
||||
this.filter = undefined;
|
||||
this.filter = null;
|
||||
}
|
||||
return this.filter;
|
||||
}
|
||||
@ -155,7 +155,7 @@ export class PhotoEditCrop extends PhotoEditBase {
|
||||
}
|
||||
|
||||
private refresh(): void {
|
||||
if (this.ctx != undefined && this.input != undefined) {
|
||||
if (this.ctx != undefined && this.input != null) {
|
||||
this.drawImage();
|
||||
this.drawCrop();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ struct Edit {
|
||||
|
||||
aboutToDisappear(): void {
|
||||
Log.debug(this.TAG, 'aboutToDisappear');
|
||||
this.globalThis.setObject("EditorMediaItem", undefined);
|
||||
this.globalThis.setObject("EditorMediaItem", null);
|
||||
PhotoEditorManager.getInstance().clear();
|
||||
screenManager.setNavigationBarColor('#FFF1F3F5', '#FF000000')
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ struct FormEditorPage {
|
||||
let intervalTimeKey = 'intervalTime';
|
||||
let promise: Promise<object> = dataStore.getData(intervalTimeKey, this.time);
|
||||
promise.then<void, void>((d: Object): void => {
|
||||
this.time = d as unknown as number;
|
||||
this.time = d as number;
|
||||
this.setIntervalTime();
|
||||
AppStorage.SetOrCreate<number>(Constants.FROM_PLAYBACK_INTERVAL, this.time);
|
||||
})
|
||||
|
@ -627,9 +627,9 @@ struct PhotoGridPage {
|
||||
this.appBroadcast.off(BroadcastConstants.UPDATE_DATA_SOURCE, (item: MediaDataItem): void => this.onUpdateFavorAndSelectStateBindImpl(item));
|
||||
this.appBroadcast.off(BroadcastConstants.ON_REMOTE_CHANGED, (res: string, deviceId: number): void => this.onUpdateRemoteDeviceBindImpl(res, deviceId));
|
||||
mediaObserver.unregisterObserver(this.dataObserver);
|
||||
this.dataObserver = undefined;
|
||||
this.scroller = undefined;
|
||||
this.barModel = undefined;
|
||||
this.dataObserver = null;
|
||||
this.scroller = null;
|
||||
this.barModel = null;
|
||||
}
|
||||
|
||||
build() {
|
||||
|
@ -169,7 +169,7 @@ struct ThirdSelectAlbumSetPage {
|
||||
// 从三方拉起,直接跳转到所有相册
|
||||
if (this.isFromThird) {
|
||||
let allAlbumDataItem: AlbumDataItem = this.albumsDataSource.getAlbumDataItemById(MediaConstants.ALBUM_ID_ALL);
|
||||
if (allAlbumDataItem == undefined) {
|
||||
if (allAlbumDataItem == null) {
|
||||
allAlbumDataItem = new AlbumDataItem(MediaConstants.ALBUM_ID_ALL, 0, displayName, this.filterMediaType, '');
|
||||
}
|
||||
this.jumpToAllAlbumGridPage(allAlbumDataItem);
|
||||
|
@ -80,8 +80,8 @@ export class TimelineItemDataSource extends ItemDataSource {
|
||||
return index
|
||||
}
|
||||
|
||||
getDataByIndex(index: number): DateAdded {
|
||||
let item: DateAdded = undefined;
|
||||
getDataByIndex(index: number): DateAdded | null {
|
||||
let item: DateAdded = null;
|
||||
let count = 0;
|
||||
for (let i = 0;i < this.groupItem.length; i++) {
|
||||
let groupItem: TimelineDataItem = this.groupItem[i]
|
||||
@ -102,8 +102,8 @@ export class TimelineItemDataSource extends ItemDataSource {
|
||||
return item;
|
||||
}
|
||||
|
||||
getData(index: number): LazyItem<DateAdded> {
|
||||
let item: LazyItem<DateAdded> = undefined;
|
||||
getData(index: number): LazyItem<DateAdded> | null {
|
||||
let item: LazyItem<DateAdded> = null;
|
||||
let count = 0;
|
||||
let lazyIndex = index;
|
||||
for (let i = 0;i < this.groupItem.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user