forked from domialex/Sidekick
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed link not working on the price view
- Loading branch information
Showing
6 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using MediatR; | ||
using Sidekick.Domain.Game.Items.Metadatas; | ||
using Sidekick.Domain.Game.Items.Models; | ||
using Sidekick.Domain.Game.Languages; | ||
using Sidekick.Domain.Game.Trade.Queries; | ||
using Sidekick.Domain.Settings; | ||
|
||
namespace Sidekick.Application.Game.Trade | ||
{ | ||
public class GetTradeUriHandler : IQueryHandler<GetTradeUriQuery, Uri> | ||
{ | ||
private readonly IGameLanguageProvider gameLanguageProvider; | ||
private readonly IItemStaticDataProvider itemStaticDataProvider; | ||
private readonly ISidekickSettings settings; | ||
|
||
public GetTradeUriHandler(IGameLanguageProvider gameLanguageProvider, | ||
IItemStaticDataProvider itemStaticDataProvider, | ||
ISidekickSettings settings) | ||
{ | ||
this.gameLanguageProvider = gameLanguageProvider; | ||
this.itemStaticDataProvider = itemStaticDataProvider; | ||
this.settings = settings; | ||
} | ||
|
||
public Task<Uri> Handle(GetTradeUriQuery request, CancellationToken cancellationToken) | ||
{ | ||
Uri baseUri; | ||
|
||
if (request.Item.Rarity == Rarity.Currency && itemStaticDataProvider.GetId(request.Item) != null) | ||
{ | ||
baseUri = gameLanguageProvider.Language.PoeTradeExchangeBaseUrl; | ||
} | ||
else | ||
{ | ||
|
||
baseUri = gameLanguageProvider.Language.PoeTradeSearchBaseUrl; | ||
} | ||
|
||
return Task.FromResult(new Uri(baseUri, $"{settings.LeagueId}/{request.QueryId}")); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Sidekick.Domain/Game/Trade/Queries/GetTradeUriQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using MediatR; | ||
using Sidekick.Domain.Game.Items.Models; | ||
|
||
namespace Sidekick.Domain.Game.Trade.Queries | ||
{ | ||
/// <summary> | ||
/// Gets the Uri for the specified trade query id | ||
/// </summary> | ||
public class GetTradeUriQuery : IQuery<Uri> | ||
{ | ||
/// <summary> | ||
/// Gets the Uri for the specified trade query id | ||
/// </summary> | ||
/// <param name="item">The item for which the uri is for</param> | ||
/// <param name="queryId">The trade query id</param> | ||
public GetTradeUriQuery(Item item, string queryId) | ||
{ | ||
Item = item; | ||
QueryId = queryId; | ||
} | ||
|
||
/// <summary> | ||
/// The item for which the uri is for | ||
/// </summary> | ||
public Item Item { get; } | ||
|
||
/// <summary> | ||
/// The trade query id | ||
/// </summary> | ||
public string QueryId { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,5 @@ public static void OnPropertyChanged( | |
|
||
self.SocketGroups = sockets; | ||
} | ||
|
||
} | ||
} |