-
Notifications
You must be signed in to change notification settings - Fork 782
ANR when asking to select the notification method #7675
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
Conversation
import im.vector.app.test.fakes.FakePushersManager | ||
import im.vector.app.test.fakes.FakeUnifiedPushHelper | ||
import im.vector.app.test.fixtures.PusherFixture | ||
import io.mockk.verify |
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.
- 🚫 Unused import
e146b84
to
b30dda7
Compare
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 rework! I have done some tests and did not see any issue.
// 'app should always check the device for a compatible Google Play services APK before accessing Google Play services features' | ||
if (checkPlayServices(activity)) { | ||
if (checkPlayServices(context)) { |
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 checkPlayServices
can display a dialog, and so needs an Activity. I will try running your code on an emulator without the PlayServices.
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.
From what I understood, we only use the checking method GoogleApiAvailability.isGooglePlayServicesAvailable(context). This method only requires a Context
. In case of error, we display a toast which only requires a Context
as well.
} | ||
} | ||
} | ||
} |
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 extracting logic from the Activity to the ViewModel. Maybe creating a new dedicated ViewModel may have been better, but it can be done later.
@@ -23,5 +23,4 @@ import org.matrix.android.sdk.api.session.sync.SyncRequestState | |||
data class HomeActivityViewState( | |||
val syncRequestState: SyncRequestState = SyncRequestState.Idle, | |||
val authenticationDescription: AuthenticationDescription? = null, | |||
val areNotificationsSilenced: Boolean = false, |
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.
This is (or will be) handled elsewhere?
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 need to look into that, I am not sure it is needed. What is sure is that it should not have been added in the ViewState
as it was not used for rendering UI but for domain logic. There will be 2 successive PRs following that current PR which will fix issues with both remote and local notifications toggling for the session.
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.
OK, thanks!
b30dda7
to
f8c59f6
Compare
SonarCloud Quality Gate failed. |
Type of change
Content
Refactoring most of the logic for registration of push notification distributor. Adding unit tests on the new code.
The previous code was a mix of UI and domain layer which lead to non necessary complexity and some bugs like ANR, crash or unexpected behavior.
Motivation and context
Closes #7653
Screenshots / GIFs
Tests
Both FDroid and Gplay version should be tested.
Tested devices
Checklist