HarmonyOSBaseLibs/src/main/ets/ContextConfig.ets
徐勤民 699de803ec refactor(app): 优化登录页面和对话框逻辑
- 修改登录页面布局,增加 SafeView 组件
- 优化用户不存在时的提示对话框
- 调整未签名批次视图的加载逻辑
- 重构 ToolsHelper 中的对话框显示逻辑
- 修改 API 配置的 showLog属性
2025-04-29 18:03:54 +08:00

39 行
1.1 KiB
Plaintext

/*
* Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
*/
import type common from '@ohos.app.ability.common';
import { WindowHelper } from './utils/WindowHelper';
declare namespace globalThis {
let _brushEngineContext: common.UIAbilityContext;
let _uiUIContext: UIContext[];
};
export class GlobalContext {
static getContext(): common.UIAbilityContext {
return globalThis._brushEngineContext;
}
static setContext(context: common.UIAbilityContext): void {
globalThis._brushEngineContext = context;
WindowHelper.windowClass = context.windowStage.getMainWindowSync()
}
static pushUIContext(context: UIContext): void {
if (!globalThis._uiUIContext) {
globalThis._uiUIContext = []
}
globalThis._uiUIContext.push(context);
}
static popUIContext(): void {
globalThis._uiUIContext.splice(globalThis._uiUIContext.length-1,1)
}
static getUiContext(): UIContext|undefined {
if (globalThis._uiUIContext === undefined) {
return undefined;
}
return globalThis._uiUIContext[globalThis._uiUIContext.length-1];
}
}