未验证 提交 73e86935 编写于 作者: O openharmony_ci 提交者: Gitee

!7132 validator中拉起弹窗的接口在最新的SDK上已被删除,为不影响后续更新,切换最新接口

Merge pull request !7132 from 田文哲/master
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
const PERMISSIONS: Array<string> = [
'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA',
'ohos.permission.CAPTURE_SCREEN']
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
this.context.requestPermissionsFromUser(PERMISSIONS)
globalThis.dir=this.context.filesDir; globalThis.dir=this.context.filesDir;
console.log("[Demo] MainAbility onCreate") console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want; globalThis.abilityWant = want;
...@@ -18,8 +13,11 @@ export default class MainAbility extends Ability { ...@@ -18,8 +13,11 @@ export default class MainAbility extends Ability {
} }
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate") console.log("[Demo] MainAbility onWindowStageCreate")
let AtManager = abilityAccessCtrl.createAtManager();
AtManager.requestPermissionsFromUser(this.context,["ohos.permission.READ_MEDIA","ohos.permission.WRITE_MEDIA",
"ohos.permission.CAPTURE_SCREEN"]).then(() => {})
windowStage.loadContent("pages/index", (err, data) => { windowStage.loadContent("pages/index", (err, data) => {
if (err.code) { if (err.code) {
......
...@@ -122,7 +122,7 @@ struct CustomContainer1 { ...@@ -122,7 +122,7 @@ struct CustomContainer1 {
await fileio.close(fd); await fileio.close(fd);
Logger.info(TAG, `write done`); Logger.info(TAG, `write done`);
prompt.showToast({ prompt.showToast({
message: '图片保存成功', duration: 1000 message: '结果保存成功', duration: 1000
}); });
} }
getScreen = (isFullScreen: boolean) => { getScreen = (isFullScreen: boolean) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册