diff --git a/android/app/build.gradle b/android/app/build.gradle index c2423e5..6960c4e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -79,8 +79,8 @@ android { applicationId "com.micahlindley.offsides" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 18 - versionName "0.5.0" + versionCode 19 + versionName "0.5.1" } signingConfigs { debug { diff --git a/android/app/release/app-release.apk b/android/app/release/app-release.apk index a15252e..a8125a8 100644 Binary files a/android/app/release/app-release.apk and b/android/app/release/app-release.apk differ diff --git a/android/app/release/output-metadata.json b/android/app/release/output-metadata.json index a34b339..3c665f0 100644 --- a/android/app/release/output-metadata.json +++ b/android/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 18, - "versionName": "0.5.0", + "versionCode": 19, + "versionName": "0.5.1", "outputFile": "app-release.apk" } ], diff --git a/docs/latest.json b/docs/latest.json index a437f1f..1a2407e 100644 --- a/docs/latest.json +++ b/docs/latest.json @@ -1,3 +1,3 @@ { - "latestVersion": "0.5.0" + "latestVersion": "0.5.1" } diff --git a/package-lock.json b/package-lock.json index 2ea69f2..1bb0d6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "offsides", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "offsides", - "version": "0.5.0", + "version": "0.5.1", "dependencies": { "@devvie/bottom-sheet": "^0.3.0", "@pchmn/expo-material3-theme": "^1.3.2", @@ -30,7 +30,7 @@ "reanimated-color-picker": "^3.0.3", "rn-emoji-keyboard": "^1.6.1", "semver": "^7.6.0", - "sidechat.js": "^2.2.9", + "sidechat.js": "^2.3.3", "timesago": "^1.0.1" }, "devDependencies": { @@ -14668,9 +14668,9 @@ } }, "node_modules/sidechat.js": { - "version": "2.2.9", - "resolved": "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.2.9.tgz", - "integrity": "sha512-YjpS+FpbaZwlh6wbxSxlfGSiSrHhyBCkj2BebGN4+rVQH0EtHnYqrVyHJYkDCw85IPJv3VL2ps+hem6bIL2F2w==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.3.3.tgz", + "integrity": "sha512-7A9skzTUdo2oqED6KlePsXPP1WYx8HzmLCxEYzub6H7bunsf+8nNY3MP8YwjXIAm7SSW+A0s4a1ep4RDohnd3w==", "engines": { "node": ">=18.0.0" } diff --git a/package.json b/package.json index 0fa20b1..c6a1813 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "offsides", - "version": "0.5.0", + "version": "0.5.1", "private": true, "scripts": { "android": "react-native run-android", @@ -32,7 +32,7 @@ "reanimated-color-picker": "^3.0.3", "rn-emoji-keyboard": "^1.6.1", "semver": "^7.6.0", - "sidechat.js": "^2.2.9", + "sidechat.js": "^2.3.3", "timesago": "^1.0.1" }, "devDependencies": { diff --git a/src/components/ActivityItem.jsx b/src/components/ActivityItem.jsx index 8171f66..7245d2e 100644 --- a/src/components/ActivityItem.jsx +++ b/src/components/ActivityItem.jsx @@ -1,10 +1,29 @@ +import { useNavigation } from '@react-navigation/native'; import * as React from 'react'; import { View } from 'react-native'; -import { Card, Icon, Text, useTheme } from 'react-native-paper'; +import { + Card, + Icon, + Text, + TouchableRipple, + useTheme, +} from 'react-native-paper'; +import timesago from 'timesago'; +import { AppContext } from '../App'; function ActivityItem({ activity }) { + const { + appState: { API }, + } = React.useContext(AppContext); + const nav = useNavigation(); const { colors } = useTheme(); - const Handler = () => { + const [linkRoute, setLinkRoute] = React.useState(''); + const [linkProps, setLinkProps] = React.useState({}); + React.useEffect(() => { + setLinkRoute('Comments'); + setLinkProps({ postID: activity.post_id }); + }, [activity]); + const RenderedContent = () => { if (activity.type == 'votes') { return ( @@ -15,9 +34,10 @@ function ActivityItem({ activity }) { size={20}> + style={{ marginLeft: 5, color: colors.primary, flex: 1 }}> Votes + {timesago(activity.timestamp)} {activity.text} @@ -34,9 +54,27 @@ function ActivityItem({ activity }) { size={20}> + style={{ marginLeft: 5, color: colors.primary, flex: 1 }}> Popular + {timesago(activity.timestamp)} + + + {activity.text.replaceAll('📈 ', '')} + + + ); + } else if (activity.type == 'followed_post') { + return ( + + + + + Followed post + + {timesago(activity.timestamp)} {activity.text.replaceAll('📈 ', '')} @@ -46,9 +84,18 @@ function ActivityItem({ activity }) { } }; return ( - - - + { + API.readActivity(activity.id).then(() => { + nav.navigate(linkRoute, linkProps); + }); + }} + borderless={true} + style={{ borderRadius: 10 }}> + + + + ); } diff --git a/src/components/CommentModal.jsx b/src/components/CommentModal.jsx index f84b19e..e592f9f 100644 --- a/src/components/CommentModal.jsx +++ b/src/components/CommentModal.jsx @@ -15,6 +15,7 @@ import useUniqueList from '../hooks/useUniqueList'; function CommentModal({ navigation, route }) { /** @type {{postID: String, postObj: SidechatPostOrComment}} */ const { postID, postObj } = route.params; + const [localPost, setLocalPost] = React.useState(postObj); const { appState } = React.useContext(AppContext); const API = appState.API; const { colors } = useTheme(); @@ -34,6 +35,11 @@ function CommentModal({ navigation, route }) { ); const fetchComments = () => { setLoadingComments(true); + if (!localPost && postID) { + API.getPost(postID).then(post => { + setLocalPost(post); + }); + } API.getPostComments(postID).then(res => { setComments(res); setLoadingComments(false); @@ -61,7 +67,7 @@ function CommentModal({ navigation, route }) { refreshing={loadingComments} ListHeaderComponent={ <> - + diff --git a/src/screens/HomeScreen.jsx b/src/screens/HomeScreen.jsx index 14e19e7..f7471af 100644 --- a/src/screens/HomeScreen.jsx +++ b/src/screens/HomeScreen.jsx @@ -63,13 +63,15 @@ function HomeScreen({ navigation, route }) { setCurrentGroupId(appState.groupID); } }); + React.useEffect(() => { + if (appState.groupColor) { + const t = createMaterial3Theme(appState.groupColor); + setCustomTheme(colorScheme == 'dark' ? t.dark : t.light); + } + }, [appState?.groupColor]); React.useEffect(() => { if (!loadingPosts) { InteractionManager.runAfterInteractions(() => { - if (appState.groupColor) { - const t = createMaterial3Theme(appState.groupColor); - setCustomTheme(colorScheme == 'dark' ? t.dark : t.light); - } if (appState.groupID && appState.userToken) { setCurrentGroupId(currentGroupId); setLoadingPosts(true); diff --git a/src/screens/MyProfileScreen.jsx b/src/screens/MyProfileScreen.jsx index 7f659ac..25f2305 100644 --- a/src/screens/MyProfileScreen.jsx +++ b/src/screens/MyProfileScreen.jsx @@ -128,7 +128,7 @@ function MyProfileScreen({ navigation }) { @@ -146,7 +146,9 @@ function MyProfileScreen({ navigation }) { titleVariant="labelLarge" titleStyle={{ minHeight: 10 }} /> - {updates.activity_items?.items ? ( + {updates.activity_items?.items && + updates.activity_items?.items?.filter(i => !i.is_seen).length > + 0 ? ( {updates.activity_items.items .filter(i => !i.is_seen) @@ -162,7 +164,7 @@ function MyProfileScreen({ navigation }) { iconColor={colors.outline} /> - No activity yet. + No recent activity )} diff --git a/yarn.lock b/yarn.lock index 8c50370..7d4d62d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8118,10 +8118,10 @@ side-channel@^1.0.4: get-intrinsic "^1.2.4" object-inspect "^1.13.1" -sidechat.js@^2.2.9: - version "2.2.9" - resolved "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.2.9.tgz" - integrity sha512-YjpS+FpbaZwlh6wbxSxlfGSiSrHhyBCkj2BebGN4+rVQH0EtHnYqrVyHJYkDCw85IPJv3VL2ps+hem6bIL2F2w== +sidechat.js@^2.3.3: + version "2.3.3" + resolved "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.3.3.tgz" + integrity sha512-7A9skzTUdo2oqED6KlePsXPP1WYx8HzmLCxEYzub6H7bunsf+8nNY3MP8YwjXIAm7SSW+A0s4a1ep4RDohnd3w== signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7"