summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls
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.Controls
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.Controls')
-rw-r--r--Xamarin.Forms.Controls/App.cs31
-rw-r--r--Xamarin.Forms.Controls/CoreGallery.cs1
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/AppLinkPageGallery.cs80
-rw-r--r--Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj5
4 files changed, 117 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/App.cs b/Xamarin.Forms.Controls/App.cs
index 31c356e3..b297097c 100644
--- a/Xamarin.Forms.Controls/App.cs
+++ b/Xamarin.Forms.Controls/App.cs
@@ -32,6 +32,37 @@ namespace Xamarin.Forms.Controls
};
}
+ protected override void OnAppLinkRequestReceived(Uri uri)
+ {
+
+ var appDomain = "http://" + AppName.ToLowerInvariant() + "/";
+
+ if (!uri.ToString().ToLowerInvariant().StartsWith(appDomain))
+ return;
+
+ var url = uri.ToString().Replace(appDomain, "");
+
+ var parts = url.Split('/');
+ if (parts.Length == 2)
+ {
+ var isPage = parts[0].Trim().ToLower() == "gallery";
+ if (isPage)
+ {
+ string page = parts[1].Trim();
+ var pageForms = Activator.CreateInstance(Type.GetType(page));
+
+ var appLinkPageGallery = pageForms as AppLinkPageGallery;
+ if (appLinkPageGallery != null)
+ {
+ appLinkPageGallery.ShowLabel = true;
+ (MainPage as MasterDetailPage)?.Detail.Navigation.PushAsync((pageForms as Page));
+ }
+ }
+ }
+
+ base.OnAppLinkRequestReceived(uri);
+ }
+
public static Dictionary<string, string> Config
{
get
diff --git a/Xamarin.Forms.Controls/CoreGallery.cs b/Xamarin.Forms.Controls/CoreGallery.cs
index 7b6ed150..d060fbbc 100644
--- a/Xamarin.Forms.Controls/CoreGallery.cs
+++ b/Xamarin.Forms.Controls/CoreGallery.cs
@@ -196,6 +196,7 @@ namespace Xamarin.Forms.Controls
{
var pages = new List<Page> {
new CarouselViewGallaryPage {Title = "CarouselView Gallery"},
+ new AppLinkPageGallery {Title = "App Link Page Gallery"},
new NestedNativeControlGalleryPage {Title = "Nested Native Controls Gallery"},
new CellForceUpdateSizeGalleryPage {Title = "Cell Force Update Size Gallery"},
new AppearingGalleryPage {Title = "Appearing Gallery"},
diff --git a/Xamarin.Forms.Controls/GalleryPages/AppLinkPageGallery.cs b/Xamarin.Forms.Controls/GalleryPages/AppLinkPageGallery.cs
new file mode 100644
index 00000000..bc765dd9
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/AppLinkPageGallery.cs
@@ -0,0 +1,80 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ public class AppLinkPageGallery : ContentPage
+ {
+ public AppLinkPageGallery ()
+ {
+ _linkEntry = GetEntry ();
+ _lbl = new Label {
+ Text = "You are on a demo page via app url", IsVisible = ShowLabel
+ };
+
+ var btnRegister = new Button { Text = "Index this Page",
+ Command = new Command (() => Application.Current.AppLinks.RegisterLink (LinkEntry))
+ };
+ var btnRemove = new Button { Text = "Remove this Page from index",
+ Command = new Command (() => Application.Current.AppLinks.DeregisterLink (LinkEntry))
+ };
+
+ var btnClearAll = new Button { Text = "Clear All Indexed Data",
+ // Command = new Command (() => Application.Current.AppLinks.DeregisterAll ())
+ };
+
+ Content = new StackLayout { Children = { _lbl, btnRegister, btnRemove, btnClearAll } };
+ }
+
+ protected override void OnAppearing ()
+ {
+ LinkEntry.IsLinkActive = true;
+ }
+
+ protected override void OnDisappearing ()
+ {
+ LinkEntry.IsLinkActive = false;
+ }
+
+ public bool ShowLabel {
+ get {
+ return _showlabel;
+ }
+ set {
+ _showlabel = value;
+ _lbl.IsVisible = _showlabel;
+ }
+ }
+
+ internal IAppLinkEntry LinkEntry {
+ get {
+ return _linkEntry;
+ }
+ }
+
+ bool _showlabel;
+ IAppLinkEntry _linkEntry;
+ Label _lbl;
+
+ AppLinkEntry GetEntry ()
+ {
+ if (string.IsNullOrEmpty (Title))
+ Title = "App Link Page Gallery";
+
+ var type = GetType ().ToString ();
+ var entry = new AppLinkEntry {
+ Title = Title,
+ Description =$"This is the page {Title} \nof Xamarin Forms Gallery",
+ AppLinkUri = new Uri ($"http://{App.AppName}/gallery/{type}", UriKind.RelativeOrAbsolute),
+ IsLinkActive = true,
+ Thumbnail = ImageSource.FromFile ("seth.png")
+ };
+
+ entry.KeyValues.Add ("contentType", "GalleryPage");
+ entry.KeyValues.Add ("appName", App.AppName);
+ entry.KeyValues.Add ("companyName", "Xamarin");
+
+ return entry;
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
index b5dd6af5..3252403b 100644
--- a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
+++ b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
@@ -72,6 +72,10 @@
<Project>{7d13bac2-c6a4-416a-b07e-c169b199e52b}</Project>
<Name>Xamarin.Forms.Maps</Name>
</ProjectReference>
+ <ProjectReference Include="..\Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj">
+ <Project>{d6133dbd-6c60-4bd5-bea2-07e0a3927c31}</Project>
+ <Name>Xamarin.Forms.Pages</Name>
+ </ProjectReference>
<ProjectReference Include="..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj">
<Project>{9db2f292-8034-4e06-89ad-98bbda4306b9}</Project>
<Name>Xamarin.Forms.Xaml</Name>
@@ -224,6 +228,7 @@
<Compile Include="ControlGalleryPages\PinchGestureTestPage.cs" />
<Compile Include="ControlGalleryPages\AppearingGalleryPage.cs" />
<Compile Include="ControlGalleryPages\AutomationIDGallery.cs" />
+ <Compile Include="GalleryPages\AppLinkPageGallery.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" />