!449 fix:修复拖动图标结束后,取消通知,数字角标未及时更新的问题

Merge pull request !449 from giteewzp/master2023121401
This commit is contained in:
openharmony_ci 2023-12-14 14:10:13 +00:00 committed by Gitee
commit 599ff1603d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 12 additions and 2 deletions

View File

@ -21,7 +21,8 @@ import {
localEventManager,
EventConstants,
CardItemInfo,
FolderData
FolderData,
BadgeManager
} from '@ohos/common';
import AppItem from './AppItem';
import FormItem from './FormItem';
@ -262,6 +263,10 @@ export default struct SwiperPage {
const dragResult = PageDesktopDragHandler.getInstance().onDragDrop(event.getWindowX(), event.getWindowY());
Log.showInfo(TAG, `onDrop dragResult: ${dragResult}`);
AppStorage.setOrCreate('selectAppIndex', null);
const dragItemInfo: LauncherDragItemInfo = AppStorage.get('dragItemInfo') as LauncherDragItemInfo;
if (dragItemInfo.bundleName) {
BadgeManager.getInstance().updateBadgeNumber(dragItemInfo.bundleName, dragItemInfo.badgeNumber);
}
if (!dragResult) {
AppStorage.setOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
} else {

View File

@ -24,7 +24,8 @@ import {
StyleConstants,
ResourceManager,
Log,
MenuInfo
MenuInfo,
BadgeManager
} from '@ohos/common';
import { SmartDockStyleConfig } from '../config/SmartDockStyleConfig';
import SmartDockDragHandler from '../common/SmartDockDragHandler';
@ -122,6 +123,10 @@ export default struct ResidentLayout {
Log.showInfo(TAG, `onDrop event: [${event.getWindowX()}, ${event.getWindowY()}]`);
const dragResult = SmartDockDragHandler.getInstance().onDragDrop(event.getWindowX(), event.getWindowY());
AppStorage.setOrCreate('selectAppIndex', null);
const dragItemInfo: LauncherDragItemInfo = AppStorage.get('dragItemInfo') as LauncherDragItemInfo;
if (dragItemInfo.bundleName) {
BadgeManager.getInstance().updateBadgeNumber(dragItemInfo.bundleName, dragItemInfo.badgeNumber);
}
if (!dragResult) {
AppStorage.setOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
} else {