Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/ineshbose/portion-mate i…
Browse files Browse the repository at this point in the history
…nto feature/48-statistics_of_logs
  • Loading branch information
ineshbose committed Jan 28, 2022
2 parents d14d356 + 8f59f71 commit 733a712
Show file tree
Hide file tree
Showing 19 changed files with 633 additions and 66 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Compile Status Report
on:
push:
paths:
- "dissertation/status.tex"
- "docs/important/status.tex"

jobs:
build-dissertation:
build-report:
runs-on: ubuntu-latest
name: Create document
steps:
Expand All @@ -16,10 +16,10 @@ jobs:
uses: xu-cheng/latex-action@v2
with:
root_file: status.tex
working_directory: dissertation
working_directory: docs/important
- name: Rename PDF
run: |
mv dissertation/status.pdf "Inesh Bose - Portion Mate (Status Report).pdf"
mv docs/important/status.pdf "Inesh Bose - Portion Mate (Status Report).pdf"
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/deploy-wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
npx ts-node docs/meetings/generate.ts docs/meetings/ docs/meetings/meetings.t.md
- name: Copy file
run: cp docs/index.md docs/Home.md
- name: Convert status report to MD
uses: docker://pandoc/core:2.9
with:
args: >-
--standalone
--output=docs/important/Status.md
docs/important/status.tex
- uses: ineshbose/wiki-action@v1
with:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/meeting-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Post Meeting Cron Job

on:
schedule:
- cron: '0 12 * * 5'

jobs:
basic-action:
runs-on: ubuntu-latest
steps:
- run: |
echo "🎉 Meeting done!"
1 change: 1 addition & 0 deletions docs/.wikignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ README.md
**/*.t.md
**/*.ts
**/*.json
**/*.tex
*.json
*.toml
*.txt
Expand Down
94 changes: 94 additions & 0 deletions docs/important/Ethics Checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
1. **_Participants were not exposed to any risks greater than those encountered in their normal working life._**

Investigators have a responsibility to protect participants from physical and mental harm during the investigation. The risk of harm must be no greater than in ordinary life. Areas of potential risk that require ethical approval include, but are not limited to, investigations that occur outside usual laboratory areas, or that require participant mobility (e.g. walking, running, use of public transport), unusual or repetitive activity or movement, that use sensory deprivation (e.g. ear plugs or blindfolds), bright or flashing lights, loud or disorienting noises, smell, taste, vibration, or force feedback


2. **_The experimental materials were paper-based, or comprised software running on standard hardware._**

Participants should not be exposed to any risks associated with the use of non-standard equipment: anything other than pen-and-paper, standard PCs, laptops, iPads, mobile phones and common hand-held devices is considered non-standard.


3. **_All participants explicitly stated that they agreed to take part, and that their data could be used in the project._**

If the results of the evaluation are likely to be used beyond the term of the project (for example, the software is to be deployed, or the data is to be published), then signed consent is necessary. A separate consent form should be signed by each participant.

Otherwise, verbal consent is sufficient, and should be explicitly requested in the introductory script.


4. **_No incentives were offered to the participants._**

The payment of participants must not be used to induce them to risk harm beyond that which they risk without payment in their normal lifestyle.


5. **_No information about the evaluation or materials was intentionally withheld from the participants._**

Withholding information or misleading participants is unacceptable if participants are likely to object or show unease when debriefed.


6. **_No participant was under the age of 16._**

Parental consent is required for participants under the age of 16.


7. **_No participant has an impairment that may limit their understanding or communication._**

Additional consent is required for participants with impairments.


8. **_Neither I nor my supervisor is in a position of authority or influence over any of the participants._**

A position of authority or influence over any participant must not be allowed to pressurise participants to take part in, or remain in, any experiment.


9. **_All participants were informed that they could withdraw at any time._**

All participants have the right to withdraw at any time during the investigation. They should be told this in the introductory script.


10. **_All participants have been informed of my contact details._**

All participants must be able to contact the investigator after the investigation. They should be given the details of both student and module co-ordinator or supervisor as part of the debriefing.


11. **_The evaluation was discussed with all the participants at the end of the session, and all participants had the opportunity to ask questions._**

The student must provide the participants with sufficient information in the debriefing to enable them to understand the nature of the investigation. In cases where remote participants may withdraw from the experiment early and it is not possible to debrief them, the fact that doing so will result in their not being debriefed should be mentioned in the introductory text.


12. **_All the data collected from the participants is stored in an anonymous form._**

All participant data (hard-copy and soft-copy) should be stored securely, and in anonymous form.


