Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
GH-672: Update SMS recipient (#674)
Browse files Browse the repository at this point in the history
* Add back constructor taking single recipient.

* Update constructors

* Clean up android xml

* Update xamarin-essentials-android.xml
  • Loading branch information
jamesmontemagno authored Jan 8, 2019
1 parent 2c2e6d6 commit 527cda6
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 6 deletions.
1 change: 1 addition & 0 deletions Xamarin.Essentials/GlobalSuppressions.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "iOS is what we want.", Scope = "member", Target = "~P:Xamarin.Essentials.DevicePlatform.iOS")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "iOS is what we want.", Scope = "member", Target = "~P:Xamarin.Essentials.DevicePlatform.iOS")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1008:Opening parenthesis should be spaced correctly", Justification = "Clashed with rule 1003", Scope = "member", Target = "~M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.String)")]
17 changes: 13 additions & 4 deletions Xamarin.Essentials/Sms/Sms.shared.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

Expand Down Expand Up @@ -31,14 +30,24 @@ public SmsMessage()
{
}

public SmsMessage(string body, string recipient)
{
Body = body;
if (!string.IsNullOrWhiteSpace(recipient))
Recipients.Add(recipient);
}

public SmsMessage(string body, IEnumerable<string> recipients)
{
Body = body;
Recipients = recipients?.Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
if (recipients != null)
{
Recipients.AddRange(recipients.Where(x => !string.IsNullOrWhiteSpace(x)));
}
}

public string Body { get; set; }

public List<string> Recipients { get; set; }
public List<string> Recipients { get; set; } = new List<string>();
}
}
1 change: 1 addition & 0 deletions docs/en/FrameworksIndex/xamarin-essentials-android.xml
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
</Type>
<Type Name="Xamarin.Essentials.SmsMessage" Id="T:Xamarin.Essentials.SmsMessage">
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.String)" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.Collections.Generic.IEnumerable{System.String})" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Body" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Recipients" />
Expand Down
1 change: 1 addition & 0 deletions docs/en/FrameworksIndex/xamarin-essentials-ios.xml
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@
<Type Name="Xamarin.Essentials.SmsMessage" Id="T:Xamarin.Essentials.SmsMessage">
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.Collections.Generic.IEnumerable{System.String})" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.String)" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Body" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Recipients" />
</Type>
Expand Down
1 change: 1 addition & 0 deletions docs/en/FrameworksIndex/xamarin-essentials-uwp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@
<Type Name="Xamarin.Essentials.SmsMessage" Id="T:Xamarin.Essentials.SmsMessage">
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.Collections.Generic.IEnumerable{System.String})" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.String)" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Body" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Recipients" />
</Type>
Expand Down
1 change: 1 addition & 0 deletions docs/en/FrameworksIndex/xamarin-essentials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@
<Type Name="Xamarin.Essentials.SmsMessage" Id="T:Xamarin.Essentials.SmsMessage">
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.Collections.Generic.IEnumerable{System.String})" />
<Member Id="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.String)" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Body" />
<Member Id="P:Xamarin.Essentials.SmsMessage.Recipients" />
</Type>
Expand Down
28 changes: 26 additions & 2 deletions docs/en/Xamarin.Essentials/SmsMessage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
</AssemblyInfo>
<Parameters />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
<summary>Creates a new instance of SmsMessage</summary>
<remarks>
<para></para>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
Expand All @@ -47,6 +49,28 @@
<param name="body">Content of the message</param>
<param name="recipients">Recipients to receive the message.</param>
<summary>Creates a new instance of SmsMessage</summary>
<remarks>
<para></para>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SmsMessage (string body, string recipient);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string body, string recipient) cil managed" />
<MemberSignature Language="DocId" Value="M:Xamarin.Essentials.SmsMessage.#ctor(System.String,System.String)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Xamarin.Essentials</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="body" Type="System.String" />
<Parameter Name="recipient" Type="System.String" />
</Parameters>
<Docs>
<param name="body">Content of the message</param>
<param name="recipient">Recipient to receive the message.</param>
<summary>Creates a new instance of SmsMessage</summary>
<remarks>
<para />
</remarks>
Expand Down

0 comments on commit 527cda6

Please sign in to comment.