You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix push gateway with some push provider (Sunup/autopush) (#5741)
* Add more HTTP response code returning NoMatrixGateway
Fix Push notifications with Mozilla's autopush that returns 406
* Update gateway resolver tests to match new known errors
Copy file name to clipboardExpand all lines: libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushGatewayResolver.kt
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -64,8 +64,9 @@ class DefaultUnifiedPushGatewayResolver(
64
64
UnifiedPushGatewayResolverResult.NoMatrixGateway
65
65
}
66
66
} catch (throwable:Throwable) {
67
-
if ((throwable as?HttpException)?.code() ==HttpURLConnection.HTTP_NOT_FOUND) {
68
-
Timber.tag(loggerTag.value).i("Checking for UnifiedPush endpoint yielded 404, using fallback")
67
+
val code = (throwable as?HttpException)?.code()
68
+
if (code inNoMatrixGatewayResp) {
69
+
Timber.tag(loggerTag.value).i("Checking for UnifiedPush endpoint yielded $code, using fallback")
69
70
UnifiedPushGatewayResolverResult.NoMatrixGateway
70
71
} else {
71
72
Timber.tag(loggerTag.value).e(throwable, "Error checking for UnifiedPush endpoint")
@@ -75,4 +76,14 @@ class DefaultUnifiedPushGatewayResolver(
Copy file name to clipboardExpand all lines: libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultUnifiedPushGatewayResolverTest.kt
+31-1Lines changed: 31 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ class DefaultUnifiedPushGatewayResolverTest {
119
119
}
120
120
121
121
@Test
122
-
fun`when a custom url is forbidden (403), Error is returned`() = runTest {
122
+
fun`when a custom url is forbidden (403), NoMatrixGateway is returned`() = runTest {
123
123
val unifiedPushApiFactory =FakeUnifiedPushApiFactory(
0 commit comments