Merged PR 2900: Update Xamarin for 0.6.2 Release

Update Xamarin for 0.6.2 Release
This commit is contained in:
Nate Peterson 2017-08-28 23:43:49 +00:00
Родитель db001204be
Коммит 6261af0eea
8 изменённых файлов: 243 добавлений и 15 удалений

Просмотреть файл

@ -0,0 +1,145 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Microsoft.ConnectedDevices
{
public partial class AppServiceConnection
{
private AppServiceRequestListener appServiceRequestListener = null;
private AppServiceConnectionInternal appServiceConnection = null;
private AppServiceConnectionListener connectionListener = null;
//
// Summary:
// The event that is raised when an AppService request is received.
public event OnRequestReceived RequestReceived;
public delegate void OnRequestReceived(AppServiceRequest request);
internal void InvokeRequestReceived(AppServiceRequest request)
{
RequestReceived?.Invoke(request);
}
public AppServiceConnection(string appServiceName, string appIdentifier, RemoteSystemConnectionRequest request)
{
appServiceConnection = new AppServiceConnectionInternal(appServiceName, appIdentifier, request, GetAppServiceConnectionListener(), GetAppServiceRequestListener(this));
}
public Task<AppServiceConnectionStatus> OpenRemoteAsync()
{
TaskCompletionSource<AppServiceConnectionStatus> tcsConnectionListener = new TaskCompletionSource<AppServiceConnectionStatus>();
// We don't "need" to remove the lambda once it's done since previous
// tcsConnectionListener's will gracefully fail when called multiple times
connectionListener.ConnectedStatus += (r) =>
{
tcsConnectionListener.TrySetResult(r);
};
try
{
appServiceConnection.OpenRemoteAsynchronous();
}
catch (Exception e)
{
tcsConnectionListener.TrySetException(e);
}
return tcsConnectionListener.Task;
}
public Task<AppServiceResponse> SendMessageAsync(Android.OS.Bundle message)
{
TaskCompletionSource<AppServiceResponse> tcsResponseListener = new TaskCompletionSource<AppServiceResponse>();
AppServiceResponseListener.OnResponseReceived onResponseReceived = (r) =>
{
tcsResponseListener.TrySetResult(r);
};
var responseListener = new AppServiceResponseListener(onResponseReceived);
try
{
appServiceConnection.SendMessageAsynchronous(message, responseListener);
}
catch (Exception e)
{
tcsResponseListener.TrySetException(e);
}
return tcsResponseListener.Task;
}
private AppServiceConnectionListener GetAppServiceConnectionListener()
{
connectionListener = new AppServiceConnectionListener();
return connectionListener;
}
private AppServiceRequestListener GetAppServiceRequestListener(AppServiceConnection c)
{
appServiceRequestListener = new AppServiceRequestListener(c);
return appServiceRequestListener;
}
internal class AppServiceConnectionListener : Java.Lang.Object, IAppServiceConnectionListener
{
public event Action<AppServiceConnectionStatus> ConnectedStatus;
public void OnSuccess()
{
this.ConnectedStatus?.Invoke(AppServiceConnectionStatus.Success);
}
public void OnError(AppServiceConnectionStatus status)
{
this.ConnectedStatus?.Invoke(status);
}
public void OnClosed(AppServiceConnectionClosedStatus status) {}
}
internal class AppServiceResponseListener : Java.Lang.Object, IAppServiceResponseListener
{
public delegate void OnResponseReceived(AppServiceResponse status);
private OnResponseReceived onResponseReceived;
public AppServiceResponseListener(OnResponseReceived onReceived)
{
this.onResponseReceived = onReceived;
}
public void ResponseReceived(AppServiceResponse response)
{
this.onResponseReceived(response);
}
}
internal class AppServiceRequestListener : Java.Lang.Object, IAppServiceRequestListener
{
private AppServiceConnection connection;
public AppServiceRequestListener(AppServiceConnection c)
{
this.connection = c;
}
public void RequestReceived(AppServiceRequest request)
{
this.connection.InvokeRequestReceived(request);
}
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using System.Threading.Tasks;
namespace Microsoft.ConnectedDevices
{
public partial class AppServiceRequest
{
private TaskCompletionSource<AppServiceResponseStatus> tcsResponseStatusListener = null;
public Task<AppServiceResponseStatus> SendResponseAsync(Android.OS.Bundle message)
{
try
{
SendResponseAsynchronous(message, GetAppServiceResponseStatusListener());
}
catch (Exception e)
{
tcsResponseStatusListener.TrySetException(e);
}
return tcsResponseStatusListener.Task;
}
private AppServiceResponseStatusListener GetAppServiceResponseStatusListener()
{
AppServiceResponseStatusListener.OnResponseReceived onResponseReceived = (r) =>
{
tcsResponseStatusListener.TrySetResult(r);
};
tcsResponseStatusListener = new TaskCompletionSource<AppServiceResponseStatus>();
var responseStatusListener = new AppServiceResponseStatusListener(onResponseReceived);
return responseStatusListener;
}
internal class AppServiceResponseStatusListener : Java.Lang.Object, IAppServiceResponseStatusListener
{
public delegate void OnResponseReceived(AppServiceResponseStatus status);
private OnResponseReceived onResponseReceived;
public AppServiceResponseStatusListener(OnResponseReceived onReceived)
{
this.onResponseReceived = onReceived;
}
public void StatusReceived(AppServiceResponseStatus status)
{
this.onResponseReceived(status);
}
}
}
}

Просмотреть файл

@ -26,8 +26,8 @@ namespace Microsoft.ConnectedDevices
{
tcs.TrySetResult(r);
};
RemoteLauncher.LaunchUriAsync(connectionRequest, uri.OriginalString, launchUriListener);
RemoteLauncher.LaunchUriAsync(connectionRequest, SystemUriToAndroidUri(uri), launchUriListener);
}
catch (Exception e)
{
@ -36,6 +36,11 @@ namespace Microsoft.ConnectedDevices
return tcs.Task;
}
private static Android.Net.Uri SystemUriToAndroidUri(System.Uri uri)
{
return Android.Net.Uri.Parse(uri.OriginalString);
}
}
internal class LaunchURIListener : Java.Lang.Object, IRemoteLauncherListener

Просмотреть файл

@ -12,8 +12,8 @@
<RootNamespace>Microsoft.ConnectedDevices.Xamarin.Droid</RootNamespace>
<AssemblyName>Microsoft.ConnectedDevices.Xamarin.Droid</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v4.4</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<AndroidClassParser>class-parse</AndroidClassParser>
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
</PropertyGroup>
@ -64,7 +64,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Additions\Platform.cs" />
<Compile Include="Additions\AppServiceClientConnection.cs" />
<Compile Include="Additions\AppServiceConnection.cs" />
<Compile Include="Additions\AppServiceRequest.cs" />
<Compile Include="Additions\RemoteLauncher.cs" />
<Compile Include="Additions\RemoteSystem.cs" />
<Compile Include="Additions\RemoteSystemWatcher.cs" />

Просмотреть файл

@ -25,5 +25,5 @@ using Android.App;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyVersion("0.6.2.0")]
[assembly: AssemblyFileVersion("0.6.2.0")]

