-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements MSC3881 (enabled and device_id fields for Pusher API) #7217
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
75935c8
Implements MSC3881 (enabled and device_id fields for Pusher API)
ericdecanini 5c27f65
Adds changelog file
ericdecanini 8c79011
Adds comments to new fields in HttpPusher
ericdecanini 65c8963
Fixes lint error with comments
ericdecanini 52171ef
Changes deviceDisplayName on pusher to use device model name
ericdecanini f724751
Adds new pusher fields to Notification Targets screen
ericdecanini 1f28a2a
Adds PushersMapperTest
ericdecanini 40c2e95
Adds PushersManagerTest
ericdecanini 4cebfa1
Adds missing bindings
ericdecanini d14570d
Replaces AppBuildConfig
ericdecanini f4dc435
Adds bindings to fdroid variant
ericdecanini 0340467
Merge remote-tracking branch 'origin/develop' into feature/eric/msc3881
ericdecanini 42d0e4f
Fixes bindings
ericdecanini d191bfe
Fixes legal copy
ericdecanini 11e251f
Fixes legal copy
ericdecanini cd2e693
Fixes legal copy
ericdecanini 78555ec
Rearranges imports
ericdecanini 31d4fc9
Fixes lint error
ericdecanini 4af2e62
Merge branch 'develop' into feature/eric/msc3881
ericdecanini c94884b
Fixes error
ericdecanini 618cf7a
Fixes error
ericdecanini 267431d
Fixes error
ericdecanini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Implements MSC3881: Parses `enabled` and `device_id` fields from updated Pusher API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...ndroid/src/test/java/org/matrix/android/sdk/internal/database/mapper/PushersMapperTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.internal.database.mapper | ||
|
||
import org.amshove.kluent.shouldBeEqualTo | ||
import org.junit.Test | ||
import org.matrix.android.sdk.test.fixtures.JsonPusherFixture.aJsonPusher | ||
import org.matrix.android.sdk.test.fixtures.PusherEntityFixture.aPusherEntity | ||
|
||
class PushersMapperTest { | ||
|
||
@Test | ||
fun `when mapping PusherEntity, then it is mapped into Pusher successfully`() { | ||
val pusherEntity = aPusherEntity() | ||
|
||
val mappedPusher = PushersMapper.map(pusherEntity) | ||
|
||
mappedPusher.pushKey shouldBeEqualTo pusherEntity.pushKey | ||
mappedPusher.kind shouldBeEqualTo pusherEntity.kind.orEmpty() | ||
mappedPusher.appId shouldBeEqualTo pusherEntity.appId | ||
mappedPusher.appDisplayName shouldBeEqualTo pusherEntity.appDisplayName | ||
mappedPusher.deviceDisplayName shouldBeEqualTo pusherEntity.deviceDisplayName | ||
mappedPusher.profileTag shouldBeEqualTo pusherEntity.profileTag | ||
mappedPusher.lang shouldBeEqualTo pusherEntity.lang | ||
mappedPusher.data.url shouldBeEqualTo pusherEntity.data?.url | ||
mappedPusher.data.format shouldBeEqualTo pusherEntity.data?.format | ||
mappedPusher.enabled shouldBeEqualTo pusherEntity.enabled | ||
mappedPusher.deviceId shouldBeEqualTo pusherEntity.deviceId | ||
mappedPusher.state shouldBeEqualTo pusherEntity.state | ||
} | ||
|
||
@Test | ||
fun `when mapping JsonPusher, then it is mapped into Pusher successfully`() { | ||
val jsonPusher = aJsonPusher() | ||
|
||
val mappedPusherEntity = PushersMapper.map(jsonPusher) | ||
|
||
mappedPusherEntity.pushKey shouldBeEqualTo jsonPusher.pushKey | ||
mappedPusherEntity.kind shouldBeEqualTo jsonPusher.kind | ||
mappedPusherEntity.appId shouldBeEqualTo jsonPusher.appId | ||
mappedPusherEntity.appDisplayName shouldBeEqualTo jsonPusher.appDisplayName | ||
mappedPusherEntity.deviceDisplayName shouldBeEqualTo jsonPusher.deviceDisplayName | ||
mappedPusherEntity.profileTag shouldBeEqualTo jsonPusher.profileTag | ||
mappedPusherEntity.lang shouldBeEqualTo jsonPusher.lang | ||
mappedPusherEntity.data?.url shouldBeEqualTo jsonPusher.data?.url | ||
mappedPusherEntity.data?.format shouldBeEqualTo jsonPusher.data?.format | ||
mappedPusherEntity.enabled shouldBeEqualTo jsonPusher.enabled | ||
mappedPusherEntity.deviceId shouldBeEqualTo jsonPusher.deviceId | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/JsonPusherFixture.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.test.fixtures | ||
|
||
import org.matrix.android.sdk.internal.session.pushers.JsonPusher | ||
import org.matrix.android.sdk.internal.session.pushers.JsonPusherData | ||
|
||
internal object JsonPusherFixture { | ||
|
||
fun aJsonPusher( | ||
pushKey: String = "", | ||
kind: String? = null, | ||
appId: String = "", | ||
appDisplayName: String? = null, | ||
deviceDisplayName: String? = null, | ||
profileTag: String? = null, | ||
lang: String? = null, | ||
data: JsonPusherData? = null, | ||
append: Boolean? = false, | ||
enabled: Boolean = true, | ||
deviceId: String? = null, | ||
) = JsonPusher( | ||
pushKey, | ||
kind, | ||
appId, | ||
appDisplayName, | ||
deviceDisplayName, | ||
profileTag, | ||
lang, | ||
data, | ||
append, | ||
enabled, | ||
deviceId, | ||
) | ||
} |
47 changes: 47 additions & 0 deletions
47
matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/PusherEntityFixture.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.test.fixtures | ||
|
||
import org.matrix.android.sdk.internal.database.model.PusherDataEntity | ||
import org.matrix.android.sdk.internal.database.model.PusherEntity | ||
|
||
internal object PusherEntityFixture { | ||
|
||
fun aPusherEntity( | ||
pushKey: String = "", | ||
kind: String? = null, | ||
appId: String = "", | ||
appDisplayName: String? = null, | ||
deviceDisplayName: String? = null, | ||
profileTag: String? = null, | ||
lang: String? = null, | ||
data: PusherDataEntity? = null, | ||
enabled: Boolean = true, | ||
deviceId: String? = null, | ||
) = PusherEntity( | ||
pushKey, | ||
kind, | ||
appId, | ||
appDisplayName, | ||
deviceDisplayName, | ||
profileTag, | ||
lang, | ||
data, | ||
enabled, | ||
deviceId, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add those bindings in FDroid variant as well, no (in the dedicated
FlavorModule
)?