Remove const val PUSH_GATEWAY_PATH, it makes the code more complex for no added value.
This commit is contained in:
@@ -17,13 +17,11 @@
|
||||
package io.element.android.libraries.pushproviders.unifiedpush
|
||||
|
||||
object UnifiedPushConfig {
|
||||
const val PUSH_GATEWAY_PATH: String = "_matrix/push/v1/notify"
|
||||
|
||||
/**
|
||||
* It is the push gateway for UnifiedPush.
|
||||
* 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/"
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class DefaultUnifiedPushGatewayResolver @Inject constructor(
|
||||
} else {
|
||||
val port = if (url.port != -1) ":${url.port}" else ""
|
||||
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")
|
||||
return withContext(coroutineDispatchers.io) {
|
||||
val api = unifiedPushApiFactory.create(customBase)
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
package io.element.android.libraries.pushproviders.unifiedpush.network
|
||||
|
||||
import io.element.android.libraries.pushproviders.unifiedpush.UnifiedPushConfig
|
||||
import retrofit2.http.GET
|
||||
|
||||
interface UnifiedPushApi {
|
||||
@GET(UnifiedPushConfig.PUSH_GATEWAY_PATH)
|
||||
@GET("_matrix/push/v1/notify")
|
||||
suspend fun discover(): DiscoveryResponse
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class UnifiedPushMatrixGatewayTest @Inject constructor(
|
||||
status = NotificationTroubleshootTestState.Status.Failure(false)
|
||||
)
|
||||
} 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
|
||||
coroutineScope.launch(coroutineDispatchers.io) {
|
||||
val api = unifiedPushApiFactory.create(gatewayBaseUrl)
|
||||
|
||||
Reference in New Issue
Block a user