Skip to content

Commit

Permalink
Merge branch 'release/0.77.1' of https://github.com/realm/realm-dotnet
Browse files Browse the repository at this point in the history
…into release/0.77.1

* 'release/0.77.1' of https://github.com/realm/realm-dotnet:
  Fix signature mismatch in PCL ToNotifyCollectionChanged - tweak IOS options
  Fix signature mismatch in PCL ToNotifyCollectionChanged - delete bogus copy
  Fix signature mismatch in PCL ToNotifyCollectionChanged - add libwrappers.so to Droid project and ensure builds for all ABIs
  Fix signature mismatch in PCL ToNotifyCollectionChanged
  • Loading branch information
AndyDentFree committed Jul 27, 2016
2 parents 6ac0b1d + 648ee44 commit 22d250b
Show file tree
Hide file tree
Showing 25 changed files with 909 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Minor Changes
* Fixed a bug weaving pure PCL projects, released in v0.77.0 (#715)
* Exception messages caused by using incompatible arguments in LINQ now include the offending argument (#719)
* PCL projects using ToNotifyCollectionChanged may have crashed due to mismatch between PCL signatures and platform builds.

Uses core 1.4.0

Expand Down
9 changes: 5 additions & 4 deletions Realm.PCL/Extensions/RealmResultsCollectionChangedPCL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using System;
using System.Collections.Specialized;
using System.Linq;

namespace Realms
{
Expand All @@ -26,11 +27,11 @@ public static class RealmResultsCollectionChanged
/// <summary>
/// Wraps a <see cref="RealmResults{T}" /> in an implementation of <see cref="INotifyCollectionChanged" /> so that it may be used in MVVM databinding.
/// </summary>
/// <param name="results">The <see cref="RealmResults{T}"/ > to observe for changes.</param>
/// <param name="results">The <see cref="RealmResults{T}"/> to observe for changes.</param>
/// <param name="errorCallback">An error callback that will be invoked if the observing thread raises an error.</param>
/// <returns>An <see cref="ObservableCollection{T}" />-like object useful for MVVM databinding.</returns>
/// <seealso cref="RealmResults{T}.SubscribeForNotifications(RealmResults{T}.NotificationCallback)"/>
public static INotifyCollectionChanged ToNotifyCollectionChanged<T>(this RealmResults<T> results, Action<Exception> errorCallback) where T : RealmObject
public static INotifyCollectionChanged ToNotifyCollectionChanged<T>(this IOrderedQueryable<T> results, Action<Exception> errorCallback) where T : RealmObject
{
RealmPCLHelpers.ThrowProxyShouldNeverBeUsed();
return null;
Expand All @@ -39,15 +40,15 @@ public static INotifyCollectionChanged ToNotifyCollectionChanged<T>(this RealmRe
/// <summary>
/// Wraps a <see cref="RealmResults{T}" /> in an implementation of <see cref="INotifyCollectionChanged" /> so that it may be used in MVVM databinding.
/// </summary>
/// <param name="results">The <see cref="RealmResults{T}"/ > to observe for changes.</param>
/// <param name="results">The <see cref="RealmResults{T}"/> to observe for changes.</param>
/// <param name="errorCallback">An error callback that will be invoked if the observing thread raises an error.</param>
/// <param name="coalesceMultipleChangesIntoReset">
/// When a lot of items have been added or removed at once it is more efficient to raise <see cref="INotifyCollectionChanged.CollectionChanged" /> once
/// with <see cref="NotifyCollectionChangedAction.Reset" /> instead of multiple times for every single change. Pass <c>true</c> to opt-in to this behavior.
/// </param>
/// <returns>An <see cref="ObservableCollection{T}" />-like object useful for MVVM databinding.</returns>
/// <seealso cref="RealmResults{T}.SubscribeForNotifications(RealmResults{T}.NotificationCallback)"/>
public static INotifyCollectionChanged ToNotifyCollectionChanged<T>(this RealmResults<T> results, Action<Exception> errorCallback, bool coalesceMultipleChangesIntoReset) where T : RealmObject
public static INotifyCollectionChanged ToNotifyCollectionChanged<T>(this IOrderedQueryable<T> results, Action<Exception> errorCallback, bool coalesceMultipleChangesIntoReset) where T : RealmObject
{
RealmPCLHelpers.ThrowProxyShouldNeverBeUsed();
return null;
Expand Down
2 changes: 1 addition & 1 deletion Realm.PCL/RealmResultsPCL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Realms
/// Iterable collection of one kind of RealmObject resulting from Realm.All or from a LINQ query expression.
/// </summary>
/// <typeparam name="T">Type of the RealmObject which is being returned.</typeparam>
public class RealmResults<T> : IQueryable<T>
public class RealmResults<T> : IOrderedQueryable<T>
{
/// <summary>
/// A <see cref="ChangeSet" /> describes the changes inside a <see cref="RealmResults{T}" /> since the last time the notification callback was invoked.
Expand Down
19 changes: 19 additions & 0 deletions Tests/QuickJournalLocal/Droid/Assets/AboutAssets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".

These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:

public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

InputStream input = Assets.Open ("my_asset.txt");
}
}

Additionally, some Android functions will automatically load asset files:

Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
4 changes: 4 additions & 0 deletions Tests/QuickJournalLocal/Droid/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<RealmWeaver/>
</Weavers>
6 changes: 6 additions & 0 deletions Tests/QuickJournalLocal/Droid/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.realm.quickjournal">
<uses-sdk android:minSdkVersion="15" />
<application android:label="QuickJournal">
</application>
</manifest>
28 changes: 28 additions & 0 deletions Tests/QuickJournalLocal/Droid/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("QuickJournal.Droid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("kristian")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

155 changes: 155 additions & 0 deletions Tests/QuickJournalLocal/Droid/QuickJournalLocal.Droid.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{3475C117-C5FE-47C2-8F65-5B54C6FA0F77}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>QuickJournal.Droid</RootNamespace>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidApplication>True</AndroidApplication>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<AssemblyName>QuickJournal.Droid</AssemblyName>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
<AndroidSupportedAbis>arm64-v8a;armeabi-v7a;x86;x86_64</AndroidSupportedAbis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<ConsolePause>false</ConsolePause>
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="Xamarin.Android.Support.v4">
<HintPath>..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
<HintPath>..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable">
<HintPath>..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
<HintPath>..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Design">
<HintPath>..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.CardView">
<HintPath>..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.MediaRouter">
<HintPath>..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath>
</Reference>
<Reference Include="DotNetCross.Memory.Unsafe">
<HintPath>..\packages\DotNetCross.Memory.Unsafe.0.2.2\lib\portable-net40+win8+sl4+wp7\DotNetCross.Memory.Unsafe.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.RecyclerView">
<HintPath>..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.Android">
<HintPath>..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
</Reference>
<Reference Include="FormsViewGroup">
<HintPath>..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.3.0.107\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QuickJournal\QuickJournalLocal.csproj">
<Project>{55AF89D0-2F10-4515-AF03-D9C2A657A348}</Project>
<Name>QuickJournalLocal</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Realm.XamarinAndroid\Realm.XamarinAndroid.csproj">
<Project>{2379D669-4F4B-4FF6-AF8A-49FEA981EFC3}</Project>
<Name>Realm.XamarinAndroid</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\..\..\examples\QuickJournal\Droid\MainActivity.cs">
<Link>MainActivity.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
<None Include="packages.config" />
<None Include="FodyWeavers.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\layout\" />
<Folder Include="Resources\values\" />
<Folder Include="Resources\drawable\" />
<Folder Include="Resources\drawable-hdpi\" />
<Folder Include="Resources\drawable-xhdpi\" />
<Folder Include="Resources\drawable-xxhdpi\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Import Project="..\packages\Realm.0.76.1\build\Realm.targets" Condition="Exists('..\packages\Realm.0.76.1\build\Realm.targets')" />
<Import Project="..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Debug-android\armeabi-v7a\libwrappers.so">
<Link>wrappers\armeabi-v7\libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Debug-android\x86\libwrappers.so">
<Link>wrappers\x86\libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Debug-android\x86_64\libwrappers.so">
<Link>wrappers\x86_64\libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Debug-android\arm64-v8a\libwrappers.so">
<Link>wrappers\arm64-v8a\libwrappers.so</Link>
</AndroidNativeLibrary>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Release-android\armeabi-v7a\libwrappers.so">
<Link>wrappers\armeabi-v7\libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Release-android\x86\libwrappers.so">
<Link>wrappers\x86\libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Release-android\x86_64\libwrappers.so">
<Link>wrappers\x86_64\libwrappers.so</Link>
</AndroidNativeLibrary>
<AndroidNativeLibrary Include="..\..\..\wrappers\build\Release-android\arm64-v8a\libwrappers.so">
<Link>wrappers\arm64-v8a\libwrappers.so</Link>
</AndroidNativeLibrary>
</ItemGroup>
</Project>
44 changes: 44 additions & 0 deletions Tests/QuickJournalLocal/Droid/Resources/AboutResources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.

For example, a sample Android app that contains a user interface layout (main.axml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:

Resources/
drawable/
icon.png

layout/
main.axml

values/
strings.xml

In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called "R"
(this is an Android convention) that contains the tokens for each one of the resources
included. For example, for the above Resources layout, this is what the R class would expose:

public class R {
public class drawable {
public const int icon = 0x123;
}

public class layout {
public const int main = 0x456;
}

public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}

You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
to reference the layout/main.axml file, or R.strings.first_string to reference the first
string in the dictionary file values/strings.xml.
Empty file.
14 changes: 14 additions & 0 deletions Tests/QuickJournalLocal/Droid/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetCross.Memory.Unsafe" version="0.2.2" targetFramework="MonoAndroid60" />
<package id="Fody" version="1.29.4" targetFramework="MonoAndroid60" developmentDependency="true" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Forms" version="2.3.0.107" targetFramework="MonoAndroid60" />
</packages>
5 changes: 5 additions & 0 deletions Tests/QuickJournalLocal/QuickJournal/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<RealmWeaver/>

</Weavers>
27 changes: 27 additions & 0 deletions Tests/QuickJournalLocal/QuickJournal/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("QuickJournal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("kristian")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Loading

0 comments on commit 22d250b

Please sign in to comment.