├── .bundle
└── config
├── .eslintrc.js
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .husky
└── pre-commit
├── .nvmrc
├── .prettierignore
├── .prettierrc.js
├── .ruby-version
├── .vscode
└── settings.json
├── .watchmanconfig
├── .yarnrc
├── Gemfile
├── LICENSE
├── __tests__
└── App.test.tsx
├── android
├── app
│ ├── build.gradle
│ ├── debug.keystore
│ ├── proguard-rules.pro
│ └── src
│ │ ├── debug
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── mangareader
│ │ │ └── ReactNativeFlipper.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── mangareader
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainApplication.java
│ │ └── res
│ │ │ ├── drawable
│ │ │ └── rn_edit_text_material.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── bootsplash_logo.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── bootsplash_logo.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── bootsplash_logo.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── bootsplash_logo.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── bootsplash_logo.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── release
│ │ └── java
│ │ └── com
│ │ └── mangareader
│ │ └── ReactNativeFlipper.java
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── app.json
├── babel.config.js
├── index.js
├── ios
├── .xcode.env
├── MangaReader.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── MangaReader.xcscheme
├── MangaReader.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── MangaReader
│ ├── AppDelegate.h
│ ├── AppDelegate.mm
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── 1024x1024.png
│ │ │ ├── 120x120.png
│ │ │ ├── 180x180.png
│ │ │ ├── 40x40.png
│ │ │ ├── 58x58.png
│ │ │ ├── 60x60.png
│ │ │ ├── 80x80.png
│ │ │ ├── 87x87.png
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ └── SplashScreen.imageset
│ │ │ ├── Contents.json
│ │ │ └── splash_screen.png
│ ├── Info.plist
│ ├── LaunchScreen.storyboard
│ └── main.m
├── MangaReaderTests
│ ├── Info.plist
│ └── MangaReaderTests.m
├── Podfile
├── Podfile.lock
└── _xcode.env
├── jest.config.js
├── metro.config.js
├── package.json
├── patches
└── native-base+3.4.28.patch
├── precommit.js
├── privacy_policy.md
├── readme.md
├── src
├── App.tsx
├── assets
│ ├── christmas.gif
│ ├── ground_pound.gif
│ ├── reading.gif
│ ├── tap_tap.gif
│ └── this_is_true.gif
├── components
│ ├── ActionsheetSelect.tsx
│ ├── Bookshelf.tsx
│ ├── ComicImage.tsx
│ ├── Controller.tsx
│ ├── Delay.tsx
│ ├── Drawer.tsx
│ ├── Empty.tsx
│ ├── ErrorFallback.tsx
│ ├── ErrorWithRetry.tsx
│ ├── Header.tsx
│ ├── InputModal.tsx
│ ├── Loading.tsx
│ ├── PageSlider.tsx
│ ├── PathModal.tsx
│ ├── Reader.tsx
│ ├── RedHeart.tsx
│ ├── Rotate.tsx
│ ├── ScoreRate.tsx
│ ├── Shake.tsx
│ ├── SpinLoading.tsx
│ ├── VectorIcon.tsx
│ └── WhiteCurtain.tsx
├── hooks
│ ├── index.ts
│ ├── useAppState.ts
│ ├── useDebouncedSafeAreaFrame.ts
│ ├── useDebouncedSafeAreaInsets.ts
│ ├── useDelayRender.ts
│ ├── useInterval.ts
│ ├── useMessageToast.ts
│ ├── useOnce.ts
│ ├── usePrevNext.ts
│ ├── useSplitWidth.ts
│ └── useVolumeUpDown.ts
├── plugins
│ ├── base.ts
│ ├── bzm.ts
│ ├── copy.ts
│ ├── dmzj.ts
│ ├── happy.ts
│ ├── index.ts
│ ├── jmc.ts
│ ├── kl.ts
│ ├── mbz.ts
│ ├── mhdb.ts
│ ├── mhg.ts
│ ├── mhgm.ts
│ ├── mhm.ts
│ ├── nh.ts
│ ├── pica.ts
│ └── rm5.ts
├── redux
│ ├── index.ts
│ ├── saga.ts
│ ├── slice.ts
│ └── store.ts
├── schema
│ ├── dict.json
│ ├── favorites.json
│ ├── plugin.json
│ ├── root.json
│ ├── setting.json
│ └── task.json
├── types
│ ├── global.d.ts
│ ├── plugins.d.ts
│ ├── router.d.ts
│ └── store.d.ts
├── utils
│ ├── cache.ts
│ ├── common.ts
│ ├── define.ts
│ ├── enum.ts
│ ├── fetch.ts
│ ├── index.ts
│ ├── navigation.ts
│ └── theme.ts
└── views
│ ├── About.tsx
│ ├── Chapter.tsx
│ ├── Detail.tsx
│ ├── Discovery.tsx
│ ├── Home.tsx
│ ├── Plugin.tsx
│ ├── Search.tsx
│ └── Webview.tsx
├── static
├── cloudflare_step1.jpeg
├── cloudflare_step2.jpeg
├── cloudflare_step3.jpeg
├── cloudflare_step4.jpeg
├── cloudflare_step5.jpeg
├── demo.gif
├── pica_step1.jpeg
├── pica_step2.jpeg
├── pica_step3.jpeg
├── usage1.jpeg
├── usage2.jpeg
├── usage3.jpeg
├── usage4.jpeg
└── usage5.jpeg
├── tsconfig.json
└── yarn.lock
/.bundle/config:
--------------------------------------------------------------------------------
1 | BUNDLE_PATH: "vendor/bundle"
2 | BUNDLE_FORCE_RUBY_PLATFORM: 1
3 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: '@react-native',
4 | };
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 错误报告
3 | about: 样式/逻辑错误、应用崩溃/卡死、异常行为请选这个
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 | ---
8 |
9 | **非常感谢您填写错误报告!**
10 |
11 | **以下是一些注意事项,请务必阅读**
12 |
13 | - 提交报告前请检索相关 issues,避免重复提问
14 | - 提交报告前请先尝试浏览器里访问原网站排除网络问题
15 | - 请按下边 issues 模板要求提供相关信息,避免挤牙膏式提问
16 |
17 | ---
18 |
19 | **问题描述**
20 |
21 | **如何复现**
22 |
23 |
24 |
25 | **错误信息**
26 |
27 |
28 |
29 | **设备信息**
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 功能优化/建议
3 | about: 新插件、新功能、使用优化请选这个
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 | ---
8 |
9 | **现有功能改进还是新功能/插件提议?**
10 |
11 | **请简单描述下你的需求**
12 |
13 |
14 |
15 | **解决方案**
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | ios/.xcode.env.local
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 | *.hprof
33 | .cxx/
34 | *.keystore
35 | !debug.keystore
36 |
37 | # node.js
38 | #
39 | node_modules/
40 | npm-debug.log
41 | yarn-error.log
42 |
43 | # fastlane
44 | #
45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46 | # screenshots whenever they are needed.
47 | # For more information about the recommended setup visit:
48 | # https://docs.fastlane.tools/best-practices/source-control/
49 |
50 | **/fastlane/report.xml
51 | **/fastlane/Preview.html
52 | **/fastlane/screenshots
53 | **/fastlane/test_output
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # Ruby / CocoaPods
59 | /ios/Pods/
60 | /vendor/bundle/
61 |
62 | # Temporary files created by Metro to check the health of the file watcher
63 | .metro-health-check*
64 |
65 | # testing
66 | /coverage
67 |
68 | # backup floder
69 | /backup
70 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | . "$(dirname -- "$0")/_/husky.sh"
3 |
4 | # eslint校验
5 | yarn lint
6 | # 更新schema文件
7 | yarn jsonschema
8 | # 检测IOS的PRODUCT_BUNDLE_IDENTIFIER
9 | node ./precommit.js
10 |
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | 18.16.1
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | backup
2 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | printWidth: 100,
3 | singleQuote: true,
4 | trailingComma: 'es5',
5 | };
6 |
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | 3.0.0
2 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "typescript.tsdk": "node_modules/typescript/lib",
3 | "files.eol": "\n"
4 | }
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/.yarnrc:
--------------------------------------------------------------------------------
1 | --install.frozen-lockfile true
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4 | ruby ">= 2.6.10"
5 |
6 | gem 'cocoapods', '~> 1.13'
7 | gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 youniaogu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/__tests__/App.test.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import 'react-native';
6 | import React from 'react';
7 | import App from '../src/App';
8 |
9 | // Note: import explicitly to use the types shiped with jest.
10 | import { it } from '@jest/globals';
11 |
12 | // Note: test renderer must be required after react-native.
13 | import renderer from 'react-test-renderer';
14 |
15 | it('renders correctly', () => {
16 | renderer.create();
17 | });
18 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 | apply plugin: "com.facebook.react"
3 |
4 | /**
5 | * This is the configuration block to customize your React Native Android app.
6 | * By default you don't need to apply any configuration, just uncomment the lines you need.
7 | */
8 | react {
9 | /* Folders */
10 | // The root of your project, i.e. where "package.json" lives. Default is '..'
11 | // root = file("../")
12 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native
13 | // reactNativeDir = file("../node_modules/react-native")
14 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
15 | // codegenDir = file("../node_modules/@react-native/codegen")
16 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
17 | // cliFile = file("../node_modules/react-native/cli.js")
18 |
19 | /* Variants */
20 | // The list of variants to that are debuggable. For those we're going to
21 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
22 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
23 | // debuggableVariants = ["liteDebug", "prodDebug"]
24 |
25 | /* Bundling */
26 | // A list containing the node command and its flags. Default is just 'node'.
27 | // nodeExecutableAndArgs = ["node"]
28 | //
29 | // The command to run when bundling. By default is 'bundle'
30 | // bundleCommand = "ram-bundle"
31 | //
32 | // The path to the CLI configuration file. Default is empty.
33 | // bundleConfig = file(../rn-cli.config.js)
34 | //
35 | // The name of the generated asset file containing your JS bundle
36 | // bundleAssetName = "MyApplication.android.bundle"
37 | //
38 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
39 | // entryFile = file("../js/MyApplication.android.js")
40 | //
41 | // A list of extra flags to pass to the 'bundle' commands.
42 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
43 | // extraPackagerArgs = []
44 |
45 | /* Hermes Commands */
46 | // The hermes compiler command to run. By default it is 'hermesc'
47 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
48 | //
49 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
50 | // hermesFlags = ["-O", "-output-source-map"]
51 | }
52 |
53 | /**
54 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
55 | */
56 | def enableProguardInReleaseBuilds = true
57 |
58 | /**
59 | * The preferred build flavor of JavaScriptCore (JSC)
60 | *
61 | * For example, to use the international variant, you can use:
62 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
63 | *
64 | * The international variant includes ICU i18n library and necessary data
65 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
66 | * give correct results when using with locales other than en-US. Note that
67 | * this variant is about 6MiB larger per architecture than default.
68 | */
69 | def jscFlavor = 'org.webkit:android-jsc:+'
70 |
71 | android {
72 | ndkVersion rootProject.ext.ndkVersion
73 |
74 | compileSdkVersion rootProject.ext.compileSdkVersion
75 |
76 | namespace "com.mangareader"
77 | defaultConfig {
78 | applicationId "com.youniaogu.mangareader"
79 | minSdkVersion rootProject.ext.minSdkVersion
80 | targetSdkVersion rootProject.ext.targetSdkVersion
81 | versionCode 51
82 | versionName "0.7.7"
83 | }
84 | signingConfigs {
85 | debug {
86 | storeFile file('debug.keystore')
87 | storePassword 'android'
88 | keyAlias 'androiddebugkey'
89 | keyPassword 'android'
90 | }
91 | release {
92 | if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
93 | storeFile file(MYAPP_RELEASE_STORE_FILE)
94 | storePassword MYAPP_RELEASE_STORE_PASSWORD
95 | keyAlias MYAPP_RELEASE_KEY_ALIAS
96 | keyPassword MYAPP_RELEASE_KEY_PASSWORD
97 | }
98 | }
99 | }
100 | buildTypes {
101 | debug {
102 | signingConfig signingConfigs.debug
103 | }
104 | release {
105 | // Caution! In production, you need to generate your own keystore file.
106 | // see https://reactnative.dev/docs/signed-apk-android.
107 | signingConfig signingConfigs.release
108 | minifyEnabled enableProguardInReleaseBuilds
109 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
110 | }
111 | }
112 | }
113 |
114 | dependencies {
115 | // The version of react-native is set by the React Native Gradle Plugin
116 | implementation("com.facebook.react:react-android")
117 |
118 | // react-native-bootsplash
119 | implementation("androidx.core:core-splashscreen:1.0.0")
120 |
121 | // For animated GIF support
122 | implementation 'com.facebook.fresco:animated-gif:2.5.0'
123 |
124 | // For WebP support, including animated WebP
125 | implementation 'com.facebook.fresco:animated-webp:2.5.0'
126 | implementation 'com.facebook.fresco:webpsupport:2.5.0'
127 |
128 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
129 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
130 | exclude group:'com.squareup.okhttp3', module:'okhttp'
131 | }
132 |
133 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
134 | if (hermesEnabled.toBoolean()) {
135 | implementation("com.facebook.react:hermes-android")
136 | } else {
137 | implementation jscFlavor
138 | }
139 | }
140 |
141 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
142 |
143 | // react-native-vector-icons
144 | project.ext.vectoricons = [
145 | iconFontNames: [ 'MaterialIcons.ttf', 'MaterialCommunityIcons.ttf', 'Octicons.ttf', 'Ionicons.ttf' ] // Name of the font files you want to copy
146 | ]
147 | apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
148 |
--------------------------------------------------------------------------------
/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/debug.keystore
--------------------------------------------------------------------------------
/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/android/app/src/debug/java/com/mangareader/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | *
This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.mangareader;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21 | import com.facebook.react.ReactInstanceEventListener;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | /**
28 | * Class responsible of loading Flipper inside your React Native application. This is the debug
29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30 | */
31 | public class ReactNativeFlipper {
32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33 | if (FlipperUtils.shouldEnableFlipper(context)) {
34 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
35 |
36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37 | client.addPlugin(new DatabasesFlipperPlugin(context));
38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39 | client.addPlugin(CrashReporterPlugin.getInstance());
40 |
41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42 | NetworkingModule.setCustomClientBuilder(
43 | new NetworkingModule.CustomClientBuilder() {
44 | @Override
45 | public void apply(OkHttpClient.Builder builder) {
46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47 | }
48 | });
49 | client.addPlugin(networkFlipperPlugin);
50 | client.start();
51 |
52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53 | // Hence we run if after all native modules have been initialized
54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55 | if (reactContext == null) {
56 | reactInstanceManager.addReactInstanceEventListener(
57 | new ReactInstanceEventListener() {
58 | @Override
59 | public void onReactContextInitialized(ReactContext reactContext) {
60 | reactInstanceManager.removeReactInstanceEventListener(this);
61 | reactContext.runOnNativeModulesQueueThread(
62 | new Runnable() {
63 | @Override
64 | public void run() {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | });
68 | }
69 | });
70 | } else {
71 | client.addPlugin(new FrescoFlipperPlugin());
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/mangareader/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.mangareader;
2 |
3 | import android.os.Bundle;
4 | import com.zoontek.rnbootsplash.RNBootSplash;
5 | import com.facebook.react.ReactActivity;
6 | import com.facebook.react.ReactActivityDelegate;
7 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
8 | import com.facebook.react.defaults.DefaultReactActivityDelegate;
9 |
10 | public class MainActivity extends ReactActivity {
11 |
12 | /**
13 | * Returns the name of the main component registered from JavaScript. This is used to schedule
14 | * rendering of the component.
15 | */
16 | @Override
17 | protected String getMainComponentName() {
18 | return "MangaReader";
19 | }
20 |
21 | /**
22 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
23 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
24 | * (aka React 18) with two boolean flags.
25 | */
26 | @Override
27 | protected ReactActivityDelegate createReactActivityDelegate() {
28 | return new DefaultReactActivityDelegate(
29 | this,
30 | getMainComponentName(),
31 | // If you opted-in for the New Architecture, we enable the Fabric Renderer.
32 | DefaultNewArchitectureEntryPoint.getFabricEnabled());
33 | }
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | RNBootSplash.init(this); // ⬅️ initialize the splash screen
38 | super.onCreate(savedInstanceState); // or super.onCreate(null) with react-native-screens
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/mangareader/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.mangareader;
2 |
3 | import android.app.Application;
4 | import com.facebook.react.PackageList;
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9 | import com.facebook.react.defaults.DefaultReactNativeHost;
10 | import com.facebook.soloader.SoLoader;
11 | import java.util.List;
12 |
13 | public class MainApplication extends Application implements ReactApplication {
14 |
15 | private final ReactNativeHost mReactNativeHost =
16 | new DefaultReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | @SuppressWarnings("UnnecessaryLocalVariable")
25 | List packages = new PackageList(this).getPackages();
26 | // Packages that cannot be autolinked yet can be added manually here, for example:
27 | // packages.add(new MyReactNativePackage());
28 | return packages;
29 | }
30 |
31 | @Override
32 | protected String getJSMainModuleName() {
33 | return "index";
34 | }
35 |
36 | @Override
37 | protected boolean isNewArchEnabled() {
38 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
39 | }
40 |
41 | @Override
42 | protected Boolean isHermesEnabled() {
43 | return BuildConfig.IS_HERMES_ENABLED;
44 | }
45 | };
46 |
47 | @Override
48 | public ReactNativeHost getReactNativeHost() {
49 | return mReactNativeHost;
50 | }
51 |
52 | @Override
53 | public void onCreate() {
54 | super.onCreate();
55 | SoLoader.init(this, /* native exopackage */ false);
56 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
57 | // If you opted-in for the New Architecture, we load the native entry point for this app.
58 | DefaultNewArchitectureEntryPoint.load();
59 | }
60 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/bootsplash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-hdpi/bootsplash_logo.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/bootsplash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-mdpi/bootsplash_logo.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/bootsplash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xhdpi/bootsplash_logo.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/bootsplash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xxhdpi/bootsplash_logo.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/bootsplash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xxxhdpi/bootsplash_logo.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 | #FFFFFF
3 |
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MangaReader
3 |
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/android/app/src/release/java/com/mangareader/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.mangareader;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "33.0.0"
6 | minSdkVersion = 21
7 | compileSdkVersion = 33
8 | targetSdkVersion = 33
9 |
10 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
11 | ndkVersion = "23.1.7779620"
12 | }
13 | repositories {
14 | google()
15 | mavenCentral()
16 | }
17 | dependencies {
18 | classpath("com.android.tools.build:gradle")
19 | classpath("com.facebook.react:react-native-gradle-plugin")
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | # https://github.com/facebook/flipper/issues/4565
29 | # https://mvnrepository.com/artifact/com.facebook.flipper/flipper
30 | FLIPPER_VERSION=0.182.0
31 |
32 | # Use this property to specify which architecture you want to build.
33 | # You can also override it from the CLI using
34 | # ./gradlew -PreactNativeArchitectures=x86_64
35 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
36 |
37 | # Use this property to enable support to the new architecture.
38 | # This will allow you to use TurboModules and the Fabric render in
39 | # your application. You should enable this flag either if you want
40 | # to write custom TurboModules/Fabric components OR use libraries that
41 | # are providing them.
42 | newArchEnabled=false
43 |
44 | # Use this property to enable or disable the Hermes JS engine.
45 | # If set to false, you will be using JSC instead.
46 | hermesEnabled=true
47 |
48 | # https://react-native-async-storage.github.io/async-storage/docs/advanced/db_size/#increase-limit
49 | # database or disk is full (code 13 SQLITE_FULL)
50 | AsyncStorage_db_size_in_MB=1024
51 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
4 | networkTimeout=10000
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147 | # shellcheck disable=SC3045
148 | MAX_FD=$( ulimit -H -n ) ||
149 | warn "Could not query maximum file descriptor limit"
150 | esac
151 | case $MAX_FD in #(
152 | '' | soft) :;; #(
153 | *)
154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155 | # shellcheck disable=SC3045
156 | ulimit -n "$MAX_FD" ||
157 | warn "Could not set maximum file descriptor limit to $MAX_FD"
158 | esac
159 | fi
160 |
161 | # Collect all arguments for the java command, stacking in reverse order:
162 | # * args from the command line
163 | # * the main class name
164 | # * -classpath
165 | # * -D...appname settings
166 | # * --module-path (only if needed)
167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
168 |
169 | # For Cygwin or MSYS, switch paths to Windows format before running java
170 | if "$cygwin" || "$msys" ; then
171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
173 |
174 | JAVACMD=$( cygpath --unix "$JAVACMD" )
175 |
176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
177 | for arg do
178 | if
179 | case $arg in #(
180 | -*) false ;; # don't mess with options #(
181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
182 | [ -e "$t" ] ;; #(
183 | *) false ;;
184 | esac
185 | then
186 | arg=$( cygpath --path --ignore --mixed "$arg" )
187 | fi
188 | # Roll the args list around exactly as many times as the number of
189 | # args, so each arg winds up back in the position where it started, but
190 | # possibly modified.
191 | #
192 | # NB: a `for` loop captures its iteration list before it begins, so
193 | # changing the positional parameters here affects neither the number of
194 | # iterations, nor the values presented in `arg`.
195 | shift # remove old arg
196 | set -- "$@" "$arg" # push replacement arg
197 | done
198 | fi
199 |
200 | # Collect all arguments for the java command;
201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202 | # shell script including quotes and variable substitutions, so put them in
203 | # double quotes to make sure that they get re-expanded; and
204 | # * put everything else in single quotes, so that it's not re-expanded.
205 |
206 | set -- \
207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
208 | -classpath "$CLASSPATH" \
209 | org.gradle.wrapper.GradleWrapperMain \
210 | "$@"
211 |
212 | # Stop when "xargs" is not available.
213 | if ! command -v xargs >/dev/null 2>&1
214 | then
215 | die "xargs is not available"
216 | fi
217 |
218 | # Use "xargs" to parse quoted args.
219 | #
220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
221 | #
222 | # In Bash we could simply go:
223 | #
224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
225 | # set -- "${ARGS[@]}" "$@"
226 | #
227 | # but POSIX shell has neither arrays nor command substitution, so instead we
228 | # post-process each arg (as a line of input to sed) to backslash-escape any
229 | # character that might be a shell metacharacter, then use eval to reverse
230 | # that process (while maintaining the separation between arguments), and wrap
231 | # the whole thing up as a single "set" statement.
232 | #
233 | # This will of course break if any of these variables contains a newline or
234 | # an unmatched quote.
235 | #
236 |
237 | eval "set -- $(
238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
239 | xargs -n1 |
240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
241 | tr '\n' ' '
242 | )" '"$@"'
243 |
244 | exec "$JAVACMD" "$@"
245 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'MangaReader'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 | includeBuild('../node_modules/@react-native/gradle-plugin')
5 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "MangaReader",
3 | "displayName": "MangaReader"
4 | }
5 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | plugins: [
4 | [
5 | 'module-resolver',
6 | {
7 | root: ['./'],
8 | alias: {
9 | '^~/(.+)': './src/\\1',
10 | },
11 | extensions: ['.ios.js', '.android.js', '.js', '.jsx', '.json', '.tsx', '.ts', '.native.js'],
12 | },
13 | ],
14 | ['react-native-reanimated/plugin'],
15 | ],
16 | };
17 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import '~/utils/define';
2 | import { CacheManager } from '@georstat/react-native-image-cache';
3 | import { AppRegistry } from 'react-native';
4 | import { Dirs } from 'react-native-file-access';
5 | import { name } from './app.json';
6 | import dayjs from 'dayjs';
7 | import App from '~/App';
8 | import * as packageJson from './package.json';
9 |
10 | require('dayjs/locale/zh-cn');
11 |
12 | // https://day.js.org/docs/en/plugin/advanced-format
13 | dayjs.extend(require('dayjs/plugin/advancedFormat'));
14 | // https://day.js.org/docs/zh-CN/plugin/custom-parse-format
15 | dayjs.extend(require('dayjs/plugin/customParseFormat'));
16 | // https://day.js.org/docs/zh-CN/i18n/changing-locale
17 | dayjs.locale('zh-cn');
18 |
19 | process.env.NAME = name;
20 | process.env.VERSION = 'v' + packageJson.version;
21 | process.env.PUBLISH_TIME = packageJson.publishTime;
22 |
23 | CacheManager.config = {
24 | baseDir: `${Dirs.CacheDir}/images_cache/`,
25 | cacheLimit: 0,
26 | sourceAnimationDuration: 500,
27 | thumbnailAnimationDuration: 500,
28 | };
29 |
30 | AppRegistry.registerComponent(name, () => App);
31 |
--------------------------------------------------------------------------------
/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | export NODE_BINARY=$(command -v node)
2 |
--------------------------------------------------------------------------------
/ios/MangaReader.xcodeproj/xcshareddata/xcschemes/MangaReader.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/ios/MangaReader.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/MangaReader.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/MangaReader/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : RCTAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/ios/MangaReader/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 | #import "RNBootSplash.h"
3 |
4 | #import
5 |
6 | @implementation AppDelegate
7 |
8 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
9 | {
10 | self.moduleName = @"MangaReader";
11 | // You can add your custom initial props in the dictionary below.
12 | // They will be passed down to the ViewController used by React Native.
13 | self.initialProps = @{};
14 |
15 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
16 | }
17 |
18 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
19 | {
20 | #if DEBUG
21 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
22 | #else
23 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
24 | #endif
25 | }
26 |
27 | - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
28 | moduleName:(NSString *)moduleName
29 | initProps:(NSDictionary *)initProps {
30 | UIView *rootView = [super createRootViewWithBridge:bridge
31 | moduleName:moduleName
32 | initProps:initProps];
33 |
34 | [RNBootSplash initWithStoryboard:@"LaunchScreen" rootView:rootView]; // ⬅️ initialize the splash screen
35 |
36 | return rootView;
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/1024x1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/1024x1024.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/120x120.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/180x180.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/40x40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/40x40.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/58x58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/58x58.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/60x60.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/80x80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/80x80.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/87x87.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/AppIcon.appiconset/87x87.png
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "filename": "40x40.png",
5 | "idiom": "iphone",
6 | "scale": "2x",
7 | "size": "20x20"
8 | },
9 | {
10 | "filename": "60x60.png",
11 | "idiom": "iphone",
12 | "scale": "3x",
13 | "size": "20x20"
14 | },
15 | {
16 | "filename": "58x58.png",
17 | "idiom": "iphone",
18 | "scale": "2x",
19 | "size": "29x29"
20 | },
21 | {
22 | "filename": "87x87.png",
23 | "idiom": "iphone",
24 | "scale": "3x",
25 | "size": "29x29"
26 | },
27 | {
28 | "filename": "80x80.png",
29 | "idiom": "iphone",
30 | "scale": "2x",
31 | "size": "40x40"
32 | },
33 | {
34 | "filename": "120x120.png",
35 | "idiom": "iphone",
36 | "scale": "3x",
37 | "size": "40x40"
38 | },
39 | {
40 | "filename": "120x120.png",
41 | "idiom": "iphone",
42 | "scale": "2x",
43 | "size": "60x60"
44 | },
45 | {
46 | "filename": "180x180.png",
47 | "idiom": "iphone",
48 | "scale": "3x",
49 | "size": "60x60"
50 | },
51 | {
52 | "filename": "1024x1024.png",
53 | "idiom": "ios-marketing",
54 | "scale": "1x",
55 | "size": "1024x1024"
56 | }
57 | ],
58 | "info": {
59 | "author": "xcode",
60 | "version": 1
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/SplashScreen.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "filename": "splash_screen.png",
5 | "idiom": "iphone",
6 | "scale": "1x"
7 | },
8 | {
9 | "filename": "splash_screen.png",
10 | "idiom": "iphone",
11 | "scale": "2x"
12 | },
13 | {
14 | "filename": "splash_screen.png",
15 | "idiom": "iphone",
16 | "scale": "3x"
17 | }
18 | ],
19 | "info": {
20 | "author": "xcode",
21 | "version": 1
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/MangaReader/Images.xcassets/SplashScreen.imageset/splash_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/ios/MangaReader/Images.xcassets/SplashScreen.imageset/splash_screen.png
--------------------------------------------------------------------------------
/ios/MangaReader/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | MangaReader
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | NSPhotoLibraryAddUsageDescription
41 |
42 | NSPhotoLibraryUsageDescription
43 |
44 | UIAppFonts
45 |
46 | MaterialIcons.ttf
47 | MaterialCommunityIcons.ttf
48 | Octicons.ttf
49 | Ionicons.ttf
50 |
51 | UILaunchStoryboardName
52 | LaunchScreen
53 | UIRequiredDeviceCapabilities
54 |
55 | armv7
56 |
57 | UISupportedInterfaceOrientations
58 |
59 | UIInterfaceOrientationPortrait
60 | UIInterfaceOrientationLandscapeLeft
61 | UIInterfaceOrientationLandscapeRight
62 |
63 | UIViewControllerBasedStatusBarAppearance
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/ios/MangaReader/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/ios/MangaReader/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | @autoreleasepool {
8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/ios/MangaReaderTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ios/MangaReaderTests/MangaReaderTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface MangaReaderTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation MangaReaderTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Resolve react_native_pods.rb with node to allow for hoisting
2 | require Pod::Executable.execute_command('node', ['-p',
3 | 'require.resolve(
4 | "react-native/scripts/react_native_pods.rb",
5 | {paths: [process.argv[1]]},
6 | )', __dir__]).strip
7 |
8 | platform :ios, min_ios_version_supported
9 | prepare_react_native_project!
10 |
11 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
12 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
13 | #
14 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
15 | # ```js
16 | # module.exports = {
17 | # dependencies: {
18 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
19 | # ```
20 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
21 |
22 | linkage = ENV['USE_FRAMEWORKS']
23 | if linkage != nil
24 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
25 | use_frameworks! :linkage => linkage.to_sym
26 | end
27 |
28 | target 'MangaReader' do
29 | config = use_native_modules!
30 |
31 | # Flags change depending on the env values.
32 | flags = get_default_flags()
33 |
34 | use_react_native!(
35 | :path => config[:reactNativePath],
36 | # Hermes is now enabled by default. Disable by setting this flag to false.
37 | :hermes_enabled => flags[:hermes_enabled],
38 | :fabric_enabled => flags[:fabric_enabled],
39 | # Enables Flipper.
40 | #
41 | # Note that if you have use_frameworks! enabled, Flipper will not work and
42 | # you should disable the next line.
43 | :flipper_configuration => flipper_config,
44 | # An absolute path to your application root.
45 | :app_path => "#{Pod::Config.instance.installation_root}/.."
46 | )
47 |
48 | target 'MangaReaderTests' do
49 | inherit! :complete
50 | # Pods for testing
51 | end
52 |
53 | post_install do |installer|
54 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
55 | react_native_post_install(
56 | installer,
57 | config[:reactNativePath],
58 | :mac_catalyst_enabled => false
59 | )
60 | __apply_Xcode_12_5_M1_post_install_workaround(installer)
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/ios/_xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'react-native',
3 | };
4 |
--------------------------------------------------------------------------------
/metro.config.js:
--------------------------------------------------------------------------------
1 | const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2 |
3 | /**
4 | * Metro configuration
5 | * https://facebook.github.io/metro/docs/configuration
6 | *
7 | * @type {import('metro-config').MetroConfig}
8 | */
9 | const config = {};
10 |
11 | module.exports = mergeConfig(getDefaultConfig(__dirname), config);
12 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mangareader",
3 | "version": "0.7.7",
4 | "publishTime": "2025-01-12",
5 | "private": true,
6 | "scripts": {
7 | "start": "react-native start",
8 | "android": "react-native run-android",
9 | "android-release": "react-native run-android --mode release",
10 | "build-android": "cd ./android && ./gradlew assembleRelease",
11 | "bundle-android": "npx react-native build-android --mode=release",
12 | "ios": "react-native run-ios",
13 | "ios-release": "react-native run-ios --configuration Release",
14 | "clean": "react-native-clean-project",
15 | "preinstall": "npx only-allow yarn",
16 | "postinstall": "patch-package",
17 | "prepare": "husky install",
18 | "jsonschema": "yarn root-schema && yarn dict-schema && yarn task-schema && yarn plugin-schema && yarn setting-schema && yarn favorites-schema",
19 | "root-schema": "typescript-json-schema ./tsconfig.json RootStateType -o ./src/schema/root.json --required",
20 | "dict-schema": "typescript-json-schema ./tsconfig.json DictStateType -o ./src/schema/dict.json --required",
21 | "task-schema": "typescript-json-schema ./tsconfig.json TaskStateType -o ./src/schema/task.json --required",
22 | "plugin-schema": "typescript-json-schema ./tsconfig.json PluginStateType -o ./src/schema/plugin.json --required",
23 | "setting-schema": "typescript-json-schema ./tsconfig.json SettingStateType -o ./src/schema/setting.json --required",
24 | "favorites-schema": "typescript-json-schema ./tsconfig.json FavoritesStateType -o ./src/schema/favorites.json --required",
25 | "lint": "eslint \"**/*.{ts,tsx}\"",
26 | "test": "jest"
27 | },
28 | "dependencies": {
29 | "@georstat/react-native-image-cache": "^2.9.0",
30 | "@loadable/component": "^5.15.2",
31 | "@react-native-async-storage/async-storage": "^1.17.4",
32 | "@react-native-camera-roll/camera-roll": "^5.2.4",
33 | "@react-native-cookies/cookies": "^6.2.1",
34 | "@react-navigation/native": "^6.0.10",
35 | "@react-navigation/native-stack": "^6.6.2",
36 | "@reduxjs/toolkit": "^1.8.1",
37 | "@shopify/flash-list": "^1.4.3",
38 | "base-64": "^1.0.0",
39 | "blueimp-md5": "2.2.0",
40 | "buffer": "^6.0.3",
41 | "cheerio": "1.0.0-rc.10",
42 | "crypto-js": "^4.1.1",
43 | "dayjs": "^1.11.10",
44 | "json-schema-library": "^9.0.3",
45 | "lz-string": "^1.4.4",
46 | "native-base": "^3.4.4",
47 | "query-string": "^7.1.1",
48 | "react": "18.2.0",
49 | "react-error-boundary": "^4.0.12",
50 | "react-native": "0.72.10",
51 | "react-native-bootsplash": "^4.3.2",
52 | "react-native-canvas": "^0.1.38",
53 | "react-native-document-picker": "^9.0.1",
54 | "react-native-draggable-flatlist": "^4.0.1",
55 | "react-native-fast-image": "^8.6.3",
56 | "react-native-file-access": "^2.4.1",
57 | "react-native-gesture-handler": "^2.12.0",
58 | "react-native-reanimated": "^3.3.0",
59 | "react-native-safe-area-context": "^4.7.4",
60 | "react-native-screens": "^3.13.1",
61 | "react-native-share": "^9.4.1",
62 | "react-native-svg": "12.1.1",
63 | "react-native-vector-icons": "^10.0.0",
64 | "react-native-volume-manager": "^1.5.1",
65 | "react-native-webview": "^11.23.0",
66 | "react-redux": "^8.0.1",
67 | "redux-logger": "^3.0.6",
68 | "redux-saga": "^1.1.3"
69 | },
70 | "devDependencies": {
71 | "@babel/core": "^7.20.0",
72 | "@babel/preset-env": "^7.20.0",
73 | "@babel/runtime": "^7.20.0",
74 | "@react-native/eslint-config": "^0.72.2",
75 | "@react-native/metro-config": "^0.72.11",
76 | "@tsconfig/react-native": "^3.0.0",
77 | "@types/base-64": "^1.0.0",
78 | "@types/blueimp-md5": "^2.18.0",
79 | "@types/cheerio": "^0.22.31",
80 | "@types/crypto-js": "^4.1.1",
81 | "@types/loadable__component": "^5.13.4",
82 | "@types/lz-string": "^1.5.0",
83 | "@types/react": "^18.0.24",
84 | "@types/react-native-canvas": "^0.1.9",
85 | "@types/react-native-vector-icons": "^6.4.13",
86 | "@types/react-test-renderer": "^18.0.0",
87 | "babel-jest": "^29.2.1",
88 | "babel-plugin-module-resolver": "^5.0.0",
89 | "eslint": "^8.19.0",
90 | "husky": "^8.0.3",
91 | "jest": "^29.2.1",
92 | "metro-react-native-babel-preset": "0.76.8",
93 | "patch-package": "^7.0.0",
94 | "postinstall-postinstall": "^2.1.0",
95 | "prettier": "^2.4.1",
96 | "react-native-clean-project": "^4.0.1",
97 | "react-test-renderer": "18.2.0",
98 | "typescript": "4.8.4",
99 | "typescript-json-schema": "^0.62.0"
100 | },
101 | "engines": {
102 | "node": ">=18"
103 | },
104 | "repository": "https://github.com/youniaogu/MangaReader",
105 | "author": "youniaogu (https://github.com/youniaogu)",
106 | "bugs": {
107 | "url": "https://github.com/youniaogu/MangaReader/issues"
108 | },
109 | "homepage": "https://github.com/youniaogu/MangaReader#readme",
110 | "license": "MIT"
111 | }
112 |
--------------------------------------------------------------------------------
/patches/native-base+3.4.28.patch:
--------------------------------------------------------------------------------
1 | diff --git a/node_modules/native-base/src/core/NativeBaseProvider.tsx b/node_modules/native-base/src/core/NativeBaseProvider.tsx
2 | index 43b4bd1..77803a3 100644
3 | --- a/node_modules/native-base/src/core/NativeBaseProvider.tsx
4 | +++ b/node_modules/native-base/src/core/NativeBaseProvider.tsx
5 | @@ -4,7 +4,6 @@ import {
6 | Metrics,
7 | initialWindowMetrics as defaultInitialWindowMetrics,
8 | } from 'react-native-safe-area-context';
9 | -import { SSRProvider } from '@react-native-aria/utils';
10 | import { theme as defaultTheme, ITheme } from './../theme';
11 | import type { IColorModeProviderProps } from './color-mode';
12 | import HybridProvider from './hybrid-overlay/HybridProvider';
13 | @@ -94,7 +93,8 @@ const NativeBaseProvider = (props: NativeBaseProviderProps) => {
14 |
15 |
16 |
17 | - {children}
18 | + {/* https://github.com/GeekyAnts/NativeBase/issues/5758 */}
19 | + {children}
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/precommit.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | const path = require('path');
3 | const fs = require('fs');
4 |
5 | const DEFAULT_BUNDLE_IDENTIFIER = 'personal.bundle.identifier.MangaReader';
6 | const PATTERN_PRODUCT_BUNDLE_IDENTIFIER = /PRODUCT_BUNDLE_IDENTIFIER = (.+);/g;
7 |
8 | const revision = require('child_process')
9 | .execSync('git diff --cached --name-only --diff-filter=ACM')
10 | .toString()
11 | .trim();
12 |
13 | if (revision.includes('ios/MangaReader.xcodeproj/project.pbxproj')) {
14 | const fileContent = fs
15 | .readFileSync(path.resolve('ios/MangaReader.xcodeproj/project.pbxproj'))
16 | .toString();
17 |
18 | [...fileContent.matchAll(PATTERN_PRODUCT_BUNDLE_IDENTIFIER)].forEach((item) => {
19 | const [, bundleIdentifier] = item || [];
20 |
21 | if (
22 | bundleIdentifier !== DEFAULT_BUNDLE_IDENTIFIER &&
23 | bundleIdentifier !== '"org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"'
24 | ) {
25 | throw new Error('开源项目请不要上传私人bundle identifier');
26 | }
27 | });
28 | }
29 |
--------------------------------------------------------------------------------
/privacy_policy.md:
--------------------------------------------------------------------------------
1 | **Privacy Policy**
2 |
3 | youniaogu built the MangaReader app as an Open Source app. This SERVICE is provided by youniaogu at no cost and is intended for use as is.
4 |
5 | This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.
6 |
7 | If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.
8 |
9 | The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at MangaReader unless otherwise defined in this Privacy Policy.
10 |
11 | **Information Collection and Use**
12 |
13 | For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.
14 |
15 | The app does use third-party services that may collect information used to identify you.
16 |
17 | Link to the privacy policy of third-party service providers used by the app
18 |
19 | - [Google Play Services](https://www.google.com/policies/privacy/)
20 |
21 | **Log Data**
22 |
23 | I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third-party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.
24 |
25 | **Cookies**
26 |
27 | Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.
28 |
29 | This Service does not use these “cookies” explicitly. However, the app may use third-party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.
30 |
31 | **Service Providers**
32 |
33 | I may employ third-party companies and individuals due to the following reasons:
34 |
35 | - To facilitate our Service;
36 | - To provide the Service on our behalf;
37 | - To perform Service-related services; or
38 | - To assist us in analyzing how our Service is used.
39 |
40 | I want to inform users of this Service that these third parties have access to their Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.
41 |
42 | **Security**
43 |
44 | I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.
45 |
46 | **Links to Other Sites**
47 |
48 | This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.
49 |
50 | **Children’s Privacy**
51 |
52 | These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13 years of age. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do the necessary actions.
53 |
54 | **Changes to This Privacy Policy**
55 |
56 | I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page.
57 |
58 | This policy is effective as of 2023-08-10
59 |
60 | **Contact Us**
61 |
62 | If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at youniaogu2023@gmail.com.
63 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # MangaReader
2 |
3 | 
4 | 
5 | 
6 | 
7 |
8 | 一个漫画 APP📱,基于 react-native 构建,兼容 Android、Ios,尽可能适配平板
9 |
10 | - 插件式设计、近十个可用[插件](#插件)
11 | - 收藏、搜索、批量更新、下载、导出
12 | - 翻页/条漫/平叛双页模式、无限翻页、保存图片
13 | - 数据全本地离线化、支持备份和恢复
14 |
15 |
16 |
17 |
18 |
19 | ## 插件
20 |
21 | - [x] ~~[漫画柜](https://www.mhgui.com/)(大陆版,访问 403,已失效)~~
22 | - [x] [漫画柜 mobile](https://m.manhuagui.com/)(需要代理)
23 | - [x] [拷贝漫画](https://www.mangacopy.com/)
24 | - [x] [漫画 db](https://www.manhuadb.com/)
25 | - [x] [禁漫天堂](https://18comic.vip)(需要代理,日本 ip 无法访问,疑似开启了 cloudflare,如果无法使用,请参考[cf 校验](#cloudflare-校验))
26 | - [x] [动漫之家 mobile](https://m.dmzj.com/)(现在需要登录才能看了,使用前请在 webview 里登录)
27 | - [x] ~~[漫画猫](https://www.maofly.com/)(网站挂了,已失效)~~
28 | - [x] [kl 漫画](https://klmanga.net/)
29 | - [x] [nhentai](https://nhentai.net/)(需要代理和[cf 校验](#cloudflare-校验))
30 | - [x] [哔咔漫画](https://manhuabika.com/)(需要代理和[登录](#登录认证相关))
31 | - [x] [漫画 bz](https://mangabz.com/)(需要代理)
32 | - [x] [包子漫画](https://cn.baozimh.com/)(不需要代理但海外 ip 会走 cloudflare,需要在 webview 里通过校验)
33 | - [x] [嗨皮漫画](https://m.happymh.com/)(需要代理同时也有 cloudflare,而且 cf 校验需要进到详情页才能触发,稍微注意一下)
34 |
35 | ## 使用指南
36 |
37 |
38 |

39 |

40 |

41 |

42 |

43 |
44 |
45 | ## 下载
46 |
47 | Android:
/ [下载 apk](https://github.com/youniaogu/MangaReader/releases)
48 |
49 | Ios:[未签名 ipa](https://github.com/youniaogu/MangaReader/releases)(可能会有 webp 格式的图片,需要 ios14 及以上,否则图片会[什么都不显示](https://github.com/youniaogu/MangaReader/issues/92))
50 |
51 | [使用 Altstore 安装 ipa 文件](https://faq.altstore.io/)
52 |
53 | ## cloudflare 校验
54 |
55 | 下面以 nhentai 为例:
56 |
57 | nhentai 开启了 cloudflare 的 ddos 保护,在使用此插件前,请遵循下面流程在 webview 里通过 cloudflare 校验并获得 cookies
58 |
59 | webview 存在 bug,需要安卓版本 9 及以上
60 |
61 |
62 |

63 |

64 |

65 |

66 |

67 |
68 |
69 | ## 登录认证相关
70 |
71 | 下面以哔咔漫画为例:
72 |
73 | 哔咔漫画需要登录后才能访问,所以请按下面图示流程在 webview 里登录并获取 token
74 |
75 |
80 |
81 | ## 关于 App
82 |
83 | 很喜欢看漫画,能在一个 APP 里看完所有的漫画,是我一直以来的想法
84 |
85 | 这个项目是在工作之余开发的,时间有限,如果遇到问题,欢迎 Issues 和 PR
86 |
87 | 最后如果你觉得本项目对你有所帮助,可以的话帮忙点个 Star 🌟,非常感谢!
88 |
--------------------------------------------------------------------------------
/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect, useCallback } from 'react';
2 | import { createNativeStackNavigator, NativeStackHeaderProps } from '@react-navigation/native-stack';
3 | import { navigationRef, customTheme, AsyncStatus } from '~/utils';
4 | import { HeartAndBrowser, PrehandleDrawer } from '~/views/Detail';
5 | import { SearchAndPlugin, PluginSelect } from '~/views/Discovery';
6 | import { GestureHandlerRootView } from 'react-native-gesture-handler';
7 | import { store, useAppSelector } from '~/redux';
8 | import { NavigationContainer } from '@react-navigation/native';
9 | import { NativeBaseProvider } from 'native-base';
10 | import { useMessageToast } from '~/hooks';
11 | import { ErrorBoundary } from 'react-error-boundary';
12 | import { StyleSheet } from 'react-native';
13 | import { Provider } from 'react-redux';
14 | import ErrorFallback from '~/components/ErrorFallback';
15 | import RNBootSplash from 'react-native-bootsplash';
16 | import loadable from '@loadable/component';
17 | import Header from '~/components/Header';
18 |
19 | interface NavigationScreenProps {
20 | ready?: boolean;
21 | }
22 |
23 | const Home = loadable(() => import('~/views/Home'));
24 | const Search = loadable(() => import('~/views/Search'));
25 | const Discovery = loadable(() => import('~/views/Discovery'));
26 | const Detail = loadable(() => import('~/views/Detail'));
27 | const Chapter = loadable(() => import('~/views/Chapter'));
28 | const Plugin = loadable(() => import('~/views/Plugin'));
29 | const Webview = loadable(() => import('~/views/Webview'));
30 | const About = loadable(() => import('~/views/About'));
31 |
32 | const styles = StyleSheet.create({ wrapper: { flex: 1 } });
33 | const { Navigator, Screen } = createNativeStackNavigator();
34 |
35 | const NavigationScreen = ({ ready = false }: NavigationScreenProps) => {
36 | const launchStatus = useAppSelector((state) => state.app.launchStatus);
37 | const latestRelease = useAppSelector((state) => state.release.latest);
38 | const haveUpdate = Boolean(latestRelease);
39 |
40 | const DefaultHeader = useCallback(
41 | (props: NativeStackHeaderProps) => ,
42 | [haveUpdate]
43 | );
44 |
45 | useEffect(() => {
46 | if (ready && launchStatus === AsyncStatus.Fulfilled) {
47 | RNBootSplash.hide();
48 | }
49 | }, [ready, launchStatus]);
50 | useMessageToast();
51 |
52 | return (
53 |
54 |
58 |
59 |
64 |
65 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | );
77 | };
78 |
79 | const App = () => {
80 | const [ready, setReady] = useState(false);
81 |
82 | return (
83 |
84 |
85 |
86 | setReady(true)}>
87 |
88 |
89 |
90 |
91 |
92 |
93 | );
94 | };
95 |
96 | /** for the json schema generate */
97 | /** https://github.com/YousefED/typescript-json-schema/issues/307 */
98 | export type RootStateType = RootState;
99 | export type DictStateType = RootState['dict'];
100 | export type TaskStateType = RootState['task'];
101 | export type PluginStateType = RootState['plugin'];
102 | export type SettingStateType = RootState['setting'];
103 | export type FavoritesStateType = RootState['favorites'];
104 | export default App;
105 |
--------------------------------------------------------------------------------
/src/assets/christmas.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/src/assets/christmas.gif
--------------------------------------------------------------------------------
/src/assets/ground_pound.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/src/assets/ground_pound.gif
--------------------------------------------------------------------------------
/src/assets/reading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/src/assets/reading.gif
--------------------------------------------------------------------------------
/src/assets/tap_tap.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/src/assets/tap_tap.gif
--------------------------------------------------------------------------------
/src/assets/this_is_true.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/src/assets/this_is_true.gif
--------------------------------------------------------------------------------
/src/components/ActionsheetSelect.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC, memo, ReactNode, useEffect } from 'react';
2 | import { Actionsheet, ScrollView, Icon } from 'native-base';
3 | import { sourceMap } from './VectorIcon';
4 | import { Keyboard } from 'react-native';
5 | import Delay from './Delay';
6 |
7 | export interface ActionsheetSelectProps {
8 | isOpen?: boolean;
9 | options: {
10 | label: string;
11 | value: string;
12 | disabled?: boolean;
13 | icon?: { source: keyof typeof sourceMap; name: string };
14 | }[];
15 | onClose?: () => void;
16 | onChange?: (value: string) => void;
17 | headerComponent?: ReactNode;
18 | }
19 |
20 | const ActionsheetSelect: FC = ({
21 | options,
22 | isOpen,
23 | onClose,
24 | onChange,
25 | headerComponent,
26 | }) => {
27 | useEffect(() => {
28 | isOpen && Keyboard.dismiss();
29 | }, [isOpen]);
30 |
31 | const handleClose = () => {
32 | onClose && onClose();
33 | };
34 | const handleChange = (value: string) => {
35 | return () => {
36 | onChange && onChange(value);
37 | handleClose();
38 | };
39 | };
40 |
41 | return (
42 |
43 |
44 |
45 | {headerComponent}
46 |
47 | {options.map((item) => (
48 |
53 | ) : undefined
54 | }
55 | disabled={item.disabled}
56 | onPress={handleChange(item.value)}
57 | >
58 | {item.label}
59 |
60 | ))}
61 |
62 |
63 |
64 |
65 | );
66 | };
67 |
68 | export default memo(ActionsheetSelect);
69 |
--------------------------------------------------------------------------------
/src/components/Bookshelf.tsx:
--------------------------------------------------------------------------------
1 | import React, { memo, useMemo } from 'react';
2 | import { useDelayRender, useSplitWidth } from '~/hooks';
3 | import { Box, Text, Icon, HStack, Pressable } from 'native-base';
4 | import { Keyboard, StyleSheet } from 'react-native';
5 | import { coverAspectRatio } from '~/utils';
6 | import { CachedImage } from '@georstat/react-native-image-cache';
7 | import { FlashList } from '@shopify/flash-list';
8 | import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
9 | import WhiteCurtain from '~/components/WhiteCurtain';
10 | import SpinLoading from '~/components/SpinLoading';
11 | import Loading from '~/components/Loading';
12 | import Empty from '~/components/Empty';
13 | import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
14 |
15 | interface BookshelfProps {
16 | list: Manga[];
17 | failList?: string[];
18 | trendList?: string[];
19 | activeList?: string[];
20 | negativeList?: string[];
21 | loadMore?: () => void;
22 | reload?: () => void;
23 | itemOnPress: (hash: string) => void;
24 | loading?: boolean;
25 | emptyText?: string;
26 | itemOnLongPress?: (hash: string) => void;
27 | selectedList?: string[];
28 | isSelectMode?: boolean;
29 | }
30 |
31 | const Bookshelf = ({
32 | list,
33 | failList,
34 | trendList,
35 | activeList,
36 | negativeList,
37 | loadMore,
38 | reload,
39 | itemOnPress,
40 | loading = false,
41 | emptyText,
42 | selectedList,
43 | isSelectMode,
44 | itemOnLongPress,
45 | }: BookshelfProps) => {
46 | const { gap, insets, itemWidth, numColumns, windowWidth, windowHeight } = useSplitWidth({
47 | gap: 8,
48 | minNumColumns: 3,
49 | maxSplitWidth: 180,
50 | });
51 | const render = useDelayRender(loading && list.length === 0);
52 | const extraData = useMemo(
53 | () => ({
54 | width: itemWidth,
55 | fail: failList || [],
56 | trend: trendList || [],
57 | active: activeList || [],
58 | negative: negativeList || [],
59 | selectMode: isSelectMode || false,
60 | selected: selectedList || [],
61 | }),
62 | [itemWidth, failList, trendList, activeList, negativeList, isSelectMode, selectedList]
63 | );
64 |
65 | const handlePress = (hash: string) => {
66 | return () => {
67 | itemOnPress(hash);
68 | };
69 | };
70 | const handleEndReached = () => {
71 | !loading && loadMore && loadMore();
72 | };
73 | const handleLongPress = (hash: string) => {
74 | return () => {
75 | itemOnLongPress?.(hash);
76 | };
77 | };
78 |
79 | if ((loading && list.length === 0) || !render) {
80 | return ;
81 | }
82 | if (!loading && list.length === 0) {
83 | return ;
84 | }
85 |
86 | return (
87 | item.hash}
102 | ListFooterComponent={
103 | loading ? :
104 | }
105 | renderItem={({
106 | item,
107 | extraData: { width, fail, trend, active, negative, selected, selectMode },
108 | }) => (
109 |
114 |
115 |
116 |
122 | {selectMode && (
123 |
124 |
133 |
134 | )}
135 | {trend.includes(item.hash) && (
136 |
146 |
147 | New
148 |
149 |
150 | )}
151 |
152 | {fail.includes(item.hash) && !selectMode && (
153 |
160 | )}
161 | {negative.includes(item.hash) && !selectMode && (
162 |
163 | )}
164 |
165 |
166 |
175 |
176 |
177 |
178 |
179 | {item.title || item.hash}
180 |
181 |
182 |
183 | )}
184 | />
185 | );
186 | };
187 |
188 | const styles = StyleSheet.create({
189 | img: {
190 | width: '100%',
191 | overflow: 'hidden',
192 | borderRadius: 6,
193 | },
194 | });
195 |
196 | export default memo(Bookshelf);
197 |
--------------------------------------------------------------------------------
/src/components/Delay.tsx:
--------------------------------------------------------------------------------
1 | import React, { ReactNode, useEffect } from 'react';
2 | import { useDisclose } from 'native-base';
3 |
4 | interface DelayProps {
5 | children: ReactNode;
6 | duration?: number;
7 | }
8 |
9 | const Delay = ({ children, duration = 300 }: DelayProps) => {
10 | const { isOpen, onOpen } = useDisclose(false);
11 |
12 | useEffect(() => {
13 | const timeout = setTimeout(onOpen, duration);
14 | return () => clearTimeout(timeout);
15 | }, [duration, onOpen]);
16 |
17 | return <>{isOpen ? children : null}>;
18 | };
19 |
20 | export default Delay;
21 |
--------------------------------------------------------------------------------
/src/components/Drawer.tsx:
--------------------------------------------------------------------------------
1 | import React, {
2 | forwardRef,
3 | useEffect,
4 | useImperativeHandle,
5 | ReactNode,
6 | ForwardRefRenderFunction,
7 | Fragment,
8 | useMemo,
9 | } from 'react';
10 | import Animated, {
11 | useSharedValue,
12 | useAnimatedStyle,
13 | withTiming,
14 | withDelay,
15 | Easing,
16 | } from 'react-native-reanimated';
17 | import { useDebouncedSafeAreaFrame, useDebouncedSafeAreaInsets } from '~/hooks';
18 | import { Gesture, GestureDetector } from 'react-native-gesture-handler';
19 |
20 | export interface DrawerRef {
21 | open: () => void;
22 | close: () => void;
23 | }
24 | interface DrawerProps {
25 | leak?: number;
26 | content?: number;
27 | maskOpacity?: number;
28 | defaultDuration?: number;
29 | children?: ReactNode;
30 | }
31 |
32 | const Drawer: ForwardRefRenderFunction = (
33 | { leak = 12, content = 300, maskOpacity = 0.5, defaultDuration = 300, children },
34 | ref
35 | ) => {
36 | const { width: windowWidth, height: windowHeight } = useDebouncedSafeAreaFrame();
37 | const { right } = useDebouncedSafeAreaInsets();
38 | const leakWidth = useMemo(() => leak + right, [leak, right]);
39 | const contentWidth = useMemo(() => content + right, [content, right]);
40 | const minContentWidth = Math.min(windowWidth * 0.55, contentWidth);
41 | const translationX = useSharedValue(minContentWidth);
42 | const savedTranslationX = useSharedValue(minContentWidth);
43 |
44 | const opacity = useSharedValue(0.1);
45 | const savedOpacity = useSharedValue(0.1);
46 | const backgroundColor = useSharedValue('transparent');
47 | const savedBackgroundColor = useSharedValue('transparent');
48 | const width = useSharedValue(leakWidth);
49 | const savedWidth = useSharedValue(leakWidth);
50 |
51 | const maskStyles = useAnimatedStyle(() => {
52 | return {
53 | position: 'absolute',
54 | right: 0,
55 | opacity: opacity.value,
56 | width: width.value,
57 | height: windowHeight,
58 | backgroundColor: backgroundColor.value,
59 | };
60 | });
61 | const contentStyles = useAnimatedStyle(() => {
62 | return {
63 | position: 'absolute',
64 | right: 0,
65 | width: minContentWidth,
66 | height: windowHeight,
67 | transform: [{ translateX: translationX.value }],
68 | };
69 | });
70 |
71 | useEffect(() => {
72 | if (translationX.value > 0) {
73 | width.value = leakWidth;
74 | savedWidth.value = leakWidth;
75 | } else {
76 | width.value = windowWidth;
77 | savedWidth.value = windowWidth;
78 | }
79 | }, [leakWidth, windowWidth, translationX, width, savedWidth]);
80 | useEffect(() => {
81 | if (translationX.value > 0) {
82 | translationX.value = minContentWidth;
83 | }
84 | if (savedTranslationX.value > 0) {
85 | savedTranslationX.value = minContentWidth;
86 | }
87 | }, [minContentWidth, translationX, savedTranslationX]);
88 |
89 | useImperativeHandle(ref, () => ({
90 | open: () => {
91 | width.value = windowWidth;
92 | savedWidth.value = windowWidth;
93 | backgroundColor.value = 'black';
94 | savedBackgroundColor.value = 'black';
95 | opacity.value = withTiming(maskOpacity, { duration: defaultDuration, easing: Easing.linear });
96 | savedOpacity.value = maskOpacity;
97 | translationX.value = withTiming(0, { duration: defaultDuration, easing: Easing.linear });
98 | savedTranslationX.value = 0;
99 | },
100 | close: () => {
101 | width.value = withDelay(defaultDuration, withTiming(leakWidth, { duration: 0 }));
102 | savedWidth.value = leakWidth;
103 | backgroundColor.value = withDelay(
104 | defaultDuration,
105 | withTiming('transparent', { duration: 0 })
106 | );
107 | savedBackgroundColor.value = 'transparent';
108 | opacity.value = withTiming(0.1, { duration: defaultDuration, easing: Easing.linear });
109 | savedOpacity.value = 0.1;
110 | translationX.value = withTiming(minContentWidth, {
111 | duration: defaultDuration,
112 | easing: Easing.linear,
113 | });
114 | savedTranslationX.value = minContentWidth;
115 | },
116 | }));
117 |
118 | const tapGesture = Gesture.Tap()
119 | .shouldCancelWhenOutside(false)
120 | .onStart((e) => {
121 | if (e.absoluteX < windowWidth - minContentWidth) {
122 | width.value = withDelay(defaultDuration, withTiming(leakWidth, { duration: 0 }));
123 | savedWidth.value = leakWidth;
124 | backgroundColor.value = withDelay(
125 | defaultDuration,
126 | withTiming('transparent', { duration: 0 })
127 | );
128 | savedBackgroundColor.value = 'transparent';
129 | opacity.value = withTiming(0.1, { duration: defaultDuration, easing: Easing.linear });
130 | savedOpacity.value = 0.1;
131 | translationX.value = withTiming(minContentWidth, {
132 | duration: defaultDuration,
133 | easing: Easing.linear,
134 | });
135 | savedTranslationX.value = minContentWidth;
136 | }
137 | });
138 | const panGesture = Gesture.Pan()
139 | .onStart(() => {
140 | 'worklet';
141 | width.value = windowWidth;
142 | })
143 | .onChange((e) => {
144 | 'worklet';
145 | const x = Math.min(Math.max(savedTranslationX.value + e.translationX, 0), minContentWidth);
146 | backgroundColor.value = 'black';
147 | opacity.value = Math.min(Math.abs(1 - x / minContentWidth) * maskOpacity, maskOpacity);
148 | translationX.value = Math.min(
149 | Math.max(savedTranslationX.value + e.translationX, 0),
150 | minContentWidth
151 | );
152 | })
153 | .onEnd(() => {
154 | 'worklet';
155 | const distance = Math.abs(translationX.value - savedTranslationX.value);
156 | const duration = defaultDuration * (1 - Math.abs(distance / minContentWidth));
157 |
158 | if (distance >= minContentWidth / 4) {
159 | if (translationX.value > savedTranslationX.value) {
160 | width.value = withDelay(duration, withTiming(leakWidth, { duration: 0 }));
161 | savedWidth.value = leakWidth;
162 | backgroundColor.value = withDelay(duration, withTiming('transparent', { duration: 0 }));
163 | savedBackgroundColor.value = 'transparent';
164 | opacity.value = withTiming(0.1, { duration, easing: Easing.linear });
165 | savedOpacity.value = 0.1;
166 | translationX.value = withTiming(minContentWidth, { duration, easing: Easing.linear });
167 | savedTranslationX.value = minContentWidth;
168 | } else {
169 | width.value = withDelay(duration, withTiming(windowWidth, { duration: 0 }));
170 | savedWidth.value = windowWidth;
171 | backgroundColor.value = withDelay(duration, withTiming('black', { duration: 0 }));
172 | savedBackgroundColor.value = 'black';
173 | opacity.value = withTiming(maskOpacity, { duration, easing: Easing.linear });
174 | savedOpacity.value = maskOpacity;
175 | translationX.value = withTiming(0, { duration, easing: Easing.linear });
176 | savedTranslationX.value = 0;
177 | }
178 | } else {
179 | width.value = withDelay(
180 | defaultDuration - duration,
181 | withTiming(savedWidth.value, { duration: 0 })
182 | );
183 | backgroundColor.value = withDelay(
184 | duration,
185 | withTiming(savedBackgroundColor.value, { duration: 0 })
186 | );
187 | opacity.value = withTiming(savedOpacity.value, {
188 | duration: defaultDuration - duration,
189 | easing: Easing.linear,
190 | });
191 | translationX.value = withTiming(savedTranslationX.value, {
192 | duration: defaultDuration - duration,
193 | easing: Easing.linear,
194 | });
195 | }
196 | });
197 |
198 | return (
199 |
200 |
201 |
202 |
203 |
204 |
205 | {children}
206 |
207 | );
208 | };
209 |
210 | export default forwardRef(Drawer);
211 |
--------------------------------------------------------------------------------
/src/components/Empty.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Center, Text, Image, Pressable } from 'native-base';
3 | import { ColorType } from 'native-base/lib/typescript/components/types';
4 |
5 | const taptapGif = require('~/assets/tap_tap.gif');
6 |
7 | interface EmptyProps {
8 | bg?: ColorType;
9 | color?: ColorType;
10 | text?: string;
11 | onPress?: () => void;
12 | }
13 |
14 | const Empty = ({ bg = 'white', color = 'gray.500', text = '', onPress }: EmptyProps) => {
15 | return (
16 |
17 |
18 |
27 | {text && (
28 |
29 | {text}
30 |
31 | )}
32 |
33 |
34 | );
35 | };
36 |
37 | export default Empty;
38 |
--------------------------------------------------------------------------------
/src/components/ErrorFallback.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Button, VStack, Image, Text } from 'native-base';
3 | import { FallbackProps } from 'react-error-boundary';
4 |
5 | const thisIsTrueGif = require('~/assets/this_is_true.gif');
6 |
7 | const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => {
8 | return (
9 |
10 |
19 |
20 | 非常抱歉,应用遇到未知错误:
21 |
22 |
23 | {error.message}
24 |
25 |
28 |
29 | );
30 | };
31 |
32 | export default ErrorFallback;
33 |
--------------------------------------------------------------------------------
/src/components/ErrorWithRetry.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { ColorType, SizeType, SafeAreaProps } from 'native-base/lib/typescript/components/types';
3 | import { GestureDetector, Gesture } from 'react-native-gesture-handler';
4 | import { Center } from 'native-base';
5 | import VectorIcon from '~/components/VectorIcon';
6 |
7 | interface ErrorWithRetryProps extends SafeAreaProps {
8 | color?: ColorType;
9 | height?: SizeType;
10 | onRetry?: () => void;
11 | }
12 |
13 | const ErrorWithRetry = ({
14 | color = 'white',
15 | height = 48,
16 | onRetry,
17 | ...safeAreaProps
18 | }: ErrorWithRetryProps) => {
19 | const singleTap = Gesture.Tap()
20 | .runOnJS(true)
21 | .onStart(() => {
22 | onRetry && onRetry();
23 | });
24 |
25 | return (
26 |
27 |
28 |
29 |
30 |
31 | );
32 | };
33 |
34 | export default ErrorWithRetry;
35 |
--------------------------------------------------------------------------------
/src/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import React, { Fragment, useMemo } from 'react';
2 | import { StatusBar, HStack, Text, useTheme } from 'native-base';
3 | import { NativeStackHeaderProps } from '@react-navigation/native-stack';
4 | import { getHeaderTitle } from '@react-navigation/elements';
5 | import VectorIcon from '~/components/VectorIcon';
6 | import Shake from '~/components/Shake';
7 |
8 | interface HeaderProps extends NativeStackHeaderProps {
9 | enableShake?: boolean;
10 | }
11 |
12 | const Header = ({ navigation, options, route, enableShake = false }: HeaderProps) => {
13 | const { colors } = useTheme();
14 | const title = getHeaderTitle(options, route.name);
15 | const canGoBack = useMemo(() => navigation.canGoBack(), [navigation]);
16 |
17 | const handleAbout = () => {
18 | navigation.navigate('About');
19 | };
20 | const handleBack = () => {
21 | navigation.goBack();
22 | };
23 |
24 | const { headerLeft, headerRight } = options;
25 | const Left = headerLeft ? headerLeft({ canGoBack }) : null;
26 | const Right = headerRight ? headerRight({ canGoBack }) : null;
27 |
28 | return (
29 |
30 |
31 |
41 |
42 | {canGoBack ? (
43 |
44 | ) : (
45 |
46 |
47 |
48 | )}
49 | {title !== '' && (
50 |
51 | {title}
52 |
53 | )}
54 | {Left}
55 |
56 |
57 | {Right}
58 |
59 |
60 | );
61 | };
62 |
63 | export default Header;
64 |
--------------------------------------------------------------------------------
/src/components/InputModal.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { Text, Modal, Input, InputGroup, InputRightAddon } from 'native-base';
3 | import { KeyboardTypeOptions } from 'react-native';
4 |
5 | interface InputModalProps {
6 | title?: string;
7 | isOpen?: boolean;
8 | rightAddon?: string;
9 | defaultValue?: string;
10 | keyboardType?: KeyboardTypeOptions;
11 | onClose?: (value: string) => void;
12 | }
13 |
14 | const InputModal = ({
15 | title,
16 | isOpen = true,
17 | rightAddon,
18 | defaultValue = '',
19 | keyboardType,
20 | onClose,
21 | }: InputModalProps) => {
22 | const [value, setValue] = useState(defaultValue);
23 |
24 | const handleClose = () => {
25 | onClose && onClose(value);
26 | };
27 |
28 | return (
29 |
30 |
31 | {title && (
32 |
33 | {title}
34 |
35 | )}
36 |
37 |
44 | {rightAddon && }
45 |
46 |
47 |
48 | );
49 | };
50 |
51 | export default InputModal;
52 |
--------------------------------------------------------------------------------
/src/components/Loading.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Image, Center } from 'native-base';
3 |
4 | const readingGif = require('~/assets/reading.gif');
5 |
6 | const Loading = () => {
7 | return (
8 |
9 |
18 |
19 | );
20 | };
21 |
22 | export default Loading;
23 |
--------------------------------------------------------------------------------
/src/components/PageSlider.tsx:
--------------------------------------------------------------------------------
1 | import React, {
2 | memo,
3 | useState,
4 | forwardRef,
5 | useImperativeHandle,
6 | ForwardRefRenderFunction,
7 | } from 'react';
8 | import { ISliderProps, Slider } from 'native-base';
9 |
10 | export interface PageSliderRef {
11 | changePage: (newPage: number) => void;
12 | }
13 | interface PageSliderProps extends ISliderProps {
14 | defaultValue: number;
15 | onSliderChangeEnd?: (page: number) => void;
16 | min?: number;
17 | max: number;
18 | disabled?: boolean;
19 | }
20 |
21 | const PageSlider: ForwardRefRenderFunction = (
22 | { defaultValue, min = 1, max, onSliderChangeEnd, disabled = false, ...props },
23 | ref
24 | ) => {
25 | const [page, setPage] = useState(defaultValue);
26 |
27 | useImperativeHandle(ref, () => ({
28 | changePage: (newPage) => setPage(newPage),
29 | }));
30 |
31 | const handleSliderChange = (value: number) => {
32 | !disabled && setPage(Math.floor(value));
33 | };
34 | const handleSliderChangeEnd = (newPage: number) => {
35 | !disabled && onSliderChangeEnd && onSliderChangeEnd(newPage);
36 | };
37 |
38 | return (
39 |
53 |
54 |
55 |
56 |
57 |
58 | );
59 | };
60 |
61 | export default memo(forwardRef(PageSlider));
62 |
--------------------------------------------------------------------------------
/src/components/PathModal.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { Text, Modal, Input, InputGroup } from 'native-base';
3 | import { initialState } from '~/redux/slice';
4 | import VectorIcon from '~/components/VectorIcon';
5 |
6 | interface PathModalProps {
7 | isOpen?: boolean;
8 | defaultValue?: string;
9 | onClose?: (path: string) => void;
10 | }
11 |
12 | const PathModal = ({ isOpen = true, defaultValue = '', onClose }: PathModalProps) => {
13 | const [path, setPath] = useState(defaultValue);
14 |
15 | const handleClose = () => {
16 | onClose && onClose(path);
17 | };
18 | const handleReset = () => {
19 | setPath(initialState.setting.androidDownloadPath);
20 | };
21 |
22 | return (
23 |
24 |
25 |
26 | 漫画导出目录:
27 |
28 |
29 |
30 |
38 |
39 |
40 |
41 | );
42 | };
43 |
44 | export default PathModal;
45 |
--------------------------------------------------------------------------------
/src/components/RedHeart.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Animated, {
3 | useSharedValue,
4 | useAnimatedStyle,
5 | withSpring,
6 | withSequence,
7 | } from 'react-native-reanimated';
8 | import { Icon, Pressable } from 'native-base';
9 | import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
10 |
11 | enum Color {
12 | Default = '#ffffff',
13 | Actived = '#ef4444',
14 | }
15 |
16 | interface RedHeartProps {
17 | actived?: boolean;
18 | onPress?: () => void;
19 | }
20 |
21 | const defaultScale = 1;
22 | const biggerScale = 1.5;
23 |
24 | const RedHeart = ({ actived = false, onPress }: RedHeartProps) => {
25 | const scale = useSharedValue(defaultScale);
26 |
27 | const handlePress = () => {
28 | onPress && onPress();
29 | };
30 |
31 | const animatedStyle = useAnimatedStyle(() => ({
32 | justifyContent: 'center',
33 | transform: [{ scale: scale.value }],
34 | }));
35 | const handleTap = () => {
36 | scale.value = withSequence(withSpring(biggerScale), withSpring(defaultScale));
37 | handlePress();
38 | };
39 |
40 | return (
41 |
42 |
43 |
50 |
51 |
52 | );
53 | };
54 |
55 | export default RedHeart;
56 |
--------------------------------------------------------------------------------
/src/components/Rotate.tsx:
--------------------------------------------------------------------------------
1 | import React, { ReactNode, useCallback } from 'react';
2 | import Animated, {
3 | useSharedValue,
4 | useAnimatedStyle,
5 | withRepeat,
6 | withTiming,
7 | Easing,
8 | } from 'react-native-reanimated';
9 | import { useFocusEffect } from '@react-navigation/native';
10 |
11 | interface RotateProps {
12 | enable?: boolean;
13 | children: ReactNode;
14 | }
15 |
16 | const Rotate = ({ enable = false, children }: RotateProps) => {
17 | const offset = useSharedValue(0);
18 | const animatedStyles = useAnimatedStyle(() => {
19 | return {
20 | transform: [{ rotate: `${offset.value}deg` }],
21 | };
22 | });
23 |
24 | useFocusEffect(
25 | useCallback(() => {
26 | if (enable) {
27 | offset.value = withRepeat(
28 | withTiming(360, { duration: 1500, easing: Easing.linear }),
29 | -1,
30 | false
31 | );
32 | } else {
33 | offset.value = 0;
34 | }
35 |
36 | return () => {
37 | offset.value = 0;
38 | };
39 | }, [enable, offset])
40 | );
41 |
42 | return {children};
43 | };
44 |
45 | export default Rotate;
46 |
--------------------------------------------------------------------------------
/src/components/ScoreRate.tsx:
--------------------------------------------------------------------------------
1 | import React, { useMemo } from 'react';
2 | import { Box, Center, HStack } from 'native-base';
3 |
4 | interface ScoreRateProps {
5 | score?: number;
6 | max?: number;
7 | }
8 |
9 | const ScoreRate = ({ score = 0, max = 5 }: ScoreRateProps) => {
10 | const rateList = useMemo(() => Array.from({ length: max }, (_v, i) => i < score), [score, max]);
11 |
12 | return (
13 |
14 | {rateList.map((actived, index) => (
15 |
16 |
23 |
24 | ))}
25 |
26 | );
27 | };
28 |
29 | export default ScoreRate;
30 |
--------------------------------------------------------------------------------
/src/components/Shake.tsx:
--------------------------------------------------------------------------------
1 | import React, { ReactNode, useCallback } from 'react';
2 | import Animated, {
3 | useSharedValue,
4 | useAnimatedStyle,
5 | withDelay,
6 | withRepeat,
7 | withSpring,
8 | withSequence,
9 | } from 'react-native-reanimated';
10 | import { useFocusEffect } from '@react-navigation/native';
11 |
12 | interface ShakeProps {
13 | enable?: boolean;
14 | children: ReactNode;
15 | }
16 |
17 | const springConfig = {
18 | mass: 0.5,
19 | stiffness: 500,
20 | overshootClamping: true,
21 | };
22 |
23 | const Shake = ({ enable = false, children }: ShakeProps) => {
24 | const offset = useSharedValue(0);
25 | const animatedStyles = useAnimatedStyle(() => {
26 | return {
27 | transform: [{ rotate: `${offset.value}deg` }],
28 | };
29 | });
30 |
31 | useFocusEffect(
32 | useCallback(() => {
33 | if (enable) {
34 | offset.value = withRepeat(
35 | withDelay(
36 | 3000,
37 | withSequence(
38 | withSpring(16, springConfig),
39 | withSpring(-16, springConfig),
40 | withSpring(12, springConfig),
41 | withSpring(-12, springConfig),
42 | withSpring(8, springConfig),
43 | withSpring(-8, springConfig),
44 | withSpring(4, springConfig),
45 | withSpring(-4, springConfig),
46 | withSpring(0, springConfig)
47 | )
48 | ),
49 | -1
50 | );
51 | } else {
52 | offset.value = 0;
53 | }
54 |
55 | return () => {
56 | offset.value = 0;
57 | };
58 | }, [enable, offset])
59 | );
60 |
61 | return {children};
62 | };
63 |
64 | export default Shake;
65 |
--------------------------------------------------------------------------------
/src/components/SpinLoading.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { ColorType, SizeType, SafeAreaProps } from 'native-base/lib/typescript/components/types';
3 | import { Spinner, Center } from 'native-base';
4 | import { ColorValue } from 'react-native';
5 |
6 | interface SpinLoadingProps extends SafeAreaProps {
7 | size?: 'lg' | 'sm';
8 | color?: ColorType;
9 | height?: SizeType;
10 | }
11 |
12 | const SpinLoading = ({
13 | size = 'lg',
14 | color = 'purple.500',
15 | height = 48,
16 | ...safeAreaProps
17 | }: SpinLoadingProps) => {
18 | return (
19 |
20 |
21 |
22 | );
23 | };
24 |
25 | export default SpinLoading;
26 |
--------------------------------------------------------------------------------
/src/components/VectorIcon.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Icon, IconButton, IIconButtonProps } from 'native-base';
3 | import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
4 | import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
5 | import Octicons from 'react-native-vector-icons/Octicons';
6 | import Ionicons from 'react-native-vector-icons/Ionicons';
7 |
8 | export const sourceMap = {
9 | materialIcons: MaterialIcons,
10 | materialCommunityIcons: MaterialCommunityIcons,
11 | octicons: Octicons,
12 | ionicons: Ionicons,
13 | };
14 |
15 | export interface VectorIconProps extends IIconButtonProps {
16 | source?: keyof typeof sourceMap;
17 | }
18 |
19 | const VectorIcon = ({
20 | name = 'check',
21 | size = 'xl',
22 | color = 'white',
23 | onPress,
24 | shadow,
25 | source = 'materialIcons',
26 | ...props
27 | }: VectorIconProps) => {
28 | return (
29 | }
33 | onPress={onPress}
34 | {...props}
35 | />
36 | );
37 | };
38 |
39 | export default VectorIcon;
40 |
--------------------------------------------------------------------------------
/src/components/WhiteCurtain.tsx:
--------------------------------------------------------------------------------
1 | import React, { useCallback, ReactNode } from 'react';
2 | import Animated, { useSharedValue, useAnimatedStyle, withTiming } from 'react-native-reanimated';
3 | import { useFocusEffect } from '@react-navigation/native';
4 |
5 | interface WhiteCurtainProps {
6 | actived?: boolean;
7 | children: ReactNode;
8 | }
9 |
10 | const WhiteCurtain = ({ actived = false, children }: WhiteCurtainProps) => {
11 | const opacity = useSharedValue(0);
12 | const animatedStyle = useAnimatedStyle(() => ({
13 | position: 'absolute',
14 | top: 0,
15 | left: 0,
16 | right: 0,
17 | bottom: 0,
18 | opacity: opacity.value,
19 | }));
20 |
21 | useFocusEffect(
22 | useCallback(() => {
23 | if (actived) {
24 | opacity.value = withTiming(1);
25 | } else {
26 | opacity.value = withTiming(0);
27 | }
28 | return () => {
29 | if (actived) {
30 | opacity.value = 1;
31 | } else {
32 | opacity.value = 0;
33 | }
34 | };
35 | }, [actived, opacity])
36 | );
37 |
38 | return {children};
39 | };
40 |
41 | export default WhiteCurtain;
42 |
--------------------------------------------------------------------------------
/src/hooks/index.ts:
--------------------------------------------------------------------------------
1 | export * from './useOnce';
2 | export * from './useMessageToast';
3 | export * from './usePrevNext';
4 | export * from './useDelayRender';
5 | export * from './useSplitWidth';
6 | export * from './useDebouncedSafeAreaInsets';
7 | export * from './useVolumeUpDown';
8 | export * from './useDebouncedSafeAreaFrame';
9 | export * from './useAppState';
10 | export * from './useInterval';
11 |
--------------------------------------------------------------------------------
/src/hooks/useAppState.ts:
--------------------------------------------------------------------------------
1 | import { AppState, AppStateStatus } from 'react-native';
2 | import { useEffect } from 'react';
3 |
4 | export const useAppState = (onChange: (state: AppStateStatus) => void) => {
5 | useEffect(() => {
6 | const listener = AppState.addEventListener('change', onChange);
7 | return listener.remove;
8 | }, [onChange]);
9 | };
10 |
--------------------------------------------------------------------------------
/src/hooks/useDebouncedSafeAreaFrame.ts:
--------------------------------------------------------------------------------
1 | import { useEffect, useMemo, useState } from 'react';
2 | import { useSafeAreaFrame } from 'react-native-safe-area-context';
3 | import { Orientation } from '~/utils';
4 |
5 | export const useDebouncedSafeAreaFrame = () => {
6 | const _frame = useSafeAreaFrame();
7 | const [frame, setFrame] = useState({ ..._frame });
8 |
9 | useEffect(() => {
10 | const timeout = setTimeout(() => {
11 | setFrame({ ..._frame });
12 | }, 1000);
13 | return () => timeout && clearTimeout(timeout);
14 | }, [_frame]);
15 |
16 | return useMemo(() => {
17 | return {
18 | ...frame,
19 | orientation: frame.width > frame.height ? Orientation.Landscape : Orientation.Portrait,
20 | };
21 | }, [frame]);
22 | };
23 |
--------------------------------------------------------------------------------
/src/hooks/useDebouncedSafeAreaInsets.ts:
--------------------------------------------------------------------------------
1 | import { EdgeInsets, useSafeAreaInsets } from 'react-native-safe-area-context';
2 | import { useState, useEffect } from 'react';
3 |
4 | export const useDebouncedSafeAreaInsets = () => {
5 | const _insets = useSafeAreaInsets();
6 | const [insets, setInsets] = useState({ ..._insets });
7 |
8 | useEffect(() => {
9 | const timeout = setTimeout(() => {
10 | setInsets({ ..._insets });
11 | }, 200);
12 | return () => timeout && clearTimeout(timeout);
13 | }, [_insets]);
14 |
15 | return insets;
16 | };
17 |
--------------------------------------------------------------------------------
/src/hooks/useDelayRender.ts:
--------------------------------------------------------------------------------
1 | import { useState, useEffect } from 'react';
2 |
3 | export const useDelayRender = (defaultValue = false, duration = 0) => {
4 | const [render, setRender] = useState(defaultValue);
5 |
6 | useEffect(() => {
7 | const timeout = setTimeout(() => {
8 | setRender(true);
9 | }, duration);
10 | return () => clearTimeout(timeout);
11 | }, [duration, setRender]);
12 |
13 | return render;
14 | };
15 |
--------------------------------------------------------------------------------
/src/hooks/useInterval.ts:
--------------------------------------------------------------------------------
1 | import { useEffect, useRef } from 'react';
2 |
3 | export const useInterval = (callback: () => void, enable = true, ms = 5000) => {
4 | const timeoutRef = useRef();
5 |
6 | useEffect(() => {
7 | const fn = () => {
8 | if (enable) {
9 | callback();
10 | timeoutRef.current = setTimeout(fn, ms);
11 | }
12 | };
13 |
14 | timeoutRef.current = setTimeout(fn, ms);
15 | return () => {
16 | timeoutRef.current && clearTimeout(timeoutRef.current);
17 | timeoutRef.current = undefined;
18 | };
19 | }, [callback, enable, ms]);
20 | };
21 |
--------------------------------------------------------------------------------
/src/hooks/useMessageToast.ts:
--------------------------------------------------------------------------------
1 | import { action, useAppSelector, useAppDispatch } from '~/redux';
2 | import { useFocusEffect } from '@react-navigation/native';
3 | import { useCallback } from 'react';
4 | import { Toast } from 'native-base';
5 |
6 | const { throwMessage } = action;
7 |
8 | export const useMessageToast = () => {
9 | const dispatch = useAppDispatch();
10 | const message = useAppSelector((state) => state.app.message);
11 |
12 | useFocusEffect(
13 | useCallback(() => {
14 | if (message.length > 0) {
15 | message.forEach((text) => {
16 | setTimeout(() => {
17 | Toast.show({ title: text, duration: 5000, placement: 'bottom' });
18 | }, 0);
19 | });
20 | dispatch(throwMessage());
21 | }
22 | }, [message, dispatch])
23 | );
24 | };
25 |
--------------------------------------------------------------------------------
/src/hooks/useOnce.ts:
--------------------------------------------------------------------------------
1 | import { useCallback, useRef } from 'react';
2 | import { useFocusEffect } from '@react-navigation/native';
3 |
4 | export const useOnce = (fn: () => void) => {
5 | const firstRender = useRef(true);
6 |
7 | useFocusEffect(
8 | useCallback(() => {
9 | if (firstRender.current) {
10 | fn();
11 | firstRender.current = false;
12 | }
13 | }, [fn])
14 | );
15 | };
16 |
--------------------------------------------------------------------------------
/src/hooks/usePrevNext.ts:
--------------------------------------------------------------------------------
1 | import { useMemo } from 'react';
2 |
3 | export const usePrevNext = (chapterList: ChapterItem[], chapterHash: string) => {
4 | return useMemo(() => {
5 | const index = chapterList.findIndex((item) => item.hash === chapterHash);
6 |
7 | if (index === -1) {
8 | return [undefined, undefined];
9 | }
10 |
11 | const prev = index < chapterList.length - 1 ? chapterList[index + 1] : undefined;
12 | const next = index > 0 ? chapterList[index - 1] : undefined;
13 |
14 | return [prev, next];
15 | }, [chapterList, chapterHash]);
16 | };
17 |
--------------------------------------------------------------------------------
/src/hooks/useSplitWidth.ts:
--------------------------------------------------------------------------------
1 | import { useSafeAreaInsets, EdgeInsets } from 'react-native-safe-area-context';
2 | import { ScaledSize, useWindowDimensions } from 'react-native';
3 | import { useEffect, useState } from 'react';
4 |
5 | interface SplitWidthLimit {
6 | gap?: number;
7 | width?: number;
8 | minNumColumns?: number;
9 | maxSplitWidth?: number;
10 | }
11 |
12 | function splitWidth(
13 | dimensions: ScaledSize,
14 | insets: EdgeInsets,
15 | { gap, width, minNumColumns, maxSplitWidth }: Required
16 | ) {
17 | const { width: windowWidth, height: windowHeight } = dimensions;
18 | const defaultWidth = windowWidth - insets.left - insets.right;
19 | const maxWindowSplitWidth = Math.min(windowWidth, windowHeight) / minNumColumns;
20 |
21 | const numColumns = Math.max(
22 | Math.floor((width || defaultWidth) / Math.min(maxSplitWidth, maxWindowSplitWidth)),
23 | minNumColumns
24 | );
25 | const itemWidth = ((width || defaultWidth) - gap * (numColumns + 1)) / numColumns;
26 |
27 | return { gap, insets, itemWidth, numColumns, windowWidth, windowHeight };
28 | }
29 |
30 | export const useSplitWidth = ({
31 | gap = 0,
32 | width = 0,
33 | minNumColumns = 3,
34 | maxSplitWidth = Infinity,
35 | }: SplitWidthLimit) => {
36 | const insets = useSafeAreaInsets();
37 | const windowDimensions = useWindowDimensions();
38 | const [split, setSplit] = useState(
39 | splitWidth(windowDimensions, insets, { gap, width, minNumColumns, maxSplitWidth })
40 | );
41 |
42 | useEffect(() => {
43 | const timeout = setTimeout(() => {
44 | setSplit(splitWidth(windowDimensions, insets, { gap, width, minNumColumns, maxSplitWidth }));
45 | }, 1000);
46 | return () => timeout && clearTimeout(timeout);
47 | }, [insets, windowDimensions, gap, width, minNumColumns, maxSplitWidth]);
48 |
49 | return split;
50 | };
51 |
--------------------------------------------------------------------------------
/src/hooks/useVolumeUpDown.ts:
--------------------------------------------------------------------------------
1 | import { useCallback, useRef, useState } from 'react';
2 | import { AppStateStatus, Platform } from 'react-native';
3 | import { useFocusEffect } from '@react-navigation/native';
4 | import { VolumeManager } from 'react-native-volume-manager';
5 | import { useAppState } from './useAppState';
6 | import { Volume } from '~/utils';
7 |
8 | export const useVolumeUpDown = (callback: (type: Volume) => void, enable = true) => {
9 | const volumeRef = useRef();
10 | const audioSessionIsInactiveRef = useRef(false);
11 | const [initVolume, setInitVolume] = useState();
12 |
13 | const init = useCallback(() => {
14 | if (!enable) {
15 | return;
16 | }
17 |
18 | if (Platform.OS === 'ios') {
19 | VolumeManager.enable(true);
20 | }
21 |
22 | VolumeManager.getVolume().then((volume) => {
23 | let prev = typeof volume === 'number' ? volume : volume.volume;
24 |
25 | volumeRef.current = prev;
26 | if (prev <= 0) {
27 | prev = 0.025;
28 | } else if (prev >= 1) {
29 | prev = 0.975;
30 | }
31 | VolumeManager.setVolume(prev);
32 | setInitVolume(prev);
33 | });
34 | }, [enable]);
35 | const listener = useCallback(() => {
36 | if (!enable || typeof initVolume !== 'number') {
37 | return;
38 | }
39 |
40 | VolumeManager.showNativeVolumeUI({ enabled: false });
41 | const volumeListener = VolumeManager.addVolumeListener((result) => {
42 | // On iOS, events could get swallowed if fired too rapidly.
43 | // https://github.com/hirbod/react-native-volume-manager/issues/3
44 | if (result.volume - initVolume > 0.0001) {
45 | setTimeout(
46 | () => VolumeManager.setVolume(initVolume).finally(() => callback(Volume.Up)),
47 | 200
48 | );
49 | } else if (initVolume - result.volume > 0.0001) {
50 | setTimeout(
51 | () => VolumeManager.setVolume(initVolume).finally(() => callback(Volume.Down)),
52 | 200
53 | );
54 | }
55 | });
56 |
57 | return () => {
58 | volumeListener && volumeListener.remove();
59 | if (typeof volumeRef.current === 'number') {
60 | VolumeManager.setVolume(volumeRef.current).finally(() => {
61 | VolumeManager.showNativeVolumeUI({ enabled: true });
62 | });
63 | }
64 | };
65 | }, [enable, initVolume, callback]);
66 | const reboot = useCallback(() => {
67 | if (Platform.OS === 'ios') {
68 | VolumeManager.enable(true);
69 | }
70 | if (initVolume !== undefined) {
71 | VolumeManager.setVolume(initVolume);
72 | }
73 | }, [initVolume]);
74 | const enabledAudioSession = useCallback(
75 | (status: AppStateStatus) => {
76 | if (!enable) {
77 | return;
78 | }
79 |
80 | if (Platform.OS === 'ios') {
81 | if (status === 'active') {
82 | if (audioSessionIsInactiveRef.current) {
83 | VolumeManager.setActive(true);
84 | audioSessionIsInactiveRef.current = false;
85 | reboot();
86 | }
87 | } else {
88 | VolumeManager.setActive(false);
89 | audioSessionIsInactiveRef.current = true;
90 | }
91 | }
92 | },
93 | [enable, reboot]
94 | );
95 |
96 | useFocusEffect(init);
97 | useFocusEffect(listener);
98 | useAppState(enabledAudioSession);
99 | };
100 |
--------------------------------------------------------------------------------
/src/plugins/index.ts:
--------------------------------------------------------------------------------
1 | import Base, { Plugin } from './base';
2 | import MHGM from './mhgm';
3 | import MHG from './mhg';
4 | import COPY from './copy';
5 | import MHDB from './mhdb';
6 | import DMZJ from './dmzj';
7 | import JMC from './jmc';
8 | import MHM from './mhm';
9 | import KL from './kl';
10 | import NH from './nh';
11 | import PICA from './pica';
12 | import MBZ from './mbz';
13 | import BZM from './bzm';
14 | import RM5 from './rm5';
15 | import HAPPY from './happy';
16 |
17 | export * from './base';
18 |
19 | export const PluginMap = new Map([
20 | [COPY.id, COPY],
21 | [MBZ.id, MBZ],
22 | [HAPPY.id, HAPPY],
23 | [MHGM.id, MHGM],
24 | [JMC.id, JMC],
25 | [NH.id, NH],
26 | [PICA.id, PICA],
27 | [RM5.id, RM5],
28 | [KL.id, KL],
29 | [BZM.id, BZM],
30 | [DMZJ.id, DMZJ],
31 | [MHDB.id, MHDB],
32 | [MHM.id, MHM],
33 | [MHG.id, MHG],
34 | ]);
35 | export const combineHash = Base.combineHash;
36 | export const splitHash = Base.splitHash;
37 | export const defaultPlugin: Plugin = PluginMap.entries().next().value[0];
38 | export const defaultPluginList = Array.from(PluginMap.values()).map((item) => {
39 | return {
40 | label: item.shortName,
41 | name: item.name,
42 | value: item.id,
43 | score: item.score,
44 | href: item.href,
45 | userAgent: item.userAgent,
46 | description: item.description,
47 | disabled: item.disabled,
48 | injectedJavaScript: item.injectedJavaScript,
49 | };
50 | });
51 |
--------------------------------------------------------------------------------
/src/redux/index.ts:
--------------------------------------------------------------------------------
1 | import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
2 | import { action, reducer } from './slice';
3 | import saga from './saga';
4 | import store from './store';
5 |
6 | const useAppDispatch = () => useDispatch();
7 | const useAppSelector: TypedUseSelectorHook = useSelector;
8 |
9 | export { action, reducer, store, saga, useAppSelector, useAppDispatch };
10 |
--------------------------------------------------------------------------------
/src/redux/store.ts:
--------------------------------------------------------------------------------
1 | import { configureStore } from '@reduxjs/toolkit';
2 | import { reducer } from './slice';
3 | import createSagaMiddleware from 'redux-saga';
4 | import saga from './saga';
5 |
6 | const sagaMiddleware = createSagaMiddleware();
7 | const middleware = [sagaMiddleware];
8 |
9 | if (__DEV__) {
10 | const { logger } = require('redux-logger');
11 | middleware.push(logger);
12 | }
13 |
14 | const store = configureStore({
15 | reducer,
16 | middleware,
17 | devTools: __DEV__,
18 | });
19 | sagaMiddleware.run(saga);
20 |
21 | export default store;
22 |
--------------------------------------------------------------------------------
/src/schema/dict.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "definitions": {
4 | "Record": {
5 | "type": "object"
6 | },
7 | "Record": {
8 | "type": "object"
9 | },
10 | "Record": {
11 | "type": "object"
12 | },
13 | "Record": {
14 | "type": "object"
15 | }
16 | },
17 | "properties": {
18 | "chapter": {
19 | "$ref": "#/definitions/Record"
20 | },
21 | "lastWatch": {
22 | "$ref": "#/definitions/Record"
23 | },
24 | "manga": {
25 | "$ref": "#/definitions/Record"
26 | },
27 | "record": {
28 | "$ref": "#/definitions/Record"
29 | }
30 | },
31 | "required": [
32 | "chapter",
33 | "lastWatch",
34 | "manga",
35 | "record"
36 | ],
37 | "type": "object"
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/src/schema/favorites.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "items": {
4 | "properties": {
5 | "enableBatch": {
6 | "type": "boolean"
7 | },
8 | "isTrend": {
9 | "type": "boolean"
10 | },
11 | "mangaHash": {
12 | "type": "string"
13 | }
14 | },
15 | "required": [
16 | "enableBatch",
17 | "isTrend",
18 | "mangaHash"
19 | ],
20 | "type": "object"
21 | },
22 | "type": "array"
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/src/schema/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "definitions": {
4 | "Plugin": {
5 | "enum": [
6 | "MHG",
7 | "MHGM",
8 | "COPY",
9 | "MHDB",
10 | "DMZJ",
11 | "JMC",
12 | "MHM",
13 | "KL",
14 | "NH",
15 | "PICA",
16 | "MBZ",
17 | "BZM",
18 | "RM5",
19 | "HAPPY"
20 | ],
21 | "type": "string"
22 | },
23 | "Record": {
24 | "type": "object"
25 | }
26 | },
27 | "properties": {
28 | "extra": {
29 | "$ref": "#/definitions/Record"
30 | },
31 | "list": {
32 | "items": {
33 | "properties": {
34 | "description": {
35 | "type": "string"
36 | },
37 | "disabled": {
38 | "type": "boolean"
39 | },
40 | "href": {
41 | "type": "string"
42 | },
43 | "injectedJavaScript": {
44 | "type": "string"
45 | },
46 | "label": {
47 | "type": "string"
48 | },
49 | "name": {
50 | "type": "string"
51 | },
52 | "score": {
53 | "type": "number"
54 | },
55 | "userAgent": {
56 | "type": "string"
57 | },
58 | "value": {
59 | "$ref": "#/definitions/Plugin"
60 | }
61 | },
62 | "required": [
63 | "description",
64 | "disabled",
65 | "href",
66 | "label",
67 | "name",
68 | "score",
69 | "value"
70 | ],
71 | "type": "object"
72 | },
73 | "type": "array"
74 | },
75 | "source": {
76 | "$ref": "#/definitions/Plugin"
77 | }
78 | },
79 | "required": [
80 | "extra",
81 | "list",
82 | "source"
83 | ],
84 | "type": "object"
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/src/schema/setting.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "definitions": {
4 | "Animated": {
5 | "enum": [
6 | 0,
7 | 1
8 | ],
9 | "type": "number"
10 | },
11 | "Hearing": {
12 | "enum": [
13 | 0,
14 | 1
15 | ],
16 | "type": "number"
17 | },
18 | "LayoutMode": {
19 | "description": "enum layoutmode of Reader component",
20 | "enum": [
21 | "horizontal",
22 | "vertical",
23 | "multiple"
24 | ],
25 | "type": "string"
26 | },
27 | "LightSwitch": {
28 | "enum": [
29 | "Off",
30 | "On"
31 | ],
32 | "type": "string"
33 | },
34 | "MultipleSeat": {
35 | "enum": [
36 | 0,
37 | 1
38 | ],
39 | "type": "number"
40 | },
41 | "ReaderDirection": {
42 | "enum": [
43 | "left",
44 | "right"
45 | ],
46 | "type": "string"
47 | },
48 | "Sequence": {
49 | "enum": [
50 | "Asc",
51 | "Desc"
52 | ],
53 | "type": "string"
54 | },
55 | "Timer": {
56 | "enum": [
57 | 0,
58 | 1
59 | ],
60 | "type": "number"
61 | }
62 | },
63 | "properties": {
64 | "androidDownloadPath": {
65 | "type": "string"
66 | },
67 | "animated": {
68 | "$ref": "#/definitions/Animated"
69 | },
70 | "direction": {
71 | "$ref": "#/definitions/ReaderDirection",
72 | "description": "漫画阅读方向"
73 | },
74 | "hearing": {
75 | "$ref": "#/definitions/Hearing",
76 | "description": "是否监听音量并进行反页"
77 | },
78 | "light": {
79 | "$ref": "#/definitions/LightSwitch",
80 | "description": "开关灯"
81 | },
82 | "mode": {
83 | "$ref": "#/definitions/LayoutMode",
84 | "description": "布局模式"
85 | },
86 | "seat": {
87 | "$ref": "#/definitions/MultipleSeat",
88 | "description": "双页模式的图片位置"
89 | },
90 | "sequence": {
91 | "$ref": "#/definitions/Sequence",
92 | "description": "章节排列顺序"
93 | },
94 | "timer": {
95 | "$ref": "#/definitions/Timer",
96 | "description": "定时翻页"
97 | },
98 | "timerGap": {
99 | "type": "number"
100 | }
101 | },
102 | "required": [
103 | "androidDownloadPath",
104 | "animated",
105 | "direction",
106 | "hearing",
107 | "light",
108 | "mode",
109 | "seat",
110 | "sequence",
111 | "timer",
112 | "timerGap"
113 | ],
114 | "type": "object"
115 | }
116 |
117 |
--------------------------------------------------------------------------------
/src/schema/task.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "definitions": {
4 | "AsyncStatus": {
5 | "description": "enum of any async status",
6 | "enum": [
7 | 0,
8 | 1,
9 | 2,
10 | 3
11 | ],
12 | "type": "number"
13 | },
14 | "Job": {
15 | "properties": {
16 | "chapterHash": {
17 | "type": "string"
18 | },
19 | "headers": {
20 | "$ref": "#/definitions/Record"
21 | },
22 | "index": {
23 | "type": "number"
24 | },
25 | "jobId": {
26 | "type": "string"
27 | },
28 | "source": {
29 | "type": "string"
30 | },
31 | "status": {
32 | "$ref": "#/definitions/AsyncStatus"
33 | },
34 | "taskId": {
35 | "type": "string"
36 | },
37 | "type": {
38 | "$ref": "#/definitions/TaskType"
39 | }
40 | },
41 | "required": [
42 | "chapterHash",
43 | "index",
44 | "jobId",
45 | "source",
46 | "status",
47 | "taskId",
48 | "type"
49 | ],
50 | "type": "object"
51 | },
52 | "Record": {
53 | "type": "object"
54 | },
55 | "Task": {
56 | "properties": {
57 | "chapterHash": {
58 | "type": "string"
59 | },
60 | "downloadPath": {
61 | "type": "string"
62 | },
63 | "fail": {
64 | "items": {
65 | "type": "string"
66 | },
67 | "type": "array"
68 | },
69 | "headers": {
70 | "$ref": "#/definitions/Record"
71 | },
72 | "pending": {
73 | "items": {
74 | "type": "string"
75 | },
76 | "type": "array"
77 | },
78 | "queue": {
79 | "items": {
80 | "properties": {
81 | "index": {
82 | "type": "number"
83 | },
84 | "jobId": {
85 | "type": "string"
86 | },
87 | "source": {
88 | "type": "string"
89 | }
90 | },
91 | "required": [
92 | "index",
93 | "jobId",
94 | "source"
95 | ],
96 | "type": "object"
97 | },
98 | "type": "array"
99 | },
100 | "status": {
101 | "$ref": "#/definitions/AsyncStatus"
102 | },
103 | "success": {
104 | "items": {
105 | "type": "string"
106 | },
107 | "type": "array"
108 | },
109 | "taskId": {
110 | "type": "string"
111 | },
112 | "title": {
113 | "type": "string"
114 | },
115 | "type": {
116 | "$ref": "#/definitions/TaskType"
117 | }
118 | },
119 | "required": [
120 | "chapterHash",
121 | "downloadPath",
122 | "fail",
123 | "pending",
124 | "queue",
125 | "status",
126 | "success",
127 | "taskId",
128 | "title",
129 | "type"
130 | ],
131 | "type": "object"
132 | },
133 | "TaskType": {
134 | "description": "任务类型",
135 | "enum": [
136 | 0,
137 | 1
138 | ],
139 | "type": "number"
140 | }
141 | },
142 | "properties": {
143 | "job": {
144 | "properties": {
145 | "list": {
146 | "items": {
147 | "$ref": "#/definitions/Job"
148 | },
149 | "type": "array"
150 | },
151 | "max": {
152 | "type": "number"
153 | },
154 | "thread": {
155 | "items": {
156 | "properties": {
157 | "jobId": {
158 | "type": "string"
159 | },
160 | "taskId": {
161 | "type": "string"
162 | }
163 | },
164 | "required": [
165 | "jobId",
166 | "taskId"
167 | ],
168 | "type": "object"
169 | },
170 | "type": "array"
171 | }
172 | },
173 | "required": [
174 | "list",
175 | "max",
176 | "thread"
177 | ],
178 | "type": "object"
179 | },
180 | "list": {
181 | "items": {
182 | "$ref": "#/definitions/Task"
183 | },
184 | "type": "array"
185 | }
186 | },
187 | "required": [
188 | "job",
189 | "list"
190 | ],
191 | "type": "object"
192 | }
193 |
194 |
--------------------------------------------------------------------------------
/src/types/global.d.ts:
--------------------------------------------------------------------------------
1 | import { PayloadAction } from '@reduxjs/toolkit';
2 | import { customTheme } from '~/utils';
3 | // choose @types/cheerio instead of default
4 | import '@types/cheerio';
5 |
6 | type CustomTheme = typeof customTheme;
7 |
8 | declare module 'native-base' {
9 | interface ICustomTheme extends CustomTheme {}
10 | }
11 |
12 | declare global {
13 | type GET = 'GET' | 'get';
14 | type POST = 'POST' | 'post';
15 |
16 | type ArrayFirst = T extends [infer U, ...any[]] ? U : any;
17 |
18 | type FetchResponseAction = PayloadAction<
19 | undefined extends T
20 | ? { error?: Error; actionId?: string }
21 | :
22 | | { error: Error; data?: undefined; actionId?: string }
23 | | { error?: undefined; data: T; actionId?: string }
24 | >;
25 |
26 | type KeyValuePair = [string, string | null];
27 |
28 | interface FetchData {
29 | url: string;
30 | method?: GET | POST;
31 | body?: FormData | Record;
32 | headers?: Headers;
33 | timeout?: number;
34 | }
35 |
36 | interface OptionItem {
37 | label: string;
38 | value: string;
39 | }
40 |
41 | namespace NodeJS {
42 | interface ProcessEnv {
43 | NAME: string;
44 | VERSION: string;
45 | PUBLISH_TIME: string;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/types/plugins.d.ts:
--------------------------------------------------------------------------------
1 | import { Plugin } from '~/plugins';
2 |
3 | declare global {
4 | type PartialOption = Omit & {
5 | [A in Extract]?: T[A];
6 | };
7 |
8 | interface String {
9 | splic(f: string): string[];
10 | }
11 |
12 | interface InitPluginOptions {
13 | OS: 'ios' | 'android' | 'windows' | 'macos' | 'web';
14 | }
15 |
16 | interface MangaPlugin {
17 | Init: (options?: InitPluginOptions) => {
18 | Plugin: typeof Plugin;
19 | Options: typeof Options;
20 | PluginMap: Map;
21 | combineHash: (id: Plugin, mangaId: string, chapterId?: string | undefined) => string;
22 | splitHash: (hash: string) => [Plugin, string, string];
23 | defaultPlugin: Plugin;
24 | defaultPluginList: {
25 | label: string;
26 | name: string;
27 | value: Plugin;
28 | score: number;
29 | href: string;
30 | userAgent: string | undefined;
31 | description: string;
32 | disabled: boolean;
33 | }[];
34 | };
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/types/router.d.ts:
--------------------------------------------------------------------------------
1 | import { NativeStackScreenProps } from '@react-navigation/native-stack';
2 | import { Plugin } from '~/plugins';
3 |
4 | declare global {
5 | type RootStackParamList = {
6 | Home: undefined;
7 | Discovery: undefined;
8 | Search: { keyword: string; source: Plugin };
9 | Detail: { mangaHash: string; enabledMultiple?: boolean; selected?: string[] };
10 | Chapter: { mangaHash: string; chapterHash: string; page: number };
11 | Plugin: undefined;
12 | Webview: { uri: string; source?: Plugin; userAgent?: string; injectedJavascript?: string };
13 | About: undefined;
14 | };
15 | type StackHomeProps = NativeStackScreenProps;
16 | type StackDiscoveryProps = NativeStackScreenProps;
17 | type StackSearchProps = NativeStackScreenProps;
18 | type StackDetailProps = NativeStackScreenProps;
19 | type StackChapterProps = NativeStackScreenProps;
20 | type StackPluginProps = NativeStackScreenProps;
21 | type StackWebviewProps = NativeStackScreenProps;
22 | type StackAboutProps = NativeStackScreenProps;
23 | }
24 |
--------------------------------------------------------------------------------
/src/types/store.d.ts:
--------------------------------------------------------------------------------
1 | import {
2 | AsyncStatus,
3 | MangaStatus,
4 | Sequence,
5 | LayoutMode,
6 | LightSwitch,
7 | ReaderDirection,
8 | MultipleSeat,
9 | Hearing,
10 | Timer,
11 | Animated,
12 | TaskType,
13 | } from '~/utils';
14 | import { Plugin } from '~/plugins';
15 |
16 | declare global {
17 | interface Manga {
18 | href: string;
19 | hash: string;
20 | source: Plugin;
21 | sourceName: string;
22 | mangaId: string;
23 | // redundancy data for init after upgrade
24 | // remove it when next version
25 | cover?: string;
26 | bookCover: string;
27 | infoCover: string;
28 | headers?: Record;
29 | title: string;
30 | latest: string;
31 | updateTime: string;
32 | author: string[];
33 | tag: string[];
34 | status: MangaStatus;
35 | chapters: ChapterItem[];
36 | }
37 | interface IncreaseManga
38 | extends PartialOption<
39 | Manga,
40 | 'latest' | 'updateTime' | 'author' | 'tag' | 'status' | 'chapters' | 'bookCover' | 'infoCover'
41 | > {}
42 | interface ChapterItem {
43 | hash: string;
44 | mangaId: string;
45 | chapterId: string;
46 | href: string;
47 | title: string;
48 | }
49 | interface Chapter {
50 | hash: string;
51 | mangaId: string;
52 | chapterId: string;
53 | /** 漫画名 */
54 | name?: string;
55 | /** 章节名 */
56 | title: string;
57 | headers?: Record;
58 | images: { uri: string; needUnscramble?: boolean; scrambleType?: ScrambleType }[];
59 | }
60 | interface Release {
61 | loadStatus: AsyncStatus;
62 | name: string;
63 | version: string;
64 | publishTime: string;
65 | latest?: LatestRelease;
66 | }
67 | interface LatestRelease {
68 | url: string;
69 | version: string;
70 | changeLog: string;
71 | publishTime: string;
72 | file?: {
73 | apk: { size: number; downloadUrl: string };
74 | ipa: { size: number; downloadUrl: string };
75 | };
76 | }
77 | interface Task {
78 | taskId: string;
79 | chapterHash: string;
80 | title: string;
81 | type: TaskType;
82 | status: AsyncStatus;
83 | downloadPath: string;
84 | headers?: Record;
85 | queue: { index: number; source: string; jobId: string }[];
86 | pending: string[];
87 | success: string[];
88 | fail: string[];
89 | }
90 | interface Job {
91 | taskId: string;
92 | jobId: string;
93 | chapterHash: string;
94 | type: TaskType;
95 | status: AsyncStatus;
96 | source: string;
97 | index: number;
98 | headers?: Record;
99 | }
100 |
101 | interface RootState {
102 | app: {
103 | launchStatus: AsyncStatus;
104 | message: string[];
105 | };
106 | datasync: {
107 | syncStatus: AsyncStatus;
108 | clearStatus: AsyncStatus;
109 | backupStatus: AsyncStatus;
110 | restoreStatus: AsyncStatus;
111 | };
112 | release: Release;
113 | setting: {
114 | /** 布局模式 */
115 | mode: LayoutMode;
116 | /** 开关灯 */
117 | light: LightSwitch;
118 | /** 漫画阅读方向 */
119 | direction: ReaderDirection;
120 | /** 双页模式的图片位置 */
121 | seat: MultipleSeat;
122 | /** 章节排列顺序 */
123 | sequence: Sequence;
124 | /** 是否监听音量并进行反页 */
125 | hearing: Hearing;
126 | /** 定时翻页 */
127 | timer: Timer;
128 | timerGap: number;
129 | animated: Animated;
130 | androidDownloadPath: string;
131 | };
132 | plugin: {
133 | source: Plugin;
134 | list: {
135 | name: string;
136 | label: string;
137 | value: Plugin;
138 | score: number;
139 | href: string;
140 | userAgent?: string;
141 | description: string;
142 | disabled: boolean;
143 | injectedJavaScript?: string;
144 | }[];
145 | extra: Record;
146 | };
147 | batch: {
148 | loadStatus: AsyncStatus;
149 | stack: string[];
150 | queue: string[];
151 | success: string[];
152 | fail: string[];
153 | };
154 | favorites: { mangaHash: string; isTrend: boolean; enableBatch: boolean }[];
155 | search: {
156 | filter: Record;
157 | keyword: string;
158 | page: number;
159 | isEnd: boolean;
160 | loadStatus: AsyncStatus;
161 | list: string[];
162 | };
163 | discovery: {
164 | filter: Record;
165 | page: number;
166 | isEnd: boolean;
167 | loadStatus: AsyncStatus;
168 | list: string[];
169 | };
170 | manga: {
171 | loadStatus: AsyncStatus;
172 | loadingMangaHash: string;
173 | };
174 | chapter: {
175 | loadStatus: AsyncStatus;
176 | loadingChapterHash: string;
177 | openDrawer: boolean;
178 | showDrawer: boolean;
179 | };
180 | task: {
181 | list: Task[];
182 | job: {
183 | max: number;
184 | list: Job[];
185 | thread: { taskId: string; jobId: string }[];
186 | };
187 | };
188 | dict: {
189 | manga: Record;
190 | chapter: Record;
191 | record: Record<
192 | string,
193 | { total: number; progress: number; imagesLoaded: number[]; isVisited: boolean }
194 | >;
195 | lastWatch: Record;
196 | };
197 | }
198 | }
199 |
200 | export type ExportRootState = { A: string };
201 |
--------------------------------------------------------------------------------
/src/utils/cache.ts:
--------------------------------------------------------------------------------
1 | import { FileSystem, Dirs } from 'react-native-file-access';
2 | import { ImageState } from '~/components/ComicImage';
3 |
4 | type CacheMap = Record>;
5 |
6 | class Cache {
7 | private _basePath = `${Dirs.DocumentDir}/@cache`; // 或者Dirs.CacheDir?
8 | private _path: string;
9 | private _cacheMap: CacheMap = {};
10 |
11 | constructor(identification: string) {
12 | this._path = `${this._basePath}/${identification}.json`;
13 | }
14 |
15 | async initCacheMap() {
16 | try {
17 | const dirExists = await FileSystem.exists(this._basePath);
18 | if (!dirExists) {
19 | await FileSystem.mkdir(this._basePath);
20 | }
21 | const exists = await FileSystem.exists(this._path);
22 | if (exists) {
23 | const content = await FileSystem.readFile(this._path);
24 | this._cacheMap = JSON.parse(content);
25 | } else {
26 | await FileSystem.writeFile(this._path, JSON.stringify({}));
27 | }
28 | } catch (error) {
29 | console.error('An error in initCacheMap:', error);
30 | }
31 | }
32 |
33 | getImageState(uri: string) {
34 | return this._cacheMap[uri];
35 | }
36 |
37 | // 去掉不需要存的dataUrl和loadStatus
38 | setImageState(
39 | uri: string,
40 | { landscapeHeight, portraitHeight, multipleFitWidth, multipleFitHeight }: ImageState
41 | ) {
42 | this._cacheMap[uri] = { landscapeHeight, portraitHeight, multipleFitWidth, multipleFitHeight };
43 | }
44 |
45 | async storeCacheMap() {
46 | try {
47 | await FileSystem.writeFile(this._path, JSON.stringify(this._cacheMap));
48 | } catch (error) {
49 | console.error('An error in storeCacheMap:', error);
50 | }
51 | }
52 |
53 | // 清除缓存
54 | static async clearCache() {
55 | const basePath = `${Dirs.DocumentDir}/@cache`;
56 | try {
57 | const dirExists = await FileSystem.exists(basePath);
58 | if (dirExists) {
59 | await FileSystem.unlink(basePath);
60 | }
61 | } catch (error) {
62 | console.error('An error in clearCache:', error);
63 | }
64 | }
65 | }
66 |
67 | export default Cache;
68 |
--------------------------------------------------------------------------------
/src/utils/define.ts:
--------------------------------------------------------------------------------
1 | import LZString from 'lz-string';
2 |
3 | // eslint-disable-next-line no-extend-native
4 | String.prototype.splic = function (f: string): string[] {
5 | return LZString.decompressFromBase64(this.toString())?.split(f) || [];
6 | };
7 |
--------------------------------------------------------------------------------
/src/utils/enum.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description enum of any async status
3 | * @enum {number}
4 | */
5 | export enum AsyncStatus {
6 | Default,
7 | Pending,
8 | Fulfilled,
9 | Rejected,
10 | }
11 |
12 | /**
13 | * @description enum of manga serial status
14 | * @enum {number}
15 | */
16 | export enum MangaStatus {
17 | Unknown,
18 | Serial,
19 | End,
20 | }
21 |
22 | /**
23 | * @description enum layoutmode of Reader component
24 | * @enum {number}
25 | */
26 | export enum LayoutMode {
27 | /** 翻页模式 */
28 | Horizontal = 'horizontal',
29 | /** 条漫模式 */
30 | Vertical = 'vertical',
31 | /** 双页模式 */
32 | Multiple = 'multiple',
33 | }
34 |
35 | export enum ReaderDirection {
36 | /** 从右向左 */
37 | Left = 'left',
38 | /** 从左向右 */
39 | Right = 'right',
40 | }
41 |
42 | export enum ErrorMessage {
43 | Unknown = '未知错误~',
44 | NoMore = '没有更多~',
45 | PluginMissing = '缺少插件~',
46 | Timeout = '超时~',
47 | RequestTimeout = '请求超时~',
48 | NoSupport = '插件不支持',
49 | MissingChapterInfo = '缺少章节信息~',
50 | WrongResponse = '响应失败: ',
51 | WrongDataType = '错误的数据格式',
52 | DDoSRetry = 'KL漫画网站DDoS保护,请重试',
53 | NotFoundDMZJ = '未找到漫画,请在Webview里登录获取UID后再试',
54 | AuthFailPICA = '哔咔漫画Token失效,请在Webview里重新获取',
55 | WithoutPermission = '授权失败',
56 | PushTaskFail = '推送任务失败',
57 | CloudflareFail = 'cloudflare认证失败,请在Webview里重新校验',
58 | AccessSourceFail = '访问资源失败',
59 | ExecutionJobFail = '执行任务失败',
60 | }
61 |
62 | export enum Orientation {
63 | Portrait = 'portrait',
64 | Landscape = 'landscape',
65 | }
66 |
67 | export enum BackupRestore {
68 | Clipboard = 'clipboard',
69 | Qrcode = 'Qrcode',
70 | Picture = 'Picture',
71 | }
72 |
73 | export enum ChapterOptions {
74 | Multiple = 'multiple',
75 | Download = 'download',
76 | Export = 'export',
77 | }
78 |
79 | export enum Sequence {
80 | /** 从小到大 */
81 | Asc = 'Asc',
82 | /** 从大到小 */
83 | Desc = 'Desc',
84 | }
85 |
86 | export enum Volume {
87 | Up = 'Up',
88 | Down = 'Down',
89 | }
90 |
91 | export enum LightSwitch {
92 | /** 关灯 */
93 | Off = 'Off',
94 | /** 开灯 */
95 | On = 'On',
96 | }
97 |
98 | /** 任务类型 */
99 | export enum TaskType {
100 | Download,
101 | Export,
102 | }
103 |
104 | export enum PositionX {
105 | Left,
106 | Mid,
107 | Right,
108 | }
109 |
110 | export enum PositionY {
111 | Top,
112 | Mid,
113 | Bottom,
114 | }
115 |
116 | export enum PositionXY {
117 | TopLeft,
118 | TopMid,
119 | TopRight,
120 | MidLeft,
121 | Center,
122 | MidRight,
123 | BottomLeft,
124 | BottomMid,
125 | BottomRight,
126 | }
127 |
128 | /** 图片加密类型 */
129 | export enum ScrambleType {
130 | JMC,
131 | RM5,
132 | }
133 |
134 | export enum MultipleSeat {
135 | /** 第一张 | 第二张 */
136 | AToB,
137 | /** 第二张 | 第一张 */
138 | BToA,
139 | }
140 |
141 | export enum Hearing {
142 | Enable,
143 | Disabled,
144 | }
145 |
146 | export enum Timer {
147 | Enable,
148 | Disabled,
149 | }
150 |
151 | export enum SafeArea {
152 | All,
153 | None,
154 | X,
155 | Y,
156 | }
157 |
158 | export enum TemplateKey {
159 | MANGA_ID = 'MANGA_ID',
160 | MANGA_NAME = 'MANGA_NAME',
161 | CHAPTER_ID = 'CHAPTER_ID',
162 | CHAPTER_NAME = 'CHAPTER_NAME',
163 | AUTHOR = 'AUTHOR',
164 | SOURCE_ID = 'SOURCE_ID',
165 | SOURCE_NAME = 'SOURCE_NAME',
166 | TAG = 'TAG',
167 | STATUS = 'STATUS',
168 | HASH = 'HASH',
169 | TIME = 'TIME',
170 | }
171 |
172 | export enum Animated {
173 | Enable,
174 | Disabled,
175 | }
176 |
--------------------------------------------------------------------------------
/src/utils/fetch.ts:
--------------------------------------------------------------------------------
1 | import queryString from 'query-string';
2 |
3 | export const fetchData = ({
4 | url,
5 | method = 'GET',
6 | body = {},
7 | headers = new Headers(),
8 | timeout = 10000,
9 | }: FetchData) => {
10 | const controller = new AbortController();
11 | const init: RequestInit & { headers: Headers } = {
12 | method: method.toUpperCase(),
13 | headers,
14 | signal: controller.signal,
15 | redirect: 'follow',
16 | credentials: 'include',
17 | };
18 |
19 | if (Object.keys(body).length > 0) {
20 | if (init.method === 'GET') {
21 | url += '?' + queryString.stringify(body);
22 | }
23 | if (init.method === 'POST') {
24 | if (body instanceof FormData) {
25 | if (!init.headers.has('Content-Type')) {
26 | init.headers.set('Content-Type', 'multipart/form-data');
27 | }
28 | init.body = body;
29 | } else {
30 | if (!init.headers.has('Content-Type')) {
31 | init.headers?.set('Content-Type', 'application/json');
32 | }
33 | init.body = JSON.stringify(body);
34 | }
35 | }
36 | }
37 |
38 | const delay = setTimeout(() => {
39 | controller.abort();
40 | }, timeout);
41 |
42 | return new Promise<{ error: Error; data: undefined } | { error: undefined; data: any }>((res) => {
43 | try {
44 | fetch(url, init)
45 | .then((response) => {
46 | const contentType = response.headers.get('content-type') || '';
47 | if (contentType.includes('application/json')) {
48 | return response.json();
49 | } else {
50 | return response.text();
51 | }
52 | })
53 | .then((data) => {
54 | res({ error: undefined, data });
55 | })
56 | .catch(() => {
57 | res({ error: new Error('网络错误,请稍后重试'), data: undefined });
58 | })
59 | .finally(() => {
60 | clearTimeout(delay);
61 | });
62 | } catch (error) {
63 | clearTimeout(delay);
64 | res({ error: error as Error, data: undefined });
65 | }
66 | });
67 | };
68 |
--------------------------------------------------------------------------------
/src/utils/index.ts:
--------------------------------------------------------------------------------
1 | export * from './fetch';
2 | export * from './common';
3 | export * from './define';
4 | export * from './navigation';
5 | export * from './theme';
6 | export * from './enum';
7 |
--------------------------------------------------------------------------------
/src/utils/navigation.ts:
--------------------------------------------------------------------------------
1 | import { createNavigationContainerRef } from '@react-navigation/native';
2 |
3 | export const navigationRef = createNavigationContainerRef();
4 |
5 | export function navigate(
6 | ...args: RouteName extends unknown
7 | ? undefined extends RootStackParamList[RouteName]
8 | ? [screen: RouteName] | [screen: RouteName, params: RootStackParamList[RouteName]]
9 | : [screen: RouteName, params: RootStackParamList[RouteName]]
10 | : never
11 | ) {
12 | if (navigationRef.isReady()) {
13 | navigationRef.navigate(...args);
14 | }
15 | }
16 |
17 | export function setParams(
18 | params: Partial
19 | ) {
20 | if (navigationRef.isReady()) {
21 | navigationRef.setParams(params);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/utils/theme.ts:
--------------------------------------------------------------------------------
1 | import { extendTheme } from 'native-base';
2 |
3 | export const customTheme = extendTheme({
4 | colors: {
5 | purple: {
6 | 50: '#f2e3ff',
7 | 100: '#d3b2ff',
8 | 200: '#b47fff',
9 | 300: '#964dff',
10 | 400: '#781aff',
11 | 500: '#5f00e6',
12 | 600: '#4a00b4',
13 | 700: '#350082',
14 | 800: '#200050',
15 | 900: '#0d0020',
16 | },
17 | transparent: 'transparent',
18 | },
19 | config: {
20 | initialColorMode: 'light',
21 | },
22 | shadows: {
23 | icon: {
24 | shadowColor: 'black',
25 | shadowOffset: {
26 | width: 0,
27 | height: 1,
28 | },
29 | shadowOpacity: 0.2,
30 | shadowRadius: 1.41,
31 |
32 | textShadowOffset: {
33 | width: 0,
34 | height: 1,
35 | },
36 | textShadowRadius: 5,
37 | elevation: 2,
38 | },
39 | },
40 | });
41 |
--------------------------------------------------------------------------------
/src/views/About.tsx:
--------------------------------------------------------------------------------
1 | import React, { Fragment } from 'react';
2 | import {
3 | Icon,
4 | Text,
5 | Image,
6 | Modal,
7 | Button,
8 | VStack,
9 | Center,
10 | ScrollView,
11 | useDisclose,
12 | } from 'native-base';
13 | import { action, useAppSelector, useAppDispatch } from '~/redux';
14 | import { Linking, Platform } from 'react-native';
15 | import { CacheManager } from '@georstat/react-native-image-cache';
16 | import { AsyncStatus } from '~/utils';
17 | import ErrorWithRetry from '~/components/ErrorWithRetry';
18 | import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
19 | import SpinLoading from '~/components/SpinLoading';
20 | import PathModal from '~/components/PathModal';
21 |
22 | const { backup, restore, clearCache, loadLatestRelease, setAndroidDownloadPath } = action;
23 | const christmasGif = require('~/assets/christmas.gif');
24 |
25 | const About = () => {
26 | const { isOpen: isClearing, onOpen: openClearing, onClose: closeClearing } = useDisclose();
27 | const { isOpen: isModalOpen, onOpen: onModalOpen, onClose: onModalClose } = useDisclose();
28 | const {
29 | isOpen: isAlbumPathOpen,
30 | onOpen: onAlbumPathOpen,
31 | onClose: onAlbumPathClose,
32 | } = useDisclose();
33 | const dispatch = useAppDispatch();
34 | const release = useAppSelector((state) => state.release);
35 | const clearStatus = useAppSelector((state) => state.datasync.clearStatus);
36 | const backupStatus = useAppSelector((state) => state.datasync.backupStatus);
37 | const restoreStatus = useAppSelector((state) => state.datasync.restoreStatus);
38 | const androidDownloadPath = useAppSelector((state) => state.setting.androidDownloadPath);
39 |
40 | const handleRetry = () => {
41 | dispatch(loadLatestRelease());
42 | };
43 |
44 | const handleBackup = () => {
45 | dispatch(backup());
46 | };
47 | const handleRestore = () => {
48 | dispatch(restore());
49 | };
50 |
51 | const handleApkDownload = () => {
52 | if (release.latest) {
53 | Linking.canOpenURL(release.latest.file?.apk.downloadUrl || '').then((supported) => {
54 | supported && Linking.openURL(release.latest?.file?.apk.downloadUrl || '');
55 | });
56 | }
57 | };
58 | const handleIpaDownload = () => {
59 | if (release.latest) {
60 | Linking.canOpenURL(release.latest.file?.ipa.downloadUrl || '').then((supported) => {
61 | supported && Linking.openURL(release.latest?.file?.ipa.downloadUrl || '');
62 | });
63 | }
64 | };
65 |
66 | const handleImageCacheClear = () => {
67 | openClearing();
68 | CacheManager.clearCache().finally(() => {
69 | setTimeout(closeClearing, 500);
70 | });
71 | };
72 | const handleStorageCacheClear = () => {
73 | dispatch(clearCache());
74 | onModalClose();
75 | };
76 |
77 | const handleAlbumPathClose = (path: string) => {
78 | onAlbumPathClose();
79 | dispatch(setAndroidDownloadPath(path));
80 | };
81 |
82 | return (
83 |
84 |
85 |
86 |
87 | {release.name}
88 |
89 |
90 | {`${release.publishTime} ${release.version}`}
91 |
92 |
93 |
94 | {release.loadStatus === AsyncStatus.Pending && }
95 | {release.loadStatus === AsyncStatus.Rejected && (
96 |
97 | )}
98 | {release.loadStatus === AsyncStatus.Fulfilled && release.latest === undefined && (
99 |
100 |
109 |
110 | 暂无更新
111 |
112 |
113 | )}
114 | {release.loadStatus === AsyncStatus.Fulfilled && release.latest !== undefined && (
115 |
116 |
117 | {release.latest.publishTime} {release.latest.version}
118 |
119 |
120 | {release.latest.changeLog}
121 |
122 |
123 | }
127 | onPress={handleApkDownload}
128 | >
129 | APK下载
130 |
131 | }
135 | onPress={handleIpaDownload}
136 | >
137 | IPA下载
138 |
139 |
140 | )}
141 |
142 | }
147 | onPress={handleBackup}
148 | >
149 | 备份
150 |
151 | }
156 | onPress={handleRestore}
157 | >
158 | 恢复
159 |
160 | {(Platform.OS === 'android' || __DEV__) && (
161 | }
165 | onPress={onAlbumPathOpen}
166 | >
167 | 漫画导出目录
168 |
169 | )}
170 | }
176 | onPress={handleImageCacheClear}
177 | >
178 | 清除图片缓存
179 |
180 | {__DEV__ && (
181 | }
187 | onPress={onModalOpen}
188 | >
189 | 清除本地离线数据
190 |
191 | )}
192 |
193 |
194 |
195 |
196 | 警告
197 | 此操作会清空收藏列表、漫画数据、插件和观看设置,请谨慎!
198 |
199 |
200 |
203 |
206 |
207 |
208 |
209 |
210 |
211 |
216 |
217 | );
218 | };
219 |
220 | export default About;
221 |
--------------------------------------------------------------------------------
/src/views/Discovery.tsx:
--------------------------------------------------------------------------------
1 | import React, { useMemo, useState, useCallback, Fragment } from 'react';
2 | import { Text, Input, Button, HStack, useDisclose } from 'native-base';
3 | import { action, useAppSelector, useAppDispatch } from '~/redux';
4 | import { useRoute, useFocusEffect, RouteProp } from '@react-navigation/native';
5 | import { nonNullable, AsyncStatus } from '~/utils';
6 | import { Plugin, PluginMap } from '~/plugins';
7 | import { Keyboard } from 'react-native';
8 | import ActionsheetSelect from '~/components/ActionsheetSelect';
9 | import VectorIcon from '~/components/VectorIcon';
10 | import Bookshelf from '~/components/Bookshelf';
11 | import * as RootNavigation from '~/utils/navigation';
12 |
13 | const { loadDiscovery, setSource, setDiscoveryFilter, resetSearchFilter } = action;
14 |
15 | const Discovery = ({ navigation }: StackDiscoveryProps) => {
16 | const dispatch = useAppDispatch();
17 | const dict = useAppSelector((state) => state.dict.manga);
18 | const list = useAppSelector((state) => state.discovery.list);
19 | const source = useAppSelector((state) => state.plugin.source);
20 | const loadStatus = useAppSelector((state) => state.discovery.loadStatus);
21 | const updateList = useMemo(
22 | () => list.map((item) => dict[item]).filter(nonNullable),
23 | [dict, list]
24 | );
25 |
26 | useFocusEffect(
27 | useCallback(() => {
28 | loadStatus === AsyncStatus.Default && dispatch(loadDiscovery({ isReset: true, source }));
29 | }, [dispatch, loadStatus, source])
30 | );
31 |
32 | const handleReload = useCallback(() => {
33 | dispatch(loadDiscovery({ source, isReset: true }));
34 | }, [dispatch, source]);
35 | const handleLoadMore = useCallback(() => {
36 | dispatch(loadDiscovery({ source }));
37 | }, [dispatch, source]);
38 | const handleDetail = useCallback(
39 | (mangaHash: string) => {
40 | navigation.push('Detail', { mangaHash });
41 | },
42 | [navigation]
43 | );
44 |
45 | return (
46 |
47 |
48 |
56 |
57 | );
58 | };
59 |
60 | export const SearchOption = () => {
61 | const dispatch = useAppDispatch();
62 | const source = useAppSelector((state) => state.plugin.source);
63 | const filter = useAppSelector((state) => state.discovery.filter);
64 | const { isOpen, onOpen, onClose } = useDisclose();
65 | const [key, setKey] = useState('');
66 | const [options, setOptions] = useState([]);
67 |
68 | const discoveryOptions = useMemo(() => {
69 | return (PluginMap.get(source)?.option.discovery || []).map((item) => {
70 | const value = filter[item.name] || item.defaultValue;
71 | const label = item.options.find((option) => option.value === value)?.label || '';
72 | return {
73 | ...item,
74 | value,
75 | label,
76 | };
77 | });
78 | }, [source, filter]);
79 |
80 | const handlePress = (name: string, newOptions: OptionItem[]) => {
81 | return () => {
82 | setKey(name);
83 | setOptions(newOptions);
84 | onOpen();
85 | };
86 | };
87 | const handleChange = (newVal: string) => {
88 | dispatch(setDiscoveryFilter({ [key]: newVal }));
89 | dispatch(loadDiscovery({ source, isReset: true }));
90 | };
91 |
92 | if (discoveryOptions.length <= 0) {
93 | return null;
94 | }
95 |
96 | return (
97 |
98 | {discoveryOptions.map((item) => {
99 | return (
100 |
108 | );
109 | })}
110 |
111 |
117 |
118 | );
119 | };
120 |
121 | export const PluginSelect = () => {
122 | const { isOpen, onOpen: handleOpen, onClose: handleClose } = useDisclose();
123 | const { source, list } = useAppSelector((state) => state.plugin);
124 | const route = useRoute>();
125 | const dispatch = useAppDispatch();
126 | const options = useMemo<{ label: string; value: string }[]>(() => {
127 | return list
128 | .filter((item) => !item.disabled)
129 | .map((item) => ({ label: `${item.name} - ${item.label}`, value: item.value }));
130 | }, [list]);
131 | const plugin = useMemo(() => {
132 | if (route.name === 'Discovery') {
133 | return source;
134 | }
135 | if (route.name === 'Search') {
136 | return route.params?.source;
137 | }
138 | return source;
139 | }, [route.name, route.params?.source, source]);
140 | const pluginLabel = useMemo(() => {
141 | return list.find((item) => item.value === plugin)?.label || plugin;
142 | }, [list, plugin]);
143 |
144 | const handleChange = (newSource: string) => {
145 | if (route.name === 'Discovery') {
146 | dispatch(setSource(newSource as Plugin));
147 | }
148 | if (route.name === 'Search') {
149 | dispatch(resetSearchFilter());
150 | RootNavigation.setParams({ source: newSource as Plugin });
151 | }
152 | };
153 | const handleSetting = () => {
154 | handleClose();
155 | RootNavigation.navigate('Plugin');
156 | };
157 |
158 | return (
159 |
160 |
174 |
181 |
182 | 选择插件
183 |
184 |
185 |
186 | }
187 | />
188 |
189 | );
190 | };
191 |
192 | export const SearchAndPlugin = () => {
193 | const [keyword, setKeyword] = useState('');
194 | const source = useAppSelector((state) => state.plugin.source);
195 |
196 | const handleSearch = () => {
197 | RootNavigation.navigate('Search', { keyword, source });
198 | };
199 |
200 | return (
201 |
202 |
214 |
215 |
216 | );
217 | };
218 |
219 | export default Discovery;
220 |
--------------------------------------------------------------------------------
/src/views/Home.tsx:
--------------------------------------------------------------------------------
1 | import React, { useMemo, useState, useCallback, Fragment } from 'react';
2 | import { action, useAppSelector, useAppDispatch } from '~/redux';
3 | import { nonNullable, AsyncStatus } from '~/utils';
4 | import { View, Text, HStack, Button, Modal, useDisclose } from 'native-base';
5 | import { useFocusEffect } from '@react-navigation/native';
6 | import VectorIcon from '~/components/VectorIcon';
7 | import Bookshelf from '~/components/Bookshelf';
8 | import Rotate from '~/components/Rotate';
9 | import * as RootNavigation from '~/utils/navigation';
10 | import Animated, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
11 |
12 | const { batchUpdate, removeFavorites } = action;
13 |
14 | const Home = ({ navigation: { navigate, setOptions } }: StackHomeProps) => {
15 | const dispatch = useAppDispatch();
16 | const list = useAppSelector((state) => state.favorites);
17 | const dict = useAppSelector((state) => state.dict.manga);
18 | const failList = useAppSelector((state) => state.batch.fail);
19 | const activeList = useAppSelector((state) => state.batch.stack);
20 | const loadStatus = useAppSelector((state) => state.app.launchStatus);
21 | const [selectedManga, setSelectedManga] = useState([]);
22 | const [isSelectMode, setSelectMode] = useState(false);
23 | const { isOpen, onOpen, onClose } = useDisclose();
24 | const headerRightOpacity = useSharedValue(0);
25 |
26 | const favoriteList = useMemo(
27 | () => list.map((item) => dict[item.mangaHash]).filter(nonNullable),
28 | [dict, list]
29 | );
30 | const trendList = useMemo(
31 | () => list.filter((item) => item.isTrend).map((item) => item.mangaHash),
32 | [list]
33 | );
34 | const negativeList = useMemo(
35 | () => list.filter((item) => !item.enableBatch).map((item) => item.mangaHash),
36 | [list]
37 | );
38 |
39 | const handleDetail = (mangaHash: string) => {
40 | if (isSelectMode) {
41 | if (selectedManga.includes(mangaHash)) {
42 | setSelectedManga(selectedManga.filter((hash) => hash !== mangaHash));
43 | } else {
44 | setSelectedManga([...selectedManga, mangaHash]);
45 | }
46 | return;
47 | }
48 | navigate('Detail', { mangaHash });
49 | };
50 |
51 | const handleSelect = (mangaHash: string) => {
52 | if (isSelectMode) {
53 | return;
54 | }
55 | setSelectMode(true);
56 | setSelectedManga([mangaHash]);
57 | headerRightOpacity.value = 1;
58 | };
59 |
60 | const handleCancel = useCallback(() => {
61 | setSelectMode(false);
62 | headerRightOpacity.value = 0;
63 | }, [headerRightOpacity]);
64 |
65 | const handleSelectAll = useCallback(() => {
66 | if (selectedManga.length === list.length) {
67 | setSelectedManga([]);
68 | return;
69 | }
70 | setSelectedManga(list.map((item) => item.mangaHash));
71 | }, [list, selectedManga]);
72 |
73 | const handleDelete = useCallback(() => {
74 | dispatch(removeFavorites(selectedManga));
75 | onClose();
76 | }, [dispatch, onClose, selectedManga]);
77 |
78 | const seteletModeHeaderRightStyle = useAnimatedStyle(() => {
79 | return {
80 | opacity: headerRightOpacity.value,
81 | transform: [{ scale: withSpring(headerRightOpacity.value) }],
82 | };
83 | }, []);
84 |
85 | const renderHeaderRight = useCallback(() => {
86 | if (isSelectMode) {
87 | return (
88 |
89 |
90 |
95 | = list.length
101 | ? 'checkbox-marked-outline'
102 | : 'checkbox-intermediate'
103 | }
104 | onPress={handleSelectAll}
105 | />
106 |
112 |
113 |
114 | );
115 | }
116 | return ;
117 | }, [
118 | list,
119 | selectedManga,
120 | isSelectMode,
121 | seteletModeHeaderRightStyle,
122 | handleCancel,
123 | handleSelectAll,
124 | onOpen,
125 | ]);
126 |
127 | useFocusEffect(
128 | useCallback(() => {
129 | setOptions({ headerRight: renderHeaderRight });
130 | }, [renderHeaderRight, setOptions])
131 | );
132 |
133 | return (
134 |
135 |
148 |
149 |
150 | 确认
151 |
152 | 从列表删除所选漫画?
153 |
154 |
155 |
156 |
159 |
162 |
163 |
164 |
165 |
166 |
167 | );
168 | };
169 |
170 | export const SearchAndAbout = () => {
171 | const dispatch = useAppDispatch();
172 | const { loadStatus: batchStatus, stack, queue, fail } = useAppSelector((state) => state.batch);
173 | const [enableRotate, setEnableRotate] = useState(false);
174 |
175 | useFocusEffect(
176 | useCallback(() => {
177 | setEnableRotate(batchStatus === AsyncStatus.Pending);
178 | }, [batchStatus])
179 | );
180 |
181 | const handleSearch = () => {
182 | RootNavigation.navigate('Discovery');
183 | };
184 | const handlePlugin = () => {
185 | RootNavigation.navigate('Plugin');
186 | };
187 | const handleUpdate = () => {
188 | dispatch(batchUpdate());
189 | };
190 |
191 | return (
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 | {batchStatus === AsyncStatus.Pending && (
200 |
201 | {queue.length + stack.length}
202 |
203 | )}
204 | {batchStatus !== AsyncStatus.Pending && fail.length > 0 && (
205 |
206 | {fail.length}
207 |
208 | )}
209 |
210 |
211 | );
212 | };
213 |
214 | export default Home;
215 |
--------------------------------------------------------------------------------
/src/views/Plugin.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import DraggableFlatList, {
3 | ScaleDecorator,
4 | RenderItemParams,
5 | } from 'react-native-draggable-flatlist';
6 | import { action, useAppSelector, useAppDispatch } from '~/redux';
7 | import { Box, Text, VStack, HStack, Switch } from 'native-base';
8 | import { useDebouncedSafeAreaInsets } from '~/hooks';
9 | import { Plugin as PluginType } from '~/plugins';
10 | import { TouchableOpacity } from 'react-native';
11 | import ScoreRate from '~/components/ScoreRate';
12 |
13 | const { sortPlugin, disablePlugin } = action;
14 |
15 | const Plugin = ({ navigation: { navigate } }: StackPluginProps) => {
16 | const dispatch = useAppDispatch();
17 | const list = useAppSelector((state) => state.plugin.list);
18 | const { left, right, bottom } = useDebouncedSafeAreaInsets();
19 |
20 | const handleToggle = (plugin: PluginType) => {
21 | dispatch(disablePlugin(plugin));
22 | };
23 | const renderItem = ({ item, drag, isActive }: RenderItemParams<(typeof list)[0]>) => (
24 |
25 |
26 |
27 |
28 |
33 | navigate('Webview', {
34 | uri: item.href,
35 | source: item.value,
36 | userAgent: item.userAgent,
37 | injectedJavascript: item.injectedJavaScript,
38 | })
39 | }
40 | textDecorationLine={item.disabled ? 'line-through' : 'none'}
41 | >
42 | {item.name} - {item.label} 🔗
43 |
44 | {item.description && {item.description}}
45 |
46 | 推荐指数:
47 |
48 |
49 |
50 | handleToggle(item.value)}
55 | />
56 |
57 |
58 |
59 | );
60 |
61 | return (
62 |
63 | item.value}
67 | onDragEnd={({ data }) => dispatch(sortPlugin(data))}
68 | contentContainerStyle={{ paddingLeft: left, paddingRight: right, paddingBottom: bottom }}
69 | />
70 | {/* for navigation gesture go back */}
71 |
72 |
73 | );
74 | };
75 |
76 | export default Plugin;
77 |
--------------------------------------------------------------------------------
/src/views/Search.tsx:
--------------------------------------------------------------------------------
1 | import React, { useMemo, useState, useEffect, useCallback, Fragment } from 'react';
2 | import { action, useAppSelector, useAppDispatch } from '~/redux';
3 | import { useRoute, useFocusEffect, RouteProp } from '@react-navigation/native';
4 | import { Button, HStack, useDisclose } from 'native-base';
5 | import { nonNullable, AsyncStatus } from '~/utils';
6 | import { PluginMap } from '~/plugins';
7 | import ActionsheetSelect from '~/components/ActionsheetSelect';
8 | import Bookshelf from '~/components/Bookshelf';
9 |
10 | const { loadSearch, setSearchFilter } = action;
11 |
12 | const Search = ({ route, navigation }: StackSearchProps) => {
13 | const { keyword, source } = route.params;
14 | const dispatch = useAppDispatch();
15 | const dict = useAppSelector((state) => state.dict.manga);
16 | const list = useAppSelector((state) => state.search.list);
17 | const loadStatus = useAppSelector((state) => state.search.loadStatus);
18 | const searchList = useMemo(
19 | () => list.map((item) => dict[item]).filter(nonNullable),
20 | [dict, list]
21 | );
22 |
23 | useFocusEffect(
24 | useCallback(() => {
25 | navigation.setOptions({ title: keyword });
26 | }, [keyword, navigation])
27 | );
28 | useEffect(() => {
29 | dispatch(loadSearch({ keyword, source, isReset: true }));
30 | }, [dispatch, keyword, source]);
31 |
32 | const handleReload = useCallback(() => {
33 | dispatch(loadSearch({ keyword, source, isReset: true }));
34 | }, [dispatch, keyword, source]);
35 | const handleLoadMore = useCallback(() => {
36 | dispatch(loadSearch({ keyword, source }));
37 | }, [dispatch, keyword, source]);
38 | const handleDetail = useCallback(
39 | (mangaHash: string) => {
40 | navigation.push('Detail', { mangaHash });
41 | },
42 | [navigation]
43 | );
44 |
45 | return (
46 |
47 |
48 |
56 |
57 | );
58 | };
59 |
60 | export const SearchOption = () => {
61 | const route = useRoute>();
62 | const source = route.params.source;
63 | const dispatch = useAppDispatch();
64 | const filter = useAppSelector((state) => state.search.filter);
65 | const keyword = useAppSelector((state) => state.search.keyword);
66 | const { isOpen, onOpen, onClose } = useDisclose();
67 | const [key, setKey] = useState('');
68 | const [options, setOptions] = useState([]);
69 |
70 | const searchOptions = useMemo(() => {
71 | return (PluginMap.get(source)?.option.search || []).map((item) => {
72 | const value = filter[item.name] || item.defaultValue;
73 | const label = item.options.find((option) => option.value === value)?.label || '';
74 | return {
75 | ...item,
76 | value,
77 | label,
78 | };
79 | });
80 | }, [source, filter]);
81 |
82 | const handlePress = (name: string, newOptions: OptionItem[]) => {
83 | return () => {
84 | setKey(name);
85 | setOptions(newOptions);
86 | onOpen();
87 | };
88 | };
89 | const handleChange = (newVal: string) => {
90 | dispatch(setSearchFilter({ [key]: newVal }));
91 | dispatch(loadSearch({ keyword, source, isReset: true }));
92 | };
93 |
94 | if (searchOptions.length <= 0) {
95 | return null;
96 | }
97 |
98 | return (
99 |
100 | {searchOptions.map((item) => {
101 | return (
102 |
110 | );
111 | })}
112 |
113 |
119 |
120 | );
121 | };
122 |
123 | export default Search;
124 |
--------------------------------------------------------------------------------
/src/views/Webview.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { action, useAppDispatch } from '~/redux';
3 | import { WebView } from 'react-native-webview';
4 |
5 | const { setExtra } = action;
6 |
7 | const Webview = ({ navigation, route }: StackWebviewProps) => {
8 | const dispatch = useAppDispatch();
9 | const { uri, source, userAgent, injectedJavascript } = route.params || {};
10 |
11 | return (
12 | {
20 | if (source && injectedJavascript) {
21 | try {
22 | const data = JSON.parse(event.nativeEvent.data);
23 | typeof data === 'object' && dispatch(setExtra({ source, data }));
24 | } catch {}
25 | }
26 | }}
27 | onLoadProgress={({ nativeEvent }) => {
28 | navigation.setOptions({ title: nativeEvent.title });
29 | }}
30 | />
31 | );
32 | };
33 |
34 | export default Webview;
35 |
--------------------------------------------------------------------------------
/static/cloudflare_step1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/cloudflare_step1.jpeg
--------------------------------------------------------------------------------
/static/cloudflare_step2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/cloudflare_step2.jpeg
--------------------------------------------------------------------------------
/static/cloudflare_step3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/cloudflare_step3.jpeg
--------------------------------------------------------------------------------
/static/cloudflare_step4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/cloudflare_step4.jpeg
--------------------------------------------------------------------------------
/static/cloudflare_step5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/cloudflare_step5.jpeg
--------------------------------------------------------------------------------
/static/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/demo.gif
--------------------------------------------------------------------------------
/static/pica_step1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/pica_step1.jpeg
--------------------------------------------------------------------------------
/static/pica_step2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/pica_step2.jpeg
--------------------------------------------------------------------------------
/static/pica_step3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/pica_step3.jpeg
--------------------------------------------------------------------------------
/static/usage1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/usage1.jpeg
--------------------------------------------------------------------------------
/static/usage2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/usage2.jpeg
--------------------------------------------------------------------------------
/static/usage3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/usage3.jpeg
--------------------------------------------------------------------------------
/static/usage4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/usage4.jpeg
--------------------------------------------------------------------------------
/static/usage5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/youniaogu/MangaReader/fbdb0bbc1fbd42a9b32bd201f92885a42942ab7d/static/usage5.jpeg
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@tsconfig/react-native/tsconfig.json",
3 | "compilerOptions": {
4 | "lib": [
5 | "es2019",
6 | "es2020.bigint",
7 | "es2020.date",
8 | "es2020.number",
9 | "es2020.promise",
10 | "es2020.string",
11 | "es2020.symbol.wellknown",
12 | "es2021.promise",
13 | "es2021.string",
14 | "es2021.weakref",
15 | "es2022.array",
16 | "es2022.object",
17 | "es2022.string",
18 | "dom"
19 | ],
20 | "baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
21 | "paths": {
22 | "~/*": ["src/*"]
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------