Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

IOS Linker fixes inside Xamarin.Forms #8001

Merged
merged 5 commits into from
Dec 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@
<AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis>
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
</PropertyGroup>
<PropertyGroup Condition=" '$(CI)' == 'True' ">
<AndroidLinkMode>Full</AndroidLinkMode>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Android" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' OR '$(CI)' == 'true'">
<MtouchLink>Full</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<AppExtensionDebugBundleId />
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.ComponentModel;
using Foundation;

namespace Xamarin.Forms.Platform.iOS
{
public class CarouselViewRenderer : ItemsViewRenderer<CarouselView, CarouselViewController>
{
CarouselView CarouselView => Element;

[Preserve(Conditional = true)]
public CarouselViewRenderer()
{
CarouselView.VerifyCarouselViewFlagEnabled(nameof(CarouselViewRenderer));
Expand Down
14 changes: 14 additions & 0 deletions Xamarin.Forms.Platform.iOS/LinkerSafeAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.ComponentModel;

namespace Xamarin.Forms.Internals
{
[AttributeUsage(AttributeTargets.All)]
[EditorBrowsable(EditorBrowsableState.Never)]
class LinkerSafeAttribute : Attribute
{
public LinkerSafeAttribute()
{
}
}
}
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.iOS/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
[assembly: Xamarin.Forms.Dependency(typeof(Deserializer))]
[assembly: Xamarin.Forms.Dependency(typeof(ResourcesProvider))]
[assembly: ResolutionGroupName("Xamarin")]
[assembly: Preserve]
[assembly: LinkerSafe]
2 changes: 2 additions & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
using Specifics = Xamarin.Forms.PlatformConfiguration.iOSSpecific;
using SizeF = CoreGraphics.CGSize;
using PreserveAttribute = Foundation.PreserveAttribute;

namespace Xamarin.Forms.Platform.iOS
{
Expand Down Expand Up @@ -35,6 +36,7 @@ public class ButtonRenderer : ViewRenderer<Button, UIButton>, IImageVisualElemen
IImageVisualElementRenderer IButtonLayoutRenderer.ImageVisualElementRenderer => this;
nfloat IButtonLayoutRenderer.MinimumHeight => _minimumButtonHeight;

[Preserve(Conditional = true)]
public ButtonRenderer()
{
BorderElementManager.Init(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class CarouselPageRenderer : UIViewController, IVisualElementRenderer
VisualElementTracker _tracker;
Page _previousPage;

[Preserve(Conditional = true)]
public CarouselPageRenderer()
{
}
Expand Down
2 changes: 2 additions & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/CheckBoxRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using Foundation;

namespace Xamarin.Forms.Platform.iOS
{
public class CheckBoxRenderer : CheckBoxRendererBase<FormsCheckBox>
{
[Preserve(Conditional = true)]
public CheckBoxRenderer()
{
}
Expand Down
1 change: 1 addition & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class EditorRenderer : EditorRendererBase<UITextView>

UILabel _placeholderLabel;

[Preserve(Conditional = true)]
public EditorRenderer()
{
Frame = new RectangleF(0, 20, 320, 40);
Expand Down
1 change: 1 addition & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Xamarin.Forms.Platform.iOS
{
public class EntryRenderer : EntryRendererBase<UITextField>
{
[Preserve(Conditional = true)]
public EntryRenderer()
{
Frame = new RectangleF(0, 20, 320, 40);
Expand Down
3 changes: 3 additions & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/FrameRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Drawing;
using CoreAnimation;
using CoreGraphics;
using Foundation;
using UIKit;

namespace Xamarin.Forms.Platform.iOS
Expand Down Expand Up @@ -88,12 +89,14 @@ public override void LayoutSubviews()
base.LayoutSubviews();
}

[Preserve(Conditional = true)]
class ShadowView : UIView
{
CALayer _shadowee;
CGRect _previousBounds;
CGRect _previousFrame;

[Preserve(Conditional = true)]
public ShadowView(CALayer shadowee)
{
_shadowee = shadowee;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ImageButtonRenderer : ViewRenderer<ImageButton, UIButton>, IImageVi
readonly nfloat _minimumButtonHeight = 44; // Apple docs


[Preserve(Conditional = true)]
public ImageButtonRenderer() : base()
{
ButtonElementManager.Init(this);
Expand Down
2 changes: 2 additions & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using UIKit;
using Xamarin.Forms.Internals;
using RectangleF = CoreGraphics.CGRect;
using PreserveAttribute = Foundation.PreserveAttribute;

namespace Xamarin.Forms.Platform.iOS
{
Expand All @@ -32,6 +33,7 @@ public class ImageRenderer : ViewRenderer<Image, FormsUIImageView>, IImageVisual
{
bool _isDisposed;

[Preserve(Conditional = true)]
public ImageRenderer() : base()
{
ImageElementManager.Init(this);
Expand Down
1 change: 1 addition & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class NavigationRenderer : UINavigationController, IVisualElementRenderer
UIImage _defaultNavBarShadowImage;
UIImage _defaultNavBarBackImage;

[Preserve(Conditional = true)]
public NavigationRenderer() : base(typeof(FormsNavigationBar), null)
{
MessagingCenter.Subscribe<IVisualElementRenderer>(this, UpdateToolbarButtons, sender =>
Expand Down
1 change: 1 addition & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class PageRenderer : UIViewController, IVisualElementRenderer, IEffectCon
Thickness _userPadding = default(Thickness);
bool _userOverriddenSafeArea = false;

[Preserve(Conditional = true)]
public PageRenderer()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class PhoneMasterDetailRenderer : UIViewController, IVisualElementRendere
Page Page => Element as Page;


[Preserve(Conditional = true)]
public PhoneMasterDetailRenderer()
{
}
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Platform.iOS/Renderers/RefreshViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ bool TryOffsetRefresh(UIView view, bool refreshing)
return true;
}

if (view is UIWebView)
if (view is WkWebViewRenderer)
{
return true;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ bool TryInsertRefresh(UIView view, int index = 0)
return true;
}

if (view is UIWebView webView)
if (view is WkWebViewRenderer webView)
{
webView.ScrollView.InsertSubview(_refreshControl, index);
return true;
Expand Down
1 change: 1 addition & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ScrollViewRenderer : UIScrollView, IVisualElementRenderer, IEffectC
bool _checkedForRtlScroll = false;
bool _previousLTR = true;

[Preserve(Conditional = true)]
public ScrollViewRenderer() : base(RectangleF.Empty)
{
ScrollAnimationEnded += HandleScrollAnimationEnded;
Expand Down
6 changes: 6 additions & 0 deletions Xamarin.Forms.Platform.iOS/Renderers/WkWebViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using UIKit;
using WebKit;
using Xamarin.Forms.Internals;
using PreserveAttribute = Foundation.PreserveAttribute;
using Uri = System.Uri;

namespace Xamarin.Forms.Platform.iOS
Expand All @@ -20,10 +21,15 @@ public class WkWebViewRenderer : WKWebView, IVisualElementRenderer, IWebViewDele
#pragma warning disable 0414
VisualElementTracker _tracker;
#pragma warning restore 0414


[Preserve(Conditional = true)]
public WkWebViewRenderer() : base(RectangleF.Empty, new WKWebViewConfiguration())
{
}


[Preserve(Conditional = true)]
public WkWebViewRenderer(WKWebViewConfiguration config) : base(RectangleF.Empty, config)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
<Compile Include="Extensions\VisualElementExtensions.cs" />
<Compile Include="Flags.cs" />
<Compile Include="IOSDeviceInfo.cs" />
<Compile Include="LinkerSafeAttribute.cs" />
<Compile Include="ModalWrapper.cs" />
<Compile Include="Renderers\FormsCAKeyFrameAnimation.cs" />
<Compile Include="Renderers\FormsCheckBox.cs" />
Expand Down