diff --git a/OpenTween/ApplicationEvents.cs b/OpenTween/ApplicationEvents.cs index dd802ac8f..14ed28347 100644 --- a/OpenTween/ApplicationEvents.cs +++ b/OpenTween/ApplicationEvents.cs @@ -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 { diff --git a/OpenTween/SocialProtocol/AccountCollection.cs b/OpenTween/SocialProtocol/AccountCollection.cs index 7bc88235a..8b9e14586 100644 --- a/OpenTween/SocialProtocol/AccountCollection.cs +++ b/OpenTween/SocialProtocol/AccountCollection.cs @@ -25,7 +25,6 @@ using System.Collections.Generic; using System.Linq; using OpenTween.Models; -using OpenTween.SocialProtocol.Twitter; namespace OpenTween.SocialProtocol { @@ -33,7 +32,7 @@ public sealed class AccountCollection : IDisposable { private Dictionary 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; } diff --git a/OpenTween/SocialProtocol/InvalidAccount.cs b/OpenTween/SocialProtocol/InvalidAccount.cs index 4c47ac620..bb43bbe16 100644 --- a/OpenTween/SocialProtocol/InvalidAccount.cs +++ b/OpenTween/SocialProtocol/InvalidAccount.cs @@ -26,7 +26,6 @@ using OpenTween.Api; using OpenTween.Connection; using OpenTween.Models; -using OpenTween.SocialProtocol.Twitter; namespace OpenTween.SocialProtocol { @@ -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) @@ -135,7 +143,7 @@ private WebApiException CreateException() private class InvalidAccountState : ISocialAccountState { public PersonId UserId - => new TwitterUserId("0"); + => new InvalidPersonId(); public string UserName => "(Unknown account)";