UnityDashDepartements

Foreword

This page describes the concept of "departments" and its implementation in the click scope, as well as the introduction of the new X-Ubuntu-Default-Department-ID desktop key required by this feature. The intended audience of this document is:

  • click scope devs
  • core apps devs
  • ubuntu store server devs

Departments intro

"Departments" is a feature of Unity8 and the new Scopes API. This feature gives scopes the ability to define a hierarchical drop-down menu, which allows users to browse content and narrow it down by diving into specific departments / subdepartments.

Taking an imaginary shopping scope as an example, it can provide top-level departments such as "Electronics", "Books" and "Games". The "Electronics" department can have sub-departments such as "TVs", "Hi-Fi" and so on.

Departments in Click scope

Click scope is composed of two separate scopes: the clickapps scope (displays a list of installed apps only) and clickstore scope (displays the content of Ubuntu Store).

The departments for applications are defined and stored on the Ubuntu Store server. This includes the hierarchy of the departments, their names for all supported locales and the information about the department of each application in the store. To some degree this data is dynamic: departments may get renamed / updated, new departments may get added, also potentially some apps may get moved to another department.

Departments data is retrieved and stored locally in a sqlite file (/home/<user>/.cache/click-departments.db) by the clickstore scope, and retrieved by clickapps scope, so that clickapps can provide same department-browsing experience as clickstore scope (but without making any network queries):

  • the hierarchy of all departments and their names for currently used locale is fetched from the server whenever store scope is started.
  • the application - department relationship is stored in the db whenever a preview of an app is displayed in the store.

The problem of first boot experience and preinstalled apps

The above however poses a problem of first-boot experience, when user is not connected to the internet, but Apps scope should already provide departments menu, with the pre-installed apps shown in correct departments.

This is solved by providing an small pre-populated sqlite database, which provides department hierarchy and names for select locales:

  • the database is provided by unity-scope-click-departmentsdb package, and installed into /usr/share/unity/scopes/clickapps/departments.db.
  • there is an upstart job /usr/share/upstart/sessions/click-scope-departments-db.conf which copies it into /home/<user>/.cache/ on unity8 session start, unless it's already there (we don't want ot overwrite it, since it may be updated with newly installed apps or new departments already).

  • the initial prepopulated database can be generated with unity-scope-click-init-departments utility.

The second part of the solution is the department => application relationship for preinstalled core applications. This information is obtained from a new .desktop key, that must be present for all default apps:

X-Ubuntu-Default-Department-ID

This key should contain the department id of the application and it should match the department id of that app in the store. Note, that this department id can however be later overriden by the server via a record stored in the local sqlite db. The only way available currently to find out the id of app's department is to issue a query like this:

https://search.apps.ubuntu.com/api/v1/package/<package-id>

and look for the "department" attribute.

List of default department ids for core apps

Below is a list of default department ids for currently pre-installed apps (as of Jul 29th, 2014). Please note, this data may change slightly overtime and this list may get out-of-sync.

com.ubuntu.terminal

accessories

com.ubuntu.gallery

accessories

com.ubuntu.reminders

accessories

com.ubuntu.filemanager

accessories

com.ubuntu.weather

accessories

com.ubuntu.clock

accessories

com.ubuntu.shorts

accessories

com.canonical.payui

accessories

com.ubuntu.calculator

accessories

com.ubuntu.camera

accessories

com.ubuntu.notes

accessories

com.ubuntu.calendar

accessories

address-book-app.desktop

accessories

dialer-app.desktop

accessories

messaging-app.desktop

accessories

ubuntu-system-settings.desktop

accessories

com.ubuntu.sudoku

games

com.ubuntu.developer.webapps.webapp-twitter

internet

com.ubuntu.developer.webapps.webapp-facebook

internet

com.ubuntu.developer.webapps.webapp-amazon

internet

com.ubuntu.developer.webapps.webapp-ebay

internet

com.ubuntu.developer.webapps.webapp-gmail

mail

com.ubuntu.dropping-letters

puzzles

com.ubuntu.music

sound-video

mediaplayer-app.desktop

sound-video

webbrowser-app.desktop

web-browsers

Limitations / Open issues

  • current implementation is geared towards phone / touch with a very limited set of preinstalled apps, and we need to think about something more robust for the future; this will likely involve changes to click.
  • any changes to departments on the server must be carried with care, to avoid cases where department ids change and already installed app ends up in an "orhpaned" department (in which case the app is still accessible via the root department ("All departments"), but cannot be found in any top-level department anymore.
  • current departments structure is going to be changed for RTM.

Touch/Specs/UnityDashDepartements (last edited 2014-07-30 14:59:14 by stolowski)