Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mvvm 8 starwars #164

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions StarWarsSample/StarWarsSample.Core/AppStart.cs
@@ -1,20 +1,20 @@
using System.Threading.Tasks;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using StarWarsSample.Core.ViewModels;

namespace StarWarsSample.Core
{
public class AppStart : MvxAppStart
{
public AppStart(IMvxApplication app, IMvxNavigationService mvxNavigationService)
: base(app, mvxNavigationService)
{
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using StarWarsSample.Core.ViewModels;
namespace StarWarsSample.Core
{
public class AppStart : MvxAppStart
{
public AppStart(IMvxApplication app, IMvxNavigationService mvxNavigationService)
: base(app, mvxNavigationService)
{
}

protected override Task NavigateToFirstViewModel(object hint = null)
protected override Task NavigateToFirstViewModel(object hint = null)
{
return NavigationService.Navigate<MainViewModel>();
}
}
}
return NavigationService.Navigate<MainViewModel>();
}
}
}
6 changes: 3 additions & 3 deletions StarWarsSample/StarWarsSample.Core/Logs.cs
@@ -1,10 +1,10 @@
using MvvmCross;
using MvvmCross.Logging;
using Microsoft.Extensions.Logging;
using MvvmCross;

namespace StarWarsSample.Core
{
public static class Logs
{
public static IMvxLog Instance { get; } = Mvx.IoCProvider.Resolve<IMvxLogProvider>().GetLogFor("StarWarsSample");
public static ILogger Instance { get; } = Mvx.IoCProvider.Resolve<ILoggerProvider>().CreateLogger("StarWarsSample");
}
}
Expand Up @@ -2,21 +2,21 @@
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using MvvmCross.Base;
using MvvmCross.Logging;
using StarWarsSample.Core.Rest.Interfaces;

namespace StarWarsSample.Core.Rest.Implementations
{
public class RestClient : IRestClient
{
private readonly IMvxJsonConverter _jsonConverter;
private readonly IMvxLog _mvxLog;
private readonly ILogger<RestClient> _logger;

public RestClient(IMvxJsonConverter jsonConverter, IMvxLog mvxLog)
public RestClient(IMvxJsonConverter jsonConverter, ILogger<RestClient> logger)
{
_jsonConverter = jsonConverter;
_mvxLog = mvxLog;
_logger = logger;
}

public async Task<TResult> MakeApiCall<TResult>(string url, HttpMethod method, object data = null) where TResult : class
Expand All @@ -41,7 +41,7 @@ public RestClient(IMvxJsonConverter jsonConverter, IMvxLog mvxLog)
}
catch (Exception ex)
{
_mvxLog.ErrorException("MakeApiCall failed", ex);
_logger.LogError("MakeApiCall failed", ex);
}

var stringSerialized = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
Expand Down
12 changes: 7 additions & 5 deletions StarWarsSample/StarWarsSample.Core/StarWarsSample.Core.csproj
Expand Up @@ -20,12 +20,14 @@
<Folder Include="Extensions\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Acr.UserDialogs" Version="7.1.0.470" />
<PackageReference Include="Acr.UserDialogs" Version="7.2.0.534" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
<PackageReference Include="OxyPlot.Core" Version="2.0.0" />
<PackageReference Include="MvvmCross" Version="7.1.2" />
<PackageReference Include="MvvmCross.Plugin.Json" Version="7.1.2" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="7.1.2" />
<PackageReference Include="MvvmCross.Plugin.Visibility" Version="7.1.2" />
<PackageReference Include="MvvmCross" Version="8.0.2" />
<PackageReference Include="MvvmCross.Plugin.Json" Version="8.0.2" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="8.0.2" />
<PackageReference Include="MvvmCross.Plugin.Visibility" Version="8.0.2" />
<PackageReference Include="Serilog" Version="2.10.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Strings.resx">
Expand Down
6 changes: 4 additions & 2 deletions StarWarsSample/StarWarsSample.Droid/LinkerPleaseInclude.cs
Expand Up @@ -5,8 +5,10 @@
using Android.Views;
using Android.Widget;
using MvvmCross.Binding.BindingContext;
using MvvmCross.IoC;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using MvvmCross.Views;

namespace StarWarsSample.Droid
{
Expand Down Expand Up @@ -107,9 +109,9 @@ public void Include(MvxTaskBasedBindingContext context)
context2.Dispose();
}

public void Include(MvxNavigationService service, IMvxViewModelLoader loader)
public void Include(MvxNavigationService service, IMvxViewDispatcher dispatcher, IMvxViewModelLoader loader, IMvxIoCProvider ioc)
{
service = new MvxNavigationService(null, loader);
service = new MvxNavigationService(null, dispatcher, ioc);
}

public void Include(ConsoleColor color)
Expand Down
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using AndroidX.SwipeRefreshLayout.Widget;
using Microsoft.Extensions.Logging;
using MvvmCross.Binding;
using MvvmCross.Logging;
using MvvmCross.Platforms.Android.Binding.Target;
Expand All @@ -27,7 +28,7 @@ protected override void SetValueImpl(object target, object value)
{
if (!(value is MvxNotifyTask))
{
Logs.Instance.Trace("Value '{0}' could not be parsed as a valid INotifyTaskCompletion", value);
Logs.Instance.Log(LogLevel.Trace, "Value '"+value+"' could not be parsed as a valid INotifyTaskCompletion");
return;
}

Expand Down