A simple API to open the default dialer, preloaded with a number and name.
static class PhoneDialer {
static bool IsSupported { get; }
// should throw a NotSupportedOnDeviceException if the device is not capable.
static void Open(string number);
}
For the discussion around exceptions, see #19
As for me it can be simplified:
static class PhoneDialer
{
static bool CanOpenDialer { get; }
static void OpenDialer(string number);
static void OpenDialer(string number, string name);
}
Just a few moments to clarify:
Task *Async(), because it seems to be sync everywhere;Call method? OpenDial() seems more natural;OpenDial(...) can be simplified to a single OpenDial(string number, string name = null) or we can left these two methods?Thanks for your feedback. I am really agreeing with you here.
With regards to the methods, we would like to avoid the default parameters as this may make it harder to change in future.
I am thinking that in the Platform we can have "capabilities" instead of each API having a "can do this"
static class Capabilities
static class Capabilities
{
bool HasTelephony { get; }
}
static class PhoneDialer
{
static void Open(string number);
}
use:
if(Capabilities.HasTelephony)
PhoneDialier.Open("+15555555555");
I don't know if we need a name option as I don't think that is handled gracefully.
We should also avoid duplicating words if it is in the class name.
I think we should move this (Capabilities) discussion to #17 - I have a longer comment there
I removed the name parameter as it is just supported on UWP right now.
However, if this is a cool feature, we could probably just add it to the UWP version:
class Dialer {
#if UWP
void Open(string number, string name);
#endif
void Open(string number);
}
This way we get a nice feature, but do not add it to the cross-platform API where it is not supported.
Thoughts?
I think eventually we may add this sort of thing in, but let's stick to things that work everywhere for the most part for now.
Most helpful comment
I think eventually we may add this sort of thing in, but let's stick to things that work everywhere for the most part for now.