修复CustomDialogController内存泄漏问题

Signed-off-by: 赵鹏 <2645604041@qq.com>
This commit is contained in:
赵鹏
2023-12-19 19:51:26 +08:00
parent f84debab3d
commit eeaf105a11
5 changed files with 55 additions and 0 deletions
@@ -135,6 +135,11 @@ export struct NoteAndCreateComp {
customStyle: true,
})
aboutToDisappear() {
this.folderCreateDialogCtl = null
this.folderCreateDialogCtlBottom = null
}
onCreateConfirm(color: string, name: string) {
let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1
this.AllFolderArray.push(folderData)
@@ -209,6 +214,16 @@ struct FolderItemComp {
autoCancel: false,
customStyle: true,
})
aboutToDisappear() {
this.folderEditDialogCtl = null
this.folderEditDialogCtlBottom = null
this.folderDeleteDialogCtl = null
this.folderDeleteDialogCtlBottom = null
this.folderCreateDialogCtl = null
this.folderCreateDialogCtlBottom = null
}
// Folder Edit Callback
onEditConfirm(color: string, name: string) {
this.folderItem.color = color
@@ -269,6 +269,10 @@ export struct ToolBarComp {
customStyle: true,
})
aboutToDisappear() {
this.editContentDialogCtl = null
}
confirm(excuteJs: string) {
this.controllerShow.runJavaScript(excuteJs)
}
@@ -453,6 +457,10 @@ export struct NoteContentOverViewComp {
customStyle: true,
})
aboutToDisappear() {
this.editTitleDialogCtl = null
}
confirm(newTitle: string) {
this.selectedNoteData.title = newTitle
this.selectedNoteData.modified_time = new Date().getTime()
@@ -365,6 +365,10 @@ export struct NoteContentOverViewComp {
this.NoteDataMoveArray.push(this.AllFolderArray[1]);
}
aboutToDisappear() {
this.editTitleDialogCtl = null
}
confirm(newTitle: string) {
this.selectedNoteData.title = newTitle
this.selectedNoteData.modified_time = new Date().getTime()
@@ -489,6 +493,11 @@ export struct ToolBarComp {
})
@Consume('AsideWidth') asideWidth: number
aboutToDisappear() {
this.noteDataDeleteDialogCtl = null
this.editContentDialogCtl = null
}
onDeleteConfirm() {
if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) {
this.selectedNoteData.is_deleted = Delete.Yes
@@ -345,6 +345,7 @@ export struct NoteContentCompPortrait {
clearInterval(time_id)
NoteUtil.refreshAll()
LogUtil.info(TAG, "aboutToDisappear")
this.editContentDialogCtl = null
}
}
@@ -371,6 +372,10 @@ export struct NoteContentOverViewComp {
this.NoteDataMoveArray.push(this.AllFolderArray[1]);
}
aboutToDisappear() {
this.editTitleDialogCtl = null
}
confirm(newTitle: string) {
this.selectedNoteData.title = newTitle
this.selectedNoteData.modified_time = new Date().getTime()
@@ -501,6 +506,10 @@ export struct ToolBarComp {
customStyle: true,
})
aboutToDisappear() {
this.noteDataDeleteDialogCtl = null
}
build() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
@@ -637,6 +646,10 @@ export struct DeleteNoteComp {
customStyle: true,
})
aboutToDisappear() {
this.noteDataDeleteDialogCtlBottom = null
}
onDeleteConfirm() {
if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) {
this.selectedNoteData.is_deleted = Delete.Yes
@@ -657,6 +657,11 @@ export struct OperateNoteComp {
customStyle: true,
})
aboutToDisappear() {
this.noteDataMoveDialogCtl = null
this.noteDataDeleteDialogCtl = null
}
onMoveConfirm(folderUuid: string) {
this.CheckedNoteArray.forEach((noteItem) => {
noteItem.folder_uuid = folderUuid
@@ -965,6 +970,11 @@ export struct OperateNoteCompForPortrait {
customStyle: true,
})
aboutToDisappear() {
this.noteDataMoveDialogCtlBottom = null
this.noteDataDeleteDialogCtlBottom = null
}
opacityChange() {
if (this.CheckedNoteArray.length == 0 && this.longpress == true) {
this.greyOpacity = true