1.codecheck整改

Signed-off-by: zhoulisheng <635547767@qq.com>
This commit is contained in:
zhoulisheng 2023-12-13 10:34:43 +08:00
parent 70a1c0911e
commit d87cda1d15
25 changed files with 58 additions and 63 deletions

View File

@ -28,10 +28,10 @@ export default class EntryAbility extends UIAbility {
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
atManager.requestPermissionsFromUser(this.context, list, (err: BusinessError, result: Object) => { atManager.requestPermissionsFromUser(this.context, list, (err: BusinessError, result: Object) => {
if (err) { if (err) {
console.log("dodo requestPermissionsFromUserError:" + JSON.stringify(err));
} else { } else {
permissionRequestResult = result; permissionRequestResult = result;
console.log("dodo permissionRequestResult:" + JSON.stringify(permissionRequestResult))
} }
}) })

View File

@ -39,7 +39,7 @@ export default function LogUtilTest() {
}) })
it('TestLogUtilLevel',0, ()=> { it('TestLogUtilLevel',0, ()=> {
console.log("tag:LogUtil LogUtil.mLogLevel="+LogUtil.mLogLevel);
LogUtil.mLogLevel = LogUtil.OFF; LogUtil.mLogLevel = LogUtil.OFF;
expect(LogUtil.mLogLevel).assertEqual(LogUtil.OFF); expect(LogUtil.mLogLevel).assertEqual(LogUtil.OFF);

View File

@ -88,7 +88,7 @@ export default function lruCacheTest() {
expect(key).assertEqual("2") expect(key).assertEqual("2")
expect(value).assertEqual("2") expect(value).assertEqual("2")
} }
console.log('dodo count='+count+' key='+key+' value='+value)
count++; count++;
} }
memoryCache.foreachLruCache( (value:string, key:string, map:Map<string,string>)=> { memoryCache.foreachLruCache( (value:string, key:string, map:Map<string,string>)=> {
@ -117,7 +117,7 @@ export default function lruCacheTest() {
expect(key).assertEqual("1") expect(key).assertEqual("1")
expect(value).assertEqual("1") expect(value).assertEqual("1")
} }
console.log('dodo count='+count+' key='+key+' value='+value)
count++; count++;
} }
memoryCache.foreachLruCache( (value:string, key:string, map:Map<string,string>)=> { memoryCache.foreachLruCache( (value:string, key:string, map:Map<string,string>)=> {

View File

@ -360,9 +360,9 @@ export class ImageKnife {
// 执行相同key的pending队列请求 // 执行相同key的pending队列请求
private keyEqualPendingToRun(nextPending: RequestOption) { private keyEqualPendingToRun(nextPending: RequestOption) {
// let nextPending = this.pendingRequest.splice(index, 1)[0];
// this.runningRequest.push(nextPending)
// RequestManager.execute((nextPending as RequestOption), this.memoryCache, this.diskMemoryCache, this.dataFetch, this.resourceFetch)
this.pendingMaps.remove(nextPending.uuid) this.pendingMaps.remove(nextPending.uuid)
this.runningMaps.put(nextPending.uuid, nextPending); this.runningMaps.put(nextPending.uuid, nextPending);
@ -445,11 +445,11 @@ export class ImageKnife {
if (hasRunningRequest) { if (hasRunningRequest) {
this.pendingMaps.put(request.uuid, request); this.pendingMaps.put(request.uuid, request);
// this.pendingRequest.push(request);
} else { } else {
this.runningMaps.put(request.uuid, request) this.runningMaps.put(request.uuid, request)
// this.runningRequest.push(request);
// 不存在相同key的 任务可以并行 // 不存在相同key的 任务可以并行
RequestManager.execute(request, this.memoryCache, this.diskMemoryCache, this.dataFetch, this.resourceFetch) RequestManager.execute(request, this.memoryCache, this.diskMemoryCache, this.dataFetch, this.resourceFetch)
} }

View File

@ -529,11 +529,11 @@ export class RequestOption {
} }
} }
// // 加载成功之后
// let imageKnife:ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife();
// if(imageKnife != undefined) {
// imageKnife.removeRunning(this);
// }
} }
// 图片文件落盘之后会自动去寻找下一个数据加载 // 图片文件落盘之后会自动去寻找下一个数据加载

View File

@ -15,5 +15,6 @@
import { BusinessError } from '@ohos.base' import { BusinessError } from '@ohos.base'
export interface IParseImage<T> { export interface IParseImage<T> {
parseImage:(imageinfo:ArrayBuffer, onCompleteFunction:(value:T)=>void | PromiseLike<T>, onErrorFunction:(reason?:BusinessError|string)=>void)=>void; parseImage:(imageinfo:ArrayBuffer, onCompleteFunction:(value:T)=>void | PromiseLike<T>, onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
parseImageThumbnail:(scale:number, imageinfo:ArrayBuffer, onCompleteFunction:(value:T)=>void | PromiseLike<T>, onErrorFunction:(reason?:BusinessError|string)=>void)=>void; parseImageThumbnail:(scale:number, imageinfo:ArrayBuffer, onCompleteFunction:(value:T)=>void | PromiseLike<T>,
onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
} }

View File

@ -44,7 +44,6 @@ export class DownloadClient implements IDataFetch {
this.dataShareFileClient.loadData(request, onCompleteFunction, onErrorFunction) this.dataShareFileClient.loadData(request, onCompleteFunction, onErrorFunction)
} else { } else {
// 网络下载 // 网络下载
// this.networkDownloadClient.loadData(request, onCompleteFunction, onErrorFunction)
this.httpDownloadClient.loadData(request, onCompleteFunction, onErrorFunction) this.httpDownloadClient.loadData(request, onCompleteFunction, onErrorFunction)
} }
} }

View File

@ -18,5 +18,6 @@ import common from '@ohos.app.ability.common';
// 本地资源解析抽象接口 // 本地资源解析抽象接口
export interface IResourceFetch<T> { export interface IResourceFetch<T> {
loadResource:(context:common.UIAbilityContext ,res: Resource, onCompleteFunction:(value:T)=>void | PromiseLike<T>, onErrorFunction:(reason?:BusinessError|string)=>void)=>void; loadResource:(context:common.UIAbilityContext ,res: Resource, onCompleteFunction:(value:T)=>void | PromiseLike<T>,
onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
} }

View File

@ -14,13 +14,6 @@
*/ */
import { LogUtil } from '../../imageknife/utils/LogUtil' import { LogUtil } from '../../imageknife/utils/LogUtil'
// jpg = 'jpg,0,FFD8',
// png = 'png,0,89504E470D0A1A0A',
// bmp = 'bmp,0,424D',
// gif = 'gif,0,474946383961',
// svg = 'svg,0,3C3F786D6C',
// webp = 'webp,0,52494646',
// tiff = 'tiff,0,492049|49492A00|4D4D002A|4D4D002B'
export class FileTypeUtil { export class FileTypeUtil {
private fileSignatureMap: Record<string, Array<Uint8Array>> = { private fileSignatureMap: Record<string, Array<Uint8Array>> = {

View File

@ -25,7 +25,8 @@ export class ParseImageUtil implements IParseImage<PixelMap> {
} }
// scale(0,1) // scale(0,1)
parseImageThumbnail(scale: number, imageinfo: ArrayBuffer, onCompleteFunction: (value: PixelMap) => void | PromiseLike<PixelMap>, onErrorFunction: (reason?: BusinessError | string) => void) { parseImageThumbnail(scale: number, imageinfo: ArrayBuffer, onCompleteFunction: (value: PixelMap) => void | PromiseLike<PixelMap>,
onErrorFunction: (reason?: BusinessError | string) => void) {
// taskPoolExecutePixelMap(imageinfo,scale,onCompleteFunction,onErrorFunction); // taskPoolExecutePixelMap(imageinfo,scale,onCompleteFunction,onErrorFunction);
let imageSource:image.ImageSource = image.createImageSource(imageinfo); // 步骤一文件转为pixelMap 然后变换 给Image组件 let imageSource:image.ImageSource = image.createImageSource(imageinfo); // 步骤一文件转为pixelMap 然后变换 给Image组件

View File

@ -112,7 +112,7 @@ function taskPoolExecutePixelMapList(arrayBuffer: ArrayBuffer, callback: (data?:
LogUtil.log("ceshi321 : arrayBuffer长度" + arrayBuffer.byteLength) LogUtil.log("ceshi321 : arrayBuffer长度" + arrayBuffer.byteLength)
let task = new taskpool.Task(taskParseGif, arrayBuffer) let task = new taskpool.Task(taskParseGif, arrayBuffer)
taskpool.execute(task).then((imageFrames: GIFFrame[]) => { taskpool.execute(task).then((imageFrames: GIFFrame[]) => {
// LogUtil.log('ceshi321 : Succeeded in creating pixelmap Ui .' + imageFrames.getPixelBytesNumber())
callback(imageFrames,undefined) callback(imageFrames,undefined)
}).catch((err: string) => { }).catch((err: string) => {
LogUtil.log("ceshi321 : test occur error: " + err) LogUtil.log("ceshi321 : test occur error: " + err)