-
Notifications
You must be signed in to change notification settings - Fork 754
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
Makes "Enable Notifications for this session" respond to enabled value in pusher #7281
Makes "Enable Notifications for this session" respond to enabled value in pusher #7281
Conversation
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.
Just a small remark
@@ -117,6 +123,9 @@ class VectorSettingsNotificationPreferenceFragment : | |||
} | |||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_NOTIFICATION_METHOD_KEY) | |||
?.summary = unifiedPushHelper.getCurrentDistributorName() | |||
lifecycleScope.launch { | |||
pushersManager.togglePusherForCurrentSession(true) |
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.
You need a try catch, it will crash if there is for instance no network.
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.
Agree, ideally a runCatching
may be added inside the PushersManager.togglePusherForCurrentSession()
method. And failure may be prompted to the user.
coVerify(ordering = Ordering.ALL) { | ||
getPushersLive() // verifies only getPushersLive and the following togglePusher was called | ||
togglePusher(pusher, enable) | ||
} | ||
} | ||
|
||
fun verifyOnlyGetPushersAndTogglePusherCalled(pusher: Pusher, enable: Boolean) { | ||
coVerify(ordering = Ordering.ALL) { | ||
getPushers() // verifies only getPushersLive and the following togglePusher was called |
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.
Comment should be updated I guess by replacing getPushersLive()
by getPushers()
. Or comments in these methods could be removed.
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.
Not tested but LGTM. Just added a minor comment.
…ifications # Conflicts: # vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewAction.kt # vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewFragment.kt # vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModel.kt # vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewState.kt # vector/src/main/res/layout/fragment_session_overview.xml # vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt
…ic/notificaton-settings-enabled # Conflicts: # vector/src/test/java/im/vector/app/core/pushers/PushersManagerTest.kt
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.
SGTM, just a remark about the new string.
@@ -931,6 +931,7 @@ | |||
<string name="settings_call_notifications_preferences">Configure Call Notifications</string> | |||
<string name="settings_silent_notifications_preferences">Configure Silent Notifications</string> | |||
<string name="settings_system_preferences_summary">Choose LED color, vibration, sound…</string> | |||
<string name="settings_error_toggle_pusher">Something went wrong. Please check your network connection and try again.</string> |
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.
Maybe use a more generic key for this string, which could be re-use in other circumstances.
Something like error_check_network
(we already have error_no_network
)
…ic/notificaton-settings-enabled
…ic/notificaton-settings-enabled
…ic/notificaton-settings-enabled
…ic/notificaton-settings-enabled
@@ -206,110 +203,6 @@ class SessionOverviewViewModelTest { | |||
.finish() | |||
} | |||
|
|||
@Test |
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.
Is there a reason to having removed all tests on SignoutAction
?
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 they were lost during a merge conflict. Good catch
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 cancel the removing of unit tests on SignoutAction
in the `SessionOverviewViewModelTest.
…ic/notificaton-settings-enabled
…icaton-settings-enabled # Conflicts: # vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt # vector/src/test/java/im/vector/app/test/fakes/FakePushersService.kt
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 seen 3 points to fix:
- on UI side, there is an issue with the constraints in the session overview screen, see the capture below.
- on UI side, when the push notifications are disabled when arriving into the session overview screen, we see the toggle is moving from enabled to disabled. I wonder if we could do something to avoid that?
- on
Realm
database side: since we updated thePusherEntity
, there should be a database migration and it looks like we don't have it yet (could be done in another PR I guess).
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.
Thanks for the fixes! I think the small animation of the switchButton is not fixed since it happens now when the push notifications are enabled. We can see going from disabled state to enabled state. But honestly, I don't know how we could fix it.
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.
And other thing, could we bind the whole push notification view to change the toggle instead of only the switch? It will ease the toggling for the user.
There is also another problem with navigation to session details, it may have been deleted during merges. I created a fix PR for that: #7340
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.
LGTM, thanks for the fix on the switch.
SonarCloud Quality Gate failed. |
Type of change
Content
Meets criteria:
(the other AC are already current behaviour)
Motivation and context
Epic: https://element-io.atlassian.net/browse/PSG-595
Closes https://element-io.atlassian.net/browse/PSG-785
Screenshots / GIFs
Tests
Tested devices
Checklist