-
Notifications
You must be signed in to change notification settings - Fork 109
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
Troubleshoot notifications screen #2596
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
e78e9d6
to
5b186ae
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.
LGTM, just some suggestions. Thanks for the work on this!
suspend fun run(coroutineScope: CoroutineScope) | ||
suspend fun reset() | ||
suspend fun quickFix(coroutineScope: CoroutineScope) { | ||
error("Quick fix not implemented, you need to override this method in your 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.
Since this is an interface, wouldn't not providing a default implementation force any devs to implement this? It seems more effective than having it crash on runtime because someone forgot to override the default behaviour.
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 agree, but I guess the developer who add a test with a quick fix will test it and so see the error.
And since quick fix support is optional I prefer to provide a default implementation.
.value | ||
.navigationState | ||
.currentSessionId() | ||
?.let { pushStoreFactory.create(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.
Not part of this PR, but maybe this pushStoreFactory.create(it)
should be instead pushStoreFactory.get(it)
or maybe getOrCreate
? I found it weird that we're creating an extra PushStore here until I realised the create
method would actually get an existing one if it's there.
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're right: d592f3a.
sealed class PushGatewayFailure : Throwable(cause = null) { | ||
data object PusherRejected : PushGatewayFailure() | ||
sealed class PushGatewayFailure : Exception() { | ||
class PusherRejected : PushGatewayFailure() |
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 guess this is needed to trigger UI changes?
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 change this to fix this warning: Serializable object must implement 'readResolve'
. Also I think it's better to extend Exception
rather than Throwable
.
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.
Oh, I was actually talking about the data object
-> class
change.
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.
Yes, I think the warning was about the data object
. I did not dig further...
import javax.inject.Inject | ||
|
||
@SingleIn(AppScope::class) | ||
class DiagnosticPushHandler @Inject constructor() { |
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 move this and NotificationClickHandle
to a sub-package?
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 could create a subpackage per test, to ease the readability, but it's maybe over engineering since the package only have 6 classes.
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 was thinking about separating the handlers from the tests, but I guess it's not really worth it.
notificationClickHandler.state.first() | ||
Timber.d("Notification clicked!") | ||
} | ||
val s = withTimeoutOrNull(30.seconds) { |
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 seems a bit hard to understand, IMO. Maybe we could use just withTimeout
inside a try/catch
block or runCatching
, the successful path leading to the Success
state and the catch clause for TimeoutCancellationException
emitting the Failure
case?
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.
Yes, good idea, thanks: 378a9c6.
c9f68ef
to
378a9c6
Compare
|
…eate` for code clarity.
… of withTimeoutOrNull
3e20075
to
cb435c5
Compare
Quality Gate passedIssues Measures |
Type of change
Content
Add a troubleshoot notification screen with tests to help users understand why notification are not working.
Test coverage:
Remaining work (will be done in a separate PR):
Motivation and context
Closes #2601
Screenshots / GIFs
and recorded screenshot
Tests
Tested devices
Checklist