Skip to content
Draft
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
20 changes: 17 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,23 @@ When upgrading a toolkit, move all three platforms together where API surface ov

### Android

- After editing any Kotlin file: `ktlint --format`; resolve all violations before committing.
- Every `PluginLog.*` message starts with `::functionName` (exact enclosing named function).
- Navigator-dependent `suspend` funcs: capture `navigator` as a local with a `?: run { … return }` guard, then wrap calls in `return withContext(coroutineContext) { }`. Funcs that only delegate to other wrappers skip the guard.
- **Kotlin formatting**: after writing or editing any Kotlin file, run `ktlint --format` on it. All violations must be resolved before committing.
- **Android log messages**: every `PluginLog.*` call in Kotlin must start with `::functionName` (double colon, then the exact name of the enclosing function). For lambdas, use the name of the enclosing named function. Example: `Log.d(TAG, "::goBackward. Navigator not ready.")`. Single-colon or missing prefixes are bugs; wrong function names from copy-paste are also bugs.
- **Android navigator null guard**: every `suspend` function that needs the navigator must capture it as a local variable with a `?: run { }` early-return guard, then wrap direct navigator calls in `return withContext(coroutineContext) { }`. Functions that only call other wrapper functions (e.g. `evaluateJavascript`) do not need their own guard or `withContext` — delegate instead. Example:
```kotlin
val navigator = epubNavigator ?: run {
PluginLog.w(TAG, "::myFunction. Navigator not ready.")
return
}
return withContext(coroutineContext) { navigator.someCall() }
```

## Build / toolchain facts

- Dart SDK: `>=3.8.0 <4.0.0`, Flutter `>=3.44.0`.
- Android: `minSdkVersion 24`, `compileSdk 36`, Kotlin 2.3.21, AGP 8.13.2, Java 18 source/target.
- iOS: requires `use_frameworks!` and `use_modular_headers!` in consuming `Podfile` (see top-level `README.md`).
- Web: webpack 5, TypeScript 5.7+.

## Gotchas

