diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 8604e26..da5c5b2 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -46,6 +46,7 @@ jobs: # import certificate to keychain security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH security list-keychain -d user -s $KEYCHAIN_PATH # apply provisioning profile diff --git a/biome.json b/biome.json index 1729069..6273c02 100644 --- a/biome.json +++ b/biome.json @@ -30,7 +30,8 @@ "noConsoleLog": "warn" }, "correctness": { - "noUnusedVariables": "error" + "noUnusedVariables": "error", + "useExhaustiveDependencies": "warn" }, "complexity": { "noUselessCatch": "warn" diff --git a/src/components/ChapterSelector.tsx b/src/components/ChapterSelector.tsx index 19bfb93..a06de5d 100644 --- a/src/components/ChapterSelector.tsx +++ b/src/components/ChapterSelector.tsx @@ -1,5 +1,5 @@ import { useRef } from "react"; -import { IVidWithCustom } from "../customTypes/types"; +import type { IVidWithCustom } from "../customTypes/types"; import { ChapterList } from "./ChapterList"; import { IconMaterialSymbolsChevronLeft, diff --git a/src/components/Icons.tsx b/src/components/Icons.tsx index 0909eae..49f312f 100644 --- a/src/components/Icons.tsx +++ b/src/components/Icons.tsx @@ -1,4 +1,4 @@ -import { SVGProps } from "react"; +import type { SVGProps } from "react"; interface IconProps { classNames?: string; diff --git a/src/components/Player.tsx b/src/components/Player.tsx index 3afa69f..e339642 100644 --- a/src/components/Player.tsx +++ b/src/components/Player.tsx @@ -1,6 +1,6 @@ -import { Dispatch, SetStateAction, useEffect, useRef } from "react"; -import { VideoJsPlayer } from "video.js"; -import { IVidWithCustom, chapterMarkers } from "../customTypes/types"; +import { type Dispatch, type SetStateAction, useEffect, useRef } from "react"; +import type { VideoJsPlayer } from "video.js"; +import type { IVidWithCustom, chapterMarkers } from "../customTypes/types"; import { handleVideoJsTaps, playerCustomHotKeys } from "../lib/Ui"; import { getSavedAppPreferences } from "../lib/storage"; type Iplayer = { @@ -40,7 +40,7 @@ export function VidJsPlayer({ ? { src: `${firstBook.savedSources?.video}`, type: "video/mp4", - } + } : firstBook.sources; const firstPoster = firstBook.savedSources?.poster diff --git a/src/components/PlaylistBookPicker.tsx b/src/components/PlaylistBookPicker.tsx index 95f9d43..376afbd 100644 --- a/src/components/PlaylistBookPicker.tsx +++ b/src/components/PlaylistBookPicker.tsx @@ -1,6 +1,6 @@ -import { Dispatch, SetStateAction } from "react"; +import type { Dispatch, SetStateAction } from "react"; import { useTranslation } from "react-i18next"; -import { IVidWithCustom } from "../customTypes/types"; +import type { IVidWithCustom } from "../customTypes/types"; import { manageShowingChapterArrows } from "../lib/Ui"; import { normalizeBookName } from "../lib/utils"; import { IconMaterialSymbolsCheckCircle } from "./Icons"; diff --git a/src/components/PlaylistInfo.tsx b/src/components/PlaylistInfo.tsx index db9794a..6df698a 100644 --- a/src/components/PlaylistInfo.tsx +++ b/src/components/PlaylistInfo.tsx @@ -1,4 +1,4 @@ -import { IVidWithCustom, validPlaylistSlugs } from "../customTypes/types"; +import type { IVidWithCustom, validPlaylistSlugs } from "../customTypes/types"; import { formatPlayListName, normalizeBookName } from "../lib/utils"; import { IconMaterialSymbolsCheckCircle } from "./Icons"; type IPlaylistInfo = { diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 0abe95c..610037b 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -1,10 +1,16 @@ import { IonButton, IonIcon, IonModal } from "@ionic/react"; import { close } from "ionicons/icons"; import { settingsOutline } from "ionicons/icons"; -import { Dispatch, SetStateAction, useEffect, useRef, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { VideoJsPlayer } from "video.js"; import { + type Dispatch, + type SetStateAction, + useEffect, + useRef, + useState, +} from "react"; +import { useTranslation } from "react-i18next"; +import type { VideoJsPlayer } from "video.js"; +import type { IPlaylistData, IVidWithCustom, downloadProgressInfo, diff --git a/src/components/Settings/BulkListing.tsx b/src/components/Settings/BulkListing.tsx index 133eddf..20cb13d 100644 --- a/src/components/Settings/BulkListing.tsx +++ b/src/components/Settings/BulkListing.tsx @@ -1,12 +1,12 @@ -import { CheckboxCustomEvent, IonButton } from "@ionic/react"; -import { Dispatch, SetStateAction, useState } from "react"; +import { type CheckboxCustomEvent, IonButton } from "@ionic/react"; +import { type Dispatch, type SetStateAction, useState } from "react"; import { useTranslation } from "react-i18next"; -import { +import type { IPlaylistData, IVidWithCustom, validPlaylistSlugs, } from "../../customTypes/types"; -import { downloadProgressInfo } from "../../customTypes/types"; +import type { downloadProgressInfo } from "../../customTypes/types"; import { getCurrentPlaylistDataFs, getDownloadSize, @@ -214,7 +214,7 @@ export function BulkListing({ size="small" fill="outline" color="primary" - disabled={booksSelected?.length ? false : true} + disabled={!booksSelected?.length} className="text-surface" onClick={() => { if (downloadProgress?.started) { diff --git a/src/components/Settings/DownloadBookItem.tsx b/src/components/Settings/DownloadBookItem.tsx index 8a2d2fa..790861b 100644 --- a/src/components/Settings/DownloadBookItem.tsx +++ b/src/components/Settings/DownloadBookItem.tsx @@ -1,8 +1,11 @@ -import { CheckboxCustomEvent } from "@ionic/core"; +import type { CheckboxCustomEvent } from "@ionic/core"; import { IonButton, IonCheckbox, IonProgressBar } from "@ionic/react"; -import { Dispatch, SetStateAction } from "react"; +import type { Dispatch, SetStateAction } from "react"; import { useTranslation } from "react-i18next"; -import { IVidWithCustom, downloadProgressInfo } from "../../customTypes/types"; +import type { + IVidWithCustom, + downloadProgressInfo, +} from "../../customTypes/types"; import { IconCancelX, IconMaterialSymbolsCheckCircle } from "../Icons"; type BookToDownloadProps = { diff --git a/src/components/Settings/SpeedControl.tsx b/src/components/Settings/SpeedControl.tsx index 3053c9d..fe0db37 100644 --- a/src/components/Settings/SpeedControl.tsx +++ b/src/components/Settings/SpeedControl.tsx @@ -1,6 +1,6 @@ -import { ChangeEvent, useEffect, useState } from "react"; +import { type ChangeEvent, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { VideoJsPlayer } from "video.js"; +import type { VideoJsPlayer } from "video.js"; import { getSavedAppPreferences, updateSavedAppPreferences, diff --git a/src/components/VerseSegmentJump.tsx b/src/components/VerseSegmentJump.tsx index 090d812..7169390 100644 --- a/src/components/VerseSegmentJump.tsx +++ b/src/components/VerseSegmentJump.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; -import { +import type { IVidWithCustom, IadjacentChap, IvidJsPlayer, diff --git a/src/customTypes/types.ts b/src/customTypes/types.ts index 0e88bec..ab63be8 100644 --- a/src/customTypes/types.ts +++ b/src/customTypes/types.ts @@ -1,5 +1,5 @@ -import videojs from "video.js"; -import brightCovePlaylistConfig from "../brightcove/playlist-mappers"; +import type videojs from "video.js"; +import type brightCovePlaylistConfig from "../brightcove/playlist-mappers"; import type { PlaylistResponse, Video, VideoSources } from "./bcApi"; declare global { diff --git a/src/lib/Ui.tsx b/src/lib/Ui.tsx index b6aa72c..4a46798 100644 --- a/src/lib/Ui.tsx +++ b/src/lib/Ui.tsx @@ -1,7 +1,7 @@ import { Directory, Encoding, Filesystem } from "@capacitor/filesystem"; -import { Dispatch, SetStateAction } from "react"; -import { +import type { Dispatch, SetStateAction } from "react"; +import type { IPlaylistData, IPlaylistResponse, IVidWithCustom, @@ -391,7 +391,7 @@ export async function updatePrefsInBackground({ } } - // biome-ignore lint/correctness/noUnusedVariables: I'm destructuring to pick off the videos and formatted because we are using updating those properties with the spread on cacheBcPlaylistJson + // I'm destructuring to pick off the videos and formatted because we are using updating those properties with the spread on cacheBcPlaylistJson const { videos, formattedVideos, ...restPlaylistData } = data; mutateTimeStampBcResponse(restPlaylistData); diff --git a/src/lib/storage.ts b/src/lib/storage.ts index 42f73c5..82db8ef 100644 --- a/src/lib/storage.ts +++ b/src/lib/storage.ts @@ -2,13 +2,13 @@ import { Capacitor } from "@capacitor/core"; import { Directory, Filesystem } from "@capacitor/filesystem"; import { Preferences } from "@capacitor/preferences"; import write_blob from "capacitor-blob-writer"; -import { +import type { IPlaylistData, IVidWithCustom, fetchSession, writeAnInProgressBlobParams, } from "src/customTypes/types"; -import { +import type { IappState, validPlaylistSlugs, vidSavingWipData, @@ -65,7 +65,7 @@ export function makeVidSaver( return lowestMp4Size; }, async savePosterBlobAndGetSrc() { - let posterBlob; + let posterBlob: Blob | undefined; const posterPath = `${playlist}/${vid.id}/poster.jpeg`; if (vid.poster) { try { @@ -107,7 +107,7 @@ export function makeVidSaver( if (contentLength === null) { return -1; } - const fileSize = parseInt(contentLength, 10); + const fileSize = Number.parseInt(contentLength, 10); return fileSize; } catch (error) { console.warn(error); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index d5fdc0d..dfd6083 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,4 +1,4 @@ -import { IVidWithCustom, validPlaylistSlugs } from "../customTypes/types"; +import type { IVidWithCustom, validPlaylistSlugs } from "../customTypes/types"; interface sortOrderI { [key: string]: number; @@ -179,7 +179,7 @@ export function massageVidsArray(vids: IVidWithCustom[]) { const bBookSort = getBibleBookSort(bCustomBook); const aChap = Number(a.custom_fields?.chapter); const bChap = Number(b.custom_fields?.chapter); - let retVal; + let retVal: undefined | number; if (aBookSort === bBookSort) { retVal = aChap < bChap ? -1 : aChap === bChap ? 0 : 1; } else { diff --git a/src/main.tsx b/src/main.tsx index 8d5c6e0..9c83933 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,8 +1,8 @@ +import "virtual:uno.css"; import React from "react"; import { createRoot } from "react-dom/client"; import App from "./App"; import "./i18n/i18nnext"; -import "virtual:uno.css"; const container = document.getElementById("root"); diff --git a/src/pages/Playlist.tsx b/src/pages/Playlist.tsx index 50e671a..8edc3e9 100644 --- a/src/pages/Playlist.tsx +++ b/src/pages/Playlist.tsx @@ -21,7 +21,7 @@ import { PlaylistBookPicker } from "../components/PlaylistBookPicker"; import { PlaylistInfo } from "../components/PlaylistInfo"; import { Settings } from "../components/Settings"; import { VerseSegmentJump } from "../components/VerseSegmentJump"; -import { +import type { IPlaylistData, IPlaylistResponse, IVidWithCustom, @@ -89,8 +89,8 @@ function Playlist() { savedPoster ? plyr?.poster(savedPoster) : vid.poster - ? plyr?.poster(vid.poster) - : null; + ? plyr?.poster(vid.poster) + : null; plyr?.one("loadedmetadata", () => { handleChapters(vid, plyr); });