Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Dec 22, 2023
2 parents 2dbbfa9 + fccfffa commit d13b769
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
更新履歴

==== Ver 3.10.1(2023/12/23)
* FIX: OAuth 1.0a によるAPIアクセスに失敗する不具合を修正

==== Ver 3.10.0(2023/12/16)
* NEW: graphqlエンドポイント経由で取得した引用ツイートの表示に対応
* FIX: APIリクエストがタイムアウトした場合のキャンセル処理を改善
Expand Down
22 changes: 22 additions & 0 deletions OpenTween.Tests/Api/GraphQL/SearchTimelineRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,28 @@ public async Task Send_Test()
mock.VerifyAll();
}

[Fact]
public async Task Send_ReplaceCursorTest()
{
using var apiResponse = await TestUtils.CreateApiResponse("Resources/Responses/SearchTimeline_ReplaceCursor.json");

var mock = new Mock<IApiConnection>();
mock.Setup(x => x.SendAsync(It.IsAny<IHttpRequest>()))
.ReturnsAsync(apiResponse);

var request = new SearchTimelineRequest(rawQuery: "#OpenTween")
{
Count = 20,
};

var response = await request.Send(mock.Object);
Assert.Empty(response.Tweets);
Assert.Equal("DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAABCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA", response.CursorTop);
Assert.Equal("DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAACCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA", response.CursorBottom);

mock.VerifyAll();
}

[Fact]
public async Task Send_RequestCursor_Test()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"data": {
"search_by_raw_query": {
"search_timeline": {
"timeline": {
"instructions": [
{
"type": "TimelineReplaceEntry",
"entry_id_to_replace": "cursor-top-9223372036854775807",
"entry": {
"entryId": "cursor-top-9223372036854775807",
"sortIndex": "9223372036854775807",
"content": {
"entryType": "TimelineTimelineCursor",
"__typename": "TimelineTimelineCursor",
"value": "DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAABCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA",
"cursorType": "Top"
}
}
},
{
"type": "TimelineReplaceEntry",
"entry_id_to_replace": "cursor-bottom-0",
"entry": {
"entryId": "cursor-bottom-0",
"sortIndex": "0",
"content": {
"entryType": "TimelineTimelineCursor",
"__typename": "TimelineTimelineCursor",
"value": "DAADDAABCgABFnlh4hraMAYKAAIOTm0DEhTAAQAIAAIAAAACCAADAAAAAQgABAAAAAAKAAUX8j3ezIBOIAoABhfyPd7Mf9jwAAA",
"cursorType": "Bottom"
}
}
}
]
}
}
}
}
}
2 changes: 1 addition & 1 deletion OpenTween/Api/TwitterApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ public async Task<LazyJson<TwitterMessageEventSingle>> DirectMessagesEventsNew(l
JsonString = json,
};

var response = await this.Connection.SendAsync(request)
using var response = await this.Connection.SendAsync(request)
.ConfigureAwait(false);

return response.ReadAsLazyJson<TwitterMessageEventSingle>();
Expand Down
2 changes: 1 addition & 1 deletion OpenTween/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid("2d0ae0ba-adac-49a2-9b10-26fd69e695bf")]

[assembly: AssemblyVersion("3.10.0.0")]
[assembly: AssemblyVersion("3.10.1.0")]

