-
Notifications
You must be signed in to change notification settings - Fork 908
[Device Management] Show correct device type icons (PSG-775) #7292
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5c95cee
Adding changelog entry
bf502f4
Set the corresponding deviceType icon in list item and in overview view
3be1513
Adding unit tests
b23520e
Adding new field for last seen user agent in DB with migration
f02b689
Adding unit tests for mapper
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 hidden or 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 @@ | ||
| [Device Management] Show correct device type icons | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ import org.matrix.android.sdk.internal.util.database.RealmMigrator | |
| * mark existing keys as safe. | ||
| * This migration can take long depending on the account | ||
| */ | ||
| internal class MigrateCryptoTo019(realm: DynamicRealm) : RealmMigrator(realm, 18) { | ||
| internal class MigrateCryptoTo019(realm: DynamicRealm) : RealmMigrator(realm, 19) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this cause any issues?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully no. The target version is only used in |
||
|
|
||
| override fun doMigrate(realm: DynamicRealm) { | ||
| realm.schema.get("CrossSigningInfoEntity") | ||
|
|
||
32 changes: 32 additions & 0 deletions
32
...main/java/org/matrix/android/sdk/internal/crypto/store/db/migration/MigrateCryptoTo020.kt
This file contains hidden or 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,32 @@ | ||
| /* | ||
| * Copyright (c) 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.crypto.store.db.migration | ||
|
|
||
| import io.realm.DynamicRealm | ||
| import org.matrix.android.sdk.internal.crypto.store.db.model.MyDeviceLastSeenInfoEntityFields | ||
| import org.matrix.android.sdk.internal.util.database.RealmMigrator | ||
|
|
||
| /** | ||
| * This migration adds a new field into MyDeviceLastSeenInfoEntity corresponding to the last seen user agent. | ||
| */ | ||
| internal class MigrateCryptoTo020(realm: DynamicRealm) : RealmMigrator(realm, 20) { | ||
|
|
||
| override fun doMigrate(realm: DynamicRealm) { | ||
| realm.schema.get("MyDeviceLastSeenInfoEntity") | ||
| ?.addField(MyDeviceLastSeenInfoEntityFields.LAST_SEEN_USER_AGENT, String::class.java) | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
45 changes: 45 additions & 0 deletions
45
...src/main/java/im/vector/app/features/settings/devices/v2/list/SetDeviceTypeIconUseCase.kt
This file contains hidden or 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,45 @@ | ||
| /* | ||
| * Copyright (c) 2022 New Vector Ltd | ||
| * | ||
| * 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 im.vector.app.features.settings.devices.v2.list | ||
|
|
||
| import android.widget.ImageView | ||
| import im.vector.app.R | ||
| import im.vector.app.core.resources.StringProvider | ||
|
|
||
| class SetDeviceTypeIconUseCase { | ||
|
|
||
| fun execute(deviceType: DeviceType, imageView: ImageView, stringProvider: StringProvider) { | ||
| when (deviceType) { | ||
| DeviceType.MOBILE -> { | ||
| imageView.setImageResource(R.drawable.ic_device_type_mobile) | ||
| imageView.contentDescription = stringProvider.getString(R.string.a11y_device_manager_device_type_mobile) | ||
| } | ||
| DeviceType.WEB -> { | ||
| imageView.setImageResource(R.drawable.ic_device_type_web) | ||
| imageView.contentDescription = stringProvider.getString(R.string.a11y_device_manager_device_type_web) | ||
| } | ||
| DeviceType.DESKTOP -> { | ||
| imageView.setImageResource(R.drawable.ic_device_type_desktop) | ||
| imageView.contentDescription = stringProvider.getString(R.string.a11y_device_manager_device_type_desktop) | ||
| } | ||
| DeviceType.UNKNOWN -> { | ||
| imageView.setImageResource(R.drawable.ic_device_type_unknown) | ||
| imageView.contentDescription = stringProvider.getString(R.string.a11y_device_manager_device_type_unknown) | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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.
Should this be 'wip'?
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 have used ".wip" for all related PRs for the new device manager feature since it is under development (behind feature flag).