diff --git a/app/App.js b/app/App.js index f2fa58a..53dba63 100644 --- a/app/App.js +++ b/app/App.js @@ -30,8 +30,6 @@ import Ionicons from 'react-native-vector-icons/Ionicons'; import I18n from './i18n'; import AsyncStorage from '@react-native-community/async-storage' - - const Tab = createBottomTabNavigator(); AsyncStorage.getItem('language') @@ -40,6 +38,15 @@ AsyncStorage.getItem('language') I18n.locale = token; }); +AsyncStorage.getItem('announcementNotifs') + .then((token) => { + console.log("announcementNotifs: " + token); + }); +AsyncStorage.getItem('eventNotifs') + .then((token) => { + console.log("eventNotifs: " + token); + }); + class App extends React.Component { state = { loaded: false diff --git a/app/Images.js b/app/Images.js index ec26ac4..666fc48 100644 --- a/app/Images.js +++ b/app/Images.js @@ -29,6 +29,8 @@ const Images = { announcements:require('./assets/announcements.png'), resources:require('./assets/resources.png'), polls:require('./assets/polls.png'), + notifs:require('./assets/notifs.png'), + lang:require('./assets/lang.png'), } export default Images; \ No newline at end of file diff --git a/app/Languages/en.js b/app/Languages/en.js index d279ac9..590675b 100644 --- a/app/Languages/en.js +++ b/app/Languages/en.js @@ -47,12 +47,17 @@ export default { }, settings: { settings: "Settings", - language: "Language" + language: "Language", + notifications: "Notifications", }, language: { SelectLanguage: "Select Language", English: "English", Spanish: "Spanish", note: "*App will reload on language change" + }, + notifications: { + announcements: "Announcements", + events: "Calendar Events" } } \ No newline at end of file diff --git a/app/Languages/es.js b/app/Languages/es.js index 1c3d2bc..05a6805 100644 --- a/app/Languages/es.js +++ b/app/Languages/es.js @@ -47,12 +47,17 @@ export default { }, settings: { settings: "Configuraciones", - language: "Idioma" + language: "Idioma", + notifications: "ESNotifications" }, language: { SelectLanguage: "Seleccione el idioma", English: "Inglés", Spanish: "Español", note: "*La aplicación se recargará al cambiar de idioma" + }, + notifications: { + announcements: "ESAnnouncements", + events: "ESCalendar Events" } } \ No newline at end of file diff --git a/app/Notifications.js b/app/Notifications.js new file mode 100644 index 0000000..69c0754 --- /dev/null +++ b/app/Notifications.js @@ -0,0 +1,122 @@ +import React, { Component, useState } from 'react'; +import { + Platform, + StyleSheet, + TouchableOpacity, + Text, + ScrollView, + View, + Switch +} from 'react-native'; +import I18n from './i18n'; +import AsyncStorage from '@react-native-community/async-storage' + +const STORAGE_KEY_ANNOUNCEMENT = "announcementNotifs" +const STORAGE_KEY_EVENT = "eventNotifs" + +function parseBoolean (val) { + + if (val == "true") { + return true; + } + else if (val == "false") { + return false; + } +} + +function AnnouncementNotifs() { + + const [ isEnabled, setIsEnabled ] = React.useState() + + React.useEffect(() => { + const checkAsync = async () => { + const value = await AsyncStorage.getItem('announcementNotifs') + if (value !== undefined || value !== null){ + + setIsEnabled(parseBoolean(value)) + } else { + setIsEnabled(false) + AsyncStorage.setItem('announcementNotifs', JSON.stringify('false')) + } + } + checkAsync() + }, []) + + const toggleSwitch = () => { + AsyncStorage.getItem('announcementNotifs') + .then((token) => { + const temp = parseBoolean(token) + AsyncStorage.setItem('announcementNotifs', JSON.stringify(!temp)) + setIsEnabled(!isEnabled) + }) + } + return ( + + {I18n.t('notifications.announcements')} + + + ) +} + +function EventNotifs() { + const [ isEnabled, setIsEnabled ] = React.useState() + + React.useEffect(() => { + const checkAsync = async () => { + const value = await AsyncStorage.getItem('eventNotifs') + if (value !== undefined || value !== null){ + + setIsEnabled(parseBoolean(value)) + } else { + setIsEnabled(false) + AsyncStorage.setItem('eventNotifs', JSON.stringify('false')) + } + } + checkAsync() + }, []) + + const toggleSwitch = () => { + AsyncStorage.getItem('eventNotifs') + .then((token) => { + const temp = parseBoolean(token) + AsyncStorage.setItem('eventNotifs', JSON.stringify(!temp)) + setIsEnabled(!isEnabled) + }) + } + + return ( + + {I18n.t('notifications.events')} + + + ) +} + +class Notifications extends Component { + + + render() { + + return ( + + + + + + ); + } +} + +export default Notifications \ No newline at end of file diff --git a/app/Settings.js b/app/Settings.js index bd3b247..489a294 100644 --- a/app/Settings.js +++ b/app/Settings.js @@ -23,11 +23,12 @@ import { import styles from './styles/morestyles' import LinearGradient from 'react-native-linear-gradient' - +import Images from './Images' import { NavigationContainer } from '@react-navigation/native' import { createStackNavigator } from '@react-navigation/stack' import I18n from './i18n'; import Language from './Language' +import Notifications from './Notifications' const Stack = createStackNavigator() @@ -42,10 +43,12 @@ class SettingSwitch extends React.Component { this.props.navigation.navigate(item.key)}> + {I18n.t('settings.' + item.key)} } @@ -69,7 +72,7 @@ class Settings extends React.Component { name="Chooser" component={SettingSwitch} options={{ - title:'Settingss', + title:'Settings', headerTitleStyle:styles.headerTitle, headerBackground: ()=>background }} @@ -84,6 +87,16 @@ class Settings extends React.Component { headerBackground: ()=>background }} /> + background + }} + /> ) diff --git a/app/assets/lang.png b/app/assets/lang.png new file mode 100644 index 0000000..d9313a2 Binary files /dev/null and b/app/assets/lang.png differ diff --git a/app/assets/notifs.png b/app/assets/notifs.png new file mode 100644 index 0000000..275de4e Binary files /dev/null and b/app/assets/notifs.png differ diff --git a/yarn.lock b/yarn.lock index 507c651..85159a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -711,6 +711,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.12.0", "@babel/runtime@^7.3.1": + version "7.12.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" + integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.0.0", "@babel/template@^7.10.4", "@babel/template@^7.3.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" @@ -1025,10 +1032,9 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" -"@k3rn31p4nic/google-translate-api@^1.1.1": +"@k3rn31p4nic/google-translate-api@github:k3rn31p4nic/google-translate-api": version "1.1.1" - resolved "https://registry.yarnpkg.com/@k3rn31p4nic/google-translate-api/-/google-translate-api-1.1.1.tgz#3869854f7540bbb82afc1b61890281f5513e1717" - integrity sha512-vg3zLYXhUmdwrNxmoKOfYSJzB8lHKDnqR7L/SYQQKCYkxsj2syK/cJMAcK5fQC0hfwgexxUaWhR2p2gGEe3nVw== + resolved "https://codeload.github.com/k3rn31p4nic/google-translate-api/tar.gz/b15b464fb0a8fa4d58bc90d3d251250a8a71e907" dependencies: got "^11.1.1" @@ -1787,6 +1793,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.10.1.tgz#e1e82e4f3e999e2cfd61b161280d16a111f86428" integrity sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA== +axios@^0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.20.0.tgz#057ba30f04884694993a8cd07fa394cff11c50bd" + integrity sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA== + dependencies: + follow-redirects "^1.10.0" + babel-eslint@10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" @@ -3007,6 +3020,11 @@ eventemitter3@^3.0.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== +events@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379" + integrity sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg== + exec-sh@^0.3.2: version "0.3.4" resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" @@ -3306,6 +3324,11 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +follow-redirects@^1.10.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7" + integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg== + for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -3628,6 +3651,13 @@ html-escaper@^2.0.0: resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== +html-parse-stringify2@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/html-parse-stringify2/-/html-parse-stringify2-2.0.1.tgz#dc5670b7292ca158b7bc916c9a6735ac8872834a" + integrity sha1-3FZwtyksoVi3vJFsmmc1rIhyg0o= + dependencies: + void-elements "^2.0.1" + http-cache-semantics@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" @@ -3666,6 +3696,23 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +i18n-js@3.0.11: + version "3.0.11" + resolved "https://registry.yarnpkg.com/i18n-js/-/i18n-js-3.0.11.tgz#f9e96bdb641c5b9d6be12759d7c422089987ef02" + integrity sha512-v7dG3kYJTQTyox3NqDabPDE/ZotWntyMI9kh4cYi+XlCSnsIR+KBTS2opPyObL8WndnklcLzbNU92FP/mLge3Q== + +i18next-react-native-language-detector@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/i18next-react-native-language-detector/-/i18next-react-native-language-detector-1.0.2.tgz#5c47482611a44262302a363d5be34a42b11ddfc6" + integrity sha1-XEdIJhGkQmIwKjY9W+NKQrEd38Y= + +i18next@^19.8.4: + version "19.8.4" + resolved "https://registry.yarnpkg.com/i18next/-/i18next-19.8.4.tgz#447718f2a26319b8debdbcc6fbc1a9761be7316b" + integrity sha512-FfVPNWv+felJObeZ6DSXZkj9QM1Ivvh7NcFCgA8XPtJWHz0iXVa9BUy+QY8EPrCLE+vWgDfV/sc96BgXVo6HAA== + dependencies: + "@babel/runtime" "^7.12.0" + iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -5390,6 +5437,11 @@ mkdirp@^0.5.1: dependencies: minimist "^1.2.5" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -6003,6 +6055,13 @@ prop-types@^15.6.2, prop-types@^15.7.2: object-assign "^4.1.1" react-is "^16.8.1" +properties-reader@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/properties-reader/-/properties-reader-2.2.0.tgz#41d837fe143d8d5f2386b6a869a1975c0b2c595c" + integrity sha512-CgVcr8MwGoBKK24r9TwHfZkLLaNFHQ6y4wgT9w/XzdpacOOi5ciH4hcuLechSDAwXsfrGQtI2JTutY2djOx2Ow== + dependencies: + mkdirp "^1.0.4" + pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" @@ -6068,6 +6127,14 @@ react-devtools-core@^4.6.0: shell-quote "^1.6.1" ws "^7" +react-i18next@^11.8.5: + version "11.8.5" + resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.8.5.tgz#a093335822e36252cda6efc0f55facef6253643f" + integrity sha512-2jY/8NkhNv2KWBnZuhHxTn13aMxAbvhiDUNskm+1xVVnrPId78l8fA7fCyVeO3XU1kptM0t4MtvxV1Nu08cjLw== + dependencies: + "@babel/runtime" "^7.3.1" + html-parse-stringify2 "2.0.1" + react-is@^16.12.0, react-is@^16.13.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" @@ -6098,6 +6165,13 @@ react-native-gesture-handler@^1.7.0: invariant "^2.2.4" prop-types "^15.7.2" +react-native-i18n@^2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/react-native-i18n/-/react-native-i18n-2.0.15.tgz#09b5a9836116fa7dbd0054c46e2d1014c1ef3c65" + integrity sha512-V8VwUP0TLda3oJvgt5tdnFaOV7WXPhTjCTLO7sXI3C2SHggSbD4bCUryMzNJhesimJidH21V2Owvj4zAylHoQQ== + dependencies: + i18n-js "3.0.11" + react-native-iphone-x-helper@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.0.tgz#84fd13e6b89cc3aa4daa80ec514bf15cb724d86d" @@ -6108,6 +6182,11 @@ react-native-linear-gradient@^2.5.6: resolved "https://registry.yarnpkg.com/react-native-linear-gradient/-/react-native-linear-gradient-2.5.6.tgz#96215cbc5ec7a01247a20890888aa75b834d44a0" integrity sha512-HDwEaXcQIuXXCV70O+bK1rizFong3wj+5Q/jSyifKFLg0VWF95xh8XQgfzXwtq0NggL9vNjPKXa016KuFu+VFg== +react-native-locale-detector@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/react-native-locale-detector/-/react-native-locale-detector-1.0.1.tgz#c002261ecb60619e5952257c8c7fa31c2c15ed30" + integrity sha1-wAImHstgYZ5ZUiV8jH+jHCwV7TA= + react-native-ratings@^7.2.0: version "7.3.0" resolved "https://registry.yarnpkg.com/react-native-ratings/-/react-native-ratings-7.3.0.tgz#32e11e4ed944ba8adbbc995d601df3f131619b6f" @@ -7251,6 +7330,13 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" +translate-google-api@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/translate-google-api/-/translate-google-api-1.0.4.tgz#562073926d4fa069ea4c105a69c0af9e1536bd92" + integrity sha512-KVXmo4+64/H1vIbnzf2zNiJ2JLeEB3jrEnNRP2EFNAGNqna/5bmw/Cps3pCHu0n3BzTOoWh9u6wFvrRYdzQ6Iw== + dependencies: + axios "^0.20.0" + tslib@^1.8.1, tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -7502,6 +7588,11 @@ vlq@^1.0.0: resolved "https://registry.yarnpkg.com/vlq/-/vlq-1.0.1.tgz#c003f6e7c0b4c1edd623fd6ee50bbc0d6a1de468" integrity sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w== +void-elements@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec" + integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w= + w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"