Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

// These files cause a bug in a lint plugin
src/plugins/types/filterTypes.ts
src/screens/reader/components/ReaderBottomSheet/ReaderValueChange.tsx
src/screens/settings/constants/defaultValues.ts
src/screens/BrowseSourceScreen/components/filterUtils.ts
src/screens/BrowseSourceScreen/components/FilterBottomSheet.tsx
src/screens/BrowseSourceScreen/useBrowseSource.ts
src/plugins/types/index.ts
17 changes: 11 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@ jobs:
with:
node-version: '20'

- name: Cache npm & node modules
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest

- name: Cache pnpm & node modules
uses: actions/cache@v4
with:
path: |
~/.npm
~/.pnpm-store
node_modules
key: ${{ runner.os }}-cache-npm-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-cache-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cache-npm-
${{ runner.os }}-cache-pnpm-

- name: Install Dependencies
run: |
npm install
pnpm install

- name: Create .env
run: |
Expand Down Expand Up @@ -62,7 +67,7 @@ jobs:
android/app/build/intermediates
android/app/build/tmp
android/.gradle
key: ${{ runner.os }}-build-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-build-${{ hashFiles('pnpm-lock.yaml') }}

- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Cache pnpm & node modules
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
node_modules
key: ${{ runner.os }}-cache-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cache-pnpm-
- name: Install modules
run: npm install
run: pnpm install
- name: Run ESLint
run: npm run lint
run: pnpm run lint
17 changes: 15 additions & 2 deletions .github/workflows/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Cache pnpm & node modules
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
node_modules
key: ${{ runner.os }}-cache-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cache-pnpm-
- name: Install modules
run: npm install
run: pnpm install
- name: Check Types
run: npm run type-check
run: pnpm run type-check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ src/sources/en/generators/
*.lock
.tool-versions
flake.lock
.rock/
69 changes: 37 additions & 32 deletions CONTRIBUTING-NIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ Compatibility with Microsoft WSL2 is not guaranteed, but should work withoud maj

## Prerequisites

