Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
ealbu committed Sep 12, 2024
1 parent 18f83cf commit c30e2ba
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions MicrosoftTranslatorProvider/Service/MicrosoftService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static async Task<bool> AuthenticateUser(MicrosoftCredentials credentials
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var tokenString = await response.Content.ReadAsStringAsync();
var token = ReadToken(tokenString);
credentials.AccessToken = "Bearer " + tokenString;
return true;
}
Expand All @@ -50,7 +49,7 @@ public static async Task<bool> AuthenticateUser(MicrosoftCredentials credentials
}
}

public async static Task<List<TranslationLanguage>> GetSupportedLanguages()
public static async Task<List<TranslationLanguage>> GetSupportedLanguages()
{
var httpClientHandler = ProxyHelper.GetHttpClientHandler(CredentialsManager.GetProxySettings(), true);
var httpClient = new HttpClient(httpClientHandler);
Expand All @@ -70,21 +69,13 @@ public async static Task<List<TranslationLanguage>> GetSupportedLanguages()
return output;
}

public async static Task<HashSet<string>> GetSupportedLanguageCodes()
public static async Task<HashSet<string>> GetSupportedLanguageCodes()
{
var supportedLanguages = await GetSupportedLanguages();
var supportedCodes = new HashSet<string>(supportedLanguages.Select(x => x.LanguageCode));
return supportedCodes;
}

private static JwtSecurityToken ReadToken(string token)
{
var jwtHandler = new JwtSecurityTokenHandler();
var readableToken = jwtHandler.CanReadToken(token);
return readableToken ? jwtHandler.ReadJwtToken(token)
: null;
}

public static async Task<string> TranslateAsync(PairModel pairModel, string textToTranslate, MicrosoftCredentials microsoftCredentials)
{
var sourceLanguage = pairModel.SourceLanguageCode;
Expand Down

0 comments on commit c30e2ba

Please sign in to comment.