Use uppercase for the user names to avoid conflicts with Playfab user registration. (#12)

* Use uppercase for the user names to avoid conflicts in the Playfab registration of the players. As an example, Playfab considers Dsr and DSR as different user names and allows to register both. But for the display name of those players Dsr and DSR are considered the same name and Playfab throws error by invalid name conflict. This
This commit is contained in:
David Sanz 2020-03-26 15:22:50 +01:00 коммит произвёл GitHub
Родитель 8741053338
Коммит 170443913d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 5 удалений

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

@ -210,7 +210,8 @@ namespace RPSLS.Game.Api.GrpcServices
return result;
}
private static string GetUsername(string username, bool twitterLogged) => twitterLogged ? username : $"${username}";
private static string GetUsername(string username, bool twitterLogged)
=> twitterLogged ? username.ToUpperInvariant() : $"${username.ToUpperInvariant()}";
private static string GetUserDisplay(string username) =>
string.IsNullOrWhiteSpace(username) ? "-" :

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

@ -128,7 +128,7 @@ namespace RPSLS.Game.Multiplayer.Services
var loginResult = await Call(
PlayFabClientAPI.LoginWithCustomIDAsync,
new LoginWithCustomIDRequestBuilder()
.WithUser(username)
.WithUser(username.ToUpperInvariant())
.WithAccountInfo()
.CreateIfDoesntExist());
@ -176,7 +176,7 @@ namespace RPSLS.Game.Multiplayer.Services
var loginResult = await Call(
PlayFabClientAPI.LoginWithCustomIDAsync,
new LoginWithCustomIDRequestBuilder()
.WithUser(username)
.WithUser(username.ToUpperInvariant())
.WithAccountInfo()
.CreateIfDoesntExist());
@ -187,7 +187,7 @@ namespace RPSLS.Game.Multiplayer.Services
await Call(
PlayFabClientAPI.UpdateUserTitleDisplayNameAsync,
new UpdateUserTitleDisplayNameRequestBuilder()
.WithName(username));
.WithName(username.ToUpperInvariant()));
}
return userEntity;
@ -251,7 +251,7 @@ namespace RPSLS.Game.Multiplayer.Services
if (apiError != null)
{
var detailedError = PlayFabUtil.GenerateErrorReport(apiError);
_logger.LogWarning($"Something went wrong with PlayFab API call {playFabCall.Method.Name}.{Environment.NewLine}{detailedError}");
_logger.LogError($"Something went wrong with PlayFab API call {playFabCall.Method.Name}.{Environment.NewLine}{detailedError}");
}
return taskResult;