Code Monkey home page Code Monkey logo

stayaway-app's Introduction

STAYAWAY COVID

Covid-19 Exposure Notification App for Portugal 🇵🇹


Introduction

STAYAWAY COVID is a voluntary system aiming at supporting Portuguese Health Authorities in the screening of COVID-19. This repository contains the STAYAWAY COVID source code for both Android and iOS. Before anyone can run the app, a Pilot was launched in order to improve the detection and correction of any issues. The Pilot phase is restricted to a defined number of invited users, though we provide an UI only mode as detailed in the building section. So, if not everyone can run it, why are we open-sourcing the code? It's pretty simple actually, for a reason of transparency, public scrutiny and security. We believe that such an important application should be available to the community. We welcome any bug reports, security or privacy concerns that you might have with the app and will do our best to address them.

STAYAWAY COVID is a React Native project built on top of the Decentralised Privacy-Preserving Proximity Tracing (DP^3T) project. DP^3T is an open protocol for COVID-19 proximity tracing using Bluetooth Low Energy functionality on mobile devices that ensures personal data and computation stays entirely on an individual's phone. STAYAWAY COVID relies on the open source DP^3T SDKs, which are the implementation of the DP^3T protocol using the Exposure Notification Framework of Google and Apple. DP^3T is a completely separate project, for any issues, concerns or checking the source code, please visit the official repository.

In the course of a pandemic, timely diagnosis of the population and informed reporting are crucial to break and control the chains of transmission. In the case of COVID-19, this does not come easy given the extended incubation period of the disease and the fact that, in many cases, infected patients are asymptomatic.

Thanks to STAYAWAY COVID, we are able to find out if we are at risk of being infected, based on the contacts we have been close to in the previous couple of weeks. A community-wide uptake of this app will turn it into a valuable and decisive ally in the fight against COVID-19.

The project was led by INESC TEC with the collaboration of Keyruptive and Ubirider.

Requirements

To build the project you'll need to setup your React Native development environment, which can achieved by following the steps at https://reactnative.dev/docs/environment-setup. The requirements will depend on your development platform.

Android

Only approved government public health authorities can access the Exposure Notification APIs. STAYAWAY COVID for Android will not work properly unless either your account is whitelisted as test account or your app is approved by Google and signed with the production certificate.

Required tools for building:

  • Watchman
  • Node 8.3
  • Yarn
  • Java SE Development Kit 8
  • Android Studio
  • Android SDK

iOS

Only approved government public health authorities can access the Exposure Notification APIs. STAYAWAY COVID for iOS will only work correctly if you were granted the com.apple.developer.exposure-notification entitlement by Apple. The ExposureNotification.framework is available starting with iOS 12.5.

Required tools for building:

  • Watchman
  • Node 8.3
  • Yarn
  • CocoaPods
  • XCode

Installation

  • Clone or download this repository:
$ git clone https://github.com/stayawayinesctec/stayaway-app.git
  • Copy .env.example to .env.{production,ui}.debug and fill in the variables with your own information, eg:
$ cp .env.example .env.production.debug
  • Install dependencies by running:
$ yarn
  • If you're using android, you'll also need to manually download the binary distribution of play-services-nearby and attach it to your project on android/app/libs. You can do so by running on your project's root:
$ wget https://github.com/google/exposure-notifications-android/raw/2fdb58ceb6399ba1e30436c9cf9f6d08a8e9b53a/app/libs/play-services-nearby-exposurenotification-1.7.2-eap.aar -P android/app/libs

Building

  • And finally, build the project:
$ yarn android # or yarn android:ui
$ yarn ios # or yarn ios:ui

NOTE: Running android:ui or ios:ui will allow you to run and test the applications' user interface without requiring to activate the Exposure Notification API.

Tests

Once you're ready, you can run the app tests. The tests structure and adopted technologies were inspired by this React Native website's post.

Unit Tests

For unit testing we consider all tests made to one or more individual modules to see if they work as expected.

For this we use JEST.

To run unit tests use the following command:

$ yarn test:unit

Integration Tests

For integration testing we consider all tests made to individual modules combined to see if their cooperation works as expected.

For this we use JEST.

To run unit tests use the following command:

$ yarn test:integration

Component Tests

For component testing, test will pass if screens render as expected and respond to user interaction.

To build these tests we rely on React Native Testing Library.

To run unit tests use the following command:

$ yarn test:components

End-to-End

