Fixed notifications not being saved unless you clicked on them

- Added automatic cleanup of old notifications after 60 days
- Added deduplicateItems function to prevent the same notification to appear multiple times
- Fixed timestamp
This commit is contained in:
2025-10-18 19:40:16 +02:00
parent 26e5b0ae6f
commit ed7c6d630c
7 changed files with 257 additions and 69 deletions

View File

@@ -1,13 +1,13 @@
import React, { useEffect, useState } from 'react';
import { View, Text, TextInput, Button, Linking, TouchableOpacity, ScrollView } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { createDrawerNavigator, DrawerContentScrollView, DrawerItemList } from '@react-navigation/drawer';
import { categories, categoryTitles, Category } from '../types/Category';
import { Item } from "../types/Item";
import { styles } from '../styles/styles';
import React, { useEffect, useState } from 'react';
import { Button, Linking, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native';
import { STORAGE_KEY, useNotificationListener } from '../hooks/useNotificationListener';
import { usePushNotifications } from '../hooks/usePushNotifications';
import { useNotificationListener, STORAGE_KEY } from '../hooks/useNotificationListener';
import { version as appVersion } from '../package.json';
import { styles } from '../styles/styles';
import { categories, Category, categoryTitles } from '../types/Category';
import { Item } from "../types/Item";
const Drawer = createDrawerNavigator();
const API_KEY_STORAGE = 'API_KEY';
@@ -86,7 +86,7 @@ function CategoryScreen({
</View>
)}
<Text style={{ fontSize: 20, marginBottom: 16, color: "#fff", textAlign: "center" }}>
<Text style={{ fontSize: 30, marginBottom: 16, color: "#000", textAlign: "center" }}>
{categoryTitles[category]}
</Text>
@@ -116,14 +116,14 @@ function CategoryScreen({
function CustomDrawerContent({ onLogout, ...props }: any) {
return (
<View style={{ flex: 1, backgroundColor: '#333' }}>
<DrawerContentScrollView {...props} contentContainerStyle={{ paddingTop: 0 }}>
<View style={{ flex: 1 }}>
<DrawerContentScrollView {...props} contentContainerStyle={{ paddingTop: 20 }}>
<View style={{ flex: 1, paddingVertical: 10 }}>
<DrawerItemList {...props} />
</View>
</DrawerContentScrollView>
{/* Logout Button */}
<View style={{ padding: 20, borderTopWidth: 1, borderTopColor: '#444' }}>
<View style={{ padding: 20,paddingBottom: 30, borderTopWidth: 1, borderTopColor: '#444' }}>
<TouchableOpacity onPress={onLogout} style={styles.logoutButton}>
<Text style={styles.logoutText}>Logout</Text>
</TouchableOpacity>
@@ -188,6 +188,7 @@ export default function App() {
drawerActiveTintColor: '#fff',
drawerInactiveTintColor: '#ccc',
drawerLabelStyle: { textAlign: 'center', fontSize: 16 },
drawerItemStyle: { paddingVertical: 5, marginVertical: 2 },
}}
>
{categories.map(c => (