From 527cda6b312608d8a0bc831cba341446f8661b99 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Tue, 8 Jan 2019 14:45:18 -0800 Subject: [PATCH] GH-672: Update SMS recipient (#674) * Add back constructor taking single recipient. * Update constructors * Clean up android xml * Update xamarin-essentials-android.xml --- .../GlobalSuppressions.shared.cs | 1 + Xamarin.Essentials/Sms/Sms.shared.cs | 17 ++++++++--- .../xamarin-essentials-android.xml | 1 + .../xamarin-essentials-ios.xml | 1 + .../xamarin-essentials-uwp.xml | 1 + .../en/FrameworksIndex/xamarin-essentials.xml | 1 + docs/en/Xamarin.Essentials/SmsMessage.xml | 28 +++++++++++++++++-- 7 files changed, 44 insertions(+), 6 deletions(-) diff --git a/Xamarin.Essentials/GlobalSuppressions.shared.cs b/Xamarin.Essentials/GlobalSuppressions.shared.cs index 5fcb8feb7..648b717f5 100644 --- a/Xamarin.Essentials/GlobalSuppressions.shared.cs +++ b/Xamarin.Essentials/GlobalSuppressions.shared.cs @@ -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)")] diff --git a/Xamarin.Essentials/Sms/Sms.shared.cs b/Xamarin.Essentials/Sms/Sms.shared.cs index 2bec2ff08..4346d8ae3 100644 --- a/Xamarin.Essentials/Sms/Sms.shared.cs +++ b/Xamarin.Essentials/Sms/Sms.shared.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -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 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 Recipients { get; set; } + public List Recipients { get; set; } = new List(); } } diff --git a/docs/en/FrameworksIndex/xamarin-essentials-android.xml b/docs/en/FrameworksIndex/xamarin-essentials-android.xml index 84bcbe587..36f8b280a 100644 --- a/docs/en/FrameworksIndex/xamarin-essentials-android.xml +++ b/docs/en/FrameworksIndex/xamarin-essentials-android.xml @@ -526,6 +526,7 @@ + diff --git a/docs/en/FrameworksIndex/xamarin-essentials-ios.xml b/docs/en/FrameworksIndex/xamarin-essentials-ios.xml index b5efc788a..d2a6a1f5e 100644 --- a/docs/en/FrameworksIndex/xamarin-essentials-ios.xml +++ b/docs/en/FrameworksIndex/xamarin-essentials-ios.xml @@ -526,6 +526,7 @@ + diff --git a/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml b/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml index 1f6e6e1a5..1172d632f 100644 --- a/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml +++ b/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml @@ -525,6 +525,7 @@ + diff --git a/docs/en/FrameworksIndex/xamarin-essentials.xml b/docs/en/FrameworksIndex/xamarin-essentials.xml index a9537af52..95f204ddd 100644 --- a/docs/en/FrameworksIndex/xamarin-essentials.xml +++ b/docs/en/FrameworksIndex/xamarin-essentials.xml @@ -522,6 +522,7 @@ + diff --git a/docs/en/Xamarin.Essentials/SmsMessage.xml b/docs/en/Xamarin.Essentials/SmsMessage.xml index 0d305e97c..41334c009 100644 --- a/docs/en/Xamarin.Essentials/SmsMessage.xml +++ b/docs/en/Xamarin.Essentials/SmsMessage.xml @@ -26,8 +26,10 @@ - To be added. - To be added. + Creates a new instance of SmsMessage + + + @@ -47,6 +49,28 @@ Content of the message Recipients to receive the message. Creates a new instance of SmsMessage + + + + + + + + + + Constructor + + Xamarin.Essentials + 1.0.0.0 + + + + + + + Content of the message + Recipient to receive the message. + Creates a new instance of SmsMessage