diff --git a/app/build.gradle b/app/build.gradle index 9b709755..fb61f5b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "jp.juggler.subwaytooter" minSdkVersion 21 targetSdkVersion 26 - versionCode 176 - versionName "1.7.6" + versionCode 177 + versionName "1.7.7" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/jp/juggler/subwaytooter/api/entity/TootRelationShip.java b/app/src/main/java/jp/juggler/subwaytooter/api/entity/TootRelationShip.java index 7a602718..00eca2be 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/api/entity/TootRelationShip.java +++ b/app/src/main/java/jp/juggler/subwaytooter/api/entity/TootRelationShip.java @@ -38,7 +38,9 @@ public class TootRelationShip { // (mastodon 2.1 or later) per-following-user setting. // Whether the boosts from target account will be shown on authorized user's home TL. - public int following_reblogs = UserRelation.REBLOG_UNKNOWN; + public int showing_reblogs = UserRelation.REBLOG_UNKNOWN; + + @Nullable public static TootRelationShip parse( JSONObject src ){ @@ -50,20 +52,28 @@ public class TootRelationShip { Object ov = src.opt( "following" ); if( ov instanceof JSONObject ){ // https://github.com/tootsuite/mastodon/issues/5856 + // 一部の開発版ではこうなっていた dst.following = true; ov = ( (JSONObject) ov ).opt( "reblogs" ); if( ov instanceof Boolean ){ - dst.following_reblogs = (Boolean) ov ? UserRelation.REBLOG_SHOW : UserRelation.REBLOG_HIDE; + dst.showing_reblogs = (Boolean) ov ? UserRelation.REBLOG_SHOW : UserRelation.REBLOG_HIDE; }else{ - dst.following_reblogs = UserRelation.REBLOG_UNKNOWN; + dst.showing_reblogs = UserRelation.REBLOG_UNKNOWN; } }else{ // 2.0 までの挙動 dst.following = ( ov instanceof Boolean ? (Boolean) ov : false ); - dst.following_reblogs = UserRelation.REBLOG_UNKNOWN; + + // 2.1 の挙動 + ov = src.opt( "showing_reblogs" ); + if( dst.following && ov instanceof Boolean ){ + dst.showing_reblogs = (Boolean) ov ? UserRelation.REBLOG_SHOW : UserRelation.REBLOG_HIDE; + }else{ + dst.showing_reblogs = UserRelation.REBLOG_UNKNOWN; + } } dst.followed_by = src.optBoolean( "followed_by" ); diff --git a/app/src/main/java/jp/juggler/subwaytooter/table/UserRelation.java b/app/src/main/java/jp/juggler/subwaytooter/table/UserRelation.java index 918a0c47..e49b3971 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/table/UserRelation.java +++ b/app/src/main/java/jp/juggler/subwaytooter/table/UserRelation.java @@ -100,7 +100,7 @@ public class UserRelation { cv.put( COL_BLOCKING, src.blocking ? 1 : 0 ); cv.put( COL_MUTING, src.muting ? 1 : 0 ); cv.put( COL_REQUESTED, src.requested ? 1 : 0 ); - cv.put( COL_FOLLOWING_REBLOGS, src.following_reblogs ); + cv.put( COL_FOLLOWING_REBLOGS, src.showing_reblogs ); App1.getDB().replace( table, null, cv ); String key = String.format( "%s:%s", db_id, src.id ); @@ -128,7 +128,7 @@ public class UserRelation { cv.put( COL_BLOCKING, src.blocking ? 1 : 0 ); cv.put( COL_MUTING, src.muting ? 1 : 0 ); cv.put( COL_REQUESTED, src.requested ? 1 : 0 ); - cv.put( COL_FOLLOWING_REBLOGS, src.following_reblogs ); + cv.put( COL_FOLLOWING_REBLOGS, src.showing_reblogs ); db.replace( table, null, cv ); }