diff --git a/components/BottomNavBar.tsx b/components/BottomNavBar.tsx index bcc1d38..05a4bd9 100644 --- a/components/BottomNavBar.tsx +++ b/components/BottomNavBar.tsx @@ -11,6 +11,7 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import { ShowInfo } from '../models/models'; import { SettingsTab } from './SettingsTab'; import { CastSettingsTab } from './CastSettingsTab'; +import { logger } from '../services/Logger'; const Tab = createMaterialBottomTabNavigator(); export const BottomNavBar = () => { @@ -78,7 +79,7 @@ export const BottomNavBar = () => { } return []; } catch (e) { - // error reading value + logger.error('Failed to read saved releases', JSON.stringify(e)); } }; diff --git a/components/DownloadTorrentButton.tsx b/components/DownloadTorrentButton.tsx index 7d93b4b..667db1d 100644 --- a/components/DownloadTorrentButton.tsx +++ b/components/DownloadTorrentButton.tsx @@ -14,6 +14,7 @@ import { SavedShowPaths } from './settingsPageComponents/SavedShowLocationSettin import { convert } from '../services/converter'; import { downloadedShows } from '../services/DownloadedShows'; import { downloadNotificationManger } from '../services/DownloadNotificationManager'; +import { logger } from '../services/Logger'; type DownloadTorrentButtonProps = { resolution: string; @@ -70,10 +71,20 @@ export const DownloadTorrentButton = ({ }; const getStoredShowPaths = async () => { - return JSON.parse( - (await AsyncStorage.getItem(StorageKeys.ShowPaths)) ?? - JSON.stringify({ shows: [] }), - ) as SavedShowPaths; + try { + return JSON.parse( + (await AsyncStorage.getItem(StorageKeys.ShowPaths)) || + JSON.stringify({ shows: [] }), + ) as SavedShowPaths; + } catch (ex) { + logger.error( + 'Failed to parse stored show paths', + JSON.stringify(ex), + ); + return { + shows: [], + }; + } }; const downloadTorrent = async () => { diff --git a/components/WatchListTab.tsx b/components/WatchListTab.tsx index cf63f13..e9caa13 100644 --- a/components/WatchListTab.tsx +++ b/components/WatchListTab.tsx @@ -128,7 +128,7 @@ const ShowDayInfo = (props: ShowDayInfoProps) => { React.useEffect(() => { const init = async () => { const watchList: WatchList = JSON.parse( - (await AsyncStorage.getItem(StorageKeys.WatchList)) ?? + (await AsyncStorage.getItem(StorageKeys.WatchList)) || '{shows: []}', ); setShowsForCurrentDay(