mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
Update the UI showing the homeserver API url in developer mode
This commit is contained in:
parent
38cb8bd33e
commit
08000dce55
4 changed files with 19 additions and 4 deletions
|
@ -23,7 +23,8 @@ import org.matrix.android.sdk.api.federation.FederationVersion
|
|||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
|
||||
|
||||
data class HomeServerSettingsViewState(
|
||||
val baseUrl: String = "",
|
||||
val homeserverUrl: String = "",
|
||||
val homeserverClientServerApiUrl: String = "",
|
||||
val homeServerCapabilities: HomeServerCapabilities = HomeServerCapabilities(),
|
||||
val federationVersion: Async<FederationVersion> = Uninitialized
|
||||
) : MvRxState
|
||||
|
|
|
@ -29,13 +29,15 @@ import im.vector.app.core.resources.StringProvider
|
|||
import im.vector.app.features.discovery.settingsCenteredImageItem
|
||||
import im.vector.app.features.discovery.settingsInfoItem
|
||||
import im.vector.app.features.discovery.settingsSectionTitleItem
|
||||
import im.vector.app.features.settings.VectorPreferences
|
||||
import org.matrix.android.sdk.api.federation.FederationVersion
|
||||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
|
||||
import javax.inject.Inject
|
||||
|
||||
class HomeserverSettingsController @Inject constructor(
|
||||
private val stringProvider: StringProvider,
|
||||
private val errorFormatter: ErrorFormatter
|
||||
private val errorFormatter: ErrorFormatter,
|
||||
private val vectorPreferences: VectorPreferences
|
||||
) : TypedEpoxyController<HomeServerSettingsViewState>() {
|
||||
|
||||
var callback: Callback? = null
|
||||
|
@ -78,7 +80,17 @@ class HomeserverSettingsController @Inject constructor(
|
|||
}
|
||||
settingsInfoItem {
|
||||
id("urlValue")
|
||||
helperText(state.baseUrl)
|
||||
helperText(state.homeserverUrl)
|
||||
}
|
||||
if (vectorPreferences.developerMode()) {
|
||||
settingsSectionTitleItem {
|
||||
id("urlApiTitle")
|
||||
titleResId(R.string.hs_client_url)
|
||||
}
|
||||
settingsInfoItem {
|
||||
id("urlApiValue")
|
||||
helperText(state.homeserverClientServerApiUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ class HomeserverSettingsViewModel @AssistedInject constructor(
|
|||
init {
|
||||
setState {
|
||||
copy(
|
||||
baseUrl = session.sessionParams.homeServerUrl,
|
||||
homeserverUrl = session.sessionParams.homeServerUrl,
|
||||
homeserverClientServerApiUrl = session.sessionParams.homeServerUrlBase,
|
||||
homeServerCapabilities = session.getHomeServerCapabilities()
|
||||
)
|
||||
}
|
||||
|
|
|
@ -538,6 +538,7 @@
|
|||
<string name="login">Log in</string>
|
||||
<string name="logout">Sign out</string>
|
||||
<string name="hs_url">Homeserver URL</string>
|
||||
<string name="hs_client_url">Homeserver API URL</string>
|
||||
<string name="identity_url">Identity Server URL</string>
|
||||
<string name="search">Search</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue