!97 截屏事件回调

Merge pull request !97 from david/master
This commit is contained in:
openharmony_ci
2025-06-18 01:04:41 +00:00
committed by Gitee
2 changed files with 7 additions and 3 deletions
+3 -3
View File
@@ -4,9 +4,9 @@
{
"name": "default",
"signingConfig": "release",
"compileSdkVersion": 18,
"compatibleSdkVersion": 18,
"targetSdkVersion": 18,
"compileSdkVersion": 20,
"compatibleSdkVersion": 20,
"targetSdkVersion": 20,
"runtimeOS": "OpenHarmony",
}
],
@@ -39,6 +39,7 @@ export class ScreenShotModel {
async shotScreen() {
Log.showInfo(TAG, 'shotScreen');
WindowMar.notifyScreenshotEvent(WindowMar.ScreenshotEventType.SYSTEM_SCREENSHOT);
await new Promise<number>((resolve) => setTimeout(resolve, CREATE_WINDOW_DELAY));
ScreenshotManager.save().then(async (data) => {
Log.showInfo(TAG, `ScreenshotManager.save data:${JSON.stringify(data)}`);
@@ -49,8 +50,11 @@ export class ScreenShotModel {
format: 'image/jpeg',
quality: OPTIONS_QUALITY,
});
} else {
WindowMar.notifyScreenshotEvent(WindowMar.ScreenshotEventType.SYSTEM_SCREENSHOT_ABORT);
}
}).catch((err: BusinessError) => {
WindowMar.notifyScreenshotEvent(WindowMar.ScreenshotEventType.SYSTEM_SCREENSHOT);
Log.showInfo(TAG, `ScreenshotManager.save err:${JSON.stringify(err)}`);
});
}