[assembly: InternalsVisibleTo("OpenTween.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // for Moq
7 changes: 4 additions & 3 deletions OpenTween/Properties/Resources.Designer.cs

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

4 changes: 2 additions & 2 deletions OpenTween/Setting/SettingCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public class UserAccount
public string Username = "";
public long UserId = 0;

public APIAuthType TwitterAuthType { get; set; }
public APIAuthType TwitterAuthType { get; set; } = APIAuthType.OAuth1;

public string TwitterOAuth1ConsumerKey { get; set; } = "";

Expand Down Expand Up @@ -405,7 +405,7 @@ public ITwitterCredential GetTwitterCredential()
return appToken.AuthType switch
{
APIAuthType.OAuth1
=> new TwitterCredentialOAuth1(appToken, this.TwitterOAuth1ConsumerKey, this.TwitterOAuth1ConsumerSecret),
=> new TwitterCredentialOAuth1(appToken, this.Token, this.TokenSecret),
APIAuthType.TwitterComCookie
=> new TwitterCredentialCookie(appToken),
_ => new TwitterCredentialNone(),
Expand Down
14 changes: 7 additions & 7 deletions OpenTween/Twitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ await this.SendDirectMessage(param.Text, mediaId)
}
else
{
var response = await this.Api.StatusesUpdate(
using var response = await this.Api.StatusesUpdate(
param.Text,
param.InReplyToStatusId?.ToTwitterStatusId(),
param.MediaIds,
Expand Down Expand Up @@ -317,7 +317,7 @@ public async Task<long> UploadMedia(IMediaItem item, string? mediaCategory = nul
_ => "application/octet-stream",
};

var initResponse = await this.Api.MediaUploadInit(item.Size, mediaType, mediaCategory)
using var initResponse = await this.Api.MediaUploadInit(item.Size, mediaType, mediaCategory)
.ConfigureAwait(false);

var initMedia = await initResponse.LoadJsonAsync()
Expand All @@ -328,7 +328,7 @@ public async Task<long> UploadMedia(IMediaItem item, string? mediaCategory = nul
await this.Api.MediaUploadAppend(mediaId, 0, item)
.ConfigureAwait(false);

var response = await this.Api.MediaUploadFinalize(mediaId)
using var response = await this.Api.MediaUploadFinalize(mediaId)
.ConfigureAwait(false);

var media = await response.LoadJsonAsync()
Expand Down Expand Up @@ -374,7 +374,7 @@ public async Task SendDirectMessage(string postStr, long? mediaId = null)
var recipient = await this.GetUserInfo(recipientName)
.ConfigureAwait(false);

var response = await this.Api.DirectMessagesEventsNew(recipient.Id, body, mediaId)
using var response = await this.Api.DirectMessagesEventsNew(recipient.Id, body, mediaId)
.ConfigureAwait(false);

var messageEventSingle = await response.LoadJsonAsync()
Expand Down Expand Up @@ -405,7 +405,7 @@ await this.CreateDirectMessagesEventFromJson(messageEventSingle, read: true)
return null;
}

var response = await this.Api.StatusesRetweet(target.ToTwitterStatusId())
using var response = await this.Api.StatusesRetweet(target.ToTwitterStatusId())
.ConfigureAwait(false);

var status = await response.LoadJsonAsync()
Expand Down Expand Up @@ -1324,7 +1324,7 @@ await this.Api.ListsDestroy(listId)

public async Task<ListElement> EditList(long listId, string new_name, bool isPrivate, string description)
{
var response = await this.Api.ListsUpdate(listId, new_name, description, isPrivate)
using var response = await this.Api.ListsUpdate(listId, new_name, description, isPrivate)
.ConfigureAwait(false);

var list = await response.LoadJsonAsync()
Expand All @@ -1349,7 +1349,7 @@ public async Task CreateListApi(string listName, bool isPrivate, string descript
{
this.CheckAccountState();

var response = await this.Api.ListsCreate(listName, description, isPrivate)
using var response = await this.Api.ListsCreate(listName, description, isPrivate)
.ConfigureAwait(false);

var list = await response.LoadJsonAsync()
Expand Down
2 changes: 1 addition & 1 deletion OpenTween/UserInfoDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ private async void ButtonEdit_Click(object sender, EventArgs e)
{
try
{
var response = await this.twitterApi.AccountUpdateProfile(
using var response = await this.twitterApi.AccountUpdateProfile(
this.TextBoxName.Text,
this.TextBoxWeb.Text,
this.TextBoxLocation.Text,
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 3.9.0.{build}
version: 3.10.0.{build}

os: Visual Studio 2022

Expand Down

0 comments on commit d13b769

Please sign in to comment.