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

Add commit attribute to AndroidSettings.Factory #74

Closed
xsveda opened this issue Dec 30, 2020 · 5 comments
Closed

Add commit attribute to AndroidSettings.Factory #74

xsveda opened this issue Dec 30, 2020 · 5 comments

Comments

@xsveda
Copy link

xsveda commented Dec 30, 2020

AndroidSettings constructor allows to set a commit flag.

I am missing the same configuration option when using AndroidSettings.Factory.

As the fun create(String?) is defined in the parent Settings.Factory interface, the commit option would need to be set in AndroidSettings.Factory constructor.

If we can agree on this I can to the PR.

@xsveda
Copy link
Author

xsveda commented Dec 30, 2020

This might be taken broader to cover all specific configuration options for other Settings implementations. Another example would be useFrozenListeners flag of AppleSettings

@russhwolf
Copy link
Owner

There's a bit of a combinatorial explosion when trying to support every option for both constructors and factories. I haven't been very focused on the Factory implementations since you can fairly easily create your own if you need different options. I've also become less and less convinced over time that having a Factory interface is really that useful compared to just supplying your own () -> Settings or (String) -> Settings lambda as needed.

At some point I want to do some deeper rethinking of how initialization works, and have been thinking about doing a DSL builder style like Ktor and kotlinx.serialization use. See #65.

@francismariano
Copy link

francismariano commented Jan 14, 2021

I think the commit flag could set also from common module perspective.

For example, when I use the no-arg module and creating the settings with val settings : Settings = Settings() I think interesting config the commit flag in this point.

@russhwolf
Copy link
Owner

Platform-specific settings should be configured in platform code, not common code. Otherwise you end up with a bunch of extra flags in common code that don't do anything most of the time, and that makes for a confusing API.

The purpose of no-arg is to provide a reasonable default configuration where you don't need to do anything extra. If those default settings don't fit your needs, then you shouldn't be using no-arg.

@russhwolf
Copy link
Owner

I don't think there's changes that need to happen here so I'm closing this issue.

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

No branches or pull requests

3 participants