[launcher] bigfolder numbadge debug

Signed-off-by: chengzhen <chengzhen15@huawei.com>
This commit is contained in:
chengzhen 2022-08-05 16:40:40 +08:00
parent 1722c727ab
commit 374aefe212
5 changed files with 19 additions and 20 deletions

View File

@ -14,7 +14,7 @@
*/
const SystemApplication = {
SystemApplicationName: 'com.ohos.launcher,com.ohos.systemui,com.ohos.devicemanagerui,com.ohos.callui,com.example.kikakeyboard,com.ohos.contactdataability,com.ohos.telephonydataability,com.ohos.medialibrary.MediaLibraryDataA,com.ohos.medialibrary.MediaScannerAbilityA'
SystemApplicationName: 'com.ohos.launcher,com.ohos.systemui,com.ohos.devicemanagerui,com.ohos.callui,com.example.kikakeyboard,com.ohos.contactdataability,com.ohos.telephonydataability,com.ohos.medialibrary.MediaLibraryDataA,com.ohos.medialibrary.MediaScannerAbilityA,com.ohos.adminprovisioning'
};
export default SystemApplication;

View File

@ -34,8 +34,8 @@ export class BadgeManager {
private constructor() {
this.mDbStoreManager = RdbStoreManager.getInstance();
this.registerAppListEvent();
this.listener = this.appRemovedCallBack.bind(this);
this.registerAppListEvent();
}
/**
* badge manager instance
@ -106,7 +106,7 @@ export class BadgeManager {
private async appRemovedCallBack(event, bundleName: string, userId): Promise<void> {
Log.showInfo(TAG, 'Launcher AppModel installationSubscriberCallBack event = ' + event);
if (event == EventConstants.EVENT_PACKAGE_REMOVED) {
void this.mDbStoreManager.deleteBadgeByBundle(bundleName);
this.mDbStoreManager.deleteBadgeByBundle(bundleName);
}
}

View File

@ -206,7 +206,7 @@ export struct FolderComponent {
icon: ResourceManager.getInstance().getCachedAppIcon(item.appIconId, item.bundleName, item.moduleName),
bundleName: item.bundleName,
moduleName: item.moduleName,
badgeNumber: CommonConstants.BADGE_DISPLAY_HIDE
badgeNumber: item.badgeNumber
})
}
.height(StyleConstants.PERCENTAGE_100)
@ -244,7 +244,7 @@ export struct FolderComponent {
icon: ResourceManager.getInstance().getCachedAppIcon(item.appIconId, item.bundleName, item.moduleName),
bundleName: item.bundleName,
moduleName: item.moduleName,
badgeNumber: CommonConstants.BADGE_DISPLAY_HIDE
badgeNumber: item.badgeNumber
})
}
.width(StyleConstants.PERCENTAGE_80)

View File

@ -78,12 +78,6 @@ export class NumBadgeManager {
BadgeManager.getInstance().updateBadgeNumber(creatorBundleName, badgeNumber)
.then((result) => {
Log.showInfo(TAG, `updateBadgeByBundle result is ${result}`);
let badgeNotification = {
creatorBundleName: creatorBundleName,
badgeNumber: badgeNumber
};
AppStorage.SetOrCreate('badgenotification', badgeNotification);
Log.showInfo(TAG, `updateBadgeByBundle badgeNotification is ${JSON.stringify(badgeNotification)}`);
})
.catch(error => {
Log.showError(TAG, `updateBadgeByBundle error is ${error.message}`);

View File

@ -372,19 +372,11 @@ export default class PageDesktopViewModel extends BaseViewModel {
if (!this.ifInfoIsNull(appInfo)) {
hasFound = true;
let oldBadge = 0;
if (layoutInfo[i].badgeNumber && layoutInfo[i].badgeNumber > 0) {
if (appInfo.badgeNumber && appInfo.badgeNumber > 0) {
oldBadge = layoutInfo[i].badgeNumber - appInfo.badgeNumber;
} else {
oldBadge = layoutInfo[i].badgeNumber;
}
}
layoutInfo[i].badgeNumber = oldBadge + badgeInfo.badgeNumber;
appInfo.badgeNumber = badgeInfo.badgeNumber;
break;
}
}
layoutInfo[i].badgeNumber = this.getFolderBadgeNumber(layoutInfo[i]);
}
}
if (hasFound) {
@ -394,6 +386,19 @@ export default class PageDesktopViewModel extends BaseViewModel {
}
}
private getFolderBadgeNumber(folderInfo) {
let bidfolderBadgeNumber: number = 0;
let layoutInfo: [[]] = folderInfo.layoutInfo;
for (var i = 0; i < layoutInfo.length; i++) {
layoutInfo[i].forEach((item: any) => {
if (item.badgeNumber && item.badgeNumber > 0) {
bidfolderBadgeNumber = bidfolderBadgeNumber + item.badgeNumber;
}
});
}
return bidfolderBadgeNumber;
}
/**
* add app to pageDesktop by dragging
* @param appInfo