diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 57b118c8..54de3a92 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -47,5 +47,8 @@ jobs: - name: Generate Environment Variables run: pnpm generate:env:debug + - name: Check Types + run: pnpm run type-check + - name: Run Tests run: pnpm run test diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 00000000..131f900c --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1 @@ +npm run type-check diff --git a/modules/native-volume-button-listener/src/NativeVolumeButtonListenerModule.ts b/modules/native-volume-button-listener/src/NativeVolumeButtonListenerModule.ts index 78999b1f..5d972585 100644 --- a/modules/native-volume-button-listener/src/NativeVolumeButtonListenerModule.ts +++ b/modules/native-volume-button-listener/src/NativeVolumeButtonListenerModule.ts @@ -9,12 +9,6 @@ declare class NativeVolumeButtonListenerModule extends NativeModule( - 'NativeVolumeButtonListener', -); - setActive(active: boolean): void; -} - export default requireNativeModule( 'NativeVolumeButtonListener', ); diff --git a/package.json b/package.json index 635a4291..b1bca383 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "type-check": "tsc --noEmit", "clean:generated": "rm -rf .expo .rock android/build android/app/build android/app/.cxx modules/*/android/build modules/*/android/.cxx modules/*/lib src/generated tsconfig.tsbuildinfo modules/*/tsconfig.tsbuildinfo", "clean:full": "pnpm run clean:generated && rm -rf node_modules && pnpm install && cd android && ./gradlew clean && cd .. && npx expo start --clear", + "check": "pnpm run format:check && pnpm run lint && pnpm run typecheck", "prepare": "husky install", "nix:shell": "nix develop --extra-experimental-features nix-command --extra-experimental-features flakes", "nix:emulator": "nix develop .#emulator --extra-experimental-features nix-command --extra-experimental-features flakes" @@ -153,9 +154,12 @@ } }, "lint-staged": { - "*.{js,jsx,ts,tsx}": [ - "eslint --fix", - "prettier --check" + "*.{ts,tsx,js,jsx}": [ + "prettier --write", + "eslint --fix" + ], + "*.{json,md,css,scss,yml,yaml}": [ + "prettier --write" ] }, "engines": { diff --git a/src/i18n/languages/en/strings.json b/src/i18n/languages/en/strings.json index 0a1701a2..e1dd3fd8 100644 --- a/src/i18n/languages/en/strings.json +++ b/src/i18n/languages/en/strings.json @@ -259,6 +259,7 @@ "newUpdateAvailable": "New update available", "none": "None", "ok": "Ok", + "close": "Close", "pause": "Pause", "preparing": "Preparing", "remove": "Remove", diff --git a/src/i18n/types/index.ts b/src/i18n/types/index.ts index 38f1990d..31bf35c3 100644 --- a/src/i18n/types/index.ts +++ b/src/i18n/types/index.ts @@ -232,6 +232,7 @@ export interface StringMap { 'common.newUpdateAvailable': 'string'; 'common.none': 'string'; 'common.ok': 'string'; + 'common.close': 'string'; 'common.pause': 'string'; 'common.preparing': 'string'; 'common.remove': 'string'; diff --git a/src/screens/reader/hooks/useTimeTracking.ts b/src/screens/reader/hooks/useTimeTracking.ts index d3388aa1..8c94349a 100644 --- a/src/screens/reader/hooks/useTimeTracking.ts +++ b/src/screens/reader/hooks/useTimeTracking.ts @@ -11,7 +11,8 @@ export default function useTimeTracking( turnedOn: boolean, increaseTimeSpent: (chapterId: number, elapsed: number) => void, ) { - const lastUserInteractionRef = useRef(0); + // eslint-disable-next-line react-hooks/purity + const lastUserInteractionRef = useRef(Date.now()); const isTTSReadingRef = useRef(false); /** Increases the time spent on the current chapter since the last user interaction, as long as it was not too long ago */