Skip to content

Commit

Permalink
feat(effectiveviewport): Enable mixins on iOS and fix csproj references
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr.Rx authored and dr1rrb committed Nov 16, 2020
1 parent ec7f73c commit d2861ff
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 1,597 deletions.
32 changes: 5 additions & 27 deletions src/Uno.UI/Mixins/Android/FrameworkElementMixins.tt
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,19 @@
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Text.RegularExpressions" #>

<#@include file="..\..\UI\Xaml\IFrameworkElement.Partials.tt"#>
<#
var partialsIncludes = new string[]
{
Host.ResolvePath(@"..\..\UI\Xaml\FrameworkElement.EffectiveViewport.cs"),
};

var types = new string[]
{
GenerateDefaultPartialClasses(
"Windows.UI.Xaml.Controls.Image",
"Windows.UI.Xaml.Controls.NativeListViewBase",
"Windows.UI.Xaml.Controls.NativePagedView",
"Windows.UI.Xaml.Controls.ProgressRing",
"Windows.UI.Xaml.Controls.ScrollContentPresenter",
"Windows.UI.Xaml.Controls.TextBoxView",
};

foreach(var include in partialsIncludes)
foreach(var type in types)
{
var typeParts = type.Split('.');
var spaceName = string.Join(".", typeParts.Take(typeParts.Length - 1));
var className = typeParts.Last();

var partialContent = System.IO.File.ReadAllText(include);
partialContent = "#define TEMPLATED\r\n" + partialContent;
partialContent = Regex.Replace(partialContent, @"^using _This\s*=.*$", $"using _This = {type};", RegexOptions.Multiline);
partialContent = Regex.Replace(partialContent, @"^namespace [a-zA-Z0-9_\.\s]+$", $"namespace {spaceName}", RegexOptions.Multiline);
partialContent = Regex.Replace(partialContent, @"partial class [a-zA-Z0-9_]+", $"partial class {className}", RegexOptions.Multiline);

var targetFile = Path.Combine(Path.GetDirectoryName(Host.TemplateFile), $"{className}.{Path.GetFileName(include)}");
File.WriteAllText(targetFile, partialContent);
}
"Windows.UI.Xaml.Controls.TextBoxView"
);
#>

#if XAMARIN_ANDROID
#if __ANDROID__
<#
AddClass("Windows.UI.Xaml", "FrameworkElement", overridesAttachedToWindow:true, overridesOnLayout: false, isUnoMotionTarget: true, hasLayouter: true);
AddClass("Windows.UI.Xaml.Controls", "NativeListViewBase", isUnoMotionTarget: true);
Expand Down
236 changes: 0 additions & 236 deletions src/Uno.UI/Mixins/Android/Image.FrameworkElement.EffectiveViewport.cs

This file was deleted.

Loading

0 comments on commit d2861ff

Please sign in to comment.