Remove const val PUSH_GATEWAY_PATH, it makes the code more complex for no added value.
This commit is contained in:
parent
6eb5610bcc
commit
90352bd1ad
4 changed files with 4 additions and 7 deletions
|
|
@ -17,13 +17,11 @@
|
||||||
package io.element.android.libraries.pushproviders.unifiedpush
|
package io.element.android.libraries.pushproviders.unifiedpush
|
||||||
|
|
||||||
object UnifiedPushConfig {
|
object UnifiedPushConfig {
|
||||||
const val PUSH_GATEWAY_PATH: String = "_matrix/push/v1/notify"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It is the push gateway for UnifiedPush.
|
* It is the push gateway for UnifiedPush.
|
||||||
* Note: default_push_gateway_http_url should have path '/_matrix/push/v1/notify'
|
* Note: default_push_gateway_http_url should have path '/_matrix/push/v1/notify'
|
||||||
*/
|
*/
|
||||||
const val DEFAULT_PUSH_GATEWAY_HTTP_URL: String = "https://matrix.gateway.unifiedpush.org/$PUSH_GATEWAY_PATH"
|
const val DEFAULT_PUSH_GATEWAY_HTTP_URL: String = "https://matrix.gateway.unifiedpush.org/_matrix/push/v1/notify"
|
||||||
|
|
||||||
const val UNIFIED_PUSH_DISTRIBUTORS_URL = "https://unifiedpush.org/users/distributors/"
|
const val UNIFIED_PUSH_DISTRIBUTORS_URL = "https://unifiedpush.org/users/distributors/"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class DefaultUnifiedPushGatewayResolver @Inject constructor(
|
||||||
} else {
|
} else {
|
||||||
val port = if (url.port != -1) ":${url.port}" else ""
|
val port = if (url.port != -1) ":${url.port}" else ""
|
||||||
val customBase = "${url.protocol}://${url.host}$port"
|
val customBase = "${url.protocol}://${url.host}$port"
|
||||||
val customUrl = "$customBase/${UnifiedPushConfig.PUSH_GATEWAY_PATH}"
|
val customUrl = "$customBase/_matrix/push/v1/notify"
|
||||||
Timber.i("Testing $customUrl")
|
Timber.i("Testing $customUrl")
|
||||||
return withContext(coroutineDispatchers.io) {
|
return withContext(coroutineDispatchers.io) {
|
||||||
val api = unifiedPushApiFactory.create(customBase)
|
val api = unifiedPushApiFactory.create(customBase)
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,9 @@
|
||||||
|
|
||||||
package io.element.android.libraries.pushproviders.unifiedpush.network
|
package io.element.android.libraries.pushproviders.unifiedpush.network
|
||||||
|
|
||||||
import io.element.android.libraries.pushproviders.unifiedpush.UnifiedPushConfig
|
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
|
|
||||||
interface UnifiedPushApi {
|
interface UnifiedPushApi {
|
||||||
@GET(UnifiedPushConfig.PUSH_GATEWAY_PATH)
|
@GET("_matrix/push/v1/notify")
|
||||||
suspend fun discover(): DiscoveryResponse
|
suspend fun discover(): DiscoveryResponse
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class UnifiedPushMatrixGatewayTest @Inject constructor(
|
||||||
status = NotificationTroubleshootTestState.Status.Failure(false)
|
status = NotificationTroubleshootTestState.Status.Failure(false)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
val gatewayBaseUrl = config.url.removeSuffix("/${UnifiedPushConfig.PUSH_GATEWAY_PATH}")
|
val gatewayBaseUrl = config.url.removeSuffix("/_matrix/push/v1/notify")
|
||||||
// Checking if the gateway is a Matrix gateway
|
// Checking if the gateway is a Matrix gateway
|
||||||
coroutineScope.launch(coroutineDispatchers.io) {
|
coroutineScope.launch(coroutineDispatchers.io) {
|
||||||
val api = unifiedPushApiFactory.create(gatewayBaseUrl)
|
val api = unifiedPushApiFactory.create(gatewayBaseUrl)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue