mirror of
https://github.com/KoalaSat/nostros.git
synced 2024-09-29 06:30:47 +00:00
Store last seen at
This commit is contained in:
parent
9c883d2dc5
commit
a66d685810
@ -35,6 +35,15 @@ export const updateConfig: (
|
|||||||
return db.execute(configQuery, [config.satoshi, config.show_public_images, config.show_sensitive])
|
return db.execute(configQuery, [config.satoshi, config.show_public_images, config.show_sensitive])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const updateLastNotificationConfig: (
|
||||||
|
lastNotificationSeenAt: number,
|
||||||
|
db: QuickSQLiteConnection,
|
||||||
|
) => Promise<QueryResult> = async (lastNotificationSeenAt, db) => {
|
||||||
|
const configQuery = `UPDATE nostros_config SET last_notification_seen_at = ?`
|
||||||
|
|
||||||
|
return db.execute(configQuery, [lastNotificationSeenAt])
|
||||||
|
}
|
||||||
|
|
||||||
export const getNotificationsCount: (
|
export const getNotificationsCount: (
|
||||||
db: QuickSQLiteConnection,
|
db: QuickSQLiteConnection,
|
||||||
pubKey: string,
|
pubKey: string,
|
||||||
|
@ -57,7 +57,7 @@ export const GlobalFeed: React.FC<GlobalFeedProps> = ({ navigation, setProfileCa
|
|||||||
}, [pageSize])
|
}, [pageSize])
|
||||||
|
|
||||||
const updateLastLoad: () => void = () => {
|
const updateLastLoad: () => void = () => {
|
||||||
setLastLoadAt(getUnixTime(new Date()))
|
setLastLoadAt(getUnixTime(new Date()) - 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onRefresh = useCallback(() => {
|
const onRefresh = useCallback(() => {
|
||||||
|
@ -22,6 +22,8 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import { navigate } from '../../lib/Navigation'
|
import { navigate } from '../../lib/Navigation'
|
||||||
import { useFocusEffect } from '@react-navigation/native'
|
import { useFocusEffect } from '@react-navigation/native'
|
||||||
import { getLastReaction } from '../../Functions/DatabaseFunctions/Reactions'
|
import { getLastReaction } from '../../Functions/DatabaseFunctions/Reactions'
|
||||||
|
import { updateLastNotificationConfig } from '../../Functions/DatabaseFunctions/Config'
|
||||||
|
import { getUnixTime } from 'date-fns'
|
||||||
|
|
||||||
export const NotificationsFeed: React.FC = () => {
|
export const NotificationsFeed: React.FC = () => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
@ -38,8 +40,11 @@ export const NotificationsFeed: React.FC = () => {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
subscribeNotes()
|
if (database) {
|
||||||
loadNotes()
|
subscribeNotes()
|
||||||
|
loadNotes()
|
||||||
|
updateLastNotificationConfig(getUnixTime(new Date()), database)
|
||||||
|
}
|
||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
relayPool?.unsubscribe([
|
relayPool?.unsubscribe([
|
||||||
|
Loading…
Reference in New Issue
Block a user