Просмотреть файл

@ -10,9 +10,17 @@
<!-- Change the visibility of a class -->
<attr path="/api/package[@name='com.microsoft.connecteddevices']" name="managedName">Microsoft.ConnectedDevices</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='Listenable']" name="visibility">public</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection']/method[@name='sendMessageAsync']" name="visibility">private</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection']/method[@name='openRemoteAsync']" name="visibility">private</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IWebAccountProvider']" name="visibility">public</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection']/method[@name='openRemoteAsync']" name="managedName">OpenRemoteAsynchronous</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection']/method[@name='sendMessageAsync']" name="managedName">SendMessageAsynchronous</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IBinaryClientListenerInternal']" name="visibility">internal</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IDeviceListenerInternal']" name="visibility">internal</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='Platform.IWebAccountProviderObjectCache']" name="visibility">internal</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='Platform.IWebAccountProviderFirstTokenFetchCallback']" name="visibility">internal</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='Platform.WebAccountProviderObjectType']" name="visibility">internal</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='Platform.OAuthWebAccountProvider.RefreshTokenRefresher']" name="visibility">internal</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceConnection']/method[@name='sendMessageAsync']" name="managedName">SendMessageAsynchronous</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceConnection']/method[@name='openRemoteAsync']" name="managedName">OpenRemoteAsynchronous</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceConnection']" name="managedName">AppServiceConnectionInternal</attr>
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceRequest']/method[@name='sendResponseAsync']" name="managedName">SendResponseAsynchronous</attr>
</metadata>

Просмотреть файл

@ -1,20 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectedDevices.Xamarin.Droid", "ConnectedDevices.Xamarin.Droid\ConnectedDevices.Xamarin.Droid.csproj", "{56EC46C7-3A80-46A1-86F0-652D2D8AD461}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Debug|x86.ActiveCfg = Debug|x86
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Debug|x86.Build.0 = Debug|x86
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Release|Any CPU.Build.0 = Release|Any CPU
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Release|x86.ActiveCfg = Release|x86
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -1,4 +1,4 @@
$version = "0.4.0"
$version = "0.6.2"
"Downloading connecteddevices-sdk-armv7-externalRelease.aar..."
Invoke-WebRequest https://projectrome.bintray.com/maven/com/microsoft/connecteddevices/connecteddevices-sdk-armv7/$version/connecteddevices-sdk-armv7-$version-release.aar -OutFile ConnectedDevices.Xamarin.Droid\Jars\connecteddevices-sdk-armv7-release.aar
Invoke-WebRequest http://projectrome.bintray.com/maven/com/microsoft/connecteddevices/connecteddevices-sdk-armeabi-v7a/$version/connecteddevices-sdk-armeabi-v7a-$version-release.aar -OutFile ConnectedDevices.Xamarin.Droid\Jars\connecteddevices-sdk-armv7-externalRelease.aar