Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions landing/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export default defineConfig({
{ text: 'Configuration', link: '/docs/guide/configuration' },
{ text: 'Themes', link: '/docs/guide/themes' }
]
},
{
text: 'Updates',
items: [
{ text: 'Changelog', link: '/docs/changelog' }
]
}
]
},
Expand Down
35 changes: 35 additions & 0 deletions landing/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

All notable changes to Keep Track will be documented in this page.

## [Unreleased]

### Fixed

#### Notification Settings Screen Error
- **Issue**: Opening the Notification Settings screen would display "Error loading settings" with a `PlatformException: Missing type parameter` error
- **Cause**: The `flutter_local_notifications` plugin's internal cache (stored in SharedPreferences) became corrupted, containing notification data with missing required fields
- **Solution**: Added error handling in the notification service to gracefully catch and recover from corrupted notification cache errors
- **Files Changed**:
- `lib/core/services/notification/notification_service.dart` - Added try-catch around `cancelNotification()` and `cancelAllNotifications()` methods
- `lib/features/notifications/presentation/state/notification_settings_controller.dart` - Added error handling in `_applySettings()` to prevent settings load failures

**Workaround for existing users**: If you still experience issues after updating, clear the app data from your device settings (Settings > Apps > Keep Track > Storage > Clear Data). This will reset the corrupted notification cache.

---

## [0.7.4] - 2025-01-25

### Added
- Build workflow updates
- Local version updates for workflows

### Fixed
- Navigation counter bug for pomodoro
- Removed unnecessary assets and fixed security risk issue on workflow

---

## Previous Releases

For older releases, please check the [GitHub Releases](https://github.com/Khesir/KeepTrack/releases) page.
46 changes: 42 additions & 4 deletions lib/core/services/notification/notification_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,53 @@ class NotificationService {
Future<void> cancelNotification(int id) async {
if (!_initialized || _plugin == null) return;

await _plugin!.cancel(id);
AppLogger.info('NotificationService: Notification cancelled - ID: $id');
try {
await _plugin!.cancel(id);
AppLogger.info('NotificationService: Notification cancelled - ID: $id');
} catch (e, stackTrace) {
// Handle corrupted notification cache (Missing type parameter error)
AppLogger.warning(
'NotificationService: Failed to cancel notification $id, attempting cache clear',
);
await _clearNotificationCacheOnError(e, stackTrace);
}
}

/// Cancel all notifications
Future<void> cancelAllNotifications() async {
if (!_initialized || _plugin == null) return;

await _plugin!.cancelAll();
AppLogger.info('NotificationService: All notifications cancelled');
try {
await _plugin!.cancelAll();
AppLogger.info('NotificationService: All notifications cancelled');
} catch (e, stackTrace) {
// Handle corrupted notification cache
AppLogger.warning(
'NotificationService: Failed to cancel all notifications, attempting cache clear',
);
await _clearNotificationCacheOnError(e, stackTrace);
}
}

/// Handle corrupted notification cache by clearing it
Future<void> _clearNotificationCacheOnError(Object error, StackTrace stackTrace) async {
AppLogger.error('NotificationService: Notification cache error', error, stackTrace);

// On Android, try to clear the notification cache
if (Platform.isAndroid && _plugin != null) {
try {
final androidPlugin = _plugin!.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>();
if (androidPlugin != null) {
// Clear all notifications from the system
await androidPlugin.cancelAll();
AppLogger.info('NotificationService: Cleared all notifications via Android plugin');
}
} catch (e2) {
AppLogger.error('NotificationService: Could not clear notification cache', e2, stackTrace);
// The corrupted cache is stored in SharedPreferences
// User may need to clear app data from device settings
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,24 @@ class NotificationSettingsController

/// Apply settings to scheduler
Future<void> _applySettings(NotificationSettings settings) async {
await _scheduler.rescheduleAllDailyReminders(
financeEnabled: settings.financeReminderEnabled,
financeTime: settings.financeReminderTime,
morningEnabled: settings.morningReminderEnabled,
morningTime: settings.morningReminderTime,
eveningEnabled: settings.eveningReminderEnabled,
eveningTime: settings.eveningReminderTime,
);

AppLogger.info('NotificationSettingsController: Settings applied');
try {
await _scheduler.rescheduleAllDailyReminders(
financeEnabled: settings.financeReminderEnabled,
financeTime: settings.financeReminderTime,
morningEnabled: settings.morningReminderEnabled,
morningTime: settings.morningReminderTime,
eveningEnabled: settings.eveningReminderEnabled,
eveningTime: settings.eveningReminderTime,
);
AppLogger.info('NotificationSettingsController: Settings applied');
} catch (e, stackTrace) {
// Log but don't fail - settings can still be saved even if scheduling fails
AppLogger.error(
'NotificationSettingsController: Failed to apply notification schedules',
e,
stackTrace,
);
}
}

/// Reset all settings to defaults
Expand Down