Skip to content

Commit

Permalink
OpenTween.SocialProtocol.Twitter名前空間への不要な参照を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Jun 21, 2024
1 parent e8fe7e8 commit 67aecc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 0 additions & 2 deletions OpenTween/ApplicationEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
#nullable enable

using System;
using System.Linq;
using System.Windows.Forms;
using OpenTween.Connection;
using OpenTween.Models;
using OpenTween.Setting;
using OpenTween.SocialProtocol;
using OpenTween.SocialProtocol.Twitter;

namespace OpenTween
{
Expand Down
3 changes: 1 addition & 2 deletions OpenTween/SocialProtocol/AccountCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
using System.Collections.Generic;
using System.Linq;
using OpenTween.Models;
using OpenTween.SocialProtocol.Twitter;

namespace OpenTween.SocialProtocol
{
public sealed class AccountCollection : IDisposable
{
private Dictionary<AccountKey, ISocialAccount> accounts = new();
private AccountKey? primaryAccountKey;
private readonly ISocialAccount emptyAccount = new TwitterAccount(AccountKey.Empty);
private readonly ISocialAccount emptyAccount = new InvalidAccount(AccountKey.Empty);

public bool IsDisposed { get; private set; }

Expand Down
12 changes: 10 additions & 2 deletions OpenTween/SocialProtocol/InvalidAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
using OpenTween.Api;
using OpenTween.Connection;
using OpenTween.Models;
using OpenTween.SocialProtocol.Twitter;

namespace OpenTween.SocialProtocol
{
Expand Down Expand Up @@ -64,6 +63,15 @@ public bool CanUsePostId(PostId postId)
public void Dispose()
=> this.IsDisposed = true;

private class InvalidPersonId : PersonId
{
public override string IdType
=> "invalid";

public override string Id
=> "0";
}

private class InvalidAccountConnection : IApiConnection
{
public void ThrowIfUnauthorizedScope(string scope)
Expand Down Expand Up @@ -135,7 +143,7 @@ private WebApiException CreateException()
private class InvalidAccountState : ISocialAccountState
{
public PersonId UserId
=> new TwitterUserId("0");
=> new InvalidPersonId();

public string UserName
=> "(Unknown account)";
Expand Down

0 comments on commit 67aecc2

Please sign in to comment.