Signed-off-by: zhangchao <zhangchao338@huawei.com>
This commit is contained in:
zhangchao 2022-08-16 10:18:54 +08:00
parent f05e308a32
commit a14dfb4466
6 changed files with 17 additions and 10 deletions

View File

@ -55,11 +55,13 @@ class AmsMissionManager {
let missionInfos = new Array<OriginMissionInfo>();
await missionManager.getMissionInfos('', AmsMissionManager.RECENT_MISSIONS_LIMIT_NUM)
.then((res) => {
Log.showInfo(TAG, `getRecentMissionsList res.length: ${res.length}`);
missionInfos = res;
if (!CheckEmptyUtils.isEmptyArr(res)) {
Log.showInfo(TAG, `getOriginRecentMissionsList res.length: ${res.length}`);
missionInfos = res;
}
})
.catch((err) => {
Log.showError(TAG, `getRecentMissionsList error: ${JSON.stringify(err)}`);
Log.showError(TAG, `getOriginRecentMissionsList error: ${JSON.stringify(err)}`);
});
return missionInfos;
}

View File

@ -106,7 +106,7 @@ export class RecentMissionsViewModel {
this.mRecentMissionsList = await amsMissionManager.getRecentMissionsList();
} else {
this.mRecentMissionsList = [];
AppStorage.SetOrCreate('recentMissionsList', this.mRecentMissionsList);
AppStorage.SetOrCreate('recentMissionsList', []);
await this.deleteRecentMissions();
return;
}

View File

@ -166,8 +166,9 @@ struct EntryView {
}
})
}
.onAreaChange((event) => {
.onAreaChange((oldValue: Area, newValue: Area) => {
Log.showDebug(TAG, `onAreaChange navigationBarStatus: ${this.navigationBarStatus}`);
if (JSON.stringify(oldValue) == JSON.stringify(newValue)) return;
if (this.navigationBarStatus == "1") {
setTimeout(() => {
SettingsModel.getInstance().setValue(this.navigationBarStatus);

View File

@ -34,7 +34,7 @@ struct RecentView {
private mRecentMissionsViewModel: RecentMissionsViewModel;
onPageShow(): void {
Log.showInfo(TAG, `onPageShow recentMissionsList.length: ${this.recentMissionsList.length}`);
Log.showInfo(TAG, 'onPageShow');
this.isClickSubComponent = false;
this.mRecentMissionsStage.onCreate();
this.mRecentMissionsViewModel = RecentMissionsViewModel.getInstance();
@ -56,13 +56,16 @@ struct RecentView {
private closeRecentDockPopup() {
let num: number = AppStorage.Get('sysUiRecentOnClickEvent');
if (!num) {
num = 0;
}
AppStorage.SetOrCreate('sysUiRecentOnClickEvent', ++num);
Log.showInfo(TAG, `aboutToAppear sysUiRecentOnClickEvent closeRecentDockPopup num: ${num}`);
}
build() {
Column() {
if (this.recentMissionsList.length === 0) {
if (!Array.isArray(this.recentMissionsList) || this.recentMissionsList.length == 0) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text($r('app.string.No_running_apps_recently'))
.fontColor(RecentsStyleConstants.DEFAULT_FONT_COLOR)

View File

@ -137,8 +137,9 @@ struct EntryView {
Column() {
SmartDock();
}
.onAreaChange((event) => {
.onAreaChange((oldValue: Area, newValue: Area) => {
Log.showDebug(TAG, `onAreaChange navigationBarStatus: ${this.navigationBarStatus}`);
if (JSON.stringify(oldValue) == JSON.stringify(newValue)) return;
if (this.navigationBarStatus == "1") {
setTimeout(() => {
SettingsModel.getInstance().setValue(this.navigationBarStatus);

View File

@ -34,7 +34,7 @@ struct RecentView {
private mRecentMissionsViewModel: RecentMissionsViewModel;
onPageShow(): void {
Log.showInfo(TAG, `onPageShow recentMissionsList.length: ${this.recentMissionsList.length}`);
Log.showInfo(TAG, 'onPageShow');
this.isClickSubComponent = false;
this.mRecentMissionsStage.onCreate();
this.mRecentMissionsViewModel = RecentMissionsViewModel.getInstance();
@ -56,7 +56,7 @@ struct RecentView {
build() {
Column() {
if (this.recentMissionsList.length === 0) {
if (!Array.isArray(this.recentMissionsList) || this.recentMissionsList.length == 0) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text($r('app.string.No_running_apps_recently'))
.fontColor(RecentsStyleConstants.DEFAULT_FONT_COLOR)