-
Notifications
You must be signed in to change notification settings - Fork 913
Remind unverified sessions with a banner once a week (PSG-892) #7694
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 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
59ac3b4
Update new strings of unverified sessions alert.
821a561
Add timeout preference for alert.
8835e4d
Create use case to decide to show alert.
4050975
Implement new logic for new login banner.
f576f83
Add changelog.
980d59a
Fix lint.
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 |
|---|---|---|
|
|
@@ -2647,8 +2647,12 @@ | |
| <string name="unencrypted">Unencrypted</string> | ||
| <string name="encrypted_unverified">Encrypted by an unverified device</string> | ||
| <string name="key_authenticity_not_guaranteed">The authenticity of this encrypted message can\'t be guaranteed on this device.</string> | ||
| <!-- TODO TO BE REMOVED --> | ||
| <string name="review_logins">Review where you’re logged in</string> | ||
| <!-- TODO TO BE REMOVED --> | ||
| <string name="verify_other_sessions">Verify all your sessions to ensure your account & messages are safe</string> | ||
| <string name="review_unverified_sessions_title">You have unverified sessions</string> | ||
| <string name="review_unverified_sessions_description">Review to ensure your account is safe</string> | ||
|
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.
|
||
| <!-- Argument will be replaced by the other session name (e.g, Desktop, mobile) --> | ||
| <string name="verify_this_session">Verify the new login accessing your account: %1$s</string> | ||
|
|
||
|
|
||
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
31 changes: 31 additions & 0 deletions
31
vector/src/main/java/im/vector/app/features/home/IsNewLoginAlertShownUseCase.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,31 @@ | ||
| /* | ||
| * 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.home | ||
|
|
||
| import im.vector.app.features.settings.VectorPreferences | ||
| import javax.inject.Inject | ||
|
|
||
| class IsNewLoginAlertShownUseCase @Inject constructor( | ||
| private val vectorPreferences: VectorPreferences, | ||
| ) { | ||
|
|
||
| fun execute(deviceId: String?): Boolean { | ||
| deviceId ?: return false | ||
|
|
||
| return vectorPreferences.isNewLoginAlertShownForDevice(deviceId) | ||
| } | ||
| } |
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
31 changes: 31 additions & 0 deletions
31
vector/src/main/java/im/vector/app/features/home/SetNewLoginAlertShownUseCase.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,31 @@ | ||
| /* | ||
| * 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.home | ||
|
|
||
| import im.vector.app.features.settings.VectorPreferences | ||
| import javax.inject.Inject | ||
|
|
||
| class SetNewLoginAlertShownUseCase @Inject constructor( | ||
| private val vectorPreferences: VectorPreferences, | ||
| ) { | ||
|
|
||
| fun execute(deviceIds: List<String>) { | ||
| deviceIds.forEach { | ||
| vectorPreferences.setNewLoginAlertShownForDevice(it) | ||
| } | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
vector/src/main/java/im/vector/app/features/home/SetUnverifiedSessionsAlertShownUseCase.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,34 @@ | ||
| /* | ||
| * 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.home | ||
|
|
||
| import im.vector.app.core.time.Clock | ||
| import im.vector.app.features.settings.VectorPreferences | ||
| import javax.inject.Inject | ||
|
|
||
| class SetUnverifiedSessionsAlertShownUseCase @Inject constructor( | ||
| private val vectorPreferences: VectorPreferences, | ||
| private val clock: Clock, | ||
| ) { | ||
|
|
||
| fun execute(deviceIds: List<String>) { | ||
| val epochMillis = clock.epochMillis() | ||
| deviceIds.forEach { | ||
| vectorPreferences.setUnverifiedSessionsAlertLastShownMillis(it, epochMillis) | ||
| } | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
vector/src/main/java/im/vector/app/features/home/ShouldShowUnverifiedSessionsAlertUseCase.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,39 @@ | ||
| /* | ||
| * 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.home | ||
|
|
||
| import im.vector.app.config.Config | ||
| import im.vector.app.core.time.Clock | ||
| import im.vector.app.features.VectorFeatures | ||
| import im.vector.app.features.settings.VectorPreferences | ||
| import javax.inject.Inject | ||
|
|
||
| class ShouldShowUnverifiedSessionsAlertUseCase @Inject constructor( | ||
| private val vectorFeatures: VectorFeatures, | ||
| private val vectorPreferences: VectorPreferences, | ||
| private val clock: Clock, | ||
| ) { | ||
|
|
||
| fun execute(deviceId: String?): Boolean { | ||
| deviceId ?: return false | ||
|
|
||
| val isUnverifiedSessionsAlertEnabled = vectorFeatures.isUnverifiedSessionsAlertEnabled() | ||
| val unverifiedSessionsAlertLastShownMillis = vectorPreferences.getUnverifiedSessionsAlertLastShownMillis(deviceId) | ||
| return isUnverifiedSessionsAlertEnabled && | ||
| clock.epochMillis() - unverifiedSessionsAlertLastShownMillis >= Config.SHOW_UNVERIFIED_SESSIONS_ALERT_AFTER_MILLIS | ||
| } | ||
| } |
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.
R.string.review_loginsappears to be unused