Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new SettingsManager. #51

Merged
merged 3 commits into from
Feb 9, 2024
Merged

Create a new SettingsManager. #51

merged 3 commits into from
Feb 9, 2024

Conversation

andrewbrereton
Copy link
Owner

  • Similar to Logger, it is a singleton.
  • Implement it in ObsidianIcalPlugin so that it can be used anywhere.
  • Change everywhere so that we are using the new getSetting and setSetting functions when we need to get the setting instead of passing arguments to parameters whenever we instantiate a class.
  • Now SettingsManager acts as a cache layer between the application and the plugin saveData and loadData functions. Can add transformation and/or validation at a later stage if required.
  • Fixes a bug where settings were not loading properly when new settings were added after a version upgrade.
  • Fixes a bug where changing a value of a setting was not reflected throughout the code, requiring a restart of Obsidian.

…mplement it in ObsidianIcalPlugin so that it can be used anywhere. Change everywhere so that we are using the new getSetting and setSetting functions.

Now SettingsManager acts as a cache layer between the application and the plugin saveData and loadData functions.

Fixes a bug where settings were not loading properly when new settings were added after a version upgrade.

Fixes a bug where changing a value of a setting was not reflected through the code.
…for each setting. Although this is more lines of code, it means that every setting is an explicit and strongly-typed property.

Also modified instantiation so that the settings object is all you need to use the SettingsManager.

Update settings implementation everywhere to use the new method.
@andrewbrereton andrewbrereton merged commit c5a320a into main Feb 9, 2024
3 checks passed
@andrewbrereton andrewbrereton deleted the singleton-settings branch February 9, 2024 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant