-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 ISmsService and support multiple SMS Providers #14774
Conversation
Lol, I planned to that but you was fast, please refer to my email PR :) |
@hishamco I saw that now. Good approach. I think there is a bug along the lines when trying to resolve dependencies for some reason. I have to find time to resolve them. What I had before does the same thing as the keyed services. I just need to know how to get a list of a dictionary with the keyed service along with their key. They figure out the issue with the dependency injection. |
Why you need to do that, you can get the service(s) by its key |
We need to create a menu with key/name pair in the settings so that the user can select which provider to use from the UI (driver). Then we store the key in the site settings. The SmsService will use the provider based on the configured value. |
@jtkech I am noticing some odd behavior when registering keyed services. As you can see I am registering keyed service like this
But I am getting an exception in the Elasticsearch model! Are we using a custom service provider that does not support keyed services? Any idea what is missing here? |
Please check my OC.Email.Azure PR I resolve this issue at shell level |
That's the question I forgot to ask you yesterday if you already test the code or not |
We build the shell service provider ourselves but not a custom one. To support keyed services we need to do some changes, before checking the
|
@jtkech I already resolve the same issue by checking the service in |
@hishamco please submit a PR with the ServiceProvider fix so we can take that soon. |
Just took a look, yes it "fixes" the issue but it is incomplete, need to also check Should be inspired by https://github.com/dotnet/runtime/blob/2158031420214184d22a29029ff24420472fcaa0/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceDescriptor.cs#L292 and adapted to our usage for example when we clone a container. If we want to support keyed services I will need to do a separated PR. |
@jtkech are you free to submit a PR for this? If you do, ping me and I'll get it tested in the morning. |
Can't right now but I will do asap. |
Sure, I will do it now |
I suggest splitting the settings for each SMS provider on a separate page because it becomes from different module |
@hishamco from a user perspective, it is much easier to visit one page where you can configure all the related options. So here one place can be used to configure all the SMS providers and set the default provider. These settings can be injected from different modules or features but should render on the same page. This way you don't have to confuse the user with so much instruction. All the instructions that you need is to direct them to the settings page. Also, with this approach feature that needs to depends on SMS "for example 2FA - SMS", will only need to add dependency on the OC.Sms module not specify implementation. If you need to create a new provider in a separate module, all you need to do is depend on OC.Sms module. This is important structure to provide in OC. The idea is to expose a facade in one module "main module" and then have same or other modules compose providers. |
Seems you merged this so quick, I just planned to revise it tonight :( |
This PR has been open for couple months. But, if you think there is a need for modification, feel free to propose a PR |
Usually in OC we need one approval other than the creator to ensure everything is as expected, so there is no rush :)
FYI I have a few PRs opened for years :) |
We improved the UI settings by to grouping each provider settings into it's own tab to simply have a one place to configure all settings
Also, adding a way to test out SMS providers.