-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
120 additions
and
26 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
Explorer/Assets/DCL/AvatarRendering/Emotes/Helpers/ApplicationParamsEmoteProvider.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,45 @@ | ||
using CommunicationData.URLHelpers; | ||
using Cysharp.Threading.Tasks; | ||
using DCL.AvatarRendering.Loading.Components; | ||
using DCL.Web3; | ||
using Global.AppArgs; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading; | ||
|
||
namespace DCL.AvatarRendering.Emotes | ||
{ | ||
public class ApplicationParamsEmoteProvider : IEmoteProvider | ||
{ | ||
private readonly IAppArgs appArgs; | ||
private readonly IEmoteProvider source; | ||
|
||
public ApplicationParamsEmoteProvider(IAppArgs appArgs, | ||
IEmoteProvider source) | ||
{ | ||
this.appArgs = appArgs; | ||
this.source = source; | ||
} | ||
|
||
public async UniTask<int> GetOwnedEmotesAsync(Web3Address userId, CancellationToken ct, | ||
IEmoteProvider.OwnedEmotesRequestOptions requestOptions, | ||
List<IEmote> output) | ||
{ | ||
if (!appArgs.TryGetValue("self-preview-emotes", out string? emotesCsv)) | ||
return await source.GetOwnedEmotesAsync(userId, ct, requestOptions, output); | ||
|
||
URN[] pointers = emotesCsv!.Split(',', StringSplitOptions.RemoveEmptyEntries) | ||
.Select(s => new URN(s)) | ||
.ToArray(); | ||
|
||
await UniTask.WhenAll(GetEmotesAsync(pointers, BodyShape.MALE, ct, output), | ||
GetEmotesAsync(pointers, BodyShape.FEMALE, ct, output)); | ||
|
||
return output.Count; | ||
} | ||
|
||
public UniTask GetEmotesAsync(IReadOnlyCollection<URN> emoteIds, BodyShape bodyShape, CancellationToken ct, List<IEmote> output) => | ||
source.GetEmotesAsync(emoteIds, bodyShape, ct, output); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Explorer/Assets/DCL/AvatarRendering/Emotes/Helpers/ApplicationParamsEmoteProvider.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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