mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
Updated so scheduled notifications does not cancel on test and are added and removed by saving to library
This commit is contained in:
parent
02ef82a804
commit
045e37a0d3
2 changed files with 29 additions and 32 deletions
|
|
@ -116,7 +116,7 @@ const NotificationSettingsScreen = () => {
|
|||
const resetAllNotifications = async () => {
|
||||
Alert.alert(
|
||||
'Reset Notifications',
|
||||
'This will cancel all scheduled notifications. Are you sure?',
|
||||
'This will cancel all scheduled notifications, but will not remove anything from your saved library. Are you sure?',
|
||||
[
|
||||
{
|
||||
text: 'Cancel',
|
||||
|
|
@ -127,7 +127,11 @@ const NotificationSettingsScreen = () => {
|
|||
style: 'destructive',
|
||||
onPress: async () => {
|
||||
try {
|
||||
await notificationService.cancelAllNotifications();
|
||||
// Cancel all notifications for all series, but do not remove from saved
|
||||
const scheduledNotifications = notificationService.getScheduledNotifications?.() || [];
|
||||
for (const notification of scheduledNotifications) {
|
||||
await notificationService.cancelNotification(notification.id);
|
||||
}
|
||||
Alert.alert('Success', 'All notifications have been reset');
|
||||
} catch (error) {
|
||||
logger.error('Error resetting notifications:', error);
|
||||
|
|
@ -466,10 +470,6 @@ const NotificationSettingsScreen = () => {
|
|||
</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<Text style={[styles.resetDescription, { color: currentTheme.colors.lightGray }]}>
|
||||
This will cancel all scheduled notifications. You'll need to re-enable them manually.
|
||||
</Text>
|
||||
</View>
|
||||
</>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { stremioService, Meta, Manifest } from './stremioService';
|
||||
import { notificationService } from './notificationService';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import axios from 'axios';
|
||||
import { TMDBService } from './tmdbService';
|
||||
|
|
@ -690,15 +691,14 @@ class CatalogService {
|
|||
try { this.libraryAddListeners.forEach(l => l(content)); } catch {}
|
||||
|
||||
// Auto-setup notifications for series when added to library
|
||||
// if (content.type === 'series') {
|
||||
// try {
|
||||
// const { notificationService } = await import('./notificationService');
|
||||
// await notificationService.updateNotificationsForSeries(content.id);
|
||||
// console.log(`[CatalogService] Auto-setup notifications for series: ${content.name}`);
|
||||
// } catch (error) {
|
||||
// console.error(`[CatalogService] Failed to setup notifications for ${content.name}:`, error);
|
||||
// }
|
||||
// }
|
||||
if (content.type === 'series') {
|
||||
try {
|
||||
await notificationService.updateNotificationsForSeries(content.id);
|
||||
console.log(`[CatalogService] Auto-setup notifications for series: ${content.name}`);
|
||||
} catch (error) {
|
||||
console.error(`[CatalogService] Failed to setup notifications for ${content.name}:`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async removeFromLibrary(type: string, id: string): Promise<void> {
|
||||
|
|
@ -707,24 +707,21 @@ class CatalogService {
|
|||
this.saveLibrary();
|
||||
this.notifyLibrarySubscribers();
|
||||
try { this.libraryRemoveListeners.forEach(l => l(type, id)); } catch {}
|
||||
|
||||
|
||||
// Cancel notifications for series when removed from library
|
||||
// if (type === 'series') {
|
||||
// try {
|
||||
// const { notificationService } = await import('./notificationService');
|
||||
// // Cancel all notifications for this series
|
||||
// const scheduledNotifications = await notificationService.getScheduledNotifications();
|
||||
// const seriesToCancel = scheduledNotifications.filter(notification => notification.seriesId === id);
|
||||
//
|
||||
// for (const notification of seriesToCancel) {
|
||||
// await notificationService.cancelNotification(notification.id);
|
||||
// }
|
||||
//
|
||||
// console.log(`[CatalogService] Cancelled ${seriesToCancel.length} notifications for removed series: ${id}`);
|
||||
// } catch (error) {
|
||||
// console.error(`[CatalogService] Failed to cancel notifications for removed series ${id}:`, error);
|
||||
// }
|
||||
// }
|
||||
if (type === 'series') {
|
||||
try {
|
||||
// Cancel all notifications for this series
|
||||
const scheduledNotifications = notificationService.getScheduledNotifications();
|
||||
const seriesToCancel = scheduledNotifications.filter(notification => notification.seriesId === id);
|
||||
for (const notification of seriesToCancel) {
|
||||
await notificationService.cancelNotification(notification.id);
|
||||
}
|
||||
console.log(`[CatalogService] Cancelled ${seriesToCancel.length} notifications for removed series: ${id}`);
|
||||
} catch (error) {
|
||||
console.error(`[CatalogService] Failed to cancel notifications for removed series ${id}:`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private addToRecentContent(content: StreamingContent): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue