(Mastodon 3.1.4) 「連合TL」と「…周辺の連合TL」のカラム設定に「リモートのみ」を追加。
This commit is contained in:
parent
ded1e329de
commit
c470b9c79b
|
@ -82,7 +82,6 @@ class Column(
|
|||
internal const val PATH_DIRECT_MESSAGES2 = "/api/v1/conversations?limit=$READ_LIMIT"
|
||||
|
||||
internal const val PATH_LOCAL = "/api/v1/timelines/public?limit=$READ_LIMIT&local=true"
|
||||
internal const val PATH_TL_FEDERATE = "/api/v1/timelines/public?limit=$READ_LIMIT"
|
||||
internal const val PATH_FAVOURITES = "/api/v1/favourites?limit=$READ_LIMIT"
|
||||
internal const val PATH_BOOKMARKS = "/api/v1/bookmarks?limit=$READ_LIMIT"
|
||||
|
||||
|
@ -117,7 +116,6 @@ class Column(
|
|||
internal const val PATH_STATUSES = "/api/v1/statuses/%s" // 1:status_id
|
||||
internal const val PATH_STATUSES_CONTEXT = "/api/v1/statuses/%s/context" // 1:status_id
|
||||
// search args 1: query(urlencoded) , also, append "&resolve=1" if resolve non-local accounts
|
||||
|
||||
|
||||
const val PATH_FILTERS = "/api/v1/filters"
|
||||
|
||||
|
@ -182,6 +180,8 @@ class Column(
|
|||
private const val KEY_SEARCH_RESOLVE = "search_resolve"
|
||||
private const val KEY_INSTANCE_URI = "instance_uri"
|
||||
|
||||
private const val KEY_REMOTE_ONLY = "remoteOnly"
|
||||
|
||||
internal const val KEY_COLUMN_ACCESS = "column_access"
|
||||
internal const val KEY_COLUMN_ACCESS_COLOR = "column_access_color"
|
||||
internal const val KEY_COLUMN_ACCESS_COLOR_BG = "column_access_color_bg"
|
||||
|
@ -209,7 +209,10 @@ class Column(
|
|||
return params[idx] as T
|
||||
}
|
||||
|
||||
private fun getParamEntityId(params : Array<out Any>, @Suppress("SameParameterValue") idx : Int) : EntityId =
|
||||
private fun getParamEntityId(
|
||||
params : Array<out Any>,
|
||||
@Suppress("SameParameterValue") idx : Int
|
||||
) : EntityId =
|
||||
when(val o = params[idx]) {
|
||||
is EntityId -> o
|
||||
is String -> EntityId(o)
|
||||
|
@ -383,6 +386,8 @@ class Column(
|
|||
return callback_ref?.get()?.isActivityStart ?: false
|
||||
}
|
||||
|
||||
private var lastStreamPath : String? = null
|
||||
|
||||
private val streamPath : String?
|
||||
get() = if(isMisskey) {
|
||||
val misskeyApiToken = access_info.misskeyApiToken
|
||||
|
@ -418,7 +423,14 @@ class Column(
|
|||
when(type) {
|
||||
ColumnType.HOME, ColumnType.NOTIFICATIONS -> "/api/v1/streaming/?stream=user"
|
||||
ColumnType.LOCAL -> "/api/v1/streaming/?stream=public:local"
|
||||
ColumnType.FEDERATE -> "/api/v1/streaming/?stream=public"
|
||||
|
||||
ColumnType.FEDERATE -> {
|
||||
when(remote_only) {
|
||||
true -> "/api/v1/streaming/?stream=public:remote"
|
||||
else -> "/api/v1/streaming/?stream=public"
|
||||
}
|
||||
}
|
||||
|
||||
ColumnType.LIST_TL -> "/api/v1/streaming/?stream=list&list=$profile_id"
|
||||
ColumnType.DOMAIN_TIMELINE -> "/api/v1/streaming/?stream=public:remote&domain=$instance_uri"
|
||||
|
||||
|
@ -499,6 +511,7 @@ class Column(
|
|||
|
||||
internal var search_query : String = ""
|
||||
internal var search_resolve : Boolean = false
|
||||
internal var remote_only : Boolean = false
|
||||
internal var instance_uri : String = ""
|
||||
internal var hashtag : String = ""
|
||||
internal var hashtag_any : String = ""
|
||||
|
@ -715,7 +728,7 @@ class Column(
|
|||
dont_show_reaction = src.optBoolean(KEY_DONT_SHOW_REACTION)
|
||||
dont_show_vote = src.optBoolean(KEY_DONT_SHOW_VOTE)
|
||||
dont_show_normal_toot = src.optBoolean(KEY_DONT_SHOW_NORMAL_TOOT)
|
||||
dont_show_non_public_toot= src.optBoolean(KEY_DONT_SHOW_NON_PUBLIC_TOOT)
|
||||
dont_show_non_public_toot = src.optBoolean(KEY_DONT_SHOW_NON_PUBLIC_TOOT)
|
||||
dont_streaming = src.optBoolean(KEY_DONT_STREAMING)
|
||||
dont_auto_refresh = src.optBoolean(KEY_DONT_AUTO_REFRESH)
|
||||
hide_media_default = src.optBoolean(KEY_HIDE_MEDIA_DEFAULT)
|
||||
|
@ -742,9 +755,19 @@ class Column(
|
|||
|
||||
when(type) {
|
||||
|
||||
ColumnType.CONVERSATION, ColumnType.BOOSTED_BY, ColumnType.FAVOURITED_BY, ColumnType.LOCAL_AROUND, ColumnType.FEDERATED_AROUND, ColumnType.ACCOUNT_AROUND ->
|
||||
ColumnType.CONVERSATION, ColumnType.BOOSTED_BY, ColumnType.FAVOURITED_BY,
|
||||
ColumnType.LOCAL_AROUND, ColumnType.ACCOUNT_AROUND ->
|
||||
status_id = EntityId.mayNull(src.string(KEY_STATUS_ID))
|
||||
|
||||
ColumnType.FEDERATED_AROUND -> {
|
||||
status_id = EntityId.mayNull(src.string(KEY_STATUS_ID))
|
||||
remote_only = src.optBoolean(KEY_REMOTE_ONLY, false)
|
||||
}
|
||||
|
||||
ColumnType.FEDERATE -> {
|
||||
remote_only = src.optBoolean(KEY_REMOTE_ONLY, false)
|
||||
}
|
||||
|
||||
ColumnType.PROFILE -> {
|
||||
profile_id = EntityId.mayNull(src.string(KEY_PROFILE_ID))
|
||||
val tabId = src.optInt(KEY_PROFILE_TAB)
|
||||
|
@ -852,9 +875,19 @@ class Column(
|
|||
|
||||
ColumnType.CONVERSATION, ColumnType.BOOSTED_BY,
|
||||
ColumnType.FAVOURITED_BY, ColumnType.LOCAL_AROUND,
|
||||
ColumnType.FEDERATED_AROUND, ColumnType.ACCOUNT_AROUND ->
|
||||
|
||||
ColumnType.ACCOUNT_AROUND ->
|
||||
dst[KEY_STATUS_ID] = status_id.toString()
|
||||
|
||||
ColumnType.FEDERATED_AROUND -> {
|
||||
dst[KEY_STATUS_ID] = status_id.toString()
|
||||
dst[KEY_REMOTE_ONLY] = remote_only
|
||||
}
|
||||
|
||||
ColumnType.FEDERATE -> {
|
||||
dst[KEY_REMOTE_ONLY] = remote_only
|
||||
}
|
||||
|
||||
ColumnType.PROFILE -> {
|
||||
dst[KEY_PROFILE_ID] = profile_id.toString()
|
||||
dst[KEY_PROFILE_TAB] = profile_tab.id
|
||||
|
@ -1332,8 +1365,7 @@ class Column(
|
|||
if(account != access_info) return
|
||||
if(type == ColumnType.LIST_LIST) {
|
||||
startLoading()
|
||||
}
|
||||
else if(type == ColumnType.LIST_TL || type == ColumnType.LIST_MEMBER) {
|
||||
} else if(type == ColumnType.LIST_TL || type == ColumnType.LIST_MEMBER) {
|
||||
if(item.id == profile_id) {
|
||||
this.list_info = item
|
||||
fireShowColumnHeader()
|
||||
|
@ -1345,8 +1377,7 @@ class Column(
|
|||
if(account != access_info) return
|
||||
if(type == ColumnType.MISSKEY_ANTENNA_LIST) {
|
||||
startLoading()
|
||||
}
|
||||
else if(type == ColumnType.MISSKEY_ANTENNA_TL) {
|
||||
} else if(type == ColumnType.MISSKEY_ANTENNA_TL) {
|
||||
if(item.id == profile_id) {
|
||||
this.antenna_info = item
|
||||
fireShowColumnHeader()
|
||||
|
@ -1527,7 +1558,7 @@ class Column(
|
|||
if(status.in_reply_to_id == null && reblog == null) return true
|
||||
}
|
||||
if(dont_show_non_public_toot) {
|
||||
if(!status.visibility.isPublic ) return true
|
||||
if(! status.visibility.isPublic) return true
|
||||
}
|
||||
|
||||
if(column_regex_filter(status.decoded_content)) return true
|
||||
|
@ -1708,7 +1739,6 @@ class Column(
|
|||
|
||||
}
|
||||
|
||||
|
||||
private inner class UpdateRelationEnv {
|
||||
internal val who_set = HashSet<EntityId>()
|
||||
internal val acct_set = HashSet<String>()
|
||||
|
@ -2284,9 +2314,9 @@ class Column(
|
|||
ColumnType.HOME, ColumnType.LIST_TL, ColumnType.MISSKEY_HYBRID -> TootFilter.CONTEXT_HOME
|
||||
|
||||
ColumnType.NOTIFICATIONS, ColumnType.NOTIFICATION_FROM_ACCT -> TootFilter.CONTEXT_NOTIFICATIONS
|
||||
|
||||
|
||||
ColumnType.CONVERSATION -> TootFilter.CONTEXT_THREAD
|
||||
|
||||
|
||||
ColumnType.DIRECT_MESSAGES -> TootFilter.CONTEXT_THREAD
|
||||
|
||||
ColumnType.PROFILE -> TootFilter.CONTEXT_PROFILE
|
||||
|
@ -2301,6 +2331,11 @@ class Column(
|
|||
return canStatusFilter()
|
||||
}
|
||||
|
||||
fun canRemoteOnly() = when(type) {
|
||||
ColumnType.FEDERATE, ColumnType.FEDERATED_AROUND -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
// カラム設定に「ブーストを表示しない」ボタンを含めるなら真
|
||||
fun canFilterBoost() : Boolean {
|
||||
return when(type) {
|
||||
|
@ -2335,6 +2370,7 @@ class Column(
|
|||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
fun canFilterNonPublicToot() : Boolean {
|
||||
return when(type) {
|
||||
ColumnType.HOME, ColumnType.MISSKEY_HYBRID,
|
||||
|
@ -2344,7 +2380,7 @@ class Column(
|
|||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal fun canAutoRefresh() : Boolean {
|
||||
return streamPath != null
|
||||
}
|
||||
|
@ -2504,9 +2540,9 @@ class Column(
|
|||
ColumnType.HASHTAG ->
|
||||
createMisskeyConnectChannelMessage(
|
||||
"hashtag",
|
||||
jsonObject { put("q", hashtag ) }
|
||||
jsonObject { put("q", hashtag) }
|
||||
)
|
||||
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
@ -2744,9 +2780,9 @@ class Column(
|
|||
}
|
||||
|
||||
this.bPutGap = bPutGap
|
||||
this.lastStreamPath = stream_path
|
||||
|
||||
stream_data_queue.clear()
|
||||
|
||||
streamReader = app_state.stream_reader.register(
|
||||
access_info,
|
||||
stream_path,
|
||||
|
@ -2762,7 +2798,7 @@ class Column(
|
|||
// カラム破棄やリロード開始時は個別にストリーミングを止める必要がある
|
||||
internal fun stopStreaming() {
|
||||
streamReader = null
|
||||
val stream_path = streamPath
|
||||
val stream_path = lastStreamPath
|
||||
if(stream_path != null) {
|
||||
app_state.stream_reader.unregister(access_info, stream_path, streamCallback)
|
||||
fireShowColumnStatus()
|
||||
|
@ -2772,6 +2808,7 @@ class Column(
|
|||
fun getStreamingStatus() : StreamingIndicatorState {
|
||||
if(is_dispose.get() || ! bFirstInitialized) return StreamingIndicatorState.NONE
|
||||
val stream_path = streamPath ?: return StreamingIndicatorState.NONE
|
||||
|
||||
return app_state.stream_reader.getStreamingStatus(access_info, stream_path, streamCallback)
|
||||
}
|
||||
|
||||
|
|
|
@ -241,10 +241,14 @@ internal fun Column.makeMisskeyHybridTlUrl() : String {
|
|||
}
|
||||
|
||||
internal fun Column.makePublicFederateUrl() : String {
|
||||
return when {
|
||||
access_info.isMisskey -> "/api/notes/global-timeline"
|
||||
with_attachment -> "${Column.PATH_TL_FEDERATE}&only_media=true"
|
||||
else -> Column.PATH_TL_FEDERATE
|
||||
|
||||
return if( access_info.isMisskey){
|
||||
"/api/notes/global-timeline"
|
||||
}else{
|
||||
val sb = StringBuilder("/api/v1/timelines/public?limit=$READ_LIMIT")
|
||||
if(with_attachment) sb.append("&only_media=true")
|
||||
if(remote_only) sb.append("&remote=true")
|
||||
sb.toString()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@ class ColumnViewHolder(
|
|||
private lateinit var ivColumnBackgroundImage : ImageView
|
||||
private lateinit var llSearch : View
|
||||
private lateinit var cbDontCloseColumn : CheckBox
|
||||
private lateinit var cbRemoteOnly : CheckBox
|
||||
private lateinit var cbWithAttachment : CheckBox
|
||||
private lateinit var cbWithHighlight : CheckBox
|
||||
private lateinit var cbDontShowBoost : CheckBox
|
||||
|
@ -358,6 +359,7 @@ class ColumnViewHolder(
|
|||
btnAnnouncementsNext.setOnClickListener(this)
|
||||
|
||||
cbDontCloseColumn.setOnCheckedChangeListener(this)
|
||||
cbRemoteOnly.setOnCheckedChangeListener(this)
|
||||
cbWithAttachment.setOnCheckedChangeListener(this)
|
||||
cbWithHighlight.setOnCheckedChangeListener(this)
|
||||
cbDontShowBoost.setOnCheckedChangeListener(this)
|
||||
|
@ -612,6 +614,7 @@ class ColumnViewHolder(
|
|||
|
||||
|
||||
cbDontCloseColumn.isCheckedNoAnime = column.dont_close
|
||||
cbRemoteOnly.isCheckedNoAnime = column.remote_only
|
||||
cbWithAttachment.isCheckedNoAnime = column.with_attachment
|
||||
cbWithHighlight.isCheckedNoAnime = column.with_highlight
|
||||
cbDontShowBoost.isCheckedNoAnime = column.dont_show_boost
|
||||
|
@ -634,6 +637,8 @@ class ColumnViewHolder(
|
|||
etSearch.setText(column.search_query)
|
||||
cbResolve.isCheckedNoAnime = column.search_resolve
|
||||
|
||||
cbRemoteOnly.vg(column.canRemoteOnly())
|
||||
|
||||
cbWithAttachment.vg(bAllowFilter)
|
||||
cbWithHighlight.vg(bAllowFilter)
|
||||
etRegexFilter.vg(bAllowFilter)
|
||||
|
@ -850,9 +855,9 @@ class ColumnViewHolder(
|
|||
val screen_h = iv.resources.displayMetrics.heightPixels
|
||||
|
||||
// 非同期処理を開始
|
||||
last_image_task = GlobalScope.launch(Dispatchers.Main){
|
||||
val bitmap = try{
|
||||
withContext(Dispatchers.IO){
|
||||
last_image_task = GlobalScope.launch(Dispatchers.Main) {
|
||||
val bitmap = try {
|
||||
withContext(Dispatchers.IO) {
|
||||
try {
|
||||
createResizedBitmap(
|
||||
activity, url.toUri(),
|
||||
|
@ -866,11 +871,11 @@ class ColumnViewHolder(
|
|||
null
|
||||
}
|
||||
}
|
||||
}catch(ex:Throwable){
|
||||
} catch(ex : Throwable) {
|
||||
null
|
||||
}
|
||||
if(bitmap != null) {
|
||||
if(!coroutineContext.isActive || url != last_image_uri) {
|
||||
if(! coroutineContext.isActive || url != last_image_uri) {
|
||||
bitmap.recycle()
|
||||
} else {
|
||||
last_image_bitmap = bitmap
|
||||
|
@ -936,6 +941,12 @@ class ColumnViewHolder(
|
|||
column.startLoading()
|
||||
}
|
||||
|
||||
cbRemoteOnly -> {
|
||||
column.remote_only = isChecked
|
||||
activity.app_state.saveColumnList()
|
||||
column.startLoading()
|
||||
}
|
||||
|
||||
cbWithHighlight -> {
|
||||
column.with_highlight = isChecked
|
||||
activity.app_state.saveColumnList()
|
||||
|
@ -1923,6 +1934,10 @@ class ColumnViewHolder(
|
|||
text = context.getString(R.string.dont_close_column)
|
||||
}.lparams(matchParent, wrapContent)
|
||||
|
||||
cbRemoteOnly = checkBox {
|
||||
text = context.getString(R.string.remote_only)
|
||||
}.lparams(matchParent, wrapContent)
|
||||
|
||||
cbWithAttachment = checkBox {
|
||||
text = context.getString(R.string.with_attachment)
|
||||
}.lparams(matchParent, wrapContent)
|
||||
|
|
|
@ -574,19 +574,16 @@ internal class StreamReader(
|
|||
streamCallback : StreamCallback
|
||||
) : StreamingIndicatorState {
|
||||
synchronized(reader_list) {
|
||||
for(reader in reader_list) {
|
||||
if(reader.access_info.db_id == accessInfo.db_id
|
||||
&& reader.end_point == endPoint
|
||||
&& reader.containsCallback(streamCallback)
|
||||
) {
|
||||
return if(reader.bListening.get() && reader.socket.get() != null) {
|
||||
StreamingIndicatorState.LISTENING
|
||||
} else {
|
||||
StreamingIndicatorState.REGISTERED
|
||||
}
|
||||
}
|
||||
val reader = reader_list.find{
|
||||
it.access_info.db_id == accessInfo.db_id
|
||||
it.end_point == endPoint
|
||||
it.containsCallback(streamCallback)
|
||||
}
|
||||
return when{
|
||||
reader ==null ->StreamingIndicatorState.NONE
|
||||
reader.bListening.get() && reader.socket.get() != null -> StreamingIndicatorState.LISTENING
|
||||
else -> StreamingIndicatorState.REGISTERED
|
||||
}
|
||||
}
|
||||
return StreamingIndicatorState.NONE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1016,4 +1016,5 @@
|
|||
<string name="quote">引用</string>
|
||||
<string name="promoted">宣伝</string>
|
||||
<string name="featured">紹介</string>
|
||||
<string name="remote_only">リモートのみ</string>
|
||||
</resources>
|
||||
|
|
|
@ -1021,4 +1021,5 @@
|
|||
<string name="quote">Quote</string>
|
||||
<string name="promoted">Promoted</string>
|
||||
<string name="featured">Featured</string>
|
||||
<string name="remote_only">Remote only</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue