├── constants ├── Units.ts ├── Layout.ts └── Colors.ts ├── .husky └── pre-commit ├── assets ├── images │ ├── icon.png │ ├── love.jpg │ ├── rocks.jpg │ ├── sleep.jpg │ ├── tea.jpg │ ├── favicon.png │ ├── sleep2.jpg │ ├── splash.png │ ├── meditate1.jpg │ ├── meditate2.jpg │ ├── meditate3.jpg │ ├── meditate4.jpg │ ├── meditate5.jpg │ ├── meditate6.jpg │ └── adaptive-icon.png └── fonts │ └── SpaceMono-Regular.ttf ├── .github ├── FUNDING.yml ├── dependabot.yml ├── workflows │ ├── cypress.yaml │ ├── lint.yaml │ ├── typecheck.yaml │ └── test.yaml ├── ISSUE_TEMPLATE │ ├── issue_template.md │ └── feature_request.md └── pull_request_template.md ├── cypress ├── .eslintrc.json ├── tsconfig.json └── integration │ ├── StatsScreen.ts │ ├── SettingsScreen.ts │ └── HomeScreen.ts ├── docs └── images │ └── logos │ ├── slack.gif │ ├── facebook.png │ ├── twitter.png │ └── instagram.jpg ├── .prettierrc ├── components ├── index.ts ├── StyledText.tsx ├── __tests__ │ ├── StyledText.tests.tsx │ ├── Themed.tests.tsx │ ├── LoadingScreen.tests.tsx │ └── Screen.tests.tsx ├── LoadingScreen.tsx ├── FavouriteButton.tsx ├── Screen.tsx ├── Themed.tsx └── DownloadButton.tsx ├── hooks ├── useMsToMinutes.ts ├── useAppDispatch.ts ├── useFiles.web.ts ├── useAppSelector.ts ├── useMeditation.ts ├── index.ts ├── useQuote.ts ├── useMsToTime.ts ├── useColorScheme.ts ├── useMinutesToStatsTime.ts ├── useFiles.ts ├── useSetNavigationBarColor.ts ├── __tests__ │ ├── useMsToTime.tests.ts │ ├── useMsToMinutes.tests.ts │ └── useMinutesToStatsTime.tests.ts └── useCachedResources.ts ├── cypress.json ├── tsconfig.json ├── babel.config.js ├── MEDITATIONS ├── utils ├── index.ts └── analytics.ts ├── redux ├── rootReducer.ts ├── store.ts ├── selectors.ts └── meditationSlice.ts ├── eas.json ├── .eslintrc.js ├── .expo-shared └── assets.json ├── .gitignore ├── screens ├── Settings │ ├── About │ │ ├── index.test.tsx │ │ └── index.tsx │ └── index.tsx ├── Play │ ├── PlayerIcon │ │ └── index.tsx │ ├── PlayerControls │ │ └── index.tsx │ └── index.tsx ├── NotFoundScreen.tsx ├── Stats │ ├── Calendar │ │ └── index.tsx │ ├── ManualEntry │ │ ├── index.tsx │ │ └── __tests__ │ │ │ └── index.tsx │ └── index.tsx ├── Completed │ └── index.tsx └── Home │ └── index.tsx ├── patches └── react-native-reanimated+2.3.1.patch ├── types.tsx ├── navigation ├── LinkingConfiguration.ts ├── MainNavigator.tsx ├── index.tsx └── BottomTabNavigator.tsx ├── app.json ├── App.tsx ├── STYLEGUIDE.md ├── CONTRIBUTING.md ├── package.json ├── data └── meditations.ts ├── README.md ├── CODE_OF_CONDUCT.md └── LICENSE /constants/Units.ts: -------------------------------------------------------------------------------- 1 | export const MS_PER_MINUTE = 60000 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # .husky/pre-commit (v5) 3 | # ... 4 | yarn lint-staged 5 | -------------------------------------------------------------------------------- /assets/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/icon.png -------------------------------------------------------------------------------- /assets/images/love.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/love.jpg -------------------------------------------------------------------------------- /assets/images/rocks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/rocks.jpg -------------------------------------------------------------------------------- /assets/images/sleep.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/sleep.jpg -------------------------------------------------------------------------------- /assets/images/tea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/tea.jpg -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | open_collective: heylinda 4 | -------------------------------------------------------------------------------- /assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/favicon.png -------------------------------------------------------------------------------- /assets/images/sleep2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/sleep2.jpg -------------------------------------------------------------------------------- /assets/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/splash.png -------------------------------------------------------------------------------- /cypress/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "plugin:cypress/recommended" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /assets/images/meditate1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/meditate1.jpg -------------------------------------------------------------------------------- /assets/images/meditate2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/meditate2.jpg -------------------------------------------------------------------------------- /assets/images/meditate3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/meditate3.jpg -------------------------------------------------------------------------------- /assets/images/meditate4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/meditate4.jpg -------------------------------------------------------------------------------- /assets/images/meditate5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/meditate5.jpg -------------------------------------------------------------------------------- /assets/images/meditate6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/meditate6.jpg -------------------------------------------------------------------------------- /docs/images/logos/slack.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/docs/images/logos/slack.gif -------------------------------------------------------------------------------- /docs/images/logos/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/docs/images/logos/facebook.png -------------------------------------------------------------------------------- /docs/images/logos/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/docs/images/logos/twitter.png -------------------------------------------------------------------------------- /assets/images/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/images/adaptive-icon.png -------------------------------------------------------------------------------- /docs/images/logos/instagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/docs/images/logos/instagram.jpg -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "trailingComma": "es5", 4 | "singleQuote": true, 5 | "printWidth": 100 6 | } 7 | -------------------------------------------------------------------------------- /assets/fonts/SpaceMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heylinda/heylinda-app/HEAD/assets/fonts/SpaceMono-Regular.ttf -------------------------------------------------------------------------------- /components/index.ts: -------------------------------------------------------------------------------- 1 | export * from './LoadingScreen' 2 | export * from './Screen' 3 | export * from './StyledText' 4 | export * from './Themed' 5 | -------------------------------------------------------------------------------- /hooks/useMsToMinutes.ts: -------------------------------------------------------------------------------- 1 | export function useMsToMinutes(ms: number) { 2 | const minutes = Math.floor(ms / 60000) 3 | 4 | return minutes 5 | } 6 | -------------------------------------------------------------------------------- /cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "baseUrl": "http://localhost:19006", 3 | "fixturesFolder": false, 4 | "supportFile": false, 5 | "pluginsFile": false 6 | } 7 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "expo/tsconfig.base", 3 | "compilerOptions": { 4 | "lib": ["es2019"], 5 | "strict": true 6 | }, 7 | "exclude": ["./cypress/*"] 8 | } 9 | -------------------------------------------------------------------------------- /hooks/useAppDispatch.ts: -------------------------------------------------------------------------------- 1 | import { useDispatch } from 'react-redux' 2 | import { AppDispatch } from '../redux/store' 3 | 4 | export const useAppDispatch = () => useDispatch() 5 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true) 3 | return { 4 | presets: ['babel-preset-expo'], 5 | plugins: ['react-native-reanimated/plugin'], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /hooks/useFiles.web.ts: -------------------------------------------------------------------------------- 1 | export const useFiles = async (filetype: string) => { 2 | // this is a walk around for es lint error 3 | if (!filetype) { 4 | return undefined 5 | } 6 | return undefined 7 | } 8 | -------------------------------------------------------------------------------- /cypress/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["es5", "dom"], 5 | "types": ["cypress"] 6 | }, 7 | 8 | "include": ["**/*.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /hooks/useAppSelector.ts: -------------------------------------------------------------------------------- 1 | import { TypedUseSelectorHook, useSelector } from 'react-redux' 2 | import { RootState } from '../redux/store' 3 | 4 | export const useAppSelector: TypedUseSelectorHook = useSelector 5 | -------------------------------------------------------------------------------- /MEDITATIONS: -------------------------------------------------------------------------------- 1 | The meditations used in the app are licensed by the author(s). You must abide 2 | to the license set out by the author of the meditation recording. We have no 3 | control over and assume no responsibility for your usage. 4 | -------------------------------------------------------------------------------- /utils/index.ts: -------------------------------------------------------------------------------- 1 | import { openURL as expoOpenURL } from 'expo-linking' 2 | 3 | export const openURL = async (url: string) => { 4 | try { 5 | await expoOpenURL(url) 6 | } catch (error) { 7 | console.error(error) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /redux/rootReducer.ts: -------------------------------------------------------------------------------- 1 | import { combineReducers } from '@reduxjs/toolkit' 2 | import meditationReducer from './meditationSlice' 3 | 4 | const rootReducer = combineReducers({ 5 | meditation: meditationReducer, 6 | }) 7 | 8 | export default rootReducer 9 | -------------------------------------------------------------------------------- /components/StyledText.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | import { Text, TextProps } from './Themed' 4 | 5 | export function MonoText(props: TextProps) { 6 | return 7 | } 8 | -------------------------------------------------------------------------------- /constants/Layout.ts: -------------------------------------------------------------------------------- 1 | import { Dimensions } from 'react-native' 2 | 3 | const width = Dimensions.get('window').width 4 | const height = Dimensions.get('window').height 5 | 6 | export default { 7 | window: { 8 | width, 9 | height, 10 | }, 11 | isSmallDevice: width < 375, 12 | } 13 | -------------------------------------------------------------------------------- /hooks/useMeditation.ts: -------------------------------------------------------------------------------- 1 | import { Meditation, meditations } from '../data/meditations' 2 | 3 | export const useMeditation = (id: string): Meditation | undefined => { 4 | const arr = Object.values(meditations).flat() 5 | const meditation = arr.find((m: Meditation) => m.id === id) 6 | return meditation 7 | } 8 | -------------------------------------------------------------------------------- /eas.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { 3 | "production": {}, 4 | "preview": { 5 | "distribution": "internal" 6 | }, 7 | "development": { 8 | "developmentClient": true, 9 | "distribution": "internal" 10 | } 11 | }, 12 | "cli": { 13 | "version": ">= 0.45.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['react', 'react-native'], 3 | extends: ['@react-native-community'], 4 | rules: { 5 | '@typescript-eslint/no-explicit-any': 'warn', 6 | 'react-native/no-unused-styles': 1, 7 | 'react-native/no-color-literals': 1, 8 | semi: ['error', 'never'], 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /.expo-shared/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "e997a5256149a4b76e6bfd6cbf519c5e5a0f1d278a3d8fa1253022b03c90473b": true, 3 | "af683c96e0ffd2cf81287651c9433fa44debc1220ca7cb431fe482747f34a505": true, 4 | "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, 5 | "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true 6 | } 7 | -------------------------------------------------------------------------------- /hooks/index.ts: -------------------------------------------------------------------------------- 1 | export * from './useAppDispatch' 2 | export * from './useAppSelector' 3 | export * from './useCachedResources' 4 | export * from './useColorScheme' 5 | export * from './useMeditation' 6 | export * from './useMsToTime' 7 | export * from './useQuote' 8 | export * from './useMsToMinutes' 9 | export * from './useMinutesToStatsTime' 10 | -------------------------------------------------------------------------------- /hooks/useQuote.ts: -------------------------------------------------------------------------------- 1 | import quotes from '../data/quotes' 2 | 3 | export const useQuote = () => { 4 | const max = quotes.length - 1 5 | const r = Math.floor(Math.random() * max) 6 | const item = quotes[r] 7 | const quote = item.text 8 | const author = item.author 9 | 10 | return { 11 | quote, 12 | author, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .expo/ 3 | npm-debug.* 4 | *.jks 5 | *.p8 6 | *.p12 7 | *.key 8 | *.mobileprovision 9 | *.orig.* 10 | web-build/ 11 | 12 | # macOS 13 | .DS_Store 14 | 15 | # eslint files 16 | .eslintcache 17 | 18 | # other files 19 | NOTES.md 20 | cypress/videos/ 21 | app-store/ 22 | 23 | # Local Netlify folder 24 | .netlify 25 | 26 | # ide 27 | .idea 28 | -------------------------------------------------------------------------------- /screens/Settings/About/index.test.tsx: -------------------------------------------------------------------------------- 1 | import { render } from '@testing-library/react-native' 2 | import React from 'react' 3 | 4 | import About from './index' 5 | 6 | describe('About', () => { 7 | test('renders', async () => { 8 | const { getByText } = render() 9 | 10 | getByText('Application Version') 11 | getByText('Build Version') 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /components/__tests__/StyledText.tests.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { render } from '@testing-library/react-native' 3 | 4 | import { MonoText } from '../StyledText' 5 | 6 | it('renders MonoText correctly', () => { 7 | const { getByTestId } = render(Snapshot test!) 8 | const element = getByTestId('mono-text') 9 | 10 | expect(element.type).toBe('Text') 11 | }) 12 | -------------------------------------------------------------------------------- /hooks/useMsToTime.ts: -------------------------------------------------------------------------------- 1 | function formatToString(n: number) { 2 | return n < 10 ? `0${n}` : n 3 | } 4 | 5 | export function useMsToTime(s: number) { 6 | const ms = s % 1000 7 | s = (s - ms) / 1000 8 | const secs = s % 60 9 | s = (s - secs) / 60 10 | const mins = s % 60 11 | const minsString = formatToString(mins) 12 | const secsString = formatToString(secs) 13 | 14 | return minsString + ':' + secsString 15 | } 16 | -------------------------------------------------------------------------------- /cypress/integration/StatsScreen.ts: -------------------------------------------------------------------------------- 1 | describe('StatsScreen', () => { 2 | it('loads stats', () => { 3 | cy.visit('/') 4 | 5 | cy.contains('Stats').click() 6 | 7 | cy.contains('Stats') 8 | 9 | cy.contains('Current Streak') 10 | cy.contains('0 days') 11 | 12 | cy.contains('Total Sessions') 13 | cy.contains('0 sessions') 14 | 15 | cy.contains('Time Meditating') 16 | cy.contains('0 minutes') 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /hooks/useColorScheme.ts: -------------------------------------------------------------------------------- 1 | import { ColorSchemeName, useColorScheme as _useColorScheme } from 'react-native' 2 | 3 | // The useColorScheme value is always either light or dark, but the built-in 4 | // type suggests that it can be null. This will not happen in practice, so this 5 | // makes it a bit easier to work with. 6 | export default function useColorScheme(): NonNullable { 7 | return _useColorScheme() as NonNullable 8 | } 9 | -------------------------------------------------------------------------------- /hooks/useMinutesToStatsTime.ts: -------------------------------------------------------------------------------- 1 | /** Receives a number of minutes and return a friendly string for easier reading */ 2 | export function useMinutesToStatsTime(minutes: number) { 3 | const h = Math.floor(minutes / 60) 4 | const m = minutes % 60 5 | 6 | if (h && m) { 7 | return `${h}h ${m}m` 8 | } else if (h) { 9 | return `${h} hour${h === 1 ? '' : 's'}` 10 | } else { 11 | return `${m} minute${m === 1 ? '' : 's'}` 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Setup for dependabot 2 | 3 | version: 2 4 | updates: 5 | # Maintain dependencies for npm 6 | - package-ecosystem: 'npm' 7 | # Look for `package.json` and `lock` files in the `root` directory 8 | directory: '/' 9 | # Check the yarn registry for updates every month 10 | schedule: 11 | interval: 'monthly' 12 | # Allow up to 1 open pull requests for npm dependencies 13 | open-pull-requests-limit: 1 14 | -------------------------------------------------------------------------------- /.github/workflows/cypress.yaml: -------------------------------------------------------------------------------- 1 | name: Cypress 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | cypress-run: 7 | name: Run Cypress Tests 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: actions/checkout@v2 11 | 12 | - name: Run cypress 13 | uses: cypress-io/github-action@v2 14 | with: 15 | install-command: yarn --frozen-lockfile 16 | start: yarn web 17 | wait-on: 'http://localhost:19006' 18 | -------------------------------------------------------------------------------- /hooks/useFiles.ts: -------------------------------------------------------------------------------- 1 | import * as FileSystem from 'expo-file-system' 2 | 3 | export const useFiles = async (filetype: string) => { 4 | if (!filetype) { 5 | return undefined 6 | } 7 | 8 | let base = FileSystem.documentDirectory || '' 9 | let fs = FileSystem.readDirectoryAsync(base) 10 | 11 | let result = await fs.then((files) => { 12 | let audioFiles = files.filter((file) => file.includes(filetype)) 13 | return audioFiles 14 | }) 15 | 16 | return result 17 | } 18 | -------------------------------------------------------------------------------- /hooks/useSetNavigationBarColor.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import * as NavigationBar from 'expo-navigation-bar' 3 | import { useThemeColor } from '../components' 4 | import { Platform } from 'react-native' 5 | 6 | export default function useSetNavigationBarColor() { 7 | const backgroundColor = useThemeColor({}, 'navBarBackground') 8 | 9 | React.useEffect(() => { 10 | if (Platform.OS === 'android') { 11 | NavigationBar.setBackgroundColorAsync(backgroundColor) 12 | } 13 | }, [backgroundColor]) 14 | } 15 | -------------------------------------------------------------------------------- /.github/workflows/lint.yaml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | run-linter: 7 | name: Run Linter 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: actions/checkout@v2 11 | 12 | - uses: actions/cache@v2 13 | with: 14 | path: '**/node_modules' 15 | key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} 16 | 17 | - uses: actions/setup-node@v1 18 | with: 19 | node-version: '14' 20 | 21 | - name: Install packages 22 | run: yarn install --frozen-lockfile 23 | 24 | - name: Run linter 25 | run: yarn lint 26 | -------------------------------------------------------------------------------- /.github/workflows/typecheck.yaml: -------------------------------------------------------------------------------- 1 | name: Type Check 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | run-tsc: 7 | name: Run tsc 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: actions/checkout@v2 11 | 12 | - uses: actions/cache@v2 13 | with: 14 | path: '**/node_modules' 15 | key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} 16 | 17 | - uses: actions/setup-node@v1 18 | with: 19 | node-version: '14' 20 | 21 | - name: Install packages 22 | run: yarn install --frozen-lockfile 23 | 24 | - name: Run tsc 25 | run: yarn tsc 26 | -------------------------------------------------------------------------------- /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | run-unit-tests: 7 | name: Run Unit Tests 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: actions/checkout@v2 11 | 12 | - uses: actions/cache@v2 13 | with: 14 | path: '**/node_modules' 15 | key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} 16 | 17 | - uses: actions/setup-node@v1 18 | with: 19 | node-version: '14' 20 | 21 | - name: Install packages 22 | run: yarn install --frozen-lockfile 23 | 24 | - name: Run tests 25 | run: yarn jest 26 | -------------------------------------------------------------------------------- /components/__tests__/Themed.tests.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { render } from '@testing-library/react-native' 3 | import { Text, View } from '../Themed' 4 | 5 | describe('Themed component tests', () => { 6 | it('renders themed text correctly', () => { 7 | const { getByTestId } = render() 8 | const element = getByTestId('themed-text') 9 | 10 | expect(element.type).toBe('Text') 11 | }) 12 | 13 | it('renders themed View correctly', () => { 14 | const { getByTestId } = render() 15 | const element = getByTestId('themed-view') 16 | 17 | expect(element.type).toBe('View') 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /screens/Play/PlayerIcon/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { MaterialIcons as Icon } from '@expo/vector-icons' 3 | import { useThemeColor } from '../../../components/Themed' 4 | import { StyleSheet } from 'react-native' 5 | 6 | function PlayerIcon(props: { 7 | name: React.ComponentProps['name'] 8 | color?: string 9 | size?: number 10 | onPress: () => void 11 | }) { 12 | const primary = useThemeColor({}, 'primary') 13 | return 14 | } 15 | 16 | const styles = StyleSheet.create({ 17 | playerIcon: { marginBottom: -3 }, 18 | }) 19 | 20 | export default PlayerIcon 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/issue_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug Report 3 | about: Open a new issue here if something isn't working as expected. 4 | title: "[Bug]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Before reporting:** 11 | - [ ] The same bug wasn't already reported, i.e. it's not a duplicate 12 | - [ ] This bug is not reported due to an unstable environment 13 | 14 | **Steps to reproduce:** 15 | 16 | 1. 17 | 2. 18 | 3. 19 | 20 | **Expected behaviour:** 21 | 22 | **Actual behaviour:** 23 | 24 | **Smartphone (please complete the following information):** 25 | - Device/OS: [e.g. iPhone6/iOS8] 26 | - Version [e.g. 22] 27 | 28 | **Screenshots/Recording:** 29 | -------------------------------------------------------------------------------- /components/LoadingScreen.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StyleSheet } from 'react-native' 3 | import { ActivityIndicator } from 'react-native-paper' 4 | import { useThemeColor } from './Themed' 5 | 6 | interface Props { 7 | loading?: boolean 8 | } 9 | export const LoadingScreen: React.FC = ({ loading = false }) => { 10 | const primary = useThemeColor({}, 'primary') 11 | 12 | if (loading) { 13 | return 14 | } 15 | return null 16 | } 17 | 18 | const styles = StyleSheet.create({ 19 | loading: { flex: 1 }, 20 | }) 21 | 22 | export default LoadingScreen 23 | -------------------------------------------------------------------------------- /components/__tests__/LoadingScreen.tests.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { render } from '@testing-library/react-native' 3 | 4 | import LoadingScreen from '../LoadingScreen' 5 | 6 | describe('tests for LoadingScreen component', () => { 7 | it('given Loading screen without props, null should be returned', () => { 8 | const tree = render().toJSON() 9 | expect(tree).toBeNull() 10 | }) 11 | 12 | it('given the Loading prop, ActivityIndicator should be returned', () => { 13 | const { getByTestId } = render() 14 | const element = getByTestId('activity-indicator') 15 | expect(element).not.toBeNull() 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /cypress/integration/SettingsScreen.ts: -------------------------------------------------------------------------------- 1 | describe('SettingsScreen', () => { 2 | it('loads settings', () => { 3 | cy.visit('/') 4 | 5 | cy.contains('Settings').click() 6 | 7 | cy.contains('Settings') 8 | 9 | cy.contains('Clear Data') 10 | cy.contains('About') 11 | }) 12 | 13 | it('can navigate to about page and back', () => { 14 | cy.visit('/') 15 | 16 | cy.contains('Settings').click() 17 | 18 | cy.contains('About').click() 19 | 20 | cy.contains('About') 21 | 22 | cy.contains('Application Version') 23 | cy.contains('Build Version') 24 | 25 | cy.get('[data-testid=headerBack]').click() 26 | 27 | cy.contains('Settings') 28 | }) 29 | }) 30 | -------------------------------------------------------------------------------- /components/__tests__/Screen.tests.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { render } from '@testing-library/react-native' 3 | import { Screen } from '../Screen' 4 | 5 | describe('Screen component tests', () => { 6 | it('given Screen component without props, it should return View component', () => { 7 | const { getByTestId } = render() 8 | const element = getByTestId('view-screen') 9 | expect(element.type).toBe('View') 10 | }) 11 | 12 | it('given scroll prop, Screen component should return ScrollView', () => { 13 | const { getByTestId } = render() 14 | const element = getByTestId('scrollview-screen') 15 | expect(element.type).toBe('RCTScrollView') 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🚀 Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | 22 | -------------------------------------------------------------------------------- /components/FavouriteButton.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { TextStyle } from 'react-native' 3 | import { AntDesign as Icon } from '@expo/vector-icons' 4 | 5 | import { StyleProp } from 'react-native' 6 | import { useThemeColor } from './Themed' 7 | 8 | interface Props { 9 | isFavourited: boolean 10 | onPress: () => void 11 | style?: StyleProp 12 | } 13 | 14 | export default function FavouriteButton(props: Props) { 15 | const { isFavourited, onPress, style } = props 16 | const primary = useThemeColor({}, 'primary') 17 | 18 | return ( 19 | 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /patches/react-native-reanimated+2.3.1.patch: -------------------------------------------------------------------------------- 1 | diff --git a/node_modules/react-native-reanimated/src/reanimated2/core.ts b/node_modules/react-native-reanimated/src/reanimated2/core.ts 2 | index 2e0c38a..e9ae28f 100644 3 | --- a/node_modules/react-native-reanimated/src/reanimated2/core.ts 4 | +++ b/node_modules/react-native-reanimated/src/reanimated2/core.ts 5 | @@ -383,9 +383,11 @@ if (!NativeReanimatedModule.useOnlyV1) { 6 | info: runOnJS(capturableConsole.info), 7 | }; 8 | _setGlobalConsole(console); 9 | - global.performance = { 10 | - now: global._chronoNow, 11 | - }; 12 | + if (global.performance == null) { 13 | + global.performance = { 14 | + now: global._chronoNow, 15 | + }; 16 | + } 17 | })(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /types.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Learn more about using TypeScript with React Navigation: 3 | * https://reactnavigation.org/docs/typescript/ 4 | */ 5 | 6 | export type NO_PARAMS = undefined 7 | export type RootStackParamList = { 8 | Root: NO_PARAMS 9 | NotFound: NO_PARAMS 10 | } 11 | 12 | export type MainStackParamList = { 13 | Main: NO_PARAMS 14 | CompletedScreen: NO_PARAMS 15 | } 16 | 17 | export type BottomTabParamList = { 18 | Home: NO_PARAMS 19 | Stats: NO_PARAMS 20 | Settings: NO_PARAMS 21 | } 22 | 23 | export type HomeParamList = { 24 | HomeScreen: NO_PARAMS 25 | PlayScreen: { 26 | id: string 27 | } 28 | } 29 | 30 | export type StatsParamList = { 31 | StatsScreen: NO_PARAMS 32 | } 33 | 34 | export type SettingsParamList = { 35 | SettingsScreen: NO_PARAMS 36 | AboutScreen: NO_PARAMS 37 | } 38 | -------------------------------------------------------------------------------- /hooks/__tests__/useMsToTime.tests.ts: -------------------------------------------------------------------------------- 1 | import { useMsToTime } from '..' 2 | 3 | describe('useMsToTime unit tests', () => { 4 | it('given 0 ms, should return 00:00', () => { 5 | const minutes = useMsToTime(0) 6 | expect(minutes).toBe('00:00') 7 | }) 8 | 9 | it('given 60000 ms, should return 01:00', () => { 10 | const minutes = useMsToTime(60000) 11 | expect(minutes).toBe('01:00') 12 | }) 13 | 14 | it('given 210000 ms, should return 03:30', () => { 15 | const minutes = useMsToTime(210000) 16 | expect(minutes).toBe('03:30') 17 | }) 18 | 19 | it('given 225000 ms, should return 03:45', () => { 20 | const minutes = useMsToTime(225000) 21 | expect(minutes).toBe('03:45') 22 | }) 23 | 24 | it('given 1335000 ms, should return 22:15', () => { 25 | const minutes = useMsToTime(1335000) 26 | expect(minutes).toBe('22:15') 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /navigation/LinkingConfiguration.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Learn more about deep linking with React Navigation 3 | * https://reactnavigation.org/docs/deep-linking 4 | * https://reactnavigation.org/docs/configuring-links 5 | */ 6 | 7 | import { LinkingOptions } from '@react-navigation/native' 8 | import * as Linking from 'expo-linking' 9 | 10 | const LinkingConfiguration: LinkingOptions<{}> = { 11 | prefixes: [Linking.makeUrl('/')], 12 | config: { 13 | screens: { 14 | Root: { 15 | screens: { 16 | TabOne: { 17 | screens: { 18 | TabOneScreen: 'one', 19 | }, 20 | }, 21 | TabTwo: { 22 | screens: { 23 | TabTwoScreen: 'two', 24 | }, 25 | }, 26 | }, 27 | }, 28 | NotFound: '*', 29 | }, 30 | }, 31 | } 32 | 33 | export default LinkingConfiguration 34 | -------------------------------------------------------------------------------- /utils/analytics.ts: -------------------------------------------------------------------------------- 1 | import * as Amplitude from 'expo-analytics-amplitude' 2 | import { Platform } from 'react-native' 3 | import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency' 4 | 5 | export const initializeAnalytics = async () => { 6 | if (Platform.OS === 'ios') { 7 | const { status } = await requestTrackingPermissionsAsync() 8 | if (status !== 'granted') { 9 | return 10 | } 11 | } 12 | if (Platform.OS !== 'web') { 13 | await Amplitude.initializeAsync('c53c4e54414340dc1e6feeb7fd95293c') 14 | } 15 | } 16 | 17 | export const logEvent = async (eventName: string) => { 18 | if (Platform.OS === 'ios') { 19 | const { status } = await requestTrackingPermissionsAsync() 20 | if (status !== 'granted') { 21 | return 22 | } 23 | } 24 | if (Platform.OS !== 'web') { 25 | await Amplitude.logEventAsync(eventName) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /hooks/__tests__/useMsToMinutes.tests.ts: -------------------------------------------------------------------------------- 1 | import { useMsToMinutes } from '..' 2 | 3 | describe('useMsToMinutes unit tests', () => { 4 | it('given 0 ms, should return 0 minutes', () => { 5 | const minutes = useMsToMinutes(0) 6 | expect(minutes).toBe(0) 7 | }) 8 | 9 | it('given 60000 ms, should return 1 minute', () => { 10 | const minutes = useMsToMinutes(60000) 11 | expect(minutes).toBe(1) 12 | }) 13 | 14 | it('given 180000 ms, should return 3 minutes', () => { 15 | const minutes = useMsToMinutes(180000) 16 | expect(minutes).toBe(3) 17 | }) 18 | 19 | it('given 3600000 ms, should return 60 minutes', () => { 20 | const minutes = useMsToMinutes(3600000) 21 | expect(minutes).toBe(60) 22 | }) 23 | 24 | it('given 4500000 ms, should return 75 minutes', () => { 25 | const minutes = useMsToMinutes(4500000) 26 | expect(minutes).toBe(75) 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /redux/store.ts: -------------------------------------------------------------------------------- 1 | import { configureStore } from '@reduxjs/toolkit' 2 | import { 3 | persistStore, 4 | persistReducer, 5 | FLUSH, 6 | REHYDRATE, 7 | PAUSE, 8 | PERSIST, 9 | PURGE, 10 | REGISTER, 11 | } from 'redux-persist' 12 | import AsyncStorage from '@react-native-async-storage/async-storage' 13 | 14 | import rootReducer from './rootReducer' 15 | 16 | const persistConfig = { 17 | key: 'root', 18 | version: 2, 19 | storage: AsyncStorage, 20 | } 21 | 22 | const persistedReducer = persistReducer(persistConfig, rootReducer) 23 | 24 | export const store = configureStore({ 25 | reducer: persistedReducer, 26 | middleware: (getDefaultMiddleware) => 27 | getDefaultMiddleware({ 28 | serializableCheck: { 29 | ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], 30 | }, 31 | }), 32 | }) 33 | export type RootState = ReturnType 34 | export type AppDispatch = typeof store.dispatch 35 | export const persistor = persistStore(store) 36 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 6 | 7 | ## Ticket Link 8 | 9 | 15 | 16 | ## How has this been tested? 17 | 18 | 29 | 30 | ## Screenshots 31 | 32 | 35 | 36 | 37 | ## Checklist 38 | 39 | - [ ] Added a "Closes [issue number]" in the ticket link section 40 | - [ ] You have not changed whitespace unnecessarily (it makes diffs hard to read) 41 | - [ ] You have commented your code, particularly in hard-to-understand areas 42 | - [ ] You have performed a self-review of your own code 43 | - [ ] UI changes: include screenshots of all affected screens 44 | -------------------------------------------------------------------------------- /hooks/useCachedResources.ts: -------------------------------------------------------------------------------- 1 | import { Ionicons } from '@expo/vector-icons' 2 | import * as Font from 'expo-font' 3 | import * as SplashScreen from 'expo-splash-screen' 4 | import * as React from 'react' 5 | 6 | export default function useCachedResources() { 7 | const [isLoadingComplete, setLoadingComplete] = React.useState(false) 8 | 9 | // Load any resources or data that we need prior to rendering the app 10 | React.useEffect(() => { 11 | async function loadResourcesAndDataAsync() { 12 | try { 13 | SplashScreen.preventAutoHideAsync() 14 | 15 | // Load fonts 16 | await Font.loadAsync({ 17 | ...Ionicons.font, 18 | 'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'), 19 | }) 20 | } catch (e) { 21 | // We might want to provide this error information to an error reporting service 22 | console.warn(e) 23 | } finally { 24 | setLoadingComplete(true) 25 | SplashScreen.hideAsync() 26 | } 27 | } 28 | 29 | loadResourcesAndDataAsync() 30 | }, []) 31 | 32 | return isLoadingComplete 33 | } 34 | -------------------------------------------------------------------------------- /components/Screen.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { ScrollView, ViewProps, StyleProp, StyleSheet, ViewStyle } from 'react-native' 3 | import { useThemeColor, View } from './Themed' 4 | 5 | interface Props extends ViewProps { 6 | scroll?: boolean 7 | style?: StyleProp 8 | } 9 | 10 | export const Screen: React.FC = ({ scroll, style, children }) => { 11 | const backgroundColor = useThemeColor({}, 'background') 12 | 13 | return scroll ? ( 14 | 20 | {children} 21 | 22 | ) : ( 23 | 24 | {children} 25 | 26 | ) 27 | } 28 | export default Screen 29 | 30 | const styles = StyleSheet.create({ 31 | container: { 32 | flex: 1, 33 | paddingTop: 36, 34 | paddingBottom: 36, 35 | paddingLeft: 14, 36 | }, 37 | contentContainer: { 38 | paddingBottom: 36, 39 | }, 40 | }) 41 | -------------------------------------------------------------------------------- /screens/NotFoundScreen.tsx: -------------------------------------------------------------------------------- 1 | import { useNavigation, NavigationProp } from '@react-navigation/native' 2 | import * as React from 'react' 3 | import { StyleSheet, Text, TouchableOpacity, View } from 'react-native' 4 | 5 | import { RootStackParamList } from '../types' 6 | 7 | export default function NotFoundScreen() { 8 | const navigation = useNavigation>() 9 | 10 | return ( 11 | 12 | This screen doesn't exist. 13 | navigation.goBack()} style={styles.link}> 14 | Go to home screen! 15 | 16 | 17 | ) 18 | } 19 | 20 | const styles = StyleSheet.create({ 21 | container: { 22 | flex: 1, 23 | backgroundColor: '#fff', 24 | alignItems: 'center', 25 | justifyContent: 'center', 26 | padding: 20, 27 | }, 28 | title: { 29 | fontSize: 20, 30 | fontWeight: 'bold', 31 | }, 32 | link: { 33 | marginTop: 15, 34 | paddingVertical: 15, 35 | }, 36 | linkText: { 37 | fontSize: 14, 38 | color: '#2e78b7', 39 | }, 40 | }) 41 | -------------------------------------------------------------------------------- /screens/Settings/About/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import * as Application from 'expo-application' 3 | import { Caption, Divider, List } from 'react-native-paper' 4 | import { StyleSheet } from 'react-native' 5 | import { openURL } from '../../../utils' 6 | 7 | const About = () => { 8 | const openAboutUs = () => { 9 | try { 10 | openURL('https://heylinda.netlify.app/about') 11 | } catch (error) { 12 | console.error(error) 13 | } 14 | } 15 | 16 | return ( 17 | <> 18 | ( 21 | {Application.nativeApplicationVersion} 22 | )} 23 | /> 24 | 25 | {Application.nativeBuildVersion}} 28 | /> 29 | 30 | 31 | 32 | 33 | ) 34 | } 35 | 36 | const styles = StyleSheet.create({ 37 | caption: { 38 | marginTop: 5, 39 | }, 40 | }) 41 | 42 | export default About 43 | -------------------------------------------------------------------------------- /constants/Colors.ts: -------------------------------------------------------------------------------- 1 | const primary = '#463FB0' // rgb(70, 63, 176) 2 | const purples = { 3 | purple900: '#4A5784', // rgb(74, 87, 132) 4 | purple500: '#6F69C9', // rgb(111, 105, 201) 5 | } 6 | const grays = { 7 | white: '#fff', // rgb(255, 255, 255) 8 | gray100: '#F2F2F2', // rgb(242, 242, 242) 9 | gray800: '#5D5D5D', // rgb(93, 93, 93) 10 | gray900: '#333333', // rgb(51, 51, 51) 11 | gray950: '#1e1e1e', //rgb(30, 30, 30) 12 | gray975: '#121212', // rgb(18, 18, 18) 13 | black: '#000', // rgb(0, 0, 0) 14 | } 15 | 16 | export default { 17 | light: { 18 | primary, 19 | text: grays.gray900, 20 | background: grays.gray100, 21 | tint: primary, 22 | tabIconDefault: '#ccc', 23 | ...purples, 24 | ...grays, 25 | completedBackground: primary, 26 | completedPrimary: grays.white, 27 | navBarBackground: grays.white, 28 | }, 29 | dark: { 30 | primary, 31 | text: grays.white, 32 | background: grays.gray900, 33 | tint: primary, 34 | tabIconDefault: '#ccc', 35 | ...purples, 36 | ...grays, 37 | white: grays.gray950, 38 | completedBackground: grays.gray900, 39 | completedPrimary: purples.purple500, 40 | navBarBackground: grays.gray975, 41 | }, 42 | } 43 | -------------------------------------------------------------------------------- /screens/Play/PlayerControls/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StyleSheet } from 'react-native' 3 | 4 | import PlayerIcon from '../PlayerIcon' 5 | import { View, Text } from '../../../components/Themed' 6 | 7 | interface Props { 8 | positionTime: string 9 | durationTime: string 10 | isPlaying: boolean 11 | pause: () => void 12 | play: () => void 13 | replay: () => void 14 | forward: () => void 15 | } 16 | export default function PlayerControls({ 17 | positionTime, 18 | durationTime, 19 | isPlaying, 20 | pause, 21 | play, 22 | replay, 23 | forward, 24 | }: Props) { 25 | return ( 26 | 27 | {positionTime} 28 | 29 | {isPlaying ? ( 30 | 31 | ) : ( 32 | 33 | )} 34 | 35 | {durationTime} 36 | 37 | ) 38 | } 39 | 40 | const styles = StyleSheet.create({ 41 | controls: { 42 | flexDirection: 'row', 43 | alignItems: 'center', 44 | justifyContent: 'space-evenly', 45 | }, 46 | }) 47 | -------------------------------------------------------------------------------- /navigation/MainNavigator.tsx: -------------------------------------------------------------------------------- 1 | import { createStackNavigator } from '@react-navigation/stack' 2 | import React from 'react' 3 | import { StyleSheet } from 'react-native' 4 | import BottomTabNavigator from './BottomTabNavigator' 5 | import CompletedScreen from '../screens/Completed' 6 | import Colors from '../constants/Colors' 7 | import { MainStackParamList } from '../types' 8 | 9 | const Stack = createStackNavigator() 10 | 11 | export default function MainNavigator() { 12 | return ( 13 | 14 | 15 | 27 | 28 | ) 29 | } 30 | 31 | const styles = StyleSheet.create({ 32 | headerTitle: { 33 | fontWeight: '600', 34 | color: Colors.light.white, 35 | fontSize: 16, 36 | }, 37 | header: { 38 | backgroundColor: Colors.light.primary, 39 | }, 40 | }) 41 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "owner": "heylinda", 4 | "name": "Hey Linda", 5 | "slug": "hey-linda", 6 | "version": "1.2.0", 7 | "orientation": "portrait", 8 | "icon": "./assets/images/icon.png", 9 | "scheme": "myapp", 10 | "userInterfaceStyle": "automatic", 11 | "splash": { 12 | "image": "./assets/images/splash.png", 13 | "resizeMode": "contain", 14 | "backgroundColor": "#fff" 15 | }, 16 | "updates": { 17 | "fallbackToCacheTimeout": 0 18 | }, 19 | "assetBundlePatterns": ["**/*"], 20 | "ios": { 21 | "supportsTablet": true, 22 | "buildNumber": "20", 23 | "infoPlist": {}, 24 | "bundleIdentifier": "com.meditation.heylinda" 25 | }, 26 | "android": { 27 | "userInterfaceStyle": "automatic", 28 | "adaptiveIcon": { 29 | "foregroundImage": "./assets/images/adaptive-icon.png", 30 | "backgroundColor": "#ffffff" 31 | }, 32 | "package": "com.meditation.heylinda", 33 | "versionCode": 20 34 | }, 35 | "web": { 36 | "favicon": "./assets/images/favicon.png" 37 | }, 38 | "plugins": [ 39 | [ 40 | "expo-tracking-transparency", 41 | { 42 | "userTrackingPermission": "This identifier will be used to deliver personalized ads to you." 43 | } 44 | ] 45 | ] 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /hooks/__tests__/useMinutesToStatsTime.tests.ts: -------------------------------------------------------------------------------- 1 | import { useMinutesToStatsTime } from '..' 2 | 3 | describe('useMinutesToStatsTime unit tests', () => { 4 | it('given 0 minutes, should return 0 minutes', () => { 5 | const time = useMinutesToStatsTime(0) 6 | expect(time).toBe('0 minutes') 7 | }) 8 | 9 | it('given 1 minute, should return 1 minute', () => { 10 | const time = useMinutesToStatsTime(1) 11 | expect(time).toBe('1 minute') 12 | }) 13 | 14 | it('given 2 minutes, should return 2 minutes', () => { 15 | const time = useMinutesToStatsTime(2) 16 | expect(time).toBe('2 minutes') 17 | }) 18 | 19 | it('given 59 minutes, should return 59 minutes', () => { 20 | const time = useMinutesToStatsTime(59) 21 | expect(time).toBe('59 minutes') 22 | }) 23 | 24 | it('given 60 minutes, should return 1 hour', () => { 25 | const time = useMinutesToStatsTime(60) 26 | expect(time).toBe('1 hour') 27 | }) 28 | 29 | it('given 120 minutes, should return 2 hours', () => { 30 | const time = useMinutesToStatsTime(120) 31 | expect(time).toBe('2 hours') 32 | }) 33 | 34 | it('given 75 minutes, should return 1h 15m', () => { 35 | const time = useMinutesToStatsTime(75) 36 | expect(time).toBe('1h 15m') 37 | }) 38 | 39 | it('given 93 minutes, should return 1h 33m', () => { 40 | const time = useMinutesToStatsTime(93) 41 | expect(time).toBe('1h 33m') 42 | }) 43 | }) 44 | -------------------------------------------------------------------------------- /App.tsx: -------------------------------------------------------------------------------- 1 | import 'react-native-gesture-handler' 2 | import 'react-native-get-random-values' 3 | import { Provider } from 'react-redux' 4 | import { StatusBar } from 'expo-status-bar' 5 | import React from 'react' 6 | import { SafeAreaProvider } from 'react-native-safe-area-context' 7 | import { Provider as PaperProvider } from 'react-native-paper' 8 | 9 | import useCachedResources from './hooks/useCachedResources' 10 | import useColorScheme from './hooks/useColorScheme' 11 | import Navigation from './navigation' 12 | import { store, persistor } from './redux/store' 13 | import { PersistGate } from 'redux-persist/integration/react' 14 | import { gestureHandlerRootHOC } from 'react-native-gesture-handler' 15 | import useSetNavigationBarColor from './hooks/useSetNavigationBarColor' 16 | 17 | const App = () => { 18 | const isLoadingComplete = useCachedResources() 19 | const colorScheme = useColorScheme() 20 | useSetNavigationBarColor() 21 | 22 | if (!isLoadingComplete) { 23 | return null 24 | } else { 25 | return ( 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | ) 37 | } 38 | } 39 | 40 | export default gestureHandlerRootHOC(App) 41 | -------------------------------------------------------------------------------- /cypress/integration/HomeScreen.ts: -------------------------------------------------------------------------------- 1 | describe('HomeScreen', () => { 2 | it('loads default mediations', () => { 3 | cy.visit('/') 4 | 5 | cy.contains('Home') 6 | 7 | cy.contains('POPULAR') 8 | cy.contains('Power of Love') 9 | cy.contains('Love and Peace') 10 | 11 | cy.contains('Quick Powerful Meditation') 12 | cy.contains('Busy At Work') 13 | 14 | cy.contains('Deep Breathing') 15 | cy.contains('Just Breath') 16 | 17 | cy.contains('Yawn and Stretch') 18 | cy.contains('Rise and Shine') 19 | 20 | cy.contains('ANXIETY') 21 | cy.contains('Deep and Quick Relaxation') 22 | cy.contains('Love and Peace') 23 | 24 | cy.contains('Calming Medition') 25 | cy.contains('Deep Relaxation') 26 | 27 | cy.contains('Candle Relaxation') 28 | cy.contains('Get Some Rest') 29 | 30 | cy.contains('SLEEP') 31 | cy.contains('Deep Sleep') 32 | cy.contains('Wake Up Refreshed') 33 | 34 | cy.contains('Short Sleep') 35 | cy.contains('For Taking a Nap') 36 | 37 | cy.contains('Good Sleep') 38 | cy.contains('Drift Off To Sleep') 39 | }) 40 | 41 | it('can save favourite meditations to home screen', () => { 42 | cy.visit('/') 43 | 44 | cy.contains('Power of Love').click() 45 | 46 | cy.get('.r-right-8eqzbf').click() 47 | 48 | cy.get('a').contains('Home').click() 49 | 50 | cy.contains('FAVOURITE') 51 | 52 | cy.contains('Power of Love') 53 | cy.contains('Love and Peace') 54 | }) 55 | }) 56 | -------------------------------------------------------------------------------- /components/Themed.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Learn more about Light and Dark modes: 3 | * https://docs.expo.io/guides/color-schemes/ 4 | */ 5 | 6 | import * as React from 'react' 7 | import { Text as DefaultText, View as DefaultView } from 'react-native' 8 | 9 | import Colors from '../constants/Colors' 10 | import useColorScheme from '../hooks/useColorScheme' 11 | 12 | export function useThemeColor( 13 | props: { light?: string; dark?: string }, 14 | colorName: keyof typeof Colors.light & keyof typeof Colors.dark 15 | ) { 16 | const theme = useColorScheme() 17 | const colorFromProps = props[theme] 18 | 19 | if (colorFromProps) { 20 | return colorFromProps 21 | } else { 22 | return Colors[theme][colorName] 23 | } 24 | } 25 | 26 | type ThemeProps = { 27 | lightColor?: string 28 | darkColor?: string 29 | } 30 | 31 | export type TextProps = ThemeProps & DefaultText['props'] 32 | export type ViewProps = ThemeProps & DefaultView['props'] 33 | 34 | export function Text(props: TextProps) { 35 | const { style, lightColor, darkColor, ...otherProps } = props 36 | const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text') 37 | 38 | return 39 | } 40 | 41 | export function View(props: ViewProps) { 42 | const { style, lightColor, darkColor, ...otherProps } = props 43 | const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background') 44 | 45 | return 46 | } 47 | -------------------------------------------------------------------------------- /redux/selectors.ts: -------------------------------------------------------------------------------- 1 | import dayjs from 'dayjs' 2 | import { RootState } from './store' 3 | 4 | interface Calendar { 5 | [key: string]: { 6 | selected: boolean 7 | } 8 | } 9 | export const selectFilePaths = (state: RootState) => state.meditation.filepaths || [] 10 | export const selectActivity = (state: RootState) => state.meditation.activity 11 | export const selectFavourites = (state: RootState) => state.meditation.favourites || [] 12 | export const selectTotalSessions = (state: RootState) => 13 | Object.keys(state.meditation.activity).length || 0 14 | export const selectTotalDuration = (state: RootState) => { 15 | let total: number = 0 16 | Object.values(state.meditation.activity).forEach((a) => { 17 | if (a.duration) { 18 | total += a.duration 19 | } 20 | }) 21 | return total 22 | } 23 | export const selectCalendar = (state: RootState) => { 24 | const { activity } = state.meditation 25 | const calendar: Calendar = {} 26 | Object.keys(activity).forEach((k) => { 27 | const date = dayjs(parseInt(k, 10)).format('YYYY-MM-DD') 28 | calendar[date] = { 29 | selected: true, 30 | } 31 | }) 32 | return calendar 33 | } 34 | export const selectStreak = (state: RootState) => { 35 | const calendar = selectCalendar(state) 36 | let streak = 0 37 | 38 | let n = 0 39 | while (true) { 40 | const date = dayjs().subtract(n, 'day').format('YYYY-MM-DD') 41 | if (!calendar[date] && n !== 0) { 42 | break 43 | } 44 | if (calendar[date]) { 45 | streak += 1 46 | } 47 | n += 1 48 | } 49 | 50 | return streak 51 | } 52 | -------------------------------------------------------------------------------- /screens/Settings/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { Alert } from 'react-native' 3 | import { Divider, List } from 'react-native-paper' 4 | import { useAppDispatch } from '../../hooks' 5 | import { reset } from '../../redux/meditationSlice' 6 | import { openURL } from '../../utils' 7 | import { StackNavigationProp } from '@react-navigation/stack' 8 | import { SettingsParamList } from '../../types' 9 | 10 | interface Props { 11 | navigation: StackNavigationProp 12 | } 13 | 14 | const Settings = ({ navigation }: Props) => { 15 | const dispatch = useAppDispatch() 16 | 17 | const openPrivacyPolicy = () => { 18 | try { 19 | openURL('https://heylinda.netlify.app/privacy') 20 | } catch (error) { 21 | console.error(error) 22 | } 23 | } 24 | const clearData = () => { 25 | Alert.alert( 26 | 'Clear Data', 27 | 'Are you sure you want to delete your data? All your stats will be reset. This cannot be undone.', 28 | [ 29 | { 30 | text: 'Clear Data', 31 | onPress: () => dispatch(reset()), 32 | style: 'destructive', 33 | }, 34 | { 35 | text: 'Cancel', 36 | }, 37 | ] 38 | ) 39 | } 40 | return ( 41 | <> 42 | 43 | 44 | 45 | 46 | navigation.navigate('AboutScreen')} /> 47 | 48 | 49 | ) 50 | } 51 | 52 | export default Settings 53 | -------------------------------------------------------------------------------- /STYLEGUIDE.md: -------------------------------------------------------------------------------- 1 | # Style Guide 2 | 3 | Here are the style rules to follow: 4 | 5 | ## #1 Be consistent with the rest of the codebase 6 | 7 | This is the number one rule and should help determine what to do in most cases. 8 | 9 | ## #2 Respect Prettier and Linter rules 10 | 11 | We use a linter and prettier to automatically help you make style guide decisions easy. 12 | 13 | ## #3 File Name 14 | 15 | Generally file names are PascalCase if they are components or classes, and camelCase otherwise. Filenames' extension must be .tsx for component files and .ts otherwise. 16 | 17 | ## #4 Respect Google JavaScript style guide 18 | 19 | The style guide accessible 20 | [here](https://google.github.io/styleguide/jsguide.html) should be 21 | respected. However, if a rule is not consistent with the rest of the codebase, 22 | rule #1 takes precedence. Same thing goes with any of the above rules taking precedence over this rule. 23 | 24 | ## #5 Follow these grammar rules 25 | 26 | - Functions descriptions have to start with a verb using the third person of the 27 | singular. 28 | - _Ex: `/\*\* Tests the validity of the input. _/`\* 29 | - Inline comments within procedures should always use the imperative. 30 | - _Ex: `// Check whether the value is true.`_ 31 | - Acronyms have to be uppercased in comments. 32 | - _Ex: `// IP, DOM, CORS, URL...`_ 33 | - _Exception: Identity Provider = IdP_ 34 | - Acronyms have to be capitalized (but not uppercased) in variable names. 35 | - _Ex: `redirectUrl()`, `signInIdp()`_ 36 | - Never use login/log in in comments. Use “sign-in” if it’s a noun, “sign in” if 37 | it’s a verb. The same goes for the variable name. Never use `login`; always use 38 | `signIn`. 39 | - _Ex: `// The sign-in method.`_ 40 | - _Ex: `// Signs in the user.`_ 41 | - Always start an inline comment with a capital (unless referring to the name of 42 | a variable/function), and end it with a period. 43 | - _Ex: `// This is a valid inline comment.`_ 44 | -------------------------------------------------------------------------------- /navigation/index.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | NavigationContainer, 3 | DefaultTheme, 4 | DarkTheme, 5 | NavigationContainerRef, 6 | } from '@react-navigation/native' 7 | import { createStackNavigator } from '@react-navigation/stack' 8 | import * as React from 'react' 9 | import { ColorSchemeName } from 'react-native' 10 | 11 | import NotFoundScreen from '../screens/NotFoundScreen' 12 | import { RootStackParamList } from '../types' 13 | import MainNavigator from './MainNavigator' 14 | import LinkingConfiguration from './LinkingConfiguration' 15 | import { StatusBar } from 'expo-status-bar' 16 | import { initializeAnalytics, logEvent } from '../utils/analytics' 17 | 18 | export default function Navigation({ colorScheme }: { colorScheme: ColorSchemeName }) { 19 | const navigationContainerRef = React.useRef>(null) 20 | 21 | React.useEffect(() => { 22 | async function initialize() { 23 | try { 24 | await initializeAnalytics() 25 | } catch (e) { 26 | console.error(e) 27 | } 28 | } 29 | initialize() 30 | }, []) 31 | 32 | const handleNavigationStateChange = async () => { 33 | const currentRouteName = navigationContainerRef?.current?.getCurrentRoute()?.name 34 | try { 35 | await logEvent(`Screen:${currentRouteName}` || 'Screen:Unknown') 36 | } catch (e) { 37 | console.error(e) 38 | } 39 | } 40 | 41 | return ( 42 | 48 | 49 | 50 | 51 | ) 52 | } 53 | 54 | // A root stack navigator is often used for displaying modals on top of all other content 55 | // Read more here: https://reactnavigation.org/docs/modal 56 | const Stack = createStackNavigator() 57 | 58 | function RootNavigator() { 59 | return ( 60 | 61 | 62 | 63 | 64 | ) 65 | } 66 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to the Hey Linda App 2 | 3 | You can contribute to Hey Linda by beta testing, recording meditations, or submitting code. 4 | If you plan to make a contribution please do so through [our detailed contribution workflow.](#contribution-steps). You can also join us on Slack to discuss ideas. 5 | 6 | When submitting code, please make every effort to follow existing [conventions and style](https://github.com/heylinda/heylinda-app/blob/main/STYLEGUIDE.md) in order to keep the code as readable as possible. 7 | 8 | Please note we have a [code of conduct](https://github.com/heylinda/heylinda-app/blob/main/CODE_OF_CONDUCT.md), follow it in all your interactions with the project. 9 | 10 |
11 | 12 | ## How To Run locally? 13 | 14 | ### Install 15 | 16 | To install the project, navigate to the directory and run: 17 | 18 | - `yarn global add expo-cli` 19 | - `yarn install` 20 | 21 | ### Run 22 | 23 | To run the project, run the following commands: 24 | 25 | - `yarn android` 26 | - `yarn ios` 27 | 28 |
29 | 30 | ## Submitting a PR 31 | 32 | - For every PR there should be an accompanying [issue](https://github.com/heylinda/heylinda-app/issues) which the PR solves 33 | 34 | - The PR itself should only contain code which is the solution for the given issue 35 | 36 | - If you are a first time contributor check if there is a [good first issue](https://github.com/heylinda/heylinda-app/labels/good%20first%20issue) for you 37 | 38 | ## Contribution steps 39 | 40 | 1. Fork this repository to your own repositiry. 41 | 42 | 2. Clone the forked repositiry to your local machine. 43 | 44 | 3. Create your feature branch: `git checkout -b my-new-feature` 45 | 46 | 4. make changes to the project. 47 | 48 | 5. Commit your changes: `git commit -m 'Add some feature'` 49 | 50 | 6. Push to the branch: `git push origin my-new-feature` 51 | 52 | 7. Submit a pull request :D 53 | 54 | ## Financial contributions 55 | 56 | We also welcome [financial contributions](https://opencollective.com/heylinda/donate). It helps us to grow better and faster. 57 | 58 | ## License 59 | 60 | By contributing your code, you agree to license your contribution under the terms of the [AGPL-3.0 License](https://github.com/heylinda/heylinda-app/blob/main/LICENSE) license. 61 | 62 | All files are released with the AGPL-3.0 License license. 63 | -------------------------------------------------------------------------------- /redux/meditationSlice.ts: -------------------------------------------------------------------------------- 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit' 2 | import { Meditation } from '../data/meditations' 3 | 4 | export interface Activity { 5 | // in miliseconds 6 | duration: number 7 | } 8 | export interface MeditationState { 9 | // When the user meditated, the key is a date string, and the value is the Activity 10 | activity: { 11 | [key: string]: Activity 12 | } 13 | // Local file paths to the audio files downloaded from the server 14 | filepaths: string[] 15 | 16 | favourites: Meditation[] 17 | } 18 | 19 | const initialState: MeditationState = { 20 | activity: {}, 21 | filepaths: [], 22 | favourites: [], 23 | } 24 | 25 | const meditationSlice = createSlice({ 26 | name: 'meditation', 27 | initialState, 28 | reducers: { 29 | completed(state, action: PayloadAction) { 30 | state.activity[Date.now()] = { 31 | duration: action.payload, 32 | } 33 | }, 34 | manualEntry( 35 | state, 36 | action: PayloadAction<{ 37 | timestamp: number 38 | duration: number 39 | }> 40 | ) { 41 | const { duration, timestamp } = action.payload 42 | 43 | // Delete sessions with 0 duration since a single activity is used for manual 44 | if (duration === 0) { 45 | delete state.activity[timestamp] 46 | return 47 | } 48 | 49 | state.activity[timestamp] = { 50 | duration, 51 | } 52 | }, 53 | addFilePath(state, action) { 54 | if (!state.filepaths) { 55 | state.filepaths = [] 56 | } 57 | state.filepaths.push(action.payload) 58 | }, 59 | reset: () => initialState, 60 | updateFavourite: (state, action) => { 61 | if (!state.favourites) { 62 | state.favourites = [] 63 | } 64 | const meditation = action.payload 65 | const meditationIndex = state.favourites.findIndex((item) => item.id === meditation.id) 66 | const meditationAlreadyFavourited = meditationIndex !== -1 67 | 68 | if (meditationAlreadyFavourited) { 69 | state.favourites.splice(meditationIndex, 1) 70 | } else { 71 | state.favourites.push(meditation) 72 | } 73 | }, 74 | }, 75 | }) 76 | 77 | export const { completed, manualEntry, reset, addFilePath, updateFavourite } = 78 | meditationSlice.actions 79 | export default meditationSlice.reducer 80 | -------------------------------------------------------------------------------- /screens/Stats/Calendar/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StyleSheet } from 'react-native' 3 | import dayjs from 'dayjs' 4 | 5 | import { useAppSelector } from '../../../hooks' 6 | import { selectCalendar } from '../../../redux/selectors' 7 | import { Calendar as DefaultCalendar } from 'react-native-calendars' 8 | import { useThemeColor } from '../../../components/Themed' 9 | import { DateData } from 'react-native-calendars/src/types' 10 | 11 | interface Props { 12 | setManualEntryTimestamp: (value: number) => void 13 | } 14 | 15 | export default function Calendar({ setManualEntryTimestamp }: Props) { 16 | const calendar = useAppSelector(selectCalendar) 17 | const white = useThemeColor({}, 'white') 18 | const primary = useThemeColor({}, 'primary') 19 | const textColor = useThemeColor({}, 'text') 20 | const today = dayjs().format('YYYY-MM-DD') 21 | const markedDates = { 22 | [today]: { 23 | marked: true, 24 | }, 25 | ...calendar, 26 | } 27 | 28 | const onManualInput = ({ day, month, year }: DateData) => { 29 | // DateObject months go from 1 to 12, Date months go from 0 to 11 30 | const newTimestamp = new Date(year, month - 1, day).getTime() 31 | 32 | if (newTimestamp < Date.now()) { 33 | setManualEntryTimestamp(newTimestamp) 34 | } 35 | } 36 | 37 | return ( 38 | 64 | ) 65 | } 66 | 67 | const styles = StyleSheet.create({ 68 | calendar: { 69 | marginRight: 14, 70 | marginBottom: 30, 71 | paddingTop: 16, 72 | paddingBottom: 16, 73 | paddingLeft: 16, 74 | paddingRight: 16, 75 | }, 76 | }) 77 | -------------------------------------------------------------------------------- /screens/Completed/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StackNavigationProp } from '@react-navigation/stack' 3 | import { StyleSheet } from 'react-native' 4 | import { AntDesign as Icon } from '@expo/vector-icons' 5 | import { Button } from 'react-native-paper' 6 | 7 | import { Screen, Text, useThemeColor } from '../../components' 8 | import Colors from '../../constants/Colors' 9 | import { MainStackParamList } from '../../types' 10 | import { Linking } from 'react-native' 11 | import { useAppSelector } from '../../hooks' 12 | import { selectTotalSessions } from '../../redux/selectors' 13 | 14 | interface Props { 15 | navigation: StackNavigationProp 16 | } 17 | 18 | const Completed = ({ navigation }: Props) => { 19 | const totalSessions = useAppSelector(selectTotalSessions) 20 | const backgroundColor = useThemeColor({}, 'completedBackground') 21 | const primaryColor = useThemeColor({}, 'completedPrimary') 22 | const onPressDonate = () => { 23 | Linking.openURL('https://opencollective.com/heylinda/donate') 24 | } 25 | const onPressSkip = () => navigation.replace('Main') 26 | 27 | return ( 28 | 29 | 30 | Congratulations! 31 | 32 | You have completed {totalSessions} meditation{totalSessions === 1 ? '' : 's'}!{'\n'}Do you 33 | want to give a donation? 34 | 35 | 38 | 46 | 47 | ) 48 | } 49 | 50 | const styles = StyleSheet.create({ 51 | screen: { 52 | flex: 1, 53 | justifyContent: 'center', 54 | alignItems: 'center', 55 | backgroundColor: Colors.light.primary, 56 | padding: 40, 57 | }, 58 | checkMark: { 59 | marginBottom: 20, 60 | }, 61 | title: { 62 | color: Colors.light.white, 63 | textAlign: 'center', 64 | fontSize: 24, 65 | fontWeight: '600', 66 | marginBottom: 20, 67 | }, 68 | description: { 69 | color: Colors.light.white, 70 | fontSize: 18, 71 | textAlign: 'center', 72 | lineHeight: 28, 73 | marginBottom: 60, 74 | }, 75 | button: { 76 | padding: 8, 77 | width: '100%', 78 | marginBottom: 20, 79 | }, 80 | skipButton: { 81 | borderColor: Colors.light.white, 82 | }, 83 | }) 84 | 85 | export default Completed 86 | -------------------------------------------------------------------------------- /screens/Stats/ManualEntry/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StyleSheet } from 'react-native' 3 | import { Button, Paragraph, Dialog, Portal, Provider, TextInput } from 'react-native-paper' 4 | import { MS_PER_MINUTE } from '../../../constants/Units' 5 | import { useAppDispatch, useAppSelector } from '../../../hooks' 6 | import { manualEntry } from '../../../redux/meditationSlice' 7 | import { selectActivity } from '../../../redux/selectors' 8 | 9 | interface Props { 10 | timestamp?: number 11 | onDismiss: () => void 12 | } 13 | 14 | const ManualEntry = ({ timestamp, onDismiss }: Props) => { 15 | const visible = Boolean(timestamp) 16 | const dispatch = useAppDispatch() 17 | const activity = useAppSelector(selectActivity) 18 | const [duration, setDuration] = React.useState(-1) 19 | const [defaultValue, setDefaultValue] = React.useState('') 20 | 21 | React.useEffect(() => { 22 | if (!timestamp) { 23 | return 24 | } 25 | 26 | const newDuration = activity[timestamp]?.duration || -1 27 | setDuration(newDuration) 28 | setDefaultValue(newDuration === -1 ? '' : Math.floor(newDuration / MS_PER_MINUTE).toString()) 29 | }, [activity, timestamp]) 30 | 31 | const onChangeText = (text: string) => { 32 | const value = Number(text) 33 | 34 | if (text === '' || Number.isNaN(value)) { 35 | setDuration(-1) 36 | return 37 | } 38 | 39 | setDuration(value * MS_PER_MINUTE) 40 | } 41 | 42 | const onSubmit = () => { 43 | if (duration < 0) { 44 | return 45 | } 46 | 47 | dispatch( 48 | manualEntry({ 49 | timestamp: timestamp!, 50 | duration, 51 | }) 52 | ) 53 | onDismiss() 54 | } 55 | 56 | return ( 57 | 58 | 59 | 60 | Manual Entry 61 | 62 | Enter how long you meditated for 63 | 75 | 76 | 77 | 80 | 83 | 84 | 85 | 86 | 87 | ) 88 | } 89 | 90 | const styles = StyleSheet.create({ 91 | textInput: { marginTop: 10 }, 92 | }) 93 | 94 | export default ManualEntry 95 | -------------------------------------------------------------------------------- /components/DownloadButton.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react' 2 | import { StyleSheet, TextStyle } from 'react-native' 3 | import { AntDesign as Icon } from '@expo/vector-icons' 4 | import * as FileSystem from 'expo-file-system' 5 | 6 | import { useMeditation, useAppDispatch } from '../hooks' 7 | import { addFilePath } from '../redux/meditationSlice' 8 | import { useFiles } from '../hooks/useFiles' 9 | import { selectFilePaths } from '../redux/selectors' 10 | import { useAppSelector } from '../hooks' 11 | import { StyleProp } from 'react-native' 12 | import { ActivityIndicator } from 'react-native-paper' 13 | import { useThemeColor } from './Themed' 14 | 15 | interface Props { 16 | id: string 17 | style: StyleProp 18 | } 19 | 20 | export default function DownloadButton(props: Props) { 21 | const { id, style } = props 22 | const [downloading, setDownloading] = useState(false) 23 | const meditation = useMeditation(id) 24 | const files = useFiles('.mp3') 25 | const uri = meditation?.uri || '' 26 | const [audioFiles, setAudioFiles] = useState([]) 27 | const [downloaded, setDownloaded] = useState(false) 28 | const dispatch = useAppDispatch() 29 | const filepaths = useAppSelector(selectFilePaths) 30 | const primary = useThemeColor({}, 'primary') 31 | 32 | const filename = (path: string) => { 33 | let _filename = path.split('/').pop() 34 | if (!_filename) { 35 | return 36 | } 37 | return _filename 38 | } 39 | 40 | useEffect(() => { 41 | // If there's any downloaded audio content in filepaths, set downloaded to true and set audioFiles 42 | if (filepaths.length > 0 && meditation) { 43 | setAudioFiles(filepaths) 44 | 45 | let name = filename(meditation.uri) || '' 46 | let isDownloaded = audioFiles.find((a) => filename(a) === name) 47 | 48 | if (isDownloaded) { 49 | setDownloaded(true) 50 | } 51 | } 52 | }, [audioFiles, files, downloaded, dispatch, meditation, filepaths]) 53 | 54 | const saveAudioFile = async () => { 55 | let base = await FileSystem.documentDirectory 56 | if (!base || !meditation) { 57 | return 58 | } 59 | 60 | const path = base + filename(meditation.uri) || '' 61 | 62 | setDownloading(true) 63 | const downloadedFile: FileSystem.FileSystemDownloadResult = await FileSystem.downloadAsync( 64 | uri, 65 | path 66 | ) 67 | setDownloading(false) 68 | 69 | if (downloadedFile.status === 200) { 70 | dispatch(addFilePath(path)) 71 | setDownloaded(true) 72 | } 73 | } 74 | 75 | if (downloading) { 76 | return 77 | } else if (downloaded) { 78 | return 79 | } else { 80 | return ( 81 | 88 | ) 89 | } 90 | } 91 | 92 | const styles = StyleSheet.create({ 93 | icon: { 94 | marginTop: 10, 95 | }, 96 | }) 97 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "node_modules/expo/AppEntry.js", 3 | "scripts": { 4 | "start": "expo start", 5 | "android": "expo start --android", 6 | "ios": "expo start --ios", 7 | "web": "expo start --web", 8 | "eject": "expo eject", 9 | "test": "jest --watchAll", 10 | "test:e2e": "cypress open", 11 | "test:e2e:headless": "cypress run", 12 | "prepare": "husky install", 13 | "prettier": "prettier --write", 14 | "debug": "open 'rndebugger://set-debugger-loc?host=localhost&port=8081'", 15 | "lint": "eslint --ext .js,.jsx,.ts,.tsx ./", 16 | "postinstall": "patch-package" 17 | }, 18 | "jest": { 19 | "preset": "jest-expo" 20 | }, 21 | "dependencies": { 22 | "@expo/vector-icons": "^12.0.0", 23 | "@react-native-async-storage/async-storage": "~1.15.0", 24 | "@react-native-community/masked-view": "0.1.10", 25 | "@react-navigation/bottom-tabs": "6.2.0", 26 | "@react-navigation/native": "6.0.8", 27 | "@react-navigation/stack": "6.1.1", 28 | "@reduxjs/toolkit": "^1.6.2", 29 | "dayjs": "^1.10.6", 30 | "expo": "^44.0.0", 31 | "expo-analytics": "^1.0.18", 32 | "expo-analytics-amplitude": "~11.1.0", 33 | "expo-asset": "~8.4.6", 34 | "expo-av": "~10.2.0", 35 | "expo-blur": "~11.0.0", 36 | "expo-constants": "~13.0.1", 37 | "expo-file-system": "~13.1.4", 38 | "expo-font": "~10.0.4", 39 | "expo-linking": "~3.0.0", 40 | "expo-navigation-bar": "~1.1.1", 41 | "expo-splash-screen": "~0.14.1", 42 | "expo-status-bar": "~1.2.0", 43 | "expo-system-ui": "~1.1.0", 44 | "expo-tracking-transparency": "~2.1.0", 45 | "expo-web-browser": "~10.1.0", 46 | "jest": "^26.6.3", 47 | "patch-package": "^6.4.7", 48 | "postinstall-postinstall": "^2.1.0", 49 | "react": "17.0.1", 50 | "react-dom": "17.0.1", 51 | "react-native": "0.64.3", 52 | "react-native-calendars": "^1.1267.0", 53 | "react-native-gesture-handler": "~2.1.0", 54 | "react-native-get-random-values": "~1.7.0", 55 | "react-native-paper": "^4.9.2", 56 | "react-native-reanimated": "~2.3.1", 57 | "react-native-safe-area-context": "3.3.2", 58 | "react-native-screens": "~3.10.1", 59 | "react-native-web": "0.17.1", 60 | "react-redux": "^7.2.5", 61 | "redux-persist": "^6.0.0", 62 | "uuid": "^8.3.2" 63 | }, 64 | "devDependencies": { 65 | "@babel/core": "^7.12.9", 66 | "@react-native-community/eslint-config": "^3.0.0", 67 | "@testing-library/react-native": "^7.2.0", 68 | "@types/jest": "^26.0.24", 69 | "@types/react": "~17.0.21", 70 | "@types/react-native": "~0.64.12", 71 | "@types/react-native-calendars": "^1.1264.2", 72 | "@types/uuid": "^8.3.1", 73 | "cypress": "^8.7.0", 74 | "cz-conventional-changelog": "3.3.0", 75 | "eslint": "^7.32.0", 76 | "eslint-plugin-cypress": "^2.12.1", 77 | "eslint-plugin-prettier": "^3.4.0", 78 | "eslint-plugin-react": "^7.24.0", 79 | "eslint-plugin-react-native": "^3.11.0", 80 | "expo-cli": "^4.12.1", 81 | "husky": "^7.0.2", 82 | "jest-expo": "^44.0.0", 83 | "lint-staged": "^11.2.0", 84 | "typescript": "~4.3.5" 85 | }, 86 | "lint-staged": { 87 | "*.{js,jsx,ts,tsx}": [ 88 | "eslint --cache --fix", 89 | "prettier --write" 90 | ], 91 | "**/*.ts?(x)": [ 92 | "bash -c tsc -p tsconfig.json --noEmit" 93 | ] 94 | }, 95 | "private": true, 96 | "config": { 97 | "commitizen": { 98 | "path": "./node_modules/cz-conventional-changelog" 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /screens/Stats/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { StyleSheet, ScrollView, View } from 'react-native' 3 | import { Card, Title, Paragraph } from 'react-native-paper' 4 | import { AntDesign as Icon } from '@expo/vector-icons' 5 | 6 | import useColorScheme from '../../hooks/useColorScheme' 7 | import Calendar from './Calendar' 8 | import Screen from '../../components/Screen' 9 | import { useAppSelector, useMinutesToStatsTime, useMsToMinutes, useQuote } from '../../hooks' 10 | import { selectStreak, selectTotalDuration, selectTotalSessions } from '../../redux/selectors' 11 | import ManualEntry from './ManualEntry' 12 | import { useThemeColor } from '../../components' 13 | 14 | export default function StatsScreen() { 15 | //Component key will redraw calendars color switch issue. 16 | const colorScheme = useColorScheme() 17 | const totalSessions = useAppSelector(selectTotalSessions) 18 | const totalDuration = useAppSelector(selectTotalDuration) 19 | const streak = useAppSelector(selectStreak) 20 | const totalMinutes = useMsToMinutes(totalDuration) 21 | const listenedStat = useMinutesToStatsTime(totalMinutes) 22 | const primary = useThemeColor({}, 'primary') 23 | const [manualEntryTimestamp, setManualEntryTimestamp] = React.useState() 24 | const { quote, author } = useQuote() 25 | 26 | return ( 27 | <> 28 | 29 | 30 | 31 | 32 | 33 | Current Streak 34 | 35 | {streak} day{streak === 1 ? '' : 's'} 36 | 37 | 38 | 39 | 40 | 41 | 42 | Total Sessions 43 | 44 | {totalSessions} session{totalSessions === 1 ? '' : 's'} 45 | 46 | 47 | 48 | 49 | 50 | 51 | Time Meditating 52 | {listenedStat} 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {author} 61 | {quote} 62 | 63 | 64 | 65 | 66 | 67 | setManualEntryTimestamp(undefined)} 70 | /> 71 | 72 | 73 | ) 74 | } 75 | 76 | const styles = StyleSheet.create({ 77 | cards: { 78 | marginBottom: 30, 79 | }, 80 | card: { 81 | width: 150, 82 | marginRight: 10, 83 | textAlign: 'center', 84 | }, 85 | quoteContainer: { marginRight: 10, marginBottom: 30 }, 86 | quoteCard: { 87 | width: '100%', 88 | }, 89 | quoteTitle: { 90 | textAlign: 'center', 91 | }, 92 | cardContent: { 93 | flex: 1, 94 | justifyContent: 'center', 95 | alignItems: 'center', 96 | }, 97 | icon: { 98 | marginBottom: 10, 99 | }, 100 | }) 101 | -------------------------------------------------------------------------------- /data/meditations.ts: -------------------------------------------------------------------------------- 1 | import { ImageSourcePropType } from 'react-native' 2 | 3 | export interface Meditation { 4 | /* Unique id of the meditation */ 5 | id: string 6 | /* Title of the meditation */ 7 | title: string 8 | /* Description of the meditation */ 9 | subtitle: string 10 | /* How long is the meditation in minutes */ 11 | time: number 12 | /* The order of the meditation in the list */ 13 | order: number 14 | /* URL of the image to show */ 15 | image: ImageSourcePropType 16 | /* URI of the audio file */ 17 | uri: string 18 | /* Track ID from the back-end */ 19 | track: number 20 | } 21 | export interface MeditationItem { 22 | item: Meditation 23 | } 24 | 25 | export const popular: Meditation[] = [ 26 | { 27 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e02c', 28 | order: 1, 29 | title: 'Power of Love', 30 | track: 0, 31 | subtitle: 'Love and Peace', 32 | time: 2, 33 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/17.mp3', 34 | image: require('../assets/images/meditate6.jpg'), 35 | }, 36 | { 37 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e02d', 38 | order: 2, 39 | title: 'Quick Powerful Meditation', 40 | track: 1, 41 | subtitle: 'Busy At Work', 42 | time: 5, 43 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/1.mp3', 44 | image: require('../assets/images/meditate1.jpg'), 45 | }, 46 | { 47 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e02e', 48 | order: 3, 49 | title: 'Deep Breathing', 50 | track: 2, 51 | subtitle: 'Just Breath', 52 | time: 5, 53 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/2.mp3', 54 | image: require('../assets/images/meditate2.jpg'), 55 | }, 56 | { 57 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e02f', 58 | order: 4, 59 | title: 'Yawn and Stretch', 60 | subtitle: 'Rise and Shine', 61 | track: 3, 62 | time: 5, 63 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/3.mp3', 64 | image: require('../assets/images/meditate5.jpg'), 65 | }, 66 | ] 67 | 68 | export const anxiety: Meditation[] = [ 69 | { 70 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e030', 71 | order: 1, 72 | title: 'Deep and Quick Relaxation', 73 | track: 4, 74 | subtitle: 'Release Anxiety', 75 | time: 10, 76 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/4.mp3', 77 | image: require('../assets/images/meditate3.jpg'), 78 | }, 79 | { 80 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e031', 81 | order: 2, 82 | title: 'Calming Medition', 83 | subtitle: 'Deep Relaxation', 84 | track: 7, 85 | time: 11, 86 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/7.mp3', 87 | image: require('../assets/images/meditate4.jpg'), 88 | }, 89 | { 90 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e032', 91 | order: 2, 92 | title: 'Candle Relaxation', 93 | subtitle: 'Get Some Rest', 94 | track: 8, 95 | time: 11, 96 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/8.mp3', 97 | image: require('../assets/images/rocks.jpg'), 98 | }, 99 | ] 100 | 101 | export const sleep: Meditation[] = [ 102 | { 103 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e033', 104 | order: 1, 105 | title: 'Deep Sleep', 106 | subtitle: 'Wake Up Refreshed', 107 | track: 5, 108 | time: 8, 109 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/5.mp3', 110 | image: require('../assets/images/tea.jpg'), 111 | }, 112 | { 113 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e034', 114 | order: 2, 115 | title: 'Short Sleep', 116 | subtitle: 'For Taking a Nap', 117 | track: 6, 118 | time: 28, 119 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/6.mp3', 120 | image: require('../assets/images/sleep.jpg'), 121 | }, 122 | { 123 | id: 'ff171f80-5960-41e7-965c-1f9bcf31e035', 124 | order: 2, 125 | title: 'Good Sleep', 126 | track: 12, 127 | subtitle: 'Drift Off To Sleep', 128 | time: 15, 129 | uri: 'https://goofy-ritchie-dd0c3d.netlify.app/meditations/12.mp3', 130 | image: require('../assets/images/sleep2.jpg'), 131 | }, 132 | ] 133 | 134 | export const meditations = { 135 | popular, 136 | sleep, 137 | anxiety, 138 | } 139 | -------------------------------------------------------------------------------- /screens/Stats/ManualEntry/__tests__/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { act, render } from '@testing-library/react-native' 3 | import ManualEntry from '..' 4 | import { useAppSelector as realUseAppSelector } from '../../../../hooks' 5 | import { MS_PER_MINUTE } from '../../../../constants/Units' 6 | 7 | const DialogMock = 'Dialog' as unknown as React.FC<{ testID: string }> 8 | const Dialog = (props: React.PropsWithChildren<{}>) => 9 | Dialog.Title = 'Dialog.Title' 10 | Dialog.Content = 'Dialog.Content' 11 | Dialog.Actions = 'Dialog.Actions' 12 | 13 | jest.mock('react-native-paper', () => ({ 14 | Button: 'Button', 15 | Paragraph: 'Paragraph', 16 | Dialog, 17 | Portal: 'Portal', 18 | Provider: 'Provider', 19 | TextInput: 'TextInput', 20 | })) 21 | jest.mock('../../../../hooks') 22 | 23 | const mockedHooks = jest.requireMock('../../../../hooks') 24 | const useAppSelector = mockedHooks.useAppSelector as jest.MockedFunction 25 | const useAppDispatch = mockedHooks.useAppDispatch as jest.MockedFunction< 26 | () => jest.MockedFunction<() => void> 27 | > 28 | 29 | describe('tests for ManualEntry component', () => { 30 | it('should render invisible without default value and disabled submit button', () => { 31 | useAppSelector.mockReturnValue({}) 32 | const { getByTestId } = render( {}} />) 33 | 34 | const dialog = getByTestId('dialog') 35 | expect(dialog.props.visible).toBe(false) 36 | 37 | const input = getByTestId('input') 38 | expect(input.props.defaultValue).toBe('') 39 | 40 | const submitBtn = getByTestId('submit-btn') 41 | expect(submitBtn.props.disabled).toBe(true) 42 | }) 43 | 44 | it('should render visible with default value and enabled submit button', () => { 45 | useAppSelector.mockReturnValue({ 46 | '1': { duration: 30 * MS_PER_MINUTE }, 47 | }) 48 | const { getByTestId } = render( {}} />) 49 | 50 | const dialog = getByTestId('dialog') 51 | expect(dialog.props.visible).toBe(true) 52 | 53 | const input = getByTestId('input') 54 | expect(input.props.defaultValue).toBe('30') 55 | 56 | const submitBtn = getByTestId('submit-btn') 57 | expect(submitBtn.props.disabled).toBe(false) 58 | }) 59 | 60 | it('should set submit button disabled prop on updates', () => { 61 | useAppSelector.mockReturnValue({}) 62 | const { getByTestId } = render( {}} />) 63 | 64 | const submitBtn = getByTestId('submit-btn') 65 | expect(submitBtn.props.disabled).toBe(true) 66 | 67 | act(() => { 68 | const input = getByTestId('input') 69 | input.props.onChangeText('10') 70 | }) 71 | 72 | expect(submitBtn.props.disabled).toBe(false) 73 | 74 | act(() => { 75 | const input = getByTestId('input') 76 | input.props.onChangeText('NaN') 77 | }) 78 | expect(submitBtn.props.disabled).toBe(true) 79 | }) 80 | 81 | it('should dispatch manual entry action on submit and dismiss', () => { 82 | const onDismiss = jest.fn() 83 | const dispatch = jest.fn() 84 | useAppSelector.mockReturnValue({}) 85 | useAppDispatch.mockReturnValue(dispatch) 86 | const { getByTestId } = render() 87 | 88 | act(() => { 89 | const submitBtn = getByTestId('submit-btn') 90 | submitBtn.props.onPress() 91 | }) 92 | expect(dispatch).toBeCalledTimes(0) 93 | expect(onDismiss).toBeCalledTimes(0) 94 | 95 | act(() => { 96 | const input = getByTestId('input') 97 | input.props.onChangeText('10') 98 | }) 99 | act(() => { 100 | const submitBtn = getByTestId('submit-btn') 101 | submitBtn.props.onPress() 102 | }) 103 | expect(dispatch).toBeCalledTimes(1) 104 | expect(onDismiss).toBeCalledTimes(1) 105 | }) 106 | 107 | it('should dismiss on cancel', () => { 108 | const onDismiss = jest.fn() 109 | useAppSelector.mockReturnValue({}) 110 | const { getByTestId } = render() 111 | 112 | act(() => { 113 | const cancelBtn = getByTestId('cancel-btn') 114 | cancelBtn.props.onPress() 115 | }) 116 | expect(onDismiss).toBeCalledTimes(1) 117 | }) 118 | }) 119 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | logo 3 |