<table>
<tbody>
<tr>
<td>Project title</td>
<td>Portion Mate</td>
</tr>
<tr>
<td>Student's Name</td>
<td>Inesh Bose</td>
</tr>
<tr>
<td>Student Number</td>
<td>2504266B</td>
</tr>
<tr>
<td>Student's Signature</td>
<td>
<a href="https://inesh.xyz/sign/?id=portion-mate-ethics" target="_blank">
<img src="https://img.shields.io/endpoint?url=https://inesh.xyz/sign/portion-mate-ethics.json" alt="Signature badge" />
</a>
</td>
</tr>
<tr>
<td>Supervisor's Signature</td>
<td>Oana Andrei</td>
</tr>
<tr>
<td>Date</td>
<td></td>
</tr>
</tbody>
</table>
File renamed without changes.
22 changes: 20 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,27 @@ import { MaterialIconsPack } from './app/components/AppIcons';
import { ColorScheme } from './app/types';
import { ThemeContext } from './app/contexts/ThemeContext';
import { ImageProps } from 'react-native';
import { getData, storeData } from './app/api/store';

export default function App() {
const isLoadingComplete = useCachedResources();
const [theme, setTheme] = React.useState<ColorScheme>('light');

React.useEffect(() => {
const getSetTheme = async () => {
const themeData = (await getData('theme', 'light')) as ColorScheme;
setTheme(themeData);
};

getSetTheme();
}, [setTheme]);

const switchTheme = async () => {
const newTheme = theme === 'light' ? 'dark' : 'light';
setTheme(newTheme);
await storeData('theme', newTheme);
};

const toggleIcon = (props: Partial<ImageProps> | undefined) => (
<Icon
key="themeToggle"
Expand All @@ -34,15 +50,17 @@ export default function App() {
appearance="ghost"
status="basic"
accessoryLeft={toggleIcon}
onPress={() => setTheme(theme === 'light' ? 'dark' : 'light')}
onPress={switchTheme}
{...props}
/>
);

return isLoadingComplete ? (
<>
<IconRegistry icons={MaterialIconsPack} />
<ThemeContext.Provider value={{ theme, ThemeToggle }}>
<ThemeContext.Provider
value={{ theme, setTheme, switchTheme, ThemeToggle }}
>
<ApplicationProvider
{...eva}
customMapping={mapping}
Expand Down
12 changes: 5 additions & 7 deletions src/app/api/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';

export const storeData = async (key: string, value: any) => {
try {
await AsyncStorage.setItem(`@${key}`, value);
return await AsyncStorage.setItem(`@${key}`, value);
} catch (e) {
// saving error
}
Expand All @@ -11,18 +11,16 @@ export const storeData = async (key: string, value: any) => {
export const storeObject = async (key: string, value: object) => {
try {
const jsonValue = JSON.stringify(value);
await AsyncStorage.setItem(`@${key}`, jsonValue);
return await AsyncStorage.setItem(`@${key}`, jsonValue);
} catch (e) {
// saving error
}
};

export const getData = async (key: string) => {
export const getData = async (key: string, _default?: string) => {
try {
const value = await AsyncStorage.getItem(`@${key}`);
if (value !== null) {
// value previous stored
}
return value !== null ? value : _default;
} catch (e) {
// error reading value
}
Expand All @@ -39,7 +37,7 @@ export const getObject = async (key: string) => {

export const removeItem = async (key: string) => {
try {
await AsyncStorage.removeItem(`@${key}`);
return await AsyncStorage.removeItem(`@${key}`);
} catch (e) {
// error removing value
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const createUser = async (
}
};

export const updateUser = async (props: UpdateData<User>) => {
export const updateUser = async (
props: UpdateData<User> & { password?: string; old_password?: string }
) => {
try {
const { id } = props;
const response = await axiosInstance.patch<User>(
Expand All @@ -34,7 +36,7 @@ export const updateUser = async (props: UpdateData<User>) => {
);
return response.data;
} catch (e) {
// handle error
throw axios.isAxiosError(e) ? (e.response?.data as FormError) : e;
}
};

Expand Down
9 changes: 8 additions & 1 deletion src/app/contexts/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ export const ContextProvider = ({ children }: ChildComponents) => {
items,
headerAction,
loading,
helpers: { signIn, signUp, signOut, setItems, setHeaderAction },
helpers: {
signIn,
signUp,
signOut,
setUser,
setItems,
setHeaderAction,
},
}}
>
{children}
Expand Down
4 changes: 4 additions & 0 deletions src/app/contexts/ThemeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import { ColorScheme } from '../types';

type ThemeContextType = {
theme: ColorScheme;
setTheme: React.Dispatch<React.SetStateAction<ColorScheme>>;
switchTheme: Function;
ThemeToggle: (props: ButtonProps | undefined) => JSX.Element;
};

export const ThemeContext = React.createContext<ThemeContextType>({
theme: 'light',
setTheme: () => {},
switchTheme: () => {},
ThemeToggle: () => <Button />,
});

Expand Down
Loading

0 comments on commit 733a712

Please sign in to comment.