mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Standardise spelling and casing of homeserver
Signed-off-by: Paulo Pinto <paulo.pinto@automattic.com>
This commit is contained in:
parent
c08bd664ab
commit
e61c8c28bb
@ -2,11 +2,11 @@ This document aims to describe how Element android displays notifications to the
|
|||||||
|
|
||||||
# Table of Contents
|
# Table of Contents
|
||||||
1. [Prerequisites Knowledge](#prerequisites-knowledge)
|
1. [Prerequisites Knowledge](#prerequisites-knowledge)
|
||||||
* [How does a matrix client get a message from a Home Server?](#how-does-a-matrix-client-get-a-message-from-a-home-server)
|
* [How does a matrix client get a message from a homeserver?](#how-does-a-matrix-client-get-a-message-from-a-homeserver)
|
||||||
* [How does a mobile app receives push notification?](#how-does-a-mobile-app-receives-push-notification)
|
* [How does a mobile app receives push notification?](#how-does-a-mobile-app-receives-push-notification)
|
||||||
* [Push VS Notification](#push-vs-notification)
|
* [Push VS Notification](#push-vs-notification)
|
||||||
* [Push in the matrix federated world](#push-in-the-matrix-federated-world)
|
* [Push in the matrix federated world](#push-in-the-matrix-federated-world)
|
||||||
* [How does the Home Server knows when to notify a client?](#how-does-the-home-server-knows-when-to-notify-a-client)
|
* [How does the homeserver know when to notify a client?](#how-does-the-homeserver-know-when-to-notify-a-client)
|
||||||
* [Push vs privacy, and mitigation](#push-vs-privacy-and-mitigation)
|
* [Push vs privacy, and mitigation](#push-vs-privacy-and-mitigation)
|
||||||
* [Background processing limitations](#background-processing-limitations)
|
* [Background processing limitations](#background-processing-limitations)
|
||||||
2. [Element Notification implementations](#element-notification-implementations)
|
2. [Element Notification implementations](#element-notification-implementations)
|
||||||
@ -22,9 +22,9 @@ First let's start with some prerequisite knowledge
|
|||||||
|
|
||||||
# Prerequisites Knowledge
|
# Prerequisites Knowledge
|
||||||
|
|
||||||
## How does a matrix client get a message from a Home Server?
|
## How does a matrix client get a message from a homeserver?
|
||||||
|
|
||||||
In order to get messages from a home server, a matrix client need to perform a ``sync`` operation.
|
In order to get messages from a homeserver, a matrix client need to perform a ``sync`` operation.
|
||||||
|
|
||||||
`To read events, the intended flow of operation is for clients to first call the /sync API without a since parameter. This returns the most recent message events for each room, as well as the state of the room at the start of the returned timeline. `
|
`To read events, the intended flow of operation is for clients to first call the /sync API without a since parameter. This returns the most recent message events for each room, as well as the state of the room at the start of the returned timeline. `
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ That means that Element Android, a matrix client created by New Vector, is using
|
|||||||
|
|
||||||
If you create your own matrix client, you will also need to deploy an instance of a **Push Gateway** with the credentials needed to use FCM for your app.
|
If you create your own matrix client, you will also need to deploy an instance of a **Push Gateway** with the credentials needed to use FCM for your app.
|
||||||
|
|
||||||
On registration, a matrix client must tell to it's Home Server what Push Gateway to use.
|
On registration, a matrix client must tell its homeserver what Push Gateway to use.
|
||||||
|
|
||||||
See [Sygnal](https://github.com/matrix-org/sygnal/) for a reference implementation.
|
See [Sygnal](https://github.com/matrix-org/sygnal/) for a reference implementation.
|
||||||
```
|
```
|
||||||
@ -122,13 +122,13 @@ Recommended reading:
|
|||||||
* https://matrix.org/docs/spec/client_server/r0.4.0.html#id128
|
* https://matrix.org/docs/spec/client_server/r0.4.0.html#id128
|
||||||
|
|
||||||
|
|
||||||
## How does the Home Server knows when to notify a client?
|
## How does the homeserver know when to notify a client?
|
||||||
|
|
||||||
This is defined by [**push rules**](https://matrix.org/docs/spec/client_server/r0.4.0.html#push-rules-).
|
This is defined by [**push rules**](https://matrix.org/docs/spec/client_server/r0.4.0.html#push-rules-).
|
||||||
|
|
||||||
`A push rule is a single rule that states under what conditions an event should be passed onto a push gateway and how the notification should be presented (sound / importance).`
|
`A push rule is a single rule that states under what conditions an event should be passed onto a push gateway and how the notification should be presented (sound / importance).`
|
||||||
|
|
||||||
A Home Server can be configured with default rules (for Direct messages, group messages, mentions, etc.. ).
|
A homeserver can be configured with default rules (for Direct messages, group messages, mentions, etc.. ).
|
||||||
|
|
||||||
There are different kind of push rules, it can be per room (each new message on this room should be notified), it can also define a pattern that a message should match (when you are mentioned, or key word based).
|
There are different kind of push rules, it can be per room (each new message on this room should be notified), it can also define a pattern that a message should match (when you are mentioned, or key word based).
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ Homeserver ----> Sygnal ----> FCM ----> Element
|
|||||||
|
|
||||||
**Possible outcomes**
|
**Possible outcomes**
|
||||||
|
|
||||||
Upon reception of the FCM push, Element will perform a sync call to the Home Server, during this process it is possible that:
|
Upon reception of the FCM push, Element will perform a sync call to the homeserver, during this process it is possible that:
|
||||||
* Happy path, the sync is performed, the message resolved and displayed in the notification drawer
|
* Happy path, the sync is performed, the message resolved and displayed in the notification drawer
|
||||||
* The notified message is not in the sync. Can happen if a lot of things did happen since the push (`gappy sync`)
|
* The notified message is not in the sync. Can happen if a lot of things did happen since the push (`gappy sync`)
|
||||||
* The sync generates additional notifications (e.g an encrypted message where the user is mentioned detected locally)
|
* The sync generates additional notifications (e.g an encrypted message where the user is mentioned detected locally)
|
||||||
|
@ -78,7 +78,7 @@ class CommonTestHelper(context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Home server configuration, with Http connection allowed for test
|
* Create a homeserver configuration, with Http connection allowed for test
|
||||||
*/
|
*/
|
||||||
fun createHomeServerConfig(): HomeServerConnectionConfig {
|
fun createHomeServerConfig(): HomeServerConnectionConfig {
|
||||||
return HomeServerConnectionConfig.Builder()
|
return HomeServerConnectionConfig.Builder()
|
||||||
|
@ -816,7 +816,7 @@ class KeysBackupTest : InstrumentedTest {
|
|||||||
// - Do an e2e backup to the homeserver
|
// - Do an e2e backup to the homeserver
|
||||||
mKeysBackupTestHelper.prepareAndCreateKeysBackupData(keysBackup)
|
mKeysBackupTestHelper.prepareAndCreateKeysBackupData(keysBackup)
|
||||||
|
|
||||||
// Get key backup version from the home server
|
// Get key backup version from the homeserver
|
||||||
val keysVersionResult = mTestHelper.doSync<KeysVersionResult?> {
|
val keysVersionResult = mTestHelper.doSync<KeysVersionResult?> {
|
||||||
keysBackup.getCurrentVersion(it)
|
keysBackup.getCurrentVersion(it)
|
||||||
}
|
}
|
||||||
|
@ -73,14 +73,14 @@ data class HomeServerConnectionConfig(
|
|||||||
*/
|
*/
|
||||||
fun withHomeServerUri(hsUri: Uri): Builder {
|
fun withHomeServerUri(hsUri: Uri): Builder {
|
||||||
if (hsUri.scheme != "http" && hsUri.scheme != "https") {
|
if (hsUri.scheme != "http" && hsUri.scheme != "https") {
|
||||||
throw RuntimeException("Invalid home server URI: $hsUri")
|
throw RuntimeException("Invalid homeserver URI: $hsUri")
|
||||||
}
|
}
|
||||||
// ensure trailing /
|
// ensure trailing /
|
||||||
val hsString = hsUri.toString().ensureTrailingSlash()
|
val hsString = hsUri.toString().ensureTrailingSlash()
|
||||||
homeServerUri = try {
|
homeServerUri = try {
|
||||||
Uri.parse(hsString)
|
Uri.parse(hsString)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
throw RuntimeException("Invalid home server URI: $hsUri")
|
throw RuntimeException("Invalid homeserver URI: $hsUri")
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ data class HomeServerConnectionConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an accepted TLS version for TLS connections with the home server.
|
* Add an accepted TLS version for TLS connections with the homeserver.
|
||||||
*
|
*
|
||||||
* @param tlsVersion the tls version to add to the set of TLS versions accepted.
|
* @param tlsVersion the tls version to add to the set of TLS versions accepted.
|
||||||
* @return this builder
|
* @return this builder
|
||||||
@ -160,7 +160,7 @@ data class HomeServerConnectionConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a TLS cipher suite to the list of accepted TLS connections with the home server.
|
* Add a TLS cipher suite to the list of accepted TLS connections with the homeserver.
|
||||||
*
|
*
|
||||||
* @param tlsCipherSuite the tls cipher suite to add.
|
* @param tlsCipherSuite the tls cipher suite to add.
|
||||||
* @return this builder
|
* @return this builder
|
||||||
|
@ -38,7 +38,7 @@ data class RegistrationFlowResponse(
|
|||||||
val completedStages: List<String>? = null,
|
val completedStages: List<String>? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The session identifier that the client must pass back to the home server, if one is provided,
|
* The session identifier that the client must pass back to the homeserver, if one is provided,
|
||||||
* in subsequent attempts to authenticate in the same API call.
|
* in subsequent attempts to authenticate in the same API call.
|
||||||
*/
|
*/
|
||||||
@Json(name = "session")
|
@Json(name = "session")
|
||||||
|
@ -28,7 +28,7 @@ import org.matrix.android.sdk.internal.crypto.store.SavedKeyBackupKeyInfo
|
|||||||
|
|
||||||
interface KeysBackupService {
|
interface KeysBackupService {
|
||||||
/**
|
/**
|
||||||
* Retrieve the current version of the backup from the home server
|
* Retrieve the current version of the backup from the homeserver
|
||||||
*
|
*
|
||||||
* It can be different than keysBackupVersion.
|
* It can be different than keysBackupVersion.
|
||||||
* @param callback onSuccess(null) will be called if there is no backup on the server
|
* @param callback onSuccess(null) will be called if there is no backup on the server
|
||||||
|
@ -54,7 +54,7 @@ enum class KeysBackupState {
|
|||||||
// Need to check the current backup version on the homeserver
|
// Need to check the current backup version on the homeserver
|
||||||
Unknown,
|
Unknown,
|
||||||
|
|
||||||
// Checking if backup is enabled on home server
|
// Checking if backup is enabled on homeserver
|
||||||
CheckingBackUpOnHomeserver,
|
CheckingBackUpOnHomeserver,
|
||||||
|
|
||||||
// Backup has been stopped because a new backup version has been detected on the homeserver
|
// Backup has been stopped because a new backup version has been detected on the homeserver
|
||||||
|
@ -104,7 +104,7 @@ data class Event(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The `age` value transcoded in a timestamp based on the device clock when the SDK received
|
* The `age` value transcoded in a timestamp based on the device clock when the SDK received
|
||||||
* the event from the home server.
|
* the event from the homeserver.
|
||||||
* Unlike `age`, this value is static.
|
* Unlike `age`, this value is static.
|
||||||
*/
|
*/
|
||||||
@Transient
|
@Transient
|
||||||
|
@ -38,7 +38,7 @@ internal class DefaultSessionCreator @Inject constructor(
|
|||||||
) : SessionCreator {
|
) : SessionCreator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credentials can affect the homeServerConnectionConfig, override home server url and/or
|
* Credentials can affect the homeServerConnectionConfig, override homeserver url and/or
|
||||||
* identity server url if provided in the credentials
|
* identity server url if provided in the credentials
|
||||||
*/
|
*/
|
||||||
override suspend fun createSession(credentials: Credentials, homeServerConnectionConfig: HomeServerConnectionConfig): Session {
|
override suspend fun createSession(credentials: Credentials, homeServerConnectionConfig: HomeServerConnectionConfig): Session {
|
||||||
|
@ -56,7 +56,7 @@ data class MXDeviceInfo(
|
|||||||
val signatures: Map<String, Map<String, String>>? = null,
|
val signatures: Map<String, Map<String, String>>? = null,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Additional data from the home server.
|
* Additional data from the homeserver.
|
||||||
*/
|
*/
|
||||||
@Json(name = "unsigned")
|
@Json(name = "unsigned")
|
||||||
val unsigned: JsonDict? = null,
|
val unsigned: JsonDict? = null,
|
||||||
|
@ -41,7 +41,7 @@ public class Credentials {
|
|||||||
|
|
||||||
public String deviceId;
|
public String deviceId;
|
||||||
|
|
||||||
// Optional data that may contain info to override home server and/or identity server
|
// Optional data that may contain info to override homeserver and/or identity server
|
||||||
public WellKnown wellKnown;
|
public WellKnown wellKnown;
|
||||||
|
|
||||||
public JSONObject toJson() throws JSONException {
|
public JSONObject toJson() throws JSONException {
|
||||||
|
@ -44,7 +44,7 @@ import timber.log.Timber;
|
|||||||
*/
|
*/
|
||||||
public class HomeServerConnectionConfig {
|
public class HomeServerConnectionConfig {
|
||||||
|
|
||||||
// the home server URI
|
// the homeserver URI
|
||||||
private Uri mHomeServerUri;
|
private Uri mHomeServerUri;
|
||||||
// the jitsi server URI. Can be null
|
// the jitsi server URI. Can be null
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -82,7 +82,7 @@ public class HomeServerConnectionConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the home server URI.
|
* Update the homeserver URI.
|
||||||
*
|
*
|
||||||
* @param uri the new HS uri
|
* @param uri the new HS uri
|
||||||
*/
|
*/
|
||||||
@ -91,7 +91,7 @@ public class HomeServerConnectionConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the home server uri
|
* @return the homeserver uri
|
||||||
*/
|
*/
|
||||||
public Uri getHomeserverUri() {
|
public Uri getHomeserverUri() {
|
||||||
return mHomeServerUri;
|
return mHomeServerUri;
|
||||||
@ -145,7 +145,7 @@ public class HomeServerConnectionConfig {
|
|||||||
public void setCredentials(Credentials credentials) {
|
public void setCredentials(Credentials credentials) {
|
||||||
mCredentials = credentials;
|
mCredentials = credentials;
|
||||||
|
|
||||||
// Override home server url and/or identity server url if provided
|
// Override homeserver url and/or identity server url if provided
|
||||||
if (credentials.wellKnown != null) {
|
if (credentials.wellKnown != null) {
|
||||||
if (credentials.wellKnown.homeServer != null) {
|
if (credentials.wellKnown.homeServer != null) {
|
||||||
String homeServerUrl = credentials.wellKnown.homeServer.baseURL;
|
String homeServerUrl = credentials.wellKnown.homeServer.baseURL;
|
||||||
@ -200,7 +200,7 @@ public class HomeServerConnectionConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TLS versions accepted for TLS connections with the home server.
|
* TLS versions accepted for TLS connections with the homeserver.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<TlsVersion> getAcceptedTlsVersions() {
|
public List<TlsVersion> getAcceptedTlsVersions() {
|
||||||
@ -208,7 +208,7 @@ public class HomeServerConnectionConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TLS cipher suites accepted for TLS connections with the home server.
|
* TLS cipher suites accepted for TLS connections with the homeserver.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<CipherSuite> getAcceptedTlsCipherSuites() {
|
public List<CipherSuite> getAcceptedTlsCipherSuites() {
|
||||||
@ -426,7 +426,7 @@ public class HomeServerConnectionConfig {
|
|||||||
*/
|
*/
|
||||||
public Builder withHomeServerUri(final Uri homeServerUri) {
|
public Builder withHomeServerUri(final Uri homeServerUri) {
|
||||||
if (homeServerUri == null || (!"http".equals(homeServerUri.getScheme()) && !"https".equals(homeServerUri.getScheme()))) {
|
if (homeServerUri == null || (!"http".equals(homeServerUri.getScheme()) && !"https".equals(homeServerUri.getScheme()))) {
|
||||||
throw new RuntimeException("Invalid home server URI: " + homeServerUri);
|
throw new RuntimeException("Invalid homeserver URI: " + homeServerUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trailing /
|
// remove trailing /
|
||||||
@ -435,7 +435,7 @@ public class HomeServerConnectionConfig {
|
|||||||
String url = homeServerUri.toString();
|
String url = homeServerUri.toString();
|
||||||
mHomeServerConnectionConfig.mHomeServerUri = Uri.parse(url.substring(0, url.length() - 1));
|
mHomeServerConnectionConfig.mHomeServerUri = Uri.parse(url.substring(0, url.length() - 1));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Invalid home server URI: " + homeServerUri);
|
throw new RuntimeException("Invalid homeserver URI: " + homeServerUri);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mHomeServerConnectionConfig.mHomeServerUri = homeServerUri;
|
mHomeServerConnectionConfig.mHomeServerUri = homeServerUri;
|
||||||
@ -549,7 +549,7 @@ public class HomeServerConnectionConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an accepted TLS version for TLS connections with the home server.
|
* Add an accepted TLS version for TLS connections with the homeserver.
|
||||||
*
|
*
|
||||||
* @param tlsVersion the tls version to add to the set of TLS versions accepted.
|
* @param tlsVersion the tls version to add to the set of TLS versions accepted.
|
||||||
* @return this builder
|
* @return this builder
|
||||||
@ -577,7 +577,7 @@ public class HomeServerConnectionConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a TLS cipher suite to the list of accepted TLS connections with the home server.
|
* Add a TLS cipher suite to the list of accepted TLS connections with the homeserver.
|
||||||
*
|
*
|
||||||
* @param tlsCipherSuite the tls cipher suite to add.
|
* @param tlsCipherSuite the tls cipher suite to add.
|
||||||
* @return this builder
|
* @return this builder
|
||||||
@ -666,7 +666,7 @@ public class HomeServerConnectionConfig {
|
|||||||
public HomeServerConnectionConfig build() {
|
public HomeServerConnectionConfig build() {
|
||||||
// Check mandatory parameters
|
// Check mandatory parameters
|
||||||
if (mHomeServerConnectionConfig.mHomeServerUri == null) {
|
if (mHomeServerConnectionConfig.mHomeServerUri == null) {
|
||||||
throw new RuntimeException("Home server URI not set");
|
throw new RuntimeException("Homeserver URI not set");
|
||||||
}
|
}
|
||||||
|
|
||||||
return mHomeServerConnectionConfig;
|
return mHomeServerConnectionConfig;
|
||||||
|
@ -38,7 +38,7 @@ import timber.log.Timber;
|
|||||||
public class LoginStorage {
|
public class LoginStorage {
|
||||||
private static final String PREFS_LOGIN = "Vector.LoginStorage";
|
private static final String PREFS_LOGIN = "Vector.LoginStorage";
|
||||||
|
|
||||||
// multi accounts + home server config
|
// multi accounts + homeserver config
|
||||||
private static final String PREFS_KEY_CONNECTION_CONFIGS = "PREFS_KEY_CONNECTION_CONFIGS";
|
private static final String PREFS_KEY_CONNECTION_CONFIGS = "PREFS_KEY_CONNECTION_CONFIGS";
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@ -49,7 +49,7 @@ public class LoginStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list of home server configurations.
|
* @return the list of homeserver configurations.
|
||||||
*/
|
*/
|
||||||
public List<HomeServerConnectionConfig> getCredentialsList() {
|
public List<HomeServerConnectionConfig> getCredentialsList() {
|
||||||
SharedPreferences prefs = mContext.getSharedPreferences(PREFS_LOGIN, Context.MODE_PRIVATE);
|
SharedPreferences prefs = mContext.getSharedPreferences(PREFS_LOGIN, Context.MODE_PRIVATE);
|
||||||
@ -85,7 +85,7 @@ public class LoginStorage {
|
|||||||
/**
|
/**
|
||||||
* Add a credentials to the credentials list
|
* Add a credentials to the credentials list
|
||||||
*
|
*
|
||||||
* @param config the home server config to add.
|
* @param config the homeserver config to add.
|
||||||
*/
|
*/
|
||||||
public void addCredentials(HomeServerConnectionConfig config) {
|
public void addCredentials(HomeServerConnectionConfig config) {
|
||||||
if (null != config && config.getCredentials() != null) {
|
if (null != config && config.getCredentials() != null) {
|
||||||
@ -203,4 +203,4 @@ public class LoginStorage {
|
|||||||
//Need to commit now because called before forcing an app restart
|
//Need to commit now because called before forcing an app restart
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ internal class DefaultIdentityService @Inject constructor(
|
|||||||
|
|
||||||
override suspend fun getShareStatus(threePids: List<ThreePid>): Map<ThreePid, SharedState> {
|
override suspend fun getShareStatus(threePids: List<ThreePid>): Map<ThreePid, SharedState> {
|
||||||
// Note: we do not require user consent here, because it is used for emails and phone numbers that the user has already sent
|
// Note: we do not require user consent here, because it is used for emails and phone numbers that the user has already sent
|
||||||
// to the home server, and not emails and phone numbers from the contact book of the user
|
// to the homeserver, and not emails and phone numbers from the contact book of the user
|
||||||
|
|
||||||
if (threePids.isEmpty()) {
|
if (threePids.isEmpty()) {
|
||||||
return emptyMap()
|
return emptyMap()
|
||||||
|
@ -46,7 +46,7 @@ private const val MAX_RETRY_COUNT = 3
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is responsible for sending events in order in each room. It uses the QueuedTask.queueIdentifier to execute tasks sequentially.
|
* This class is responsible for sending events in order in each room. It uses the QueuedTask.queueIdentifier to execute tasks sequentially.
|
||||||
* Each send is retried 3 times, if there is no network (e.g if cannot ping home server) it will wait and
|
* Each send is retried 3 times, if there is no network (e.g if cannot ping homeserver) it will wait and
|
||||||
* periodically test reachability before resume (does not count as a retry)
|
* periodically test reachability before resume (does not count as a retry)
|
||||||
*
|
*
|
||||||
* If the app is killed before all event were sent, on next wakeup the scheduled events will be re posted
|
* If the app is killed before all event were sent, on next wakeup the scheduled events will be re posted
|
||||||
|
@ -42,7 +42,7 @@ import kotlin.concurrent.schedule
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple ever running thread unique for that session responsible of sending events in order.
|
* A simple ever running thread unique for that session responsible of sending events in order.
|
||||||
* Each send is retried 3 times, if there is no network (e.g if cannot ping home server) it will wait and
|
* Each send is retried 3 times, if there is no network (e.g if cannot ping homeserver) it will wait and
|
||||||
* periodically test reachability before resume (does not count as a retry)
|
* periodically test reachability before resume (does not count as a retry)
|
||||||
*
|
*
|
||||||
* If the app is killed before all event were sent, on next wakeup the scheduled events will be re posted
|
* If the app is killed before all event were sent, on next wakeup the scheduled events will be re posted
|
||||||
|
@ -94,7 +94,7 @@ internal class DefaultSyncTask @Inject constructor(
|
|||||||
userStore.createOrUpdate(userId)
|
userStore.createOrUpdate(userId)
|
||||||
initialSyncProgressService.startRoot(InitSyncStep.ImportingAccount, 100)
|
initialSyncProgressService.startRoot(InitSyncStep.ImportingAccount, 100)
|
||||||
}
|
}
|
||||||
// Maybe refresh the home server capabilities data we know
|
// Maybe refresh the homeserver capabilities data we know
|
||||||
getHomeServerCapabilitiesTask.execute(GetHomeServerCapabilitiesTask.Params(forceRefresh = false))
|
getHomeServerCapabilitiesTask.execute(GetHomeServerCapabilitiesTask.Params(forceRefresh = false))
|
||||||
|
|
||||||
val readTimeOut = (params.timeout + TIMEOUT_MARGIN).coerceAtLeast(TimeOutInterceptor.DEFAULT_LONG_TIMEOUT)
|
val readTimeOut = (params.timeout + TIMEOUT_MARGIN).coerceAtLeast(TimeOutInterceptor.DEFAULT_LONG_TIMEOUT)
|
||||||
|
@ -130,7 +130,7 @@ internal class DefaultGetWellknownTask @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if home server is valid, and (if applicable) if identity server is pingable
|
* Return true if homeserver is valid, and (if applicable) if identity server is pingable
|
||||||
*/
|
*/
|
||||||
private suspend fun validateHomeServer(homeServerBaseUrl: String, wellKnown: WellKnown, client: OkHttpClient): WellknownResult {
|
private suspend fun validateHomeServer(homeServerBaseUrl: String, wellKnown: WellKnown, client: OkHttpClient): WellknownResult {
|
||||||
val capabilitiesAPI = retrofitFactory.create(client, homeServerBaseUrl)
|
val capabilitiesAPI = retrofitFactory.create(client, homeServerBaseUrl)
|
||||||
@ -186,7 +186,7 @@ internal class DefaultGetWellknownTask @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to get an identity server URL from a home server URL, using a .wellknown request
|
* Try to get an identity server URL from a homeserver URL, using a .wellknown request
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
fun getIdentityServer(homeServerUrl: String, callback: ApiCallback<String?>) {
|
fun getIdentityServer(homeServerUrl: String, callback: ApiCallback<String?>) {
|
||||||
|
@ -66,7 +66,7 @@ public class MXDeviceInfo implements Serializable {
|
|||||||
public Map<String, Map<String, String>> signatures;
|
public Map<String, Map<String, String>> signatures;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Additional data from the home server.
|
* Additional data from the homeserver.
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> unsigned;
|
public Map<String, Object> unsigned;
|
||||||
|
|
||||||
@ -81,4 +81,4 @@ public class MXDeviceInfo implements Serializable {
|
|||||||
public MXDeviceInfo() {
|
public MXDeviceInfo() {
|
||||||
mVerified = DEVICE_VERIFICATION_UNKNOWN;
|
mVerified = DEVICE_VERIFICATION_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ class RegistrationTest {
|
|||||||
onView(withId(R.id.loginSplashSubmit))
|
onView(withId(R.id.loginSplashSubmit))
|
||||||
.perform(click())
|
.perform(click())
|
||||||
|
|
||||||
// Check that home server options are shown
|
// Check that homeserver options are shown
|
||||||
onView(withId(R.id.loginServerTitle))
|
onView(withId(R.id.loginServerTitle))
|
||||||
.check(matches(isDisplayed()))
|
.check(matches(isDisplayed()))
|
||||||
.check(matches(withText(R.string.login_server_title)))
|
.check(matches(withText(R.string.login_server_title)))
|
||||||
|
@ -486,7 +486,7 @@ class UiAllScreensSanityTest {
|
|||||||
clickOn(R.string.add_identity_server)
|
clickOn(R.string.add_identity_server)
|
||||||
pressBack()
|
pressBack()
|
||||||
pressBack()
|
pressBack()
|
||||||
// Home server
|
// Homeserver
|
||||||
clickOnPreference(R.string.settings_home_server)
|
clickOnPreference(R.string.settings_home_server)
|
||||||
pressBack()
|
pressBack()
|
||||||
// Identity server
|
// Identity server
|
||||||
|
@ -30,7 +30,7 @@ object ServerUrlsRepository {
|
|||||||
private const val DEFAULT_REFERRER_HOME_SERVER_URL_PREF = "default_referrer_home_server_url"
|
private const val DEFAULT_REFERRER_HOME_SERVER_URL_PREF = "default_referrer_home_server_url"
|
||||||
private const val DEFAULT_REFERRER_IDENTITY_SERVER_URL_PREF = "default_referrer_identity_server_url"
|
private const val DEFAULT_REFERRER_IDENTITY_SERVER_URL_PREF = "default_referrer_identity_server_url"
|
||||||
|
|
||||||
// Keys used to store current home server url and identity url
|
// Keys used to store current homeserver url and identity url
|
||||||
const val HOME_SERVER_URL_PREF = "home_server_url"
|
const val HOME_SERVER_URL_PREF = "home_server_url"
|
||||||
const val IDENTITY_SERVER_URL_PREF = "identity_server_url"
|
const val IDENTITY_SERVER_URL_PREF = "identity_server_url"
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ object ServerUrlsRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return last used home server url, or the default one from referrer or the default one from resources
|
* Return last used homeserver url, or the default one from referrer or the default one from resources
|
||||||
*/
|
*/
|
||||||
fun getLastHomeServerUrl(context: Context): String {
|
fun getLastHomeServerUrl(context: Context): String {
|
||||||
val prefs = DefaultSharedPreferences.getInstance(context)
|
val prefs = DefaultSharedPreferences.getInstance(context)
|
||||||
@ -73,12 +73,12 @@ object ServerUrlsRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if url is the default home server url form resources
|
* Return true if url is the default homeserver url form resources
|
||||||
*/
|
*/
|
||||||
fun isDefaultHomeServerUrl(context: Context, url: String) = url == getDefaultHomeServerUrl(context)
|
fun isDefaultHomeServerUrl(context: Context, url: String) = url == getDefaultHomeServerUrl(context)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return default home server url from resources
|
* Return default homeserver url from resources
|
||||||
*/
|
*/
|
||||||
fun getDefaultHomeServerUrl(context: Context): String = context.getString(R.string.matrix_org_server_url)
|
fun getDefaultHomeServerUrl(context: Context): String = context.getString(R.string.matrix_org_server_url)
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class LinkHandlerActivity : VectorBaseActivity<ActivityProgressBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the login screen with identity server and home server pre-filled
|
* Start the login screen with identity server and homeserver pre-filled
|
||||||
*/
|
*/
|
||||||
private fun startLoginActivity(uri: Uri) {
|
private fun startLoginActivity(uri: Uri) {
|
||||||
navigator.openLogin(
|
navigator.openLogin(
|
||||||
|
@ -159,7 +159,7 @@ class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment<F
|
|||||||
views.loginServerUrlFormClearHistory.isInvisible = state.knownCustomHomeServersUrls.isEmpty()
|
views.loginServerUrlFormClearHistory.isInvisible = state.knownCustomHomeServersUrls.isEmpty()
|
||||||
|
|
||||||
if (state.loginMode != LoginMode.Unknown) {
|
if (state.loginMode != LoginMode.Unknown) {
|
||||||
// The home server url is valid
|
// The homeserver url is valid
|
||||||
loginViewModel.handle(LoginAction.PostViewEvent(LoginViewEvents.OnLoginFlowRetrieved))
|
loginViewModel.handle(LoginAction.PostViewEvent(LoginViewEvents.OnLoginFlowRetrieved))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ class LoginViewModel @AssistedInject constructor(
|
|||||||
is WellknownResult.Prompt ->
|
is WellknownResult.Prompt ->
|
||||||
onWellknownSuccess(action, data, homeServerConnectionConfig)
|
onWellknownSuccess(action, data, homeServerConnectionConfig)
|
||||||
is WellknownResult.FailPrompt ->
|
is WellknownResult.FailPrompt ->
|
||||||
// Relax on IS discovery if home server is valid
|
// Relax on IS discovery if homeserver is valid
|
||||||
if (data.homeServerUrl != null && data.wellKnown != null) {
|
if (data.homeServerUrl != null && data.wellKnown != null) {
|
||||||
onWellknownSuccess(action, WellknownResult.Prompt(data.homeServerUrl!!, null, data.wellKnown!!), homeServerConnectionConfig)
|
onWellknownSuccess(action, WellknownResult.Prompt(data.homeServerUrl!!, null, data.wellKnown!!), homeServerConnectionConfig)
|
||||||
} else {
|
} else {
|
||||||
|
@ -590,7 +590,7 @@ class LoginViewModel2 @AssistedInject constructor(
|
|||||||
is WellknownResult.Prompt ->
|
is WellknownResult.Prompt ->
|
||||||
onWellknownSuccess(action, data, homeServerConnectionConfig)
|
onWellknownSuccess(action, data, homeServerConnectionConfig)
|
||||||
is WellknownResult.FailPrompt ->
|
is WellknownResult.FailPrompt ->
|
||||||
// Relax on IS discovery if home server is valid
|
// Relax on IS discovery if homeserver is valid
|
||||||
if (data.homeServerUrl != null && data.wellKnown != null) {
|
if (data.homeServerUrl != null && data.wellKnown != null) {
|
||||||
onWellknownSuccess(action, WellknownResult.Prompt(data.homeServerUrl!!, null, data.wellKnown!!), homeServerConnectionConfig)
|
onWellknownSuccess(action, WellknownResult.Prompt(data.homeServerUrl!!, null, data.wellKnown!!), homeServerConnectionConfig)
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,7 +22,7 @@ package im.vector.app.features.roomdirectory
|
|||||||
data class RoomDirectoryData(
|
data class RoomDirectoryData(
|
||||||
/**
|
/**
|
||||||
* The server name (might be null)
|
* The server name (might be null)
|
||||||
* Set null when the server is the current user's home server.
|
* Set null when the server is the current user's homeserver.
|
||||||
*/
|
*/
|
||||||
val homeServer: String? = null,
|
val homeServer: String? = null,
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ data class RoomPreviewViewState(
|
|||||||
|
|
||||||
val shouldPeekFromServer: Boolean = false,
|
val shouldPeekFromServer: Boolean = false,
|
||||||
/**
|
/**
|
||||||
* Can be empty when the server is the current user's home server.
|
* Can be empty when the server is the current user's homeserver.
|
||||||
*/
|
*/
|
||||||
val homeServers: List<String> = emptyList(),
|
val homeServers: List<String> = emptyList(),
|
||||||
// Current state of the room in preview
|
// Current state of the room in preview
|
||||||
|
@ -273,7 +273,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
|||||||
fun clearPreferences() {
|
fun clearPreferences() {
|
||||||
val keysToKeep = HashSet(mKeysToKeepAfterLogout)
|
val keysToKeep = HashSet(mKeysToKeepAfterLogout)
|
||||||
|
|
||||||
// home server urls
|
// homeserver urls
|
||||||
keysToKeep.add(ServerUrlsRepository.HOME_SERVER_URL_PREF)
|
keysToKeep.add(ServerUrlsRepository.HOME_SERVER_URL_PREF)
|
||||||
keysToKeep.add(ServerUrlsRepository.IDENTITY_SERVER_URL_PREF)
|
keysToKeep.add(ServerUrlsRepository.IDENTITY_SERVER_URL_PREF)
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ class VectorSettingsGeneralFragment @Inject constructor(
|
|||||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_LOGGED_IN_PREFERENCE_KEY)!!
|
findPreference<VectorPreference>(VectorPreferences.SETTINGS_LOGGED_IN_PREFERENCE_KEY)!!
|
||||||
.summary = session.myUserId
|
.summary = session.myUserId
|
||||||
|
|
||||||
// home server
|
// homeserver
|
||||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_HOME_SERVER_PREFERENCE_KEY)!!
|
findPreference<VectorPreference>(VectorPreferences.SETTINGS_HOME_SERVER_PREFERENCE_KEY)!!
|
||||||
.summary = session.sessionParams.homeServerUrl
|
.summary = session.sessionParams.homeServerUrl
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
|||||||
.find { it.ruleId == RuleIds.RULE_ID_DISABLE_ALL }
|
.find { it.ruleId == RuleIds.RULE_ID_DISABLE_ALL }
|
||||||
|
|
||||||
if (mRuleMaster == null) {
|
if (mRuleMaster == null) {
|
||||||
// The home server does not support RULE_ID_DISABLE_ALL, so hide the preference
|
// The homeserver does not support RULE_ID_DISABLE_ALL, so hide the preference
|
||||||
pref.isVisible = false
|
pref.isVisible = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class ConsentWebViewEventListener(activity: VectorBaseActivity<*>,
|
|||||||
session.profileApiClient
|
session.profileApiClient
|
||||||
.displayname(RIOT_BOT_ID, object : MatrixCallback<String>(createRiotBotRoomCallback) {
|
.displayname(RIOT_BOT_ID, object : MatrixCallback<String>(createRiotBotRoomCallback) {
|
||||||
override fun onSuccess(info: String?) {
|
override fun onSuccess(info: String?) {
|
||||||
// Ok, the Home Server knows riot-Bot, so create a Room with him
|
// Ok, the homeserver knows riot-Bot, so create a Room with him
|
||||||
session.createDirectMessageRoom(RIOT_BOT_ID, createRiotBotRoomCallback)
|
session.createDirectMessageRoom(RIOT_BOT_ID, createRiotBotRoomCallback)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="6dp"
|
android:padding="6dp"
|
||||||
tools:text="Home Server URL: http://matrix.org" />
|
tools:text="Homeserver URL: http://matrix.org" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/ssl_fingerprint_title"
|
android:id="@+id/ssl_fingerprint_title"
|
||||||
@ -60,4 +60,4 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
Loading…
Reference in New Issue
Block a user