Skip to content

Commit

Permalink
- Adjusting logic for signing in YouTube bot account to detect when n…
Browse files Browse the repository at this point in the history
…o channel is set
  • Loading branch information
SaviorXTanren committed Sep 6, 2023
1 parent ae66c34 commit 5435926
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
11 changes: 1 addition & 10 deletions MixItUp.Base/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions MixItUp.Base/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -8450,7 +8450,7 @@ NOTE: This may require you to opt-in to the Preview build from the General tab i
<value>Failed to connect to YouTube chat servers</value>
</data>
<data name="YouTubeFailedToGetBotData" xml:space="preserve">
<value>Failed to get YouTube bot data</value>
<value>Failed to get YouTube bot data. For YouTube bot accounts, ensure that you have created a channel on YouTube for the account you are signing in to. See the following Wiki page for more information: https://wiki.mixitupapp.com/accounts#bot-accounts</value>
</data>
<data name="YouTubeFailedToGetUserData" xml:space="preserve">
<value>Failed to get YouTube user data</value>
Expand Down Expand Up @@ -10282,7 +10282,4 @@ sendParentMessage({ Type: "Remove", ID: "{ID}" });</value>
<data name="MusicPlayerSelectFolderOrPlayMusicToLoadInSongs" xml:space="preserve">
<value>Select a new folder to load in music from a folder or hit the Play button to load in music from the last used folder.</value>
</data>
<data name="YouTubeBotAccountEnsureChannelCreated" xml:space="preserve">
<value>For YouTube bot accounts, ensure that you have created a channel on YouTube for the account you are signing in to. See the following Wiki page for more information: https://wiki.mixitupapp.com/accounts#bot-accounts</value>
</data>
</root>
7 changes: 1 addition & 6 deletions MixItUp.Base/Services/YouTube/YouTubePlatformService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ public static async Task<Result<YouTubePlatformService>> ConnectUser()

public static async Task<Result<YouTubePlatformService>> ConnectBot()
{
Result<YouTubePlatformService> result = await YouTubePlatformService.Connect(YouTubePlatformService.BotScopes);
if (!result.Success)
{
result.Combine(new Result(Resources.YouTubeBotAccountEnsureChannelCreated));
}
return result;
return await YouTubePlatformService.Connect(YouTubePlatformService.BotScopes);
}

public static async Task<Result<YouTubePlatformService>> Connect(IEnumerable<OAuthClientScopeEnum> scopes)
Expand Down
4 changes: 2 additions & 2 deletions MixItUp.Base/Services/YouTube/YouTubeSessionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public async Task<Result> ConnectBot()
Result<YouTubePlatformService> result = await YouTubePlatformService.ConnectBot();
if (result.Success)
{
this.BotConnection = result.Value;
this.Bot = await this.BotConnection.GetCurrentChannel();
this.Bot = await result.Value.GetCurrentChannel();
if (this.Bot == null)
{
return new Result(MixItUp.Base.Resources.YouTubeFailedToGetBotData);
}
this.BotConnection = result.Value;
}
return result;
}
Expand Down

0 comments on commit 5435926

Please sign in to comment.