diff options
4 files changed, 56 insertions, 1 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/AppLinkEntryTests.cs b/Xamarin.Forms.Core.UnitTests/AppLinkEntryTests.cs new file mode 100644 index 00000000..0a5c5a8b --- /dev/null +++ b/Xamarin.Forms.Core.UnitTests/AppLinkEntryTests.cs @@ -0,0 +1,42 @@ +using System; +using NUnit.Framework; + +namespace Xamarin.Forms.Core.UnitTests +{ + [TestFixture] + public class AppLinkEntryTests : BaseTestFixture + { + + [Test] + public void KeyValuesTest() + { + var entry = new AppLinkEntry(); + + entry.KeyValues.Add("contentType", "GalleryPage"); + entry.KeyValues.Add("companyName", "Xamarin"); + Assert.AreEqual(entry.KeyValues.Count, 2); + } + + + [Test] + public void FromUriTest() + { + var uri = new Uri("http://foo.com"); + + var entry = AppLinkEntry.FromUri(uri); + + Assert.AreEqual(uri, entry.AppLinkUri); + } + + [Test] + public void ToStringTest() + { + var str = "http://foo.com"; + var uri = new Uri(str); + + var entry = new AppLinkEntry { AppLinkUri = uri }; + + Assert.AreEqual(uri.ToString(), entry.ToString()); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj b/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj index e8eeaba4..27fc07ee 100644 --- a/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj +++ b/Xamarin.Forms.Core.UnitTests/Xamarin.Forms.Core.UnitTests.csproj @@ -175,6 +175,7 @@ <Compile Include="MultiTriggerTests.cs" /> <Compile Include="TriggerTests.cs" /> <Compile Include="PinchGestureRecognizerTests.cs" /> + <Compile Include="AppLinkEntryTests.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> diff --git a/Xamarin.Forms.Core/AppLinkEntry.cs b/Xamarin.Forms.Core/AppLinkEntry.cs index 6942aa10..154b9691 100644 --- a/Xamarin.Forms.Core/AppLinkEntry.cs +++ b/Xamarin.Forms.Core/AppLinkEntry.cs @@ -5,6 +5,13 @@ namespace Xamarin.Forms { public class AppLinkEntry : Element, IAppLinkEntry { + readonly Dictionary<string, string> keyValues; + + public AppLinkEntry() + { + keyValues = new Dictionary<string, string>(); + } + public static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(AppLinkEntry), default(string)); public static readonly BindableProperty DescriptionProperty = BindableProperty.Create(nameof(Description), typeof(string), typeof(AppLinkEntry), default(string)); @@ -33,7 +40,10 @@ namespace Xamarin.Forms set { SetValue(IsLinkActiveProperty, value); } } - public IDictionary<string, string> KeyValues => new Dictionary<string, string>(); + public IDictionary<string, string> KeyValues + { + get { return keyValues; } + } public ImageSource Thumbnail { diff --git a/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs b/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs index 31225f9f..ca862d1c 100644 --- a/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs +++ b/Xamarin.Forms.Platform.Android/FormsApplicationActivity.cs @@ -100,6 +100,8 @@ namespace Xamarin.Forms.Platform.Android if (application == null) throw new ArgumentNullException("application"); + (application as IApplicationController)?.SetAppIndexingProvider(new AndroidAppIndexProvider(this)); + _application = application; Xamarin.Forms.Application.Current = application; |