* **Nix installed**: [https://nixos.org/download.html](https://nixos.org/download.html)
* **Git**: Required for cloning the repository.
* **KVM (for emulator, if enabled)**: Ensure KVM is enabled and your user is in the `kvm` group for optimal emulator performance:
```bash
sudo usermod -aG kvm $USER && newgrp kvm # (or log out/in)
kvm-ok # Verify KVM acceleration
```
* **GPU Drivers (for emulator, if enabled)**: For hardware-accelerated emulator (AMD/Intel), ensure host Vulkan drivers are working:
```bash
vulkaninfo | grep -i "device name" # Should show your GPU
```
If not, install `vulkan-radeon` (AMD) or `vulkan-intel` (Intel) on your host system and reboot.

- **Nix installed**: [https://nixos.org/download.html](https://nixos.org/download.html)
- **Git**: Required for cloning the repository.
- **KVM (for emulator, if enabled)**: Ensure KVM is enabled and your user is in the `kvm` group for optimal emulator performance:
```bash
sudo usermod -aG kvm $USER && newgrp kvm # (or log out/in)
kvm-ok # Verify KVM acceleration
```
- **GPU Drivers (for emulator, if enabled)**: For hardware-accelerated emulator (AMD/Intel), ensure host Vulkan drivers are working:
```bash
vulkaninfo | grep -i "device name" # Should show your GPU
```
If not, install `vulkan-radeon` (AMD) or `vulkan-intel` (Intel) on your host system and reboot.

## Getting Started

1. **Clone the Project:**

```bash
git clone <your-fork-url>
cd <your-fork-name>
Expand All @@ -35,24 +35,26 @@ Compatibility with Microsoft WSL2 is not guaranteed, but should work withoud maj
2. **Enter the Development Shell:**

If you have `npm` or `yarn` installed, use the defined scripts:
* **For Physical Device Only (default):**
```bash
npm run nix # or yarn nix
```
* **For Emulator Development (explicitly enable):**
```bash
npm run nix-emulator # or yarn nix-emulator
```

- **For Physical Device Only (default):**
```bash
pnpm nix # or yarn nix
```
- **For Emulator Development (explicitly enable):**
```bash
pnpm nix-emulator # or yarn nix-emulator
```

If you do not have `npm`/`yarn` installed, execute the commands manually:
* **For Physical Device Only (default):**
```bash
nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
```
* **For Emulator Development (explicitly enable):**
```
nix develop .#emulator --extra-experimental-features nix-command --extra-experimental-features flakes
```

- **For Physical Device Only (default):**
```bash
nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
```
- **For Emulator Development (explicitly enable):**
```
nix develop .#emulator --extra-experimental-features nix-command --extra-experimental-features flakes
```

The first time, this will download and set up all required tools, which can take considerable time. Subsequent entries will be much faster. You will also see a message about "Setting up writable Android SDK..." which only happens once.

Expand All @@ -63,8 +65,9 @@ Once inside the `nix develop` shell, all tools are available.
### 1. Start Metro Bundler

Open a new terminal or run in the background:

```bash
npm start
pnpm start
```

### 2. Physical Device Development
Expand All @@ -87,10 +90,12 @@ npm start
### 3. Android Emulator Development (if enabled)

1. **Launch Emulator**:

```bash
emulator -avd ReactNative_API35 -gpu host -no-metrics -no-audio
```
* Use `-gpu swiftshader_indirect` if hardware acceleration (`-gpu host`) fails.

- Use `-gpu swiftshader_indirect` if hardware acceleration (`-gpu host`) fails.

2. **Verify Emulator**:
```bash
Expand All @@ -100,4 +105,4 @@ npm start
Launches the the emulater automatically, if it is not already running.
```bash
npx run android
```
```
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ git clone https://github.com/<your-account-name>/lnreader.git
cd lnreader

# install dependencies
npm install
pnpm install

# build the apk (the built apk will be found in ~/lnreader/android/app/build/outputs/apk/release/)
npm run buildRelease
pnpm buildRelease
```

### Developing on Android
Expand All @@ -43,10 +43,10 @@ IDE
adb devices

# run metro for development
npm start
pnpm start

# then to view on your android device (new terminal)
npm run android
pnpm android
```

### Style & Linting
Expand All @@ -57,5 +57,5 @@ It is recommended that you install an eslint plugin for your editor of choice wh
codebase, however you can always check to see if the source code is compliant by running:

```bash
npm run lint
pnpm lint
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.res.Configuration
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
Expand Down Expand Up @@ -40,11 +41,7 @@ class MainApplication : Application(), ReactApplication {

override fun onCreate() {
super.onCreate()
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
loadReactNative(this)
ApplicationLifecycleDispatcher.onApplicationCreate(this)
}

Expand Down
6 changes: 3 additions & 3 deletions android/app/src/main/jni/OnLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <autolinking.h>
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <rncore.h>
#include <FBReactNativeSpec.h>
#include <NativeEpub.hpp>

#ifdef REACT_NATIVE_APP_CODEGEN_HEADER
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace facebook::react
// if (module != nullptr) {
// return module;
// }
// return rncore_ModuleProvider(name, params);
// return FBReactNativeSpec_ModuleProvider(name, params);

// We link app local modules if available
#ifdef REACT_NATIVE_APP_MODULE_PROVIDER
Expand All @@ -108,7 +108,7 @@ namespace facebook::react
#endif

// We first try to look up core modules
if (auto module = rncore_ModuleProvider(name, params))
if (auto module = FBReactNativeSpec_ModuleProvider(name, params))
{
return module;
}
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
buildscript {
ext {
buildToolsVersion = "35.0.0"
buildToolsVersion = "36.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 35
compileSdkVersion = 36
targetSdkVersion = 36
ndkVersion = "27.1.12297006"
kotlinVersion = "2.0.21"
kotlinVersion = "2.1.20"
}
repositories {
google()
Expand Down
5 changes: 5 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ expo.webp.enabled=false
# Enable animated webp support (~3.4 MB increase)
# Disabled by default because iOS doesn't support animated webp
expo.webp.animated=false

# Use this property to enable edge-to-edge display support.
# This allows your app to draw behind system bars for an immersive UI.
# Note: Only works with ReactActivity and should not be used with custom Activity.
edgeToEdgeEnabled=false
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 2 additions & 2 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
9 changes: 7 additions & 2 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@REM Copyright (c) Meta Platforms, Inc. and affiliates.
@REM
@REM This source code is licensed under the MIT license found in the
@REM LICENSE file in the root directory of this source tree.

@rem
@rem Copyright 2015 the original author or authors.
@rem
Expand Down Expand Up @@ -70,11 +75,11 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function (api) {
},
},
],
'react-native-reanimated/plugin',
'react-native-worklets/plugin',
[
'module:react-native-dotenv',
{
Expand Down
Loading