!118 【证书管理】session冲突问题修复

Merge pull request !118 from 杨海龙2023/master
This commit is contained in:
openharmony_ci 2024-08-01 09:42:21 +00:00 committed by Gitee
commit 593ae3fbf8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 22 additions and 9 deletions

View File

@ -40,11 +40,8 @@ export default class CertPickerUiExtAbility extends UIExtensionAbility {
}
let storage: LocalStorage = new LocalStorage(param);
session.loadContent('pages/picker/CertManagerSheetFa', storage);
GlobalContext.getContext().setAbilityWant(want);
GlobalContext.getContext().setSession(session);
let pwdStore = new PwdStore();
GlobalContext.getContext().setPwdStore(pwdStore);
GlobalContext.getContext().setFlag(true);
try {
session.setWindowBackgroundColor('#00000000');
} catch (err) {

View File

@ -31,9 +31,8 @@ export default class PreventScreenshotsModel {
return PreventScreenshotsModel.sInstance;
}
PreventScreenshots(flag: boolean) {
PreventScreenshots(flag: boolean, session: UIExtensionContentSession | undefined) {
let isPrivacyMode: boolean = flag;
let session: UIExtensionContentSession = GlobalContext.getContext().getSession();
if (session !== undefined) {
session.setWindowPrivacyMode(isPrivacyMode);
return;

View File

@ -35,7 +35,7 @@ struct CertPwdInput {
@State mPreventScreenshotsPresenter: PreventScreenshotsPresenter = PreventScreenshotsPresenter.getInstance();
onPageShow() {
this.mPreventScreenshotsPresenter.PreventScreenshots(true);
this.mPreventScreenshotsPresenter.PreventScreenshots(true, GlobalContext.getContext().getSession());
let uri = GlobalContext.getContext().getAbilityWant().uri;
GlobalContext.getContext().clearAbilityWantUri();
@ -51,7 +51,7 @@ struct CertPwdInput {
}
onPageHide() {
this.mPreventScreenshotsPresenter.PreventScreenshots(false);
this.mPreventScreenshotsPresenter.PreventScreenshots(false, GlobalContext.getContext().getSession());
}
build() {

View File

@ -82,7 +82,9 @@ export struct CertManagerSheetFa {
} else if (name === NavEntryKey.AUTHORIZED_APP_ENTRY) {
AuthorizedAppManagementPage()
} else if (name === NavEntryKey.CRED_PWD_INPUT_ENTRY) {
CredPwdInputPage()
CredPwdInputPage({
sheetSession: this.session
})
}
}
@ -94,7 +96,7 @@ export struct CertManagerSheetFa {
.bindSheet(true, this.buildContent(), {
height: SheetSize.FIT_CONTENT,
preferType: ['2in1', 'tablet'].includes(deviceInfo.deviceType) ? SheetType.CENTER : null,
showClose: this.stack.size() === 0,
showClose: true,
shouldDismiss: ((sheetDismiss: SheetDismiss) => {
sheetDismiss.dismiss();
this.session?.sendData({'action': 'exit'})

View File

@ -21,6 +21,9 @@ import { RouterFileVo } from '../../model/CertManagerVo/RouterInfoVo';
import { GlobalContext } from '../../common/GlobalContext';
import CmInstallPresenter from '../../presenter/CmInstallPresenter';
import PreventScreenshotsPresenter from '../../model/PreventScreenshotsModel';
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
const TAG: string = 'CredPwdInputPage: ';
export class CredPwdInputParam {
@ -43,6 +46,18 @@ export struct CredPwdInputPage {
@State isPasswordError: boolean = false;
@State passWordWarn: number = 0;
@State mPreventScreenshotsPresenter: PreventScreenshotsPresenter = PreventScreenshotsPresenter.getInstance();
private sheetSession?: UIExtensionContentSession;
onPageShow(): void {
this.mPreventScreenshotsPresenter.PreventScreenshots(true, this.sheetSession);
}
onPageHide(): void {
this.mPreventScreenshotsPresenter.PreventScreenshots(false, this.sheetSession);
}
build() {
NavDestination() {
Stack({ alignContent: Alignment.Bottom }) {