From eb97568e6966e2c796aafa98d5533dade10c693a Mon Sep 17 00:00:00 2001 From: tateisu Date: Thu, 1 Mar 2018 15:41:07 +0900 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E3=82=AB=E3=83=A9=E3=83=A0?= =?UTF-8?q?=E3=81=AE=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=B0=E6=99=82=E3=81=ABAPI=E3=81=ABexclude=5Ftypes[]?= =?UTF-8?q?=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 +- .../java/jp/juggler/subwaytooter/Column.kt | 41 +++++++++++-------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b14b6870..a84be9c7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { minSdkVersion 21 targetSdkVersion 27 - versionCode 220 - versionName "2.2.0" + versionCode 221 + versionName "2.2.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/jp/juggler/subwaytooter/Column.kt b/app/src/main/java/jp/juggler/subwaytooter/Column.kt index e2c1811f..89f1b8fa 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/Column.kt +++ b/app/src/main/java/jp/juggler/subwaytooter/Column.kt @@ -1492,10 +1492,8 @@ class Column( return result } - internal fun parseNotifications( - client : TootApiClient, - path_base : String - ) : TootApiResult? { + internal fun parseNotifications( client : TootApiClient ) : TootApiResult? { + val path_base = makeNotificationUrl() val time_start = SystemClock.elapsedRealtime() val result = client.request(path_base) @@ -1670,7 +1668,7 @@ class Column( TYPE_REPORTS -> return parseReports(client, PATH_REPORTS) - TYPE_NOTIFICATIONS -> return parseNotifications(client, PATH_NOTIFICATIONS) + TYPE_NOTIFICATIONS -> return parseNotifications(client) TYPE_BOOSTED_BY -> return parseAccountList( client, @@ -2245,10 +2243,8 @@ class Column( return result } - internal fun getNotificationList( - client : TootApiClient, - path_base : String - ) : TootApiResult? { + internal fun getNotificationList( client : TootApiClient ) : TootApiResult? { + val path_base = makeNotificationUrl() val time_start = SystemClock.elapsedRealtime() val delimiter = if(- 1 != path_base.indexOf('?')) '&' else '?' val last_since_id = since_id @@ -2522,7 +2518,7 @@ class Column( TYPE_REPORTS -> getReportList(client, PATH_REPORTS) - TYPE_NOTIFICATIONS -> getNotificationList(client, PATH_NOTIFICATIONS) + TYPE_NOTIFICATIONS -> getNotificationList(client) TYPE_BOOSTED_BY -> getAccountList( client, String.format( @@ -2905,12 +2901,14 @@ class Column( return result } - internal fun getNotificationList( - client : TootApiClient, - path_base : String - ) : TootApiResult? { + internal fun getNotificationList( client : TootApiClient ) : TootApiResult? { + val path_base = makeNotificationUrl() + val time_start = SystemClock.elapsedRealtime() val delimiter = if(- 1 != path_base.indexOf('?')) '&' else '?' + + + list_tmp = ArrayList() var result : TootApiResult? = null @@ -3047,7 +3045,7 @@ class Column( TYPE_REPORTS -> getReportList(client, PATH_REPORTS) - TYPE_NOTIFICATIONS -> getNotificationList(client, PATH_NOTIFICATIONS) + TYPE_NOTIFICATIONS -> getNotificationList(client) TYPE_HASHTAG -> getStatusList( client, @@ -3584,5 +3582,16 @@ class Column( } } - + private fun makeNotificationUrl():String{ + return if(!dont_show_favourite && !dont_show_boost && !dont_show_follow && !dont_show_reply){ + PATH_NOTIFICATIONS + }else { + val sb = StringBuilder(PATH_NOTIFICATIONS) // always contain "?limit=XX" + if(dont_show_favourite) sb.append("&exclude_types[]=favourite") + if(dont_show_boost) sb.append("&exclude_types[]=reblog") + if(dont_show_follow) sb.append("&exclude_types[]=follow") + if(dont_show_reply) sb.append("&exclude_types[]=mention") + sb.toString() + } + } }