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

[net6.0] Update Essentials Contacts API Docs #11631

Merged
merged 2 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions src/Essentials/docs/Microsoft.Maui.Essentials/Contacts.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Microsoft.Maui.ApplicationModel.Communication
{
/// <include file="../../docs/Microsoft.Maui.Essentials/Contacts.xml" path="Type[@FullName='Microsoft.Maui.ApplicationModel.Communications.Contacts']/Docs/*" />
class ContactsImplementation : IContacts
{
public Task<Contact> PickContactAsync() =>
Expand Down
30 changes: 27 additions & 3 deletions src/Essentials/src/Contacts/Contacts.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,50 @@

namespace Microsoft.Maui.ApplicationModel.Communication
{
/// <summary>
/// The Contacts API lets a user pick a contact and retrieve information about it.
/// </summary>
public interface IContacts
{
/// <summary>
/// Opens the operating system's default UI for picking a contact from the device.
/// </summary>
/// <returns>A single contact, or <see langword="null"/> if the user cancelled the operation.</returns>
Task<Contact?> PickContactAsync();

/// <summary>
/// Gets a collection of all the contacts on the device.
/// </summary>
/// <param name="cancellationToken">A token that can be used for cancelling the operation.</param>
/// <returns>A collection of contacts on the device.</returns>
Task<IEnumerable<Contact>> GetAllAsync(CancellationToken cancellationToken = default);
}

/// <include file="../../docs/Microsoft.Maui.Essentials/Contacts.xml" path="Type[@FullName='Microsoft.Maui.ApplicationModel.Communications.Contacts']/Docs/*" />
/// <summary>
/// The Contacts API lets a user pick a contact and retrieve information about it.
/// </summary>
public static class Contacts
{
/// <include file="../../docs/Microsoft.Maui.Essentials/Contacts.xml" path="//Member[@MemberName='PickContactAsync']/Docs/*" />
/// <summary>
/// Opens the operating system's default UI for picking a contact from the device.
/// </summary>
/// <returns>A single contact, or <see langword="null"/> if the user cancelled the operation.</returns>
public static Task<Contact?> PickContactAsync() =>
Default.PickContactAsync();

/// <include file="../../docs/Microsoft.Maui.Essentials/Contacts.xml" path="//Member[@MemberName='GetAllAsync']/Docs/*" />
/// <summary>
/// Gets a collection of all the contacts on the device.
/// </summary>
/// <param name="cancellationToken">A token that can be used for cancelling the operation.</param>
/// <returns>A collection of contacts on the device.</returns>
public static Task<IEnumerable<Contact>> GetAllAsync(CancellationToken cancellationToken = default) =>
Default.GetAllAsync(cancellationToken);

static IContacts? defaultImplementation;

/// <summary>
/// Provides the default implementation for static usage of this API.
/// </summary>
public static IContacts Default =>
defaultImplementation ??= new ContactsImplementation();

Expand Down