├── web ├── manifest.json ├── favicon.png └── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── linux ├── .gitignore ├── runner │ ├── main.cc │ ├── my_application.h │ ├── CMakeLists.txt │ └── my_application.cc ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt └── CMakeLists.txt ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-50x50@1x.png │ │ │ ├── Icon-App-50x50@2x.png │ │ │ ├── Icon-App-57x57@1x.png │ │ │ ├── Icon-App-57x57@2x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-72x72@1x.png │ │ │ ├── Icon-App-72x72@2x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── RunnerTests │ └── RunnerTests.swift └── .gitignore ├── macos ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ ├── app_icon_64.png │ │ │ └── Contents.json │ ├── Release.entitlements │ ├── AppDelegate.swift │ ├── DebugProfile.entitlements │ ├── MainFlutterWindow.swift │ └── Info.plist ├── .gitignore ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme └── RunnerTests │ └── RunnerTests.swift ├── .gitattributes ├── assets └── icons │ └── z.png ├── run_dump.bat ├── run_test.bat ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── runner.exe.manifest │ ├── utils.h │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ └── win32_window.h ├── .gitignore ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ ├── generated_plugin_registrant.cc │ └── CMakeLists.txt └── CMakeLists.txt ├── android ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ └── ic_launcher.xml │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── open_library │ │ │ │ │ └── app │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle.kts ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── build.gradle.kts └── settings.gradle.kts ├── devtools_options.yaml ├── lib ├── services │ ├── hive_service.dart │ ├── auth_storage.dart │ ├── update_service.dart │ ├── storage_service.dart │ └── ad_service.dart ├── routes │ └── app_routes.dart ├── theme │ ├── app_colors.dart │ └── app_theme.dart ├── models │ ├── api_response.dart │ ├── user.dart │ └── book.dart ├── widgets │ ├── loading_widget.dart │ ├── gradient_app_bar.dart │ ├── empty_state.dart │ ├── banner_ad.dart │ └── book_list_tile.dart ├── providers │ ├── zlibrary_provider.dart │ ├── domain_provider.dart │ ├── ad_provider.dart │ └── settings_provider.dart ├── screens │ ├── settings │ │ └── history_screen.dart │ ├── reader │ │ └── reader_screen.dart │ ├── favorites │ │ └── favorites_screen.dart │ └── splash │ │ └── splash_screen.dart ├── main.dart └── constants │ └── search_filters.dart ├── analysis_options.yaml ├── .gitignore ├── .metadata ├── LICENSE ├── README_ZH.md ├── README_KO.md ├── README_JA.md ├── README.md └── pubspec.yaml /web/manifest.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/web/favicon.png -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Mark .gitignore as always using ours during merge 2 | .gitignore merge=ours 3 | -------------------------------------------------------------------------------- /assets/icons/z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/assets/icons/z.png -------------------------------------------------------------------------------- /run_dump.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not exist api_dump mkdir api_dump 3 | dart lib/api_dump.dart 4 | -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /run_test.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | dart lib/test_api_structure.dart > test_output.txt 2>&1 3 | type test_output.txt 4 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6C5CE7 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shiyi-0x7f/olib-mobile/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/open_library/app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.open_library.app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity : FlutterActivity() 6 | -------------------------------------------------------------------------------- /devtools_options.yaml: -------------------------------------------------------------------------------- 1 | description: This file stores settings for Dart & Flutter DevTools. 2 | documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states 3 | extensions: 4 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /linux/runner/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip 6 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | .cxx/ 9 | 10 | # Remember to never publicly share your keystore. 11 | # See https://flutter.dev/to/reference-keystore 12 | key.properties 13 | **/*.keystore 14 | **/*.jks 15 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /linux/runner/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /lib/services/hive_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive_flutter/hive_flutter.dart'; 2 | 3 | class HiveService { 4 | static const String settingsBoxName = 'settings'; 5 | static const String authBoxName = 'auth'; 6 | 7 | static Future init() async { 8 | await Hive.initFlutter(); 9 | await Hive.openBox(settingsBoxName); 10 | await Hive.openBox(authBoxName); 11 | } 12 | 13 | static Box get settingsBox => Hive.box(settingsBoxName); 14 | static Box get authBox => Hive.box(authBoxName); 15 | } 16 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/routes/app_routes.dart: -------------------------------------------------------------------------------- 1 | class AppRoutes { 2 | static const String splash = '/'; 3 | static const String login = '/login'; 4 | static const String register = '/register'; 5 | static const String home = '/home'; 6 | static const String search = '/search'; 7 | static const String bookDetail = '/book-detail'; 8 | static const String favorites = '/favorites'; 9 | static const String downloads = '/downloads'; 10 | static const String history = '/history'; 11 | static const String settings = '/settings'; 12 | static const String similarBooks = '/similar-books'; 13 | static const String reader = '/reader'; 14 | } 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = zlibrary_mobile 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.zlibraryMobile 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) rive_native_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "RiveNativePlugin"); 15 | rive_native_plugin_register_with_registrar(rive_native_registrar); 16 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 18 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | rive_native 7 | url_launcher_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/theme/app_colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppColors { 4 | // Backgrounds 5 | static const background = Color(0xFFF7F9FC); // Soft off-white/greyish 6 | static const surface = Colors.white; 7 | 8 | // Primary (Dark Teal / Dark Cyan) 9 | static const primary = Color(0xFF0E7C7B); 10 | static const primaryLight = Color(0xFFE0F2F1); // Pale blue/teal for backgrounds 11 | 12 | // Accent (Orange/Yellow for tags/ratings) 13 | static const accent = Color(0xFFFF9F1C); 14 | 15 | // Text 16 | static const textPrimary = Color(0xFF1A1D1E); // Almost black 17 | static const textSecondary = Color(0xFF6C757D); // Grey 18 | 19 | // Progress Bars 20 | static const progressGreen = Color(0xFF2EC4B6); 21 | static const progressYellow = Color(0xFFFFBF69); 22 | static const progressOrange = Color(0xFFFF9F1C); 23 | 24 | // Status 25 | static const error = Color(0xFFE71D36); 26 | static const success = Color(0xFF2EC4B6); 27 | } 28 | -------------------------------------------------------------------------------- /android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | // China mirrors for faster downloads 4 | maven { url = uri("https://maven.aliyun.com/repository/google") } 5 | maven { url = uri("https://maven.aliyun.com/repository/central") } 6 | maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") } 7 | maven { url = uri("https://maven.aliyun.com/repository/public") } 8 | // Fallback to original 9 | google() 10 | mavenCentral() 11 | } 12 | } 13 | 14 | val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() 15 | rootProject.layout.buildDirectory.value(newBuildDir) 16 | 17 | subprojects { 18 | val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) 19 | project.layout.buildDirectory.value(newSubprojectBuildDir) 20 | } 21 | subprojects { 22 | project.evaluationDependsOn(":app") 23 | } 24 | 25 | tasks.register("clean") { 26 | delete(rootProject.layout.buildDirectory) 27 | } 28 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | downloadsfolder 7 | flutter_inappwebview_windows 8 | permission_handler_windows 9 | rive_native 10 | share_plus 11 | url_launcher_windows 12 | ) 13 | 14 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 15 | ) 16 | 17 | set(PLUGIN_BUNDLED_LIBRARIES) 18 | 19 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 20 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 21 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 24 | endforeach(plugin) 25 | 26 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 27 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 28 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 29 | endforeach(ffi_plugin) 30 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /linux/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} 10 | "main.cc" 11 | "my_application.cc" 12 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 13 | ) 14 | 15 | # Apply the standard set of build settings. This can be removed for applications 16 | # that need different build settings. 17 | apply_standard_settings(${BINARY_NAME}) 18 | 19 | # Add preprocessor definitions for the application ID. 20 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 21 | 22 | # Add dependency libraries. Add any application-specific dependencies here. 23 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 24 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 25 | 26 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 27 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/models/api_response.dart: -------------------------------------------------------------------------------- 1 | // Simple API response wrapper without json_serializable 2 | // (Generic types don't work well with json_serializable) 3 | class ApiResponse { 4 | final bool success; 5 | final T? data; 6 | final String? message; 7 | final String? error; 8 | 9 | const ApiResponse({ 10 | required this.success, 11 | this.data, 12 | this.message, 13 | this.error, 14 | }); 15 | 16 | factory ApiResponse.fromJson( 17 | Map json, 18 | T Function(Object?)? fromJsonT, 19 | ) { 20 | return ApiResponse( 21 | success: json['success'] as bool, 22 | data: fromJsonT != null && json['data'] != null 23 | ? fromJsonT(json['data']) 24 | : null, 25 | message: json['message'] as String?, 26 | error: json['error'] as String?, 27 | ); 28 | } 29 | 30 | Map toJson(Object? Function(T)? toJsonT) { 31 | return { 32 | 'success': success, 33 | 'data': toJsonT != null && data != null ? toJsonT(data as T) : data, 34 | 'message': message, 35 | 'error': error, 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/widgets/loading_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../theme/app_colors.dart'; 3 | 4 | class LoadingWidget extends StatelessWidget { 5 | final String? message; 6 | 7 | const LoadingWidget({super.key, this.message}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Center( 12 | child: Column( 13 | mainAxisAlignment: MainAxisAlignment.center, 14 | children: [ 15 | Container( 16 | padding: const EdgeInsets.all(20), 17 | decoration: const BoxDecoration( 18 | color: AppColors.primary, 19 | shape: BoxShape.circle, 20 | ), 21 | child: const CircularProgressIndicator( 22 | valueColor: AlwaysStoppedAnimation(Colors.white), 23 | ), 24 | ), 25 | if (message != null) ...[ 26 | const SizedBox(height: 24), 27 | Text( 28 | message!, 29 | style: Theme.of(context).textTheme.bodyMedium, 30 | textAlign: TextAlign.center, 31 | ), 32 | ], 33 | ], 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /android/app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | id("kotlin-android") 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id("dev.flutter.flutter-gradle-plugin") 6 | } 7 | 8 | android { 9 | namespace = "com.open_library.app" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_11 15 | targetCompatibility = JavaVersion.VERSION_11 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_11.toString() 20 | } 21 | 22 | defaultConfig { 23 | applicationId = "com.open_library.app" 24 | minSdk = flutter.minSdkVersion 25 | targetSdk = flutter.targetSdkVersion 26 | versionCode = flutter.versionCode 27 | versionName = flutter.versionName 28 | } 29 | 30 | buildTypes { 31 | release { 32 | signingConfig = signingConfigs.getByName("debug") 33 | isMinifyEnabled = false 34 | isShrinkResources = false 35 | } 36 | } 37 | } 38 | 39 | flutter { 40 | source = "../.." 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /lib/models/user.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'user.freezed.dart'; 4 | part 'user.g.dart'; 5 | 6 | @freezed 7 | class User with _$User { 8 | const User._(); 9 | 10 | const factory User({ 11 | @JsonKey(fromJson: _toString) required String id, 12 | required String name, 13 | required String email, 14 | @JsonKey(name: 'kindle_email') String? kindleEmail, 15 | @JsonKey(name: 'remix_userkey') required String remixUserkey, 16 | @JsonKey(name: 'downloads_limit', fromJson: _toInt) int? downloadsLimit, 17 | @JsonKey(name: 'downloads_today', fromJson: _toInt) int? downloadsToday, 18 | @JsonKey(fromJson: _toInt) int? confirmed, 19 | @JsonKey(name: 'isPremium', fromJson: _toInt) int? isPremium, 20 | }) = _User; 21 | 22 | factory User.fromJson(Map json) => _$UserFromJson(json); 23 | 24 | // Computed property for downloads left 25 | int get downloadsLeft => (downloadsLimit ?? 10) - (downloadsToday ?? 0); 26 | } 27 | 28 | // Helpers 29 | String _toString(dynamic value) => value?.toString() ?? ''; 30 | int? _toInt(dynamic value) { 31 | if (value == null) return null; 32 | if (value is int) return value; 33 | return int.tryParse(value.toString()); 34 | } 35 | -------------------------------------------------------------------------------- /android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val flutterSdkPath = run { 3 | val properties = java.util.Properties() 4 | file("local.properties").inputStream().use { properties.load(it) } 5 | val flutterSdkPath = properties.getProperty("flutter.sdk") 6 | require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } 7 | flutterSdkPath 8 | } 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | // China mirrors for faster downloads 14 | maven { url = uri("https://maven.aliyun.com/repository/google") } 15 | maven { url = uri("https://maven.aliyun.com/repository/central") } 16 | maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") } 17 | maven { url = uri("https://maven.aliyun.com/repository/public") } 18 | // Fallback to original 19 | google() 20 | mavenCentral() 21 | gradlePluginPortal() 22 | } 23 | } 24 | 25 | plugins { 26 | id("dev.flutter.flutter-plugin-loader") version "1.0.0" 27 | id("com.android.application") version "8.7.3" apply false 28 | id("org.jetbrains.kotlin.android") version "2.1.0" apply false 29 | } 30 | 31 | include(":app") 32 | -------------------------------------------------------------------------------- /lib/providers/zlibrary_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 2 | import '../services/zlibrary_api.dart'; 3 | 4 | /// Provider for the ZLibrary API singleton instance 5 | final zlibraryApiProvider = Provider((ref) { 6 | // We don't set domain here because DomainNotifier will set it 7 | // immediately upon creation. However, DomainNotifier READS this provider. 8 | // So we just return the instance. 9 | // The only risk is if API is used BEFORE DomainNotifier is initialized. 10 | // But DomainNotifier is watched by UI usually. 11 | // BETTER: Initialize it here too for safety. 12 | 13 | final api = ZLibraryApi(); 14 | // We can't use HiveService here easily without imports, but we can try? 15 | // Actually, DomainProvider handles the logic. 16 | // API defaults to 'z-library.sk'. 17 | // If DomainNotifier isn't alive, API uses default. 18 | // IF we want persisted domain on startup for background tasks (if any), 19 | // we should read Hive here. 20 | 21 | // For now, simple return is fine as UI will init DomainProvider. 22 | // But wait, if we use API in `ref.read` before UI builds... 23 | // I'll leave it as is, relying on DomainProvider or AuthProvider usages. 24 | return api; 25 | }); 26 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | void RegisterPlugins(flutter::PluginRegistry* registry) { 17 | DownloadsfolderPluginCApiRegisterWithRegistrar( 18 | registry->GetRegistrarForPlugin("DownloadsfolderPluginCApi")); 19 | FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar( 20 | registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi")); 21 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 22 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 23 | RiveNativePluginRegisterWithRegistrar( 24 | registry->GetRegistrarForPlugin("RiveNativePlugin")); 25 | SharePlusWindowsPluginCApiRegisterWithRegistrar( 26 | registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); 27 | UrlLauncherWindowsRegisterWithRegistrar( 28 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 29 | } 30 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"Olib", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import downloadsfolder 9 | import file_picker 10 | import flutter_inappwebview_macos 11 | import package_info_plus 12 | import path_provider_foundation 13 | import rive_native 14 | import share_plus 15 | import shared_preferences_foundation 16 | import sqflite_darwin 17 | import url_launcher_macos 18 | 19 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 20 | DownloadsfolderPlugin.register(with: registry.registrar(forPlugin: "DownloadsfolderPlugin")) 21 | FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) 22 | InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) 23 | FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) 24 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 25 | RiveNativePlugin.register(with: registry.registrar(forPlugin: "RiveNativePlugin")) 26 | SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) 27 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 28 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 29 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 30 | } 31 | -------------------------------------------------------------------------------- /lib/widgets/gradient_app_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../theme/app_colors.dart'; 3 | 4 | class GradientAppBar extends StatelessWidget implements PreferredSizeWidget { 5 | final String title; 6 | final List? actions; 7 | final Widget? leading; 8 | final bool centerTitle; 9 | 10 | const GradientAppBar({ 11 | super.key, 12 | required this.title, 13 | this.actions, 14 | this.leading, 15 | this.centerTitle = true, 16 | }); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | // Minimalist AppBar: No gradient, matches scaffold background 21 | return AppBar( 22 | title: Text( 23 | title, 24 | style: Theme.of(context).textTheme.headlineSmall?.copyWith( 25 | fontWeight: FontWeight.bold, 26 | color: AppColors.textPrimary, 27 | ), 28 | ), 29 | backgroundColor: AppColors.background, 30 | elevation: 0, 31 | centerTitle: centerTitle, 32 | leading: leading, 33 | actions: actions, 34 | iconTheme: const IconThemeData(color: AppColors.textPrimary), 35 | bottom: PreferredSize( 36 | preferredSize: const Size.fromHeight(1.0), 37 | child: Container( 38 | color: Colors.black.withOpacity(0.05), // Subtle separator 39 | height: 1.0, 40 | ), 41 | ), 42 | ); 43 | } 44 | 45 | @override 46 | Size get preferredSize => const Size.fromHeight(kToolbarHeight + 1); 47 | } 48 | -------------------------------------------------------------------------------- /lib/providers/domain_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 2 | import '../services/hive_service.dart'; 3 | import '../services/zlibrary_api.dart'; 4 | import 'zlibrary_provider.dart'; 5 | 6 | final domainListProvider = Provider>((ref) { 7 | return { 8 | 'Line 1 (CN)': 'zkoo.site', 9 | 'Line 2 (CN)': 'zlibrary-iran.ir', 10 | 'Line 3 (CN)': 'freezlib.me', 11 | 'Line 4 (CN)': 'pkuedu.online', 12 | 'Global': 'z-library.sk', 13 | }; 14 | }); 15 | 16 | final domainProvider = StateNotifierProvider((ref) { 17 | final api = ref.watch(zlibraryApiProvider); 18 | return DomainNotifier(api); 19 | }); 20 | 21 | class DomainNotifier extends StateNotifier { 22 | final ZLibraryApi _api; 23 | 24 | DomainNotifier(this._api) 25 | : super(HiveService.settingsBox.get('domain', defaultValue: 'pkuedu.online')) { 26 | // Ensure API is in sync with initial state 27 | _api.setDomain(state); 28 | } 29 | 30 | void setDomain(String domain) { 31 | state = domain; 32 | HiveService.settingsBox.put('domain', domain); 33 | _api.setDomain(domain); 34 | } 35 | 36 | void setCustomDomain(String domain) { 37 | // Remove protocol if present 38 | String cleanDomain = domain.replaceAll(RegExp(r'^https?://'), ''); 39 | if (cleanDomain.endsWith('/')) { 40 | cleanDomain = cleanDomain.substring(0, cleanDomain.length - 1); 41 | } 42 | setDomain(cleanDomain); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /lib/widgets/empty_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class EmptyState extends StatelessWidget { 4 | final IconData icon; 5 | final String title; 6 | final String? message; 7 | final Widget? action; 8 | 9 | const EmptyState({ 10 | super.key, 11 | required this.icon, 12 | required this.title, 13 | this.message, 14 | this.action, 15 | }); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Center( 20 | child: Padding( 21 | padding: const EdgeInsets.all(32), 22 | child: Column( 23 | mainAxisAlignment: MainAxisAlignment.center, 24 | children: [ 25 | Icon( 26 | icon, 27 | size: 80, 28 | color: Theme.of(context).colorScheme.primary.withOpacity(0.5), 29 | ), 30 | const SizedBox(height: 24), 31 | Text( 32 | title, 33 | style: Theme.of(context).textTheme.titleLarge, 34 | textAlign: TextAlign.center, 35 | ), 36 | if (message != null) ...[ 37 | const SizedBox(height: 12), 38 | Text( 39 | message!, 40 | style: Theme.of(context).textTheme.bodyMedium, 41 | textAlign: TextAlign.center, 42 | ), 43 | ], 44 | if (action != null) ...[ 45 | const SizedBox(height: 24), 46 | action!, 47 | ], 48 | ], 49 | ), 50 | ), 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .build/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | .swiftpm/ 13 | migrate_working_dir/ 14 | 15 | # IntelliJ related 16 | *.iml 17 | *.ipr 18 | *.iws 19 | .idea/ 20 | 21 | # VS Code 22 | .vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | pubspec.lock 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio build artifacts 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | /android/.gradle/ 46 | /android/local.properties 47 | /android/app/build/ 48 | *.jks 49 | *.keystore 50 | 51 | # iOS 52 | /ios/Pods/ 53 | /ios/.symlinks/ 54 | /ios/Flutter/Flutter.framework 55 | /ios/Flutter/Flutter.podspec 56 | /ios/Runner.xcworkspace/ 57 | 58 | # Generated files 59 | *.freezed.dart 60 | *.g.dart 61 | 62 | # Large binary files 63 | *.apk 64 | *.ipa 65 | *.aab 66 | *.dSYM.zip 67 | *.dSYM 68 | 69 | # Publish page 70 | api_dump/ 71 | test/ 72 | publish_page/ 73 | 74 | # ======================================== 75 | # SENSITIVE SOURCE CODE - DO NOT SHARE 76 | # ======================================== 77 | lib/services/zlibrary_api.dart 78 | lib/test_api_structure.dart 79 | lib/test_email_verification.dart 80 | lib/api_dump.dart 81 | lib/debug_login.dart 82 | lib/screens/debug 83 | 84 | # Environment / Secrets 85 | .env 86 | .env.* 87 | secrets/ 88 | *.pem 89 | *.p12 -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.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 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "8defaa71a77c16e8547abdbfad2053ce3a6e2d5b" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 17 | base_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 18 | - platform: android 19 | create_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 20 | base_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 21 | - platform: ios 22 | create_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 23 | base_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 24 | - platform: linux 25 | create_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 26 | base_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 27 | - platform: macos 28 | create_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 29 | base_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 30 | - platform: windows 31 | create_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 32 | base_revision: 8defaa71a77c16e8547abdbfad2053ce3a6e2d5b 33 | 34 | # User provided section 35 | 36 | # List of Local paths (relative to this file) that should be 37 | # ignored by the migrate tool. 38 | # 39 | # Files that are not part of the templates will be ignored by default. 40 | unmanaged_files: 41 | - 'lib/main.dart' 42 | - 'ios/Runner.xcodeproj/project.pbxproj' 43 | -------------------------------------------------------------------------------- /lib/widgets/banner_ad.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:unity_ads_plugin/unity_ads_plugin.dart'; 4 | import '../services/ad_service.dart'; 5 | import '../providers/ad_provider.dart'; 6 | 7 | /// Banner ad widget that respects ad-free status 8 | class BannerAdWidget extends ConsumerWidget { 9 | const BannerAdWidget({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context, WidgetRef ref) { 13 | final shouldShowAds = ref.watch(shouldShowAdsProvider); 14 | 15 | if (!shouldShowAds) { 16 | return const SizedBox.shrink(); 17 | } 18 | 19 | return Container( 20 | height: 50, 21 | alignment: Alignment.center, 22 | child: UnityBannerAd( 23 | placementId: AdService.getBannerPlacement(), 24 | onLoad: (placementId) { 25 | debugPrint('Banner loaded: $placementId'); 26 | }, 27 | onFailed: (placementId, error, message) { 28 | debugPrint('Banner failed: $error - $message'); 29 | }, 30 | onClick: (placementId) { 31 | debugPrint('Banner clicked: $placementId'); 32 | }, 33 | ), 34 | ); 35 | } 36 | } 37 | 38 | /// Bottom banner ad wrapper (for screens that need it) 39 | class BottomBannerAd extends ConsumerWidget { 40 | final Widget child; 41 | 42 | const BottomBannerAd({ 43 | super.key, 44 | required this.child, 45 | }); 46 | 47 | @override 48 | Widget build(BuildContext context, WidgetRef ref) { 49 | final shouldShowAds = ref.watch(shouldShowAdsProvider); 50 | 51 | return Column( 52 | children: [ 53 | Expanded(child: child), 54 | if (shouldShowAds) const BannerAdWidget(), 55 | ], 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "version": 1, 4 | "author": "xcode" 5 | }, 6 | "images": [ 7 | { 8 | "size": "16x16", 9 | "idiom": "mac", 10 | "filename": "app_icon_16.png", 11 | "scale": "1x" 12 | }, 13 | { 14 | "size": "16x16", 15 | "idiom": "mac", 16 | "filename": "app_icon_32.png", 17 | "scale": "2x" 18 | }, 19 | { 20 | "size": "32x32", 21 | "idiom": "mac", 22 | "filename": "app_icon_32.png", 23 | "scale": "1x" 24 | }, 25 | { 26 | "size": "32x32", 27 | "idiom": "mac", 28 | "filename": "app_icon_64.png", 29 | "scale": "2x" 30 | }, 31 | { 32 | "size": "128x128", 33 | "idiom": "mac", 34 | "filename": "app_icon_128.png", 35 | "scale": "1x" 36 | }, 37 | { 38 | "size": "128x128", 39 | "idiom": "mac", 40 | "filename": "app_icon_256.png", 41 | "scale": "2x" 42 | }, 43 | { 44 | "size": "256x256", 45 | "idiom": "mac", 46 | "filename": "app_icon_256.png", 47 | "scale": "1x" 48 | }, 49 | { 50 | "size": "256x256", 51 | "idiom": "mac", 52 | "filename": "app_icon_512.png", 53 | "scale": "2x" 54 | }, 55 | { 56 | "size": "512x512", 57 | "idiom": "mac", 58 | "filename": "app_icon_512.png", 59 | "scale": "1x" 60 | }, 61 | { 62 | "size": "512x512", 63 | "idiom": "mac", 64 | "filename": "app_icon_1024.png", 65 | "scale": "2x" 66 | } 67 | ] 68 | } -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /lib/models/book.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'book.freezed.dart'; 4 | part 'book.g.dart'; 5 | 6 | @freezed 7 | class Book with _$Book { 8 | const factory Book({ 9 | @JsonKey(fromJson: _toInt) required int id, 10 | @JsonKey(name: 'content_type') String? contentType, 11 | required String title, 12 | String? author, 13 | String? volume, 14 | @JsonKey(fromJson: _toInt) int? year, 15 | String? edition, 16 | String? publisher, 17 | String? identifier, 18 | String? language, 19 | @JsonKey(fromJson: _toInt) int? pages, 20 | String? series, 21 | String? cover, 22 | @JsonKey(name: 'terms_hash') String? termsHash, 23 | @JsonKey(fromJson: _toInt) int? active, 24 | @JsonKey(fromJson: _toInt) int? deleted, 25 | @JsonKey(fromJson: _toInt) int? filesize, 26 | @JsonKey(name: 'filesizeString') String? filesizeString, 27 | String? extension, 28 | String? md5, 29 | String? sha256, 30 | String? href, 31 | String? hash, 32 | @JsonKey(name: 'kindleAvailable') bool? kindleAvailable, 33 | @JsonKey(name: 'sendToEmailAvailable') bool? sendToEmailAvailable, 34 | @JsonKey(name: 'interestScore') String? interestScore, 35 | @JsonKey(name: 'qualityScore') String? qualityScore, 36 | String? dl, 37 | @JsonKey(name: 'readOnlineUrl') String? readOnlineUrl, 38 | String? description, 39 | @JsonKey(name: '_isUserSavedBook') bool? isUserSavedBook, 40 | @JsonKey(name: 'readOnlineAvailable') bool? readOnlineAvailable, 41 | }) = _Book; 42 | 43 | factory Book.fromJson(Map json) => _$BookFromJson(json); 44 | } 45 | 46 | // Helpers 47 | int _toInt(dynamic value) { 48 | if (value == null) return 0; 49 | if (value is int) return value; 50 | return int.tryParse(value.toString()) ?? 0; 51 | } 52 | int? _toIntNullable(dynamic value) { 53 | if (value == null) return null; 54 | if (value is int) return value; 55 | return int.tryParse(value.toString()); 56 | } 57 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Olib 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | olib_mobile 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | UIFileSharingEnabled 49 | 50 | LSSupportsOpeningDocumentsInPlace 51 | 52 | UISupportsDocumentBrowser 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | {"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/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 | -------------------------------------------------------------------------------- /lib/providers/ad_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 2 | import '../services/ad_service.dart'; 3 | 4 | /// State for ad-free status 5 | class AdFreeState { 6 | final bool isAdFree; 7 | final Duration remaining; 8 | final int todayWatchCount; 9 | 10 | const AdFreeState({ 11 | required this.isAdFree, 12 | required this.remaining, 13 | required this.todayWatchCount, 14 | }); 15 | 16 | factory AdFreeState.initial() { 17 | return AdFreeState( 18 | isAdFree: AdService.isAdFree(), 19 | remaining: AdService.getAdFreeRemaining(), 20 | todayWatchCount: AdService.getTodayWatchCount(), 21 | ); 22 | } 23 | 24 | AdFreeState copyWith({ 25 | bool? isAdFree, 26 | Duration? remaining, 27 | int? todayWatchCount, 28 | }) { 29 | return AdFreeState( 30 | isAdFree: isAdFree ?? this.isAdFree, 31 | remaining: remaining ?? this.remaining, 32 | todayWatchCount: todayWatchCount ?? this.todayWatchCount, 33 | ); 34 | } 35 | 36 | /// Format remaining time as string 37 | String getRemainingString(String locale) { 38 | if (!isAdFree || remaining == Duration.zero) { 39 | return locale.startsWith('zh') ? '无' : 'None'; 40 | } 41 | 42 | final hours = remaining.inHours; 43 | final minutes = remaining.inMinutes % 60; 44 | 45 | if (locale.startsWith('zh')) { 46 | if (hours > 0) { 47 | return '$hours小时${minutes > 0 ? '$minutes分钟' : ''}'; 48 | } 49 | return '$minutes分钟'; 50 | } else { 51 | if (hours > 0) { 52 | return '${hours}h${minutes > 0 ? ' ${minutes}m' : ''}'; 53 | } 54 | return '${minutes}m'; 55 | } 56 | } 57 | } 58 | 59 | /// Notifier for ad-free status 60 | class AdFreeNotifier extends StateNotifier { 61 | AdFreeNotifier() : super(AdFreeState.initial()); 62 | 63 | /// Refresh state from storage 64 | void refresh() { 65 | state = AdFreeState.initial(); 66 | } 67 | 68 | /// Grant ad-free time after watching rewarded ad 69 | Future grantAdFreeTime() async { 70 | final granted = await AdService.grantAdFreeTime(); 71 | refresh(); 72 | return granted; 73 | } 74 | } 75 | 76 | /// Provider for ad-free status 77 | final adFreeProvider = StateNotifierProvider((ref) { 78 | return AdFreeNotifier(); 79 | }); 80 | 81 | /// Provider to check if ads should be shown (only on mobile platforms) 82 | final shouldShowAdsProvider = Provider((ref) { 83 | // Only show ads on mobile platforms 84 | if (!AdService.isMobilePlatform) return false; 85 | 86 | final adFreeState = ref.watch(adFreeProvider); 87 | return !adFreeState.isAdFree && AdService.isInitialized; 88 | }); 89 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License with Additional Disclaimers 2 | 3 | Copyright (c) 2024 FreeBooks Team 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 | ADDITIONAL DISCLAIMERS AND LIMITATIONS: 16 | 17 | 1. EDUCATIONAL PURPOSE ONLY 18 | This software is provided for educational and personal use only. The authors 19 | do not endorse, encourage, or condone any use of this software that may 20 | violate applicable laws or the terms of service of any third-party platforms. 21 | 22 | 2. USER RESPONSIBILITY 23 | Users are solely responsible for ensuring their use of this software complies 24 | with all applicable local, national, and international laws and regulations. 25 | The authors assume no responsibility for any misuse of this software. 26 | 27 | 3. NO AFFILIATION 28 | This software is an independent project and is not affiliated with, endorsed 29 | by, or connected to any third-party service, platform, or organization. 30 | 31 | 4. CONTENT DISCLAIMER 32 | The authors do not host, store, or provide access to any copyrighted content. 33 | Any content accessed through this software is the responsibility of the user 34 | and the respective content providers. 35 | 36 | 5. NO WARRANTY 37 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 38 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 39 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 40 | 41 | 6. LIMITATION OF LIABILITY 42 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 43 | DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 44 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 45 | USE OR OTHER DEALINGS IN THE SOFTWARE. 46 | 47 | 7. INDEMNIFICATION 48 | By using this software, you agree to indemnify, defend, and hold harmless 49 | the authors from and against any and all claims, damages, obligations, 50 | losses, liabilities, costs, or debt arising from your use of this software. 51 | 52 | 8. TERMINATION 53 | The authors reserve the right to discontinue, modify, or terminate this 54 | software at any time without notice. 55 | 56 | By using this software, you acknowledge that you have read, understood, and 57 | agree to be bound by these terms and conditions. 58 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 25 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 43 | 44 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /README_ZH.md: -------------------------------------------------------------------------------- 1 | # 📚 Olib 2 | 3 |
4 | 5 | ![Flutter](https://img.shields.io/badge/Flutter-02569B?style=for-the-badge&logo=flutter&logoColor=white) 6 | ![Dart](https://img.shields.io/badge/Dart-0175C2?style=for-the-badge&logo=dart&logoColor=white) 7 | ![AI Built](https://img.shields.io/badge/AI%20构建-🤖-purple?style=for-the-badge) 8 | ![Open Source](https://img.shields.io/badge/开源-❤️-green?style=for-the-badge) 9 | ![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge) 10 | 11 | **🤖 完全由 AI 辅助构建的开源电子书阅读器** 12 | 13 | **第三方客户端 • 仅提供前端界面 • 数据来自外部源** 14 | 15 | [下载 APK](https://bookbook.space) • [报告问题](../../issues) • [功能建议](../../issues) 16 | 17 | **[English](README.md)** | **简体中文** | **[日本語](README_JA.md)** | **[한국어](README_KO.md)** 18 | 19 |
20 | 21 | --- 22 | 23 | > ⚠️ **免责声明**: Olib 是一个独立的开源第三方客户端,**不是**官方客户端,与任何官方服务无关。本项目仅提供前端界面,所有书籍数据来自外部源。请谨慎使用。 24 | 25 | ## ✨ 功能特点 26 | 27 | | 功能 | 说明 | 28 | |------|------| 29 | | 📖 **书籍搜索** | 支持书名、作者、ISBN 等多种搜索方式 | 30 | | 💾 **离线阅读** | 下载后无需网络即可阅读 | 31 | | 🌙 **夜间模式** | 护眼阅读体验 | 32 | | 🌍 **多语言** | 支持 16+ 种语言,包括中文、英文、日文、韩文等 | 33 | | 🔐 **多账号** | 支持多账号切换,轻松管理 | 34 | | 🔗 **多线路** | 多个服务器线路可选 | 35 | | 🆓 **完全免费** | 无广告、无订阅、无隐藏费用 | 36 | 37 | ## 🤖 AI 构建项目 38 | 39 | 本项目**完全由 AI 辅助构建**: 40 | - AI 设计架构 41 | - AI 实现代码 42 | - AI 设计界面 43 | - AI 编写文档 44 | 45 | ## 📱 截图 46 | 47 |
48 | 即将推出... 49 |
50 | 51 | ## 🚀 快速开始 52 | 53 | ### 环境要求 54 | 55 | - Flutter SDK 3.8+ 56 | - Android Studio / VS Code 57 | - Android 设备或模拟器 58 | 59 | ### 安装步骤 60 | 61 | ```bash 62 | # 克隆仓库 63 | git clone https://github.com/shiyi-0x7f/olib-mobile.git 64 | 65 | # 进入项目目录 66 | cd olib-mobile 67 | 68 | # 安装依赖 69 | flutter pub get 70 | 71 | # 运行应用 72 | flutter run 73 | ``` 74 | 75 | ### 构建 APK 76 | 77 | ```bash 78 | flutter build apk --release 79 | ``` 80 | 81 | ## 🏗️ 项目结构 82 | 83 | ``` 84 | lib/ 85 | ├── l10n/ # 多语言文件 (16+ 种语言) 86 | ├── models/ # 数据模型 87 | ├── providers/ # 状态管理 (Riverpod) 88 | ├── routes/ # 路由导航 89 | ├── screens/ # 界面 90 | ├── services/ # API 和存储服务 91 | ├── theme/ # 主题配置 92 | └── widgets/ # 可复用组件 93 | ``` 94 | 95 | ## 🛠️ 技术栈 96 | 97 | - **框架**: Flutter 98 | - **状态管理**: Riverpod 99 | - **本地存储**: Hive 100 | - **网络请求**: http 包 101 | - **多语言**: 16+ 种语言 102 | 103 | ## 🤝 贡献指南 104 | 105 | 欢迎贡献代码!请随时提交 Pull Request。 106 | 107 | 1. Fork 本项目 108 | 2. 创建功能分支 (`git checkout -b feature/AmazingFeature`) 109 | 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) 110 | 4. 推送到分支 (`git push origin feature/AmazingFeature`) 111 | 5. 发起 Pull Request 112 | 113 | ## 📄 许可证 114 | 115 | 本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。 116 | 117 | > ⚠️ **法律声明**: 118 | > - 这是一个独立的第三方客户端,**非**官方应用 119 | > - 所有书籍数据来自外部源,本项目仅提供前端界面 120 | > - 用户须自行确保使用符合相关法律法规 121 | > - 使用本软件即表示您了解并接受以上条款 122 | 123 | ## 💖 致谢 124 | 125 | - 🤖 AI 辅助构建 126 | - 💙 Flutter 框架 127 | - ❤️ 开源社区 128 | 129 | --- 130 | 131 |
132 | 133 | **[⬆ 返回顶部](#-olib)** 134 | 135 | 🤖 AI 构建 • 开源 • 永久免费 136 | 137 |
138 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /lib/services/auth_storage.dart: -------------------------------------------------------------------------------- 1 | import '../services/hive_service.dart'; 2 | 3 | class AuthStorage { 4 | static const String _keyUserId = 'remix_userid'; 5 | static const String _keyUserKey = 'remix_userkey'; 6 | static const String _keyUserEmail = 'user_email'; 7 | static const String _keyUserName = 'user_name'; 8 | static const String _keyUserPassword = 'user_password'; 9 | 10 | static const String _keyAccounts = 'saved_accounts'; 11 | 12 | /// Save authentication credentials 13 | Future saveCredentials({ 14 | required String userId, 15 | required String userKey, 16 | String? email, 17 | String? name, 18 | String? password, 19 | }) async { 20 | final box = HiveService.authBox; 21 | await box.put(_keyUserId, userId); 22 | await box.put(_keyUserKey, userKey); 23 | if (email != null) await box.put(_keyUserEmail, email); 24 | if (name != null) await box.put(_keyUserName, name); 25 | if (password != null) await box.put(_keyUserPassword, password); 26 | 27 | // Also save to accounts list 28 | await saveAccount({ 29 | 'userId': userId, 30 | 'userKey': userKey, 31 | 'email': email, 32 | 'name': name, 33 | 'password': password, 34 | }); 35 | } 36 | 37 | /// Retrieve stored credentials 38 | Future> getCredentials() async { 39 | final box = HiveService.authBox; 40 | return { 41 | 'userId': box.get(_keyUserId), 42 | 'userKey': box.get(_keyUserKey), 43 | 'email': box.get(_keyUserEmail), 44 | 'name': box.get(_keyUserName), 45 | 'password': box.get(_keyUserPassword), 46 | }; 47 | } 48 | 49 | /// Check if credentials are stored 50 | Future hasStoredCredentials() async { 51 | final box = HiveService.authBox; 52 | return box.containsKey(_keyUserId) && box.containsKey(_keyUserKey); 53 | } 54 | 55 | /// Clear all stored credentials 56 | Future clearCredentials() async { 57 | final box = HiveService.authBox; 58 | await box.delete(_keyUserId); 59 | await box.delete(_keyUserKey); 60 | await box.delete(_keyUserEmail); 61 | await box.delete(_keyUserName); 62 | await box.delete(_keyUserPassword); 63 | } 64 | 65 | /// Save an account to the list 66 | Future saveAccount(Map account) async { 67 | final box = HiveService.authBox; 68 | final List accounts = box.get(_keyAccounts, defaultValue: []); 69 | final existingIndex = accounts.indexWhere((a) => a['userId'] == account['userId']); 70 | 71 | if (existingIndex != -1) { 72 | accounts[existingIndex] = account; 73 | } else { 74 | accounts.add(account); 75 | } 76 | await box.put(_keyAccounts, accounts); 77 | } 78 | 79 | /// Get all stored accounts 80 | Future>> getStoredAccounts() async { 81 | final box = HiveService.authBox; 82 | final List rawList = box.get(_keyAccounts, defaultValue: []); 83 | // Cast to List safely 84 | return rawList.map((e) => Map.from(e as Map)).toList(); 85 | } 86 | 87 | /// Remove an account 88 | Future removeAccount(String userId) async { 89 | final box = HiveService.authBox; 90 | final List accounts = box.get(_keyAccounts, defaultValue: []); 91 | accounts.removeWhere((a) => a['userId'] == userId); 92 | await box.put(_keyAccounts, accounts); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/providers/settings_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import '../services/storage_service.dart'; 4 | import '../services/hive_service.dart'; 5 | import '../l10n/app_localizations.dart'; 6 | 7 | enum AppThemeMode { 8 | system, 9 | light, 10 | dark, 11 | } 12 | 13 | /// Theme mode notifier 14 | class ThemeModeNotifier extends StateNotifier { 15 | final StorageService _storage; 16 | 17 | ThemeModeNotifier(this._storage) : super(AppThemeMode.system) { 18 | _loadThemeMode(); 19 | } 20 | 21 | Future _loadThemeMode() async { 22 | final mode = await _storage.getThemeMode(); 23 | state = AppThemeMode.values[mode]; 24 | } 25 | 26 | Future setThemeMode(AppThemeMode mode) async { 27 | state = mode; 28 | await _storage.setThemeMode(mode.index); 29 | } 30 | 31 | ThemeMode get themeMode { 32 | switch (state) { 33 | case AppThemeMode.light: 34 | return ThemeMode.light; 35 | case AppThemeMode.dark: 36 | return ThemeMode.dark; 37 | case AppThemeMode.system: 38 | default: 39 | return ThemeMode.system; 40 | } 41 | } 42 | } 43 | 44 | /// Theme mode provider 45 | final themeModeProvider = 46 | StateNotifierProvider((ref) { 47 | return ThemeModeNotifier(StorageService()); 48 | }); 49 | 50 | /// Download path notifier for custom download directory (Android only) 51 | class DownloadPathNotifier extends StateNotifier { 52 | final StorageService _storage; 53 | 54 | DownloadPathNotifier(this._storage) : super(null) { 55 | _init(); 56 | } 57 | 58 | Future _init() async { 59 | state = await _storage.getDownloadPath(); 60 | } 61 | 62 | Future setDownloadPath(String path) async { 63 | await _storage.setDownloadPath(path); 64 | state = path; 65 | } 66 | 67 | Future clearDownloadPath() async { 68 | // Clear by setting empty string, storage will handle deletion 69 | await _storage.setDownloadPath(''); 70 | state = null; 71 | } 72 | } 73 | 74 | /// Download path provider 75 | final downloadPathProvider = 76 | StateNotifierProvider((ref) { 77 | return DownloadPathNotifier(StorageService()); 78 | }); 79 | 80 | /// Locale notifier for managing app language 81 | class LocaleNotifier extends StateNotifier { 82 | LocaleNotifier() : super(null) { 83 | _loadLocale(); 84 | } 85 | 86 | Future _loadLocale() async { 87 | final key = HiveService.settingsBox.get('locale'); 88 | if (key != null && key is String) { 89 | state = parseLocaleKey(key); 90 | } 91 | } 92 | 93 | Future setLocale(Locale? locale) async { 94 | state = locale; 95 | if (locale == null) { 96 | await HiveService.settingsBox.delete('locale'); 97 | } else { 98 | await HiveService.settingsBox.put('locale', getLocaleKey(locale)); 99 | } 100 | } 101 | 102 | /// Get display name for current locale 103 | String getDisplayName() { 104 | if (state == null) return 'System'; 105 | final key = getLocaleKey(state!); 106 | return localeDisplayNames[key] ?? key; 107 | } 108 | } 109 | 110 | /// Locale provider 111 | final localeProvider = StateNotifierProvider((ref) { 112 | return LocaleNotifier(); 113 | }); 114 | -------------------------------------------------------------------------------- /README_KO.md: -------------------------------------------------------------------------------- 1 | # 📚 Olib 2 | 3 |
4 | 5 | ![Flutter](https://img.shields.io/badge/Flutter-02569B?style=for-the-badge&logo=flutter&logoColor=white) 6 | ![Dart](https://img.shields.io/badge/Dart-0175C2?style=for-the-badge&logo=dart&logoColor=white) 7 | ![AI Built](https://img.shields.io/badge/AI%20구축-🤖-purple?style=for-the-badge) 8 | ![Open Source](https://img.shields.io/badge/오픈소스-❤️-green?style=for-the-badge) 9 | ![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge) 10 | 11 | **🤖 AI 지원으로 완전히 구축된 오픈 소스 전자책 리더** 12 | 13 | **서드파티 클라이언트 • 프론트엔드 인터페이스만 제공 • 외부 소스에서 데이터** 14 | 15 | [APK 다운로드](https://bookbook.space) • [버그 신고](../../issues) • [기능 요청](../../issues) 16 | 17 | **[English](README.md)** | **[简体中文](README_ZH.md)** | **[日本語](README_JA.md)** | **한국어** 18 | 19 |
20 | 21 | --- 22 | 23 | > ⚠️ **면책 조항**: Olib은 독립적인 오픈 소스 서드파티 클라이언트입니다. 공식 클라이언트가 **아니며** 어떤 공식 서비스와도 관련이 없습니다. 이 프로젝트는 프론트엔드 인터페이스만 제공하며 모든 책 데이터는 외부 소스에서 가져옵니다. 본인의 판단에 따라 사용하세요. 24 | 25 | ## ✨ 기능 26 | 27 | | 기능 | 설명 | 28 | |------|------| 29 | | 📖 **책 검색** | 제목, 저자, ISBN 또는 키워드로 책 검색 | 30 | | 💾 **오프라인 읽기** | 인터넷 없이 읽기 위해 책 다운로드 | 31 | | 🌙 **다크 모드** | 눈에 편안한 읽기 경험 | 32 | | 🌍 **다국어** | 영어, 中文, 日本語, 한국어 등 16개 이상의 언어 지원 | 33 | | 🔐 **멀티 계정** | 여러 계정을 원활하게 전환 | 34 | | 🔗 **멀티 도메인** | 여러 서버 라인 중 선택 | 35 | | 🆓 **완전 무료** | 광고 없음, 구독 없음, 숨겨진 비용 없음 | 36 | 37 | ## 🤖 AI 구축 프로젝트 38 | 39 | 이 프로젝트는 **완전히 AI 지원으로 구축**되었습니다: 40 | - AI에 의한 아키텍처 설계 41 | - AI에 의한 코드 구현 42 | - AI에 의한 UI/UX 디자인 43 | - AI에 의한 문서 작성 44 | 45 | ## 📱 스크린샷 46 | 47 |
48 | 곧 출시 예정... 49 |
50 | 51 | ## 🚀 빠른 시작 52 | 53 | ### 전제 조건 54 | 55 | - Flutter SDK 3.8+ 56 | - Android Studio / VS Code 57 | - Android 기기 또는 에뮬레이터 58 | 59 | ### 설치 60 | 61 | ```bash 62 | # 저장소 복제 63 | git clone https://github.com/shiyi-0x7f/olib-mobile.git 64 | 65 | # 프로젝트 디렉토리로 이동 66 | cd olib-mobile 67 | 68 | # 종속성 설치 69 | flutter pub get 70 | 71 | # 앱 실행 72 | flutter run 73 | ``` 74 | 75 | ### APK 빌드 76 | 77 | ```bash 78 | flutter build apk --release 79 | ``` 80 | 81 | ## 🏗️ 프로젝트 구조 82 | 83 | ``` 84 | lib/ 85 | ├── l10n/ # 로컬라이제이션 파일 (16개 이상 언어) 86 | ├── models/ # 데이터 모델 87 | ├── providers/ # 상태 관리 (Riverpod) 88 | ├── routes/ # 앱 네비게이션 89 | ├── screens/ # UI 화면 90 | ├── services/ # API & 스토리지 서비스 91 | ├── theme/ # 앱 테마 설정 92 | └── widgets/ # 재사용 가능한 컴포넌트 93 | ``` 94 | 95 | ## 🛠️ 기술 스택 96 | 97 | - **프레임워크**: Flutter 98 | - **상태 관리**: Riverpod 99 | - **로컬 스토리지**: Hive 100 | - **HTTP 클라이언트**: http 패키지 101 | - **다국어**: 16개 이상 언어 102 | 103 | ## 🤝 기여 104 | 105 | 기여를 환영합니다! 자유롭게 Pull Request를 제출해 주세요. 106 | 107 | 1. 프로젝트 포크 108 | 2. 기능 브랜치 생성 (`git checkout -b feature/AmazingFeature`) 109 | 3. 변경 사항 커밋 (`git commit -m 'Add some AmazingFeature'`) 110 | 4. 브랜치에 푸시 (`git push origin feature/AmazingFeature`) 111 | 5. Pull Request 열기 112 | 113 | ## 📄 라이선스 114 | 115 | 이 프로젝트는 MIT 라이선스 하에 라이선스가 부여됩니다 - 자세한 내용은 [LICENSE](LICENSE) 파일을 참조하세요. 116 | 117 | > ⚠️ **법적 고지**: 118 | > - 이것은 독립적인 서드파티 클라이언트이며 공식 애플리케이션이 **아닙니다** 119 | > - 모든 책 데이터는 외부 소스에서 가져오며 이 프로젝트는 프론트엔드만 제공합니다 120 | > - 사용자는 해당 법률을 준수해야 할 책임이 있습니다 121 | > - 이 소프트웨어를 사용함으로써 이러한 조건을 인정하게 됩니다 122 | 123 | ## 💖 감사의 말 124 | 125 | - 🤖 AI 지원으로 구축 126 | - 💙 Flutter 프레임워크 127 | - ❤️ 오픈 소스 커뮤니티 128 | 129 | --- 130 | 131 |
132 | 133 | **[⬆ 맨 위로](#-olib)** 134 | 135 | 🤖 AI 구축 • 오픈 소스 • 영원히 무료 136 | 137 |
138 | -------------------------------------------------------------------------------- /README_JA.md: -------------------------------------------------------------------------------- 1 | # 📚 Olib 2 | 3 |
4 | 5 | ![Flutter](https://img.shields.io/badge/Flutter-02569B?style=for-the-badge&logo=flutter&logoColor=white) 6 | ![Dart](https://img.shields.io/badge/Dart-0175C2?style=for-the-badge&logo=dart&logoColor=white) 7 | ![AI Built](https://img.shields.io/badge/AI%20構築-🤖-purple?style=for-the-badge) 8 | ![Open Source](https://img.shields.io/badge/オープンソース-❤️-green?style=for-the-badge) 9 | ![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge) 10 | 11 | **🤖 AIアシスタンスで完全に構築されたオープンソース電子書籍リーダー** 12 | 13 | **サードパーティクライアント • フロントエンドインターフェースのみ • 外部ソースからのデータ** 14 | 15 | [APKをダウンロード](https://bookbook.space) • [バグを報告](../../issues) • [機能をリクエスト](../../issues) 16 | 17 | **[English](README.md)** | **[简体中文](README_ZH.md)** | **日本語** | **[한국어](README_KO.md)** 18 | 19 |
20 | 21 | --- 22 | 23 | > ⚠️ **免責事項**: Olibは独立したオープンソースのサードパーティクライアントです。公式クライアントではなく、いかなる公式サービスとも関連していません。このプロジェクトはフロントエンドインターフェースのみを提供し、すべての書籍データは外部ソースから取得されます。ご自身の判断でお使いください。 24 | 25 | ## ✨ 機能 26 | 27 | | 機能 | 説明 | 28 | |------|------| 29 | | 📖 **書籍検索** | タイトル、著者、ISBN、キーワードで書籍を検索 | 30 | | 💾 **オフライン読書** | インターネットなしで読書するために書籍をダウンロード | 31 | | 🌙 **ダークモード** | 目に優しい読書体験 | 32 | | 🌍 **多言語対応** | 英語、中文、日本語、한국어など16以上の言語をサポート | 33 | | 🔐 **マルチアカウント** | 複数のアカウントをシームレスに切り替え | 34 | | 🔗 **マルチドメイン** | 複数のサーバーラインから選択 | 35 | | 🆓 **完全無料** | 広告なし、サブスクリプションなし、隠れたコストなし | 36 | 37 | ## 🤖 AI構築プロジェクト 38 | 39 | このプロジェクトは**完全にAIアシスタンスで構築**されました: 40 | - AIによるアーキテクチャ設計 41 | - AIによるコード実装 42 | - AIによるUI/UXデザイン 43 | - AIによるドキュメント作成 44 | 45 | ## 📱 スクリーンショット 46 | 47 |
48 | 近日公開予定... 49 |
50 | 51 | ## 🚀 クイックスタート 52 | 53 | ### 前提条件 54 | 55 | - Flutter SDK 3.8+ 56 | - Android Studio / VS Code 57 | - Androidデバイスまたはエミュレータ 58 | 59 | ### インストール 60 | 61 | ```bash 62 | # リポジトリをクローン 63 | git clone https://github.com/shiyi-0x7f/olib-mobile.git 64 | 65 | # プロジェクトディレクトリに移動 66 | cd olib-mobile 67 | 68 | # 依存関係をインストール 69 | flutter pub get 70 | 71 | # アプリを実行 72 | flutter run 73 | ``` 74 | 75 | ### APKをビルド 76 | 77 | ```bash 78 | flutter build apk --release 79 | ``` 80 | 81 | ## 🏗️ プロジェクト構成 82 | 83 | ``` 84 | lib/ 85 | ├── l10n/ # ローカライゼーションファイル (16以上の言語) 86 | ├── models/ # データモデル 87 | ├── providers/ # 状態管理 (Riverpod) 88 | ├── routes/ # アプリナビゲーション 89 | ├── screens/ # UI画面 90 | ├── services/ # API & ストレージサービス 91 | ├── theme/ # アプリテーマ設定 92 | └── widgets/ # 再利用可能なコンポーネント 93 | ``` 94 | 95 | ## 🛠️ 技術スタック 96 | 97 | - **フレームワーク**: Flutter 98 | - **状態管理**: Riverpod 99 | - **ローカルストレージ**: Hive 100 | - **HTTPクライアント**: http パッケージ 101 | - **多言語**: 16以上の言語 102 | 103 | ## 🤝 コントリビューション 104 | 105 | コントリビューションを歓迎します!お気軽にPull Requestを提出してください。 106 | 107 | 1. プロジェクトをフォーク 108 | 2. 機能ブランチを作成 (`git checkout -b feature/AmazingFeature`) 109 | 3. 変更をコミット (`git commit -m 'Add some AmazingFeature'`) 110 | 4. ブランチにプッシュ (`git push origin feature/AmazingFeature`) 111 | 5. Pull Requestを開く 112 | 113 | ## 📄 ライセンス 114 | 115 | このプロジェクトはMITライセンスの下でライセンスされています - 詳細は[LICENSE](LICENSE)ファイルをご覧ください。 116 | 117 | > ⚠️ **法的通知**: 118 | > - これは独立したサードパーティクライアントであり、公式アプリケーションではありません 119 | > - すべての書籍データは外部ソースから取得され、このプロジェクトはフロントエンドのみを提供します 120 | > - ユーザーは適用法への準拠を確認する責任があります 121 | > - このソフトウェアを使用することで、これらの条件を認めたことになります 122 | 123 | ## 💖 謝辞 124 | 125 | - 🤖 AIアシスタンスで構築 126 | - 💙 Flutterフレームワーク 127 | - ❤️ オープンソースコミュニティ 128 | 129 | --- 130 | 131 |
132 | 133 | **[⬆ トップに戻る](#-olib)** 134 | 135 | 🤖 AI構築 • オープンソース • 永久に無料 136 | 137 |
138 | -------------------------------------------------------------------------------- /lib/screens/settings/history_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import '../../providers/books_provider.dart'; 4 | import '../../widgets/gradient_app_bar.dart'; 5 | import '../../widgets/loading_widget.dart'; 6 | import '../../widgets/empty_state.dart'; 7 | import '../../routes/app_routes.dart'; 8 | import '../../l10n/app_localizations.dart'; 9 | 10 | class HistoryScreen extends ConsumerWidget { 11 | const HistoryScreen({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context, WidgetRef ref) { 15 | final l10n = AppLocalizations.of(context); 16 | // This provider gets "downloaded" books from account (Cloud history) 17 | final downloadedBooksAsync = ref.watch(downloadedBooksProvider); 18 | 19 | return Scaffold( 20 | appBar: GradientAppBar(title: l10n.get('download_history')), 21 | body: downloadedBooksAsync.when( 22 | data: (books) { 23 | if (books.isEmpty) { 24 | return EmptyState( 25 | icon: Icons.history, 26 | title: l10n.get('no_history'), 27 | message: l10n.get('history_empty_message'), 28 | ); 29 | } 30 | 31 | return ListView.builder( 32 | padding: const EdgeInsets.all(16), 33 | itemCount: books.length, 34 | itemBuilder: (context, index) { 35 | final book = books[index]; 36 | 37 | return Card( 38 | margin: const EdgeInsets.only(bottom: 12), 39 | child: ListTile( 40 | contentPadding: const EdgeInsets.all(12), 41 | leading: book.cover != null 42 | ? ClipRRect( 43 | borderRadius: BorderRadius.circular(8), 44 | child: Image.network( 45 | book.cover!, 46 | width: 50, 47 | height: 70, 48 | fit: BoxFit.cover, 49 | ), 50 | ) 51 | : const Icon(Icons.book, size: 50), 52 | title: Text( 53 | book.title, 54 | maxLines: 2, 55 | overflow: TextOverflow.ellipsis, 56 | ), 57 | subtitle: Column( 58 | crossAxisAlignment: CrossAxisAlignment.start, 59 | children: [ 60 | if (book.author != null) Text(book.author!), 61 | if (book.filesizeString != null) 62 | Text( 63 | '${book.extension?.toUpperCase()} • ${book.filesizeString}', 64 | style: Theme.of(context).textTheme.bodySmall, 65 | ), 66 | ], 67 | ), 68 | trailing: const Icon(Icons.chevron_right), 69 | onTap: () { 70 | Navigator.of(context).pushNamed( 71 | AppRoutes.bookDetail, 72 | arguments: book, 73 | ); 74 | }, 75 | ), 76 | ); 77 | }, 78 | ); 79 | }, 80 | loading: () => LoadingWidget(message: l10n.get('loading_downloads')), 81 | error: (error, stack) => EmptyState( 82 | icon: Icons.error_outline, 83 | title: l10n.get('error'), 84 | message: error.toString(), 85 | ), 86 | ), 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:flutter_localizations/flutter_localizations.dart'; 4 | import 'theme/app_theme.dart'; 5 | import 'providers/settings_provider.dart'; 6 | import 'routes/app_routes.dart'; 7 | import 'screens/splash/splash_screen.dart'; 8 | import 'screens/auth/login_screen.dart'; 9 | // import 'screens/auth/register_screen.dart'; // Registration disabled - API不支持 10 | import 'screens/home/home_screen.dart'; 11 | import 'screens/search/search_screen.dart'; 12 | import 'screens/book_detail/book_detail_screen.dart'; 13 | import 'screens/favorites/favorites_screen.dart'; 14 | import 'screens/settings/history_screen.dart'; 15 | import 'screens/downloads/local_downloads_screen.dart'; 16 | import 'screens/settings/settings_screen.dart'; 17 | import 'screens/similar/similar_books_screen.dart'; 18 | import 'screens/reader/reader_screen.dart'; 19 | import 'services/hive_service.dart'; 20 | import 'services/ad_service.dart'; 21 | import 'l10n/app_localizations.dart'; 22 | 23 | void main() async { 24 | WidgetsFlutterBinding.ensureInitialized(); 25 | await HiveService.init(); 26 | 27 | // Initialize Unity Ads (non-blocking) 28 | AdService.init(); 29 | 30 | runApp( 31 | const ProviderScope( 32 | child: MyApp(), 33 | ), 34 | ); 35 | } 36 | 37 | class MyApp extends ConsumerWidget { 38 | const MyApp({super.key}); 39 | 40 | @override 41 | Widget build(BuildContext context, WidgetRef ref) { 42 | final themeModeState = ref.watch(themeModeProvider); 43 | final locale = ref.watch(localeProvider); 44 | 45 | // Convert AppThemeMode to ThemeMode 46 | ThemeMode themeMode; 47 | switch (themeModeState) { 48 | case AppThemeMode.light: 49 | themeMode = ThemeMode.light; 50 | case AppThemeMode.dark: 51 | themeMode = ThemeMode.dark; 52 | case AppThemeMode.system: 53 | themeMode = ThemeMode.system; 54 | } 55 | 56 | return MaterialApp( 57 | title: 'Olib', 58 | debugShowCheckedModeBanner: false, 59 | theme: AppTheme.lightTheme, 60 | darkTheme: AppTheme.darkTheme, 61 | themeMode: themeMode, 62 | 63 | // Localization 64 | locale: locale, 65 | supportedLocales: supportedLocales, 66 | localizationsDelegates: const [ 67 | AppLocalizations.delegate, 68 | GlobalMaterialLocalizations.delegate, 69 | GlobalWidgetsLocalizations.delegate, 70 | GlobalCupertinoLocalizations.delegate, 71 | ], 72 | 73 | initialRoute: AppRoutes.splash, 74 | routes: { 75 | AppRoutes.splash: (context) => const SplashScreen(), 76 | AppRoutes.login: (context) => const LoginScreen(), 77 | // AppRoutes.register: (context) => const RegisterScreen(), // Disabled 78 | AppRoutes.home: (context) => const HomeScreen(), 79 | AppRoutes.search: (context) => const SearchScreen(), 80 | AppRoutes.bookDetail: (context) => const BookDetailScreen(), 81 | AppRoutes.favorites: (context) => const FavoritesScreen(), 82 | AppRoutes.history: (context) => const HistoryScreen(), 83 | AppRoutes.downloads: (context) => const LocalDownloadsScreen(), 84 | AppRoutes.settings: (context) => const SettingsScreen(), 85 | AppRoutes.similarBooks: (context) => const SimilarBooksScreen(), 86 | AppRoutes.reader: (context) { 87 | final args = ModalRoute.of(context)!.settings.arguments as ReaderArgs; 88 | return ReaderScreen(url: args.url, title: args.title); 89 | }, 90 | }, 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "Open Source Community" "\0" 93 | VALUE "FileDescription", "Olib" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "olib" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2025 Open Source Community. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "olib.exe" "\0" 98 | VALUE "ProductName", "Olib" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /lib/widgets/book_list_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/book.dart'; 3 | import '../theme/app_colors.dart'; 4 | 5 | /// Simplified list tile for books - compact view without cover images 6 | class BookListTile extends StatelessWidget { 7 | final Book book; 8 | final VoidCallback? onTap; 9 | 10 | const BookListTile({ 11 | super.key, 12 | required this.book, 13 | this.onTap, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Card( 19 | margin: const EdgeInsets.only(bottom: 8), 20 | child: ListTile( 21 | contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), 22 | leading: Container( 23 | width: 40, 24 | height: 40, 25 | decoration: BoxDecoration( 26 | color: AppColors.primary.withOpacity(0.1), 27 | borderRadius: BorderRadius.circular(8), 28 | ), 29 | child: const Icon( 30 | Icons.menu_book_rounded, 31 | color: AppColors.primary, 32 | size: 22, 33 | ), 34 | ), 35 | title: Text( 36 | book.title, 37 | maxLines: 1, 38 | overflow: TextOverflow.ellipsis, 39 | style: Theme.of(context).textTheme.titleSmall?.copyWith( 40 | fontWeight: FontWeight.w600, 41 | ), 42 | ), 43 | subtitle: Column( 44 | crossAxisAlignment: CrossAxisAlignment.start, 45 | children: [ 46 | if (book.author != null && book.author!.isNotEmpty) 47 | Text( 48 | book.author!, 49 | maxLines: 1, 50 | overflow: TextOverflow.ellipsis, 51 | style: Theme.of(context).textTheme.bodySmall, 52 | ), 53 | const SizedBox(height: 4), 54 | Row( 55 | children: [ 56 | // Extension badge 57 | if (book.extension != null && book.extension!.isNotEmpty) 58 | Container( 59 | padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), 60 | decoration: BoxDecoration( 61 | color: AppColors.accent.withOpacity(0.15), 62 | borderRadius: BorderRadius.circular(4), 63 | ), 64 | child: Text( 65 | book.extension!.toUpperCase(), 66 | style: const TextStyle( 67 | color: AppColors.accent, 68 | fontSize: 10, 69 | fontWeight: FontWeight.bold, 70 | ), 71 | ), 72 | ), 73 | if (book.extension != null && book.filesizeString != null) 74 | const SizedBox(width: 8), 75 | // File size 76 | if (book.filesizeString != null) 77 | Text( 78 | book.filesizeString!, 79 | style: TextStyle( 80 | color: AppColors.textSecondary, 81 | fontSize: 11, 82 | ), 83 | ), 84 | const Spacer(), 85 | // Year 86 | if (book.year != null && book.year != 0) 87 | Text( 88 | '${book.year}', 89 | style: TextStyle( 90 | color: AppColors.textSecondary, 91 | fontSize: 11, 92 | ), 93 | ), 94 | ], 95 | ), 96 | ], 97 | ), 98 | trailing: const Icon(Icons.chevron_right, color: AppColors.textSecondary), 99 | onTap: onTap, 100 | ), 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/screens/reader/reader_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_inappwebview/flutter_inappwebview.dart'; 3 | import '../../theme/app_colors.dart'; 4 | 5 | class ReaderScreen extends StatefulWidget { 6 | final String url; 7 | final String title; 8 | 9 | const ReaderScreen({ 10 | super.key, 11 | required this.url, 12 | required this.title, 13 | }); 14 | 15 | @override 16 | State createState() => _ReaderScreenState(); 17 | } 18 | 19 | class _ReaderScreenState extends State { 20 | InAppWebViewController? _webViewController; 21 | double _progress = 0; 22 | bool _isLoading = true; 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | appBar: AppBar( 28 | title: Text( 29 | widget.title, 30 | maxLines: 1, 31 | overflow: TextOverflow.ellipsis, 32 | ), 33 | backgroundColor: AppColors.primary, 34 | foregroundColor: Colors.white, 35 | actions: [ 36 | IconButton( 37 | icon: const Icon(Icons.refresh), 38 | onPressed: () => _webViewController?.reload(), 39 | ), 40 | ], 41 | ), 42 | body: Stack( 43 | children: [ 44 | InAppWebView( 45 | initialUrlRequest: URLRequest(url: WebUri(widget.url)), 46 | initialSettings: InAppWebViewSettings( 47 | javaScriptEnabled: true, 48 | domStorageEnabled: true, 49 | databaseEnabled: true, 50 | useWideViewPort: true, 51 | loadWithOverviewMode: true, 52 | supportZoom: true, 53 | builtInZoomControls: true, 54 | displayZoomControls: false, 55 | mediaPlaybackRequiresUserGesture: false, 56 | allowsInlineMediaPlayback: true, 57 | useShouldOverrideUrlLoading: true, 58 | userAgent: 'Mozilla/5.0 (Linux; Android 10; Mobile) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36', 59 | ), 60 | onWebViewCreated: (controller) { 61 | _webViewController = controller; 62 | }, 63 | onLoadStart: (controller, url) { 64 | setState(() { 65 | _isLoading = true; 66 | }); 67 | }, 68 | onLoadStop: (controller, url) async { 69 | setState(() { 70 | _isLoading = false; 71 | }); 72 | }, 73 | onProgressChanged: (controller, progress) { 74 | setState(() { 75 | _progress = progress / 100; 76 | }); 77 | }, 78 | shouldOverrideUrlLoading: (controller, navigationAction) async { 79 | // Allow all navigation 80 | return NavigationActionPolicy.ALLOW; 81 | }, 82 | onReceivedError: (controller, request, error) { 83 | debugPrint('WebView error: ${error.description}'); 84 | }, 85 | ), 86 | 87 | // Progress indicator 88 | if (_isLoading) 89 | Positioned( 90 | top: 0, 91 | left: 0, 92 | right: 0, 93 | child: LinearProgressIndicator( 94 | value: _progress, 95 | backgroundColor: Colors.grey[200], 96 | valueColor: const AlwaysStoppedAnimation(AppColors.primary), 97 | ), 98 | ), 99 | ], 100 | ), 101 | ); 102 | } 103 | } 104 | 105 | /// Arguments for ReaderScreen 106 | class ReaderArgs { 107 | final String url; 108 | final String title; 109 | 110 | const ReaderArgs({ 111 | required this.url, 112 | required this.title, 113 | }); 114 | } 115 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 38 | 39 | 40 | 41 | 44 | 50 | 51 | 52 | 53 | 54 | 66 | 68 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 📚 Olib 2 | 3 |
4 | 5 | ![Flutter](https://img.shields.io/badge/Flutter-02569B?style=for-the-badge&logo=flutter&logoColor=white) 6 | ![Dart](https://img.shields.io/badge/Dart-0175C2?style=for-the-badge&logo=dart&logoColor=white) 7 | ![AI Built](https://img.shields.io/badge/AI%20Built-🤖-purple?style=for-the-badge) 8 | ![Open Source](https://img.shields.io/badge/Open%20Source-❤️-green?style=for-the-badge) 9 | ![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge) 10 | 11 | **🤖 An open-source ebook reader built entirely with AI assistance** 12 | 13 | **Third-party client • Frontend interface only • All data from external sources** 14 | 15 | [Download](https://bookbook.space) • [Report Bug](../../issues) • [Request Feature](../../issues) 16 | 17 | **English** | **[简体中文](README_ZH.md)** | **[日本語](README_JA.md)** | **[한국어](README_KO.md)** 18 | 19 |
20 | 21 | --- 22 | 23 | > ⚠️ **Disclaimer**: Olib is an independent, open-source third-party client. It is NOT an official client and is not affiliated with any official service. This project only provides the frontend interface - all book data comes from external sources. Use at your own discretion. 24 | 25 | ## ✨ Features 26 | 27 | | Feature | Description | 28 | |---------|-------------| 29 | | 📖 **Book Search** | Search books by title, author, ISBN, or keywords | 30 | | 💾 **Offline Reading** | Download books for reading without internet | 31 | | 🌙 **Dark Mode** | Eye-friendly reading experience | 32 | | 🌍 **Multi-language** | Supports 16+ languages including English, 中文, 日本語, 한국어 | 33 | | 🔐 **Multi-Account** | Switch between multiple accounts seamlessly | 34 | | 🔗 **Multi-Domain** | Choose from multiple server lines | 35 | | 🆓 **100% Free** | No ads, no subscriptions, no hidden costs | 36 | 37 | ## 🤖 AI-Built Project 38 | 39 | This project was built **entirely with AI assistance**: 40 | - Architecture design by AI 41 | - Code implementation by AI 42 | - UI/UX design by AI 43 | - Documentation by AI 44 | 45 | ## 📱 Screenshots 46 | 47 |
48 | Coming soon... 49 |
50 | 51 | ## 🚀 Quick Start 52 | 53 | ### Prerequisites 54 | 55 | - Flutter SDK 3.8+ 56 | - Android Studio / VS Code 57 | - Android device or emulator 58 | 59 | ### Installation 60 | 61 | ```bash 62 | # Clone the repository 63 | git clone https://github.com/shiyi-0x7f/olib-mobile.git 64 | 65 | # Navigate to project directory 66 | cd olib-mobile 67 | 68 | # Install dependencies 69 | flutter pub get 70 | 71 | # Run the app 72 | flutter run 73 | ``` 74 | 75 | ### Build APK 76 | 77 | ```bash 78 | flutter build apk --release 79 | ``` 80 | 81 | ## 🏗️ Project Structure 82 | 83 | ``` 84 | lib/ 85 | ├── l10n/ # Localization files (16+ languages) 86 | ├── models/ # Data models 87 | ├── providers/ # State management (Riverpod) 88 | ├── routes/ # App navigation 89 | ├── screens/ # UI screens 90 | ├── services/ # API & storage services 91 | ├── theme/ # App theme configuration 92 | └── widgets/ # Reusable components 93 | ``` 94 | 95 | ## 🛠️ Tech Stack 96 | 97 | - **Framework**: Flutter 98 | - **State Management**: Riverpod 99 | - **Local Storage**: Hive 100 | - **HTTP Client**: http package 101 | - **Localization**: 16+ languages 102 | 103 | ## 🤝 Contributing 104 | 105 | Contributions are welcome! Please feel free to submit a Pull Request. 106 | 107 | 1. Fork the Project 108 | 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 109 | 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 110 | 4. Push to the Branch (`git push origin feature/AmazingFeature`) 111 | 5. Open a Pull Request 112 | 113 | ## 📄 License 114 | 115 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 116 | 117 | > ⚠️ **Legal Notice**: 118 | > - This is an independent third-party client, NOT an official application 119 | > - All book data comes from external sources; this project provides frontend only 120 | > - Users are responsible for ensuring compliance with applicable laws 121 | > - By using this software, you acknowledge these terms 122 | 123 | ## 💖 Acknowledgments 124 | 125 | - 🤖 Built with AI assistance 126 | - 💙 Flutter framework 127 | - ❤️ Open source community 128 | 129 | --- 130 | 131 |
132 | 133 | **[⬆ Back to Top](#-olib)** 134 | 135 | Built with 🤖 AI • Open Source • Free Forever 136 | 137 |
138 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(olib LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "olib") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /lib/screens/favorites/favorites_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:flutter_slidable/flutter_slidable.dart'; 4 | import '../../providers/books_provider.dart'; 5 | import '../../widgets/gradient_app_bar.dart'; 6 | import '../../widgets/loading_widget.dart'; 7 | import '../../widgets/empty_state.dart'; 8 | import '../../routes/app_routes.dart'; 9 | import '../../theme/app_colors.dart'; 10 | import '../../l10n/app_localizations.dart'; 11 | 12 | class FavoritesScreen extends ConsumerWidget { 13 | const FavoritesScreen({super.key}); 14 | 15 | @override 16 | Widget build(BuildContext context, WidgetRef ref) { 17 | final savedBooksAsync = ref.watch(savedBooksProvider); 18 | 19 | return Scaffold( 20 | appBar: GradientAppBar(title: AppLocalizations.of(context).get('favorites')), 21 | body: savedBooksAsync.when( 22 | data: (books) { 23 | if (books.isEmpty) { 24 | return EmptyState( 25 | icon: Icons.favorite_outline, 26 | title: AppLocalizations.of(context).get('no_favorites'), 27 | message: AppLocalizations.of(context).get('save_books_hint'), 28 | ); 29 | } 30 | 31 | return ListView.builder( 32 | padding: const EdgeInsets.all(16), 33 | itemCount: books.length, 34 | itemBuilder: (context, index) { 35 | final book = books[index]; 36 | 37 | return Slidable( 38 | key: ValueKey(book.id), 39 | endActionPane: ActionPane( 40 | motion: const ScrollMotion(), 41 | children: [ 42 | SlidableAction( 43 | onPressed: (context) async { 44 | await ref 45 | .read(savedBooksProvider.notifier) 46 | .unsaveBook(book.id.toString()); 47 | }, 48 | backgroundColor: AppColors.error, 49 | foregroundColor: Colors.white, 50 | icon: Icons.delete, 51 | label: AppLocalizations.of(context).get('remove'), 52 | ), 53 | ], 54 | ), 55 | child: Card( 56 | margin: const EdgeInsets.only(bottom: 12), 57 | child: ListTile( 58 | contentPadding: const EdgeInsets.all(12), 59 | leading: book.cover != null 60 | ? ClipRRect( 61 | borderRadius: BorderRadius.circular(8), 62 | child: Image.network( 63 | book.cover!, 64 | width: 50, 65 | height: 70, 66 | fit: BoxFit.cover, 67 | ), 68 | ) 69 | : Container( 70 | width: 50, 71 | height: 70, 72 | decoration: BoxDecoration( 73 | color: AppColors.textSecondary.withOpacity(0.1), 74 | borderRadius: BorderRadius.circular(8), 75 | ), 76 | child: const Icon(Icons.book), 77 | ), 78 | title: Text( 79 | book.title, 80 | maxLines: 2, 81 | overflow: TextOverflow.ellipsis, 82 | ), 83 | subtitle: book.author != null 84 | ? Text(book.author!) 85 | : null, 86 | trailing: const Icon(Icons.chevron_right), 87 | onTap: () { 88 | Navigator.of(context).pushNamed( 89 | AppRoutes.bookDetail, 90 | arguments: book, 91 | ); 92 | }, 93 | ), 94 | ), 95 | ); 96 | }, 97 | ); 98 | }, 99 | loading: () => LoadingWidget(message: AppLocalizations.of(context).get('loading_favorites')), 100 | error: (error, stack) => EmptyState( 101 | icon: Icons.error_outline, 102 | title: AppLocalizations.of(context).get('error'), 103 | message: error.toString(), 104 | ), 105 | ), 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /lib/services/update_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:http/http.dart' as http; 4 | import 'package:package_info_plus/package_info_plus.dart'; 5 | import 'hive_service.dart'; 6 | 7 | /// Update checker service for checking new app versions 8 | class UpdateService { 9 | static const String _versionUrl = 'https://bookbook.space/version.json'; 10 | static const String _lastCheckKey = 'last_update_check'; 11 | static const String _dismissedVersionKey = 'dismissed_version'; 12 | 13 | /// Check interval: once per day 14 | static const Duration _checkInterval = Duration(hours: 24); 15 | 16 | /// Remote version info 17 | static String? latestVersion; 18 | static String? downloadUrl; 19 | static Map? changelog; 20 | static bool forceUpdate = false; 21 | static bool hasUpdate = false; 22 | 23 | /// Flag to indicate app is blocked due to force update 24 | /// When true, search and download features should be disabled 25 | static bool isBlocked = false; 26 | 27 | /// Check for updates (non-blocking, silent on errors) 28 | static Future checkForUpdate({bool force = false}) async { 29 | try { 30 | // Check if we should skip (already checked recently) 31 | if (!force && !_shouldCheck()) { 32 | debugPrint('UpdateService: Skipping check (checked recently)'); 33 | return false; 34 | } 35 | 36 | // Fetch remote version 37 | final response = await http.get( 38 | Uri.parse(_versionUrl), 39 | ).timeout(const Duration(seconds: 10)); 40 | 41 | if (response.statusCode != 200) { 42 | debugPrint('UpdateService: Failed to fetch version (${response.statusCode})'); 43 | return false; 44 | } 45 | 46 | final data = json.decode(response.body) as Map; 47 | latestVersion = data['version'] as String?; 48 | downloadUrl = data['url'] as String?; 49 | forceUpdate = data['force_update'] as bool? ?? false; 50 | 51 | // Parse changelog 52 | if (data['changelog'] != null) { 53 | final changelogData = data['changelog'] as Map; 54 | changelog = changelogData.map((k, v) => MapEntry(k, v.toString())); 55 | } 56 | 57 | // Get current version 58 | final packageInfo = await PackageInfo.fromPlatform(); 59 | final currentVersion = packageInfo.version; 60 | 61 | // Compare versions 62 | hasUpdate = _isNewerVersion(latestVersion!, currentVersion); 63 | 64 | // Save check time 65 | await HiveService.settingsBox.put( 66 | _lastCheckKey, 67 | DateTime.now().millisecondsSinceEpoch, 68 | ); 69 | 70 | debugPrint('UpdateService: Current=$currentVersion, Latest=$latestVersion, HasUpdate=$hasUpdate'); 71 | 72 | return hasUpdate; 73 | } catch (e) { 74 | debugPrint('UpdateService: Error checking for update: $e'); 75 | return false; 76 | } 77 | } 78 | 79 | /// Check if we should perform update check 80 | static bool _shouldCheck() { 81 | final lastCheck = HiveService.settingsBox.get(_lastCheckKey); 82 | if (lastCheck == null) return true; 83 | 84 | final lastCheckTime = DateTime.fromMillisecondsSinceEpoch(lastCheck as int); 85 | return DateTime.now().difference(lastCheckTime) > _checkInterval; 86 | } 87 | 88 | /// Compare version strings (e.g., "1.0.1" > "1.0.0") 89 | static bool _isNewerVersion(String remote, String current) { 90 | final remoteParts = remote.split('.').map(int.parse).toList(); 91 | final currentParts = current.split('.').map(int.parse).toList(); 92 | 93 | for (int i = 0; i < remoteParts.length && i < currentParts.length; i++) { 94 | if (remoteParts[i] > currentParts[i]) return true; 95 | if (remoteParts[i] < currentParts[i]) return false; 96 | } 97 | 98 | return remoteParts.length > currentParts.length; 99 | } 100 | 101 | /// Check if user has dismissed this version 102 | static bool isVersionDismissed() { 103 | final dismissed = HiveService.settingsBox.get(_dismissedVersionKey); 104 | return dismissed == latestVersion; 105 | } 106 | 107 | /// Dismiss the current update notification 108 | static Future dismissUpdate() async { 109 | if (latestVersion != null) { 110 | await HiveService.settingsBox.put(_dismissedVersionKey, latestVersion); 111 | } 112 | } 113 | 114 | /// Get changelog text for current locale 115 | static String getChangelog(String locale) { 116 | if (changelog == null) return ''; 117 | return changelog![locale] ?? changelog!['en'] ?? ''; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /lib/services/storage_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | import 'dart:convert'; 3 | 4 | class StorageService { 5 | static const String _keyFavorites = 'favorite_books'; 6 | static const String _keyDownloads = 'downloaded_books'; 7 | static const String _keyThemeMode = 'theme_mode'; 8 | static const String _keyDownloadPath = 'download_path'; 9 | static const String _keyDownloadHistory = 'download_history'; 10 | 11 | /// Save favorite book IDs 12 | Future saveFavorites(List bookIds) async { 13 | final prefs = await SharedPreferences.getInstance(); 14 | await prefs.setStringList( 15 | _keyFavorites, 16 | bookIds, 17 | ); 18 | } 19 | 20 | /// Get favorite book IDs 21 | Future> getFavorites() async { 22 | final prefs = await SharedPreferences.getInstance(); 23 | return prefs.getStringList(_keyFavorites) ?? []; 24 | } 25 | 26 | /// Add book to favorites 27 | Future addFavorite(String bookId) async { 28 | final favorites = await getFavorites(); 29 | if (!favorites.contains(bookId)) { 30 | favorites.add(bookId); 31 | await saveFavorites(favorites); 32 | } 33 | } 34 | 35 | /// Remove book from favorites 36 | Future removeFavorite(String bookId) async { 37 | final favorites = await getFavorites(); 38 | favorites.remove(bookId); 39 | await saveFavorites(favorites); 40 | } 41 | 42 | /// Check if book is favorited 43 | Future isFavorite(String bookId) async { 44 | final favorites = await getFavorites(); 45 | return favorites.contains(bookId); 46 | } 47 | 48 | /// Save downloaded book info 49 | Future saveDownloadedBook(Map bookInfo) async { 50 | final prefs = await SharedPreferences.getInstance(); 51 | final downloads = prefs.getStringList(_keyDownloads) ?? []; 52 | // Store as JSON string 53 | downloads.add(bookInfo.toString()); 54 | await prefs.setStringList(_keyDownloads, downloads); 55 | } 56 | 57 | /// Get theme mode (0: system, 1: light, 2: dark) 58 | Future getThemeMode() async { 59 | final prefs = await SharedPreferences.getInstance(); 60 | return prefs.getInt(_keyThemeMode) ?? 0; 61 | } 62 | 63 | /// Set theme mode 64 | Future setThemeMode(int mode) async { 65 | final prefs = await SharedPreferences.getInstance(); 66 | await prefs.setInt(_keyThemeMode, mode); 67 | } 68 | 69 | /// Get download path 70 | Future getDownloadPath() async { 71 | final prefs = await SharedPreferences.getInstance(); 72 | return prefs.getString(_keyDownloadPath); 73 | } 74 | 75 | /// Set download path 76 | Future setDownloadPath(String path) async { 77 | final prefs = await SharedPreferences.getInstance(); 78 | await prefs.setString(_keyDownloadPath, path); 79 | } 80 | 81 | // ===== Download History Methods ===== 82 | 83 | /// Add book to download history 84 | /// Stores: {bookId: {title, author, filePath, cover, extension, downloadTime}} 85 | Future addToDownloadHistory( 86 | String bookId, 87 | String title, 88 | String? author, 89 | String filePath, 90 | {String? cover, String? extension} 91 | ) async { 92 | final prefs = await SharedPreferences.getInstance(); 93 | final historyJson = prefs.getString(_keyDownloadHistory) ?? '{}'; 94 | final history = Map.from(jsonDecode(historyJson)); 95 | 96 | history[bookId] = { 97 | 'title': title, 98 | 'author': author, 99 | 'filePath': filePath, 100 | 'cover': cover, 101 | 'extension': extension, 102 | 'downloadTime': DateTime.now().toIso8601String(), 103 | }; 104 | 105 | await prefs.setString(_keyDownloadHistory, jsonEncode(history)); 106 | } 107 | 108 | /// Get all download history 109 | Future> getDownloadHistory() async { 110 | final prefs = await SharedPreferences.getInstance(); 111 | final historyJson = prefs.getString(_keyDownloadHistory) ?? '{}'; 112 | return Map.from(jsonDecode(historyJson)); 113 | } 114 | 115 | /// Check if book was previously downloaded 116 | Future isBookDownloaded(String bookId) async { 117 | final history = await getDownloadHistory(); 118 | return history.containsKey(bookId); 119 | } 120 | 121 | /// Get downloaded file path for a book 122 | Future getDownloadedFilePath(String bookId) async { 123 | final history = await getDownloadHistory(); 124 | if (history.containsKey(bookId)) { 125 | return history[bookId]['filePath'] as String?; 126 | } 127 | return null; 128 | } 129 | 130 | /// Remove book from download history 131 | Future removeFromDownloadHistory(String bookId) async { 132 | final prefs = await SharedPreferences.getInstance(); 133 | final historyJson = prefs.getString(_keyDownloadHistory) ?? '{}'; 134 | final history = Map.from(jsonDecode(historyJson)); 135 | 136 | history.remove(bookId); 137 | 138 | await prefs.setString(_keyDownloadHistory, jsonEncode(history)); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.13) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "olib") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.open_library.app") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | # Application build; see runner/CMakeLists.txt. 58 | add_subdirectory("runner") 59 | 60 | # Run the Flutter tool portions of the build. This must not be removed. 61 | add_dependencies(${BINARY_NAME} flutter_assemble) 62 | 63 | # Only the install-generated bundle's copy of the executable will launch 64 | # correctly, since the resources must in the right relative locations. To avoid 65 | # people trying to run the unbundled copy, put it in a subdirectory instead of 66 | # the default top-level location. 67 | set_target_properties(${BINARY_NAME} 68 | PROPERTIES 69 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 70 | ) 71 | 72 | 73 | # Generated plugin build rules, which manage building the plugins and adding 74 | # them to the application. 75 | include(flutter/generated_plugins.cmake) 76 | 77 | 78 | # === Installation === 79 | # By default, "installing" just makes a relocatable bundle in the build 80 | # directory. 81 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 82 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 83 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 84 | endif() 85 | 86 | # Start with a clean build bundle directory every time. 87 | install(CODE " 88 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 89 | " COMPONENT Runtime) 90 | 91 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 92 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 93 | 94 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 95 | COMPONENT Runtime) 96 | 97 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 98 | COMPONENT Runtime) 99 | 100 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 101 | COMPONENT Runtime) 102 | 103 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 104 | install(FILES "${bundled_library}" 105 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 106 | COMPONENT Runtime) 107 | endforeach(bundled_library) 108 | 109 | # Copy the native assets provided by the build.dart from all packages. 110 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 111 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 112 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 113 | COMPONENT Runtime) 114 | 115 | # Fully re-copy the assets directory on each build to avoid having stale files 116 | # from a previous install. 117 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 118 | install(CODE " 119 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 120 | " COMPONENT Runtime) 121 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 122 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 123 | 124 | # Install the AOT library on non-Debug builds only. 125 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 126 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 127 | COMPONENT Runtime) 128 | endif() 129 | -------------------------------------------------------------------------------- /linux/runner/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "Olib"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "Olib"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GApplication::startup. 85 | static void my_application_startup(GApplication* application) { 86 | //MyApplication* self = MY_APPLICATION(object); 87 | 88 | // Perform any actions required at application startup. 89 | 90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application); 91 | } 92 | 93 | // Implements GApplication::shutdown. 94 | static void my_application_shutdown(GApplication* application) { 95 | //MyApplication* self = MY_APPLICATION(object); 96 | 97 | // Perform any actions required at application shutdown. 98 | 99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); 100 | } 101 | 102 | // Implements GObject::dispose. 103 | static void my_application_dispose(GObject* object) { 104 | MyApplication* self = MY_APPLICATION(object); 105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 107 | } 108 | 109 | static void my_application_class_init(MyApplicationClass* klass) { 110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup; 113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; 114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 115 | } 116 | 117 | static void my_application_init(MyApplication* self) {} 118 | 119 | MyApplication* my_application_new() { 120 | // Set the program name to the application ID, which helps various systems 121 | // like GTK and desktop environments map this running application to its 122 | // corresponding .desktop file. This ensures better integration by allowing 123 | // the application to be recognized beyond its binary name. 124 | g_set_prgname(APPLICATION_ID); 125 | 126 | return MY_APPLICATION(g_object_new(my_application_get_type(), 127 | "application-id", APPLICATION_ID, 128 | "flags", G_APPLICATION_NON_UNIQUE, 129 | nullptr)); 130 | } 131 | -------------------------------------------------------------------------------- /lib/screens/splash/splash_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'dart:io'; 4 | import '../../providers/auth_provider.dart'; 5 | import '../../providers/domain_provider.dart'; 6 | import '../../routes/app_routes.dart'; 7 | import '../../theme/app_colors.dart'; 8 | 9 | class SplashScreen extends ConsumerStatefulWidget { 10 | const SplashScreen({super.key}); 11 | 12 | @override 13 | ConsumerState createState() => _SplashScreenState(); 14 | } 15 | 16 | class _SplashScreenState extends ConsumerState { 17 | String _statusText = ''; 18 | bool _networkOk = false; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | _initialize(); 24 | } 25 | 26 | Future _initialize() async { 27 | // Step 1: Check network 28 | setState(() => _statusText = 'Checking network...'); 29 | _networkOk = await _checkNetwork(); 30 | 31 | if (!_networkOk) { 32 | setState(() => _statusText = 'Network unavailable, retrying...'); 33 | await Future.delayed(const Duration(seconds: 2)); 34 | _networkOk = await _checkNetwork(); 35 | } 36 | 37 | // Step 2: Wait for auth state 38 | setState(() => _statusText = 'Loading...'); 39 | await _waitForAuth(); 40 | } 41 | 42 | Future _checkNetwork() async { 43 | try { 44 | final domain = ref.read(domainProvider); 45 | // Use API endpoint for testing (same as domain selector) 46 | final uri = Uri.parse('https://$domain/eapi/info/languages'); 47 | 48 | final client = HttpClient(); 49 | client.connectionTimeout = const Duration(seconds: 5); 50 | 51 | try { 52 | final request = await client.getUrl(uri); 53 | final response = await request.close().timeout( 54 | const Duration(seconds: 8), 55 | ); 56 | 57 | // Read response body to check for success 58 | final bodyBytes = await response.expand((chunk) => chunk).toList(); 59 | final body = String.fromCharCodes(bodyBytes); 60 | 61 | // Check if API returns success 62 | final isSuccess = body.contains('"success":1') || 63 | body.contains('"success": 1') || 64 | (response.statusCode >= 200 && response.statusCode < 300); 65 | return isSuccess; 66 | } finally { 67 | client.close(); 68 | } 69 | } catch (e) { 70 | debugPrint('Network check failed: $e'); 71 | return false; 72 | } 73 | } 74 | 75 | Future _waitForAuth() async { 76 | // Wait for auth state to finish loading (max 10 seconds) 77 | int attempts = 0; 78 | while (mounted && attempts < 20) { 79 | final authState = ref.read(authProvider); 80 | if (!authState.isLoading) { 81 | // Auth finished loading 82 | if (authState.isAuthenticated) { 83 | Navigator.of(context).pushReplacementNamed(AppRoutes.home); 84 | } else { 85 | Navigator.of(context).pushReplacementNamed(AppRoutes.login); 86 | } 87 | return; 88 | } 89 | await Future.delayed(const Duration(milliseconds: 500)); 90 | attempts++; 91 | } 92 | 93 | // Timeout - go to login 94 | if (mounted) { 95 | Navigator.of(context).pushReplacementNamed(AppRoutes.login); 96 | } 97 | } 98 | 99 | @override 100 | Widget build(BuildContext context) { 101 | return Scaffold( 102 | body: Container( 103 | decoration: const BoxDecoration( 104 | color: AppColors.primary, 105 | ), 106 | child: Center( 107 | child: Column( 108 | mainAxisAlignment: MainAxisAlignment.center, 109 | children: [ 110 | const Icon( 111 | Icons.book, 112 | size: 80, 113 | color: Colors.white, 114 | ), 115 | const SizedBox(height: 24), 116 | Text( 117 | 'Olib', 118 | style: Theme.of(context).textTheme.displayLarge?.copyWith( 119 | color: Colors.white, 120 | ), 121 | ), 122 | const SizedBox(height: 16), 123 | const CircularProgressIndicator( 124 | valueColor: AlwaysStoppedAnimation(Colors.white), 125 | ), 126 | const SizedBox(height: 16), 127 | // Status indicator 128 | Row( 129 | mainAxisAlignment: MainAxisAlignment.center, 130 | children: [ 131 | Container( 132 | width: 8, 133 | height: 8, 134 | decoration: BoxDecoration( 135 | color: _networkOk ? Colors.greenAccent : Colors.white54, 136 | shape: BoxShape.circle, 137 | ), 138 | ), 139 | const SizedBox(width: 8), 140 | Text( 141 | _statusText, 142 | style: TextStyle( 143 | color: Colors.white.withOpacity(0.8), 144 | fontSize: 12, 145 | ), 146 | ), 147 | ], 148 | ), 149 | ], 150 | ), 151 | ), 152 | ), 153 | ); 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: olib_mobile 2 | description: "Olib: An open-source ebook reader built with AI assistance. Third-party client." 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.3+3 20 | 21 | environment: 22 | sdk: ^3.8.1 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | flutter_localizations: 34 | sdk: flutter 35 | 36 | # UI & Icons 37 | cupertino_icons: ^1.0.8 38 | google_fonts: ^6.2.1 39 | cached_network_image: ^3.3.1 40 | flutter_slidable: ^3.1.0 41 | dropdown_button2: ^2.3.9 42 | awesome_dialog: ^3.3.0 43 | 44 | # State Management 45 | flutter_riverpod: ^2.5.1 46 | riverpod_annotation: ^2.3.5 47 | 48 | # HTTP & Network 49 | dio: ^5.4.3+1 50 | dio_cookie_manager: ^3.1.1 51 | cookie_jar: ^4.0.8 52 | http: ^1.2.0 53 | 54 | # Storage 55 | shared_preferences: ^2.2.3 56 | hive: ^2.2.3 57 | hive_flutter: ^1.1.0 58 | path_provider: ^2.1.4 59 | permission_handler: ^11.3.0 60 | open_filex: ^4.4.0 61 | share_plus: ^7.2.2 62 | url_launcher: ^6.2.5 63 | unity_ads_plugin: ^0.3.12 64 | package_info_plus: ^8.0.0 65 | file_picker: ^8.0.0 66 | flutter_inappwebview: ^6.1.5 67 | flutter_inappwebview_windows: ^0.6.0 68 | downloadsfolder: ^1.2.0 # MediaStore API for Android 10+ Downloads folder 69 | 70 | # Data Models 71 | freezed_annotation: ^2.4.1 72 | json_annotation: ^4.8.1 73 | 74 | dev_dependencies: 75 | flutter_test: 76 | sdk: flutter 77 | 78 | # Lints 79 | flutter_lints: ^5.0.0 80 | 81 | # Code Generation 82 | build_runner: ^2.4.9 83 | riverpod_generator: ^2.4.0 84 | hive_generator: ^2.0.1 85 | freezed: ^2.5.2 86 | json_serializable: ^6.7.1 87 | 88 | # App Icon Generator 89 | flutter_launcher_icons: ^0.14.2 90 | 91 | # App Icon Configuration 92 | flutter_launcher_icons: 93 | android: true 94 | ios: true 95 | image_path: "assets/icons/z.png" 96 | adaptive_icon_background: "#6C5CE7" 97 | adaptive_icon_foreground: "assets/icons/z.png" 98 | min_sdk_android: 21 99 | web: 100 | generate: true 101 | image_path: "assets/icons/z.png" 102 | windows: 103 | generate: true 104 | image_path: "assets/icons/z.png" 105 | macos: 106 | generate: true 107 | image_path: "assets/icons/z.png" 108 | # For information on the generic Dart part of this file, see the 109 | # following page: https://dart.dev/tools/pub/pubspec 110 | 111 | # The following section is specific to Flutter packages. 112 | flutter: 113 | 114 | # The following line ensures that the Material Icons font is 115 | # included with your application, so that you can use the icons in 116 | # the material Icons class. 117 | uses-material-design: true 118 | 119 | # To add assets to your application, add an assets section, like this: 120 | assets: 121 | - assets/images/ 122 | - assets/icons/ 123 | 124 | # An image asset can refer to one or more resolution-specific "variants", see 125 | # https://flutter.dev/to/resolution-aware-images 126 | 127 | # For details regarding adding assets from package dependencies, see 128 | # https://flutter.dev/to/asset-from-package 129 | 130 | # To add custom fonts to your application, add a fonts section here, 131 | # in this "flutter" section. Each entry in this list should have a 132 | # "family" key with the font family name, and a "fonts" key with a 133 | # list giving the asset and other descriptors for the font. For 134 | # example: 135 | # fonts: 136 | # - family: Schyler 137 | # fonts: 138 | # - asset: fonts/Schyler-Regular.ttf 139 | # - asset: fonts/Schyler-Italic.ttf 140 | # style: italic 141 | # - family: Trajan Pro 142 | # fonts: 143 | # - asset: fonts/TrajanPro.ttf 144 | # - asset: fonts/TrajanPro_Bold.ttf 145 | # weight: 700 146 | # 147 | # For details regarding fonts from package dependencies, 148 | # see https://flutter.dev/to/font-from-package 149 | -------------------------------------------------------------------------------- /lib/constants/search_filters.dart: -------------------------------------------------------------------------------- 1 | /// Search filter constants for ZLibrary API 2 | 3 | /// Language options for book search 4 | const searchLanguages = { 5 | 'all': null, 6 | 'chinese': 'chinese', 7 | 'traditional_chinese': 'traditional chinese', 8 | 'english': 'english', 9 | 'russian': 'russian', 10 | 'german': 'german', 11 | 'spanish': 'spanish', 12 | 'dutch': 'dutch', 13 | 'french': 'french', 14 | 'italian': 'italian', 15 | 'portuguese': 'portuguese', 16 | 'brazilian': 'brazilian', 17 | 'polish': 'polish', 18 | 'ukrainian': 'ukrainian', 19 | 'bulgarian': 'bulgarian', 20 | 'greek': 'greek', 21 | 'romanian': 'romanian', 22 | 'moldavian': 'moldavian', 23 | 'turkish': 'turkish', 24 | 'persian': 'persian', 25 | 'arabic': 'arabic', 26 | 'japanese': 'japanese', 27 | 'swedish': 'swedish', 28 | 'hungarian': 'hungarian', 29 | 'serbian': 'serbian', 30 | 'latin': 'latin', 31 | 'croatian': 'croatian', 32 | 'czech': 'czech', 33 | 'kazakh': 'kazakh', 34 | 'belarusian': 'belarusian', 35 | 'indonesian': 'indonesian', 36 | 'malaysian': 'malaysian', 37 | 'lithuanian': 'lithuanian', 38 | 'catalan': 'catalan', 39 | 'finnish': 'finnish', 40 | 'azerbaijani': 'azerbaijani', 41 | 'korean': 'korean', 42 | 'bengali': 'bengali', 43 | 'esperanto': 'esperanto', 44 | 'hindi': 'hindi', 45 | 'urdu': 'urdu', 46 | 'danish': 'danish', 47 | 'uzbek': 'uzbek', 48 | 'slovak': 'slovak', 49 | 'norwegian': 'norwegian', 50 | 'vietnamese': 'vietnamese', 51 | 'thai': 'thai', 52 | 'hebrew': 'hebrew', 53 | }; 54 | 55 | /// Localized language display names (key: api_value) 56 | Map getLanguageDisplayNames(String locale) { 57 | // Common languages with localized names 58 | if (locale.startsWith('zh')) { 59 | return { 60 | 'all': '所有语言', 61 | 'chinese': '简体中文', 62 | 'traditional_chinese': '繁体中文', 63 | 'english': '英语', 64 | 'russian': '俄语', 65 | 'german': '德语', 66 | 'spanish': '西班牙语', 67 | 'french': '法语', 68 | 'italian': '意大利语', 69 | 'portuguese': '葡萄牙语', 70 | 'brazilian': '巴西葡萄牙语', 71 | 'japanese': '日语', 72 | 'korean': '韩语', 73 | 'arabic': '阿拉伯语', 74 | 'turkish': '土耳其语', 75 | 'vietnamese': '越南语', 76 | 'thai': '泰语', 77 | 'indonesian': '印度尼西亚语', 78 | 'polish': '波兰语', 79 | 'ukrainian': '乌克兰语', 80 | 'dutch': '荷兰语', 81 | 'swedish': '瑞典语', 82 | 'danish': '丹麦语', 83 | 'norwegian': '挪威语', 84 | 'finnish': '芬兰语', 85 | 'greek': '希腊语', 86 | 'czech': '捷克语', 87 | 'romanian': '罗马尼亚语', 88 | 'hungarian': '匈牙利语', 89 | 'persian': '波斯语', 90 | 'hindi': '印地语', 91 | 'bengali': '孟加拉语', 92 | 'hebrew': '希伯来语', 93 | 'latin': 'latin', 94 | }; 95 | } 96 | // Default: English names 97 | return { 98 | 'all': 'All Languages', 99 | 'chinese': 'Chinese', 100 | 'traditional_chinese': 'Traditional Chinese', 101 | 'english': 'English', 102 | 'russian': 'Russian', 103 | 'german': 'German', 104 | 'spanish': 'Spanish', 105 | 'french': 'French', 106 | 'italian': 'Italian', 107 | 'portuguese': 'Portuguese', 108 | 'brazilian': 'Brazilian Portuguese', 109 | 'japanese': 'Japanese', 110 | 'korean': 'Korean', 111 | 'arabic': 'Arabic', 112 | 'turkish': 'Turkish', 113 | 'vietnamese': 'Vietnamese', 114 | 'thai': 'Thai', 115 | 'indonesian': 'Indonesian', 116 | 'polish': 'Polish', 117 | 'ukrainian': 'Ukrainian', 118 | 'dutch': 'Dutch', 119 | 'swedish': 'Swedish', 120 | 'danish': 'Danish', 121 | 'norwegian': 'Norwegian', 122 | 'finnish': 'Finnish', 123 | 'greek': 'Greek', 124 | 'czech': 'Czech', 125 | 'romanian': 'Romanian', 126 | 'hungarian': 'Hungarian', 127 | 'persian': 'Persian', 128 | 'hindi': 'Hindi', 129 | 'bengali': 'Bengali', 130 | 'hebrew': 'Hebrew', 131 | 'latin': 'Latin', 132 | }; 133 | } 134 | 135 | /// Sort order options 136 | const searchOrders = { 137 | 'default': null, 138 | 'popular': 'popular', 139 | 'bestmatch': 'bestmatch', 140 | 'title': 'title', 141 | 'date': 'date', 142 | 'year': 'year', 143 | }; 144 | 145 | /// Localized sort order names 146 | Map getOrderDisplayNames(String locale) { 147 | if (locale.startsWith('zh')) { 148 | return { 149 | 'default': '默认顺序', 150 | 'popular': '热度', 151 | 'bestmatch': '匹配度', 152 | 'title': '书名', 153 | 'date': '上传日期', 154 | 'year': '出版日期', 155 | }; 156 | } 157 | return { 158 | 'default': 'Default', 159 | 'popular': 'Popular', 160 | 'bestmatch': 'Best Match', 161 | 'title': 'Title', 162 | 'date': 'Upload Date', 163 | 'year': 'Publish Year', 164 | }; 165 | } 166 | 167 | /// File extension options 168 | const searchExtensions = { 169 | 'all': null, 170 | 'pdf': 'pdf', 171 | 'epub': 'epub', 172 | 'mobi': 'mobi', 173 | 'txt': 'txt', 174 | 'azw': 'azw', 175 | 'azw3': 'azw3', 176 | }; 177 | 178 | /// Localized extension names 179 | Map getExtensionDisplayNames(String locale) { 180 | if (locale.startsWith('zh')) { 181 | return { 182 | 'all': '所有格式', 183 | 'pdf': 'PDF', 184 | 'epub': 'EPUB', 185 | 'mobi': 'MOBI', 186 | 'txt': 'TXT', 187 | 'azw': 'AZW', 188 | 'azw3': 'AZW3', 189 | }; 190 | } 191 | return { 192 | 'all': 'All Formats', 193 | 'pdf': 'PDF', 194 | 'epub': 'EPUB', 195 | 'mobi': 'MOBI', 196 | 'txt': 'TXT', 197 | 'azw': 'AZW', 198 | 'azw3': 'AZW3', 199 | }; 200 | } 201 | -------------------------------------------------------------------------------- /lib/theme/app_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | import 'app_colors.dart'; 4 | 5 | class AppTheme { 6 | static ThemeData get lightTheme { 7 | return ThemeData( 8 | useMaterial3: true, 9 | brightness: Brightness.light, 10 | primaryColor: AppColors.primary, 11 | scaffoldBackgroundColor: AppColors.background, 12 | 13 | colorScheme: const ColorScheme.light( 14 | primary: AppColors.primary, 15 | secondary: AppColors.accent, 16 | surface: AppColors.surface, 17 | background: AppColors.background, 18 | onPrimary: Colors.white, 19 | onSurface: AppColors.textPrimary, 20 | error: AppColors.error, 21 | ), 22 | 23 | textTheme: GoogleFonts.poppinsTextTheme().copyWith( 24 | displayLarge: const TextStyle(color: AppColors.textPrimary, fontWeight: FontWeight.bold), 25 | titleLarge: const TextStyle(color: AppColors.textPrimary, fontWeight: FontWeight.bold), 26 | titleMedium: const TextStyle(color: AppColors.textPrimary, fontWeight: FontWeight.w600), 27 | bodyLarge: const TextStyle(color: AppColors.textPrimary), 28 | bodyMedium: const TextStyle(color: AppColors.textSecondary), 29 | bodySmall: const TextStyle(color: AppColors.textSecondary, fontSize: 12), 30 | ), 31 | 32 | cardTheme: const CardThemeData( 33 | color: AppColors.surface, 34 | elevation: 2, 35 | shadowColor: Color(0x0D000000), 36 | shape: RoundedRectangleBorder( 37 | borderRadius: BorderRadius.all(Radius.circular(20)), 38 | ), 39 | margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), 40 | ), 41 | 42 | appBarTheme: const AppBarTheme( 43 | backgroundColor: AppColors.background, 44 | elevation: 0, 45 | centerTitle: false, 46 | titleTextStyle: TextStyle( 47 | color: AppColors.textPrimary, 48 | fontSize: 24, 49 | fontWeight: FontWeight.bold, 50 | fontFamily: 'Poppins', 51 | ), 52 | iconTheme: IconThemeData(color: AppColors.textPrimary), 53 | ), 54 | 55 | bottomNavigationBarTheme: const BottomNavigationBarThemeData( 56 | backgroundColor: AppColors.surface, 57 | selectedItemColor: AppColors.primary, 58 | unselectedItemColor: AppColors.textSecondary, 59 | showSelectedLabels: true, 60 | showUnselectedLabels: true, 61 | type: BottomNavigationBarType.fixed, 62 | elevation: 8, 63 | ), 64 | 65 | inputDecorationTheme: InputDecorationTheme( 66 | filled: true, 67 | fillColor: Colors.white, 68 | border: OutlineInputBorder( 69 | borderRadius: BorderRadius.circular(30), // Capsule shape 70 | borderSide: BorderSide.none, 71 | ), 72 | enabledBorder: OutlineInputBorder( 73 | borderRadius: BorderRadius.circular(30), 74 | borderSide: BorderSide.none, 75 | ), 76 | focusedBorder: OutlineInputBorder( 77 | borderRadius: BorderRadius.circular(30), 78 | borderSide: const BorderSide(color: AppColors.primary, width: 1.5), 79 | ), 80 | contentPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), 81 | hintStyle: const TextStyle(color: AppColors.textSecondary), 82 | ), 83 | 84 | elevatedButtonTheme: ElevatedButtonThemeData( 85 | style: ElevatedButton.styleFrom( 86 | backgroundColor: AppColors.primary, 87 | foregroundColor: Colors.white, 88 | elevation: 0, 89 | padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), 90 | shape: RoundedRectangleBorder( 91 | borderRadius: BorderRadius.circular(30), // Pill shape 92 | ), 93 | textStyle: const TextStyle( 94 | fontSize: 16, 95 | fontWeight: FontWeight.w600, 96 | ), 97 | ), 98 | ), 99 | ); 100 | } 101 | 102 | // Dark Theme (Adaptive) 103 | static ThemeData get darkTheme { 104 | return ThemeData( 105 | useMaterial3: true, 106 | brightness: Brightness.dark, 107 | primaryColor: AppColors.primary, 108 | scaffoldBackgroundColor: const Color(0xFF121212), 109 | 110 | colorScheme: const ColorScheme.dark( 111 | primary: AppColors.primary, 112 | secondary: AppColors.accent, 113 | surface: Color(0xFF1E1E1E), 114 | background: Color(0xFF121212), 115 | onPrimary: Colors.white, 116 | onSurface: Colors.white, 117 | ), 118 | 119 | textTheme: GoogleFonts.poppinsTextTheme(ThemeData.dark().textTheme), 120 | 121 | cardTheme: CardThemeData( 122 | color: const Color(0xFF1E1E1E), 123 | elevation: 0, 124 | shape: RoundedRectangleBorder( 125 | side: const BorderSide(color: Colors.white10), 126 | borderRadius: BorderRadius.circular(20), 127 | ), 128 | ), 129 | 130 | appBarTheme: const AppBarTheme( 131 | backgroundColor: Color(0xFF121212), 132 | elevation: 0, 133 | iconTheme: IconThemeData(color: Colors.white), 134 | ), 135 | 136 | inputDecorationTheme: InputDecorationTheme( 137 | filled: true, 138 | fillColor: const Color(0xFF2C2C2C), 139 | border: OutlineInputBorder( 140 | borderRadius: BorderRadius.circular(30), 141 | borderSide: BorderSide.none, 142 | ), 143 | ), 144 | 145 | elevatedButtonTheme: ElevatedButtonThemeData( 146 | style: ElevatedButton.styleFrom( 147 | backgroundColor: AppColors.primary, 148 | foregroundColor: Colors.white, 149 | shape: RoundedRectangleBorder( 150 | borderRadius: BorderRadius.circular(30), 151 | ), 152 | ), 153 | ), 154 | ); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /lib/services/ad_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:unity_ads_plugin/unity_ads_plugin.dart'; 4 | import 'hive_service.dart'; 5 | 6 | /// Unity Ads Service for managing banner and rewarded ads 7 | class AdService { 8 | // ⚠️ Set to false to completely disable all ads (Unity Ads not available in China) 9 | static const bool adsEnabled = false; 10 | 11 | static const String _androidGameId = '6003580'; 12 | static const String _iosGameId = '6003581'; 13 | 14 | // Ad Placement IDs (default Unity placements) 15 | static const String bannerPlacement = 'Banner_Android'; 16 | static const String bannerPlacementIos = 'Banner_iOS'; 17 | static const String rewardedPlacement = 'Rewarded_Android'; 18 | static const String rewardedPlacementIos = 'Rewarded_iOS'; 19 | 20 | static bool _isInitialized = false; 21 | static bool get isInitialized => _isInitialized; 22 | 23 | /// Check if ads should be shown (platform support + enabled flag) 24 | static bool get isMobilePlatform => 25 | adsEnabled && (Platform.isAndroid || Platform.isIOS); 26 | 27 | /// Initialize Unity Ads 28 | static Future init() async { 29 | // Skip if ads are disabled 30 | if (!adsEnabled) { 31 | debugPrint('Unity Ads: Ads are disabled'); 32 | return; 33 | } 34 | 35 | if (_isInitialized) return; 36 | 37 | // Unity Ads only supports Android and iOS 38 | if (!Platform.isAndroid && !Platform.isIOS) { 39 | debugPrint('Unity Ads: Skipping initialization on unsupported platform'); 40 | return; 41 | } 42 | 43 | final gameId = Platform.isAndroid ? _androidGameId : _iosGameId; 44 | 45 | await UnityAds.init( 46 | gameId: gameId, 47 | testMode: kDebugMode, // Enable test mode in debug builds 48 | onComplete: () { 49 | _isInitialized = true; 50 | debugPrint('Unity Ads initialized successfully'); 51 | }, 52 | onFailed: (error, message) { 53 | debugPrint('Unity Ads initialization failed: $error - $message'); 54 | }, 55 | ); 56 | } 57 | 58 | /// Get correct placement ID based on platform 59 | static String getBannerPlacement() { 60 | return Platform.isAndroid ? bannerPlacement : bannerPlacementIos; 61 | } 62 | 63 | static String getRewardedPlacement() { 64 | return Platform.isAndroid ? rewardedPlacement : rewardedPlacementIos; 65 | } 66 | 67 | /// Show rewarded ad 68 | static Future showRewardedAd({ 69 | required Function onComplete, 70 | required Function onSkipped, 71 | }) async { 72 | if (!_isInitialized) { 73 | debugPrint('Unity Ads not initialized'); 74 | return false; 75 | } 76 | 77 | final placement = getRewardedPlacement(); 78 | 79 | UnityAds.showVideoAd( 80 | placementId: placement, 81 | onComplete: (placementId) { 82 | onComplete(); 83 | }, 84 | onFailed: (placementId, error, message) { 85 | debugPrint('Rewarded ad failed: $error - $message'); 86 | onSkipped(); 87 | }, 88 | onSkipped: (placementId) { 89 | onSkipped(); 90 | }, 91 | ); 92 | 93 | return true; 94 | } 95 | 96 | // ============ Ad-Free Time Management ============ 97 | 98 | static const String _adFreeUntilKey = 'ad_free_until'; 99 | static const String _rewardWatchCountKey = 'reward_watch_count'; 100 | static const String _rewardWatchDateKey = 'reward_watch_date'; 101 | 102 | /// Check if user is currently ad-free 103 | static bool isAdFree() { 104 | final adFreeUntil = HiveService.settingsBox.get(_adFreeUntilKey); 105 | if (adFreeUntil == null) return false; 106 | 107 | final until = DateTime.fromMillisecondsSinceEpoch(adFreeUntil as int); 108 | return DateTime.now().isBefore(until); 109 | } 110 | 111 | /// Get remaining ad-free time 112 | static Duration getAdFreeRemaining() { 113 | final adFreeUntil = HiveService.settingsBox.get(_adFreeUntilKey); 114 | if (adFreeUntil == null) return Duration.zero; 115 | 116 | final until = DateTime.fromMillisecondsSinceEpoch(adFreeUntil as int); 117 | final remaining = until.difference(DateTime.now()); 118 | 119 | return remaining.isNegative ? Duration.zero : remaining; 120 | } 121 | 122 | /// Get today's reward watch count 123 | static int getTodayWatchCount() { 124 | final savedDate = HiveService.settingsBox.get(_rewardWatchDateKey); 125 | final today = _getDateString(DateTime.now()); 126 | 127 | if (savedDate != today) { 128 | // Reset count for new day 129 | return 0; 130 | } 131 | 132 | return HiveService.settingsBox.get(_rewardWatchCountKey, defaultValue: 0) as int; 133 | } 134 | 135 | /// Grant ad-free time based on watch count 136 | /// 1st watch: 1 hour, 2nd watch: 3 hours, 3rd+ watch: rest of day 137 | static Future grantAdFreeTime() async { 138 | final today = _getDateString(DateTime.now()); 139 | final savedDate = HiveService.settingsBox.get(_rewardWatchDateKey); 140 | 141 | int watchCount = 0; 142 | if (savedDate == today) { 143 | watchCount = HiveService.settingsBox.get(_rewardWatchCountKey, defaultValue: 0) as int; 144 | } 145 | 146 | // Increment watch count 147 | watchCount++; 148 | await HiveService.settingsBox.put(_rewardWatchCountKey, watchCount); 149 | await HiveService.settingsBox.put(_rewardWatchDateKey, today); 150 | 151 | // Calculate ad-free duration 152 | Duration grantDuration; 153 | if (watchCount == 1) { 154 | grantDuration = const Duration(hours: 1); 155 | } else if (watchCount == 2) { 156 | grantDuration = const Duration(hours: 3); 157 | } else { 158 | // 3rd+ watch: rest of the day (until midnight) 159 | final now = DateTime.now(); 160 | final midnight = DateTime(now.year, now.month, now.day + 1); 161 | grantDuration = midnight.difference(now); 162 | } 163 | 164 | // Calculate new ad-free until time 165 | final currentRemaining = getAdFreeRemaining(); 166 | final newUntil = DateTime.now().add(currentRemaining + grantDuration); 167 | 168 | await HiveService.settingsBox.put( 169 | _adFreeUntilKey, 170 | newUntil.millisecondsSinceEpoch, 171 | ); 172 | 173 | return grantDuration; 174 | } 175 | 176 | /// Get description of next reward 177 | static String getNextRewardDescription(String locale) { 178 | final count = getTodayWatchCount(); 179 | final isZh = locale.startsWith('zh'); 180 | 181 | if (count == 0) { 182 | return isZh ? '观看广告免除1小时广告' : 'Watch to get 1 hour ad-free'; 183 | } else if (count == 1) { 184 | return isZh ? '再看一次免除3小时广告' : 'Watch again for 3 hours ad-free'; 185 | } else if (count == 2) { 186 | return isZh ? '再看一次免除今日所有广告' : 'Watch again for ad-free rest of day'; 187 | } else { 188 | return isZh ? '今日已达免广告上限' : 'Max ad-free rewards reached today'; 189 | } 190 | } 191 | 192 | static String _getDateString(DateTime date) { 193 | return '${date.year}-${date.month}-${date.day}'; 194 | } 195 | } 196 | --------------------------------------------------------------------------------