diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..e5962b3 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,58 @@ +on: [workflow_dispatch] +jobs: + build: + runs-on: ubuntu-latest + name: Build the project + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup java + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "17" + - name: Set up node + # ADD YOUR CUSTOM DEPENDENCY UPGRADE COMMANDS BELOW + uses: actions/setup-node@v3 + with: + node-version: "20" + - name: Load secret + uses: 1password/load-secrets-action@v1 + with: + # Export loaded secrets as environment variables + export-env: true + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + AWS_KEY_ID: "op://DevOps/cloudflare-r2-token/access-key-id" + AWS_SECRET_ACCESS_KEY: "op://DevOps/cloudflare-r2-token/secret-access-key" + RELEASE_KEYSTORE: "op://DevOps/btt-android-keystore-key/base64-encoded-jks" + RELEASE_KEYSTORE_PASSWORD: "op://DevOps/btt-android-keystore-key/keystore-password" + ENDPOINT: "op://DevOps/cloudflare-r2-token/endpoint" + - name: + Install JS dependencies and build + # ADD YOUR CUSTOM DEPENDENCY UPGRADE COMMANDS BELOW + run: | + npm ci && npm run build-android + env: + VITE_POLICY_KEY: ${{ secrets.VITE_POLICY_KEY }} + VITE_BC_ACCOUNT_ID: ${{ secrets.VITE_BC_ACCOUNT_ID }} + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" + - name: Build app bundle + run: cd android && ./gradlew bundle + - name: Extract Android signing key from env + run: | + echo "${{ secrets.RELEASE_KEYSTORE }}" > android/release.jks.base64 + base64 -d android/release.jks.base64 > android/release.decrypted.jks + - name: Sign dev build + run: jarsigner -keystore android/release.decrypted.jks -storepass "${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" -signedjar ./android/app/build/outputs/bundle/release/app-release-signed.aab ./android/app/build/outputs/bundle/release/app-release.aab release + - name: Upload Android to R2 + uses: shallwefootball/s3-upload-action@master + with: + aws_key_id: ${{ env.AWS_KEY_ID }} + aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY}} + aws_bucket: dot-mobile + source_dir: "./android/app/build/outputs/bundle/release" + destination_dir: "android/${{steps.date.outputs.date}}" + endpoint: ${{ env.ENDPOINT }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bb695f..afbce4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,26 +23,28 @@ jobs: OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} AWS_KEY_ID: "op://DevOps/cloudflare-r2-token/access-key-id" AWS_SECRET_ACCESS_KEY: "op://DevOps/cloudflare-r2-token/secret-access-key" + RELEASE_KEYSTORE: "op://DevOps/btt-android-keystore-key/base64-encoded-jks" + RELEASE_KEYSTORE_PASSWORD: "op://DevOps/btt-android-keystore-key/keystore-password" ENDPOINT: "op://DevOps/cloudflare-r2-token/endpoint" - name: Install JS dependencies and build # ADD YOUR CUSTOM DEPENDENCY UPGRADE COMMANDS BELOW run: | - npm ci && npm run build-ios + npm ci && npm run build-ios && npm run build-android env: VITE_POLICY_KEY: ${{ secrets.VITE_POLICY_KEY }} VITE_BC_ACCOUNT_ID: ${{ secrets.VITE_BC_ACCOUNT_ID }} - name: Get current date id: date run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" - - name: zip the built folder - run: mkdir ./dottmp && zip -r ./dottmp/${{steps.date.outputs.date}}-dotapp ./ios - - name: Upload IOS to R2 - uses: shallwefootball/s3-upload-action@master - with: - aws_key_id: ${{ env.AWS_KEY_ID }} - aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY}} - aws_bucket: dot-mobile - source_dir: "./dottmp" - destination_dir: "ios" - endpoint: ${{ env.ENDPOINT }} + # - name: zip the built folder + # run: mkdir ./dottmp && zip -r ./dottmp/${{steps.date.outputs.date}}-dotapp ./ios + # - name: Upload IOS to R2 + # uses: shallwefootball/s3-upload-action@master + # with: + # aws_key_id: ${{ env.AWS_KEY_ID }} + # aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY}} + # aws_bucket: dot-mobile + # source_dir: "./dottmp" + # destination_dir: "ios" + # endpoint: ${{ env.ENDPOINT }} diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 870adf4..183f1a9 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,39 +1,14 @@ - + - - + + - - + + diff --git a/android/app/src/main/java/com/slbible/MainActivity.java b/android/app/src/main/java/com/slbible/MainActivity.java index e7ffcc9..6032755 100644 --- a/android/app/src/main/java/com/slbible/MainActivity.java +++ b/android/app/src/main/java/com/slbible/MainActivity.java @@ -2,4 +2,7 @@ import com.getcapacitor.BridgeActivity; -public class MainActivity extends BridgeActivity {} +public class MainActivity extends BridgeActivity { + +} + diff --git a/package.json b/package.json index 36c754f..8f415bf 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "test.unit": "vitest", "lint": "biome check --apply --verbose src/**/* src/", "build-ios": "ionic capacitor build ios --release --prod --no-open", + "build-android": "ionic capacitor build android --release --prod --no-open", "ios": "npm run build && npm run sync && npx cap run ios", "android": "npm run build && npx cap run android", "sync": "cap sync", diff --git a/src/components/Player.tsx b/src/components/Player.tsx index e78aa0d..a4d137b 100644 --- a/src/components/Player.tsx +++ b/src/components/Player.tsx @@ -1,11 +1,8 @@ import { Capacitor } from "@capacitor/core"; +import { useIonViewWillLeave } from "@ionic/react"; import { Dispatch, SetStateAction, useEffect, useRef } from "react"; import { VideoJsPlayer } from "video.js"; -import { - IVidWithCustom, - changePlayerSrcParams, - chapterMarkers, -} from "../customTypes/types"; +import { IVidWithCustom, chapterMarkers } from "../customTypes/types"; import { handleVideoJsTaps, playerCustomHotKeys } from "../lib/Ui"; import { getSavedAppPreferences } from "../lib/storage"; type Iplayer = { @@ -71,6 +68,7 @@ export function VidJsPlayer({ fullscreen: { navigationUI: "show", }, + enableDocumentPictureInPicture: true, sources: firstVidSrces, poster: firstPoster, nativeControlsForTouch: true, diff --git a/src/lib/Ui.tsx b/src/lib/Ui.tsx index 3786867..b1a9fa7 100644 --- a/src/lib/Ui.tsx +++ b/src/lib/Ui.tsx @@ -81,6 +81,7 @@ export async function fetchRemoteChaptersFile(src: string) { } export function cleanUpOldChapters() { const elements = document.querySelectorAll('[data-role="chapterMarker"]'); + for (const element of elements) { element.remove(); } diff --git a/src/pages/Playlist.tsx b/src/pages/Playlist.tsx index 1a08c0b..c7c96c0 100644 --- a/src/pages/Playlist.tsx +++ b/src/pages/Playlist.tsx @@ -1,3 +1,4 @@ +import { Capacitor } from "@capacitor/core"; import { Preferences } from "@capacitor/preferences"; import { IonAlert, @@ -8,6 +9,7 @@ import { IonToolbar, useIonViewWillEnter, } from "@ionic/react"; +import { useIonViewWillLeave } from "@ionic/react"; import { useCallback, useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { useParams } from "react-router"; @@ -363,7 +365,7 @@ function Playlist() { useIonViewWillEnter(() => { fetchAndSetup(); }, []); - + // useIonViewWillLeave(() => {}, [vidJsPlayer]); // MANAGE EFFECTS FOR HEN PLAYER CHANGES // biome-ignore lint/correctness/useExhaustiveDependencies: @@ -450,6 +452,7 @@ function Playlist() { setShapedPlaylist={setShapedPlaylist} setCurrentBook={setCurrentBook} /> + {currentBook && (