• R/O
  • HTTP
  • SSH
  • HTTPS

open-tween: コミット

開発に使用するリポジトリ


コミットメタ情報

リビジョン5c331578112405d18f2187f5482d9fb8e7e716ba (tree)
日時2018-09-27 02:24:53
作者Kimura Youichi <kim.upsilon@bucy...>
コミッターKimura Youichi

ログメッセージ

旧DM APIに関するコードを削除

変更サマリ

差分

--- a/OpenTween.Tests/Api/TwitterApiTest.cs
+++ b/OpenTween.Tests/Api/TwitterApiTest.cs
@@ -664,66 +664,6 @@ namespace OpenTween.Api
664664 }
665665
666666 [Fact]
667- public async Task DirectMessagesRecv_Test()
668- {
669- using (var twitterApi = new TwitterApi())
670- {
671- var mock = new Mock<IApiConnection>();
672- mock.Setup(x =>
673- x.GetAsync<TwitterDirectMessage[]>(
674- new Uri("direct_messages.json", UriKind.Relative),
675- new Dictionary<string, string> {
676- { "full_text", "true" },
677- { "include_entities", "true" },
678- { "include_ext_alt_text", "true" },
679- { "count", "200" },
680- { "max_id", "900" },
681- { "since_id", "100" },
682- },
683- "/direct_messages")
684- )
685- .ReturnsAsync(new TwitterDirectMessage[0]);
686-
687- twitterApi.apiConnection = mock.Object;
688-
689- await twitterApi.DirectMessagesRecv(count: 200, maxId: 900L, sinceId: 100L)
690- .ConfigureAwait(false);
691-
692- mock.VerifyAll();
693- }
694- }
695-
696- [Fact]
697- public async Task DirectMessagesSent_Test()
698- {
699- using (var twitterApi = new TwitterApi())
700- {
701- var mock = new Mock<IApiConnection>();
702- mock.Setup(x =>
703- x.GetAsync<TwitterDirectMessage[]>(
704- new Uri("direct_messages/sent.json", UriKind.Relative),
705- new Dictionary<string, string> {
706- { "full_text", "true" },
707- { "include_entities", "true" },
708- { "include_ext_alt_text", "true" },
709- { "count", "200" },
710- { "max_id", "900" },
711- { "since_id", "100" },
712- },
713- "/direct_messages/sent")
714- )
715- .ReturnsAsync(new TwitterDirectMessage[0]);
716-
717- twitterApi.apiConnection = mock.Object;
718-
719- await twitterApi.DirectMessagesSent(count: 200, maxId: 900L, sinceId: 100L)
720- .ConfigureAwait(false);
721-
722- mock.VerifyAll();
723- }
724- }
725-
726- [Fact]
727667 public async Task DirectMessagesEventsList_Test()
728668 {
729669 using (var twitterApi = new TwitterApi())
--- a/OpenTween.Tests/TwitterTest.cs
+++ b/OpenTween.Tests/TwitterTest.cs
@@ -447,7 +447,6 @@ namespace OpenTween
447447
448448 var timeline = SettingManager.Common.CountApi;
449449 var reply = SettingManager.Common.CountApiReply;
450- var dm = 20; // DMは固定値
451450 var more = SettingManager.Common.MoreCountApi;
452451 var startup = SettingManager.Common.FirstCountApi;
453452 var favorite = SettingManager.Common.FavoritesCountApi;
@@ -470,10 +469,6 @@ namespace OpenTween
470469 Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Timeline, false, false));
471470 Assert.Equal(reply, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Reply, false, false));
472471
473- // DM
474- Assert.Equal(dm, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.DirectMessegeRcv, false, false));
475- Assert.Equal(dm, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.DirectMessegeSnt, false, false));
476-
477472 // その他はTimelineと同値になる
478473 Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Favorites, false, false));
479474 Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.List, false, false));
--- a/OpenTween/Api/TwitterApi.cs
+++ b/OpenTween/Api/TwitterApi.cs
@@ -381,46 +381,6 @@ namespace OpenTween.Api
381381 return this.apiConnection.PostLazyAsync<TwitterUser>(endpoint, param);
382382 }
383383
384- public Task<TwitterDirectMessage[]> DirectMessagesRecv(int? count = null, long? maxId = null, long? sinceId = null)
385- {
386- var endpoint = new Uri("direct_messages.json", UriKind.Relative);
387- var param = new Dictionary<string, string>
388- {
389- ["full_text"] = "true",
390- ["include_entities"] = "true",
391- ["include_ext_alt_text"] = "true",
392- };
393-
394- if (count != null)
395- param["count"] = count.ToString();
396- if (maxId != null)
397- param["max_id"] = maxId.ToString();
398- if (sinceId != null)
399- param["since_id"] = sinceId.ToString();
400-
401- return this.apiConnection.GetAsync<TwitterDirectMessage[]>(endpoint, param, "/direct_messages");
402- }
403-
404- public Task<TwitterDirectMessage[]> DirectMessagesSent(int? count = null, long? maxId = null, long? sinceId = null)
405- {
406- var endpoint = new Uri("direct_messages/sent.json", UriKind.Relative);
407- var param = new Dictionary<string, string>
408- {
409- ["full_text"] = "true",
410- ["include_entities"] = "true",
411- ["include_ext_alt_text"] = "true",
412- };
413-
414- if (count != null)
415- param["count"] = count.ToString();
416- if (maxId != null)
417- param["max_id"] = maxId.ToString();
418- if (sinceId != null)
419- param["since_id"] = sinceId.ToString();
420-
421- return this.apiConnection.GetAsync<TwitterDirectMessage[]>(endpoint, param, "/direct_messages/sent");
422- }
423-
424384 public Task<TwitterMessageEventList> DirectMessagesEventsList(int? count = null, string cursor = null)
425385 {
426386 var endpoint = new Uri("direct_messages/events/list.json", UriKind.Relative);
--- a/OpenTween/Models/DirectMessagesTabModel.cs
+++ b/OpenTween/Models/DirectMessagesTabModel.cs
@@ -60,11 +60,6 @@ namespace OpenTween.Models
6060 await tw.GetDirectMessageEvents(read, backward)
6161 .ConfigureAwait(false);
6262
63- await tw.GetDirectMessageApi(read, MyCommon.WORKERTYPE.DirectMessegeRcv, backward)
64- .ConfigureAwait(false);
65- await tw.GetDirectMessageApi(read, MyCommon.WORKERTYPE.DirectMessegeSnt, backward)
66- .ConfigureAwait(false);
67-
6863 TabInformations.GetInstance().DistributePosts();
6964
7065 progress.Report(Properties.Resources.GetTimelineWorker_RunWorkerCompletedText11);
--- a/OpenTween/Resources/ChangeLog.txt
+++ b/OpenTween/Resources/ChangeLog.txt
@@ -3,6 +3,7 @@
33 ==== Ver 2.1.2-dev(2018/xx/xx)
44 * CHG: 投稿時取得の設定がオフでも、投稿した内容を即時タイムラインに反映させるようにしました
55 * CHG: APIのレートリミットに達した場合、リセットされるまでは手動で更新してもリクエストを送らないように変更しました
6+ * CHG: Directタブの更新時に旧DM APIへのアクセスを行わないよう変更しました (旧API廃止のため)
67 * FIX: 起動時に取得したDMが1件も表示されない場合がある不具合を修正 (thx @brianhartgen!)
78 * FIX: 起動直後からレートリミット規制中であった場合に解除までの時間がステータスバーに表示されない不具合を修正
89
--- a/OpenTween/Twitter.cs
+++ b/OpenTween/Twitter.cs
@@ -164,9 +164,6 @@ namespace OpenTween
164164 //プロパティからアクセスされる共通情報
165165 private List<string> _hashList = new List<string>();
166166
167- //max_idで古い発言を取得するために保持(lists分は個別タブで管理)
168- private long minDirectmessage = long.MaxValue;
169- private long minDirectmessageSent = long.MaxValue;
170167 private string nextCursorDirectMessage = null;
171168
172169 private long previousStatusId = -1L;
@@ -487,8 +484,6 @@ namespace OpenTween
487484 case MyCommon.WORKERTYPE.Reply:
488485 case MyCommon.WORKERTYPE.UserTimeline:
489486 case MyCommon.WORKERTYPE.Favorites:
490- case MyCommon.WORKERTYPE.DirectMessegeRcv:
491- case MyCommon.WORKERTYPE.DirectMessegeSnt:
492487 case MyCommon.WORKERTYPE.List: // 不明
493488 return 200;
494489
@@ -505,12 +500,6 @@ namespace OpenTween
505500 /// </summary>
506501 public static int GetApiResultCount(MyCommon.WORKERTYPE type, bool more, bool startup)
507502 {
508- if (type == MyCommon.WORKERTYPE.DirectMessegeRcv ||
509- type == MyCommon.WORKERTYPE.DirectMessegeSnt)
510- {
511- return 20;
512- }
513-
514503 if (SettingManager.Common.UseAdditionalCount)
515504 {
516505 switch (type)
@@ -1124,17 +1113,6 @@ namespace OpenTween
11241113 try
11251114 {
11261115 post.StatusId = message.Id;
1127- if (gType != MyCommon.WORKERTYPE.UserStream)
1128- {
1129- if (gType == MyCommon.WORKERTYPE.DirectMessegeRcv)
1130- {
1131- if (minDirectmessage > post.StatusId) minDirectmessage = post.StatusId;
1132- }
1133- else
1134- {
1135- if (minDirectmessageSent > post.StatusId) minDirectmessageSent = post.StatusId;
1136- }
1137- }
11381116
11391117 //二重取得回避
11401118 lock (LockObj)
@@ -1233,44 +1211,6 @@ namespace OpenTween
12331211 }
12341212 }
12351213
1236- public async Task GetDirectMessageApi(bool read, MyCommon.WORKERTYPE gType, bool more)
1237- {
1238- this.CheckAccountState();
1239- this.CheckAccessLevel(TwitterApiAccessLevel.ReadWriteAndDirectMessage);
1240-
1241- var count = GetApiResultCount(gType, more, false);
1242-
1243- TwitterDirectMessage[] messages;
1244- if (gType == MyCommon.WORKERTYPE.DirectMessegeRcv)
1245- {
1246- if (more)
1247- {
1248- messages = await this.Api.DirectMessagesRecv(count, maxId: this.minDirectmessage)
1249- .ConfigureAwait(false);
1250- }
1251- else
1252- {
1253- messages = await this.Api.DirectMessagesRecv(count)
1254- .ConfigureAwait(false);
1255- }
1256- }
1257- else
1258- {
1259- if (more)
1260- {
1261- messages = await this.Api.DirectMessagesSent(count, maxId: this.minDirectmessageSent)
1262- .ConfigureAwait(false);
1263- }
1264- else
1265- {
1266- messages = await this.Api.DirectMessagesSent(count)
1267- .ConfigureAwait(false);
1268- }
1269- }
1270-
1271- CreateDirectMessagesFromJson(messages, gType, read);
1272- }
1273-
12741214 public async Task GetDirectMessageEvents(bool read, bool backward)
12751215 {
12761216 this.CheckAccountState();
旧リポジトリブラウザで表示