The e2e test aim at testing the critical user path within the app. Critical app flows such as onboarding, users marking themselves as infected, and risky contact notification are the main focus here. These tests need to run on an emulator/simulator which does not have access to exposure notifications APIs thus requiring the use of the UI-only app version.

The framework chosen to support these tests was Detox.

To run tests, you need to step your tests environmnet, and you do so by carefully go through every step on the setup tests environment guide (iOS/Android).

For android the default emulator is Nexus 5X with API version 29 and for iOS the simulator is the iPhone 8, but this can be changed in package.json.

Once your environment is set up, you can run the tests with the following commands:

$ yarn test:e2e:android
$ yarn test:e2e:ios

Copyright and license

Copyright (c) 2020 INESC TEC. Developed with Keyruptive. This project is licensed under the terms of the EUPL-1.2 license. Please see the LICENSE file for full reference.

Some files contain code from the DP3T applications, Copyright (c) 2020 Ubique Innovation AG. These files are are marked as such and licensed also under MPL-2.0.

Third-party components licenses

Tools

Name License
Gradle Apache 2.0
Cocoapods MIT

Libraries

Name License
DP3T-SDK-Android MPL 2.0
DP3T-SDK-iOS MPL 2.0
OkHttp Apache 2.0
Retrofit Apache 2.0
Version Compare Apache 2.0
TrustKit MIT

Fonts

Name License
Roboto Apache 2.0

React Native Packages

Name License
@react-native-community/async-storage MIT
@react-native-community/checkbox MIT
@react-native-community/masked-view MIT
@react-native-community/netinfo MIT
@react-navigation/bottom-tabs MIT
@react-navigation/native MIT
@react-navigation/stack MIT
i18n-js MIT
jest MIT
detox MIT
lodash.pickby MIT
lodash.memoize MIT
mirror-creator MIT
moment MIT
react MIT
react-native MIT
react-native-android-location-enabler MIT
react-native-config MIT
react-native-elements MIT
react-native-react-native-email-link MIT
react-native-gesture-handler MIT
react-native-indicators BSD-3-Clause
react-native-keyboard-aware-scroll-view MIT
react-native-localize MIT
react-native-modal MIT
react-native-permissions MIT
react-native-reanimated MIT
react-native-safe-area-context MIT
react-native-screens MIT
react-native-splash-screen MIT
react-native-svg MIT
react-native-svg-icon MIT
react-native-swiper MIT
react-native-vector-icons MIT
react-native-testing-library MIT
react-native-tooltips Apache 2.0
react-navigation-redux-debouncer MIT
react-redux MIT
redux-actions MIT
redux-saga MIT
reselect MIT

stayaway-app's People

Contributors

dependabot[bot] avatar diogotcorreia avatar djcouto avatar educbraga avatar fmaia avatar fmcruz avatar maghuro avatar marado avatar miguelcarreiro avatar mluisbrown avatar sctfcm avatar stuntspt avatar suskind avatar zamith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stayaway-app's Issues

Where is the server source code?

Today, Inesc Tec's president reinforced the intent to fully open the platform's source code. However, the server-side source code seems to be missing.

There is a stale fork of the DP3T server backend, with no edits since July 14. This means that two scenarios are possible:

  • Either this fork is being used as the server backend, meaning that the framework is missing security updates from the last couple of months, and that no improvements have been made during the testing period
  • Or this fork is not the actual code of the server, meaning that the server code is not published.

Of course, the 2nd option seems much more likely, which is why it's important to know why the platform's source code is not yet fully published, contrary to public statements. Can anyone explain?

Explain why you need all the different permissions/access

There are several people asking why the location access is needed when they already enabled the bluetooth. This leads to distrust and that people won't install the app.

Maybe during the onboarding additional screens should be added to explain why all the permissions/access are needed.

Security. Vulnerabilities in your dependencies tree and build process

By including dependencies with caret: (example:"react-native-version-number": "^0.3.6") you are allowing the mantainer of the dependency to include any code he wishes in your app just by releasing a minor without giving you a chance to review his changes.

Notice this can also be done through sub dependencies or through your build process (example: devDependencies could inject malicious code in your source on npm install or during build).

Example: https://www.veracode.com/blog/research/discovering-malicious-packages-published-npm

Widget for iOS 14

An idea to improve the user experience of the app is instead of the user having to open the app all the time to check the status or wait for a notification (that can be missed), you can have a widget with the main info (had/not had contact with an infected person) or even to input the code provided by the doctor.
If you need help developing this feature I can help you with that.

UI/UX: False sense of security

The background stock image gives a false sense of security since there are two people close to each other when one of the main measures to fight this pandemic is social distancing.