4 |

5 | Hey Linda 6 |

7 |

8 | The open source and free meditation app alternative for everyone.
Built with React Native and Expo. 9 |

10 | 11 |

12 | Need help building your meditation app? Connect with Adrian on X 🚀 13 | 14 |

15 | 16 |

17 | banner 18 |

19 | 20 | ## Features 21 | 22 | - meditate 23 | - track progress 24 | - dark mode 25 | - current streak 26 | - calendar activity 27 | - time listened 28 | - offline support 29 | - manually enter meditation 30 | 31 | ## Install 32 | 33 | - [Web](https://webheylinda.netlify.app/) 34 | - [Android (beta)](https://play.google.com/store/apps/details?id=com.meditation.heylinda) 35 | - Coming soon for iOS 36 | 37 | ## Install (dev) 38 | 39 | To install the project, navigate to the directory and run: 40 | 41 | - `yarn global add expo-cli` 42 | - `yarn install` 43 | 44 | ## Run 45 | 46 | To run the project, run the following commands: 47 | 48 | - `yarn android` 49 | - `yarn ios` 50 | 51 | ## Contribute 52 | 53 | You can contribute to Hey Linda by beta testing, recording meditations, or submitting code. 54 | 55 | See the [contribution guide](CONTRIBUTING.md) for more info. 56 | 57 | ## Join Us On 58 | 59 | 60 | 61 | 63 | 64 | 65 | ## Credits 66 | 67 | ### Github Contributors 68 | 69 | Thanks to these awesome contributors and many more! 🧘 70 | 71 | [![](https://github.com/trentmercer.png?size=50)](https://github.com/trentmercer) 72 | [![](https://github.com/watadarkstar.png?size=50)](https://github.com/watadarkstar) 73 | [![](https://github.com/AliNisarAhmed.png?size=50)](https://github.com/AliNisarAhmed) 74 | [![](https://github.com/lsmacedo.png?size=50)](https://github.com/lsmacedo) 75 | [![](https://github.com/alexandrvicente.png?size=50)](https://github.com/alexandrvicente) 76 | [![](https://github.com/pedpess.png?size=50)](https://github.com/pedpess) 77 | [![](https://github.com/orama254.png?size=50)](https://github.com/orama254) 78 | [![](https://github.com/Kevan-Y.png?size=50)](https://github.com/Kevan-Y) 79 | 80 | ### Sponsors 81 | 82 | Thank you to all our sponsors! 🥇 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Deploys by Netlify 91 | 92 | 93 | ### Backers 94 | 95 | Thank you to all our backers! 🙏 96 | 97 | 98 | 99 | ## License 100 | 101 | - [GGNU Affero General Public License v3.0](https://github.com/heylinda/heylinda-app/blob/main/LICENSE) 102 | - [Meditation 103 | Contributors](https://github.com/heylinda/heylinda-app/blob/main/MEDITATIONS) 104 | 105 | --- 106 | 107 |
108 | 109 | **Ready to build a meditation app at scale?** 110 | 111 | ⭐ **Star this repo** • 💬 **[Contact Adrian to Build It](https://x.com/icookandcode)** 112 | 113 | _Built with ❤️ by [Adrian](https://x.com/icookandcode)_ 114 | 115 |
116 | 117 | --- 118 | 119 | **Keywords:** react-native, react, meditation, typescript, heylinda-app 120 | -------------------------------------------------------------------------------- /navigation/BottomTabNavigator.tsx: -------------------------------------------------------------------------------- 1 | import { AntDesign as Icon } from '@expo/vector-icons' 2 | import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' 3 | import { createStackNavigator } from '@react-navigation/stack' 4 | import * as React from 'react' 5 | import { StyleSheet } from 'react-native' 6 | 7 | import Colors from '../constants/Colors' 8 | import useColorScheme from '../hooks/useColorScheme' 9 | import HomeScreen from '../screens/Home' 10 | import PlayScreen from '../screens/Play' 11 | import SettingsScreen from '../screens/Settings' 12 | import StatsScreen from '../screens/Stats' 13 | import AboutPage from '../screens/Settings/About' 14 | import { BottomTabParamList, HomeParamList, SettingsParamList, StatsParamList } from '../types' 15 | 16 | const BottomTab = createBottomTabNavigator() 17 | 18 | export default function BottomTabNavigator() { 19 | const colorScheme = useColorScheme() 20 | 21 | return ( 22 | 26 | , 31 | }} 32 | /> 33 | , 38 | }} 39 | /> 40 | , 45 | }} 46 | /> 47 | 48 | ) 49 | } 50 | 51 | // You can explore the built-in icon families and icons on the web at: 52 | // https://icons.expo.fyi/ 53 | function TabBarIcon(props: { name: React.ComponentProps['name']; color: string }) { 54 | return 55 | } 56 | 57 | // Each tab has its own navigation stack, you can read more about this pattern here: 58 | // https://reactnavigation.org/docs/tab-based-navigation#a-stack-navigator-for-each-tab 59 | const HomeStack = createStackNavigator() 60 | 61 | function TabOneNavigator() { 62 | return ( 63 | 64 | 71 | 78 | 86 | 87 | 88 | ) 89 | } 90 | 91 | const StatsStack = createStackNavigator() 92 | 93 | function StatsNavigator() { 94 | return ( 95 | 96 | 105 | 106 | ) 107 | } 108 | 109 | const SettingsStack = createStackNavigator() 110 | 111 | function SettingsNavigator() { 112 | return ( 113 | 114 | 123 | 135 | 136 | ) 137 | } 138 | 139 | const styles = StyleSheet.create({ 140 | headerTitle: { 141 | fontWeight: '600', 142 | color: Colors.light.white, 143 | fontSize: 16, 144 | }, 145 | header: { 146 | backgroundColor: Colors.light.primary, 147 | }, 148 | tabBarIcon: { 149 | marginBottom: -3, 150 | }, 151 | }) 152 | -------------------------------------------------------------------------------- /screens/Home/index.tsx: -------------------------------------------------------------------------------- 1 | import { StackNavigationProp } from '@react-navigation/stack' 2 | import * as React from 'react' 3 | import { StyleSheet, FlatList } from 'react-native' 4 | import { Card, Paragraph } from 'react-native-paper' 5 | import Screen from '../../components/Screen' 6 | 7 | import DownloadButton from '../../components/DownloadButton' 8 | 9 | import { Text, useThemeColor } from '../../components/Themed' 10 | import Colors from '../../constants/Colors' 11 | import { meditations, MeditationItem } from '../../data/meditations' 12 | import { HomeParamList } from '../../types' 13 | import { useAppSelector } from '../../hooks' 14 | import { selectFavourites } from '../../redux/selectors' 15 | 16 | interface Props { 17 | navigation: StackNavigationProp 18 | } 19 | 20 | export default function Home({ navigation }: Props) { 21 | const textColor = useThemeColor({}, 'text') 22 | 23 | const favourites = useAppSelector(selectFavourites) 24 | 25 | const renderPopularCard = ({ item }: MeditationItem) => { 26 | return ( 27 | 31 | navigation.navigate('PlayScreen', { 32 | id: item.id, 33 | }) 34 | } 35 | > 36 | 37 | 43 | 44 | {item.time} minutes 45 | 46 | 47 | 48 | ) 49 | } 50 | 51 | const renderCard = ({ item }: MeditationItem) => { 52 | return ( 53 | 56 | navigation.navigate('PlayScreen', { 57 | id: item.id, 58 | }) 59 | } 60 | > 61 | 62 | 68 | 69 | {item.time} minutes 70 | 71 | 72 | 73 | ) 74 | } 75 | 76 | return ( 77 | 78 | POPULAR 79 | id} 86 | /> 87 | ANXIETY 88 | id} 95 | /> 96 | SLEEP 97 | id} 104 | /> 105 | {favourites.length > 0 && ( 106 | <> 107 | FAVOURITE 108 | id} 115 | /> 116 | 117 | )} 118 | 119 | ) 120 | } 121 | 122 | const styles = StyleSheet.create({ 123 | card: { 124 | width: 250, 125 | marginRight: 10, 126 | }, 127 | cardTitle: { 128 | fontSize: 16, 129 | }, 130 | cardImage: { 131 | height: 135, 132 | }, 133 | popularImage: { 134 | height: 250, 135 | }, 136 | cardContent: { 137 | flex: 1, 138 | flexDirection: 'row', 139 | justifyContent: 'space-between', 140 | alignItems: 'flex-start', 141 | }, 142 | cardSubtitle: { 143 | color: Colors.light.gray800, 144 | fontSize: 14, 145 | }, 146 | cardParagraph: { 147 | color: Colors.light.purple900, 148 | fontWeight: '600', 149 | }, 150 | downloadButton: { 151 | position: 'relative', 152 | top: -6, 153 | }, 154 | cards: { 155 | marginBottom: 30, 156 | }, 157 | title: { 158 | fontSize: 16, 159 | fontWeight: 'bold', 160 | marginBottom: 19, 161 | }, 162 | }) 163 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Hey Linda App Code of Conduct 2 | 3 | ### Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | 8 | 9 | 10 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 11 | 12 | 13 | 14 | 15 | ### Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our community include: 18 | 19 | 20 | 21 | 22 | Demonstrating empathy and kindness toward other people 23 | 24 | Being respectful of differing opinions, viewpoints, and experiences 25 | 26 | Giving and gracefully accepting constructive feedback 27 | 28 | Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 29 | 30 | Focusing on what is best not just for us as individuals, but for the overall community 31 | 32 | Examples of unacceptable behavior include: 33 | 34 | 35 | 36 | 37 | The use of sexualized language or imagery, and sexual attention or advances of any kind 38 | 39 | Trolling, insulting or derogatory comments, and personal or political attacks 40 | 41 | Public or private harassment 42 | 43 | Publishing others' private information, such as a physical or email address, without their explicit permission 44 | 45 | Other conduct which could reasonably be considered inappropriate in a professional setting 46 | 47 | ### Enforcement Responsibilities 48 | 49 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 50 | 51 | 52 | 53 | 54 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 55 | 56 | 57 | 58 | 59 | ### Scope 60 | 61 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 62 | 63 | 64 | 65 | 66 | ### Enforcement 67 | 68 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [@icookandcode](https://twitter.com/icookandcode). All complaints will be reviewed and investigated promptly and fairly. 69 | 70 | 71 | 72 | 73 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 74 | 75 | 76 | 77 | 78 | ### Enforcement Guidelines 79 | 80 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 81 | 82 | 83 | 84 | 85 | 1. Correction 86 | 87 | Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 88 | 89 | 90 | 91 | 92 | Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 93 | 94 | 95 | 96 | 97 | 2. Warning 98 | 99 | Community Impact: A violation through a single incident or series of actions. 100 | 101 | 102 | 103 | 104 | Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 105 | 106 | 107 | 108 | 109 | 3. Temporary Ban 110 | 111 | Community Impact: A serious violation of community standards, including sustained inappropriate behavior. 112 | 113 | 114 | 115 | 116 | Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 117 | 118 | 119 | 120 | 121 | 4. Permanent Ban 122 | 123 | Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 124 | 125 | 126 | 127 | 128 | Consequence: A permanent ban from any sort of public interaction within the community. 129 | 130 | 131 | 132 | 133 | ### Attribution 134 | 135 | This Code of Conduct is adapted from the Contributor Covenant, version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 136 | 137 | 138 | 139 | 140 | Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder. 141 | 142 | 143 | 144 | 145 | For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 146 | -------------------------------------------------------------------------------- /screens/Play/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { Image, StyleSheet } from 'react-native' 3 | import { Audio, AVPlaybackStatus } from 'expo-av' 4 | 5 | import PlayerControls from './PlayerControls' 6 | import Screen from '../../components/Screen' 7 | import { Text } from '../../components/Themed' 8 | import { useAppSelector, useMeditation } from '../../hooks' 9 | import NotFoundScreen from '../NotFoundScreen' 10 | import { HomeParamList, MainStackParamList } from '../../types' 11 | import { CompositeNavigationProp, RouteProp } from '@react-navigation/native' 12 | import { useMsToTime, useAppDispatch } from '../../hooks' 13 | import { completed, updateFavourite } from '../../redux/meditationSlice' 14 | import { LoadingScreen } from '../../components' 15 | import { useCallback } from 'react' 16 | import { StackNavigationProp } from '@react-navigation/stack' 17 | import { selectFavourites, selectFilePaths } from '../../redux/selectors' 18 | import FavouriteButton from '../../components/FavouriteButton' 19 | import { Meditation } from '../../data/meditations' 20 | 21 | type PlayRouteProp = RouteProp 22 | 23 | type PlayNavProp = CompositeNavigationProp< 24 | StackNavigationProp, 25 | StackNavigationProp 26 | > 27 | interface Props { 28 | navigation: PlayNavProp 29 | route: PlayRouteProp 30 | } 31 | export default function PlayScreen({ route, navigation }: Props) { 32 | const { id } = route.params 33 | const meditation = useMeditation(id) 34 | const favourites = useAppSelector(selectFavourites) 35 | const [isLoadingAudio, setIsLoadingAudio] = React.useState(true) 36 | const [isPlaying, setIsPlaying] = React.useState(false) 37 | const [sound, setSound] = React.useState() 38 | const [positionMillis, setPositionMillis] = React.useState(0) 39 | const [durationMills, setDurationMills] = React.useState(0) 40 | const durationTime = useMsToTime(durationMills) 41 | const positionTime = useMsToTime(positionMillis) 42 | const dispatch = useAppDispatch() 43 | const uri = meditation?.uri || '' 44 | const filepaths = useAppSelector(selectFilePaths) 45 | 46 | const isFavourited = favourites.some((item: Meditation) => item.id === meditation?.id) 47 | 48 | const onFavourite = () => { 49 | dispatch(updateFavourite(meditation)) 50 | } 51 | 52 | const onPlaybackStatusUpdate = useCallback( 53 | (playbackStatus: AVPlaybackStatus) => { 54 | if (!playbackStatus.isLoaded) { 55 | // Update your UI for the unloaded state 56 | } else { 57 | // Update your UI for the loaded state 58 | if (playbackStatus.positionMillis) { 59 | setPositionMillis(playbackStatus.positionMillis) 60 | } 61 | if (playbackStatus.durationMillis) { 62 | setDurationMills(playbackStatus.durationMillis) 63 | } 64 | if (playbackStatus.didJustFinish) { 65 | dispatch(completed(playbackStatus.durationMillis || 0)) 66 | setIsPlaying(false) 67 | navigation.replace('CompletedScreen') 68 | } 69 | } 70 | }, 71 | [dispatch, navigation] 72 | ) 73 | 74 | React.useEffect(() => { 75 | return sound 76 | ? () => { 77 | sound.unloadAsync() 78 | } 79 | : undefined 80 | }, [sound]) 81 | 82 | React.useEffect(() => { 83 | const loadAudio = async () => { 84 | let filename = uri.split('/').pop() ?? '' 85 | let filepath = filepaths.find((file) => { 86 | if (file.split('/').pop() === filename) { 87 | return file 88 | } 89 | }) 90 | 91 | setIsLoadingAudio(true) 92 | 93 | await Audio.setAudioModeAsync({ 94 | playsInSilentModeIOS: true, 95 | staysActiveInBackground: true, 96 | }) 97 | 98 | if (filepath) { 99 | // Load from downloaded audio file 100 | const _sound = new Audio.Sound() 101 | _sound.setOnPlaybackStatusUpdate(onPlaybackStatusUpdate) 102 | await _sound.loadAsync({ uri: filepath }) 103 | setSound(_sound) 104 | } else { 105 | // Load from remote URI 106 | const { sound: _sound } = await Audio.Sound.createAsync({ uri }, {}, onPlaybackStatusUpdate) 107 | setSound(_sound) 108 | } 109 | 110 | setIsLoadingAudio(false) 111 | } 112 | 113 | loadAudio() 114 | }, [onPlaybackStatusUpdate, uri, filepaths]) 115 | 116 | const replay = async () => { 117 | await sound?.setPositionAsync(positionMillis - 10 * 1000) 118 | } 119 | 120 | const forward = async () => { 121 | await sound?.setPositionAsync(positionMillis + 10 * 1000) 122 | } 123 | 124 | const play = async () => { 125 | if (sound) { 126 | await sound.playAsync() 127 | setIsPlaying(true) 128 | } 129 | } 130 | 131 | const pause = async () => { 132 | if (sound) { 133 | await sound.pauseAsync() 134 | setIsPlaying(false) 135 | } 136 | } 137 | 138 | if (!meditation) { 139 | return 140 | } 141 | 142 | const { title, subtitle, image } = meditation 143 | 144 | if (isLoadingAudio) { 145 | return 146 | } 147 | 148 | return ( 149 | 150 | 151 | 152 | {title} 153 | {subtitle} 154 | 163 | 164 | ) 165 | } 166 | 167 | const styles = StyleSheet.create({ 168 | container: { 169 | flex: 1, 170 | justifyContent: 'center', 171 | paddingLeft: 31, 172 | paddingRight: 31, 173 | }, 174 | title: { 175 | fontSize: 18, 176 | textAlign: 'center', 177 | fontWeight: 'bold', 178 | marginBottom: 8, 179 | }, 180 | subtitle: { 181 | textAlign: 'center', 182 | fontSize: 16, 183 | marginBottom: 30, 184 | }, 185 | image: { 186 | width: '100%', 187 | height: '100%', 188 | maxWidth: 300, 189 | maxHeight: 300, 190 | marginBottom: 30, 191 | borderRadius: 10, 192 | alignSelf: 'center', 193 | }, 194 | favourite: { 195 | position: 'absolute', 196 | top: 10, 197 | right: 10, 198 | }, 199 | }) 200 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . --------------------------------------------------------------------------------