diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-05-11 08:22:51 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-06-16 17:12:56 +0200 |
commit | a94236483e26785dcaf97fb10e863f82348eb068 (patch) | |
tree | 72acc7ac8eb955e93704bf563cc2973149ab9f97 /lib/private/NavigationManager.php | |
parent | 4c93249514783181115be8bb040de701bffdba10 (diff) | |
download | nextcloud-server-a94236483e26785dcaf97fb10e863f82348eb068.tar.gz nextcloud-server-a94236483e26785dcaf97fb10e863f82348eb068.zip |
Let apps toggle an unread counter on app icons
Co-authored-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/NavigationManager.php')
-rw-r--r-- | lib/private/NavigationManager.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 97bb8f85894..2ffd25df9b8 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -49,6 +49,8 @@ class NavigationManager implements INavigationManager { protected $entries = []; protected $closureEntries = []; protected $activeEntry; + protected $unreadCounters = []; + /** @var bool */ protected $init = false; /** @var IAppManager|AppManager */ @@ -97,7 +99,11 @@ class NavigationManager implements INavigationManager { if (!isset($entry['type'])) { $entry['type'] = 'link'; } - $this->entries[$entry['id']] = $entry; + + $id = $entry['id']; + $entry['unread'] = isset($this->unreadCounters[$id]) ? $this->unreadCounters[$id] : 0; + + $this->entries[$id] = $entry; } /** @@ -319,4 +325,8 @@ class NavigationManager implements INavigationManager { } return false; } + + public function setUnreadCounter(string $id, int $unreadCounter): void { + $this->unreadCounters[$id] = $unreadCounter; + } } |