Screenshot_20201112-124915

Please consider changing it to something more appropriate.

"Monitoring" toggle doesn't work when the app language is set to Portuguese

OS: iOS 13.7
App Version: 1.0.1

The toggle for "Monitoring", which can be accessed via the hamburger menu > Monitoring, does not work if the app is set to Portuguese.

Tapping the toggle does not result in any observable action, and it stays on.

Interestingly, if the app is running in English, that toggle updates as expected when tapped.

I do not know if this is a regression in 1.0.1, as I have not tested this in 1.0.

Bump version on README

The commit history shows this code reflects the v1.0.0 of the app, so README should be updated to say so.

Quick improve to enable users returning to the app and increase adoption

Since the app runs in the background I tend to forget to enable/disable the app, or getting back to the app.

One quick win in order to get people back to the app could be an indication that would update automatically about how many "code" were exchanged or how many contacts you had.

This quick win would improve exponential people getting back to the app and use it more often!

iOS app doesn't build

I followed the installation steps and when running yarn ios-ui I get the following error:

❌  ld: library not found for -lappcenter-analytics

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

I notice that CI (GitHub actions) is only running for the Android build. It should be running for iOS too.

Sugestão para metodo de introdução de positivos

Penso que o grande problema da aplicação não é a falta de instalações mas sim a falta de insercções de positivos. Também penso que isto não é nada de novo nem surpresa para ninguém aqui.

Gostaria que sugerir portanto um método diferente de registo de positivo. Em vez da pessoa receber um código em conjunto com o resultado laboratorial, e ter a possibilidade de o introduzir ou não, alteraria para 1 de 2 métodos:

Opção 1) O resultado laboratorial recebido seria na verdade uma hash que seria introduzida na App e indicava se era positivo ou negativo. Desta forma estaria automaticamente introduzida no sistema

Opção 2) O resultado laboratorial apenas seria informado pelo laboratorio/SNS após o utente fornecer um token da app (à la 2FA) que seria nesse momento inserido na Base de Dados da App e como consequência também faria uma inserção automática do positivo.

Quem não possua dispositivo móvel com app ou que tenha decidido não utilizar a app por opção própria, teria que se deslocar a uma entidade pública (Centro Saude, Hospital, etc) para conhecer o resultado que seria "lido" com um token mestre do SNS.

Cumprimentos.

Android - Background Screenshot Available [Security]

The application is disclosing information of the last Activity shown when it is put in background.

It is possible to see this information when the user opens the list of background apps:

Screenshot_20200828-165227_Trebuchet

Due to the possible sensitive information that might be shown, this should be implement.

Linking to play-services-nearby's HEAD

Currently you're pointing to the "master's HEAD version" of play-services-nearby-18.0.3-eap.aar, but you don't have any certainty that the file won't change, or disappear (for eg., being replaced with an 18.0.4 version of the file).

You should instead point to the actual version of the file we are supposed to be using, ie:

https://github.com/google/exposure-notifications-android/raw/58f6dc872016e2a42d174178dcefcae5d7590952/app/libs/play-services-nearby-18.0.3-eap.aar

App does not contain a "select language" feature

