summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-04-24 12:25:26 -0400
committerRui Marinho <me@ruimarinho.net>2016-04-24 12:25:26 -0400
commit5907152c50ee2c658b266f2804e6b383bb15a6f1 (patch)
tree9beb907623359723456c5c03b08922bebc4f41f3 /Xamarin.Forms.Core
parentfeac1ba3ed6df5e27b3fa2076bd15c190cbacd1c (diff)
downloadxamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.tar.gz
xamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.tar.bz2
xamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.zip
Evolve feature branch (#117)
* Initial import of evolve features * [Android] Add Xamarin.Forms.Platform.Android.AppLinks project * [iOS] Fix issues with c# 6 features on iOS AppLinks * Added naive stanza to update-docs-windows.bat to produce Pages docs. Not tested. (#69) * Update packages * Add AppLinks android nuspec and fix linker issues * Fix build * Fix nusepc * Fix nuspec * Update android support nugets to 23.2.1 * Update Xamarin.UITest * Add CardView * [iOS] Fix app link for CoreSpotlight * [Android] Update AppLinks android support libs * Add Newtonsoft.Json dependency to nuspec * Fix NRE when setting ControlTemplate to null * Move to ModernHttpClient for download * Try fix build * Preserve android app links * Fix margin issue * General coding and simple fixes
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/AppLinkEntry.cs62
-rw-r--r--Xamarin.Forms.Core/Application.cs29
-rw-r--r--Xamarin.Forms.Core/IAppIndexingProvider.cs7
-rw-r--r--Xamarin.Forms.Core/IAppLinkEntry.cs20
-rw-r--r--Xamarin.Forms.Core/IAppLinks.cs11
-rw-r--r--Xamarin.Forms.Core/IApplicationController.cs1
-rw-r--r--Xamarin.Forms.Core/TemplateUtilities.cs16
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj4
8 files changed, 144 insertions, 6 deletions
diff --git a/Xamarin.Forms.Core/AppLinkEntry.cs b/Xamarin.Forms.Core/AppLinkEntry.cs
new file mode 100644
index 00000000..6942aa10
--- /dev/null
+++ b/Xamarin.Forms.Core/AppLinkEntry.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+
+namespace Xamarin.Forms
+{
+ public class AppLinkEntry : Element, IAppLinkEntry
+ {
+ 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));
+
+ public static readonly BindableProperty ThumbnailProperty = BindableProperty.Create(nameof(Thumbnail), typeof(ImageSource), typeof(AppLinkEntry), default(ImageSource));
+
+ public static readonly BindableProperty AppLinkUriProperty = BindableProperty.Create(nameof(AppLinkUri), typeof(Uri), typeof(AppLinkEntry), null);
+
+ public static readonly BindableProperty IsLinkActiveProperty = BindableProperty.Create(nameof(IsLinkActive), typeof(bool), typeof(AppLinkEntry), false);
+
+ public Uri AppLinkUri
+ {
+ get { return (Uri)GetValue(AppLinkUriProperty); }
+ set { SetValue(AppLinkUriProperty, value); }
+ }
+
+ public string Description
+ {
+ get { return (string)GetValue(DescriptionProperty); }
+ set { SetValue(DescriptionProperty, value); }
+ }
+
+ public bool IsLinkActive
+ {
+ get { return (bool)GetValue(IsLinkActiveProperty); }
+ set { SetValue(IsLinkActiveProperty, value); }
+ }
+
+ public IDictionary<string, string> KeyValues => new Dictionary<string, string>();
+
+ public ImageSource Thumbnail
+ {
+ get { return (ImageSource)GetValue(ThumbnailProperty); }
+ set { SetValue(ThumbnailProperty, value); }
+ }
+
+ public string Title
+ {
+ get { return (string)GetValue(TitleProperty); }
+ set { SetValue(TitleProperty, value); }
+ }
+
+ public static AppLinkEntry FromUri(Uri uri)
+ {
+ var appEntry = new AppLinkEntry();
+ appEntry.AppLinkUri = uri;
+ return appEntry;
+ }
+
+ public override string ToString()
+ {
+ return AppLinkUri.ToString();
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/Application.cs b/Xamarin.Forms.Core/Application.cs
index 1dfe258b..230b744b 100644
--- a/Xamarin.Forms.Core/Application.cs
+++ b/Xamarin.Forms.Core/Application.cs
@@ -10,7 +10,8 @@ namespace Xamarin.Forms
{
static Application s_current;
readonly Task<IDictionary<string, object>> _propertiesTask;
-
+
+ IAppIndexingProvider _appIndexProvider;
bool _isSaving;
ReadOnlyCollection<Element> _logicalChildren;
@@ -33,6 +34,18 @@ namespace Xamarin.Forms
SystemResources.ValuesChanged += OnParentResourcesChanged;
}
+ public IAppLinks AppLinks
+ {
+ get
+ {
+ if (_appIndexProvider == null)
+ throw new ArgumentException("No IAppIndexingProvider was provided");
+ if (_appIndexProvider.AppLinks == null)
+ throw new ArgumentException("No AppLinks implementation was found, if in Android make sure you installed the Xamarin.Forms.AppLinks");
+ return _appIndexProvider.AppLinks;
+ }
+ }
+
public static Application Current
{
get { return s_current; }
@@ -94,6 +107,11 @@ namespace Xamarin.Forms
ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
+ void IApplicationController.SetAppIndexingProvider(IAppIndexingProvider provider)
+ {
+ _appIndexProvider = provider;
+ }
+
public ResourceDictionary Resources
{
get { return _resources; }
@@ -128,6 +146,10 @@ namespace Xamarin.Forms
await SetPropertiesAsync();
}
+ protected virtual void OnAppLinkRequestReceived(Uri uri)
+ {
+ }
+
protected override void OnParentSet()
{
throw new InvalidOperationException("Setting a Parent on Application is invalid.");
@@ -177,6 +199,11 @@ namespace Xamarin.Forms
internal event EventHandler PopCanceled;
+ internal void SendOnAppLinkRequestReceived(Uri uri)
+ {
+ OnAppLinkRequestReceived(uri);
+ }
+
internal void SendResume()
{
s_current = this;
diff --git a/Xamarin.Forms.Core/IAppIndexingProvider.cs b/Xamarin.Forms.Core/IAppIndexingProvider.cs
new file mode 100644
index 00000000..86b1d611
--- /dev/null
+++ b/Xamarin.Forms.Core/IAppIndexingProvider.cs
@@ -0,0 +1,7 @@
+namespace Xamarin.Forms
+{
+ public interface IAppIndexingProvider
+ {
+ IAppLinks AppLinks { get; }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/IAppLinkEntry.cs b/Xamarin.Forms.Core/IAppLinkEntry.cs
new file mode 100644
index 00000000..b9a77a51
--- /dev/null
+++ b/Xamarin.Forms.Core/IAppLinkEntry.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace Xamarin.Forms
+{
+ public interface IAppLinkEntry
+ {
+ Uri AppLinkUri { get; set; }
+
+ string Description { get; set; }
+
+ bool IsLinkActive { get; set; }
+
+ IDictionary<string, string> KeyValues { get; }
+
+ ImageSource Thumbnail { get; set; }
+
+ string Title { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/IAppLinks.cs b/Xamarin.Forms.Core/IAppLinks.cs
new file mode 100644
index 00000000..9dbcf466
--- /dev/null
+++ b/Xamarin.Forms.Core/IAppLinks.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Xamarin.Forms
+{
+ public interface IAppLinks
+ {
+ void DeregisterLink(IAppLinkEntry appLink);
+ void DeregisterLink(Uri appLinkUri);
+ void RegisterLink(IAppLinkEntry appLink);
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/IApplicationController.cs b/Xamarin.Forms.Core/IApplicationController.cs
index 201032f9..d31f2c49 100644
--- a/Xamarin.Forms.Core/IApplicationController.cs
+++ b/Xamarin.Forms.Core/IApplicationController.cs
@@ -2,5 +2,6 @@
{
public interface IApplicationController
{
+ void SetAppIndexingProvider(IAppIndexingProvider appIndexing);
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/TemplateUtilities.cs b/Xamarin.Forms.Core/TemplateUtilities.cs
index 0599e747..a965308c 100644
--- a/Xamarin.Forms.Core/TemplateUtilities.cs
+++ b/Xamarin.Forms.Core/TemplateUtilities.cs
@@ -110,14 +110,20 @@ namespace Xamarin.Forms
}
ControlTemplate template = self.ControlTemplate;
- var content = template.CreateContent() as View;
-
- if (content == null)
+ if (template == null)
{
- throw new NotSupportedException("ControlTemplate must return a type derived from View.");
+ // do nothing for now
}
+ else
+ {
+ var content = template.CreateContent() as View;
+ if (content == null)
+ {
+ throw new NotSupportedException("ControlTemplate must return a type derived from View.");
+ }
- self.InternalChildren.Add(content);
+ self.InternalChildren.Add(content);
+ }
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 70d721d6..a4580fd6 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -395,7 +395,11 @@
<Compile Include="PinchGestureRecognizer.cs" />
<Compile Include="IStyle.cs" />
<Compile Include="MergedStyle.cs" />
+ <Compile Include="IAppLinks.cs" />
+ <Compile Include="IAppLinkEntry.cs" />
+ <Compile Include="AppLinkEntry.cs" />
<Compile Include="IApplicationController.cs" />
+ <Compile Include="IAppIndexingProvider.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<ItemGroup>