crash of id and setConversationCheckAll

Signed-off-by: zhouhongli2023 <zhouhongli5@huawei.com>
This commit is contained in:
zhouhongli2023 2024-09-10 17:30:26 +08:00
parent 102d4b088a
commit 0c373210af
3 changed files with 30 additions and 16 deletions

View File

@ -1340,8 +1340,12 @@ export default class ConversationController {
return;
}
if (initData.telephone == telephone) {
if (initData.id == undefined || initData.id == null) {
return;
try {
if (initData.id == undefined || initData.id == null) {
return;
}
} catch(err) {
HiLog.e(TAG, 'this initData.id is undefined ' + JSON.stringify(err));
}
return initData.id;
}

View File

@ -136,6 +136,7 @@ export default class ConversationListController {
delItem: number;
// conversation list adapters
conversationListDataSource: ConversationListDataSource = new ConversationListDataSource();
private checkedStatus: Set<number> = new Set<number>();
static getInstance() {
if (ConversationCtrl == null) {
@ -211,20 +212,29 @@ export default class ConversationListController {
}
// Touch and hold a list to display the selection and deletion functions.
conversationLongPress(index) {
// Check whether the left slide button exists. If yes, the button cannot be clicked.
if (this.messageList[index].isDelShow) {
return;
conversationLongPress(index : number) {
if (this.messageList[index]) {
// Check whether the left slide button exists. If yes, the button cannot be clicked.
if (this.messageList[index]?.isDelShow != null && this.messageList[index].isDelShow) {
return;
}
// Touch and hold a list to display the selection and deletion functions.
HiLog.i(TAG, 'conversationLongPress, index: ' + index);
let oldStates = this.messageList[index].isCbChecked;
if (this.isMultipleSelectState) {
this.messageList[index].isCbChecked = !this.messageList[index].isCbChecked;
} else {
this.messageList[index].isCbChecked = true;
this.isMultipleSelectState = true;
}
if (this.messageList[index].isCbChecked != oldStates && this.messageList[index].isCbChecked == true) {
this.conversationSelectedNumber = 1;
this.checkedStatus.clear();
this.checkedStatus.add(index);
}
this.conversationListDataSource.notifyDataChange(index);
this.setConversationCheckAll(common.int.CHECKBOX_SELECT_UNKNOWN);
}
// Touch and hold a list to display the selection and deletion functions.
HiLog.i(TAG, 'conversationLongPress, index: ' + index);
if (this.isMultipleSelectState) {
this.messageList[index].isCbChecked = !this.messageList[index].isCbChecked;
} else {
this.isMultipleSelectState = true;
this.messageList[index].isCbChecked = true;
}
this.setConversationCheckAll(common.int.CHECKBOX_SELECT_UNKNOWN);
}
setConversationCheckAll(selectType) {

View File

@ -114,7 +114,7 @@ export default class NotificationService {
text: message.text
},
},
wantAgent: '',
wantAgent: undefined,
slotType: Notification.SlotType.OTHER_TYPES,
deliveryTime: new Date().getTime(),
groupName: 'MMS'