diff --git a/Android-Libtester/Android-Libtester.csproj b/Android-Libtester/Android-Libtester.csproj index 521b005c..107a73b7 100644 --- a/Android-Libtester/Android-Libtester.csproj +++ b/Android-Libtester/Android-Libtester.csproj @@ -14,7 +14,7 @@ True True Android-Libtester - v4.4 + v5.0 Properties\AndroidManifest.xml diff --git a/Kinvey-Xamarin.userprefs b/Kinvey-Xamarin.userprefs index 26fcd5ea..108ffd17 100644 --- a/Kinvey-Xamarin.userprefs +++ b/Kinvey-Xamarin.userprefs @@ -1,13 +1,12 @@ - - - + + + - - - - - - + + + + + @@ -51,28 +50,21 @@ - - - - - - - - - + - - - - + + + + + diff --git a/Kinvey-Xamarin/Async/AsyncFile.cs b/Kinvey-Xamarin/Async/AsyncFile.cs index d1aa1fb8..90eb87fb 100644 --- a/Kinvey-Xamarin/Async/AsyncFile.cs +++ b/Kinvey-Xamarin/Async/AsyncFile.cs @@ -36,12 +36,14 @@ public AsyncFile (AbstractClient client) : base(client) /// The FileMetaData representing the file to download. This must contain an id. /// Where the contents of the file will be streamed. /// Delegates for success or failure. - public void download(FileMetaData metadata, Stream content, KinveyDelegate delegates) + public void download(FileMetaData metadata, Stream content, KinveyFileDelegate delegates) { Task.Run (() => { try { - FileMetaData entity = base.downloadBlocking (metadata).executeAndDownloadTo (content); - delegates.onSuccess (entity); + Stream stream = new MemoryStream(); + FileMetaData entity = base.downloadBlocking (metadata).executeAndDownloadTo (ref stream); + //delegates.onSuccess (entity); + delegates.onDownload(stream); } catch (Exception e) { delegates.onError (e); } @@ -55,7 +57,7 @@ public void download(FileMetaData metadata, Stream content, KinveyDelegateThe FileMetaData representing the file to download. This must contain an id. /// Content. /// Delegates for success or failure. - public void download(FileMetaData metadata, byte[] content, KinveyDelegate delegates) + public void download(FileMetaData metadata, byte[] content, KinveyDelegate delegates) { Task.Run (() => { try { diff --git a/Kinvey-Xamarin/Async/KinveyFileDelegate.cs b/Kinvey-Xamarin/Async/KinveyFileDelegate.cs new file mode 100644 index 00000000..b246a0e7 --- /dev/null +++ b/Kinvey-Xamarin/Async/KinveyFileDelegate.cs @@ -0,0 +1,19 @@ +using System; +using System.IO; + +namespace KinveyXamarin +{ + /// + /// The Kinvey File Delegate class is used for the callback pattern when executing file specific requests asynchronously. All Async* File methods will take one as a parameter. + /// + public class KinveyFileDelegate : KinveyDelegate + { + /// + /// This Action is executed when the file is downloaded. + /// + public Action onDownload; + + + } +} + diff --git a/Kinvey-Xamarin/Core/KinveyHeaders.cs b/Kinvey-Xamarin/Core/KinveyHeaders.cs index 1408fcec..beecf658 100644 --- a/Kinvey-Xamarin/Core/KinveyHeaders.cs +++ b/Kinvey-Xamarin/Core/KinveyHeaders.cs @@ -28,7 +28,7 @@ public class KinveyHeaders : List /// /// The version of the library. /// - private static string version = "1.2.0"; + private static string version = "1.2.1"; /// /// The kinvey API version key. diff --git a/Kinvey-Xamarin/File/KinveyFileRequest.cs b/Kinvey-Xamarin/File/KinveyFileRequest.cs index 608e09c3..bbd6167f 100644 --- a/Kinvey-Xamarin/File/KinveyFileRequest.cs +++ b/Kinvey-Xamarin/File/KinveyFileRequest.cs @@ -35,9 +35,9 @@ public FileMetaData executeAndDownloadTo (byte[] output){ return metadata; } - public FileMetaData executeAndDownloadTo(Stream stream){ + public FileMetaData executeAndDownloadTo(ref Stream stream){ FileMetaData metadata = base.Execute (); - downloadFile (metadata, stream); + downloadFile (metadata, ref stream); return metadata; } @@ -53,7 +53,7 @@ public FileMetaData executeAndUploadFrom(Stream stream){ return metadata; } - private void downloadFile(FileMetaData metadata, Stream stream){ + private void downloadFile(FileMetaData metadata, ref Stream stream){ string downloadURL = metadata.downloadURL; RestClient client = new RestClient (downloadURL); @@ -61,11 +61,16 @@ private void downloadFile(FileMetaData metadata, Stream stream){ request.Method = Method.GET; - request.ResponseWriter = (responseStream) => responseStream.CopyTo (stream); + //request.ResponseWriter = (responseStream) => responseStream.CopyTo (stream); var req = client.DownloadDataAsync (request); var response = req.Result; + +//stream = new MemoryStream(); +//stream.Write(response, 0, response.Length); +//stream. +// stream = new MemoryStream (response); var x = 123; } diff --git a/Kinvey-Xamarin/Kinvey-Xamarin.csproj b/Kinvey-Xamarin/Kinvey-Xamarin.csproj index 861522f5..2ef7e365 100644 --- a/Kinvey-Xamarin/Kinvey-Xamarin.csproj +++ b/Kinvey-Xamarin/Kinvey-Xamarin.csproj @@ -86,6 +86,7 @@ + diff --git a/release/kinvey-xamarin-1.2.1.zip b/release/kinvey-xamarin-1.2.1.zip new file mode 100644 index 00000000..16e9b520 Binary files /dev/null and b/release/kinvey-xamarin-1.2.1.zip differ diff --git a/release/kinvey-xamarin-1.2.1/Kinvey-Utils.dll b/release/kinvey-xamarin-1.2.1/Kinvey-Utils.dll new file mode 100755 index 00000000..ae1d1bad Binary files /dev/null and b/release/kinvey-xamarin-1.2.1/Kinvey-Utils.dll differ diff --git a/release/kinvey-xamarin-1.2.1/Kinvey-Xamarin.dll b/release/kinvey-xamarin-1.2.1/Kinvey-Xamarin.dll new file mode 100755 index 00000000..955eb29e Binary files /dev/null and b/release/kinvey-xamarin-1.2.1/Kinvey-Xamarin.dll differ diff --git a/release/kinvey-xamarin-1.2.1/README.txt b/release/kinvey-xamarin-1.2.1/README.txt new file mode 100644 index 00000000..34ada68a --- /dev/null +++ b/release/kinvey-xamarin-1.2.1/README.txt @@ -0,0 +1,9 @@ +1. Right click the *References* folder within your project -> **Edit References** -> **.Net Assembly** -> Navigate to download location of kinvey library, and add all the dll files. +2. Right click your project -> **Add** -> **Add Packages** + 1. Add "Json.NET" v6.0.6 + 2. Add "SQLite.Net.Async PCL" v2.4.1 + 3. Add "SQLite.Net PCL - Platform" v2.4.1 where is your project's target platform + 4. Add "LinqExtender" v3.0.1 + 5. Add "Microsoft HTTP Client Libraries" v2.2.28 + 6. Add "Microsoft Async" v1.0.168 + 7. Add "Microsoft BCL Build Components" v1.0.14 \ No newline at end of file diff --git a/release/kinvey-xamarin-1.2.1/RestSharp.Portable.dll b/release/kinvey-xamarin-1.2.1/RestSharp.Portable.dll new file mode 100755 index 00000000..f8d16a51 Binary files /dev/null and b/release/kinvey-xamarin-1.2.1/RestSharp.Portable.dll differ