3.0.0rc1未満ならディレクトリのWebページを開く。サイドメニューからディレクトリを開いた場合も同様。
This commit is contained in:
parent
444768431a
commit
afda5df997
|
@ -12,6 +12,7 @@ import androidx.core.view.GravityCompat
|
|||
import androidx.drawerlayout.widget.DrawerLayout
|
||||
import jp.juggler.subwaytooter.action.Action_Account
|
||||
import jp.juggler.subwaytooter.action.Action_App
|
||||
import jp.juggler.subwaytooter.action.Action_Instance
|
||||
import jp.juggler.subwaytooter.table.SavedAccount
|
||||
import jp.juggler.util.createColoredDrawable
|
||||
import jp.juggler.util.getAttributeColor
|
||||
|
@ -63,7 +64,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.HOME
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -72,7 +73,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.NOTIFICATIONS
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -81,7 +82,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.DIRECT_MESSAGES
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -90,7 +91,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.MISSKEY_HYBRID
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -108,7 +109,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.FEDERATE
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -117,7 +118,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.LIST_LIST
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -143,7 +144,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.FAVOURITES
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -152,7 +153,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.PROFILE
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -170,7 +171,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.FOLLOW_SUGGESTION
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -179,16 +180,13 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.ENDORSEMENT
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
Item(icon = R.drawable.ic_follow_plus, title = R.string.profile_directory) {
|
||||
Action_Account.timeline(
|
||||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.PROFILE_DIRECTORY
|
||||
)
|
||||
Action_Instance.profileDirectoryFromSideMenu(this)
|
||||
|
||||
},
|
||||
|
||||
Item(icon = R.drawable.ic_volume_off, title = R.string.muted_users) {
|
||||
|
@ -196,7 +194,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.MUTES
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -205,7 +203,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.BLOCKS
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -232,7 +230,7 @@ class SideMenuAdapter(
|
|||
this
|
||||
, defaultInsertPosition
|
||||
, ColumnType.SCHEDULED_STATUS
|
||||
|
||||
|
||||
)
|
||||
},
|
||||
|
||||
|
|
|
@ -12,6 +12,48 @@ import java.util.*
|
|||
|
||||
object Action_Instance {
|
||||
|
||||
// サイドメニューからprofile directory を開く
|
||||
fun profileDirectoryFromSideMenu(activity : ActMain) {
|
||||
AccountPicker.pick(
|
||||
activity,
|
||||
bAllowPseudo = true,
|
||||
bAllowMisskey = false,
|
||||
bAllowMastodon = true,
|
||||
bAuto = true,
|
||||
message = activity.getString(
|
||||
R.string.account_picker_add_timeline_of,
|
||||
ColumnType.PROFILE_DIRECTORY.name1(activity)
|
||||
)
|
||||
) { ai ->
|
||||
TootTaskRunner(activity).run(ai, object : TootTask {
|
||||
var ti : TootInstance? = null
|
||||
override fun background(client : TootApiClient) : TootApiResult? {
|
||||
return client.getInstanceInformation()?.also { result ->
|
||||
val (_, instance) = client.parseInstanceInformation(result)
|
||||
ti = instance
|
||||
}
|
||||
}
|
||||
|
||||
override fun handleResult(result : TootApiResult?) {
|
||||
val instance = ti
|
||||
if(result != null && instance != null) {
|
||||
when {
|
||||
! instance.versionGE(TootInstance.VERSION_3_0_0_rc1) ->
|
||||
App1.openBrowser(activity, "https://${ai.host}/explore")
|
||||
|
||||
else -> activity.addColumn(
|
||||
activity.defaultInsertPosition,
|
||||
ai,
|
||||
ColumnType.PROFILE_DIRECTORY,
|
||||
ai.host
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ?@? からprofile directoryを開く
|
||||
fun profileDirectory(
|
||||
activity : ActMain,
|
||||
|
@ -20,7 +62,7 @@ object Action_Instance {
|
|||
instance : TootInstance? = null
|
||||
) {
|
||||
when {
|
||||
instance == null ->{
|
||||
instance == null -> {
|
||||
// インスタンスのバージョン情報がなければ取得してやり直し
|
||||
TootTaskRunner(activity).run(host, object : TootTask {
|
||||
var targetInstance : TootInstance? = null
|
||||
|
@ -48,8 +90,7 @@ object Action_Instance {
|
|||
instance.instanceType == TootInstance.InstanceType.Misskey ->
|
||||
showToast(activity, false, R.string.profile_directory_not_supported_on_misskey)
|
||||
|
||||
// TODO 3.0.0 がリリースされたらバージョン条件を切り替えること
|
||||
! instance.versionGE(TootInstance.VERSION_2_9_2) ->
|
||||
! instance.versionGE(TootInstance.VERSION_3_0_0_rc1) ->
|
||||
App1.openBrowser(activity, "https://$host/explore")
|
||||
|
||||
currentColumn.access_info.host == host ->
|
||||
|
@ -61,8 +102,8 @@ object Action_Instance {
|
|||
ColumnType.PROFILE_DIRECTORY,
|
||||
host
|
||||
)
|
||||
|
||||
else -> addPseudoAccount(activity,host,misskeyVersion = 0) {
|
||||
|
||||
else -> addPseudoAccount(activity, host, misskeyVersion = 0) {
|
||||
activity.addColumn(
|
||||
false,
|
||||
activity.nextPosition(currentColumn),
|
||||
|
|
|
@ -22,8 +22,7 @@ class TootInstance(parser : TootParser, src : JSONObject) {
|
|||
val VERSION_2_4_1 = VersionString("2.4.1")
|
||||
val VERSION_2_6_0 = VersionString("2.6.0")
|
||||
val VERSION_2_7_0_rc1 = VersionString("2.7.0rc1")
|
||||
val VERSION_2_9_2 = VersionString("2.9.2")
|
||||
val VERSION_2_9_3 = VersionString("2.9.3")
|
||||
val VERSION_3_0_0_rc1 = VersionString("3.0.0rc1")
|
||||
|
||||
val MISSKEY_VERSION_11 = VersionString("11.0")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue