diff --git a/src/components/Checkbox/Checkbox.js b/src/components/Checkbox/Checkbox.js index 535ae60a..0302c26a 100644 --- a/src/components/Checkbox/Checkbox.js +++ b/src/components/Checkbox/Checkbox.js @@ -15,7 +15,13 @@ export const Checkbox = ({ label, status, onPress, theme }) => ( style={styles.pressable} onPress={onPress} > - {label} + + {label} + {status && ( ( style={styles.pressable} onPress={onPress} > - {label} + + {label} + {status && ( async (dispatch) => { export const updateLibraryAction = () => async (dispatch, getState) => { showToast("Updating library"); + dispatch({ type: SET_LAST_UPDATE_TIME, payload: Date.now() }); + const { downloadNewChapters = false } = getState().settingsReducer; await updateAllNovels({ downloadNewChapters }); diff --git a/src/redux/updates/updates.reducer.js b/src/redux/updates/updates.reducer.js index 216e4ae7..f4c5dd52 100644 --- a/src/redux/updates/updates.reducer.js +++ b/src/redux/updates/updates.reducer.js @@ -1,7 +1,14 @@ -import { LOAD_UPDATES, GET_UPDATES } from "./updates.types"; +import { + LOAD_UPDATES, + GET_UPDATES, + SET_LAST_UPDATE_TIME, + SHOW_LAST_UPDATE_TIME, +} from "./updates.types"; const initialState = { updates: [], + lastUpdateTime: null, + showLastUpdateTime: true, loading: true, }; @@ -13,6 +20,16 @@ const updateReducer = (state = initialState, action) => { return { ...state, loading: true }; case GET_UPDATES: return { ...state, updates: payload, loading: false }; + case SET_LAST_UPDATE_TIME: + return { + ...state, + lastUpdateTime: payload, + }; + case SHOW_LAST_UPDATE_TIME: + return { + ...state, + showLastUpdateTime: payload, + }; default: return state; } diff --git a/src/redux/updates/updates.types.js b/src/redux/updates/updates.types.js index 108a3c19..1a1a87ff 100644 --- a/src/redux/updates/updates.types.js +++ b/src/redux/updates/updates.types.js @@ -1,2 +1,4 @@ export const GET_UPDATES = "GET_UPDATES"; export const LOAD_UPDATES = "LOAD_UPDATES"; +export const SET_LAST_UPDATE_TIME = "SET_LAST_UPDATE_TIME"; +export const SHOW_LAST_UPDATE_TIME = "SHOW_LAST_UPDATE_TIME"; diff --git a/src/screens/Chapter/components/ReaderSheet.js b/src/screens/Chapter/components/ReaderSheet.js index 61325f5e..6affa896 100644 --- a/src/screens/Chapter/components/ReaderSheet.js +++ b/src/screens/Chapter/components/ReaderSheet.js @@ -328,7 +328,11 @@ const ReaderSheet = ({ style={{ fontSize: 16, fontFamily: font.fontFamily, - color: theme.textColorPrimary, + color: + reader.fontFamily === + font.fontFamily + ? theme.colorAccent + : theme.textColorPrimary, }} > {font.name} diff --git a/src/screens/More/GeneralSettings.js b/src/screens/More/GeneralSettings.js index 2339b410..604f6976 100644 --- a/src/screens/More/GeneralSettings.js +++ b/src/screens/More/GeneralSettings.js @@ -18,6 +18,7 @@ import { import ColorPickerModal from "../../components/ColorPickerModal"; import SwitchSetting from "../../components/Switch/Switch"; import { ScrollView } from "react-native"; +import { SHOW_LAST_UPDATE_TIME } from "../../redux/updates/updates.types"; const GenralSettings = ({ navigation }) => { const theme = useTheme(); @@ -35,6 +36,10 @@ const GenralSettings = ({ navigation }) => { showLabelsInNav = false, } = useSettings(); + const { showLastUpdateTime = true } = useSelector( + (state) => state.updatesReducer + ); + const displayModeLabel = (displayMode) => { const label = { 0: "Compact Grid", @@ -165,6 +170,17 @@ const GenralSettings = ({ navigation }) => { } theme={theme} /> + + dispatch({ + type: SHOW_LAST_UPDATE_TIME, + payload: !showLastUpdateTime, + }) + } + theme={theme} + /> Auto-download { {presetThemes.map((theme) => ( diff --git a/src/screens/Novel/components/NovelHeader.js b/src/screens/Novel/components/NovelHeader.js index e8f32725..afa3a93f 100644 --- a/src/screens/Novel/components/NovelHeader.js +++ b/src/screens/Novel/components/NovelHeader.js @@ -99,10 +99,10 @@ const NovelInfoHeader = ({ {!loading && ( <> - {novel.author ?? "Unknown author"} + {novel.author || "Unknown author"} - {novel.status ?? "Unknown status"} + {novel.status || "Unknown status"} {novel.source} diff --git a/src/screens/Updates/Updates.js b/src/screens/Updates/Updates.js index 4695b582..70116cb1 100644 --- a/src/screens/Updates/Updates.js +++ b/src/screens/Updates/Updates.js @@ -28,7 +28,12 @@ import { const Updates = ({ navigation }) => { const theme = useTheme(); const dispatch = useDispatch(); - const { updates, loading } = useSelector((state) => state.updatesReducer); + const { + updates, + lastUpdateTime = null, + showLastUpdateTime = true, + loading, + } = useSelector((state) => state.updatesReducer); const { downloadQueue } = useSelector((state) => state.downloadsReducer); const [searchText, setSearchText] = useState(""); @@ -171,6 +176,18 @@ const Updates = ({ navigation }) => { }, ]} /> + {showLastUpdateTime && lastUpdateTime && ( + + Library last updated: {moment(lastUpdateTime).fromNow()} + + )}