MOBILE-4469 site: Implement new hasInfo function

main
Dani Palou 2023-11-13 13:07:02 +01:00
parent a3898d7515
commit 748dce1757
1 changed files with 12 additions and 0 deletions

View File

@ -71,6 +71,18 @@ export class CoreUnauthenticatedSite {
return undefined;
}
/**
* Check if the site has info with the given key and it doesn't contain an empty value.
*
* @param key Info key.
* @returns Whether the key is filled within site info.
*/
hasInfo(key: string): boolean {
const info = this.getInfo()?.[key] ?? null;
return info === false || info === 0 || !!info;
}
/**
* Get site name.
*