Skip to content

Commit

Permalink
Merge pull request #1009 from Abby-Wheelis/profile_logic_migration
Browse files Browse the repository at this point in the history
Migration of Profile Logic
  • Loading branch information
shankari authored Sep 9, 2023
2 parents d6637a6 + 91b24d2 commit 6abaae5
Show file tree
Hide file tree
Showing 19 changed files with 1,401 additions and 672 deletions.
6 changes: 1 addition & 5 deletions www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@
position: relative;
}

.fill-container div[class*='css-'] {
.fill-container > div[class*='css-'] {
height: 100%;
width: 100%;
position: absolute;
}

.fill-container div[class*='css-'] > div[class*='css-'] {
position: static;
}

/* Without this, the LabelTab does not fill the entire height of the screen.
It has something to do with React Navigation's NavigationContainer.
This should not be necessary once the entire app's routing has been
Expand Down
64 changes: 60 additions & 4 deletions www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"app-version": "App Version",
"reminders-time-of-day": "Time of Day for Reminders ({{time}})",
"upcoming-notifications": "Upcoming Notifications",
"dummy-notification" : "Dummy Notification in 5 Seconds"
"dummy-notification" : "Dummy Notification in 5 Seconds",
"log-out": "Log Out"
},

"general-settings":{
Expand All @@ -65,9 +66,6 @@
"consent-found": "Consent found!",
"consented-to": "Consented to protocol {{protocol_id}}, {{approval_date}}",
"consented-ok": "OK",
"share-message": "Join me in making transportation greener and healthier \nDownload the emission app:",
"share-subject": "Emission - UC Berkeley Research Project",
"share-url": "https://bic2cal.eecs.berkeley.edu/#download",
"qrcode": "My OPcode",
"qrcode-share-title": "You can save your OPcode to login easily in the future!"
},
Expand Down Expand Up @@ -228,6 +226,7 @@
"fix": "Fix",
"refresh":"Refresh",
"overall-description": "This app works in the background to automatically build a travel diary for you. Make sure that all the settings below are green so that the app can work properly!",
"explanation-title": "What are these used for?",
"overall-loc-name": "Location",
"overall-loc-description": "We use the background location permission to track your location in the background, even when the app is closed. Reading background locations removes the need to turn tracking on and off, making the app easier to use and preventing battery drain.",
"locsettings": {
Expand Down Expand Up @@ -356,5 +355,62 @@
"invalid-opcode-format": "Invalid OPcode format",
"error-loading-config-app-start": "Error loading config on app start",
"survey-missing-formpath": "Error while fetching resources in config: survey_info.surveys has a survey without a formPath"
},
"consent-text": {
"title":"NREL OPENPATH PRIVACY POLICY/TERMS OF USE",
"introduction":{
"header":"Introduction and Purpose",
"what-is-openpath":"This data is being collected through OpenPATH, an NREL open-sourced platform. The smart phone application, NREL OpenPATH (“App”), combines data from smartphone sensors, semantic user labels and a short demographic survey.",
"what-is-NREL":"NREL is a national laboratory of the U.S. Department of Energy, Office of Energy Efficiency and Renewable Energy, operated by Alliance for Sustainable Energy, LLC under Prime Contract No. DE-AC36-08GO28308. This Privacy Policy applies to the App provided by Alliance for Sustainable Energy, LLC. This App is provided solely for the purposes of collecting travel behavior data for the {{program_or_study}} and for research to inform public policy. None of the data collected by the App will never be sold or used for any commercial purposes, including advertising.",
"if-disagree":"IF YOU DO NOT AGREE WITH THE TERMS OF THIS PRIVACY POLICY, PLEASE DELETE THE APP"
},
"why":{
"header":"Why we collect this information"
},
"what":{
"header":"What information we collect",
"no-pii":"The App will never ask for any Personally Identifying Information (PII) such as name, email, address, or phone number.",
"phone-sensor":"It collects phone sensor data pertaining to your location (including background location), accelerometer, device-generated activity and mode recognition, App usage time, and battery usage. The App will create a “travel diary” based on your background location data to determine your travel patterns and location history.",
"labeling":"It will also ask you to periodically annotate these sensed trips with semantic labels, such as the trip mode, purpose, and replaced mode.",
"demographics":"It will also request sociodemographic information such as your approximate age, gender, and household type. The sociodemographic factors can be used to understand the influence of lifestyle on travel behavior, as well as generalize the results to a broader population.",
"open-source-data":"For the greatest transparency, the App is based on an open source platform, NREL’s OpenPATH. you can inspect the data that OpenPATH collects in the background at",
"open-source-analysis":"the analysis pipeline at",
"open-source-dashboard":"and the dashboard metrics at",
"on-nrel-site": "For the greatest transparency, the App is based on an open source platform, NREL’s OpenPATH. you can inspect the data that OpenPATH collects in the background, the analysis pipeline, and the dashboard metrics through links on the NREL OpenPATH website."
},
"opcode":{
"header":"How we associate information with you",
"not-autogen":"Program administrators will provide you with a 'opcode' that you will use to log in to the system. This long random string will be used for all further communication with the server. If you forget or lose your opcode, you may request it by providing your name and/or email address to the program administrator. Please do not contact NREL staff with opcode retrieval requests since we do not have access to the connection between your name/email and your opcode. The data that NREL automatically collects (phone sensor data, semidemographic data, etc.) will only be associated with your 'opcode'",
"autogen":"You are logging in with a randomly generated 'opcode' that has been generated by the platform. This long random string will used for all further communication with the server. Only you know the opcode that is associated with you. There is no “Forgot password” option, and NREL staff cannot retrieve your opcode, even if you provide your name or email address. This means that, unless you store your opcode in a safe place, you will not have access to your prior data if you switch phones or uninstall and reinstall the App."
},
"who-sees":{
"header":"Who gets to see the information",
"public-dash":"Aggregate metrics derived from the travel patterns will be made available on a public dashboard to provide transparency into the impact of the program. These metrics will focus on information summaries such as counts, distances and durations, and will not display individual travel locations or times.",
"individual-info":"Individual labeling rates and trip level information will only be made available to:",
"program-admins":"🧑 Program administrators from {{deployment_partner_name}} to {{raw_data_use}}, and",
"nrel-devs":"💻 NREL OpenPATH developers for debugging",
"TSDC-info":"The data will also be periodically archived in NREL’s Transportation Secure Data Center (TSDC) after a delay of 3 to 6 months. It will then be made available for legitimate research through existing, privacy-preserving TSDC operating procedures. Further information on the procedures is available",
"on-website":" on the website ",
"and-in":"and in",
"this-pub":" this publication ",
"and":"and",
"fact-sheet":" fact sheet",
"on-nrel-site": " through links on the NREL OpenPATH website."
},
"rights":{
"header":"Your rights",
"app-required":"You are required to track your travel patterns using the App as a condition of participation in the Program. If you wish to withdraw from the Program, you should contact the program administrator, {{program_admin_contact}} to discuss termination options. If you wish to stay in the program but not use the app, please contact your program administrator to negotiate an alternative data collection procedure before uninstalling the app. If you uninstall the app without approval from the program administrator, you may not have access to the benefits provided by the program.",
"app-not-required":"Participation in the {{program_or_study}} is completely voluntary. You have the right to decline to participate or to withdraw at any point in the Study without providing notice to NREL or the point of contact. If you do not wish to participate in the Study or to discontinue your participation in the Study, please delete the App.",
"destroy-data-pt1":"If you would like to have your data destroyed, please contact K. Shankari ",
"destroy-data-pt2":" requesting deletion. You must include your token in the request for deletion. Because we do not connect your identity with your token, we cannot delete your information without obtaining the token as part of the deletion request. We will then destroy all data associated with that deletion request, both in the online and archived datasets."
},
"questions":{
"header":"Questions",
"for-questions":"If you have any questions about the data collection goals and results, please contact the primary point of contact for the study, {{program_admin_contact}}. If you have any technical questions about app operation, please contact NREL’s K. Shankari (k.shankari@nrel.gov)."
},
"consent":{
"header":"Consent",
"press-button-to-consent":"Please select the button below to indicate that you have read and agree to this Privacy Policy, consent to the collection of your information, and want to participate in the {{program_or_study}}."
}
}
}
2 changes: 2 additions & 0 deletions www/js/appTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const AppTheme = {
level4: '#e0f0ff', // lch(94% 50 250)
level5: '#d6ebff', // lch(92% 50 250)
},
success: '#38872e', // lch(50% 55 135)
danger: '#f23934' // lch(55% 85 35)
},
roundness: 5,
};
Expand Down
41 changes: 41 additions & 0 deletions www/js/appstatus/ExplainPermissions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from "react";
import { Modal, ScrollView, useWindowDimensions, View } from "react-native";
import { Button, Dialog, Text } from 'react-native-paper';
import { useTranslation } from "react-i18next";

const ExplainPermissions = ({ explanationList, visible, setVisible }) => {
const { t } = useTranslation();
const { height: windowHeight } = useWindowDimensions();

return (
<Modal visible={visible}
onDismiss={() => setVisible(false)} >
<Dialog visible={visible}
onDismiss={() => setVisible(false)} >
<Dialog.Title>{t('intro.appstatus.explanation-title')}</Dialog.Title>
<Dialog.Content style={{maxHeight: windowHeight/1.5, paddingBottom: 0}}>
<ScrollView>
{explanationList?.map((li) =>
<View key={li.name}>
<Text variant="headlineSmall" key={li.name}>
{li.name}
</Text>
<Text variant="bodyMedium">
{li.desc}
</Text>
</View>
)}
</ScrollView>
</Dialog.Content>
<Dialog.Actions>
<Button
onPress={() => setVisible(false)}>
{t('join.close')}
</Button>
</Dialog.Actions>
</Dialog>
</Modal>
);
};

export default ExplainPermissions;
21 changes: 21 additions & 0 deletions www/js/appstatus/PermissionItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import { List, Button } from 'react-native-paper';
import { useTranslation } from "react-i18next";

const PermissionItem = ({ check }) => {
const { t } = useTranslation();

return (
<List.Item
title={t(check.name)}
description={t(check.desc)}
descriptionNumberOfLines={5}
left={() => <List.Icon icon={check.statusIcon} color={check.statusColor}/>}
right={() => <Button onPress={()=>check.fix()}>
{t('intro.appstatus.fix')}
</Button>}
/>
);
};

export default PermissionItem;
2 changes: 1 addition & 1 deletion www/js/components/QrCode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { string } from "prop-types";
import QRCode from "react-qr-code";

const QrCode = ({ value }) => {
return <QRCode value={value} style={{ width: '100%', height: '100%' }} />;
return <QRCode className="qr-code" value={value} style={{ width: '100%', height: '100%' }} />;
};

QrCode.propTypes = {
Expand Down
40 changes: 26 additions & 14 deletions www/js/control/AlertBar.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
import React from "react";
import { Modal, Snackbar} from 'react-native-paper';
import { Modal } from "react-native";
import { Snackbar } from 'react-native-paper';
import { useTranslation } from "react-i18next";
import { SafeAreaView } from "react-native-safe-area-context";

const AlertBar = ({visible, setVisible, messageKey}) => {
const AlertBar = ({visible, setVisible, messageKey, messageAddition}) => {
const { t } = useTranslation();
const onDismissSnackBar = () => setVisible(false);

let text = "";
if(messageAddition){
text = t(messageKey) + messageAddition;
}
else {
text = t(messageKey);
}

return (
<Modal visible={visible} onDismiss={() => setVisible(false)}>
<Snackbar
visible={visible}
onDismiss={onDismissSnackBar}
action={{
label: t("join.close"),
onPress: () => {
onDismissSnackBar()
},
}}>
{t(messageKey)}
</Snackbar>
<Modal visible={visible} onDismiss={() => setVisible(false)} transparent={true}>
<SafeAreaView style={{flex: 1}}>
<Snackbar
visible={visible}
onDismiss={onDismissSnackBar}
action={{
label: t("join.close"),
onPress: () => {
onDismissSnackBar()
},
}}>
{text}
</Snackbar>
</SafeAreaView>
</Modal>
);
};
Expand Down
Loading

0 comments on commit 6abaae5

Please sign in to comment.