Skip to content

Commit

Permalink
sample: update sample for socket transport
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavisau committed Apr 13, 2022
1 parent 9e6b930 commit b8bd794
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/samples/prism/run-host.sh
@@ -1 +1 @@
dotnet run -c release --project ../../heads/tbc.host.console/tbc.host.console.csproj -- ./reload-config.json
dotnet run -f net6.0 -c release --project ../../heads/tbc.host.console/tbc.host.console.csproj -- ./reload-config.json
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?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.companyname.tbc.sample.prism">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="tbc.sample.prism.Android"></application>
</manifest>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
<application android:label="tbc.sample.prism.Android"></application>
</manifest>
Expand Up @@ -14,8 +14,7 @@
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -46,22 +45,18 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.12.3" />
<PackageReference Include="Grpc.Core" Version="2.30.0" />
<PackageReference Include="Grpc.Tools" Version="2.30.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Prism.DryIoc.Forms" Version="8.0.0.1909" />
<PackageReference Include="Prism.Forms" Version="8.0.0.1909" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
<PackageReference Include="tbc.target" Version="0.0.20210216.10" />
<PackageReference Include="tbc.target" Version="0.0.20220413.3" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.3" />
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.0" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.5" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand All @@ -81,7 +76,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\tbc.sample.prism\tbc.sample.prism.csproj">
<Project>{FEC29B52-B36E-43A7-9E04-5E6EA596E6DF}</Project>
<Project>{94CFA5B9-FF4C-4522-B116-7E942E7C727C}</Project>
<Name>tbc.sample.prism</Name>
</ProjectReference>
</ItemGroup>
Expand Down
Expand Up @@ -126,8 +126,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DryIoc.dll" Version="4.5.0" />
<PackageReference Include="Google.Protobuf" Version="3.14.0" />
<PackageReference Include="Grpc.Core" Version="2.30.0" />
<PackageReference Include="Prism.Core" Version="8.0.0.1909" />
<PackageReference Include="Prism.DryIoc.Forms" Version="8.0.0.1909" />
<PackageReference Include="Prism.Forms" Version="8.0.0.1909" />
Expand All @@ -141,32 +139,8 @@
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
<PackageReference Include="tbc.target" Version="0.0.20210216.10" />
<PackageReference Include="tbc.target" Version="0.0.20220413.3" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />

<Target Name="GrpcCoreShim" BeforeTargets="CoreCompile">
<PropertyGroup>
<GrpcCoreTargetsRelativePath>$(NugetPackageRoot)\grpc.core\2.30.0\build\Xamarin.iOS10\</GrpcCoreTargetsRelativePath>
</PropertyGroup>
<ConvertToAbsolutePath Paths="$(GrpcCoreTargetsRelativePath)">
<Output TaskParameter="AbsolutePaths" PropertyName="GrpcCoreTargetsAbsPath" />
</ConvertToAbsolutePath>
<ItemGroup>
<NativeReference Remove="libgrpc_csharp_ext.a" />
<NativeReference Remove="libgrpc.a" />
<NativeReference Include="$(GrpcCoreTargetsAbsPath)..\..\native\ios\universal\libgrpc_csharp_ext.a">
<Kind>Static</Kind>
<ForceLoad>True</ForceLoad>
<IsCxx>True</IsCxx>
</NativeReference>
<NativeReference Include="$(GrpcCoreTargetsAbsPath)..\..\native\ios\universal\libgrpc.a">
<Kind>Static</Kind>
<ForceLoad>True</ForceLoad>
<IsCxx>True</IsCxx>
</NativeReference>
</ItemGroup>
</Target>

</Project>
</Project>
@@ -1,17 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DryIoc;
using Prism.Navigation;
using Prism.Services;
using Serilog;
using Tbc.Protocol;
using Tbc.Core.Models;
using tbc.sample.prism.Extensions;
using Tbc.Target;
using Tbc.Target.Interfaces;
using Tbc.Target.Requests;
using Xamarin.Forms;
using static Tbc.Target.Extensions.TbcOutcome;
using static Tbc.Core.Models.Outcome;

namespace tbc.sample.prism
{
Expand Down Expand Up @@ -105,11 +106,22 @@ public override async Task<Outcome> ExecuteCommand(CommandRequest commandRequest
case "goto":
await Device.InvokeOnMainThreadAsync(
async () => await GotoPage(args.Any() ? args[0] : null, message:"where to my friend?"));
return Success();
return new Outcome { Success = true };

default:
_logger.Warning("No logic to handle command \"{Command}\" with args {@Args}", command, args);
return Failure($"No logic to handle command \"{command}\" with args {String.Join(", ", args)}");
return new Outcome
{
Success = true,
Messages = new List<OutcomeMessage>()
{
new OutcomeMessage
{
Message =
$"No logic to handle command \"{command}\" with args {String.Join(", ", args)}"
}
}
};
}
}

Expand Down Expand Up @@ -141,4 +153,4 @@ private async Task GotoPage(string pageName = null, string message = "choose")
await navigationService.NavigateAsync(pageName);
}
}
}
}
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Prism.Forms" Version="8.0.0.1909" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
<PackageReference Include="tbc.target" Version="0.0.20210216.10" />
<PackageReference Include="tbc.target" Version="0.0.20220413.3" />
<PackageReference Include="Xamarin.CommunityToolkit.Markup" Version="1.0.2" />
</ItemGroup>
</Project>
</Project>

0 comments on commit b8bd794

Please sign in to comment.