Remove default identity server as we don't use it.

This commit is contained in:
ganfra 2019-07-29 18:26:26 +02:00
parent 6176520805
commit 65f0af918f
5 changed files with 16 additions and 51 deletions

View file

@ -31,7 +31,7 @@ import okhttp3.TlsVersion
@JsonClass(generateAdapter = true)
data class HomeServerConnectionConfig(
val homeServerUri: Uri,
val identityServerUri: Uri,
val identityServerUri: Uri? = null,
val antiVirusServerUri: Uri? = null,
val allowedFingerprints: MutableList<Fingerprint> = ArrayList(),
val shouldPin: Boolean = false,
@ -48,7 +48,7 @@ data class HomeServerConnectionConfig(
class Builder {
private lateinit var homeServerUri: Uri
private lateinit var identityServerUri: Uri
private var identityServerUri: Uri? = null
private var antiVirusServerUri: Uri? = null
private val allowedFingerprints: MutableList<Fingerprint> = ArrayList()
private var shouldPin: Boolean = false

View file

@ -128,8 +128,8 @@ class CreateRoomParams {
contentMap["algorithm"] = algorithm
val algoEvent = Event(type = EventType.ENCRYPTION,
stateKey = "",
content = contentMap.toContent()
stateKey = "",
content = contentMap.toContent()
)
if (null == initialStates) {
@ -162,8 +162,8 @@ class CreateRoomParams {
contentMap["history_visibility"] = historyVisibility
val historyVisibilityEvent = Event(type = EventType.STATE_HISTORY_VISIBILITY,
stateKey = "",
content = contentMap.toContent())
stateKey = "",
content = contentMap.toContent())
if (null == initialStates) {
initialStates = Arrays.asList<Event>(historyVisibilityEvent)
@ -202,8 +202,8 @@ class CreateRoomParams {
*/
fun isDirect(): Boolean {
return preset == CreateRoomPreset.PRESET_TRUSTED_PRIVATE_CHAT
&& isDirect == true
&& (1 == getInviteCount() || 1 == getInvite3PidCount())
&& isDirect == true
&& (1 == getInviteCount() || 1 == getInvite3PidCount())
}
/**
@ -223,14 +223,13 @@ class CreateRoomParams {
credentials: Credentials,
ids: List<String>) {
for (id in ids) {
if (Patterns.EMAIL_ADDRESS.matcher(id).matches()) {
if (Patterns.EMAIL_ADDRESS.matcher(id).matches() && hsConfig.identityServerUri != null) {
if (null == invite3pids) {
invite3pids = ArrayList()
}
val pid = Invite3Pid(idServer = hsConfig.identityServerUri.host!!,
medium = ThreePidMedium.EMAIL,
address = id)
medium = ThreePidMedium.EMAIL,
address = id)
invite3pids!!.add(pid)
} else if (isUserId(id)) {

View file

@ -69,39 +69,19 @@ object ServerUrlsRepository {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getString(HOME_SERVER_URL_PREF,
prefs.getString(DEFAULT_REFERRER_HOME_SERVER_URL_PREF,
getDefaultHomeServerUrl(context)))
prefs.getString(DEFAULT_REFERRER_HOME_SERVER_URL_PREF,
getDefaultHomeServerUrl(context)))
}
/**
* Return last used identity server url, or the default one from referrer or the default one from resources
*/
fun getLastIdentityServerUrl(context: Context): String {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getString(IDENTITY_SERVER_URL_PREF,
prefs.getString(DEFAULT_REFERRER_IDENTITY_SERVER_URL_PREF,
getDefaultIdentityServerUrl(context)))
}
/**
* Return true if url is the default home server url form resources
*/
fun isDefaultHomeServerUrl(context: Context, url: String) = url == getDefaultHomeServerUrl(context)
/**
* Return true if url is the default identity server url form resources
*/
fun isDefaultIdentityServerUrl(context: Context, url: String) = url == getDefaultIdentityServerUrl(context)
/**
* Return default home server url from resources
*/
fun getDefaultHomeServerUrl(context: Context): String = context.getString(R.string.default_hs_server_url)
/**
* Return default identity server url from resources
*/
fun getDefaultIdentityServerUrl(context: Context): String = context.getString(R.string.default_identity_server_url)
}

View file

@ -37,6 +37,7 @@ import im.vector.riotx.core.platform.VectorBaseActivity
import im.vector.riotx.core.utils.openUrlInExternalBrowser
import im.vector.riotx.features.disclaimer.showDisclaimerDialog
import im.vector.riotx.features.home.HomeActivity
import im.vector.riotx.features.homeserver.ServerUrlsRepository
import im.vector.riotx.features.notifications.PushRuleTriggerListener
import io.reactivex.Observable
import io.reactivex.functions.Function3
@ -44,9 +45,6 @@ import io.reactivex.rxkotlin.subscribeBy
import kotlinx.android.synthetic.main.activity_login.*
import javax.inject.Inject
private const val DEFAULT_HOME_SERVER_URI = "https://matrix.org"
private const val DEFAULT_IDENTITY_SERVER_URI = "https://vector.im"
private const val DEFAULT_ANTIVIRUS_SERVER_URI = "https://matrix.org"
class LoginActivity : VectorBaseActivity() {
@ -66,7 +64,7 @@ class LoginActivity : VectorBaseActivity() {
setupNotice()
setupAuthButton()
setupPasswordReveal()
homeServerField.setText(DEFAULT_HOME_SERVER_URI)
homeServerField.setText(ServerUrlsRepository.getDefaultHomeServerUrl(this))
}
private fun setupNotice() {
@ -118,8 +116,6 @@ class LoginActivity : VectorBaseActivity() {
val homeServerUri = homeServerField.text?.trim().toString()
HomeServerConnectionConfig.Builder()
.withHomeServerUri(homeServerUri)
.withIdentityServerUri(DEFAULT_IDENTITY_SERVER_URI)
.withAntiVirusServerUri(DEFAULT_ANTIVIRUS_SERVER_URI)
.build()
}
}

View file

@ -4,26 +4,16 @@
<!-- "app_name" is now defined in build.gradle -->
<!-- server urls -->
<string name="vector_im_server_url" translatable="false">https://vector.im</string>
<string name="matrix_org_server_url" translatable="false">https://matrix.org</string>
<string name="default_hs_server_url" translatable="false">https://matrix.org</string>
<string name="default_identity_server_url" translatable="false">https://vector.im</string>
<string name="piwik_server_url" translatable="false">https://piwik.riot.im</string>
<string name="bug_report_url" translatable="false">https://riot.im/bugreports/submit</string>
<!-- Widget urls -->
<string name="integrations_ui_url" translatable="false">"https://scalar-staging.riot.im/scalar-web/"</string>
<string name="integrations_rest_url" translatable="false">"https://scalar-staging.riot.im/scalar/api"</string>
<string-array name="integrations_widgets_urls" translatable="false">
<item>https://scalar-staging.riot.im/scalar/api</item>
<item>https://scalar.vector.im/api</item>
</string-array>
<!--
Pusher config for the application
https://matrix.org/docs/spec/client_server/r0.4.0#id128
-->
<string name="pusher_http_url" translatable="false">https://matrix.org/_matrix/push/v1/notify</string>
<string name="pusher_app_id" translatable="false">im.vector.app.android</string>