Skip to content
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

Refactor: add unzipping downloaded key data files but only for iOS. #157

Merged
merged 7 commits into from
Jun 26, 2020

Conversation

gavrix
Copy link
Contributor

@gavrix gavrix commented Jun 24, 2020

I added adapter around ExposureNotification bridge so that it adds additional platform-specific behaviour (and unzipping downloaded files is such a behaviour on iOS)

src/bridge/ExposureNotificationAdapter.ios.ts Outdated Show resolved Hide resolved
if (diagnosisKeysURLs.length === 0) {
throw new Error('Attempt to call detectExposure with empty list if downloaded files');
}
const keysZipUrl = diagnosisKeysURLs[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a check first to make sure that there's only one diagnosis key URL? What would it mean for there to be more than 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is now, the rest will be ignored.
I guess, the best thing we can do is to change type signature, to take string instead of string[].
Native APIs concern me a little though, both iOS and Android leave the room for interpretation. iOS takes array of at least to files (bin and sig) whereas android needs just one file (but is typed such that it can take several files at once).

I'm not sure whats the best way to handle this

Copy link
Member

@honkfestival honkfestival Jun 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now I think we should loop over the array and handle each entry appropriately, but log when we get more than 1, since it would be a surprise at this point.

@henrytao-me what do you think?

@gavrix
Copy link
Contributor Author

gavrix commented Jun 24, 2020

@henrytao-me this will affect android I believe, please take a look when you have a moment.
I won't merge until you give a 👍

@gavrix
Copy link
Contributor Author

gavrix commented Jun 25, 2020

@honkfestival addressed all your comments, I believe.

Copy link
Member

@honkfestival honkfestival left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

`${unzippedLocation}/export.sig`,
]);
// first detected exposure is enough
if (summary.matchedKeyCount > 0) break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@henrytao-me henrytao-me left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the unzip part be done in iOS layer instead of share layer?

@honkfestival
Copy link
Member

@henrytao-me does this work on Android?

@gavrix
Copy link
Contributor Author

gavrix commented Jun 25, 2020

@henrytao-me
Screen Shot 2020-06-25 at 11 59 46 AM

@gavrix gavrix merged commit b98844f into master Jun 26, 2020
@gavrix gavrix deleted the bugfix/unzip-files-ios branch June 26, 2020 00:27
lpcox pushed a commit to covidsafe/CovidShieldExposure that referenced this pull request Jul 7, 2020
…s-ios

Refactor: add unzipping downloaded key data files but only for iOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants