Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0195f1c9b8 | ||
|
|
18d2d992a4 | ||
|
|
5582353c44 | ||
|
|
464568f29f | ||
|
|
213a9d56d2 | ||
|
|
f672462bcd | ||
|
|
9a0b0d2c65 | ||
|
|
fcaf4e3182 | ||
|
|
ea40fa9b05 | ||
|
|
2e3436dbe7 | ||
|
|
bd759dedea | ||
|
|
bac78ce018 | ||
|
|
dd95d7aaa2 | ||
|
|
d1bb5b1d87 | ||
|
|
67a3252b05 | ||
|
|
2df08f022f | ||
|
|
65673a0ed9 | ||
|
|
aef20e2e04 | ||
|
|
3bbfc8ac3a | ||
|
|
02e85a8c4d | ||
|
|
8cc531ccec | ||
|
|
30fc750e17 | ||
|
|
0ff40d3d38 | ||
|
|
9fa80db783 | ||
|
|
357503b403 | ||
|
|
10f7b2a7a9 | ||
|
|
99696b11db | ||
|
|
71291b8800 | ||
|
|
3532dbdcd6 | ||
|
|
589ba8432c | ||
|
|
273196bf5d | ||
|
|
a5fadeee3c | ||
|
|
3f784ec1de | ||
|
|
f7a70cdfc3 | ||
|
|
030100280f | ||
|
|
0d76ee43fd | ||
|
|
11a215f070 | ||
|
|
a6e61e07fc | ||
|
|
da94d298ce | ||
|
|
9e74db0f02 | ||
|
|
0d63c2fa3c | ||
|
|
bf44fde58e | ||
|
|
4bc119138f | ||
|
|
c7f5b86843 | ||
|
|
2aa815dce1 | ||
|
|
cf7f18351d | ||
|
|
5ed27963d7 | ||
|
|
85e539f0ba | ||
|
|
15ecb0e3f4 | ||
|
|
db5055da6e | ||
|
|
09e201f3f2 | ||
|
|
6f34083880 | ||
|
|
4e0c42c955 | ||
|
|
935b7dec0c | ||
|
|
d0b0651c7d | ||
|
|
e131a416e8 | ||
|
|
dd526d33bd | ||
|
|
4611a77e04 | ||
|
|
806560cf59 | ||
|
|
fd3f6eb124 | ||
|
|
8e14c6e57b | ||
|
|
20a4f4ab25 | ||
|
|
d4c64f6e66 | ||
|
|
cfb2f15a1e | ||
|
|
927a738f46 | ||
|
|
19482dbd77 | ||
|
|
43b7fb611a | ||
|
|
c39338efb7 | ||
|
|
dbd952eebb | ||
|
|
192039408c | ||
|
|
e38376d4b0 | ||
|
|
a4062cf4d1 | ||
|
|
3c47d36525 | ||
|
|
00090944d5 | ||
|
|
d2cafbb2a3 | ||
|
|
9847b95582 | ||
|
|
986412932b | ||
|
|
f13831cb74 | ||
|
|
5ed1203558 | ||
|
|
acf1fe43bf | ||
|
|
4761ef7416 | ||
|
|
70aaf38f94 | ||
|
|
a92aaf19c9 | ||
|
|
a5b408d316 | ||
|
|
f96a2e63d1 | ||
|
|
a0a9da68da | ||
|
|
a83be94d1f | ||
|
|
cc5dfbfa41 | ||
|
|
57b79b0b06 | ||
|
|
569130087f | ||
|
|
1a7b36b488 | ||
|
|
e8b5fd0425 | ||
|
|
626d5e7a8c | ||
|
|
4d94e84c13 | ||
|
|
863ec659ff | ||
|
|
071fdfc0a3 | ||
|
|
a137e9715a | ||
|
|
c28d1d34ff | ||
|
|
1230022d17 | ||
|
|
9a9f2a8d70 | ||
|
|
f51da1a948 | ||
|
|
c1ac592855 | ||
|
|
371103908b | ||
|
|
a2a029bb28 | ||
|
|
9266fba415 | ||
|
|
0963e2f564 | ||
|
|
72a5906a9b | ||
|
|
4dbd54c495 | ||
|
|
6219acb15c | ||
|
|
c4179bef5d | ||
|
|
117a1eaab8 | ||
|
|
78e31e4fb9 | ||
|
|
3da86fd745 |
No files matched your search
@@ -1,5 +1,7 @@
|
||||
[*.{kt,kts}]
|
||||
ij_kotlin_imports_layout = *
|
||||
ij_kotlin_line_break_after_multiline_when_entry = false
|
||||
ktlint_code_style = intellij_idea
|
||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||
ktlint_standard_class-signature = disabled
|
||||
ktlint_standard_mixed-condition-operators = disabled
|
||||
@@ -1 +0,0 @@
|
||||
*.sh eol=lf
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
workspaces: "./app/src/main/rust"
|
||||
|
||||
- name: CMake Cache
|
||||
uses: actions/cache/restore@v4
|
||||
uses: actions/cache/restore@v5
|
||||
with:
|
||||
path: app/.cxx
|
||||
key: cmake-
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
|
||||
- name: Upload reports
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: reports
|
||||
path: benchmark/build/reports
|
||||
+15
-15
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
cache-encryption-key: ${{ secrets.GradleEncryptionKey }}
|
||||
|
||||
- name: CMake Cache
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: app/.cxx
|
||||
key: cmake-default-${{ hashFiles('rust-toolchain.toml', 'settings.gradle.kts', 'app/src/main/cpp/CMakeLists.txt', 'app/src/main/rust/Cargo.lock') }}
|
||||
@@ -93,32 +93,32 @@ jobs:
|
||||
run: ./gradlew assembleDefaultRelease
|
||||
|
||||
- name: Upload ARM64
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: default-arm64-v8a-${{ github.sha }}
|
||||
path: app/build/outputs/apk/default/release/app-default-arm64-v8a-release.apk
|
||||
|
||||
- name: Upload x86_64
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: default-x86_64-${{ github.sha }}
|
||||
path: app/build/outputs/apk/default/release/app-default-x86_64-release.apk
|
||||
|
||||
- name: Upload ARM32
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: default-armeabi-v7a-${{ github.sha }}
|
||||
path: app/build/outputs/apk/default/release/app-default-armeabi-v7a-release.apk
|
||||
|
||||
- name: Upload mapping
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: default-mapping-${{ github.sha }}
|
||||
path: app/build/outputs/mapping/defaultRelease
|
||||
|
||||
- name: Upload native debug symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: default-native-debug-symbols-${{ github.sha }}
|
||||
path: app/build/outputs/native-debug-symbols/defaultRelease/native-debug-symbols.zip
|
||||
@@ -127,7 +127,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
@@ -151,7 +151,7 @@ jobs:
|
||||
cache-encryption-key: ${{ secrets.GradleEncryptionKey }}
|
||||
|
||||
- name: CMake Cache
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: app/.cxx
|
||||
key: cmake-marshmallow-${{ hashFiles('rust-toolchain.toml', 'settings.gradle.kts', 'app/src/main/cpp/CMakeLists.txt', 'app/src/main/rust/Cargo.lock') }}
|
||||
@@ -165,32 +165,32 @@ jobs:
|
||||
run: ./gradlew assembleMarshmallowRelease
|
||||
|
||||
- name: Upload ARM64
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: marshmallow-arm64-v8a-${{ github.sha }}
|
||||
path: app/build/outputs/apk/marshmallow/release/app-marshmallow-arm64-v8a-release.apk
|
||||
|
||||
- name: Upload x86_64
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: marshmallow-x86_64-${{ github.sha }}
|
||||
path: app/build/outputs/apk/marshmallow/release/app-marshmallow-x86_64-release.apk
|
||||
|
||||
- name: Upload ARM32
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: marshmallow-armeabi-v7a-${{ github.sha }}
|
||||
path: app/build/outputs/apk/marshmallow/release/app-marshmallow-armeabi-v7a-release.apk
|
||||
|
||||
- name: Upload mapping
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: marshmallow-mapping-${{ github.sha }}
|
||||
path: app/build/outputs/mapping/marshmallowRelease
|
||||
|
||||
- name: Upload native debug symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: marshmallow-native-debug-symbols-${{ github.sha }}
|
||||
path: app/build/outputs/native-debug-symbols/marshmallowRelease/native-debug-symbols.zip
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v5
|
||||
- uses: dessant/lock-threads@v6
|
||||
with:
|
||||
issue-inactive-days: '1'
|
||||
process-only: 'issues'
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
workspaces: "./app/src/main/rust"
|
||||
|
||||
- name: CMake Cache
|
||||
uses: actions/cache/restore@v4
|
||||
uses: actions/cache/restore@v5
|
||||
with:
|
||||
path: app/.cxx
|
||||
key: cmake-
|
||||
|
||||
@@ -1,5 +1,39 @@
|
||||
# 变更日志
|
||||
|
||||
## [1.14.6] - 2025-12-17
|
||||
|
||||
### 新功能
|
||||
|
||||
* 支持显示画廊阅读进度(于 EH 设置中开启) [#2277](https://github.com/FooIbar/EhViewer/issues/2277)
|
||||
|
||||
### 改进
|
||||
|
||||
* 画廊列表变化时重新显示悬浮操作按钮 [#2681](https://github.com/FooIbar/EhViewer/issues/2681)
|
||||
* 移除文件名中的尾随空格和点以兼容 Windows [#2727](https://github.com/FooIbar/EhViewer/issues/2727)
|
||||
* 长按画廊详情中的标签时显示标签名称 [#2769](https://github.com/FooIbar/EhViewer/issues/2769)
|
||||
* 杂项优化
|
||||
|
||||
### Bug 修复
|
||||
|
||||
* 对话框中的下拉菜单显示错位
|
||||
* HTTP 状态错误显示为“什么都没有找到”
|
||||
* 某些老设备无法通过 Cloudflare 验证 [#2794](https://github.com/FooIbar/EhViewer/issues/2794)
|
||||
* 杂项修复
|
||||
|
||||
|
||||
## [1.14.5] - 2025-10-19
|
||||
|
||||
### 改进
|
||||
|
||||
* [阅读器] 显示画廊标题
|
||||
* [阅读器] 显示菜单时改变标题栏颜色
|
||||
|
||||
### Bug 修复
|
||||
|
||||
* 横屏模式下打开阅读器设置会闪退 [#2673](https://github.com/FooIbar/EhViewer/issues/2673)
|
||||
* 强制横屏时竖直拿取设备加载图片会横竖屏乱跳 [#2674](https://github.com/FooIbar/EhViewer/issues/2674)
|
||||
|
||||
|
||||
## [1.14.4] - 2025-10-12
|
||||
|
||||
### 改进
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</p>
|
||||
|
||||
<h1 align="center">
|
||||
<img src="https://github.com/Ehviewer-Overhauled/Art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<img src="https://github.com/FooIbar/EhViewer-art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<br>EhViewer<br>
|
||||
</h1>
|
||||
|
||||
@@ -78,13 +78,13 @@ and [Dynamic Color](https://m3.material.io/styles/color/dynamic-color/overview)
|
||||
*Devices running Android 6 need to have the [ISRG Root X1](https://letsencrypt.org/certs/isrgrootx1.pem) certificate installed
|
||||
|
||||
<a href="https://github.com/FooIbar/EhViewer/releases">
|
||||
<img alt="Get it on GitHub" src="https://github.com/Ehviewer-Overhauled/Art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
<img alt="Get it on GitHub" src="https://github.com/FooIbar/EhViewer-art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
</a>
|
||||
|
||||
# Screenshot
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# Thanks
|
||||
|
||||
|
||||
@@ -52,18 +52,15 @@ android {
|
||||
}.standardOutput.asText.get().trim().removePrefix("https://github.com/").removePrefix("git@github.com:")
|
||||
.removeSuffix(".git")
|
||||
|
||||
val chromeVersion = rootProject.layout.projectDirectory.file("chrome.version").asFile.readText().trim()
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "moe.tarsin.ehviewer"
|
||||
versionCode = 180063
|
||||
versionName = "1.14.4"
|
||||
versionName = "1.14.6"
|
||||
// versionNameSuffix = "-SNAPSHOT"
|
||||
buildConfigField("String", "RAW_VERSION_NAME", "\"$versionName${versionNameSuffix.orEmpty()}\"")
|
||||
buildConfigField("String", "COMMIT_SHA", "\"$commitSha\"")
|
||||
buildConfigField("long", "COMMIT_TIME", commitTime)
|
||||
buildConfigField("String", "REPO_NAME", "\"$repoName\"")
|
||||
buildConfigField("String", "CHROME_VERSION", "\"$chromeVersion\"")
|
||||
ndk {
|
||||
if (isRelease) {
|
||||
abiFilters.addAll(supportedAbis)
|
||||
@@ -179,10 +176,7 @@ dependencies {
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.androidx.biometric)
|
||||
implementation(libs.androidx.browser)
|
||||
|
||||
// https://developer.android.com/jetpack/androidx/releases/compose-material3
|
||||
api(platform(libs.compose.bom))
|
||||
implementation(libs.bundles.compose)
|
||||
implementation(libs.androidx.webkit)
|
||||
|
||||
implementation(libs.compose.destinations.core)
|
||||
ksp(libs.compose.destinations.compiler)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:banner="@mipmap/ic_leanback_banner"
|
||||
android:configChanges="screenSize"
|
||||
android:configChanges="orientation|screenLayout|screenSize|smallestScreenSize"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppTheme.Splash"
|
||||
|
||||
@@ -4,17 +4,20 @@ include(ExternalProject)
|
||||
include(FetchContent)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Ofast -fvisibility=hidden -fvisibility-inlines-hidden -funroll-loops -flto \
|
||||
-mllvm -polly \
|
||||
-mllvm -polly-run-dce \
|
||||
-mllvm -polly-run-inliner \
|
||||
-mllvm -polly-isl-arg=--no-schedule-serialize-sccs \
|
||||
-mllvm -polly-ast-use-context \
|
||||
-mllvm -polly-detect-keep-going \
|
||||
-mllvm -polly-position=before-vectorizer \
|
||||
-mllvm -polly-vectorizer=stripmine \
|
||||
-mllvm -polly-detect-profitability-min-per-loop-insts=40 \
|
||||
-mllvm -polly-invariant-load-hoisting")
|
||||
string(CONCAT CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -ffast-math -fvisibility=hidden -fvisibility-inlines-hidden -funroll-loops -flto "
|
||||
"-ffile-prefix-map=${ANDROID_TOOLCHAIN_ROOT}= "
|
||||
"-ffile-prefix-map=${CMAKE_SOURCE_DIR}= "
|
||||
"-ffile-prefix-map=${CMAKE_BINARY_DIR}= "
|
||||
"-mllvm -polly "
|
||||
"-mllvm -polly-run-dce "
|
||||
"-mllvm -polly-run-inliner "
|
||||
"-mllvm -polly-isl-arg=--no-schedule-serialize-sccs "
|
||||
"-mllvm -polly-ast-use-context "
|
||||
"-mllvm -polly-detect-keep-going "
|
||||
"-mllvm -polly-position=before-vectorizer "
|
||||
"-mllvm -polly-vectorizer=stripmine "
|
||||
"-mllvm -polly-detect-profitability-min-per-loop-insts=40 "
|
||||
"-mllvm -polly-invariant-load-hoisting")
|
||||
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
||||
option(BUILD_TESTING OFF)
|
||||
@@ -38,23 +41,25 @@ include_directories(${liblzma_SOURCE_DIR}/src/liblzma/api)
|
||||
|
||||
# Build GNUTLS libnettle
|
||||
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
execute_process(
|
||||
COMMAND wsl wslpath ${CMAKE_CURRENT_LIST_DIR}
|
||||
OUTPUT_VARIABLE CURRENT_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(NDK_VERSION "${ANDROID_NDK_MAJOR}.${ANDROID_NDK_MINOR}.${ANDROID_NDK_BUILD}")
|
||||
set(TOOLCHAIN "$ANDROID_HOME/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/linux-x86_64/bin")
|
||||
set(WSL wsl)
|
||||
else ()
|
||||
set(CURRENT_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(TOOLCHAIN "${ANDROID_TOOLCHAIN_ROOT}/bin")
|
||||
endif ()
|
||||
set(NDK_VERSION "${ANDROID_NDK_MAJOR}.${ANDROID_NDK_MINOR}.${ANDROID_NDK_BUILD}")
|
||||
set(CONFIGURE_COMMAND ./configure --disable-public-key --disable-dependency-tracking
|
||||
"--host=${CMAKE_C_COMPILER_TARGET}"
|
||||
"CFLAGS=${CMAKE_C_FLAGS} -Qunused-arguments"
|
||||
"AR=${TOOLCHAIN}/llvm-ar"
|
||||
"CC=${TOOLCHAIN}/clang --target=${CMAKE_C_COMPILER_TARGET}"
|
||||
"RANLIB=${TOOLCHAIN}/llvm-ranlib"
|
||||
)
|
||||
ExternalProject_Add(
|
||||
nettle
|
||||
GIT_REPOSITORY https://gitlab.com/gnutls/nettle.git
|
||||
GIT_TAG nettle_3.10.2_release_20250626
|
||||
GIT_SHALLOW 1
|
||||
GIT_CONFIG core.autocrlf=input
|
||||
CONFIGURE_COMMAND bash ${CURRENT_DIR}/configure_nettle.sh ${NDK_VERSION} ${CMAKE_C_COMPILER_TARGET}
|
||||
BUILD_COMMAND bash -c "make -j4 libnettle.a CFLAGS='${CMAKE_C_FLAGS} -Qunused-arguments'"
|
||||
URL https://ftpmirror.gnu.org/nettle/nettle-3.10.2.tar.gz
|
||||
URL_MD5 b28bcbf6f045ff007940a9401673600d
|
||||
CONFIGURE_COMMAND ${WSL} ${CONFIGURE_COMMAND}
|
||||
BUILD_COMMAND ${WSL} make -j4 libnettle.a
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_BYPRODUCTS <SOURCE_DIR>/libnettle.a
|
||||
@@ -96,7 +101,7 @@ set(LIBARCHIVE_PATCH
|
||||
FetchContent_Declare(
|
||||
libarchive
|
||||
GIT_REPOSITORY https://github.com/libarchive/libarchive.git
|
||||
GIT_TAG v3.8.1
|
||||
GIT_TAG v3.8.4
|
||||
GIT_SHALLOW 1
|
||||
PATCH_COMMAND git apply --check -R ${LIBARCHIVE_PATCH} || git apply ${LIBARCHIVE_PATCH}
|
||||
)
|
||||
@@ -134,7 +139,7 @@ unset(Rust_TOOLCHAIN CACHE)
|
||||
FetchContent_Declare(
|
||||
Corrosion
|
||||
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
|
||||
GIT_TAG v0.5.2
|
||||
GIT_TAG v0.6
|
||||
GIT_SHALLOW 1
|
||||
)
|
||||
|
||||
@@ -145,7 +150,7 @@ corrosion_import_crate(
|
||||
FEATURES $<IF:$<VERSION_GREATER_EQUAL:${ANDROID_NATIVE_API_LEVEL},26>,android-26,android>
|
||||
FLAGS $<$<NOT:$<CONFIG:Debug>>:-Z build-std -Z build-std-features=>
|
||||
)
|
||||
corrosion_add_target_rustflags(ehviewer_rust $<$<NOT:$<CONFIG:Debug>>:-Z unstable-options -C panic=immediate-abort>)
|
||||
corrosion_add_target_rustflags(ehviewer_rust $<$<NOT:$<CONFIG:Debug>>:-Z unstable-options -C panic=immediate-abort -Z location-detail=none -Z fmt-debug=none>)
|
||||
corrosion_link_libraries(ehviewer_rust android jnigraphics log webp webpdemux)
|
||||
|
||||
# Build and link our app's native lib
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
SUFFIX=toolchains/llvm/prebuilt/$(uname -s | tr '[:upper:]' '[:lower:]')-x86_64/bin
|
||||
CI_NDK_LOCATION=$ANDROID_HOME/ndk/$1/$SUFFIX
|
||||
ARCH_NDK_LOCATION=$ANDROID_HOME/ndk-bundle/$SUFFIX
|
||||
if test -e $CI_NDK_LOCATION ;then
|
||||
TOOLCHAIN=$CI_NDK_LOCATION
|
||||
else
|
||||
TOOLCHAIN=$ARCH_NDK_LOCATION
|
||||
fi
|
||||
TARGET=$2
|
||||
./.bootstrap && ./configure --host=$TARGET --disable-public-key --disable-dependency-tracking \
|
||||
AR=$TOOLCHAIN/llvm-ar \
|
||||
CC="$TOOLCHAIN/clang -target $TARGET" \
|
||||
RANLIB=$TOOLCHAIN/llvm-ranlib
|
||||
@@ -180,7 +180,6 @@ fun WebView(
|
||||
is WebContent.Url -> {
|
||||
wv.loadUrl(content.url, content.additionalHttpHeaders)
|
||||
}
|
||||
|
||||
is WebContent.Data -> {
|
||||
wv.loadDataWithBaseURL(
|
||||
content.baseUrl,
|
||||
@@ -190,14 +189,12 @@ fun WebView(
|
||||
content.historyUrl,
|
||||
)
|
||||
}
|
||||
|
||||
is WebContent.Post -> {
|
||||
wv.postUrl(
|
||||
content.url,
|
||||
content.postData,
|
||||
)
|
||||
}
|
||||
|
||||
is WebContent.NavigatorOnly -> {
|
||||
// NO-OP
|
||||
}
|
||||
@@ -502,11 +499,9 @@ class WebViewNavigator(private val coroutineScope: CoroutineScope) {
|
||||
event.encoding,
|
||||
event.historyUrl,
|
||||
)
|
||||
|
||||
is NavigationEvent.LoadUrl -> {
|
||||
loadUrl(event.url, event.additionalHttpHeaders)
|
||||
}
|
||||
|
||||
is NavigationEvent.PostUrl -> {
|
||||
postUrl(event.url, event.postData)
|
||||
}
|
||||
|
||||
@@ -39,12 +39,12 @@ import coil3.request.crossfade
|
||||
import coil3.serviceLoaderEnabled
|
||||
import coil3.util.DebugLogger
|
||||
import com.ehviewer.core.database.SearchDatabase
|
||||
import com.ehviewer.core.database.roomDb
|
||||
import com.ehviewer.core.files.deleteContent
|
||||
import com.ehviewer.core.ui.util.initSETConnection
|
||||
import com.ehviewer.core.util.isAtLeastO
|
||||
import com.ehviewer.core.util.isAtLeastP
|
||||
import com.ehviewer.core.util.isAtLeastS
|
||||
import com.ehviewer.core.util.isAtLeastSExtension7
|
||||
import com.ehviewer.core.util.launchIO
|
||||
import com.ehviewer.core.util.logcat
|
||||
import com.ehviewer.core.util.withUIContext
|
||||
@@ -65,6 +65,7 @@ import com.hippo.ehviewer.ktbuilder.imageLoader
|
||||
import com.hippo.ehviewer.ktor.Cronet
|
||||
import com.hippo.ehviewer.ktor.configureClient
|
||||
import com.hippo.ehviewer.ktor.configureCommon
|
||||
import com.hippo.ehviewer.ktor.isCronetAvailable
|
||||
import com.hippo.ehviewer.ui.keepNoMediaFileStatus
|
||||
import com.hippo.ehviewer.ui.lockObserver
|
||||
import com.hippo.ehviewer.ui.screen.detailCache
|
||||
@@ -83,7 +84,6 @@ import logcat.LogPriority
|
||||
import logcat.LogcatLogger
|
||||
import logcat.asLog
|
||||
import okio.Path.Companion.toOkioPath
|
||||
import splitties.arch.room.roomDb
|
||||
import splitties.init.appCtx
|
||||
|
||||
private val lifecycle = ProcessLifecycleOwner.get().lifecycle
|
||||
@@ -146,6 +146,8 @@ class EhApplication : Application(), SingletonImageLoader.Factory {
|
||||
if (BuildConfig.DEBUG) {
|
||||
StrictMode.enableDefaults()
|
||||
Composer.setDiagnosticStackTraceMode(ComposeStackTraceMode.SourceInformation)
|
||||
} else {
|
||||
Composer.setDiagnosticStackTraceMode(ComposeStackTraceMode.Auto)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +220,7 @@ class EhApplication : Application(), SingletonImageLoader.Factory {
|
||||
private set
|
||||
|
||||
val ktorClient by lazy {
|
||||
if (isAtLeastSExtension7 && Settings.enableCronet.value) {
|
||||
if (isCronetAvailable && Settings.enableCronet.value) {
|
||||
HttpClient(Cronet) {
|
||||
engine { configureClient(Settings.enableQuic.value) }
|
||||
configureCommon()
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
*/
|
||||
package com.hippo.ehviewer
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import androidx.room.execSQL
|
||||
import androidx.room.useWriterConnection
|
||||
import arrow.fx.coroutines.resource
|
||||
import arrow.fx.coroutines.resourceScope
|
||||
import com.ehviewer.core.data.model.asEntity
|
||||
import com.ehviewer.core.database.EhDatabase
|
||||
import com.ehviewer.core.database.Schema17to18
|
||||
import com.ehviewer.core.database.getDatabasePath
|
||||
import com.ehviewer.core.database.model.DownloadArtist
|
||||
import com.ehviewer.core.database.model.DownloadDirname
|
||||
import com.ehviewer.core.database.model.DownloadInfo
|
||||
@@ -32,13 +33,13 @@ import com.ehviewer.core.database.model.HistoryInfo
|
||||
import com.ehviewer.core.database.model.LocalFavoriteInfo
|
||||
import com.ehviewer.core.database.model.ProgressInfo
|
||||
import com.ehviewer.core.database.model.QuickSearch
|
||||
import com.ehviewer.core.database.roomDb
|
||||
import com.ehviewer.core.files.delete
|
||||
import com.ehviewer.core.files.sendTo
|
||||
import com.ehviewer.core.model.GalleryInfo
|
||||
import com.hippo.ehviewer.download.DownloadManager
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import okio.Path
|
||||
import okio.Path.Companion.toOkioPath
|
||||
import splitties.arch.room.roomDb
|
||||
|
||||
object EhDB {
|
||||
private const val DB_NAME = "eh.db"
|
||||
@@ -277,23 +278,26 @@ object EhDB {
|
||||
db.filterDao().update(filter)
|
||||
}
|
||||
|
||||
fun exportDB(context: Context, file: Path) {
|
||||
db.query("PRAGMA wal_checkpoint(FULL)", null).use { it.moveToNext() }
|
||||
val dbFile = context.getDatabasePath(DB_NAME)
|
||||
dbFile.toOkioPath() sendTo file
|
||||
suspend fun exportDB(file: Path) {
|
||||
db.useWriterConnection { conn ->
|
||||
conn.execSQL("PRAGMA wal_checkpoint(FULL)")
|
||||
conn.execSQL("VACUUM")
|
||||
}
|
||||
val dbFile = getDatabasePath(DB_NAME)
|
||||
dbFile sendTo file
|
||||
}
|
||||
|
||||
suspend fun importDB(context: Context, uri: Uri) = resourceScope {
|
||||
suspend fun importDB(file: Path) = resourceScope {
|
||||
val tempDBName = "tmp.db"
|
||||
val dbFile = getDatabasePath(tempDBName)
|
||||
file sendTo dbFile
|
||||
val oldDB = resource {
|
||||
context.deleteDatabase(tempDBName)
|
||||
roomDb<EhDatabase>(tempDBName) {
|
||||
createFromInputStream { context.contentResolver.openInputStream(uri) }
|
||||
addMigrations(Schema17to18())
|
||||
}
|
||||
} release { db ->
|
||||
db.close()
|
||||
context.deleteDatabase(tempDBName)
|
||||
dbFile.delete()
|
||||
}
|
||||
|
||||
db.galleryDao().insertOrIgnore(oldDB.galleryDao().list())
|
||||
|
||||
@@ -9,10 +9,10 @@ import androidx.compose.runtime.Stable
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.remember
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.ehviewer.core.preferences.DataStorePreferences
|
||||
import com.ehviewer.core.preferences.PrefDelegate
|
||||
import com.ehviewer.core.preferences.edit
|
||||
import com.hippo.ehviewer.client.EhCookieStore
|
||||
import com.hippo.ehviewer.client.data.FavListUrlBuilder
|
||||
import com.hippo.ehviewer.download.DownloadsFilterMode
|
||||
import com.hippo.ehviewer.download.SortMode
|
||||
@@ -82,6 +82,7 @@ object Settings : DataStorePreferences(null) {
|
||||
val detailSize = intPref("detail_size_2", 0)
|
||||
val thumbColumns = intPref("thumb_columns", 3)
|
||||
val showGalleryPages = boolPref("show_gallery_pages", true)
|
||||
val showReadingProgress = boolPref("show_reading_progress", false)
|
||||
val showVoteStatus = boolPref("show_vote_status", false)
|
||||
val showComments = boolPref("show_gallery_comments", true)
|
||||
val commentThreshold = intPref("comment_threshold", -100)
|
||||
@@ -194,6 +195,10 @@ object Settings : DataStorePreferences(null) {
|
||||
if (pref[downloadFilterMode] == DownloadsFilterMode.ARTIST.flag && pref[recentDownloadLabel] == null) {
|
||||
pref[recentDownloadLabel] = ""
|
||||
}
|
||||
val orientation = pref[orientationMode]
|
||||
if (OrientationType.entries.none { it.prefValue == orientation }) {
|
||||
pref.remove(orientationMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import arrow.fx.coroutines.parZip
|
||||
import com.ehviewer.core.i18n.R
|
||||
import com.ehviewer.core.model.BaseGalleryInfo
|
||||
import com.ehviewer.core.model.GalleryInfo
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.ehviewer.core.util.logcat
|
||||
import com.hippo.ehviewer.EhDB
|
||||
import com.hippo.ehviewer.Settings
|
||||
@@ -31,6 +32,7 @@ import com.hippo.ehviewer.client.data.FavListUrlBuilder
|
||||
import com.hippo.ehviewer.client.data.fillInfo
|
||||
import com.hippo.ehviewer.client.data.filterComments
|
||||
import com.hippo.ehviewer.client.exception.CloudflareBypassException
|
||||
import com.hippo.ehviewer.client.exception.EhError
|
||||
import com.hippo.ehviewer.client.exception.EhException
|
||||
import com.hippo.ehviewer.client.exception.InsufficientFundsException
|
||||
import com.hippo.ehviewer.client.exception.InsufficientGpException
|
||||
@@ -69,6 +71,7 @@ import io.ktor.client.statement.HttpStatement
|
||||
import io.ktor.client.statement.bodyAsChannel
|
||||
import io.ktor.client.statement.request
|
||||
import io.ktor.http.Url
|
||||
import io.ktor.util.moveToByteArray
|
||||
import io.ktor.utils.io.pool.DirectByteBufferPool
|
||||
import io.ktor.utils.io.pool.useInstance
|
||||
import io.ktor.utils.io.readAvailable
|
||||
@@ -79,6 +82,8 @@ import kotlin.system.measureTimeMillis
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.serialization.SerializationException
|
||||
import kotlinx.serialization.cbor.Cbor
|
||||
import kotlinx.serialization.decodeFromByteArray
|
||||
import kotlinx.serialization.json.add
|
||||
import kotlinx.serialization.json.addJsonArray
|
||||
import kotlinx.serialization.json.put
|
||||
@@ -127,27 +132,30 @@ private fun rethrowExactly(response: HttpResponse, body: Either<String, ByteBuff
|
||||
throw IpBannedException(message)
|
||||
}
|
||||
|
||||
// Check parse error thrown by rust
|
||||
val cause = e.cause
|
||||
if (e is ParseException && cause is RuntimeException) {
|
||||
when (val message = cause.message) {
|
||||
"0" -> throw NoHitsFoundException()
|
||||
"1" -> throw EhException(R.string.gallery_list_empty_hit_subscription)
|
||||
"2" -> throw NotLoggedInException()
|
||||
"3" -> throw NoHathClientException()
|
||||
"4" -> throw InsufficientFundsException()
|
||||
is String if message.isNotEmpty() -> {
|
||||
when (message[0]) {
|
||||
'5' -> throw IpBannedException(message.substring(1))
|
||||
'6' -> throw EhException(message.substring(1))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Parse error from rust
|
||||
val error = body.getOrNull()?.runCatching {
|
||||
val array = moveToByteArray()
|
||||
rewind()
|
||||
Cbor.decodeFromByteArray<EhError>(array)
|
||||
}?.getOrNull()
|
||||
|
||||
// Check Gallery Not Available - 404
|
||||
if (error is EhError.GalleryUnavailable) throw EhException(error.message)
|
||||
|
||||
// Check bad response code
|
||||
response.status.ensureSuccess()
|
||||
|
||||
when (error) {
|
||||
EhError.NoHits -> throw NoHitsFoundException()
|
||||
EhError.NoWatched -> throw EhException(R.string.gallery_list_empty_hit_subscription)
|
||||
EhError.NeedLogin -> throw NotLoggedInException()
|
||||
EhError.NoHathClient -> throw NoHathClientException()
|
||||
EhError.InsufficientFunds -> throw InsufficientFundsException()
|
||||
is EhError.IpBanned -> throw IpBannedException(error.message)
|
||||
is EhError.Error -> throw EhException(error.message)
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
if (e is ParseException || e is SerializationException) {
|
||||
body.onLeft { if ("<" !in it) throw IpBannedException(it) }
|
||||
if (Settings.saveParseErrorBody.value) body.saveParseError(e)
|
||||
|
||||
@@ -20,15 +20,19 @@ import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Environment
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.core.net.toUri
|
||||
import arrow.core.memoize
|
||||
import com.ehviewer.core.model.GalleryDetail
|
||||
import com.ehviewer.core.model.GalleryInfo
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.ehviewer.core.util.withUIContext
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.client.parser.Archive
|
||||
@@ -39,6 +43,7 @@ import com.hippo.ehviewer.util.addTextToClipboard
|
||||
import com.materialkolor.hct.Hct
|
||||
import com.materialkolor.ktx.from
|
||||
import com.materialkolor.ktx.toColor
|
||||
import com.materialkolor.utils.ColorUtils.lstarFromArgb
|
||||
import splitties.systemservices.downloadManager
|
||||
|
||||
object EhUtils {
|
||||
@@ -151,7 +156,13 @@ object EhUtils {
|
||||
}
|
||||
}
|
||||
|
||||
val categoryTextColor = Color(0xffe6e0e9)
|
||||
@ReadOnlyComposable
|
||||
@Composable
|
||||
fun getCategoryTextColor(color: Color) = if (isSystemInDarkTheme() == lstarFromArgb(color.toArgb()) > 70) {
|
||||
MaterialTheme.colorScheme.surface
|
||||
} else {
|
||||
LocalContentColor.current
|
||||
}
|
||||
|
||||
val favoriteIconColor = Color(0xffff3040)
|
||||
|
||||
|
||||
@@ -212,7 +212,6 @@ data class ListUrlBuilder(
|
||||
}
|
||||
}
|
||||
}.buildString()
|
||||
|
||||
MODE_UPLOADER, MODE_TAG -> {
|
||||
val path = if (mode == MODE_UPLOADER) "uploader" else "tag"
|
||||
ehUrl(listOf(path, requireNotNull(mKeyword))) {
|
||||
@@ -222,7 +221,6 @@ data class ListUrlBuilder(
|
||||
addQueryParameterIfNotBlank("range", range.takeIf { it > 0 }?.toString())
|
||||
}.buildString()
|
||||
}
|
||||
|
||||
MODE_WHATS_HOT -> EhUrl.popularUrl
|
||||
MODE_IMAGE_SEARCH -> ehUrl {
|
||||
addQueryParameter("f_shash", requireNotNull(hash))
|
||||
@@ -231,7 +229,6 @@ data class ListUrlBuilder(
|
||||
addQueryParameter("tl", requireNotNull(mKeyword))
|
||||
addQueryParameterIfNotBlank("p", jumpTo)
|
||||
}.buildString()
|
||||
|
||||
else -> throw IllegalStateException("Unexpected value: $mode")
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.hippo.ehviewer.client.exception
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.cbor.CborArray
|
||||
|
||||
@Serializable
|
||||
sealed interface EhError {
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("NoHits")
|
||||
data object NoHits : EhError
|
||||
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("NoWatched")
|
||||
data object NoWatched : EhError
|
||||
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("NeedLogin")
|
||||
data object NeedLogin : EhError
|
||||
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("NoHathClient")
|
||||
data object NoHathClient : EhError
|
||||
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("InsufficientFunds")
|
||||
data object InsufficientFunds : EhError
|
||||
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("GalleryUnavailable")
|
||||
data class GalleryUnavailable(val message: String) : EhError
|
||||
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("IpBanned")
|
||||
data class IpBanned(val message: String) : EhError
|
||||
|
||||
@CborArray
|
||||
@Serializable
|
||||
@SerialName("Error")
|
||||
data class Error(val message: String) : EhError
|
||||
}
|
||||
@@ -26,7 +26,7 @@ object GalleryListUrlParser {
|
||||
fun parse(urlStr: String) = Either.catch {
|
||||
val url = Url(urlStr)
|
||||
if (url.host != EhUrl.DOMAIN_E && url.host != EhUrl.DOMAIN_EX) {
|
||||
return null
|
||||
return@catch null
|
||||
}
|
||||
val segments = url.segments
|
||||
if (segments.isEmpty()) {
|
||||
@@ -42,7 +42,6 @@ object GalleryListUrlParser {
|
||||
mode = if (head == "uploader") ListUrlBuilder.MODE_UPLOADER else ListUrlBuilder.MODE_TAG
|
||||
keyword = segments[1].decodeURLQueryComponent(plusIsSpace = true)
|
||||
}
|
||||
|
||||
"toplist.php" -> {
|
||||
val tl = url.parameters["tl"]
|
||||
if (tl != null && tl in arrayOf("11", "12", "13", "15")) {
|
||||
@@ -55,7 +54,6 @@ object GalleryListUrlParser {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
val category = EhUtils.getCategory(head)
|
||||
if (category != EhUtils.UNKNOWN) {
|
||||
|
||||
@@ -148,7 +148,7 @@ object DownloadManager : OnSpiderListener, CoroutineScope {
|
||||
mCurrentTask = info
|
||||
with(info) {
|
||||
archiveFile?.let {
|
||||
return onFinish(pages, pages, pages)
|
||||
return onFinish(pages, pages, pages, failed = false)
|
||||
}
|
||||
state = DownloadInfo.STATE_DOWNLOAD
|
||||
speed = -1
|
||||
@@ -682,7 +682,7 @@ object DownloadManager : OnSpiderListener, CoroutineScope {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish(finished: Int, downloaded: Int, total: Int) {
|
||||
override fun onFinish(finished: Int, downloaded: Int, total: Int, failed: Boolean) {
|
||||
launch {
|
||||
mSpeedReminder.onFinish()
|
||||
mCurrentSpider?.let { spider ->
|
||||
@@ -697,11 +697,7 @@ object DownloadManager : OnSpiderListener, CoroutineScope {
|
||||
info.downloaded = downloaded
|
||||
info.total = total
|
||||
info.legacy = total - finished
|
||||
if (info.legacy == 0) {
|
||||
info.state = DownloadInfo.STATE_FINISH
|
||||
} else {
|
||||
info.state = DownloadInfo.STATE_FAILED
|
||||
}
|
||||
info.state = if (failed) DownloadInfo.STATE_FAILED else DownloadInfo.STATE_FINISH
|
||||
EhDB.putDownloadInfo(info)
|
||||
mDownloadListener?.onFinish(info)
|
||||
mutableNotifyFlow.emit(info)
|
||||
|
||||
@@ -113,14 +113,12 @@ class DownloadService :
|
||||
val label = intent.getStringExtra(KEY_LABEL)
|
||||
deferredMgr.await().startDownload(decodeFromSavedState(gi), label)
|
||||
}
|
||||
|
||||
ACTION_START_RANGE -> {
|
||||
val gidList = intent.getLongArrayExtra(KEY_GID_LIST)
|
||||
if (gidList != null) {
|
||||
deferredMgr.await().startRangeDownload(gidList)
|
||||
}
|
||||
}
|
||||
|
||||
ACTION_START_ALL -> deferredMgr.await().startAllDownload()
|
||||
ACTION_STOP_ALL -> deferredMgr.await().stopAllDownload()
|
||||
ACTION_CLEAR -> clear()
|
||||
@@ -388,7 +386,6 @@ class DownloadService :
|
||||
notifyManager.notify(id, builder.build())
|
||||
}
|
||||
}
|
||||
|
||||
Ops.Cancel -> notifyManager.cancel(id)
|
||||
Ops.StartForeground -> service.startForeground(id, builder.build())
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@ package com.hippo.ehviewer.gallery
|
||||
|
||||
import arrow.autoCloseScope
|
||||
import com.ehviewer.core.files.openFileDescriptor
|
||||
import com.ehviewer.core.model.GalleryInfo
|
||||
import com.ehviewer.core.util.logcat
|
||||
import com.hippo.ehviewer.Settings.archivePasswds
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.image.ImageSource
|
||||
import com.hippo.ehviewer.image.byteBufferSource
|
||||
import com.hippo.ehviewer.jni.closeArchive
|
||||
@@ -40,7 +42,7 @@ typealias PasswdProvider = suspend (PasswdInvalidator) -> String
|
||||
|
||||
suspend inline fun <T> useArchivePageLoader(
|
||||
file: Path,
|
||||
gid: Long = 0,
|
||||
info: GalleryInfo? = null,
|
||||
startPage: Int = 0,
|
||||
hasAds: Boolean = false,
|
||||
crossinline passwdProvider: PasswdProvider,
|
||||
@@ -49,7 +51,7 @@ suspend inline fun <T> useArchivePageLoader(
|
||||
coroutineScope {
|
||||
val pfd = install(file.openFileDescriptor("r"))
|
||||
val size = install(
|
||||
{ openArchive(pfd.fd, pfd.statSize, gid == 0L || file.name.endsWith(".zip")) },
|
||||
{ openArchive(pfd.fd, pfd.statSize, info == null || file.name.endsWith(".zip")) },
|
||||
{ _, _ -> closeArchive() },
|
||||
)
|
||||
check(size > 0) { "Archive have no content!" }
|
||||
@@ -57,8 +59,14 @@ suspend inline fun <T> useArchivePageLoader(
|
||||
archivePasswds += passwdProvider(::providePassword)
|
||||
}
|
||||
val loader = install(
|
||||
object : PageLoader(this, gid, startPage, size, hasAds) {
|
||||
override val title by lazy { FileUtils.getNameFromFilename(file.displayName)!! }
|
||||
object : PageLoader(this, info, startPage, size, hasAds) {
|
||||
override val title by lazy {
|
||||
if (info != null) {
|
||||
EhUtils.getSuitableTitle(info)
|
||||
} else {
|
||||
FileUtils.getNameFromFilename(file.displayName)!!
|
||||
}
|
||||
}
|
||||
|
||||
override fun getImageExtension(index: Int) = getExtension(index)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ suspend inline fun <T> useEhPageLoader(
|
||||
)
|
||||
queen.awaitReady()
|
||||
val loader = install(
|
||||
object : PageLoader(this, info.gid, startPage, queen.size, info.hasAds) {
|
||||
object : PageLoader(this, info, startPage, queen.size, info.hasAds) {
|
||||
override val title by lazy { EhUtils.getSuitableTitle(info) }
|
||||
|
||||
override fun getImageExtension(index: Int) = queen.getExtension(index)
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.collection.SieveCache
|
||||
import androidx.collection.mutableIntObjectMapOf
|
||||
import arrow.fx.coroutines.ExitCase
|
||||
import arrow.fx.coroutines.bracketCase
|
||||
import com.ehviewer.core.model.GalleryInfo
|
||||
import com.ehviewer.core.util.isAtLeastO
|
||||
import com.ehviewer.core.util.withNonCancellableContext
|
||||
import com.hippo.ehviewer.EhDB
|
||||
@@ -35,7 +36,7 @@ private val progressScope = CoroutineScope(Dispatchers.IO)
|
||||
private const val MAX_CACHE_SIZE = 512 * 1024 * 1024
|
||||
private const val MIN_CACHE_SIZE = 256 * 1024 * 1024
|
||||
|
||||
abstract class PageLoader(val scope: CoroutineScope, val gid: Long, startPage: Int, val size: Int, val hasAds: Boolean = false) : AutoCloseable {
|
||||
abstract class PageLoader(val scope: CoroutineScope, val info: GalleryInfo?, startPage: Int, val size: Int, val hasAds: Boolean = false) : AutoCloseable {
|
||||
var startPage = startPage.coerceIn(0, size - 1)
|
||||
|
||||
private val jobs = mutableIntObjectMapOf<Job>()
|
||||
@@ -111,14 +112,14 @@ abstract class PageLoader(val scope: CoroutineScope, val gid: Long, startPage: I
|
||||
|
||||
override fun close() {
|
||||
lock.write { cache.evictAll() }
|
||||
if (gid != 0L) {
|
||||
info?.run {
|
||||
progressScope.launch {
|
||||
EhDB.putReadProgress(gid, startPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract val title: String
|
||||
abstract val title: String
|
||||
|
||||
protected abstract fun getImageExtension(index: Int): String?
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ class Image private constructor(image: CoilImage, private val src: ImageSource)
|
||||
}
|
||||
src.right().decodeCoil(checkExtraneousAds)
|
||||
}
|
||||
|
||||
is ByteBufferSource -> {
|
||||
if (isAtLeastP && !isAtLeastU) {
|
||||
rewriteGifSource(src.source)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.hippo.ehviewer.ktor
|
||||
|
||||
import com.hippo.ehviewer.BuildConfig
|
||||
import androidx.webkit.WebViewCompat
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.client.EhCookieStore
|
||||
import io.ktor.client.HttpClientConfig
|
||||
import io.ktor.client.engine.HttpClientEngineConfig
|
||||
import io.ktor.client.plugins.HttpTimeout
|
||||
@@ -14,9 +14,12 @@ import io.ktor.client.request.header
|
||||
import io.ktor.http.HttpHeaders
|
||||
import io.ktor.http.userAgent
|
||||
import io.ktor.util.appendIfNameAbsent
|
||||
import splitties.init.appCtx
|
||||
|
||||
const val CHROME_MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${BuildConfig.CHROME_VERSION}.0.0.0 Mobile Safari/537.36"
|
||||
private const val CHROME_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${BuildConfig.CHROME_VERSION}.0.0.0 Safari/537.36"
|
||||
// It's safe to assume the WebView package will always be present as we require CookieManager anyway
|
||||
private val WebViewVersion = WebViewCompat.getCurrentWebViewPackage(appCtx)!!.versionName!!.substringBefore('.')
|
||||
val CHROME_MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/$WebViewVersion.0.0.0 Mobile Safari/537.36"
|
||||
private val CHROME_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/$WebViewVersion.0.0.0 Safari/537.36"
|
||||
private const val CHROME_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
|
||||
private const val CHROME_ACCEPT_LANGUAGE = "en-US,en;q=0.9"
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@ import android.net.http.UrlRequest
|
||||
import android.net.http.UrlResponseInfo
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresExtension
|
||||
import com.ehviewer.core.preferences.edit
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.util.restartApplication
|
||||
import io.ktor.client.engine.HttpClientEngineBase
|
||||
import io.ktor.client.engine.callContext
|
||||
import io.ktor.client.plugins.HttpTimeoutCapability
|
||||
@@ -103,15 +100,6 @@ class CronetEngine(override val config: CronetConfig) : HttpClientEngineBase("Cr
|
||||
}
|
||||
|
||||
override fun onFailed(request: UrlRequest, info: UrlResponseInfo?, error: HttpException) {
|
||||
// Cronet may crash on some devices, fuck xiaomi
|
||||
// https://github.com/FooIbar/EhViewer/issues/1826
|
||||
val message = error.message.orEmpty()
|
||||
if ("ERR_FILE_NOT_FOUND" in message || "ERR_PROXY_CONNECTION_FAILED" in message) {
|
||||
Settings.edit(true) {
|
||||
it[enableCronet] = false
|
||||
}
|
||||
with(config.context) { restartApplication() }
|
||||
}
|
||||
if (continuation.isActive) {
|
||||
continuation.resumeWithException(error)
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
@file:RequiresExtension(extension = Build.VERSION_CODES.S, version = 7)
|
||||
|
||||
package com.hippo.ehviewer.ktor
|
||||
|
||||
import android.net.http.HttpEngine
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresExtension
|
||||
import com.ehviewer.core.util.isAtLeastSExtension7
|
||||
import java.io.File
|
||||
|
||||
@RequiresExtension(extension = Build.VERSION_CODES.S, version = 7)
|
||||
fun CronetConfig.configureClient(enableQuic: Boolean) {
|
||||
config = {
|
||||
setEnableBrotli(true)
|
||||
@@ -24,3 +24,14 @@ fun CronetConfig.configureClient(enableQuic: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val isCronetAvailable: Boolean
|
||||
get() = isAtLeastSExtension7 && !isDeviceBlocked
|
||||
|
||||
// https://github.com/FooIbar/EhViewer/issues/1826
|
||||
private val isDeviceBlocked = when (Build.VERSION.INCREMENTAL.substringBefore('.')) {
|
||||
"V816", // HyperOS 1
|
||||
"OS2", // HyperOS 2
|
||||
-> true
|
||||
else -> false
|
||||
}
|
||||
@@ -68,7 +68,6 @@ fun GalleryInfo.getComicInfo(): ComicInfo {
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
else -> simpleTags?.forEach { tagString ->
|
||||
val (namespace, tag) = tagString.split(':', limit = 2)
|
||||
.takeIf { it.size == 2 } ?: return@forEach // Ignore temp tags that don't have namespace
|
||||
|
||||
@@ -56,7 +56,6 @@ import io.ktor.client.statement.request
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||
import kotlin.concurrent.read
|
||||
import kotlin.concurrent.write
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import okio.Path
|
||||
|
||||
class SpiderDen(val info: GalleryInfo) {
|
||||
@@ -129,11 +128,9 @@ class SpiderDen(val info: GalleryInfo) {
|
||||
SpiderQueen.MODE_READ -> {
|
||||
containInCache(index) || containInDownloadDir(index)
|
||||
}
|
||||
|
||||
SpiderQueen.MODE_DOWNLOAD -> {
|
||||
containInDownloadDir(index) || copyFromCacheToDownloadDir(index)
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
@@ -270,22 +267,18 @@ class SpiderDen(val info: GalleryInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun archive() {
|
||||
if (saveAsCbz) {
|
||||
downloadDir?.run {
|
||||
resolve(archiveName).let { file ->
|
||||
runCatching {
|
||||
archiveTo(file)
|
||||
}.onFailure {
|
||||
file.delete()
|
||||
if (it is CancellationException) throw it
|
||||
logcat(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
suspend fun archive() = saveAsCbz && downloadDir?.run {
|
||||
resolve(archiveName).let { file ->
|
||||
runCatching {
|
||||
archiveTo(file)
|
||||
}.onFailure {
|
||||
file.delete()
|
||||
logcat(it)
|
||||
}.isFailure
|
||||
}
|
||||
}
|
||||
} == true
|
||||
|
||||
// Postpone this to `SpiderQueen.stop` because files may still be in use by reader
|
||||
suspend fun postArchive(): Boolean {
|
||||
val dir = downloadDir
|
||||
val archived = saveAsCbz && dir?.find(archiveName) != null
|
||||
|
||||
@@ -134,13 +134,14 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifyAllPageDownloaded() {
|
||||
private fun notifyAllPageDownloaded(failed: Boolean) {
|
||||
synchronized(mSpiderListeners) {
|
||||
mSpiderListeners.forEach {
|
||||
it.onFinish(
|
||||
mFinishedPages.load(),
|
||||
mDownloadedPages.load(),
|
||||
pageStates.size,
|
||||
failed,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -213,7 +214,10 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
|
||||
|
||||
private val prepareScope = CoroutineScope(coroutineContext + SupervisorJob())
|
||||
private val prepareJob = prepareScope.async { doPrepare() }
|
||||
private val archiveJob = launch(start = CoroutineStart.LAZY) { spiderDen.archive() }
|
||||
private val archiveJob = launch(start = CoroutineStart.LAZY) {
|
||||
val failed = spiderDen.archive()
|
||||
notifyAllPageDownloaded(failed)
|
||||
}
|
||||
|
||||
private suspend fun doPrepare() {
|
||||
spiderDen.initDownloadDirIfExist()
|
||||
@@ -400,8 +404,11 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
|
||||
notifyPageSuccess(index)
|
||||
}
|
||||
if (mDownloadedPages.load() == size) {
|
||||
if (mFinishedPages.load() == size) archiveJob.start()
|
||||
notifyAllPageDownloaded()
|
||||
if (mFinishedPages.load() == size) {
|
||||
archiveJob.start()
|
||||
} else {
|
||||
notifyAllPageDownloaded(failed = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,7 +425,7 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
|
||||
fun onPageDownload(index: Int, contentLength: Long, receivedSize: Long, bytesRead: Int) {}
|
||||
fun onPageSuccess(index: Int, finished: Int, downloaded: Int, total: Int) {}
|
||||
fun onPageFailure(index: Int, error: String?, finished: Int, downloaded: Int, total: Int) {}
|
||||
fun onFinish(finished: Int, downloaded: Int, total: Int) {}
|
||||
fun onFinish(finished: Int, downloaded: Int, total: Int, failed: Boolean) {}
|
||||
fun onPageReady(index: Int) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,6 @@ private suspend fun doModifyFavorites(
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
LOCAL_FAVORITED -> {
|
||||
if (localFavorited) {
|
||||
EhDB.removeLocalFavorites(galleryInfo)
|
||||
@@ -248,7 +247,6 @@ private suspend fun doModifyFavorites(
|
||||
}
|
||||
!localFavorited
|
||||
}
|
||||
|
||||
in 0..9 -> {
|
||||
EhEngine.modifyFavorites(gid, token, slot, note)
|
||||
favoriteSlot = slot
|
||||
@@ -256,7 +254,6 @@ private suspend fun doModifyFavorites(
|
||||
favoriteNote = note
|
||||
true
|
||||
}
|
||||
|
||||
else -> throw EhException("Invalid favorite slot!")
|
||||
}
|
||||
FavouriteStatusRouter.notify(galleryInfo)
|
||||
@@ -305,13 +302,11 @@ suspend fun doGalleryInfoAction(info: BaseGalleryInfo) {
|
||||
EhDB.putHistoryInfo(info)
|
||||
navToReader(info)
|
||||
}
|
||||
|
||||
1 -> if (downloaded) {
|
||||
confirmRemoveDownload(info)
|
||||
} else {
|
||||
startDownload(false, info)
|
||||
}
|
||||
|
||||
2 -> if (favorited) {
|
||||
runSuspendCatching {
|
||||
removeFromFavorites(info)
|
||||
@@ -327,7 +322,6 @@ suspend fun doGalleryInfoAction(info: BaseGalleryInfo) {
|
||||
tip(R.string.add_to_favorite_failure)
|
||||
}
|
||||
}
|
||||
|
||||
3 -> showMoveDownloadLabel(info)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.hippo.ehviewer.ui.login
|
||||
|
||||
import arrow.core.Either.Companion.catch
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.ehviewer.core.util.logcat
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.client.EhCookieStore
|
||||
import com.hippo.ehviewer.client.EhEngine
|
||||
import com.hippo.ehviewer.client.EhUrl
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@@ -6,10 +6,10 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.google.accompanist.web.WebView
|
||||
import com.google.accompanist.web.rememberWebViewState
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.client.EhCookieStore
|
||||
import com.hippo.ehviewer.client.EhUrl
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.ui.Screen
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.DownloadDone
|
||||
import androidx.compose.material.icons.filled.Pause
|
||||
import androidx.compose.material.icons.filled.PlayArrow
|
||||
import androidx.compose.material3.Card
|
||||
@@ -26,6 +27,7 @@ import androidx.compose.material3.ShapeDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.minimumInteractiveComponentSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.movableContentOf
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
@@ -35,7 +37,6 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -45,7 +46,7 @@ import com.ehviewer.core.ui.component.CrystalCard
|
||||
import com.ehviewer.core.ui.component.GalleryListCardRating
|
||||
import com.ehviewer.core.ui.util.TransitionsVisibilityScope
|
||||
import com.ehviewer.core.ui.util.listThumbGenerator
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.EhDB
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.download.DownloadManager
|
||||
import com.hippo.ehviewer.util.FileUtils
|
||||
@@ -60,6 +61,7 @@ fun DownloadCard(
|
||||
onStop: () -> Unit,
|
||||
info: DownloadInfo,
|
||||
selectMode: Boolean,
|
||||
showProgress: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
) = CrystalCard(modifier = modifier, onClick = onClick, onLongClick = onLongClick, interactionSource = interactionSource) {
|
||||
@@ -99,7 +101,14 @@ fun DownloadCard(
|
||||
DownloadInfo.STATE_NONE -> stringResource(R.string.download_state_none)
|
||||
DownloadInfo.STATE_WAIT -> stringResource(R.string.download_state_wait)
|
||||
DownloadInfo.STATE_FAILED -> if (info.legacy <= 0) stateFailed else stateFailed2
|
||||
DownloadInfo.STATE_FINISH -> stringResource(R.string.download_state_finish)
|
||||
DownloadInfo.STATE_FINISH -> {
|
||||
if (showProgress) {
|
||||
val readProgress by remember { EhDB.getReadProgressFlow(info.gid) }.collectAsState(0)
|
||||
if (readProgress > 0) "${readProgress + 1}/${info.pages}P" else "${info.pages}P"
|
||||
} else {
|
||||
"${info.pages}P"
|
||||
}
|
||||
}
|
||||
else -> null // The item has been removed and this will be disposed soon
|
||||
}
|
||||
ProvideTextStyle(MaterialTheme.typography.labelLarge) {
|
||||
@@ -149,24 +158,24 @@ fun DownloadCard(
|
||||
Text(
|
||||
text = categoryText,
|
||||
modifier = Modifier.clip(ShapeDefaults.Small).background(categoryColor).padding(vertical = 2.dp, horizontal = 8.dp),
|
||||
color = if (Settings.harmonizeCategoryColor.value) Color.Unspecified else EhUtils.categoryTextColor,
|
||||
color = EhUtils.getCategoryTextColor(categoryColor),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
val running = downloadState == DownloadInfo.STATE_WAIT || downloadState == DownloadInfo.STATE_DOWNLOAD
|
||||
val icon = remember {
|
||||
movableContentOf<Boolean> {
|
||||
Icon(imageVector = if (it) Icons.Default.Pause else Icons.Default.PlayArrow, contentDescription = null)
|
||||
}
|
||||
val icon = when (downloadState) {
|
||||
DownloadInfo.STATE_WAIT, DownloadInfo.STATE_DOWNLOAD -> Icons.Default.Pause
|
||||
DownloadInfo.STATE_FINISH -> Icons.Default.DownloadDone
|
||||
else -> Icons.Default.PlayArrow
|
||||
}
|
||||
if (selectMode) {
|
||||
Box(modifier = Modifier.offset(4.dp).minimumInteractiveComponentSize()) {
|
||||
icon(running)
|
||||
Icon(imageVector = icon, contentDescription = null)
|
||||
}
|
||||
} else {
|
||||
IconButton(onClick = if (running) onStop else onStart, shapes = IconButtonDefaults.shapes(), modifier = Modifier.offset(4.dp)) {
|
||||
icon(running)
|
||||
Icon(imageVector = icon, contentDescription = null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.material3.ShapeDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.contentColorFor
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableFloatStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
@@ -33,7 +33,6 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -46,7 +45,7 @@ import com.ehviewer.core.ui.component.GalleryListCardRating
|
||||
import com.ehviewer.core.ui.util.SharedElementBox
|
||||
import com.ehviewer.core.ui.util.TransitionsVisibilityScope
|
||||
import com.ehviewer.core.ui.util.listThumbGenerator
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.EhDB
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.download.DownloadManager
|
||||
import com.hippo.ehviewer.util.FavouriteStatusRouter
|
||||
@@ -58,6 +57,7 @@ fun GalleryInfoListItem(
|
||||
onLongClick: () -> Unit,
|
||||
info: GalleryInfo,
|
||||
showPages: Boolean,
|
||||
showProgress: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
isInFavScene: Boolean = false,
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
@@ -126,7 +126,12 @@ fun GalleryInfoListItem(
|
||||
Text(text = it)
|
||||
}
|
||||
if (info.pages != 0 && showPages) {
|
||||
Text(text = "${info.pages}P")
|
||||
val readProgress = if (showProgress) {
|
||||
remember { EhDB.getReadProgressFlow(info.gid) }.collectAsState(0).value
|
||||
} else {
|
||||
0
|
||||
}
|
||||
Text(text = if (readProgress > 0) "${readProgress + 1}/${info.pages}P" else "${info.pages}P")
|
||||
}
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
@@ -135,7 +140,7 @@ fun GalleryInfoListItem(
|
||||
Text(
|
||||
text = categoryText,
|
||||
modifier = Modifier.clip(ShapeDefaults.Small).background(categoryColor).padding(vertical = 2.dp, horizontal = 8.dp),
|
||||
color = if (Settings.harmonizeCategoryColor.value) Color.Unspecified else EhUtils.categoryTextColor,
|
||||
color = EhUtils.getCategoryTextColor(categoryColor),
|
||||
)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text(text = info.posted.orEmpty())
|
||||
@@ -154,6 +159,7 @@ fun GalleryInfoGridItem(
|
||||
modifier: Modifier = Modifier,
|
||||
showLanguage: Boolean = true,
|
||||
showPages: Boolean = true,
|
||||
showProgress: Boolean = true,
|
||||
showFavoriteStatus: Boolean = true,
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
) = ElevatedCard(
|
||||
@@ -187,11 +193,16 @@ fun GalleryInfoGridItem(
|
||||
Badge(
|
||||
modifier = Modifier.align(Alignment.TopEnd).widthIn(min = 32.dp).height(24.dp),
|
||||
containerColor = categoryColor,
|
||||
contentColor = if (Settings.harmonizeCategoryColor.value) contentColorFor(categoryColor) else EhUtils.categoryTextColor,
|
||||
contentColor = EhUtils.getCategoryTextColor(categoryColor),
|
||||
) {
|
||||
val shouldShowLanguage = showLanguage && info.simpleLanguage != null
|
||||
if (showPages && info.pages > 0) {
|
||||
Text(text = "${info.pages}")
|
||||
val readProgress = if (showProgress) {
|
||||
remember { EhDB.getReadProgressFlow(info.gid) }.collectAsState(0).value
|
||||
} else {
|
||||
0
|
||||
}
|
||||
Text(text = if (readProgress > 0) "${readProgress + 1}/${info.pages}" else "${info.pages}")
|
||||
if (shouldShowLanguage) {
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.plus
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.lazy.grid.GridCells
|
||||
@@ -196,7 +197,6 @@ fun GalleryList(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is LoadState.Error -> {
|
||||
Surface {
|
||||
ErrorTip(
|
||||
@@ -205,7 +205,6 @@ fun GalleryList(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is LoadState.NotLoading -> if (data.itemCount == 0) {
|
||||
// Only for local favorites as empty gallery lists from network are treated as error
|
||||
ErrorTip(modifier = Modifier.widthIn(max = 228.dp), text = stringResource(id = R.string.gallery_list_empty_hit))
|
||||
|
||||
@@ -22,7 +22,6 @@ fun LoadStateIndicator(
|
||||
is LoadState.Loading -> {
|
||||
LinearWavyProgressIndicator(modifier = modifier)
|
||||
}
|
||||
|
||||
is LoadState.Error -> {
|
||||
Column(modifier = modifier, horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(text = state.error.displayString())
|
||||
@@ -31,6 +30,5 @@ fun LoadStateIndicator(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is LoadState.NotLoading -> Unit
|
||||
}
|
||||
@@ -88,7 +88,7 @@ fun ColorFilterSetting() = Column(modifier = Modifier.verticalScroll(rememberScr
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_color_filter_mode),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.color_filter_modes),
|
||||
values = arrayOf("0", "1", "2", "3", "4", "5"),
|
||||
values = listOf(0, 1, 2, 3, 4, 5),
|
||||
field = Settings.colorFilterMode.asMutableState(),
|
||||
)
|
||||
SwitchChoice(
|
||||
|
||||
@@ -204,20 +204,17 @@ private fun PageContainer(
|
||||
moveToNext()
|
||||
}
|
||||
}
|
||||
|
||||
NavigationRegion.PREV -> {
|
||||
val canPan = if (isRtl) panLeft(distance, bounds) else panRight(distance, bounds)
|
||||
if (!canPan) {
|
||||
moveToPrevious()
|
||||
}
|
||||
}
|
||||
|
||||
NavigationRegion.RIGHT -> {
|
||||
if (!panLeft(distance, bounds)) {
|
||||
if (isRtl) moveToPrevious() else moveToNext()
|
||||
}
|
||||
}
|
||||
|
||||
NavigationRegion.LEFT -> {
|
||||
if (!panRight(distance, bounds)) {
|
||||
if (isRtl) moveToNext() else moveToPrevious()
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.integerArrayResource
|
||||
import androidx.compose.ui.res.stringArrayResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.ehviewer.core.i18n.R
|
||||
@@ -21,7 +22,7 @@ fun ReaderGeneralSetting() = Column(modifier = Modifier.verticalScroll(rememberS
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_reader_theme),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.reader_themes),
|
||||
values = stringArrayResource(id = com.hippo.ehviewer.R.array.reader_themes_values),
|
||||
values = integerArrayResource(id = com.hippo.ehviewer.R.array.reader_themes_values).toList(),
|
||||
field = Settings.readerTheme.asMutableState(),
|
||||
)
|
||||
SwitchChoice(
|
||||
|
||||
@@ -13,25 +13,28 @@ import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.integerArrayResource
|
||||
import androidx.compose.ui.res.stringArrayResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.ehviewer.core.i18n.R
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.asMutableState
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
|
||||
|
||||
@Composable
|
||||
fun ReaderModeSetting(isWebtoon: Boolean) = Column(modifier = Modifier.verticalScroll(rememberScrollState()).navigationBarsPadding()) {
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_category_reading_mode),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.viewers_selector),
|
||||
values = arrayOf("0", "1", "2", "3", "4", "5"),
|
||||
values = ReadingModeType.entries.map { it.prefValue },
|
||||
field = Settings.readingMode.asMutableState(),
|
||||
)
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.rotation_type),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.rotation_type),
|
||||
values = arrayOf("0", "8", "16", "24", "32", "40", "48"),
|
||||
values = OrientationType.entries.map { it.prefValue },
|
||||
field = Settings.orientationMode.asMutableState(),
|
||||
)
|
||||
Spacer(modifier = Modifier.size(16.dp))
|
||||
@@ -55,7 +58,7 @@ private fun PagerSetting() = Column {
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_viewer_nav),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.pager_nav),
|
||||
values = arrayOf("0", "1", "2", "3", "4", "5"),
|
||||
values = listOf(0, 1, 2, 3, 4, 5),
|
||||
field = pagerNav,
|
||||
)
|
||||
AnimatedVisibility(visible = pagerNav.value != 5) {
|
||||
@@ -63,7 +66,7 @@ private fun PagerSetting() = Column {
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_read_with_tapping_inverted),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.invert_tapping_mode),
|
||||
values = arrayOf("0", "1", "2", "3"),
|
||||
values = listOf(0, 1, 2, 3),
|
||||
field = Settings.readerPagerNavInverted.asMutableState(),
|
||||
)
|
||||
SwitchChoice(
|
||||
@@ -76,7 +79,7 @@ private fun PagerSetting() = Column {
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_image_scale_type),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.image_scale_type),
|
||||
values = arrayOf("1", "2", "3", "4", "5", "6"),
|
||||
values = listOf(1, 2, 3, 4, 5, 6),
|
||||
field = scaleType,
|
||||
)
|
||||
AnimatedVisibility(visible = scaleType.value == 1) {
|
||||
@@ -88,7 +91,7 @@ private fun PagerSetting() = Column {
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_zoom_start),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.zoom_start),
|
||||
values = arrayOf("1", "2", "3", "4"),
|
||||
values = listOf(1, 2, 3, 4),
|
||||
field = Settings.zoomStart.asMutableState(),
|
||||
)
|
||||
SwitchChoice(
|
||||
@@ -108,21 +111,21 @@ private fun WebtoonSetting() = Column {
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_viewer_nav),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.webtoon_nav),
|
||||
values = arrayOf("0", "1", "2", "3", "4", "5"),
|
||||
values = listOf(0, 1, 2, 3, 4, 5),
|
||||
field = webtoonNav,
|
||||
)
|
||||
AnimatedVisibility(visible = webtoonNav.value != 5) {
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_read_with_tapping_inverted),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.invert_tapping_mode),
|
||||
values = arrayOf("0", "1", "2", "3"),
|
||||
values = listOf(0, 1, 2, 3),
|
||||
field = Settings.readerWebtoonNavInverted.asMutableState(),
|
||||
)
|
||||
}
|
||||
SpinnerChoice(
|
||||
title = stringResource(id = R.string.pref_webtoon_side_padding),
|
||||
entries = stringArrayResource(id = com.hippo.ehviewer.R.array.webtoon_side_padding),
|
||||
values = stringArrayResource(id = com.hippo.ehviewer.R.array.webtoon_side_padding_values),
|
||||
values = integerArrayResource(id = com.hippo.ehviewer.R.array.webtoon_side_padding_values).toList(),
|
||||
field = Settings.webtoonSidePadding.asMutableState(),
|
||||
)
|
||||
SwitchChoice(
|
||||
|
||||
@@ -13,14 +13,11 @@ import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.WindowInsetsSides
|
||||
import androidx.compose.foundation.layout.displayCutout
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.only
|
||||
import androidx.compose.foundation.layout.safeDrawing
|
||||
import androidx.compose.foundation.layout.statusBars
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.layout.windowInsetsTopHeight
|
||||
import androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
@@ -53,7 +50,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.keepScreenOn
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.zIndex
|
||||
import arrow.core.Either
|
||||
import arrow.core.Either.Companion.catch
|
||||
import arrow.core.raise.ensure
|
||||
@@ -82,7 +78,6 @@ import com.hippo.ehviewer.gallery.useEhPageLoader
|
||||
import com.hippo.ehviewer.ui.MainActivity
|
||||
import com.hippo.ehviewer.ui.Screen
|
||||
import com.hippo.ehviewer.ui.theme.EhTheme
|
||||
import com.hippo.ehviewer.ui.theme.scrim
|
||||
import com.hippo.ehviewer.ui.tools.DialogState
|
||||
import com.hippo.ehviewer.ui.tools.awaitInputText
|
||||
import com.hippo.ehviewer.ui.tools.dialog
|
||||
@@ -131,15 +126,11 @@ fun AnimatedVisibilityScope.ReaderScreen(args: ReaderScreenArgs, navigator: Dest
|
||||
val uiController = rememberSystemUiController()
|
||||
DisposableEffect(uiController) {
|
||||
val lightStatusBar = uiController.statusBarDarkContentEnabled
|
||||
uiController.statusBarDarkContentEnabled = bgColor == Color.White
|
||||
onDispose {
|
||||
uiController.statusBarDarkContentEnabled = lightStatusBar
|
||||
}
|
||||
}
|
||||
LaunchedEffect(uiController) {
|
||||
snapshotFlow { bgColor }.collect {
|
||||
uiController.statusBarDarkContentEnabled = it == Color.White
|
||||
}
|
||||
}
|
||||
|
||||
Await(
|
||||
block = asyncInVM(args) { alive ->
|
||||
@@ -184,7 +175,7 @@ fun AnimatedVisibilityScope.ReaderScreen(args: ReaderScreenArgs, navigator: Dest
|
||||
}
|
||||
|
||||
@Composable
|
||||
context(activity: MainActivity, _: SnackbarHostState, _: DialogState, _: CoroutineScope)
|
||||
context(activity: MainActivity, _: SnackbarHostState, _: DialogState, _: CoroutineScope, _: DestinationsNavigator)
|
||||
fun ReaderScreen(pageLoader: PageLoader, info: BaseGalleryInfo?) {
|
||||
LaunchedEffect(Unit) {
|
||||
val orientation = activity.requestedOrientation
|
||||
@@ -240,18 +231,14 @@ fun ReaderScreen(pageLoader: PageLoader, info: BaseGalleryInfo?) {
|
||||
LaunchedEffect(Unit) {
|
||||
focusRequester.requestFocus()
|
||||
}
|
||||
val bgColor by collectBackgroundColorAsState()
|
||||
syncState.Sync(isWebtoon) { appbarVisible = false }
|
||||
if (fullscreen) {
|
||||
LaunchedEffect(Unit) {
|
||||
snapshotFlow { appbarVisible }.collect {
|
||||
uiController.isSystemBarsVisible = it
|
||||
}
|
||||
val bgColor by collectBackgroundColorAsState()
|
||||
val isDarkTheme = isSystemInDarkTheme()
|
||||
LaunchedEffect(isDarkTheme) {
|
||||
snapshotFlow { appbarVisible }.collect {
|
||||
uiController.isSystemBarsVisible = it || !fullscreen
|
||||
uiController.statusBarDarkContentEnabled = if (it) !isDarkTheme else bgColor == Color.White
|
||||
}
|
||||
Box(
|
||||
Modifier.windowInsetsTopHeight(WindowInsets.statusBars).fillMaxWidth()
|
||||
.align(Alignment.TopCenter).background(bgColor.scrim()).zIndex(1f),
|
||||
)
|
||||
}
|
||||
var showNavigationOverlay by remember {
|
||||
val showOnStart = Settings.showNavigationOverlayNewUser.value || Settings.showNavigationOverlayOnStart.value
|
||||
@@ -353,6 +340,7 @@ fun ReaderScreen(pageLoader: PageLoader, info: BaseGalleryInfo?) {
|
||||
}
|
||||
ReaderAppBars(
|
||||
visible = appbarVisible,
|
||||
title = pageLoader.title,
|
||||
isRtl = readingMode == ReadingModeType.RIGHT_TO_LEFT,
|
||||
showSeekBar = showSeekbar,
|
||||
currentPage = syncState.sliderValue,
|
||||
@@ -383,7 +371,6 @@ fun ReaderScreen(pageLoader: PageLoader, info: BaseGalleryInfo?) {
|
||||
}
|
||||
}
|
||||
},
|
||||
modifier = Modifier.align(Alignment.BottomCenter),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -395,7 +382,7 @@ suspend inline fun <T> usePageLoader(args: ReaderScreenArgs, crossinline block:
|
||||
val page = args.page.takeUnless { it == -1 } ?: EhDB.getReadProgress(info.gid)
|
||||
val archive = DownloadManager.getDownloadInfo(info.gid)?.archiveFile
|
||||
if (archive != null) {
|
||||
useArchivePageLoader(archive, info.gid, page, info.hasAds, { error("Managed Archive have password???") }, block)
|
||||
useArchivePageLoader(archive, info, page, info.hasAds, { error("Managed Archive have password???") }, block)
|
||||
} else {
|
||||
useEhPageLoader(info, page, block)
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ import androidx.compose.ui.unit.dp
|
||||
import com.ehviewer.core.ui.component.Slider
|
||||
|
||||
@Composable
|
||||
fun SpinnerChoice(title: String, entries: Array<String>, values: Array<String>, field: MutableState<Int>) {
|
||||
fun SpinnerChoice(title: String, entries: Array<String>, values: List<Int>, field: MutableState<Int>) {
|
||||
var value by field
|
||||
var dropdown by remember { mutableStateOf(false) }
|
||||
val data = remember { entries zip values.map { v -> v.toInt() } }
|
||||
val data = remember { entries zip values }
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().height(48.dp).clickable { dropdown = true }.padding(horizontal = 16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.only
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.plus
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
@@ -146,6 +147,7 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
|
||||
var gridView by Settings.gridView.asMutableState()
|
||||
var sortMode by Settings.downloadSortMode.asMutableState()
|
||||
val filterMode by Settings.downloadFilterMode.collectAsState { DownloadsFilterMode.from(it) }
|
||||
val showProgress by Settings.showReadingProgress.collectAsState()
|
||||
var filterState by rememberSerializable { mutableStateOf(DownloadsFilterState(filterMode, Settings.recentDownloadLabel.value)) }
|
||||
var invalidateKey by rememberSaveable { mutableStateOf(false) }
|
||||
var isLoading by rememberSaveable { mutableStateOf(true) }
|
||||
@@ -228,6 +230,7 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
|
||||
fun switchLabel(label: String?) {
|
||||
Settings.recentDownloadLabel.value = label
|
||||
filterState = filterState.copy(label = label)
|
||||
fabHidden = false
|
||||
}
|
||||
|
||||
LaunchedEffect(filterState) {
|
||||
@@ -594,6 +597,7 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
|
||||
info = info,
|
||||
modifier = Modifier.thenIf(animateItems) { animateItem() },
|
||||
showLanguage = false,
|
||||
showProgress = showProgress,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -633,6 +637,7 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
|
||||
onStop = { launchIO { DownloadManager.stopDownload(info.gid) } },
|
||||
info = info,
|
||||
selectMode = selectMode,
|
||||
showProgress = showProgress,
|
||||
modifier = Modifier.height(height),
|
||||
interactionSource = interactionSource,
|
||||
)
|
||||
|
||||
@@ -104,6 +104,8 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator, v
|
||||
var urlBuilder by viewModel.urlBuilder
|
||||
var searchBarExpanded by rememberSaveable { mutableStateOf(false) }
|
||||
var searchBarOffsetY by remember { mutableIntStateOf(0) }
|
||||
var fabExpanded by remember { mutableStateOf(false) }
|
||||
var fabHidden by remember { mutableStateOf(false) }
|
||||
|
||||
// Derived State
|
||||
val keyword = urlBuilder.keyword
|
||||
@@ -163,6 +165,7 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator, v
|
||||
val newCat = index - 2
|
||||
refresh(FavListUrlBuilder(newCat))
|
||||
Settings.recentFavCat = newCat
|
||||
fabHidden = false
|
||||
launch { sheetState.close() }
|
||||
},
|
||||
colors = listItemOnDrawerColor(urlBuilder.favCat == index - 2),
|
||||
@@ -171,8 +174,6 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator, v
|
||||
}
|
||||
}
|
||||
|
||||
var fabExpanded by remember { mutableStateOf(false) }
|
||||
var fabHidden by remember { mutableStateOf(false) }
|
||||
val checkedInfoMap = remember { mutableStateMapOf<Long, BaseGalleryInfo>() }
|
||||
val selectMode = checkedInfoMap.isNotEmpty()
|
||||
DrawerHandle(!selectMode && !searchBarExpanded)
|
||||
@@ -200,6 +201,7 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator, v
|
||||
val listMode by Settings.listMode.collectAsState()
|
||||
val height by collectListThumbSizeAsState()
|
||||
val showPages by Settings.showGalleryPages.collectAsState()
|
||||
val showProgress by Settings.showReadingProgress.collectAsState()
|
||||
val searchBarConnection = remember {
|
||||
val slop = ViewConfiguration.get(contextOf<Context>()).scaledTouchSlop
|
||||
val topPaddingPx = with(density) { contentPadding.calculateTopPadding().roundToPx() }
|
||||
@@ -244,6 +246,7 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator, v
|
||||
},
|
||||
info = info,
|
||||
showPages = showPages,
|
||||
showProgress = showProgress,
|
||||
modifier = Modifier.height(height),
|
||||
isInFavScene = true,
|
||||
interactionSource = interactionSource,
|
||||
@@ -273,6 +276,7 @@ fun AnimatedVisibilityScope.FavouritesScreen(navigator: DestinationsNavigator, v
|
||||
},
|
||||
info = info,
|
||||
showPages = showPages,
|
||||
showProgress = showProgress,
|
||||
showFavoriteStatus = false,
|
||||
interactionSource = interactionSource,
|
||||
)
|
||||
|
||||
@@ -320,7 +320,6 @@ fun GalleryDetailContent(
|
||||
galleryPreview(galleryDetail, previews) { navToReader(galleryDetail.galleryInfo, it) }
|
||||
}
|
||||
}
|
||||
|
||||
else -> FastScrollLazyVerticalGrid(
|
||||
columns = GridCells.Fixed(thumbColumns),
|
||||
contentPadding = contentPadding,
|
||||
@@ -722,15 +721,17 @@ fun BelowHeader(galleryDetail: GalleryDetail, voteTag: VoteTag) {
|
||||
val upTag = stringResource(R.string.tag_vote_up)
|
||||
val downTag = stringResource(R.string.tag_vote_down)
|
||||
val withDraw = stringResource(R.string.tag_vote_withdraw)
|
||||
fun search(tag: String) = navigate(ListUrlBuilder(mode = ListUrlBuilder.MODE_TAG, mKeyword = tag).asDst())
|
||||
GalleryTags(
|
||||
tagGroups = tags,
|
||||
onTagClick = {
|
||||
navigate(ListUrlBuilder(mode = ListUrlBuilder.MODE_TAG, mKeyword = it).asDst())
|
||||
},
|
||||
onTagClick = ::search,
|
||||
onTagLongClick = { tag, translation, vote ->
|
||||
val rawValue = tag.substringAfter(':')
|
||||
launchIO {
|
||||
awaitSelectAction {
|
||||
onSelect(ctx.getString(R.string.search_bar_hint, tag)) {
|
||||
withUIContext { search(tag) }
|
||||
}
|
||||
onSelect(copy) {
|
||||
addTextToClipboard(tag)
|
||||
}
|
||||
|
||||
@@ -160,6 +160,9 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
var urlBuilder by viewModel.urlBuilder
|
||||
var searchBarExpanded by rememberSaveable { mutableStateOf(false) }
|
||||
var searchBarOffsetY by remember { mutableIntStateOf(0) }
|
||||
var fabExpanded by remember { mutableStateOf(false) }
|
||||
var fabHidden by remember { mutableStateOf(false) }
|
||||
|
||||
val animateItems by Settings.animateItems.collectAsState()
|
||||
|
||||
var category by rememberMutableStateInDataStore("SearchCategory") { EhUtils.ALL_CATEGORY }
|
||||
@@ -169,15 +172,11 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
|
||||
LaunchedEffect(urlBuilder) {
|
||||
if (urlBuilder.category != EhUtils.NONE) category = urlBuilder.category
|
||||
if (urlBuilder.mode != MODE_TOPLIST) {
|
||||
var keyword = urlBuilder.keyword.orEmpty()
|
||||
if (urlBuilder.mode == MODE_TAG) {
|
||||
keyword = wrapTagKeyword(keyword)
|
||||
}
|
||||
if (keyword.isNotBlank()) {
|
||||
searchFieldState.setTextAndPlaceCursorAtEnd(keyword)
|
||||
}
|
||||
var keyword = urlBuilder.keyword.takeUnless { urlBuilder.mode == MODE_TOPLIST }.orEmpty()
|
||||
if (urlBuilder.mode == MODE_TAG) {
|
||||
keyword = wrapTagKeyword(keyword)
|
||||
}
|
||||
searchFieldState.setTextAndPlaceCursorAtEnd(keyword)
|
||||
}
|
||||
|
||||
val density = LocalDensity.current
|
||||
@@ -220,6 +219,7 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
Settings.recentToplist = keyword
|
||||
urlBuilder = ListUrlBuilder(MODE_TOPLIST, mKeyword = keyword)
|
||||
data.refresh()
|
||||
fabHidden = false
|
||||
launch { sheetState.close() }
|
||||
},
|
||||
headlineContent = {
|
||||
@@ -374,6 +374,7 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
language = languageFilter
|
||||
}
|
||||
data.refresh()
|
||||
fabHidden = false
|
||||
}
|
||||
launch { sheetState.close() }
|
||||
},
|
||||
@@ -425,9 +426,6 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
}
|
||||
}
|
||||
|
||||
var fabExpanded by remember { mutableStateOf(false) }
|
||||
var fabHidden by remember { mutableStateOf(false) }
|
||||
|
||||
val openGalleryKeyword = stringResource(R.string.gallery_list_search_bar_open_gallery)
|
||||
abstract class UrlSuggestion : Suggestion() {
|
||||
override val keyword = openGalleryKeyword
|
||||
@@ -509,6 +507,7 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
) { contentPadding ->
|
||||
val height by collectListThumbSizeAsState()
|
||||
val showPages by Settings.showGalleryPages.collectAsState()
|
||||
val showProgress by Settings.showReadingProgress.collectAsState()
|
||||
val searchBarConnection = remember {
|
||||
val slop = ViewConfiguration.get(contextOf<Context>()).scaledTouchSlop
|
||||
val topPaddingPx = with(density) { contentPadding.calculateTopPadding().roundToPx() }
|
||||
@@ -537,6 +536,7 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
onLongClick = { launch { doGalleryInfoAction(info) } },
|
||||
info = info,
|
||||
showPages = showPages,
|
||||
showProgress = showProgress,
|
||||
modifier = Modifier.height(height),
|
||||
)
|
||||
},
|
||||
@@ -547,6 +547,7 @@ fun AnimatedVisibilityScope.GalleryListScreen(
|
||||
onLongClick = { launch { doGalleryInfoAction(info) } },
|
||||
info = info,
|
||||
showPages = showPages,
|
||||
showProgress = showProgress,
|
||||
)
|
||||
},
|
||||
searchBarOffsetY = { searchBarOffsetY },
|
||||
|
||||
@@ -136,6 +136,7 @@ fun AnimatedVisibilityScope.HistoryScreen(navigator: DestinationsNavigator) = Sc
|
||||
val marginH = dimensionResource(id = com.hippo.ehviewer.R.dimen.gallery_list_margin_h)
|
||||
val cardHeight by collectListThumbSizeAsState()
|
||||
val showPages by Settings.showGalleryPages.collectAsState()
|
||||
val showProgress by Settings.showReadingProgress.collectAsState()
|
||||
FastScrollLazyColumn(
|
||||
modifier = Modifier.nestedScroll(searchBarConnection).fillMaxSize(),
|
||||
contentPadding = paddingValues,
|
||||
@@ -161,6 +162,7 @@ fun AnimatedVisibilityScope.HistoryScreen(navigator: DestinationsNavigator) = Sc
|
||||
onLongClick = { launch { doGalleryInfoAction(info) } },
|
||||
info = info,
|
||||
showPages = showPages,
|
||||
showProgress = showProgress,
|
||||
modifier = Modifier.height(cardHeight).padding(horizontal = marginH),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.plus
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
|
||||
@@ -123,7 +123,7 @@ fun AnimatedVisibilityScope.AboutScreen(navigator: DestinationsNavigator) = Scre
|
||||
}
|
||||
}
|
||||
|
||||
context(ctx: Context, _: DialogState)
|
||||
context(_: Context, _: DialogState)
|
||||
suspend fun showNewVersion(release: Release) {
|
||||
awaitConfirmationOrCancel(
|
||||
confirmText = R.string.download,
|
||||
@@ -140,7 +140,7 @@ suspend fun showNewVersion(release: Release) {
|
||||
}
|
||||
if (Settings.backupBeforeUpdate.value) {
|
||||
val time = ReadableTime.getFilenamableTime()
|
||||
EhDB.exportDB(ctx, (downloadLocation / "$time.db"))
|
||||
EhDB.exportDB(downloadLocation / "$time.db")
|
||||
}
|
||||
// TODO: Download in the background and show progress in notification
|
||||
val path = AppConfig.tempDir / "update.apk"
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.ehviewer.core.files.sendTo
|
||||
import com.ehviewer.core.files.toOkioPath
|
||||
import com.ehviewer.core.i18n.R
|
||||
import com.ehviewer.core.util.isAtLeastO
|
||||
import com.ehviewer.core.util.isAtLeastSExtension7
|
||||
import com.ehviewer.core.util.launch
|
||||
import com.ehviewer.core.util.logcat
|
||||
import com.ehviewer.core.util.withIOContext
|
||||
@@ -46,6 +45,7 @@ import com.hippo.ehviewer.asMutableState
|
||||
import com.hippo.ehviewer.client.EhEngine
|
||||
import com.hippo.ehviewer.client.data.FavListUrlBuilder
|
||||
import com.hippo.ehviewer.collectAsState
|
||||
import com.hippo.ehviewer.ktor.isCronetAvailable
|
||||
import com.hippo.ehviewer.ui.Screen
|
||||
import com.hippo.ehviewer.ui.main.NavigationIcon
|
||||
import com.hippo.ehviewer.ui.showRestartDialog
|
||||
@@ -94,15 +94,15 @@ private fun dumplog(uri: Uri): Unit = with(ctx) {
|
||||
}
|
||||
|
||||
context(ctx: Context)
|
||||
private fun exportDatabase(uri: Uri) {
|
||||
private suspend fun exportDatabase(uri: Uri) {
|
||||
ctx.grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
EhDB.exportDB(ctx, uri.toOkioPath())
|
||||
EhDB.exportDB(uri.toOkioPath())
|
||||
}
|
||||
|
||||
context(ctx: Context)
|
||||
private suspend fun importDatabase(uri: Uri) {
|
||||
ctx.grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
EhDB.importDB(ctx, uri)
|
||||
EhDB.importDB(uri.toOkioPath())
|
||||
}
|
||||
|
||||
@Destination<RootGraph>
|
||||
@@ -185,7 +185,7 @@ fun AnimatedVisibilityScope.AdvancedScreen(navigator: DestinationsNavigator) = S
|
||||
title = { Text(stringResource(id = R.string.settings_advanced_app_language_title)) },
|
||||
summary = { Text(languages[currentLanguage].orEmpty()) },
|
||||
)
|
||||
if (isAtLeastSExtension7) {
|
||||
if (isCronetAvailable) {
|
||||
val enableCronet = Settings.enableCronet.asMutableState()
|
||||
if (BuildConfig.DEBUG || !enableCronet.value) {
|
||||
SwitchPreference(
|
||||
|
||||
@@ -29,11 +29,11 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.fromHtml
|
||||
import com.ehviewer.core.i18n.R
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.ehviewer.core.util.isAtLeastT
|
||||
import com.ehviewer.core.util.launch
|
||||
import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.asMutableState
|
||||
import com.hippo.ehviewer.client.EhCookieStore
|
||||
import com.hippo.ehviewer.client.EhTagDatabase
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.collectAsState
|
||||
@@ -214,6 +214,11 @@ fun AnimatedVisibilityScope.EhScreen(navigator: DestinationsNavigator) = Screen(
|
||||
summary = stringResource(id = R.string.settings_eh_show_gallery_pages_summary),
|
||||
state = Settings.showGalleryPages.asMutableState(),
|
||||
)
|
||||
SwitchPreference(
|
||||
title = stringResource(id = R.string.settings_eh_show_reading_progress),
|
||||
summary = stringResource(id = R.string.settings_eh_show_reading_progress_summary),
|
||||
state = Settings.showReadingProgress.asMutableState(),
|
||||
)
|
||||
SwitchPreference(
|
||||
title = stringResource(id = R.string.settings_eh_show_vote_status),
|
||||
state = Settings.showVoteStatus.asMutableState(),
|
||||
|
||||
@@ -16,11 +16,11 @@ import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.ehviewer.core.i18n.R
|
||||
import com.ehviewer.core.network.EhCookieStore
|
||||
import com.ehviewer.core.util.launch
|
||||
import com.google.accompanist.web.WebView
|
||||
import com.google.accompanist.web.rememberWebViewNavigator
|
||||
import com.google.accompanist.web.rememberWebViewState
|
||||
import com.hippo.ehviewer.client.EhCookieStore
|
||||
import com.hippo.ehviewer.client.EhUrl
|
||||
import com.hippo.ehviewer.ui.Screen
|
||||
import com.hippo.ehviewer.ui.main.NavigationIcon
|
||||
|
||||
@@ -79,9 +79,9 @@ object FileUtils {
|
||||
*/
|
||||
// From https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/os/FileUtils.java;l=1142;drc=7b647e4ea0e92f33c19b315eaed364ee067ba0aa
|
||||
fun sanitizeFilename(name: String): String {
|
||||
if (name.isEmpty() || "." == name || ".." == name) {
|
||||
return "(invalid)"
|
||||
}
|
||||
// Windows does not support filenames ending with a space or a period
|
||||
val name = name.trimEnd(' ', '.')
|
||||
check(name.isNotEmpty()) { "Invalid filename" }
|
||||
return buildString(name.length) {
|
||||
name.forEach {
|
||||
if (isValidFatFilenameChar(it)) {
|
||||
|
||||
@@ -6,47 +6,72 @@ import androidx.compose.animation.slideInVertically
|
||||
import androidx.compose.animation.slideOutVertically
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.BoxScope
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.WindowInsetsSides
|
||||
import androidx.compose.foundation.layout.only
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.layout.systemBarsIgnoringVisibility
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.material3.BottomAppBarDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.IntOffset
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.hippo.ehviewer.ui.main.NavigationIcon
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
|
||||
private val animationSpec = tween<IntOffset>(200)
|
||||
|
||||
@Composable
|
||||
fun ReaderAppBars(
|
||||
context(navigator: DestinationsNavigator)
|
||||
fun BoxScope.ReaderAppBars(
|
||||
visible: Boolean,
|
||||
title: String,
|
||||
isRtl: Boolean,
|
||||
showSeekBar: Boolean,
|
||||
currentPage: Int,
|
||||
totalPages: Int,
|
||||
onSliderValueChange: (Int) -> Unit,
|
||||
onClickSettings: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) = AnimatedVisibility(
|
||||
visible = visible,
|
||||
modifier = modifier.windowInsetsPadding(WindowInsets.systemBars.only(WindowInsetsSides.Horizontal)),
|
||||
enter = slideInVertically(initialOffsetY = { it }, animationSpec = animationSpec),
|
||||
exit = slideOutVertically(targetOffsetY = { it }, animationSpec = animationSpec),
|
||||
) {
|
||||
val toolbarColor = BottomAppBarDefaults.containerColor.copy(alpha = if (isSystemInDarkTheme()) 0.9f else 0.95f)
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (showSeekBar && totalPages > 1) {
|
||||
ChapterNavigator(
|
||||
isRtl = isRtl,
|
||||
currentPage = currentPage,
|
||||
totalPages = totalPages,
|
||||
onSliderValueChange = onSliderValueChange,
|
||||
containerColor = toolbarColor,
|
||||
)
|
||||
val backgroundColor = BottomAppBarDefaults.containerColor.copy(alpha = if (isSystemInDarkTheme()) 0.9f else 0.95f)
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = visible,
|
||||
modifier = Modifier.windowInsetsPadding(WindowInsets.systemBarsIgnoringVisibility.only(WindowInsetsSides.Horizontal)).align(Alignment.TopStart),
|
||||
enter = slideInVertically(initialOffsetY = { -it }, animationSpec = animationSpec),
|
||||
exit = slideOutVertically(targetOffsetY = { -it }, animationSpec = animationSpec),
|
||||
) {
|
||||
TopAppBar(
|
||||
title = { Text(text = title, maxLines = 2, overflow = TextOverflow.Ellipsis) },
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = backgroundColor),
|
||||
navigationIcon = { NavigationIcon() },
|
||||
)
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = visible,
|
||||
modifier = Modifier.windowInsetsPadding(WindowInsets.systemBarsIgnoringVisibility.only(WindowInsetsSides.Horizontal)).align(Alignment.BottomStart),
|
||||
enter = slideInVertically(initialOffsetY = { it }, animationSpec = animationSpec),
|
||||
exit = slideOutVertically(targetOffsetY = { it }, animationSpec = animationSpec),
|
||||
) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (showSeekBar && totalPages > 1) {
|
||||
ChapterNavigator(
|
||||
isRtl = isRtl,
|
||||
currentPage = currentPage,
|
||||
totalPages = totalPages,
|
||||
onSliderValueChange = onSliderValueChange,
|
||||
containerColor = backgroundColor,
|
||||
)
|
||||
}
|
||||
BottomReaderBar(onClickSettings = onClickSettings, containerColor = backgroundColor)
|
||||
}
|
||||
BottomReaderBar(onClickSettings = onClickSettings, containerColor = toolbarColor)
|
||||
}
|
||||
}
|
||||
@@ -220,12 +220,12 @@
|
||||
<item>@string/automatic_background</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="reader_themes_values">
|
||||
<integer-array name="reader_themes_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>0</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
</integer-array>
|
||||
|
||||
<string-array name="color_filter_modes" tools:ignore="InconsistentArrays">
|
||||
<item>@string/label_default</item>
|
||||
@@ -293,14 +293,14 @@
|
||||
<item>@string/webtoon_side_padding_25</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="webtoon_side_padding_values">
|
||||
<integer-array name="webtoon_side_padding_values">
|
||||
<item>0</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>15</item>
|
||||
<item>20</item>
|
||||
<item>25</item>
|
||||
</string-array>
|
||||
</integer-array>
|
||||
|
||||
<string-array name="update_frequency">
|
||||
<item>@string/update_frequency_never</item>
|
||||
|
||||
Generated
+235
-298
File diff suppressed because it is too large.
Load diff
@@ -257,17 +257,28 @@ where
|
||||
{
|
||||
jni_throwing(env, |env| {
|
||||
let buffer = deref_mut_direct_bytebuffer(env, str)?;
|
||||
let value = {
|
||||
// SAFETY: ktor client ensure html content is valid utf-8.
|
||||
let body = unsafe { from_utf8_unchecked(&buffer[..limit as usize]) };
|
||||
f(body)?
|
||||
};
|
||||
let mut cursor = Cursor::new(buffer);
|
||||
serde_cbor::to_writer(&mut cursor, &value)?;
|
||||
Ok(cursor.position() as i32)
|
||||
|
||||
// SAFETY: ktor client ensure html content is valid utf-8.
|
||||
let body = unsafe { from_utf8_unchecked(&buffer[..limit as usize]) };
|
||||
match f(body) {
|
||||
Ok(value) => serialize_to_buffer(buffer, &value),
|
||||
Err(err) => {
|
||||
if let Some(value) = err.downcast_ref::<EhError>() {
|
||||
serialize_to_buffer(buffer, value)
|
||||
} else {
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn serialize_to_buffer<T: Serialize>(buffer: &mut [u8], value: &T) -> Result<i32> {
|
||||
let mut cursor = Cursor::new(buffer);
|
||||
serde_cbor::to_writer(&mut cursor, value)?;
|
||||
Ok(cursor.position() as i32)
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
#[allow(non_snake_case)]
|
||||
pub extern "system" fn JNI_OnLoad(_: JavaVM, _: *mut c_void) -> jint {
|
||||
|
||||
@@ -5,6 +5,7 @@ mod ffi;
|
||||
pub mod img;
|
||||
pub mod parser;
|
||||
|
||||
use serde::{Serialize, Serializer, ser::SerializeTuple};
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use tl::{Bytes, HTMLTag, Node, NodeHandle, Parser, VDom};
|
||||
|
||||
@@ -74,22 +75,47 @@ enum EhError {
|
||||
NeedLogin,
|
||||
NoHathClient,
|
||||
InsufficientFunds,
|
||||
GalleryUnavailable(String),
|
||||
IpBanned(String),
|
||||
Error(String),
|
||||
}
|
||||
|
||||
impl EhError {
|
||||
fn variant_name(&self) -> &'static str {
|
||||
match self {
|
||||
EhError::NoHits => "NoHits",
|
||||
EhError::NoWatched => "NoWatched",
|
||||
EhError::NeedLogin => "NeedLogin",
|
||||
EhError::NoHathClient => "NoHathClient",
|
||||
EhError::InsufficientFunds => "InsufficientFunds",
|
||||
EhError::GalleryUnavailable(_) => "GalleryUnavailable",
|
||||
EhError::IpBanned(_) => "IpBanned",
|
||||
EhError::Error(_) => "Error",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for EhError {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let mut tup = serializer.serialize_tuple(2)?;
|
||||
tup.serialize_element(self.variant_name())?;
|
||||
let payload = match self {
|
||||
EhError::GalleryUnavailable(s) | EhError::IpBanned(s) | EhError::Error(s) => {
|
||||
std::slice::from_ref(s)
|
||||
}
|
||||
_ => &[],
|
||||
};
|
||||
tup.serialize_element(payload)?;
|
||||
tup.end()
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for EhError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
let msg = match self {
|
||||
EhError::NoHits => "0",
|
||||
EhError::NoWatched => "1",
|
||||
EhError::NeedLogin => "2",
|
||||
EhError::NoHathClient => "3",
|
||||
EhError::InsufficientFunds => "4",
|
||||
EhError::IpBanned(s) => &format!("5{s}"),
|
||||
EhError::Error(s) => &format!("6{s}"),
|
||||
};
|
||||
f.write_str(msg)
|
||||
Debug::fmt(&self, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -470,11 +470,11 @@ pub fn parse_pages(dom: &VDom, parser: &Parser) -> Result<i32> {
|
||||
}
|
||||
|
||||
pub fn parse_preview_list(dom: &VDom, parser: &Parser) -> Result<Vec<GalleryPreview>> {
|
||||
// Check Gallery Not Available
|
||||
let error = get_vdom_first_element_by_class_name(dom, "d");
|
||||
if let Some(tag) = error.and_then(|n| get_first_child(n.as_tag()?, parser)) {
|
||||
let node = tag.children().top()[0].get(parser).unwrap();
|
||||
bail!(EhError::Error(node.inner_text(parser).to_string()));
|
||||
let err = EhError::GalleryUnavailable(node.inner_text(parser).to_string());
|
||||
bail!(err);
|
||||
}
|
||||
|
||||
dom.get_element_by_id("gdt")
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
141
|
||||
@@ -39,4 +39,54 @@ open class BaseGalleryInfo(
|
||||
override var favoriteSlot: Int = NOT_FAVORITED,
|
||||
override var favoriteName: String? = null,
|
||||
override var favoriteNote: String? = null,
|
||||
) : GalleryInfo
|
||||
) : GalleryInfo {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is BaseGalleryInfo) return false
|
||||
|
||||
if (gid != other.gid) return false
|
||||
if (category != other.category) return false
|
||||
if (disowned != other.disowned) return false
|
||||
if (rating != other.rating) return false
|
||||
if (rated != other.rated) return false
|
||||
if (pages != other.pages) return false
|
||||
if (thumbWidth != other.thumbWidth) return false
|
||||
if (thumbHeight != other.thumbHeight) return false
|
||||
if (favoriteSlot != other.favoriteSlot) return false
|
||||
if (token != other.token) return false
|
||||
if (title != other.title) return false
|
||||
if (titleJpn != other.titleJpn) return false
|
||||
if (thumbKey != other.thumbKey) return false
|
||||
if (posted != other.posted) return false
|
||||
if (uploader != other.uploader) return false
|
||||
if (simpleTags != other.simpleTags) return false
|
||||
if (simpleLanguage != other.simpleLanguage) return false
|
||||
if (favoriteName != other.favoriteName) return false
|
||||
if (favoriteNote != other.favoriteNote) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = gid.hashCode()
|
||||
result = 31 * result + category
|
||||
result = 31 * result + disowned.hashCode()
|
||||
result = 31 * result + rating.hashCode()
|
||||
result = 31 * result + rated.hashCode()
|
||||
result = 31 * result + pages
|
||||
result = 31 * result + thumbWidth
|
||||
result = 31 * result + thumbHeight
|
||||
result = 31 * result + favoriteSlot
|
||||
result = 31 * result + token.hashCode()
|
||||
result = 31 * result + (title?.hashCode() ?: 0)
|
||||
result = 31 * result + (titleJpn?.hashCode() ?: 0)
|
||||
result = 31 * result + (thumbKey?.hashCode() ?: 0)
|
||||
result = 31 * result + (posted?.hashCode() ?: 0)
|
||||
result = 31 * result + (uploader?.hashCode() ?: 0)
|
||||
result = 31 * result + (simpleTags?.hashCode() ?: 0)
|
||||
result = 31 * result + (simpleLanguage?.hashCode() ?: 0)
|
||||
result = 31 * result + (favoriteName?.hashCode() ?: 0)
|
||||
result = 31 * result + (favoriteNote?.hashCode() ?: 0)
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,13 @@ kotlin {
|
||||
api(projects.core.common)
|
||||
api(libs.androidx.datastore)
|
||||
api(libs.androidx.room.paging)
|
||||
implementation(libs.ktor.client.core)
|
||||
}
|
||||
}
|
||||
androidMain {
|
||||
dependencies {
|
||||
implementation(project.dependencies.platform(libs.okhttp.bom))
|
||||
implementation(libs.ktor.client.okhttp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ehviewer.core.database
|
||||
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.sqlite.driver.AndroidSQLiteDriver
|
||||
import okio.Path.Companion.toOkioPath
|
||||
import splitties.init.appCtx
|
||||
|
||||
actual inline fun <reified T : RoomDatabase> roomDb(
|
||||
name: String,
|
||||
builder: RoomDatabase.Builder<T>.() -> Unit,
|
||||
) = Room.databaseBuilder<T>(appCtx, name).setDriver(AndroidSQLiteDriver()).apply(builder).build()
|
||||
|
||||
actual fun getDatabasePath(name: String) = appCtx.getDatabasePath(name).toOkioPath()
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ehviewer.core.network
|
||||
|
||||
import io.ktor.http.Cookie
|
||||
import io.ktor.http.Url
|
||||
import io.ktor.http.parseClientCookiesHeader
|
||||
import io.ktor.http.renderSetCookieHeader
|
||||
|
||||
class AndroidCookieManager : CookieManager {
|
||||
private val manager = android.webkit.CookieManager.getInstance()
|
||||
override fun getCookies(url: Url) = manager.getCookie(url.toString())?.let { parseClientCookiesHeader(it) }
|
||||
override fun setCookie(url: Url, cookie: Cookie) = manager.setCookie(url.toString(), renderSetCookieHeader(cookie))
|
||||
override fun removeAllCookies() = manager.removeAllCookies(null)
|
||||
override fun flush() = manager.flush()
|
||||
}
|
||||
|
||||
actual fun getCookieManager(): CookieManager = AndroidCookieManager()
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ehviewer.core.database
|
||||
|
||||
import androidx.room.RoomDatabase
|
||||
import okio.Path
|
||||
|
||||
expect inline fun <reified T : RoomDatabase> roomDb(
|
||||
name: String,
|
||||
builder: RoomDatabase.Builder<T>.() -> Unit = {},
|
||||
): T
|
||||
|
||||
expect fun getDatabasePath(name: String): Path
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ehviewer.core.network
|
||||
|
||||
import io.ktor.http.Cookie
|
||||
import io.ktor.http.Url
|
||||
|
||||
interface CookieManager {
|
||||
fun getCookies(url: Url): Map<String, String>?
|
||||
fun setCookie(url: Url, cookie: Cookie)
|
||||
fun removeAllCookies()
|
||||
fun flush()
|
||||
}
|
||||
|
||||
expect fun getCookieManager(): CookieManager
|
||||
+20
-22
@@ -1,17 +1,19 @@
|
||||
package com.hippo.ehviewer.client
|
||||
package com.ehviewer.core.network
|
||||
|
||||
import android.webkit.CookieManager
|
||||
import io.ktor.client.plugins.cookies.CookiesStorage
|
||||
import io.ktor.http.Cookie
|
||||
import io.ktor.http.URLBuilder
|
||||
import io.ktor.http.URLProtocol
|
||||
import io.ktor.http.Url
|
||||
import io.ktor.http.parseClientCookiesHeader
|
||||
import io.ktor.http.renderSetCookieHeader
|
||||
|
||||
object EhCookieStore : CookiesStorage {
|
||||
private val manager = CookieManager.getInstance()
|
||||
fun removeAllCookies() = manager.removeAllCookies(null)
|
||||
private val manager = getCookieManager()
|
||||
private val urlE = URLBuilder(URLProtocol.HTTPS, "e-hentai.org").build()
|
||||
private val urlEx = URLBuilder(URLProtocol.HTTPS, "exhentai.org").build()
|
||||
|
||||
fun hasSignedIn(): Boolean = getCookies(EhUrl.HOST_E)?.run {
|
||||
fun removeAllCookies() = manager.removeAllCookies()
|
||||
|
||||
fun hasSignedIn(): Boolean = manager.getCookies(urlE)?.run {
|
||||
containsKey(KEY_IPB_MEMBER_ID) && containsKey(KEY_IPB_PASS_HASH)
|
||||
} == true
|
||||
|
||||
@@ -29,18 +31,18 @@ object EhCookieStore : CookiesStorage {
|
||||
|
||||
fun clearIgneous() {
|
||||
manager.setCookie(
|
||||
EhUrl.HOST_EX,
|
||||
renderSetCookieHeader(KEY_IGNEOUS, "", maxAge = 0, domain = EhUrl.DOMAIN_EX, path = "/"),
|
||||
urlEx,
|
||||
Cookie(KEY_IGNEOUS, "", maxAge = 0, domain = urlEx.host, path = "/"),
|
||||
)
|
||||
}
|
||||
|
||||
fun getUserId() = getCookies(EhUrl.HOST_E)?.get(KEY_IPB_MEMBER_ID)
|
||||
fun getUserId() = manager.getCookies(urlE)?.get(KEY_IPB_MEMBER_ID)
|
||||
|
||||
fun getHathPerks() = getCookies(EhUrl.HOST_E)?.get(KEY_HATH_PERKS)?.substringBefore('-')
|
||||
fun getHathPerks() = manager.getCookies(urlE)?.get(KEY_HATH_PERKS)?.substringBefore('-')
|
||||
|
||||
fun getIdentityCookies(): List<Pair<String, String?>> {
|
||||
val eCookies = getCookies(EhUrl.HOST_E)
|
||||
val exCookies = getCookies(EhUrl.HOST_EX)
|
||||
val eCookies = manager.getCookies(urlE)
|
||||
val exCookies = manager.getCookies(urlEx)
|
||||
val ipbMemberId = eCookies?.get(KEY_IPB_MEMBER_ID)
|
||||
val ipbPassHash = eCookies?.get(KEY_IPB_PASS_HASH)
|
||||
val igneous = exCookies?.get(KEY_IGNEOUS)
|
||||
@@ -51,24 +53,22 @@ object EhCookieStore : CookiesStorage {
|
||||
)
|
||||
}
|
||||
|
||||
fun isCloudflareBypassed() = getCookies(EhUrl.HOST_E)?.containsKey("cf_clearance") == true
|
||||
fun isCloudflareBypassed() = manager.getCookies(urlE)?.containsKey("cf_clearance") == true
|
||||
|
||||
fun flush() = manager.flush()
|
||||
|
||||
// See https://github.com/Ehviewer-Overhauled/Ehviewer/issues/873
|
||||
override suspend fun addCookie(requestUrl: Url, cookie: Cookie) {
|
||||
if (cookie.name != KEY_UTMP_NAME) {
|
||||
manager.setCookie(requestUrl.toString(), renderSetCookieHeader(cookie))
|
||||
manager.setCookie(requestUrl, cookie)
|
||||
}
|
||||
}
|
||||
|
||||
override fun close() = Unit
|
||||
|
||||
private fun getCookies(url: String) = manager.getCookie(url)?.let { parseClientCookiesHeader(it) }
|
||||
|
||||
fun load(url: Url): List<Cookie> {
|
||||
val checkTips = EhUrl.DOMAIN_E in url.host
|
||||
return getCookies(url.toString())?.mapTo(mutableListOf()) {
|
||||
override suspend fun get(requestUrl: Url): List<Cookie> {
|
||||
val checkTips = requestUrl.host == urlE.host
|
||||
return manager.getCookies(requestUrl)?.mapTo(mutableListOf()) {
|
||||
Cookie(it.key, it.value)
|
||||
}?.apply {
|
||||
if (checkTips) {
|
||||
@@ -76,6 +76,4 @@ object EhCookieStore : CookiesStorage {
|
||||
}
|
||||
} ?: if (checkTips) listOf(sTipsCookie) else emptyList()
|
||||
}
|
||||
|
||||
override suspend fun get(requestUrl: Url) = load(requestUrl)
|
||||
}
|
||||
@@ -9,6 +9,7 @@ open class Snapshot internal constructor(private val delegate: Preferences) {
|
||||
}
|
||||
|
||||
class MutableSnapshot internal constructor(private val delegate: MutablePreferences) : Snapshot(delegate) {
|
||||
fun <T> remove(pref: PrefDelegate<T>): T = delegate.remove(pref.key)
|
||||
operator fun <T> set(pref: PrefDelegate<T>, value: T) {
|
||||
if (value == null) {
|
||||
delegate.remove(pref.key)
|
||||
|
||||
@@ -317,6 +317,8 @@
|
||||
<string name="settings_eh_show_jpn_title_summary">Require enabling Japanese Title in Settings on EHentai website</string>
|
||||
<string name="settings_eh_show_gallery_pages">Show gallery pages</string>
|
||||
<string name="settings_eh_show_gallery_pages_summary">Display the number of pages in the gallery list</string>
|
||||
<string name="settings_eh_show_reading_progress">Show reading progress</string>
|
||||
<string name="settings_eh_show_reading_progress_summary">Display reading progress in gallery list</string>
|
||||
<string name="settings_eh_show_vote_status">Show tag vote status</string>
|
||||
<string name="settings_eh_show_gallery_comments">Show gallery comments</string>
|
||||
<string name="settings_eh_show_gallery_comments_summary">Show comments on the gallery details page</string>
|
||||
|
||||
@@ -301,6 +301,8 @@
|
||||
<string name="settings_eh_show_jpn_title_summary">需同时在 EHentai 网站设置中启用 Japanese Title</string>
|
||||
<string name="settings_eh_show_gallery_pages">显示画廊页数</string>
|
||||
<string name="settings_eh_show_gallery_pages_summary">在画廊列表中显示页数</string>
|
||||
<string name="settings_eh_show_reading_progress">显示阅读进度</string>
|
||||
<string name="settings_eh_show_reading_progress_summary">在画廊列表中显示阅读进度</string>
|
||||
<string name="settings_eh_show_vote_status">显示标签投票状态</string>
|
||||
<string name="settings_eh_show_gallery_comments">显示画廊评论</string>
|
||||
<string name="settings_eh_show_gallery_comments_summary">在画廊详情页中显示评论</string>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import org.jetbrains.compose.compose
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.ehviewer.multiplatform.library.compose)
|
||||
}
|
||||
@@ -9,19 +7,20 @@ kotlin {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(projects.core.common)
|
||||
api(compose.material3)
|
||||
api(compose.materialIconsExtended)
|
||||
api(libs.compose.material3)
|
||||
api(libs.compose.material.icons.extended)
|
||||
api(libs.compose.material3.adaptive)
|
||||
api(libs.androidx.lifecycle.compose)
|
||||
api(libs.androidx.lifecycle.viewmodel.compose)
|
||||
implementation(compose("org.jetbrains.compose.ui:ui-backhandler"))
|
||||
implementation(compose.preview)
|
||||
implementation(libs.compose.ui.backhandler)
|
||||
implementation(libs.compose.ui.tooling.preview)
|
||||
}
|
||||
}
|
||||
|
||||
androidMain {
|
||||
dependencies {
|
||||
api(project.dependencies.platform(libs.compose.bom))
|
||||
api(libs.compose.foundation)
|
||||
implementation(libs.androidx.activity.compose)
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -86,6 +86,7 @@ internal abstract class HorizontalDragGestureNode(
|
||||
private fun startListeningForEvents() {
|
||||
isListeningForEvents = true
|
||||
|
||||
@Suppress("ktlint:standard:kdoc")
|
||||
/**
|
||||
* To preserve the original behavior we had (before the Modifier.Node migration) we need to
|
||||
* scope the DragStopped and DragCancel methods to the node's coroutine scope instead of using
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("ktlint:standard:kdoc")
|
||||
|
||||
package androidx.compose.material3.fork
|
||||
|
||||
/**
|
||||
|
||||
+4
-4
@@ -16,7 +16,7 @@
|
||||
</p>
|
||||
|
||||
<h1 align="center">
|
||||
<img src="https://github.com/Ehviewer-Overhauled/Art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<img src="https://github.com/FooIbar/EhViewer-art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<br>EhViewer<br>
|
||||
</h1>
|
||||
|
||||
@@ -78,13 +78,13 @@
|
||||
*Android 6 のデバイスは [ISRG Root X1](https://letsencrypt.org/certs/isrgrootx1.pem) 証明書のインストールが必要です
|
||||
|
||||
<a href="https://github.com/FooIbar/EhViewer/releases">
|
||||
<img alt="Get it on GitHub" src="https://github.com/Ehviewer-Overhauled/Art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
<img alt="Get it on GitHub" src="https://github.com/FooIbar/EhViewer-art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
</a>
|
||||
|
||||
# スクリーンショット
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# 感謝
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</p>
|
||||
|
||||
<h1 align="center">
|
||||
<img src="https://github.com/Ehviewer-Overhauled/Art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<img src="https://github.com/FooIbar/EhViewer-art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<br>EhViewer<br>
|
||||
</h1>
|
||||
|
||||
@@ -77,13 +77,13 @@
|
||||
*运行 Android 6 的设备需安装 [ISRG Root X1](https://letsencrypt.org/certs/isrgrootx1.pem) 证书
|
||||
|
||||
<a href="https://github.com/FooIbar/EhViewer/releases">
|
||||
<img alt="Get it on GitHub" src="https://github.com/Ehviewer-Overhauled/Art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
<img alt="Get it on GitHub" src="https://github.com/FooIbar/EhViewer-art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
</a>
|
||||
|
||||
# 截图
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# 感谢
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</p>
|
||||
|
||||
<h1 align="center">
|
||||
<img src="https://github.com/Ehviewer-Overhauled/Art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<img src="https://github.com/FooIbar/EhViewer-art/blob/master/launcher_icon-web.svg" width="200" alt="EhViewer">
|
||||
<br>EhViewer<br>
|
||||
</h1>
|
||||
|
||||
@@ -75,13 +75,13 @@
|
||||
| Marshmallow | 6.0 | 有限支援,無保證 |
|
||||
|
||||
<a href="https://github.com/FooIbar/EhViewer/releases">
|
||||
<img alt="Get it on GitHub" src="https://github.com/Ehviewer-Overhauled/Art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
<img alt="Get it on GitHub" src="https://github.com/FooIbar/EhViewer-art/blob/master/get-it-on-github.svg" width="200px"/>
|
||||
</a>
|
||||
|
||||
# 截圖
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# 感謝
|
||||
|
||||
|
||||
+33
-32
@@ -1,40 +1,41 @@
|
||||
[versions]
|
||||
aboutlibraries = "13.0.0"
|
||||
aboutlibraries = "13.1.0"
|
||||
accompanist = "0.37.3"
|
||||
agp = "8.13.0"
|
||||
androidx-activity = "1.12.0-alpha09"
|
||||
agp = "8.13.2"
|
||||
androidx-activity = "1.12.1"
|
||||
androidx-appcompat = "1.7.1"
|
||||
androidx-biometric = "1.4.0-alpha04"
|
||||
androidx-browser = "1.9.0"
|
||||
androidx-core = "1.17.0"
|
||||
androidx-core-splashscreen = "1.2.0-rc01"
|
||||
androidx-datastore = "1.1.7"
|
||||
androidx-lifecycle = "2.10.0-alpha05"
|
||||
androidx-core-splashscreen = "1.2.0"
|
||||
androidx-datastore = "1.2.0"
|
||||
androidx-lifecycle = "2.10.0"
|
||||
androidx-paging = "3.3.6"
|
||||
androidx-room = "2.8.2"
|
||||
androidx-work = "2.11.0-rc01"
|
||||
arrow = "2.1.2"
|
||||
androidx-room = "2.8.4"
|
||||
androidx-webkit = "1.14.0"
|
||||
androidx-work = "2.11.0"
|
||||
arrow = "2.2.1.1"
|
||||
coil = "3.3.0"
|
||||
compose-bom = "2025.10.00"
|
||||
compose-multiplatform = "1.9.0"
|
||||
compose-bom = "2025.12.00"
|
||||
compose-multiplatform = "1.9.3"
|
||||
compose-destinations = "2.3.0"
|
||||
compose-preference = "2.1.0"
|
||||
kotlin = "2.2.20"
|
||||
kotlin = "2.3.0"
|
||||
kotlinx-coroutines = "1.10.2"
|
||||
kotlinx-datetime = "0.7.1"
|
||||
kotlinx-io = "0.8.0"
|
||||
kotlinx-io = "0.8.2"
|
||||
kotlinx-serialization = "1.9.0"
|
||||
ksp = "2.2.20-2.0.4"
|
||||
ktor = "3.3.1"
|
||||
moko-resources = "0.25.1"
|
||||
okhttp = "5.2.1"
|
||||
okio = "3.16.1"
|
||||
ksp = "2.3.4"
|
||||
ktor = "3.3.3"
|
||||
moko-resources = "0.25.2"
|
||||
okhttp = "5.3.2"
|
||||
okio = "3.16.4"
|
||||
splitties = "3.0.0"
|
||||
spotless = "8.0.0"
|
||||
spotless = "8.1.0"
|
||||
telephoto = "0.18.0"
|
||||
xmlutil = "0.91.2"
|
||||
xmlutil = "0.91.3"
|
||||
junit = "1.3.0"
|
||||
uiautomator = "2.4.0-alpha06"
|
||||
uiautomator = "2.4.0-alpha07"
|
||||
benchmark = "1.4.1"
|
||||
profileinstaller = "1.4.1"
|
||||
|
||||
@@ -59,6 +60,7 @@ androidx-paging-compose = { module = "androidx.paging:paging-compose", version.r
|
||||
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidx-room" }
|
||||
androidx-room-paging = { module = "androidx.room:room-paging", version.ref = "androidx-room" }
|
||||
|
||||
androidx-webkit = { module = "androidx.webkit:webkit", version.ref = "androidx-webkit" }
|
||||
androidx-work-runtime = { module = "androidx.work:work-runtime", version.ref = "androidx-work" }
|
||||
|
||||
arrow-fx-coroutines = { module = "io.arrow-kt:arrow-fx-coroutines" }
|
||||
@@ -73,12 +75,12 @@ coil-network = { module = "io.coil-kt.coil3:coil-network-ktor3" }
|
||||
|
||||
compose-bom = { module = "androidx.compose:compose-bom-alpha", version.ref = "compose-bom" }
|
||||
compose-foundation = { module = "androidx.compose.foundation:foundation" }
|
||||
compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
|
||||
compose-material3 = { module = "androidx.compose.material3:material3" }
|
||||
compose-material3-adaptive = { module = "org.jetbrains.compose.material3.adaptive:adaptive", version = "1.1.2" }
|
||||
compose-material-icons-extended = { module = "org.jetbrains.compose.material:material-icons-extended", version = "1.7.3" }
|
||||
compose-material3 = { module = "org.jetbrains.compose.material3:material3", version = "1.9.0" }
|
||||
compose-material3-adaptive = { module = "org.jetbrains.compose.material3.adaptive:adaptive", version = "1.2.0" }
|
||||
compose-ui-backhandler = { module = "org.jetbrains.compose.ui:ui-backhandler", version.ref = "compose-multiplatform" }
|
||||
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
|
||||
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
|
||||
compose-ui-util = { module = "androidx.compose.ui:ui-util" }
|
||||
compose-ui-tooling-preview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "compose-multiplatform" }
|
||||
|
||||
compose-destinations-core = { module = "io.github.raamcosta.compose-destinations:core", version.ref = "compose-destinations" }
|
||||
compose-destinations-compiler = { module = "io.github.raamcosta.compose-destinations:ksp", version.ref = "compose-destinations" }
|
||||
@@ -86,20 +88,21 @@ compose-destinations-compiler = { module = "io.github.raamcosta.compose-destinat
|
||||
compose-preference = { module = "me.zhanghai.compose.preference:preference", version.ref = "compose-preference" }
|
||||
|
||||
material-motion-core = "io.github.fornewid:material-motion-compose-core:2.0.1"
|
||||
material-kolor = "com.materialkolor:material-kolor:3.0.1"
|
||||
material-kolor = "com.materialkolor:material-kolor:4.0.5"
|
||||
|
||||
desugar = "com.android.tools:desugar_jdk_libs:2.1.5"
|
||||
|
||||
diff = "io.github.petertrr:kotlin-multiplatform-diff:1.1.0"
|
||||
diff = "io.github.petertrr:kotlin-multiplatform-diff:1.2.0"
|
||||
|
||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
|
||||
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
|
||||
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
|
||||
kotlinx-io = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kotlinx-io" }
|
||||
|
||||
ktlint = "com.pinterest.ktlint:ktlint-cli:1.7.1"
|
||||
ktlint = "com.pinterest.ktlint:ktlint-cli:1.8.0"
|
||||
|
||||
okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp" }
|
||||
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
|
||||
|
||||
logcat = "com.squareup.logcat:logcat:0.4"
|
||||
@@ -118,7 +121,6 @@ serialization-xml = { module = "io.github.pdvrieze.xmlutil:serialization", versi
|
||||
serialization-xml-io = { module = "io.github.pdvrieze.xmlutil:serialization-io", version.ref = "xmlutil" }
|
||||
|
||||
splitties-appctx = { module = "com.louiscad.splitties:splitties-appctx", version.ref = "splitties" }
|
||||
splitties-arch-room = { module = "com.louiscad.splitties:splitties-arch-room", version.ref = "splitties" }
|
||||
splitties-systemservices = { module = "com.louiscad.splitties:splitties-systemservices", version.ref = "splitties" }
|
||||
|
||||
telephoto-zoomable = { module = "me.saket.telephoto:zoomable", version.ref = "telephoto" }
|
||||
@@ -135,9 +137,8 @@ spotless-gradlePlugin = { module = "com.diffplug.spotless:spotless-plugin-gradle
|
||||
[bundles]
|
||||
arrow = ["arrow-fx-coroutines", "arrow-functions", "arrow-resilience"]
|
||||
coil = ["coil-compose", "coil-gif", "coil-network"]
|
||||
compose = ["compose-foundation", "compose-material-icons-extended", "compose-material3", "compose-material3-adaptive", "compose-ui-util"]
|
||||
kotlinx-serialization = ["serialization-cbor", "serialization-json", "serialization-json-io", "serialization-xml", "serialization-xml-io"]
|
||||
splitties = ["splitties-appctx", "splitties-arch-room", "splitties-systemservices"]
|
||||
splitties = ["splitties-appctx", "splitties-systemservices"]
|
||||
|
||||
[plugins]
|
||||
aboutlibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutlibraries" }
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+9
-16
@@ -15,19 +15,18 @@
|
||||
"matchStrings": [
|
||||
"(?<depName>\\S*)\\s*GIT_REPOSITORY https://(?<datasource>.*?)\\.com/(?<packageName>.*?)\\.git\\s*GIT_TAG (?<currentValue>\\S*)"
|
||||
],
|
||||
"datasourceTemplate": "{{{datasource}}}-tags"
|
||||
"datasourceTemplate": "{{datasource}}-tags"
|
||||
},
|
||||
{
|
||||
"customType": "regex",
|
||||
"managerFilePatterns": [
|
||||
"chrome.version"
|
||||
"/(^|/)CMakeLists\\.txt$/"
|
||||
],
|
||||
"matchStrings": [
|
||||
"(?<currentValue>\\S+)"
|
||||
"(/(?<depName>[^/]+)){2}-(?<currentValue>.+)\\.tar\\.gz"
|
||||
],
|
||||
"depNameTemplate": "chrome",
|
||||
"datasourceTemplate": "custom.chrome",
|
||||
"extractVersionTemplate": "^(?<version>\\d+)"
|
||||
"datasourceTemplate": "custom.gnu",
|
||||
"extractVersionTemplate": "{{depName}}-(?<version>.+)\\.tar\\.gz$"
|
||||
},
|
||||
{
|
||||
"customType": "regex",
|
||||
@@ -54,10 +53,6 @@
|
||||
}
|
||||
],
|
||||
"customDatasources": {
|
||||
"chrome": {
|
||||
"defaultRegistryUrlTemplate": "https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE",
|
||||
"format": "plain"
|
||||
},
|
||||
"rust-nightly": {
|
||||
"defaultRegistryUrlTemplate": "https://rust-lang.github.io/rustup-components-history/aarch64-linux-android/rust-std",
|
||||
"format": "plain"
|
||||
@@ -67,6 +62,10 @@
|
||||
"transformTemplates": [
|
||||
"{\"releases\":[{\"version\":$match(body,/ndkVersion \"([^\"]+)\"/).groups[0]}],\"changelogUrl\":html_url}"
|
||||
]
|
||||
},
|
||||
"gnu": {
|
||||
"defaultRegistryUrlTemplate": "https://ftpmirror.gnu.org/{{packageName}}/",
|
||||
"format": "html"
|
||||
}
|
||||
},
|
||||
"packageRules": [
|
||||
@@ -92,12 +91,6 @@
|
||||
],
|
||||
"allowedVersions": "!/compat$/"
|
||||
},
|
||||
{
|
||||
"matchDepNames": [
|
||||
"nettle"
|
||||
],
|
||||
"versioning": "regex:^nettle_(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?(?<prerelease>rc\\d+)?"
|
||||
},
|
||||
{
|
||||
"matchDepNames": [
|
||||
"rust-nightly"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2025-10-05"
|
||||
channel = "nightly-2025-11-15"
|
||||
components = ["rustfmt", "clippy", "rust-src"]
|
||||
targets = ["aarch64-linux-android", "x86_64-linux-android"]
|
||||
profile = "minimal"
|
||||
+1
-1
@@ -28,7 +28,7 @@ dependencyResolutionManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.android.settings") version "8.13.0"
|
||||
id("com.android.settings") version "8.13.2"
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
Reference in new issue
Block a user