There is no way of selecting the language of the app (at least that I'm aware of). I'm assuming that it uses the system's language but it should have a way to set the language, either when the user opens the app for the first time or in a settings page.

Compatibilidade com iOS 12.5

Olá,

A Apple lançou na segunda-feira uma actualização para o iOS 12 (12.5) com o objectivo de expandir as notificações de exposição a aparelhos incompatíveis com o iOS 13 (nomeadamente o iPhone 5s, iPhone 6 e iPhone 6 Plus).

Existem planos para actualizar a aplicação para ser compatível com esta versão?

Lack of Third party notices

This app lacks the third-party licenses from the open-source component it uses. One should be included under Legal Information in order to avoid Business and Legal issues

Problem trying to run on Lineage OS

Hello, everyone!

I'm aware that this use case is not likely a priority, but I tried to run the app on Lineage OS 14.1 (Android 7.1), and I cannot turn on monitoring. The app shows a "Monitoring disabled" popup, but the "Enable monitoring" button does nothing. In the settings, "Monitoring" is shown as "Disabled", but when I click on the switch, it momentarily goes grey and then stays off. I have enabled Bluetooth but it did not make a difference.

Do you know what may be causing this, or any pointers on how can I debug what is going on?

Thanks in advance!

New version of play-services-nearby

There seems to be a new version of the play-services-nearby- play-services-nearby-exposurenotification-1.6.1-eap.aar in https://github.com/google/exposure-notifications-android/tree/master/app/libs.

The Corona-Warn-App for Germany seems to be already using it (corona-warn-app/cwa-app-android#1057) and according to the comments in the PR it seems that this new version solves the problem of Location setting need in order to work (for devices which support locationless scanning)

fixed Location-Settings on Android 11 Devices with EN 1.6.1 (Location not needed anymore)

Usual places awarness

With the concent of the user, and explicit settings from the user this application should maintain population density about popular locations in the city where the person is. With this the application shoud raise notifications to the person saying the places that he should avoid and the places that are safe

Dark mode support

I saw in the code that there is currently some support for a dark mode version of the app.
Unfortunately, I know this is currently not implemented. Could a switch be added to toggle between light and dark modes?
As a bonus, making it follow system dark more preferences should also be an option.

Relevant code:

export const ThemeContext = createContext(THEMES.light);

https://github.com/stayawayinesctec/stayaway-app/blob/ff885b9c1a5b44e8c03e5928fcf9ec31215907fa/src/app/common/theme/index.js

I could also submit a PR if needed.

Versioning

Hi there,

For the currently tagged versions in this repository, we have:

  • v1.0.0-alpha - Aug 21
  • v1.0.0 - Sep 1

This situation is confusing, since on Google's Play Store, the version available is:

  • 1.0.0 - August 21, 2020

Naming the "new version" (released yesterday) as 1.0.0 is misleading, as users will think that the version they're using currently from the app stores corresponds this repo's "v1.0.0", when in fact it is "v1.0.0-alpha".

reproducible builds

As done in the Swiss app https://github.com/DP-3T/dp3t-app-android-ch/blob/master/REPRODUCIBLE_BUILDS.md , it would be an important step for the trustworthiness of the official apps distributed on the play stores if there is a way to make reproducible builds, and ensure this code matches what is being distributed.

More info about why this is important can be read in the issue requesting this same possibility to the German app: https://github.com/corona-warn-app/cwa-backlog/issues/21 .

Implement software tests

On #3 , the issue was closed after the develpment team said that there is no way to run the tests since there are no tests to be run, but that PRs implementing tests are welcome.

Discussion went on in that issue, after it was closed, but I'm opening this one in the hopes that the efforts regarding the implementation of software tests can be focused here.

I take also the opportunity to kindly request this issue not to be closed while those tests aren't implemented: while they might not be a current priority, their importance seems undeniable.

App doesn't force update when switching from background to foreground

OS: iOS 13.7
App Version: 1.0.1

After updating the app to 1.0.1, the "last checked date" is still at 1/Sept, even after restarting the app a few times and switching it from foreground to background.

I'd consider this "normal", as I don't expect it to always be updating, but the changelog of version 1.0.1 leads me to beleive it's not:

Add force app sync when app comes from background or foreground

App not updating

Hello, sorry for not reporting this problem earlier since I was part of the pilot program, but didn't get around to give feedback.

Similar to #65 my app isn't updating. The only times my app updated, indicated by the field "atualizado a:", was once when I installed the app, and once after the app reset around the time the full release was launched.
Right now it says updated on 31st of August and today is the 16th of September.

App version: 1.0.1
Phone: Pocophone f1 (Xiaomi)
MIUI version (modified android from xiaomi): MIUI Global 11.0.9
Android version: 10QKQ1.190828.002

I know one other person who told me he had the same problem.

iOS 13.7 issues - app seems not to check for exposures

Hi,

Since installed iOS 13.7, which brings phase two of the COVID Exposure API, it seems that the app is no longer updating.

IMG_0333A15F93AA-1

I updated from iOS 13.6 to 13.7 on the 1st of September and today is the 3rd of September and the app seems to be stuck and no longer updating.

I'm not sure if this is some sort of visualization issue only, because when checking Settings -> Exposure Notifications - Exposure Checks I see records being written to the system.

IMG_0783

I'm available for any information needed. Thank you

Support older iOS versions

There are many people with old iPhones, that can’t update to iOS version 13.5.
The app should be inclusive also in that sense.

Last updated date doesn't update on Version 1.0.1 on iOS 13.7

Phone is running iOS 13.7. Version 1.0.1 of APP installed on Sep 7, 2020. "Last updated" date displayed by the APP is "9.10.2020". Today is Sep 13, 2020. APP is opened at least once a day. Exposure checks are being logged by iOS.

Happy to provide more information if requested.

IMG_C2805E55C723-1
IMG_B71BD590BDC4-1
82A28229-5F9A-4ECA-9F96-C0A105ADA267
DB6F5711-EA8D-4083-9D87-FDF6D9902311

No Exposure IDs recorded

App version: 1.1.3
Google play services: 21.21.16
OS: MIUI 12.5

After installing the APP and using it for a few days no exposure IDs are being recorded at all.
Tried to uninstall the app, and install it via settings, but when selecting Portugal, it says no app is recorded for use in portugal by my health authority.

Low contrast on bottom Android bar

This app changes the Android bottom bar's colour from Black to White, making it very hard to distinguish the white Android navigation buttons. We should change it to some other colour, like #1d3787 which is one of this app's main colours.

Screenshot_20200904-184318

Should I try to make a PR with this change?

Add comments on code for better understand

For better code understand, we should add comments like this:

// A brief explanation about 'Teste' function
function teste(param) {
    // Other explanation
}

What do you think?

Open statistics for transparency

I would consider this a minor feature request, not at all being fundamental for the app itself.

It would be very interesting to publish statistical data periodically and in fully anonymised form like the Swiss FOPH does by providing:

  • Number of all apps downloaded up to now
  • Number of covid codes entered by users per day

The installation of the App is totally voluntarily but such data may help to convince people and increase the number of installations and therefore, success for its use.

Automatically fix vulnerabilities from npm dependencies

Your CI/CD pipeline should contain a step to automatically audit and fix these vulnerabilities. High and critical ones will likely require manual input and it should stop there. Low ones like the current 248 (analysed today, Thursday the 30th) would automatically be fixed.

However, fixing can break sruff, unless your code is properly tested. This issue requires solving #7 first.

Version 1.0.4 automatically disables exposure monitoring on iOS

Hi,

My iPhone (on iOS 14.0.1) updated the app to version 1.0.4 and the app automatically disabled exposure monitoring. It shows that the latest risk evaluation was today (before the update) and now monitoring is just disabled without my interaction.

I've discovered some other people with the exact same situation. I think this is a major issue that may case many people to have exposure monitoring disabled, which compromises the effectiveness of this app.

I'm available for more details if needed.

Dependency on GAEN (a closed source component) raises issues

Hi there. This is by no means an exaustive list, but:

Therefore, I am opening this issue to propose to the project that the issues that arise from having a closed source dependency on GAEN must be openly addressed.

As a "starting point", I'll also link to https://www.lusa.pt/article/RuzdrRtnLzuClNfx09aPxzMSZM5iuSI1 , where INESC TEC's administrator is quoted saying:

“Ao estarmos a usar estas funcionalidades da Apple e da Google perdemos o controlo sobre elas, mais ainda, apesar da aplicação e todo o sistema ser código aberto, esta parte não é e, portanto, perdemos esse controlo”, disse, acrescentando que esta é “uma fragilidade que não vai ser ultrapassada”. “Deixarmos de usar estas funcionalidades da Google e da Apple significaria não termos aplicação”, sublinhou.

(In english, my translation:)

"By using these features from Apple and Google we loose control over them, and besides, while the application and the whole system is open source, this part isn't and so we loose that control", he said, adding that this is "a fragility that is not going to be overcome"
. "No longer using these features from Google and Apple would mean not having an application", he highlighted.

Population density awareness nearby

This application should give feedback to the user about the population density in the nearby.
For this the application should have configuration settings where the person should introduce the number of people that are arround him that should raise a notification telling him about the density of people arround him treshold that is being overcomed. That will allow people to be more caution about the places and the amount of time they spend in some overcrowded place.

binary distribution of play-services-nearby

There are several differently-licensed items within this project that aren't listed on the README (the Roboto fonts, for eg.). But one of them caught my attention for a different reason.

While unpackable and easy to decompile, ./android/app/libs/play-services-nearby-18.0.3-eap.aar is being distributed here as-is, instead of built from source, or used as a dependency. There isn't even a reference of where did this supposedly came from.

Also, note that, as far as I can see, that file came from an Apache 2.0 licensed repository and might be covered by that license: https://github.com/google/exposure-notifications-android/blob/master/LICENSE . If that is the case, then the current distribution of it being made on stayaway-app doesn't seem to be complying with the LICENSE (lack of notice). If it isn't, even you are not allowed redistribution.

Also, please note that the non-eap versions of this file are usually distributed under the Android Software Development Kit License, which does not allow redistribution.

There is an open issue regarding this, upstream, at google/exposure-notifications-android#23 .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.