-
Notifications
You must be signed in to change notification settings - Fork 106
Conversation
@@ -388,7 +388,7 @@ export class ExposureNotificationService { | |||
} | |||
|
|||
private async processPendingExposureSummary() { | |||
const summary = await this.exposureNotification.getPendingExposureSummary(); | |||
const summary = await this.exposureNotification.getPendingExposureSummary().catch(() => undefined); |
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.
It's unnecessary to try catch PendingExposureSummary. We can return undefined and the method will return early anyway.
@@ -96,6 +103,10 @@ class ExposureNotificationModule(context: ReactApplicationContext) : ReactContex | |||
@ReactMethod | |||
fun detectExposure(configuration: ReadableMap, diagnosisKeysURLs: ReadableArray, promise: Promise) { | |||
promise.launch(this) { | |||
if (getStatusInternal() != Status.ACTIVE) { |
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 the use of getStatusInternal()
at this point is overreaching what is required. It could be possible to perform the detectExposure
functions with Bluetooth turned off, but with the exposureNotificationClient enabled.
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 are right. I just tested on Android when EN is ON but Bluetooth is OFF, the framework still can run detectExposure
. However, I wouldn't think it is important to separate the condition between EN and Bluetooth. It's clearly that in order for the app to work properly, both EN and Bluetooth have to be ON. I prefer to keep same logic for consistency.
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.
@jeberhardt points out this
Some people may turn off Bluetooth to "save battery", like when they are at home, and only turn it on when they go out. It's possible. I don't think consistency in the logic should be more important than specific functionality.
I will test all changes again with just EN.
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.
As a result of this #866 (review), I would prefer to check both EN + Bluetooth. This is a low risk approach, imo.
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.
Tested again with just checking EN. It works fine. 👍 cc @jeberhardt @timarney
d658729
to
9af19f8
Compare
9af19f8
to
fd78717
Compare
I'm still testing but wondering what comes back from the Framework in this case |
We'll handle #864 (comment) in a separate PR. |
This PR handles error code 10 on Android by checking EN permission when accessing EN methods. It also extracts all exception in the app into a utils for convenience.
Ref #593
How to test?
Test in all cases: EN is OFF, Bluetooth is OFF, EN and Bluetooth are OFF.
Expected log
Error: performExposureStatusUpdate {"error": {"error": [Error: API_NOT_ENABLED], "message": "API_NOT_ENABLED"}}
is called afterperformExposureStatusUpdate
.finalize
is called at the end with:lastChecked.period
should be the same before and after updating.last.Checked.timestamp
should be different.If you already passed onboarding screen and enable EN framework:
If you are still in onboarding screen:
updateExposureStatusInBackground
immediately.Enable COVID Alert
.Error: performExposureStatusUpdate
. You might see it hangs atperformExposureStatusUpdate
because you don't have exposed TEKs or you are in exposed state.