From b6ee403eb90ae824926678225f62f646e3123be1 Mon Sep 17 00:00:00 2001 From: natjms Date: Sat, 3 Apr 2021 00:44:51 -0300 Subject: [PATCH] Enable tray to indicate when there's new notifications --- assets/eva-icons/person-black-notif.png | Bin 0 -> 10021 bytes assets/eva-icons/person-grey-notif.png | Bin 0 -> 10549 bytes src/components/navigation/tray.js | 32 +++++++++++++++++++--- src/components/pages/authenticate.js | 18 +++++++++---- src/components/pages/profile/settings.js | 14 +++++++++- src/requests.js | 33 +++++++++++++++++++++++ 6 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 assets/eva-icons/person-black-notif.png create mode 100644 assets/eva-icons/person-grey-notif.png create mode 100644 src/requests.js diff --git a/assets/eva-icons/person-black-notif.png b/assets/eva-icons/person-black-notif.png new file mode 100644 index 0000000000000000000000000000000000000000..95af55d49889f416d0da471d76f4757b3f14e1a7 GIT binary patch literal 10021 zcmeHrXIPWlwr=QzD!nKQ2vS2r=q2P4?OVp?SVOosJH{PthjK=;V|_75cBBu=4gl~Ook+8IIIi|W z<%capZCFagTv!`McWn|>U&`?^I#fgR{{D_R0x6sdz+e3;PPowhLyIXUS%THU(DiRQNMKMFcLIc__e+9E7Xey=yT zOjoieKm7U!Wb^3wdo^7x_MQqMYR~NS2xGq)FBXD~wu$Uv@w#=p5 zs}mCwe%9U+9{G=V0*o%b-aKw0xqGj0zO2J+MsI3<*PpWPEkSL}s&jqK#;YdMM5iwa z%~T@en9Lyt#;cthEv-(mF=~sonb$73aj!Yp4VqPz=O=nCZ9DgVZmHhz08PDF^$~il zG~Xn%{+?OVLcesPfBnn)PCwm*KzqdGk$s7|89k{*xOCx~e{^`*QE=WS{r=4I(Tybm zmBvEjuicco=u#tdAlezIzKFt3hu#?)G7qc#!jr9HRb7^nun8N7G8RO*G`!d| zs{$*yaF;R6aN6#HaG^0uH~y`7TgAG+_{05M=eu)h?g%?p*ge)PRdJpyoTCc2)8tMz zbVTJR8`$ZH4H-JQn9NF8I=*>eYUxyaSKM#u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8=rQ!@E2_z7H;l)o)LL z9wMR{>?t!zHdslgfVs%4gtF&B&m$IlzR;qzdoHg~erre9Y!ofM){fHq$^{G=d;9{a zPCVhawYlIh)f{wKlFMfsyC-$8vF==)GNT;;p-;|Q2a;SjdSBXT8$15B>BkY7gb5>A_@Fv3NsexSuaK@L2yki#i#+|@YKBjl>Yy9}?ZFaF48C8H`v~R`BnVA`&f9n*M z#PQP^?$7kBoQHw_@CA<)5)~ZI#wSB|n)=J~a$a3s-Px>#Duu^=OIv9|3+Fz{dfmYp zr!DRja|VO0dmMfDY<#c)B#Put7le(C4WxNZ-|ppw@hf@E_c&(gz0#{$C~rL~D!Su? zZ45wU*%}Pl7MGU?#M~EWjybwmO%x9~9>Pgcyu)c}Y4IiK+6Q;VMxfSTa*goqgODx4IV;{%~gUVB58>hW=_KuC^> z7MZM1Xx5_3nc(64nQ3rrC2Hq^X+<-+4NhT&Q%Ax6q;!NJNG8Sa`T zx+5){M*>uR$o!^OSwp$b-0AWKgTY9Ax)NW`7dxEi;K*-lyZmK!wIDO|ytR!DRRS6KcUyYqxF3(`d3botZ+&+`Aha4*-7Pg8Zvlh?aD{x7 zoC7n$53U@iy`1xD&Qkus&qxVph*!%oGG}}?95*4{SmIP^*;rfq9{yRdi;_iFQL#+l z&=AWMeenzK%7)eQ0LK0%GvEm=9e~);!Pv&exU8odtI)6~hs9zaBqfdEE)6l4*Ybuh zU{aRbGw0R-wWQOPNw2^E0J6Oxz}u*&woWULLBo0C7b=pY1GdL24;KmFkO0U5vdn9T z?!t%JuaEP3P^)){vZ-dG@Lk}?+FEfbcB{ErGv#qmO?zh!{TS`PG=0Fk?)KZvclX~t RXc0V_)YZJIQK9A-_Fn)~ro;dM literal 0 HcmV?d00001 diff --git a/src/components/navigation/tray.js b/src/components/navigation/tray.js index 5d0c921..831862e 100644 --- a/src/components/navigation/tray.js +++ b/src/components/navigation/tray.js @@ -1,5 +1,8 @@ -import React from "react"; +import React, { useState, useEffect } from "react"; import { Image } from "react-native"; + +import { checkUnreadNotifications } from "src/requests"; + import { activeOrNot } from "src/interface/interactions" import { TouchableWithoutFeedback, View } from "react-native"; @@ -18,6 +21,19 @@ const TrayButtonJsx = (props) => { const TrayJsx = (props) => { const nav = props.navigation; + const [state, setState] = useState({ + unreadNotifications: false + }); + + useEffect(() => { + checkUnreadNotifications() + .then(isUnread => { + setState({...state, + unreadNotifications: isUnread, + }); + }); + }, []); + const icons = { feed: { @@ -40,8 +56,12 @@ const TrayJsx = (props) => { active: require("assets/eva-icons/person-black.png"), inactive: require("assets/eva-icons/person-grey.png") }, + profileNotif: { + active: require("assets/eva-icons/person-black-notif.png"), + inactive: require("assets/eva-icons/person-grey-notif.png") + }, } - + return ( @@ -67,7 +87,11 @@ const TrayJsx = (props) => { nav = { nav } /> @@ -103,4 +127,4 @@ const styles = { } }; -export default TrayJsx; \ No newline at end of file +export default TrayJsx; diff --git a/src/components/pages/authenticate.js b/src/components/pages/authenticate.js index 1d51162..2f58806 100644 --- a/src/components/pages/authenticate.js +++ b/src/components/pages/authenticate.js @@ -44,9 +44,9 @@ const AuthenticateJsx = ({navigation}) => { }); useEffect(() => { - const profile = AsyncStorage.getItem("@user_profile").then((profile) => { - if (profile != null) { - navigation.navigate("feed"); + AsyncStorage.getItem("@user_profile").then((profile) => { + if (profile) { + navigation.navigate("Feed"); } setState({...state, authChecked: true}); @@ -55,9 +55,17 @@ const AuthenticateJsx = ({navigation}) => { const loginCallback = async () => { const profileJSON = JSON.stringify(TEST_PROFILE); - AsyncStorage.setItem("@user_profile", profileJSON).then(() => { - navigation.navigate("Feed"); + + // TODO: Should fetch initial notifications to prevent bugging a newly + // logged in user about the notifications already on their account + const notificationsJSON = JSON.stringify({ + unread: false, + memory: [{ id: 1 }, { id: 2 }], }); + await AsyncStorage.setItem("@user_profile", profileJSON); + await AsyncStorage.setItem("@user_notifications", notificationsJSON); + + navigation.navigate("Feed"); }; return ( diff --git a/src/components/pages/profile/settings.js b/src/components/pages/profile/settings.js index 0f6d11a..698cf3a 100644 --- a/src/components/pages/profile/settings.js +++ b/src/components/pages/profile/settings.js @@ -10,6 +10,8 @@ import { Dimensions, } from "react-native"; +import AsyncStorage from "@react-native-async-storage/async-storage"; + import { withoutHTML } from "src/interface/rendering"; import { ScreenWithBackBarJsx } from "src/components/navigation/navigators"; @@ -203,7 +205,17 @@ const SettingsJsx = (props) => { Save Profile - + { + AsyncStorage.multiRemove( + ["@user_profile", "@user_notifications"] + ).then(() => { + props.navigation.navigate("Authenticate"); + }); + } + }> Log out diff --git a/src/requests.js b/src/requests.js new file mode 100644 index 0000000..64c075d --- /dev/null +++ b/src/requests.js @@ -0,0 +1,33 @@ +import AsyncStorage from "@react-native-async-storage/async-storage"; + +const TEST_NOTIFICATIONS = [{ id: 1 }, { id: 2 }]; +const TEST_NEW_NOTIFICATIONS_1 = [{ id: 1 }, { id: 2 }]; +const TEST_NEW_NOTIFICATIONS_2 = [{ id: 1 }, { id: 2 }, { id: 3 }]; + +export async function checkUnreadNotifications() { + // If the check has already been made since the last time notifications.js + // has been opened + const notifications = JSON.parse(await AsyncStorage.getItem("@user_notifications")); + + if (notifications.unread) { + return true; + } else { + // Some promise to get new notifications + const newNotifs = await Promise.resolve(TEST_NEW_NOTIFICATIONS_2); + + const isUnread = JSON.stringify(newNotifs) != JSON.stringify(notifications.memory); + + console.log(JSON.stringify(newNotifs)); + console.log(JSON.stringify(notifications.memory)); + + // Update stored notifications + await AsyncStorage.setItem( + "@user_notifications", + JSON.stringify({...notifications, + unread: isUnread, + }) + ); + + return isUnread; + } +}