[COMPASS-6149] Add unified way of accessing preferences that works in main process and renderer Created: 19/Sep/22  Updated: 29/Oct/23  Resolved: 29/Sep/22

Status: Closed
Project: Compass
Component/s: Preferences
Affects Version/s: None
Fix Version/s: 1.34.0

Type: Task Priority: Major - P3
Reporter: Anna Henningsen Assignee: Anna Henningsen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by COMPASS-6092 Replace compass:usage:enabled/disable... Closed
is depended on by COMPASS-6107 Replace app:disable/enable-auto-updat... Closed
Epic Link: COMPASS-5816
Story Points: 5
Documentation Changes: Not Needed
Sprint: Iteration Kraken

 Description   

Currently, preferencesIpc is the only way for application code to access the preferences model. This is unfortunate, because it means that main process code can essentially not access the preferences without asking a renderer to do that access for it (this is essentially what happens for telemetry, for example).

Other packages such as compass-logging transparently select the right way of accessing the underlying structures, so that they can be used through the same API in both main process and renderer processes it. We should do the same here.

Specifically, this would entail moving setup-preferences.ts to compass-preferences-model, stopping to export preferencesIpc directly, and instead export a wrapper that accesses either the preferences model singleton in the main process, or preferencesIpc in renderer processes.

This can also involve aligning diverging APIs (e.g. onPreferencesChanged vs. onPreferenceValueChanged).



 Comments   
Comment by Githook User [ 05/Oct/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149 (#3529)

Comment by Githook User [ 03/Oct/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149 (#3529)

  • Rename `GlobalPreferences` to `AllPreferences`
  • Add an API that wraps `Preferences` access for the main process case
  • Remove `preferencesIpc` as an explicit export of the package
  • Consistently export an object that can be used in any supported
    environment for accessing preferences with identical API
    Branch: update-compass-shell-to-shared-config
    https://github.com/mongodb-js/compass/commit/e7ce350c62f4460f898d336ac36ece1e56ed8169
Comment by Githook User [ 29/Sep/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149 (#3529)

Comment by Githook User [ 29/Sep/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149 (#3529)

Comment by Githook User [ 29/Sep/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149 (#3529)

Comment by Githook User [ 29/Sep/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna.henningsen@mongodb.com', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149 (#3529)

Comment by Githook User [ 28/Sep/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149

Comment by Githook User [ 28/Sep/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: chore(compass-preferences-model): refactor preferences access API COMPASS-6149

Generated at Wed Feb 07 22:42:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.