mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +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
|
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
|
||||||
|
|
||||||
data class HomeServerSettingsViewState(
|
data class HomeServerSettingsViewState(
|
||||||
val baseUrl: String = "",
|
val homeserverUrl: String = "",
|
||||||
|
val homeserverClientServerApiUrl: String = "",
|
||||||
val homeServerCapabilities: HomeServerCapabilities = HomeServerCapabilities(),
|
val homeServerCapabilities: HomeServerCapabilities = HomeServerCapabilities(),
|
||||||
val federationVersion: Async<FederationVersion> = Uninitialized
|
val federationVersion: Async<FederationVersion> = Uninitialized
|
||||||
) : MvRxState
|
) : 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.settingsCenteredImageItem
|
||||||
import im.vector.app.features.discovery.settingsInfoItem
|
import im.vector.app.features.discovery.settingsInfoItem
|
||||||
import im.vector.app.features.discovery.settingsSectionTitleItem
|
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.federation.FederationVersion
|
||||||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
|
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilities
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class HomeserverSettingsController @Inject constructor(
|
class HomeserverSettingsController @Inject constructor(
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val errorFormatter: ErrorFormatter
|
private val errorFormatter: ErrorFormatter,
|
||||||
|
private val vectorPreferences: VectorPreferences
|
||||||
) : TypedEpoxyController<HomeServerSettingsViewState>() {
|
) : TypedEpoxyController<HomeServerSettingsViewState>() {
|
||||||
|
|
||||||
var callback: Callback? = null
|
var callback: Callback? = null
|
||||||
|
@ -78,7 +80,17 @@ class HomeserverSettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("urlValue")
|
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 {
|
init {
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
baseUrl = session.sessionParams.homeServerUrl,
|
homeserverUrl = session.sessionParams.homeServerUrl,
|
||||||
|
homeserverClientServerApiUrl = session.sessionParams.homeServerUrlBase,
|
||||||
homeServerCapabilities = session.getHomeServerCapabilities()
|
homeServerCapabilities = session.getHomeServerCapabilities()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -538,6 +538,7 @@
|
||||||
<string name="login">Log in</string>
|
<string name="login">Log in</string>
|
||||||
<string name="logout">Sign out</string>
|
<string name="logout">Sign out</string>
|
||||||
<string name="hs_url">Homeserver URL</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="identity_url">Identity Server URL</string>
|
||||||
<string name="search">Search</string>
|
<string name="search">Search</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue