Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Preserve attribute (#140)
Browse files Browse the repository at this point in the history
* Adds PreserveAttribute

* Removes dependency from File plugin

* Preserves Plugins and PluginLoaders

* Fixes FilePlugin initialization

* Fixes VisibilityPlugin initialization

* Fix for ResourceLoader plugin

* Fix for Network plugin

* Fixes Browser Plugin

* Fixes Color Plugin

* Fixes Visibility plugin

* Fixes Accelerometer and File Plugins

* Fixes Accelerometer, Email, Location and Messenger

* Fixes Share and PhoneCall Plugins

* Fixes a bunch of Plugins

I couldn’t test those in actual projects, so I preserved all classes
that were registered by the Plugin

* Fixes Json, SQLite and PictureChooser Plugins
  • Loading branch information
heytherewill authored and martijn00 committed Oct 17, 2016
1 parent fa865f3 commit c4751db
Show file tree
Hide file tree
Showing 184 changed files with 333 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace MvvmCross.Plugins.Accelerometer.Droid
{
[Preserve(AllMembers = true)]
public class MvxAccelerometer
: Java.Lang.Object
, ISensorEventListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace MvvmCross.Plugins.Accelerometer.Droid
{
[Preserve(AllMembers = true)]
public class Plugin
: IMvxPlugin
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace MvvmCross.Plugins.Accelerometer.iOS
{
[Preserve(AllMembers = true)]
public class Plugin
: IMvxPlugin
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace MvvmCross.Plugins.Accelerometer.iOS
{
[Preserve(AllMembers = true)]
public class MvxAccelerometer
: IMvxAccelerometer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<Compile Include="PluginLoader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MvxAccelerometerReading.cs" />
<Compile Include="..\..\All\MvvmCross.Plugins.All\Preserve.cs">
<Link>Preserve.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Reference Include="MvvmCross.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace MvvmCross.Plugins.Accelerometer
{
[Preserve(AllMembers = true)]
public class MvxAccelerometerReading
{
public double X { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace MvvmCross.Plugins.Accelerometer
{
[Preserve(AllMembers = true)]
public class PluginLoader
: IMvxPluginLoader
{
Expand Down
1 change: 1 addition & 0 deletions All/MvvmCross.Plugins.All/MvvmCross.Plugins.All.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<ItemGroup>
<Compile Include="PluginLoader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Preserve.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="MvvmCross.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
1 change: 1 addition & 0 deletions All/MvvmCross.Plugins.All/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace MvvmCross.Plugins.All
{
[Preserve(AllMembers = true)]
public class PluginLoader
: IMvxPluginLoader
{
Expand Down
12 changes: 12 additions & 0 deletions All/MvvmCross.Plugins.All/Preserve.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace MvvmCross.Plugins
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate)]
public sealed class PreserveAttribute : Attribute
{
public bool AllMembers;

public bool Conditional;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
<Compile Include="IMvxBookmarkLibrarian.cs" />
<Compile Include="PluginLoader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\..\All\MvvmCross.Plugins.All\Preserve.cs">
<Link>Preserve.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace MvvmCross.Plugins.Bookmarks
{
#warning this bookmark code may be too wp7 sepcific?

[Preserve(AllMembers = true)]
public class MvxBookmarkMetadata
{
public Uri BackgroundImageUri { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Bookmarks/MvvmCross.Plugins.Bookmarks/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace MvvmCross.Plugins.Bookmarks
{
[Preserve(AllMembers = true)]
public class PluginLoader
: IMvxPluginLoader
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace MvvmCross.Plugins.Color.Droid.BindingTargets
{
[Preserve(AllMembers = true)]
public class MvxDefaultColorBindingSet
{
public void RegisterBindings()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace MvvmCross.Plugins.Color.Droid.BindingTargets
{
[Preserve(AllMembers = true)]
public class MvxTextViewTextColorBinding
: MvxViewColorBinding
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace MvvmCross.Plugins.Color.Droid.BindingTargets
{
[Preserve(AllMembers = true)]
public class MvxViewBackgroundColorBinding
: MvxViewColorBinding
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

namespace MvvmCross.Plugins.Color.Droid.BindingTargets
{
public abstract class MvxViewColorBinding
[Preserve(AllMembers = true)]
public abstract class MvxViewColorBinding
: MvxAndroidTargetBinding
{
protected View TextView => (View) base.Target;
Expand Down
1 change: 1 addition & 0 deletions Color/MvvmCross.Plugins.Color.Droid/MvxAndroidColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace MvvmCross.Plugins.Color.Droid
{
[Preserve(AllMembers = true)]
public class MvxAndroidColor : IMvxNativeColor
{
public object ToNative(MvxColor mvxColor)
Expand Down
1 change: 1 addition & 0 deletions Color/MvvmCross.Plugins.Color.Droid/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace MvvmCross.Plugins.Color.Droid
{
[Preserve(AllMembers = true)]
public class Plugin
: IMvxPlugin
{
Expand Down
1 change: 1 addition & 0 deletions Color/MvvmCross.Plugins.Color.iOS/MvxTouchColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace MvvmCross.Plugins.Color.iOS
{
[Preserve(AllMembers = true)]
public class MvxIosColor : IMvxNativeColor
{
public object ToNative(MvxColor mvxColor)
Expand Down
1 change: 1 addition & 0 deletions Color/MvvmCross.Plugins.Color.iOS/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace MvvmCross.Plugins.Color.iOS
{
[Preserve(AllMembers = true)]
public class Plugin
: IMvxPlugin

Expand Down
3 changes: 3 additions & 0 deletions Color/MvvmCross.Plugins.Color/MvvmCross.Plugins.Color.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MvxColorValueConverter.cs" />
<Compile Include="MvxNativeColorValueConverter.cs" />
<Compile Include="..\..\All\MvvmCross.Plugins.All\Preserve.cs">
<Link>Preserve.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
3 changes: 2 additions & 1 deletion Color/MvvmCross.Plugins.Color/MvxARGBValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

namespace MvvmCross.Plugins.Color
{
public class MvxARGBValueConverter : MvxRGBValueConverter
[Preserve(AllMembers = true)]
public class MvxARGBValueConverter : MvxRGBValueConverter
{
protected override MvxColor Parse8DigitColor(string value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace MvvmCross.Plugins.Color
{
public class MvxNativeColorValueConverter : MvxColorValueConverter<MvxColor>
[Preserve(AllMembers = true)]
public class MvxNativeColorValueConverter : MvxColorValueConverter<MvxColor>
{
protected override MvxColor Convert(MvxColor value, object parameter, CultureInfo culture)
{
Expand Down
3 changes: 2 additions & 1 deletion Color/MvvmCross.Plugins.Color/MvxRGBAValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

namespace MvvmCross.Plugins.Color
{
public class MvxRGBAValueConverter : MvxRGBValueConverter
[Preserve(AllMembers = true)]
public class MvxRGBAValueConverter : MvxRGBValueConverter
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace MvvmCross.Plugins.Color
{
public class MvxRGBIntColorValueConverter : MvxColorValueConverter<int>
[Preserve(AllMembers = true)]
public class MvxRGBIntColorValueConverter : MvxColorValueConverter<int>
{
protected override MvxColor Convert(int value, object parameter, CultureInfo culture)
{
Expand Down
3 changes: 2 additions & 1 deletion Color/MvvmCross.Plugins.Color/MvxRGBValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

namespace MvvmCross.Plugins.Color
{
public class MvxRGBValueConverter : MvxColorValueConverter<string>
[Preserve(AllMembers = true)]
public class MvxRGBValueConverter : MvxColorValueConverter<string>
{
protected override MvxColor Convert(string value, object parameter, CultureInfo culture)
{
Expand Down
1 change: 1 addition & 0 deletions Color/MvvmCross.Plugins.Color/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace MvvmCross.Plugins.Color
{
[Preserve(AllMembers = true)]
public class PluginLoader
: IMvxPluginLoader
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace MvvmCross.Plugins.DownloadCache.Droid
{
public class MvxAndroidImage
[Preserve(AllMembers = true)]
public class MvxAndroidImage
: MvxImage<Bitmap>
{
public MvxAndroidImage(Bitmap rawImage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

namespace MvvmCross.Plugins.DownloadCache.Droid
{
public class MvxAndroidLocalFileImageLoader
[Preserve(AllMembers = true)]
public class MvxAndroidLocalFileImageLoader
: IMvxLocalFileImageLoader<Bitmap>
{
private const string ResourcePrefix = "res:";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace MvvmCross.Plugins.DownloadCache.Droid
{
public class MvxDownloadCacheConfiguration
[Preserve(AllMembers = true)]
public class MvxDownloadCacheConfiguration
: IMvxPluginConfiguration
{
public static readonly MvxDownloadCacheConfiguration Default = new MvxDownloadCacheConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace MvvmCross.Plugins.DownloadCache.Droid
{
[Preserve(AllMembers = true)]
public class Plugin
: IMvxConfigurablePlugin
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

namespace MvvmCross.Plugins.DownloadCache.iOS
{
public class MvxDownloadCacheConfiguration
[Preserve(AllMembers = true)]
public class MvxDownloadCacheConfiguration
: IMvxPluginConfiguration
{
public static readonly MvxDownloadCacheConfiguration Default = new MvxDownloadCacheConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

namespace MvvmCross.Plugins.DownloadCache.iOS
{
public class MvxIosImage
[Preserve(AllMembers = true)]
public class MvxIosImage
: MvxImage<UIImage>
{
public MvxIosImage(UIImage rawImage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

namespace MvvmCross.Plugins.DownloadCache.iOS
{
public class MvxIosLocalFileImageLoader
[Preserve(AllMembers = true)]
public class MvxIosLocalFileImageLoader
: MvxAllThreadDispatchingObject
, IMvxLocalFileImageLoader<UIImage>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace MvvmCross.Plugins.DownloadCache.iOS
{
#warning One day I would like to decouple this plugin from the FileStore plugin

[Preserve(AllMembers = true)]
public class Plugin
: IMvxConfigurablePlugin
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

namespace MvvmCross.Plugins.DownloadCache
{
public class MvxDynamicImageHelper<T>
[Preserve(AllMembers = true)]
public class MvxDynamicImageHelper<T>
: IMvxImageHelper<T>
where T : class
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

namespace MvvmCross.Plugins.DownloadCache
{
public class MvxFileDownloadCache
[Preserve(AllMembers = true)]
public class MvxFileDownloadCache
: MvxLockableObject
, IMvxFileDownloadCache
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

namespace MvvmCross.Plugins.DownloadCache
{
public class MvxFileDownloadedEventArgs
[Preserve(AllMembers = true)]
public class MvxFileDownloadedEventArgs
: EventArgs
{
public MvxFileDownloadedEventArgs(string url, string downloadPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

namespace MvvmCross.Plugins.DownloadCache
{
public static class MvxFileStoreHelper
[Preserve(AllMembers = true)]
public static class MvxFileStoreHelper
{
public static IMvxFileStore SafeGetFileStore()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

namespace MvvmCross.Plugins.DownloadCache
{
public class MvxHttpFileDownloader
[Preserve(AllMembers = true)]
public class MvxHttpFileDownloader
: MvxLockableObject
, IMvxHttpFileDownloader
{
Expand Down
3 changes: 2 additions & 1 deletion DownloadCache/MvvmCross.Plugins.DownloadCache/MvxImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

namespace MvvmCross.Plugins.DownloadCache
{
public abstract class MvxImage<T>
[Preserve(AllMembers = true)]
public abstract class MvxImage<T>
{
protected MvxImage(T rawImage)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

namespace MvvmCross.Plugins.DownloadCache
{
public class MvxImageCache<T>
[Preserve(AllMembers = true)]
public class MvxImageCache<T>
: MvxAllThreadDispatchingObject
, IMvxImageCache<T>
{
Expand Down
Loading

0 comments on commit c4751db

Please sign in to comment.