1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2024-12-27 01:13:31 +01:00

4de211b80a の仕様変更に対応

This commit is contained in:
tateisu 2017-12-07 12:21:45 +09:00
parent 797edbcd3d
commit 700f3ca5a9
3 changed files with 18 additions and 8 deletions

View File

@ -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"
}

View File

@ -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" );

View File

@ -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 );
}