diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt index f231d3f1..850c4f71 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt @@ -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 = 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 = ArrayList() private var shouldPin: Boolean = false diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/create/CreateRoomParams.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/create/CreateRoomParams.kt index 77c4fcf1..94d6e0a8 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/create/CreateRoomParams.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/create/CreateRoomParams.kt @@ -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(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) { 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)) { diff --git a/vector/src/main/java/im/vector/riotx/features/homeserver/ServerUrlsRepository.kt b/vector/src/main/java/im/vector/riotx/features/homeserver/ServerUrlsRepository.kt index 37ac4400..18587086 100644 --- a/vector/src/main/java/im/vector/riotx/features/homeserver/ServerUrlsRepository.kt +++ b/vector/src/main/java/im/vector/riotx/features/homeserver/ServerUrlsRepository.kt @@ -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) } \ No newline at end of file diff --git a/vector/src/main/java/im/vector/riotx/features/login/LoginActivity.kt b/vector/src/main/java/im/vector/riotx/features/login/LoginActivity.kt index 53519fc4..41eed536 100644 --- a/vector/src/main/java/im/vector/riotx/features/login/LoginActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/login/LoginActivity.kt @@ -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() } } diff --git a/vector/src/main/res/values/config.xml b/vector/src/main/res/values/config.xml index 508b942a..4d81a54e 100755 --- a/vector/src/main/res/values/config.xml +++ b/vector/src/main/res/values/config.xml @@ -4,26 +4,16 @@ - https://vector.im https://matrix.org https://matrix.org - https://vector.im https://piwik.riot.im https://riot.im/bugreports/submit - - "https://scalar-staging.riot.im/scalar-web/" - "https://scalar-staging.riot.im/scalar/api" - - - https://scalar-staging.riot.im/scalar/api - https://scalar.vector.im/api - - + https://matrix.org/_matrix/push/v1/notify im.vector.app.android