fix: fix icon display problem when application is installed, remove all related settings when an application is uinstalled

This commit is contained in:
DanyLE 2022-08-24 14:45:11 +02:00
parent a0ee2d1090
commit b381294064
9 changed files with 45 additions and 5 deletions

2
d.ts/antos.d.ts vendored
View File

@ -1140,7 +1140,7 @@ declare namespace OS {
* @export
* @param {string} app
*/
function unloadApp(app: string): void;
function unloadApp(app: string, save?: boolean): void;
/**
* Create a service process.
*

View File

@ -400,11 +400,43 @@ namespace OS {
* @export
* @param {string} app
*/
export function unloadApp(app: string): void {
export function unloadApp(app: string, save?: boolean): void {
PM.killAll(app, true);
if (application[app] && application[app].style) {
$(application[app].style).remove();
}
if(save)
{
// remove pinned application if any
if(OS.setting.system.startup.pinned)
OS.setting.system.startup.pinned = OS.setting.system.startup.pinned.filter((e) => e != app);
// remove service if it is the service
if(OS.setting.system.startup.services)
OS.setting.system.startup.services = OS.setting.system.startup.services.filter((e) => e != app);
// remove startup app if any
if(OS.setting.system.startup.apps)
OS.setting.system.startup.apps = OS.setting.system.startup.apps.filter((e) => e != app);
// refresh pinned list
announcer.ostrigger("app-pinned", "app-pinned", undefined);
// remove application setting
if(OS.setting.applications[app])
delete OS.setting.applications[app];
OS.API.setting()
.then((d) =>{
if(d.error)
{
announcer.oserror(
__("Error when save system setting {0}:{1}", app, d.error),
undefined);
}
})
.catch((e)=> {
announcer.oserror(
__("Error when save system setting {0}: {1}", app, e.toString()),
e);
});
}
delete application[app];
}

View File

@ -5,4 +5,5 @@ This application is icluded in the AntOS delivery
and cannot be removed/uinstalled by regular user
## Change logs
- 0.2.6-b: improve install process
- v0.2.5-b: add README.md

View File

@ -684,6 +684,10 @@ namespace OS {
v.iconclass =
"fa fa-adn";
}
if(v.icon)
{
v.icon = `${pth}/${v.icon}`;
}
v.path = pth;
this.systemsetting.system.packages[
v.pkgname ? v.pkgname : v.app
@ -727,7 +731,7 @@ namespace OS {
}
}
delete this.systemsetting.system.packages[meta.pkgname];
this._gui.unloadApp(meta.pkgname);
this._gui.unloadApp(meta.pkgname, true);
if (meta.download) {
this.appDetail(meta);
}

View File

@ -7,7 +7,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.2.5-a",
"version":"0.2.6-b",
"category":"System",
"iconclass":"fa fa-shopping-bag",
"mimes":["none"],

View File

@ -101,6 +101,7 @@ namespace OS {
text: v.name,
app: k,
iconclass: v.iconclass,
icon: v.icon
});
}
}

View File

@ -10,4 +10,5 @@ In case of system anormaly after the modification, the system settings can be re
by simply removing the setting file
## Change logs
-v0.1.2-b: minor bug fix on UI
-v0.1.2-b: add README

View File

@ -102,6 +102,7 @@ namespace OS {
text: v.name,
app: k,
iconclass: v.iconclass,
icon: v.icon
});
}
}

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1.2-b",
"version":"0.1.3-b",
"category":"System",
"iconclass":"fa fa-wrench",
"mimes":["none"]