Expand Down
1 change: 0 additions & 1 deletion flutter_readium/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand Down
2 changes: 2 additions & 0 deletions flutter_readium/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.newDsl=false
android.builtInKotlin=false

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
1 change: 0 additions & 1 deletion flutter_readium/example/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins
id("dev.flutter.flutter-gradle-plugin")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
34 changes: 0 additions & 34 deletions flutter_readium/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@ PODS:
- DifferenceKit/UIKitExtension (1.3.0):
- DifferenceKit/Core
- Flutter (1.0.0)
- flutter_readium (0.0.1):
- Flutter
- ReadiumNavigator (~> 3.9.0)
- ReadiumOPDS (~> 3.9.0)
- ReadiumShared (~> 3.9.0)
- ReadiumStreamer (~> 3.9.0)
- integration_test (0.0.1):
- Flutter
- Minizip (1.0.0)
- package_info_plus (0.4.5):
- Flutter
- pointer_interceptor_ios (0.0.1):
- Flutter
- ReadiumFuzi (4.0.0)
- ReadiumInternal (3.9.0)
- ReadiumNavigator (3.9.0):
Expand All @@ -44,22 +32,15 @@ PODS:
- ReadiumShared (~> 3.9.0)
- ReadiumZIPFoundation (3.0.1)
- SwiftSoup (2.11.3)
- wakelock_plus (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_readium (from `.symlinks/plugins/flutter_readium/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
- ReadiumInternal (from `https://raw.githubusercontent.com/readium/swift-toolkit/3.9.0/Support/CocoaPods/ReadiumInternal.podspec`)
- ReadiumNavigator (from `https://raw.githubusercontent.com/readium/swift-toolkit/3.9.0/Support/CocoaPods/ReadiumNavigator.podspec`)
- ReadiumOPDS (from `https://raw.githubusercontent.com/readium/swift-toolkit/3.9.0/Support/CocoaPods/ReadiumOPDS.podspec`)
- ReadiumShared (from `https://raw.githubusercontent.com/readium/swift-toolkit/3.9.0/Support/CocoaPods/ReadiumShared.podspec`)
- ReadiumStreamer (from `https://raw.githubusercontent.com/readium/swift-toolkit/3.9.0/Support/CocoaPods/ReadiumStreamer.podspec`)
- ReadiumZIPFoundation (from `https://raw.githubusercontent.com/readium/podspecs/refs/heads/main/ReadiumZIPFoundation/3.0.1/ReadiumZIPFoundation.podspec`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)

SPEC REPOS:
trunk:
Expand All @@ -72,14 +53,6 @@ SPEC REPOS:
EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_readium:
:path: ".symlinks/plugins/flutter_readium/ios"
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
pointer_interceptor_ios:
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
ReadiumInternal:
:podspec: https://raw.githubusercontent.com/readium/swift-toolkit/3.9.0/Support/CocoaPods/ReadiumInternal.podspec
ReadiumNavigator:
Expand All @@ -92,18 +65,12 @@ EXTERNAL SOURCES:
:podspec: https://raw.githubusercontent.com/readium/swift-toolkit/3.9.0/Support/CocoaPods/ReadiumStreamer.podspec
ReadiumZIPFoundation:
:podspec: https://raw.githubusercontent.com/readium/podspecs/refs/heads/main/ReadiumZIPFoundation/3.0.1/ReadiumZIPFoundation.podspec
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"

SPEC CHECKSUMS:
CryptoSwift: e64e11850ede528a02a0f3e768cec8e9d92ecb90
DifferenceKit: ab185c4d7f9cef8af3fcf593e5b387fb81e999ca
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_readium: 8de113dbcb83268e6d978750cc9cb3cb24034732
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
Minizip: 188cb3e39a1195c283ae03bf673d182596fefd0b
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
pointer_interceptor_ios: da06a662d5bfd329602b45b2ab41bc0fb5fdb0f0
ReadiumFuzi: 888d023b862f524e314f85925c94768a501f05c0
ReadiumInternal: 44ae41c0487eb56cd5bbeded3d8a6c86351fa0a0
ReadiumNavigator: 3bac1f518748845913a9fbcf292cb8204aa460e5
Expand All @@ -112,7 +79,6 @@ SPEC CHECKSUMS:
ReadiumStreamer: cddfb21ed01a48a4c6dccfc133aefaea78630e4d
ReadiumZIPFoundation: 2f3e19e361f1b7751ecf37a88c754287692c12c2
SwiftSoup: 959c9ac70d7053fbf476341bfac90ab228523f2a
wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556

PODFILE CHECKSUM: 894bc4dbb676e55d1a69180023df51e183cd49ec

Expand Down
66 changes: 37 additions & 29 deletions flutter_readium/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ packages:
dependency: transitive
description:
name: code_assets
sha256: dad6bf6b9f4f378b0a69edbf42584d336efd1a9ce15deb1ba591cbb1b5ff440f
sha256: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.2.1"
collection:
dependency: "direct main"
description:
Expand Down Expand Up @@ -93,10 +93,10 @@ packages:
dependency: transitive
description:
name: dbus
sha256: "792974a4007974fbc5c1b5433eb2330a9db3e368c3f906253af4c007d0f49a91"
sha256: "0ce9b0a839e6dee59a37a623d2fc26a35bbbe6404213e419b0d6411023d62645"
url: "https://pub.dev"
source: hosted
version: "0.7.13"
version: "0.7.14"
dfunc:
dependency: transitive
description:
Expand Down Expand Up @@ -129,6 +129,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.0"
ffi_leak_tracker:
dependency: transitive
description:
name: ffi_leak_tracker
sha256: "4093d4ef9ca06ffe2786e73bfb25e22aa92112b9bb4ec941f11e3e6b61489a97"
url: "https://pub.dev"
source: hosted
version: "0.1.2"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -204,10 +212,10 @@ packages:
dependency: transitive
description:
name: hooks
sha256: a41af4e8fc687cd6d33de9751eb936c8c0204ebe2bcb6c15ecf707504bf47f31
sha256: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "2.0.2"
http:
dependency: transitive
description:
Expand Down Expand Up @@ -361,10 +369,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.18.0"
nested:
dependency: transitive
description:
Expand All @@ -390,21 +398,21 @@ packages:
source: hosted
version: "2.2.0"
package_info_plus:
dependency: "direct main"
dependency: transitive
description:
name: package_info_plus
sha256: "468c26b4254ab01979fa5e4a98cb343ea3631b9acee6f21028997419a80e1a20"
sha256: "4bf625947f6c7713ee242296a682e23e44823c09cf9d79e4f1238923c92db852"
url: "https://pub.dev"
source: hosted
version: "9.0.1"
version: "10.1.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086"
sha256: db762cb2f4f25ee60fb6359773861b0f199e00b90d237bd85a76a1e806b46ef4
url: "https://pub.dev"
source: hosted
version: "3.2.1"
version: "4.1.0"
path:
dependency: "direct main"
description:
Expand All @@ -417,10 +425,10 @@ packages:
dependency: "direct main"
description:
name: path_provider
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825
url: "https://pub.dev"
source: hosted
version: "2.1.5"
version: "2.1.6"
path_provider_android:
dependency: transitive
description:
Expand Down Expand Up @@ -449,10 +457,10 @@ packages:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.1.3"
path_provider_windows:
dependency: transitive
description:
Expand Down Expand Up @@ -606,10 +614,10 @@ packages:
dependency: transitive
description:
name: synchronized
sha256: "63896c27e81b28f8cb4e69ead0d3e8f03f1d1e5fc531a3e579cabed6a2c7c9e5"
sha256: "93b153dcb6a26dcddee6ca087dd634b53e38c10b5aa163e8e49501a776456153"
url: "https://pub.dev"
source: hosted
version: "3.4.0+1"
version: "3.4.1"
term_glyph:
dependency: transitive
description:
Expand All @@ -622,10 +630,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
version: "0.7.11"
time:
dependency: transitive
description:
Expand Down Expand Up @@ -662,10 +670,10 @@ packages:
dependency: transitive
description:
name: wakelock_plus
sha256: ddf3db70eaa10c37558ff817519b85d527dbd21034fd5d8e1c2e85f31588f1c1
sha256: "824c5bba0f800e86d32e57d3d1843c531f090005cc89d9a837933e6601093d53"
url: "https://pub.dev"
source: hosted
version: "1.5.2"
version: "1.6.1"
wakelock_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -694,10 +702,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e
sha256: ba6f4bba816c8d7e3c1580e170f3786d216951cc6b94babc3b814c08d2cb2738
url: "https://pub.dev"
source: hosted
version: "5.15.0"
version: "6.3.0"
xdg_directories:
dependency: transitive
description:
Expand All @@ -710,10 +718,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4"
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
url: "https://pub.dev"
source: hosted
version: "7.0.1"
version: "6.6.1"
yaml:
dependency: transitive
description:
Expand All @@ -723,5 +731,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.11.0 <4.0.0"
flutter: ">=3.38.4"
dart: ">=3.12.0 <4.0.0"
flutter: ">=3.44.0"
1 change: 0 additions & 1 deletion flutter_readium/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies:
logging: ^1.3.0
marionette_flutter: ^0.5.0
marionette_logging: ^0.5.0
package_info_plus: ^9.0.0
path: ^1.9.1
path_provider: ^2.1.5
pointer_interceptor: ^0.10.1
Expand Down
4 changes: 2 additions & 2 deletions flutter_readium/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ topics:

environment:
sdk: ">=3.8.0 <4.0.0"
flutter: '>=3.32.0'
flutter: '>=3.44.0'

flutter:
plugin:
Expand All @@ -40,7 +40,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
flutter_readium_platform_interface: ^0.1.1
wakelock_plus: ^1.4.0
wakelock_plus: ^1.6.0
web: ^1.1.1
collection: ^1.19.1

Expand Down
12 changes: 6 additions & 6 deletions flutter_readium_platform_interface/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ packages:
dependency: "direct main"
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.18.0"
path:
dependency: "direct main"
description:
Expand Down Expand Up @@ -228,10 +228,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
version: "0.7.11"
time:
dependency: transitive
description:
Expand Down Expand Up @@ -265,5 +265,5 @@ packages:
source: hosted
version: "15.2.0"
sdks:
dart: ">=3.9.0-0 <4.0.0"
flutter: ">=3.32.0"
dart: ">=3.10.0-0 <4.0.0"
flutter: ">=3.44.0"
Loading
Loading