mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-10-04 00:14:26 +00:00
fix: AIAgentService getContext(this) 改为外部传入,Index 添加 aboutToDisappear 释放 display 监听
- AIAgentService: 添加 appContext 字段,构造函数接收 Context 参数 - ChatPage: 创建 AIAgentService 时传入 getContext(this) - Index: 添加 displayCallback 字段和 aboutToDisappear 释放监听
This commit is contained in:
@ -8,11 +8,18 @@ import { ImmersiveTabNavigation } from '../components/ImmersiveTabNavigation';
|
||||
struct Index {
|
||||
@State currentIndex: number = 0;
|
||||
private db: GraphDatabase = new GraphDatabase();
|
||||
private displayCallback?: (data: display.Display) => void;
|
||||
|
||||
aboutToAppear() {
|
||||
this.db.init(getContext(this));
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
if (this.displayCallback) {
|
||||
display.off('change', this.displayCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@Builder
|
||||
tabContentBuilder() {
|
||||
Column() {
|
||||
|
||||
Reference in New Issue
Block a user