From b01e63791e75b366375204c01fc4fbb0280d21f9 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Thu, 6 May 2021 20:55:23 +0530 Subject: [PATCH] Release v1.0.17 --- package-lock.json | 112 ++++++++++++++++++ package.json | 5 +- src/Screens/History/components/HistoryCard.js | 9 +- src/Screens/More/About.js | 2 +- src/Screens/More/Settings.js | 4 +- src/Services/updates.js | 17 +++ src/redux/history/history.actions.js | 8 ++ src/redux/history/history.reducer.js | 12 +- src/redux/history/history.types.js | 1 + 9 files changed, 158 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99b2a016..1f336d04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1357,6 +1357,11 @@ "@hapi/hoek": "^8.3.0" } }, + "@ide/backoff": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@ide/backoff/-/backoff-1.0.0.tgz", + "integrity": "sha512-F0YfUDjvT+Mtt/R4xdl2X0EYCHMMiJqNLdxHD++jDT5ydEFIyqbCHh51Qx2E211dgZprPKhV7sHmnXKpLuvc5g==" + }, "@jest/console": { "version": "24.9.0", "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", @@ -2589,6 +2594,17 @@ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" }, + "assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "requires": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", @@ -2735,6 +2751,11 @@ "babel-plugin-syntax-trailing-function-commas": "^7.0.0-beta.0" } }, + "badgin": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/badgin/-/badgin-1.2.2.tgz", + "integrity": "sha512-XtoSjNhy2D09qGiLhFWBJmBwBlmleQuwyYyjddWNCJ3gqGRBOBR25VGcd8CAOSghpEUmghB3LD4NpHrUG89zCg==" + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -3656,6 +3677,11 @@ "is-symbol": "^1.0.2" } }, + "es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=" + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -3818,6 +3844,15 @@ "url-parse": "^1.4.4" } }, + "expo-background-fetch": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/expo-background-fetch/-/expo-background-fetch-9.1.0.tgz", + "integrity": "sha512-vBA+qTugxTYhAlNcXQxUUXTR6Qm2H/6QA3OzfgZUFL2bvnATuJ6BLoA29mrxHRUtSIcPDjHD9PVBnGBOEyCnwA==", + "requires": { + "@expo/config-plugins": "^1.0.18", + "expo-task-manager": "~9.1.0" + } + }, "expo-constants": { "version": "10.1.3", "resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-10.1.3.tgz", @@ -3888,6 +3923,42 @@ "unimodules-permissions-interface": "~6.1.0" } }, + "expo-notifications": { + "version": "0.11.6", + "resolved": "https://registry.npmjs.org/expo-notifications/-/expo-notifications-0.11.6.tgz", + "integrity": "sha512-skVEOHXKXrXBWofCQ/Zn7yKhAFA2EN0fd9mXqpkbF6nE4NKE7pn63gTWpyCy6sXC9M3YUal8yT0vp9GkD2FsmA==", + "requires": { + "@expo/config-plugins": "^1.0.18", + "@expo/image-utils": "^0.3.10", + "@ide/backoff": "^1.0.0", + "abort-controller": "^3.0.0", + "assert": "^2.0.0", + "badgin": "^1.1.5", + "expo-application": "~3.1.2", + "expo-constants": "10.1.3", + "fs-extra": "^9.0.1", + "unimodules-permissions-interface": "~6.1.0", + "uuid": "^3.4.0" + }, + "dependencies": { + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, "expo-permissions": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-12.0.1.tgz", @@ -3920,6 +3991,15 @@ "resolved": "https://registry.npmjs.org/expo-status-bar/-/expo-status-bar-1.0.4.tgz", "integrity": "sha512-s7nc496D/Zn1NGiMJ5wu6HyIdXxbgGtmZZtbHm7rpbcmLdf28GmMSNHDx7M0t00BMhky7VAurTCUo+BJs8ugsw==" }, + "expo-task-manager": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/expo-task-manager/-/expo-task-manager-9.1.0.tgz", + "integrity": "sha512-mCWpjsBrlP/8B97UUpEoimSlFY67qNlblL5RQoL07UTYG14CCVmoIwMwOgxkE3lw+078gPOiwDuDQvYibbLyRw==", + "requires": { + "@expo/config-plugins": "^1.0.18", + "unimodules-app-loader": "~2.1.0" + } + }, "expo-web-browser": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/expo-web-browser/-/expo-web-browser-9.1.0.tgz", @@ -4739,11 +4819,25 @@ "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" }, + "is-generator-function": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.9.tgz", + "integrity": "sha512-ZJ34p1uvIfptHCN7sFTjGibB9/oBg17sHqzDLfuwhvmN/qLVvIQXRQ8licZQ35WJ8KuEQt/etnnzQFI9C9Ue/A==" + }, "is-map": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==" }, + "is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, "is-negative-zero": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", @@ -8574,6 +8668,11 @@ "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==" }, + "unimodules-app-loader": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unimodules-app-loader/-/unimodules-app-loader-2.1.0.tgz", + "integrity": "sha512-W+D+hVXq6jOvBm7QVwODPENz6Lupj73QequNNG+6GCTkqn4ybq/lba9IQvJQT2QzdL3luVHin+eym18cDblMlg==" + }, "unimodules-permissions-interface": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/unimodules-permissions-interface/-/unimodules-permissions-interface-6.1.0.tgz", @@ -8684,6 +8783,19 @@ "pako": "^1.0.5" } }, + "util": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", + "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index e8b39cdf..b35eaeda 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,10 @@ "redux-devtools-extension": "^2.13.9", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0", - "rn-sliding-up-panel": "^2.4.4" + "rn-sliding-up-panel": "^2.4.4", + "expo-notifications": "~0.11.6", + "expo-background-fetch": "~9.1.0", + "expo-task-manager": "~9.1.0" }, "devDependencies": { "@babel/core": "~7.9.0" diff --git a/src/Screens/History/components/HistoryCard.js b/src/Screens/History/components/HistoryCard.js index 86fca2fb..4565bdcb 100644 --- a/src/Screens/History/components/HistoryCard.js +++ b/src/Screens/History/components/HistoryCard.js @@ -5,15 +5,20 @@ import { TouchableRipple, IconButton } from "react-native-paper"; import moment from "moment"; -import { useSelector } from "react-redux"; +import { useDispatch } from "react-redux"; +import { setNovel } from "../../../redux/novel/novel.actions"; const HistoryCard = ({ item, deleteHistoryAction, navigation, theme }) => { + const dispatch = useDispatch(); return ( navigation.navigate("Novel", item)} + onPress={() => { + navigation.navigate("Novel", item); + dispatch(setNovel(item)); + }} > <> { /> deleteAllHistory()} + onPress={() => dispatch(clearAllHistoryAction())} theme={theme} /> diff --git a/src/Services/updates.js b/src/Services/updates.js index 6d2559dc..172354f1 100644 --- a/src/Services/updates.js +++ b/src/Services/updates.js @@ -3,6 +3,17 @@ const db = SQLite.openDatabase("lnreader.db"); import { getLibrary } from "../Database/queries/LibraryQueries"; import { fetchChapters, fetchNovel } from "../Services/Source/source"; +import * as Notifications from "expo-notifications"; + +Notifications.setNotificationHandler({ + handleNotification: async () => { + return { + shouldShowAlert: true, + shouldPlaySound: true, + shouldSetBadge: true, + }; + }, +}); const updateNovelDetails = async (novel, novelId) => { db.transaction((tx) => { @@ -106,6 +117,12 @@ export const updateAllNovels = async () => { setTimeout(async () => { updateNovelChapters(novel.sourceId, novel.novelUrl, novel.novelId); console.log(novel.novelName + " Updated"); + if (index + 1 === libraryNovels.length) { + Notifications.scheduleNotificationAsync({ + content: { title: "Library Updated" }, + trigger: null, + }); + } }, 3000 * index) ); }; diff --git a/src/redux/history/history.actions.js b/src/redux/history/history.actions.js index 9754887b..21e45c3a 100644 --- a/src/redux/history/history.actions.js +++ b/src/redux/history/history.actions.js @@ -3,11 +3,13 @@ import { CLEAR_NOVEL_HISTORY, GET_HISTORY, LOAD_HISTORY, + CLEAR_HISTORY, } from "./history.types"; import { getHistory, insertHistory, deleteHistory, + deleteAllHistory, } from "../../Database/queries/HistoryQueries"; import { SET_LAST_READ } from "../preferences/preference.types"; @@ -44,3 +46,9 @@ export const deleteHistoryAction = (novelId) => async (dispatch) => { payload: { novelId }, }); }; + +export const clearAllHistoryAction = () => async (dispatch) => { + deleteAllHistory(); + + dispatch({ type: CLEAR_HISTORY }); +}; diff --git a/src/redux/history/history.reducer.js b/src/redux/history/history.reducer.js index 657ebb27..ffd074f2 100644 --- a/src/redux/history/history.reducer.js +++ b/src/redux/history/history.reducer.js @@ -1,4 +1,5 @@ import { + CLEAR_HISTORY, CLEAR_NOVEL_HISTORY, GET_HISTORY, LOAD_HISTORY, @@ -27,12 +28,11 @@ const historyReducer = (state = initialState, action) => { (item) => item.novelId !== payload.novelId ), }; - // return { - // ...state, - // history: state.history.map((novel) => - // novel.novelUrl === payload.novelUrl ? payload : novel - // ), - // }; + case CLEAR_HISTORY: + return { + ...state, + history: [], + }; default: return state; } diff --git a/src/redux/history/history.types.js b/src/redux/history/history.types.js index ee1b10ce..8dbe1ba5 100644 --- a/src/redux/history/history.types.js +++ b/src/redux/history/history.types.js @@ -2,3 +2,4 @@ export const LOAD_HISTORY = "LOAD_HISTORY"; export const GET_HISTORY = "GET_HISTORY"; export const UPDATE_NOVEL_HISTORY = "UPDATE_NOVEL_HISTORY"; export const CLEAR_NOVEL_HISTORY = "CLEAR_NOVEL_HISTORY"; +export const CLEAR_HISTORY = "CLEAR_HISTORY";