├── .gitignore
├── .metadata
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SETUP.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── app
│ │ │ │ └── openlib
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── launcher_icon.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── launcher_icon.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── launcher_icon.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── launcher_icon.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── launcher_icon.png
│ │ │ ├── raw
│ │ │ └── annas_archive
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ ├── values
│ │ │ └── styles.xml
│ │ │ └── xml
│ │ │ └── network_security_config.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
├── captcha.svg
├── delete_confirmation.svg
├── empty_mylib.svg
├── error_fixing_bugs.svg
├── icons
│ └── appIcon.png
├── library.svg
├── no_internet.svg
├── no_results.svg
├── searching.svg
└── undraw.svg
├── fastlane
└── metadata
│ └── android
│ └── en-US
│ ├── full_description.txt
│ ├── images
│ ├── icon.png
│ └── phoneScreenshots
│ │ ├── Screenshot_1.png
│ │ ├── Screenshot_2.png
│ │ ├── Screenshot_3.png
│ │ ├── Screenshot_4.png
│ │ ├── Screenshot_5.png
│ │ ├── Screenshot_6.png
│ │ ├── Screenshot_7.png
│ │ └── Screenshot_8.png
│ └── short_description.txt
├── github_releases.png
├── google_fonts
├── Nunito-Black.ttf
├── Nunito-Bold.ttf
├── Nunito-ExtraBold.ttf
├── Nunito-ExtraLight.ttf
├── Nunito-Light.ttf
├── Nunito-Medium.ttf
├── Nunito-Regular.ttf
└── Nunito-SemiBold.ttf
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── 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-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
└── RunnerTests
│ └── RunnerTests.swift
├── lib
├── main.dart
├── services
│ ├── annas_archieve.dart
│ ├── database.dart
│ ├── download_file.dart
│ ├── files.dart
│ ├── goodreads.dart
│ ├── open_library.dart
│ └── share_book.dart
├── state
│ └── state.dart
└── ui
│ ├── about_page.dart
│ ├── book_info_page.dart
│ ├── categories_page.dart
│ ├── components
│ ├── book_card_widget.dart
│ ├── book_info_widget.dart
│ ├── delete_dialog_widget.dart
│ ├── error_widget.dart
│ ├── file_buttons_widget.dart
│ ├── page_title_widget.dart
│ └── snack_bar_widget.dart
│ ├── epub_viewer.dart
│ ├── extensions.dart
│ ├── home_page.dart
│ ├── mybook_page.dart
│ ├── mylibrary_page.dart
│ ├── pdf_viewer.dart
│ ├── results_page.dart
│ ├── search_page.dart
│ ├── settings_page.dart
│ ├── themes.dart
│ ├── trending_page.dart
│ └── webview_page.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── 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
│ ├── Base.lproj
│ │ └── MainMenu.xib
│ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
└── RunnerTests
│ └── RunnerTests.swift
├── pubspec.lock
├── pubspec.yaml
├── screenshots
├── Screenshot_1.png
├── Screenshot_2.png
├── Screenshot_3.png
├── Screenshot_4.png
├── Screenshot_5.png
├── Screenshot_6.png
├── Screenshot_7.png
└── Screenshot_8.png
├── test
└── widget_test.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
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 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/.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.
5 |
6 | version:
7 | revision: 796c8ef79279f9c774545b3771238c3098dbefab
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: 796c8ef79279f9c774545b3771238c3098dbefab
17 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
18 | - platform: android
19 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
20 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
21 | - platform: ios
22 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
23 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
24 | - platform: linux
25 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
26 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
27 | - platform: macos
28 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
29 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
30 | - platform: web
31 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
32 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
33 | - platform: windows
34 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
35 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Openlib Contribution guidelines
2 |
3 | ### Getting started
4 |
5 | - This project is powered by Flutter. Make sure you have the latest version of Flutter.
6 |
7 | - If you want to fix bug or implement a new feature, that already mention in the [issues](https://github.com/dstark5/Openlib/issues), please, assign this issue to you and/or comment about it.
8 |
9 | - Whether you have to implement new feature, please, open an issue or discussion regarding it to ensure it will be accepted.
10 |
11 | ### Open a pull request
12 | When you're done making changes and you'd like to propose them for review, open your PR (pull request). You can use the GitHub user interface for some small changes, like fixing a typo or updating a readme. You can also fork the repo and then clone it locally, to view changes and run your tests on your machine.
13 |
14 | ### Submit your PR & get it reviewed
15 | - Once you submit your PR, others from the Docs community will review it with you. The first thing you're going to want to do is a [self review](#self-review).
16 | - After that, we may have questions, check back on your PR to keep up with the conversation.
17 | - We may ask for changes to be made before a PR can be merged. You can make any other changes in your fork, then commit them to your branch.
18 |
19 | ### Self review
20 | You should always review your own PR first.
21 |
22 | For content changes, make sure that you:
23 | - [ ] Confirm the changes doesn't break anything else.
24 | - [ ] Compare your pull request's source changes to staging to confirm that the output matches the source and that everything is rendering as expected. This helps spot issues like typos, content that doesn't follow the style guide, or content that isn't rendering due to versioning problems.
25 | - [ ] Review the content for technical accuracy.
26 | - [ ] Copy-edit the changes for grammar or spelling mistakes.
27 |
28 | ### Notes
29 | - Please, do not modify readme and other information files (except for typos).
30 | - Avoid adding new dependencies unless required. APK size is important.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | # Openlib
6 |
7 | An Open source app to download and read books from shadow library ([Anna’s Archive](https://annas-archive.org/))
8 |
9 | [](https://flutter.dev/)
10 | [](https://opensource.org/licenses/)
11 | [](https://github.com/dstark5/Openlib/releases)
12 |
13 | [
](https://github.com/dstark5/Openlib/releases)
16 | [
](https://android.izzysoft.de/repo/apk/com.app.openlib)
19 | [
](https://f-droid.org/en/packages/com.app.openlib/)
22 | [
](https://www.openapk.net/openlib/com.app.openlib/)
25 |
26 |
27 | ## Note 📝
28 |
29 | **WARNING:** This App Is In Beta Stage, So You May Encounter Bugs. If You Do, Open An Issue In Github Repository.
30 |
31 | **Publishing Openlib, Or Any Fork Of It In The Google Play Store Violates Their Terms And Conditions**
32 |
33 | ## Screenshots 🖼️
34 |
35 | [ ](screenshots/Screenshot_1.png)
36 | [ ](screenshots/Screenshot_2.png)
37 | [ ](screenshots/Screenshot_3.png)
38 | [ ](screenshots/Screenshot_4.png)
39 | [ ](screenshots/Screenshot_5.png)
40 | [ ](screenshots/Screenshot_6.png)
41 | [ ](screenshots/Screenshot_7.png)
42 | [ ](screenshots/Screenshot_8.png)
43 |
44 | ## Description 📖
45 |
46 | Openlib Is An Open Source App To Download And Read Books From Shadow Library ([Anna’s Archive](https://annas-archive.org/)). The App Has Built In Reader to Read Books
47 |
48 | As [Anna’s Archive](https://annas-archive.org/) Doesn't Have An API. The App Works By Sending Request To Anna’s Archive And Parses The Response To objects. The App Extracts The Mirrors From Response And Downloads The Book
49 |
50 | ## Features ✨
51 |
52 | - Trending Books
53 | - Download And Read Books With In-Built Viewer
54 | - Supports Epub And Pdf Formats
55 | - Open Books In Your Favourite Ebook Reader
56 | - Filter Books
57 | - Sort Books
58 |
59 | ## Roadmap 🎯
60 |
61 | - Adding More Book Format supports (cbz,cbr,azw3,etc...)
62 | - Adding Support For Background Downloads
63 | - Adding Support For Multiple Downloads
64 | - Move existing books when changing the storage path
65 |
66 | ## Building from Source
67 |
68 | - If you don't have Flutter SDK installed, please visit official [Flutter](https://flutter.dev) site.
69 |
70 | - Git Clone The Repo
71 |
72 | ```sh
73 | git clone https://github.com/dstark5/Openlib.git
74 | ```
75 |
76 | - Run the app with Android Studio or VS Code. Or the command line:
77 |
78 | ```sh
79 | flutter pub get
80 | flutter run
81 | ```
82 |
83 | - To Build App Run:
84 |
85 | ```sh
86 | flutter build
87 | ```
88 |
89 | - The Build Will Be In './build/app/outputs/flutter-apk/app-release.apk'
90 |
91 | ### Android
92 |
93 | Make sure that `android/local.properties` has `flutter.minSdkVersion=21` or above
94 | For setup guide see [SETUP.md](./SETUP.md)
95 |
96 | ## Contributor required 🚧
97 |
98 | We are actively seeking contributors. Whether you're a seasoned developer or just starting out, we welcome your contributions to help make this project even better!
99 |
100 | ## Contribution 💝
101 |
102 | Whether you have ideas, design changes or even major code changes, help is always welcome. The app gets better and better with each contribution, no matter how big or small!
103 |
104 | If you'd like to get involved See [CONTRIBUTING.md](./CONTRIBUTING.md) for the guidelines.
105 |
106 | ## Issues 🚩
107 |
108 | Please report bugs via the [issue tracker](https://github.com/dstark5/Openlib/issues).
109 |
110 | ## Donate 🎁
111 |
112 | If you like Openlib, you're welcome to send a donation.
113 |
114 | [Donate To Anna’s Archive.](https://annas-archive.org/donate?tier=1)
115 |
116 | ## License 📜
117 |
118 | [](https://www.gnu.org/licenses/gpl-3.0.en.html)
119 |
120 | Openlib is a free software licensed under GPL v3.0 It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. [GNU General Public License](https://www.gnu.org/licenses/gpl.html) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
121 |
122 | ## Disclaimer ⚠️
123 |
124 | Openlib does not own or have any affiliation with the books available through the app. All books are the property of their respective owners and are protected by copyright law. Openlib is not responsible for any infringement of copyright or other intellectual property rights that may result from the use of the books available through the app. By using the app, you agree to use the books only for personal, non-commercial purposes and in compliance with all applicable laws and regulations.
125 |
--------------------------------------------------------------------------------
/SETUP.md:
--------------------------------------------------------------------------------
1 |
2 | # Openlib Project Setup Guide
3 |
4 | Welcome to the **Openlib Project**! This guide will walk you through setting up the project on your local machine, specifically focusing on **Android Studio**.
5 |
6 | ### Prerequisites
7 | Before you begin, make sure you have the following installed and configured on your system:
8 |
9 | - **Flutter**: Follow [Flutter installation instructions](https://docs.flutter.dev/get-started/install).
10 | - To verify Flutter installation, run:
11 | ```bash
12 | flutter doctor
13 | ```
14 | - **Git**: Required to clone the repository.
15 | - **Android Studio** (recommended): With Flutter plugin support.
16 |
17 | ---
18 |
19 | ## Steps to Set Up Locally
20 |
21 | ### 1. Create a Project Directory
22 | First, decide where you want the project folder to be created. You can do this from the terminal as follows:
23 | ```bash
24 | mkdir OpenlibProject
25 | cd OpenlibProject
26 | ```
27 |
28 | ### 2. Clone the Repository
29 | Use Git to clone the project into your newly created directory:
30 | ```bash
31 | git clone https://github.com/dstark5/Openlib.git
32 | ```
33 |
34 | ### 3. Navigate to the Project Folder
35 | After cloning, move into the **Openlib** folder:
36 | ```bash
37 | cd Openlib
38 | ```
39 |
40 | ### 4. Open the Project in Android Studio or VS Code
41 | To open the project:
42 | - **For VS Code**: Use:
43 | ```bash
44 | code .
45 | ```
46 | - **For Android Studio**: Open Android Studio, and then use **File > Open** to navigate to the Openlib folder.
47 |
48 | ### 5. local.properties changes
49 | To ensure compatibility with your target Android devices, update the minimum SDK version:
50 | 1. Open **local.properties** (located in `android/`).
51 | 2. Add the below properties:
52 | ```gradle
53 | flutter.buildMode=release
54 | flutter.minSdkVersion=21
55 | flutter.targetSdkVersion=34
56 | flutter.compileSdkVersion=34
57 | ```
58 | Here, `"21"` represents the minimum SDK version supported.
59 |
60 | ### 6. Enable Flutter Support in Android Studio
61 | To access the emulator options and additional Flutter-specific features:
62 | - Go to **File > Settings > Plugins** in Android Studio.
63 | - Ensure **Flutter** support is enabled.
64 | - This will provide access to the emulator tab, where you can choose the device for testing.
65 |
66 | ### 7. Run the Application
67 | To run the app:
68 | 1. Open **main.dart** (usually found under `lib/`).
69 | 2. Use the **Run** button in Android Studio to launch the app on your selected emulator or connected device.
70 |
71 | ---
72 |
73 | ## Additional Resources and Troubleshooting
74 | If you encounter any issues, refer to the official [Flutter documentation](https://docs.flutter.dev/) for comprehensive troubleshooting and setup tips.
75 |
76 | ---
77 |
78 | Feel free to reach out or create an issue if you have any questions or need further assistance.
79 |
--------------------------------------------------------------------------------
/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
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
31 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
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 | def keystoreProperties = new Properties()
9 | def keystorePropertiesFile = rootProject.file('key.properties')
10 | if (keystorePropertiesFile.exists()) {
11 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
12 | }
13 |
14 | android {
15 | namespace = "com.app.openlib"
16 | compileSdk = flutter.compileSdkVersion
17 | ndkVersion = flutter.ndkVersion
18 |
19 | compileOptions {
20 | sourceCompatibility = JavaVersion.VERSION_17
21 | targetCompatibility = JavaVersion.VERSION_17
22 | }
23 |
24 | kotlinOptions {
25 | jvmTarget = JavaVersion.VERSION_17
26 | }
27 |
28 | defaultConfig {
29 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
30 | applicationId = "com.app.openlib"
31 | // You can update the following values to match your application needs.
32 | // For more information, see: https://flutter.dev/to/review-gradle-config.
33 | minSdk = flutter.minSdkVersion
34 | targetSdk = flutter.targetSdkVersion
35 | versionCode = flutter.versionCode
36 | versionName = flutter.versionName
37 | }
38 |
39 | dependenciesInfo {
40 | // Disables dependency metadata when building APKs.
41 | includeInApk = false
42 | // Disables dependency metadata when building Android App Bundles.
43 | includeInBundle = false
44 | }
45 |
46 | signingConfigs {
47 | release {
48 | keyAlias = keystoreProperties['keyAlias']
49 | keyPassword = keystoreProperties['keyPassword']
50 | storeFile = keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
51 | storePassword = keystoreProperties['storePassword']
52 | v1SigningEnabled = true
53 | v2SigningEnabled = true
54 | }
55 | }
56 |
57 | buildTypes {
58 | release {
59 | // TODO: Add your own signing config for the release build.
60 | // Signing with the debug keys for now, so `flutter run --release` works.
61 | signingConfig = signingConfigs.release
62 | minifyEnabled = false
63 | shrinkResources = false
64 | }
65 | }
66 | }
67 |
68 | flutter {
69 | source = "../.."
70 | }
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
30 |
31 |
39 |
43 |
44 |
48 |
49 |
50 |
51 |
52 |
53 |
55 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/app/openlib/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.app.openlib
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-hdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-mdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
--------------------------------------------------------------------------------
/android/app/src/main/res/raw/annas_archive:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIFfTCCBGWgAwIBAgIRAI0YQRVveHeTEYLPgc2CDXowDQYJKoZIhvcNAQELBQAw
3 | RjELMAkGA1UEBhMCVVMxIjAgBgNVBAoTGUdvb2dsZSBUcnVzdCBTZXJ2aWNlcyBM
4 | TEMxEzARBgNVBAMTCkdUUyBDQSAxUDUwHhcNMjMxMDMwMjMwOTExWhcNMjQwMTI4
5 | MjMwOTEwWjAcMRowGAYDVQQDExFhbm5hcy1hcmNoaXZlLm9yZzCCASIwDQYJKoZI
6 | hvcNAQEBBQADggEPADCCAQoCggEBAKl79Oj7GW10c1ikBC/sSkyr2tmmIl1/iszu
7 | 9DN5w3lbX3q5hLeSB2xPaW6FWPB0u+YR8tgXyk6jG8jkzSe2cdkW0pjKaxSNiQgW
8 | rXipoonUbaceSDd3aFQFGhqe0urkM+84Sgspy39REdxXuQeL2hXH8fouRPA65/pn
9 | 2nipwkpZHOezEQfE7BbUYwt4/YQaWXD3ScBLNx0PJuZdL4sfVC41IP8Ml/i5zzU7
10 | mupl6EGgw5IuXwyHN1AC1NHQBU5/8X062/NdVhW/letbsR52Z6DJ727+nWLpdwq4
11 | WgowHui6PthI6h+F4LCu+g3V5akAibsNffqVyWssxaMWFXjMuDECAwEAAaOCAo4w
12 | ggKKMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMB
13 | Af8EAjAAMB0GA1UdDgQWBBSIWJPHr1GutuUbnUApJ/vU3TQP9DAfBgNVHSMEGDAW
14 | gBTV/J4N3x7K3QiXl24rxV/FK/XsuDB4BggrBgEFBQcBAQRsMGowNQYIKwYBBQUH
15 | MAGGKWh0dHA6Ly9vY3NwLnBraS5nb29nL3MvZ3RzMXA1L1VfN25sRDJPX1JRMDEG
16 | CCsGAQUFBzAChiVodHRwOi8vcGtpLmdvb2cvcmVwby9jZXJ0cy9ndHMxcDUuZGVy
17 | MDEGA1UdEQQqMCiCEWFubmFzLWFyY2hpdmUub3JnghMqLmFubmFzLWFyY2hpdmUu
18 | b3JnMCEGA1UdIAQaMBgwCAYGZ4EMAQIBMAwGCisGAQQB1nkCBQMwPAYDVR0fBDUw
19 | MzAxoC+gLYYraHR0cDovL2NybHMucGtpLmdvb2cvZ3RzMXA1L19ZUS1xNlF1bEJB
20 | LmNybDCCAQUGCisGAQQB1nkCBAIEgfYEgfMA8QB2AHb/iD8KtvuVUcJhzPWHujS0
21 | pM27KdxoQgqf5mdMWjp0AAABi4MQGPAAAAQDAEcwRQIhALVAeepoK0WtUPs01yzZ
22 | XjAkdE7WYGw2QNzSkvywFRoIAiAnp1Lec4PqwGPbg/ppC8PgGxb8+yvSlVT0ChUt
23 | NMinWgB3ANq2v2s/tbYin5vCu1xr6HCRcWy7UYSFNL2kPTBI1/urAAABi4MQGP0A
24 | AAQDAEgwRgIhAKbAEYr9qDmiafcnkXIG7xObbI4fz3IsLSht8etA/jSlAiEAkQ7G
25 | t6x81Onpl4RcTtrXLptI0fDkrAZ66hAPWbIH8SAwDQYJKoZIhvcNAQELBQADggEB
26 | AGfvZYtIOPKRvVyfI4tJpetCJmU/DEMbCIyX05M+2P1n2uY1D4tweAMmYf4trh5Z
27 | cuTK3QDeoICus3WK08L3Ni/699QbQ0uonp0IIIOi2NlP2rLhvtETWpmLoX6jM55W
28 | cYGiQldhCgWYEXoANrJshUbjkyM81QMNzSrn33JPkzWUdgVoS/KfABaeymLekXO4
29 | ndLp4ktLlYQZr3JJU39FvwgN8IcmeLWUnpSWsekH+nHSW9e8vOsNQoZyHw0minqz
30 | ZzFbS10reX1kG56+AxDf5fOOM+C+MAozSUnXUjrkpXXakwUooMTklKtYbBiwR2R0
31 | wrcYmVHymn07AUliDOalu2I=
32 | -----END CERTIFICATE-----
33 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | secure.example.com
12 | 127.0.0.1
13 |
14 |
15 | annas-archive.org
16 |
17 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | rootProject.buildDir = "../build"
9 | subprojects {
10 | project.buildDir = "${rootProject.buildDir}/${project.name}"
11 | }
12 | subprojects {
13 | project.evaluationDependsOn(":app")
14 | }
15 |
16 | tasks.register("clean", Delete) {
17 | delete rootProject.buildDir
18 | }
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/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.0-all.zip
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }()
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21 | id "com.android.application" version "8.0.0" apply false
22 | id "org.jetbrains.kotlin.android" version "1.8.0" apply false
23 | }
24 |
25 | include ":app"
--------------------------------------------------------------------------------
/assets/icons/appIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/assets/icons/appIcon.png
--------------------------------------------------------------------------------
/assets/library.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ic_fluent_library_28_filled
5 | Created with Sketch.
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/assets/no_results.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assets/searching.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/full_description.txt:
--------------------------------------------------------------------------------
1 |
2 | Openlib is an open source app to download and read books from shadow library (Anna’s Archive ). The App Has Built In Reader to Read Books.
3 |
4 |
5 | As Anna’s Archive doesn't have an API, the app works by sending requests to Anna’s Archive and parses the response to objects. The app extracts the mirrors from the responses, downloads the book and stores it in the application's document directory.
6 |
7 |
8 | Note :
9 | The app requires VPN to function properly . Without VPN the might show the captcha required page even after completing the captcha
10 |
11 | Main Features:
12 |
13 | Trending Books
14 | Download And Read Books With In-Built Viewer
15 | Supports Epub And Pdf Formats
16 | Open Books With Your Favourite Ebooks Reader
17 | Filter Books
18 | Sort Books
19 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/icon.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_1.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_2.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_3.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_4.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_5.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_6.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_7.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/fastlane/metadata/android/en-US/images/phoneScreenshots/Screenshot_8.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/short_description.txt:
--------------------------------------------------------------------------------
1 | download and read books from shadow library (Anna’s Archive)
--------------------------------------------------------------------------------
/github_releases.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/github_releases.png
--------------------------------------------------------------------------------
/google_fonts/Nunito-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-Black.ttf
--------------------------------------------------------------------------------
/google_fonts/Nunito-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-Bold.ttf
--------------------------------------------------------------------------------
/google_fonts/Nunito-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-ExtraBold.ttf
--------------------------------------------------------------------------------
/google_fonts/Nunito-ExtraLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-ExtraLight.ttf
--------------------------------------------------------------------------------
/google_fonts/Nunito-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-Light.ttf
--------------------------------------------------------------------------------
/google_fonts/Nunito-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-Medium.ttf
--------------------------------------------------------------------------------
/google_fonts/Nunito-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-Regular.ttf
--------------------------------------------------------------------------------
/google_fonts/Nunito-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/google_fonts/Nunito-SemiBold.ttf
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '17.5'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | target 'RunnerTests' do
36 | inherit! :search_paths
37 | end
38 | end
39 |
40 | post_install do |installer|
41 | installer.pods_project.targets.each do |target|
42 | flutter_additional_ios_build_settings(target)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/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 |
63 |
65 |
71 |
72 |
73 |
74 |
80 |
82 |
88 |
89 |
90 |
91 |
93 |
94 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
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 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/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/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Openlib
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | Openlib
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 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/services/download_file.dart:
--------------------------------------------------------------------------------
1 | // Dart imports:
2 | import 'dart:io';
3 |
4 | // Package imports:
5 | import 'package:crypto/crypto.dart';
6 | import 'package:dio/dio.dart';
7 |
8 | // Project imports:
9 | import 'package:openlib/services/database.dart' show MyLibraryDb;
10 |
11 | MyLibraryDb dataBase = MyLibraryDb.instance;
12 |
13 | Future _getFilePath(String fileName) async {
14 | String bookStorageDirectory =
15 | await dataBase.getPreference('bookStorageDirectory');
16 | return '$bookStorageDirectory/$fileName';
17 | }
18 |
19 | List _reorderMirrors(List mirrors) {
20 | List ipfsMirrors = [];
21 | List httpsMirrors = [];
22 |
23 | for (var element in mirrors) {
24 | if (element.contains('ipfs') == true) {
25 | ipfsMirrors.add(element);
26 | } else {
27 | if (element.startsWith('https://annas-archive.org') != true &&
28 | element.startsWith('https://1lib.sk') != true) {
29 | httpsMirrors.add(element);
30 | }
31 | }
32 | }
33 | return [...ipfsMirrors, ...httpsMirrors];
34 | }
35 |
36 | Future _getAliveMirror(List mirrors) async {
37 | Dio dio = Dio();
38 | const timeOut = 15;
39 | if (mirrors.length == 1) {
40 | await Future.delayed(const Duration(seconds: 2));
41 | return mirrors[0];
42 | }
43 | for (var url in mirrors) {
44 | try {
45 | final response = await dio.head(url,
46 | options: Options(receiveTimeout: const Duration(seconds: timeOut)));
47 | if (response.statusCode == 200) {
48 | dio.close();
49 | return url;
50 | }
51 | } catch (_) {}
52 | }
53 | return null;
54 | }
55 |
56 | Future downloadFile(
57 | {required List mirrors,
58 | required String md5,
59 | required String format,
60 | required Function onStart,
61 | required Function onProgress,
62 | required Function cancelDownlaod,
63 | required Function mirrorStatus,
64 | required Function onDownlaodFailed}) async {
65 | if (mirrors.isEmpty) {
66 | onDownlaodFailed('No mirrors available!');
67 | } else {
68 | Dio dio = Dio();
69 |
70 | String path = await _getFilePath('$md5.$format');
71 | List orderedMirrors = _reorderMirrors(mirrors);
72 |
73 | String? workingMirror = await _getAliveMirror(orderedMirrors);
74 |
75 | // print(workingMirror);
76 | // print(path);
77 | // print(orderedMirrors);
78 | // print(orderedMirrors[0]);
79 |
80 | if (workingMirror != null) {
81 | onStart();
82 | try {
83 | CancelToken cancelToken = CancelToken();
84 | dio.download(
85 | workingMirror,
86 | path,
87 | options: Options(headers: {
88 | 'Connection': 'Keep-Alive',
89 | 'User-Agent':
90 | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'
91 | }),
92 | onReceiveProgress: (rcv, total) {
93 | if (!(rcv.isNaN || rcv.isInfinite) &&
94 | !(total.isNaN || total.isInfinite)) {
95 | onProgress(rcv, total);
96 | }
97 | },
98 | deleteOnError: true,
99 | cancelToken: cancelToken,
100 | ).catchError((err) {
101 | if (err.type != DioExceptionType.cancel) {
102 | onDownlaodFailed('downloaded Failed! try again...');
103 | }
104 | throw err;
105 | });
106 |
107 | mirrorStatus(true);
108 |
109 | cancelDownlaod(cancelToken);
110 | } catch (_) {
111 | onDownlaodFailed('downloaded Failed! try again...');
112 | }
113 | } else {
114 | onDownlaodFailed('No working mirrors available to download book!');
115 | }
116 | }
117 | }
118 |
119 | Future verifyFileCheckSum(
120 | {required String md5Hash, required String format}) async {
121 | try {
122 | final bookStorageDirectory =
123 | await dataBase.getPreference('bookStorageDirectory');
124 | final filePath = '$bookStorageDirectory/$md5Hash.$format';
125 | final file = File(filePath);
126 | final stream = file.openRead();
127 | final hash = await md5.bind(stream).first;
128 | if (md5Hash == hash.toString()) {
129 | return true;
130 | }
131 | return false;
132 | } catch (_) {
133 | return false;
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/lib/services/files.dart:
--------------------------------------------------------------------------------
1 | // Dart imports:
2 | import 'dart:io';
3 |
4 | // Package imports:
5 | import 'package:flutter_riverpod/flutter_riverpod.dart';
6 | import 'package:path_provider/path_provider.dart';
7 |
8 | // Project imports:
9 | import 'package:openlib/services/database.dart';
10 | import 'package:openlib/state/state.dart' show myLibraryProvider;
11 |
12 | MyLibraryDb dataBase = MyLibraryDb.instance;
13 |
14 | Future get getBookStorageDefaultDirectory async {
15 | if (Platform.isAndroid) {
16 | final directory = await getExternalStorageDirectory();
17 | return directory!.path;
18 | } else {
19 | final directory = await getApplicationDocumentsDirectory();
20 | return directory.path;
21 | }
22 | }
23 |
24 | Future moveFilesToAndroidInternalStorage() async {
25 | try {
26 | final directory = await getApplicationDocumentsDirectory();
27 | final directoryExternal = await getExternalStorageDirectory();
28 | List files = Directory(directory.path).listSync();
29 | for (var element in files) {
30 | if ((element.path.contains('pdf')) || element.path.contains('epub')) {
31 | String fileName = element.path.split('/').last;
32 | File file = File(element.path);
33 | file.copySync('${directoryExternal!.path}/$fileName');
34 | file.deleteSync();
35 | }
36 | }
37 | } catch (e) {
38 | // ignore: avoid_print
39 | print(e);
40 | }
41 | }
42 |
43 | Future moveFolderContents(
44 | String source_path, String destination_path) async {
45 | final source = Directory(source_path);
46 | source.listSync(recursive: false).forEach((var entity) {
47 | if (entity is Directory) {
48 | var newDirectory =
49 | Directory('${destination_path}/${entity.path.split('/').last}');
50 | newDirectory.createSync();
51 | moveFolderContents(entity.path, newDirectory.path);
52 | entity.deleteSync();
53 | } else if (entity is File) {
54 | entity.copySync('${destination_path}/${entity.path.split('/').last}');
55 | entity.deleteSync();
56 | }
57 | });
58 | }
59 |
60 | Future isFileExists(String filePath) async {
61 | return await File(filePath).exists();
62 | }
63 |
64 | Future deleteFile(String filePath) async {
65 | if (await isFileExists(filePath) == true) {
66 | await File(filePath).delete();
67 | }
68 | }
69 |
70 | Future getFilePath(String fileName) async {
71 | final bookStorageDirectory =
72 | await dataBase.getPreference('bookStorageDirectory');
73 | String filePath = '$bookStorageDirectory/$fileName';
74 | bool isExists = await isFileExists(filePath);
75 | if (isExists == true) {
76 | return filePath;
77 | }
78 | throw "File Not Exists";
79 | }
80 |
81 | Future deleteFileWithDbData(
82 | FutureProviderRef ref, String md5, String format) async {
83 | try {
84 | String fileName = '$md5.$format';
85 | final bookStorageDirectory =
86 | await dataBase.getPreference('bookStorageDirectory');
87 | await deleteFile('$bookStorageDirectory/$fileName');
88 | await dataBase.delete(md5);
89 | await dataBase.deleteBookState(fileName);
90 | // ignore: unused_result
91 | ref.refresh(myLibraryProvider);
92 | } catch (e) {
93 | // print(e);
94 | rethrow;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/lib/services/goodreads.dart:
--------------------------------------------------------------------------------
1 | // Package imports:
2 | import 'package:dio/dio.dart';
3 | import 'package:html/parser.dart' show parse;
4 |
5 | class CategoryBookData {
6 | final String? title;
7 | final String? thumbnail;
8 | final String? link;
9 | CategoryBookData({this.title, this.thumbnail, this.link});
10 |
11 | @override
12 | bool operator ==(Object other) {
13 | if (identical(this, other)) return true;
14 | return other is CategoryBookData &&
15 | other.title == title &&
16 | other.thumbnail == thumbnail &&
17 | other.link == link;
18 | }
19 |
20 | @override
21 | int get hashCode {
22 | return title.hashCode ^ thumbnail.hashCode ^ link.hashCode; // Using XOR to combine hash codes
23 | }
24 | }
25 |
26 |
27 | String baseUrl = "https://www.goodreads.com/";
28 |
29 | class SubCategoriesTypeList {
30 | List_parser(data) {
31 | var document = parse(data.toString());
32 | var categoryList = document.querySelectorAll('.listImgs a');
33 | List categoriesBooks = [];
34 | for (var element in categoryList) {
35 | if (element.querySelector('img"]')?.attributes['title'] != null &&
36 | element.querySelector('img')?.attributes['src'] != null) {
37 | String? title = element.querySelector('img')?.attributes['title'];
38 | String? thumbnail = element.querySelector('img')?.attributes['src'];
39 | String? link = element.querySelector('a')?.attributes['herf']!;
40 | categoriesBooks.add( CategoryBookData(
41 | title: title
42 | .toString()
43 | .trim(),
44 | thumbnail: thumbnail
45 | .toString()
46 | .replaceAll("._SY75_.", "._SY225_.")
47 | .replaceAll("._SX50_.", "._SX148_."),
48 | link : link
49 | .toString(),
50 | ),
51 | );
52 | }
53 | }
54 | return categoriesBooks;
55 | }
56 |
57 | Future> categoriesBooks({required String url}) async {
58 | try {
59 | final dio = Dio();
60 | final response = await dio.get('$baseUrl$url',
61 | options: Options(
62 | sendTimeout: const Duration(seconds: 20),
63 | receiveTimeout: const Duration(seconds: 20)));
64 | final response1 = await dio.get('$baseUrl$url?page=2',
65 | options: Options(
66 | sendTimeout: const Duration(seconds: 20),
67 | receiveTimeout: const Duration(seconds: 20)));
68 | return _parser('${response.data.toString()}${response1.data.toString()}');
69 | } on DioException catch (e) {
70 | if (e.type == DioExceptionType.unknown) {
71 | throw "socketException";
72 | }
73 | rethrow;
74 | }
75 | }
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/lib/services/share_book.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 | import 'dart:typed_data';
4 | import 'dart:ui';
5 | import 'package:cached_network_image/cached_network_image.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:path_provider/path_provider.dart';
8 | import 'package:share_plus/share_plus.dart';
9 |
10 | Future shareBook(String title, String link, String path) async {
11 | try {
12 | String imagePath = await saveAndGetImagePath(path);
13 | String message = 'Discover this amazing book: "$title"\nRead more : $link';
14 | if (imagePath.isNotEmpty) {
15 | await Share.shareXFiles([XFile(imagePath)], text: message);
16 | } else {
17 | await Share.share(message);
18 | }
19 | } catch (e) {
20 | debugPrint('Error sharing the book: $e');
21 | }
22 | }
23 |
24 | Future saveAndGetImagePath(String url) async {
25 | if (url != null && url.isNotEmpty) {
26 | try {
27 | final imageProvider = CachedNetworkImageProvider(url);
28 | final imageStream = imageProvider.resolve(const ImageConfiguration());
29 | String? localFilePath;
30 |
31 | final Completer completer = Completer();
32 |
33 | imageStream.addListener(
34 | ImageStreamListener(
35 | (ImageInfo info, bool _) async {
36 | try {
37 | final ByteData? byteData =
38 | await info.image.toByteData(format: ImageByteFormat.png);
39 | if (byteData != null) {
40 | final Uint8List imageBytes = byteData.buffer.asUint8List();
41 | final Directory tempDir = await getTemporaryDirectory();
42 | final File imageFile = File('${tempDir.path}/image.jpg');
43 |
44 | await imageFile.writeAsBytes(imageBytes);
45 | localFilePath = imageFile.path;
46 | completer.complete(byteData);
47 | } else {
48 | completer.completeError('Failed to get image bytes');
49 | }
50 | } catch (e) {
51 | completer.completeError(e);
52 | }
53 | },
54 | onError: (exception, stackTrace) {
55 | completer.completeError('Failed to get image bytes');
56 | },
57 | ),
58 | );
59 | await completer.future;
60 | return localFilePath ?? "";
61 | } catch (e) {
62 | return "";
63 | }
64 | } else {
65 | return "";
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/lib/ui/about_page.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:url_launcher/url_launcher.dart';
6 |
7 | // Project imports:
8 | import 'package:openlib/ui/components/page_title_widget.dart';
9 | import 'package:openlib/ui/components/snack_bar_widget.dart';
10 |
11 | class AboutPage extends StatelessWidget {
12 | const AboutPage({super.key});
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | const version = "1.0.11";
17 |
18 | return Scaffold(
19 | appBar: AppBar(
20 | backgroundColor: Theme.of(context).colorScheme.surface,
21 | title: const Text("Openlib"),
22 | titleTextStyle: Theme.of(context).textTheme.displayLarge,
23 | ),
24 | body: const SingleChildScrollView(
25 | physics: BouncingScrollPhysics(),
26 | scrollDirection: Axis.vertical,
27 | child: Padding(
28 | padding: EdgeInsets.only(left: 5, right: 5, top: 10),
29 | child: Column(
30 | mainAxisAlignment: MainAxisAlignment.start,
31 | crossAxisAlignment: CrossAxisAlignment.start,
32 | children: [
33 | TitleText("About"),
34 | Padding(
35 | padding:
36 | EdgeInsets.only(left: 7, right: 7, top: 13, bottom: 10),
37 | child: Text(
38 | "An Open source app to download and read books from shadow library (Anna`s Archive)",
39 | style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
40 | ),
41 | ),
42 | Padding(
43 | padding: EdgeInsets.only(left: 7, right: 7, top: 10),
44 | child: Text(
45 | "Version",
46 | style: TextStyle(fontSize: 19, fontWeight: FontWeight.bold),
47 | ),
48 | ),
49 | Padding(
50 | padding: EdgeInsets.only(left: 7, right: 7, top: 5),
51 | child: Text(
52 | version,
53 | style: TextStyle(
54 | fontSize: 15,
55 | fontWeight: FontWeight.bold,
56 | color: Colors.grey),
57 | ),
58 | ),
59 | Padding(
60 | padding: EdgeInsets.only(left: 7, right: 7, top: 15),
61 | child: Text(
62 | "Github",
63 | style: TextStyle(fontSize: 19, fontWeight: FontWeight.bold),
64 | ),
65 | ),
66 | _UrlText(
67 | text: 'Open Github Page',
68 | url: 'https://github.com/dstark5/Openlib',
69 | ),
70 | _UrlText(
71 | text: 'Contribute To Openlib',
72 | url:
73 | 'https://github.com/dstark5/Openlib/blob/main/CONTRIBUTING.md'),
74 | _UrlText(
75 | text: 'Report An Issue',
76 | url: 'https://github.com/dstark5/Openlib/issues'),
77 | Padding(
78 | padding: EdgeInsets.only(left: 7, right: 7, top: 15),
79 | child: Text(
80 | "Licence",
81 | style: TextStyle(fontSize: 19, fontWeight: FontWeight.bold),
82 | ),
83 | ),
84 | _UrlText(
85 | text: "GPL v3.0 license",
86 | url: 'https://www.gnu.org/licenses/gpl-3.0.en.html'),
87 | ],
88 | ),
89 | ),
90 | ),
91 | );
92 | }
93 | }
94 |
95 | class _UrlText extends StatelessWidget {
96 | const _UrlText({required this.text, required this.url});
97 |
98 | final String url;
99 | final String text;
100 | @override
101 | Widget build(BuildContext context) {
102 | return Padding(
103 | padding: const EdgeInsets.only(left: 7, right: 7, top: 5),
104 | child: InkWell(
105 | onTap: () async {
106 | final Uri uri = Uri.parse(url);
107 | if (!await launchUrl(uri, mode: LaunchMode.externalApplication)) {
108 | // ignore: use_build_context_synchronously
109 | showSnackBar(context: context, message: 'Could not launch $uri');
110 | }
111 | },
112 | child: Row(
113 | crossAxisAlignment: CrossAxisAlignment.center,
114 | children: [
115 | Text(
116 | text,
117 | style: const TextStyle(
118 | fontSize: 15,
119 | fontWeight: FontWeight.bold,
120 | color: Colors.blueAccent,
121 | ),
122 | ),
123 | const SizedBox(
124 | width: 2,
125 | ),
126 | const Icon(
127 | Icons.launch,
128 | size: 17,
129 | color: Colors.blueAccent,
130 | )
131 | ],
132 | ),
133 | ),
134 | );
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/lib/ui/components/delete_dialog_widget.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:flutter_riverpod/flutter_riverpod.dart';
6 |
7 | // Project imports:
8 | import 'package:openlib/state/state.dart' show FileName, deleteFileFromMyLib;
9 | import 'package:openlib/ui/components/snack_bar_widget.dart';
10 |
11 | class ShowDeleteDialog extends ConsumerWidget {
12 | final String id;
13 | final String format;
14 | final Function onDelete;
15 |
16 | const ShowDeleteDialog(
17 | {super.key,
18 | required this.id,
19 | required this.format,
20 | required this.onDelete});
21 |
22 | @override
23 | Widget build(BuildContext context, WidgetRef ref) {
24 | return Stack(
25 | alignment: Alignment.center,
26 | children: [
27 | Padding(
28 | padding: const EdgeInsets.all(15.0),
29 | child: Container(
30 | width: double.infinity,
31 | height: 219,
32 | decoration: BoxDecoration(
33 | borderRadius: BorderRadius.circular(15),
34 | color: Theme.of(context).colorScheme.tertiaryContainer,
35 | ),
36 | padding: const EdgeInsets.fromLTRB(20, 50, 20, 20),
37 | child: SingleChildScrollView(
38 | child: Column(
39 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
40 | crossAxisAlignment: CrossAxisAlignment.start,
41 | children: [
42 | Padding(
43 | padding: const EdgeInsets.all(8),
44 | child: Text(
45 | "Delete Book",
46 | style: TextStyle(
47 | fontSize: 19,
48 | fontWeight: FontWeight.bold,
49 | color: Theme.of(context).colorScheme.tertiary,
50 | decoration: TextDecoration.none),
51 | ),
52 | ),
53 | Padding(
54 | padding: const EdgeInsets.all(8),
55 | child: Text(
56 | "This is permanent and cannot be undone",
57 | style: TextStyle(
58 | fontSize: 13,
59 | fontWeight: FontWeight.bold,
60 | color: Theme.of(context)
61 | .colorScheme
62 | .tertiary
63 | .withAlpha(170),
64 | decoration: TextDecoration.none),
65 | overflow: TextOverflow.ellipsis,
66 | maxLines: 2,
67 | textAlign: TextAlign.start,
68 | ),
69 | ),
70 | Padding(
71 | padding: const EdgeInsets.all(10.0),
72 | child: Row(
73 | mainAxisAlignment: MainAxisAlignment.end,
74 | children: [
75 | TextButton(
76 | style: ButtonStyle(
77 | shape: MaterialStateProperty.all(
78 | RoundedRectangleBorder(
79 | borderRadius: BorderRadius.circular(50.0),
80 | side: BorderSide(
81 | width: 3,
82 | color: Theme.of(context)
83 | .colorScheme
84 | .secondary),
85 | ),
86 | ),
87 | ),
88 | onPressed: () {
89 | ref.read(deleteFileFromMyLib(
90 | FileName(md5: id, format: format)));
91 | Navigator.of(context).pop();
92 |
93 | showSnackBar(
94 | context: context,
95 | message: 'Book has been Deleted!');
96 |
97 | onDelete();
98 | },
99 | child: Padding(
100 | padding: const EdgeInsets.all(5.0),
101 | child: Text(
102 | 'Delete',
103 | style: TextStyle(
104 | fontSize: 11,
105 | fontWeight: FontWeight.bold,
106 | color: Theme.of(context).colorScheme.tertiary,
107 | ),
108 | ),
109 | ),
110 | ),
111 | const SizedBox(
112 | width: 10,
113 | ),
114 | TextButton(
115 | style: TextButton.styleFrom(
116 | backgroundColor:
117 | Theme.of(context).colorScheme.secondary,
118 | textStyle: const TextStyle(
119 | fontSize: 11,
120 | fontWeight: FontWeight.w900,
121 | color: Colors.white,
122 | )),
123 | onPressed: () {
124 | Navigator.of(context).pop();
125 | },
126 | child: const Padding(
127 | padding: EdgeInsets.all(5.0),
128 | child: Text('Cancel'),
129 | ),
130 | )
131 | ],
132 | ),
133 | )
134 | ],
135 | ),
136 | ),
137 | ),
138 | ),
139 | ],
140 | );
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/lib/ui/components/error_widget.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:flutter_svg/svg.dart';
6 |
7 | // Project imports:
8 | import 'package:openlib/ui/extensions.dart';
9 |
10 | // ignore: must_be_immutable
11 | class CustomErrorWidget extends StatelessWidget {
12 | final Object error;
13 | final StackTrace stackTrace;
14 | VoidCallback? onRefresh;
15 |
16 | CustomErrorWidget(
17 | {super.key,
18 | required this.error,
19 | required this.stackTrace,
20 | this.onRefresh});
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | if (error.toString().contains("socketException")) {
25 | return Column(
26 | mainAxisAlignment: MainAxisAlignment.center,
27 | crossAxisAlignment: CrossAxisAlignment.stretch,
28 | children: [
29 | SizedBox(
30 | width: 200,
31 | child: SvgPicture.asset(
32 | 'assets/no_internet.svg',
33 | width: 200,
34 | ),
35 | ),
36 | const SizedBox(
37 | height: 30,
38 | ),
39 | Text(
40 | "Unable to access internet",
41 | textAlign: TextAlign.center,
42 | style: TextStyle(
43 | fontSize: 18,
44 | fontWeight: FontWeight.bold,
45 | color: "#4D4D4D".toColor(),
46 | overflow: TextOverflow.ellipsis,
47 | ),
48 | ),
49 | SizedBox(
50 | height: 80,
51 | child: FittedBox(
52 | fit: BoxFit.none,
53 | child: TextButton(
54 | style: TextButton.styleFrom(
55 | backgroundColor: Theme.of(context).colorScheme.secondary,
56 | textStyle: const TextStyle(
57 | fontSize: 13,
58 | fontWeight: FontWeight.w900,
59 | color: Colors.white,
60 | )),
61 | onPressed: onRefresh,
62 | child: const Padding(
63 | padding: EdgeInsets.fromLTRB(21, 9, 21, 9),
64 | child: Text('Refresh'),
65 | ),
66 | ),
67 | ),
68 | ),
69 | ],
70 | );
71 | } else {
72 | return SingleChildScrollView(
73 | child: Column(
74 | mainAxisAlignment: MainAxisAlignment.center,
75 | crossAxisAlignment: CrossAxisAlignment.stretch,
76 | children: [
77 | const SizedBox(
78 | height: 150,
79 | ),
80 | SizedBox(
81 | width: 200,
82 | child: SvgPicture.asset(
83 | 'assets/error_fixing_bugs.svg',
84 | width: 200,
85 | ),
86 | ),
87 | const SizedBox(
88 | height: 10,
89 | ),
90 | const Text(
91 | "Something Went Wrong!",
92 | style: TextStyle(
93 | fontSize: 18,
94 | fontWeight: FontWeight.bold,
95 | color: Colors.black,
96 | ),
97 | textAlign: TextAlign.center,
98 | ),
99 | const SizedBox(
100 | height: 30,
101 | ),
102 | Padding(
103 | padding: const EdgeInsets.fromLTRB(20, 20, 20, 5),
104 | child: Text(
105 | "Error",
106 | style: TextStyle(
107 | fontSize: 18,
108 | fontWeight: FontWeight.bold,
109 | color: Theme.of(context).colorScheme.secondary,
110 | ),
111 | textAlign: TextAlign.start,
112 | ),
113 | ),
114 | Padding(
115 | padding: const EdgeInsets.fromLTRB(20, 5, 20, 20),
116 | child: SizedBox(
117 | width: double.infinity,
118 | child: Padding(
119 | padding: const EdgeInsets.all(7.0),
120 | child: Text(
121 | error.toString(),
122 | textAlign: TextAlign.start,
123 | style: const TextStyle(
124 | fontSize: 13,
125 | fontWeight: FontWeight.bold,
126 | color: Colors.black,
127 | ),
128 | ),
129 | ),
130 | ),
131 | ),
132 | Padding(
133 | padding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
134 | child: Text(
135 | "Stack Trace",
136 | style: TextStyle(
137 | fontSize: 18,
138 | fontWeight: FontWeight.bold,
139 | color: Theme.of(context).colorScheme.secondary,
140 | ),
141 | textAlign: TextAlign.start,
142 | ),
143 | ),
144 | Padding(
145 | padding: const EdgeInsets.fromLTRB(20, 5, 20, 20),
146 | child: Container(
147 | width: double.infinity,
148 | decoration: BoxDecoration(
149 | color: const Color.fromARGB(255, 255, 186, 186),
150 | borderRadius: BorderRadius.circular(5)),
151 | child: Padding(
152 | padding: const EdgeInsets.all(7.0),
153 | child: Text(
154 | stackTrace.toString(),
155 | textAlign: TextAlign.start,
156 | style: const TextStyle(
157 | fontSize: 13,
158 | fontWeight: FontWeight.bold,
159 | color: Colors.black,
160 | ),
161 | ),
162 | ),
163 | ),
164 | )
165 | ],
166 | ),
167 | );
168 | }
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/lib/ui/components/file_buttons_widget.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:flutter_riverpod/flutter_riverpod.dart';
6 | import 'package:open_file/open_file.dart';
7 |
8 | // Project imports:
9 | import 'package:openlib/services/files.dart' show getFilePath;
10 | import 'package:openlib/ui/components/delete_dialog_widget.dart';
11 | import 'package:openlib/ui/components/snack_bar_widget.dart';
12 | import 'package:openlib/ui/epub_viewer.dart' show launchEpubViewer;
13 | import 'package:openlib/ui/pdf_viewer.dart' show launchPdfViewer;
14 |
15 | class FileOpenAndDeleteButtons extends ConsumerWidget {
16 | final String id;
17 | final String format;
18 | final Function onDelete;
19 |
20 | const FileOpenAndDeleteButtons(
21 | {super.key,
22 | required this.id,
23 | required this.format,
24 | required this.onDelete});
25 |
26 | @override
27 | Widget build(BuildContext context, WidgetRef ref) {
28 | return Padding(
29 | padding: const EdgeInsets.only(top: 21, bottom: 21),
30 | child: Row(
31 | mainAxisAlignment: MainAxisAlignment.start,
32 | crossAxisAlignment: CrossAxisAlignment.start,
33 | children: [
34 | TextButton(
35 | style: TextButton.styleFrom(
36 | backgroundColor: Theme.of(context).colorScheme.secondary,
37 | textStyle: TextStyle(
38 | fontSize: 13,
39 | fontWeight: FontWeight.w900,
40 | color: Theme.of(context).colorScheme.primary,
41 | )),
42 | onPressed: () async {
43 | if (format == 'pdf') {
44 | await launchPdfViewer(
45 | fileName: '$id.$format', context: context, ref: ref);
46 | } else if (format == 'epub') {
47 | await launchEpubViewer(
48 | fileName: '$id.$format', context: context, ref: ref);
49 | } else {
50 | await openCbrAndCbz(fileName: '$id.$format', context: context);
51 | }
52 | },
53 | child: const Padding(
54 | padding: EdgeInsets.fromLTRB(17, 8, 17, 8),
55 | child: Text('Open'),
56 | ),
57 | ),
58 | const SizedBox(
59 | width: 10,
60 | ),
61 | TextButton(
62 | style: ButtonStyle(
63 | shape: MaterialStateProperty.all(
64 | RoundedRectangleBorder(
65 | borderRadius: BorderRadius.circular(50.0),
66 | side: BorderSide(
67 | width: 3, color: Theme.of(context).colorScheme.secondary),
68 | ),
69 | ),
70 | ),
71 | onPressed: () {
72 | showDialog(
73 | context: context,
74 | barrierDismissible: false,
75 | builder: (BuildContext context) {
76 | return ShowDeleteDialog(
77 | id: id,
78 | format: format,
79 | onDelete: onDelete,
80 | );
81 | });
82 | },
83 | child: Padding(
84 | padding: const EdgeInsets.all(5.3),
85 | child: Text(
86 | 'Delete',
87 | style: TextStyle(
88 | fontSize: 13,
89 | fontWeight: FontWeight.bold,
90 | color: Theme.of(context).colorScheme.tertiary,
91 | ),
92 | ),
93 | ),
94 | ),
95 | ],
96 | ),
97 | );
98 | }
99 | }
100 |
101 | Future openCbrAndCbz(
102 | {required String fileName, required BuildContext context}) async {
103 | try {
104 | String path = await getFilePath(fileName);
105 | await OpenFile.open(path, linuxByProcess: true);
106 | } catch (e) {
107 | // ignore: avoid_print
108 | // print(e);
109 | // ignore: use_build_context_synchronously
110 | showSnackBar(context: context, message: 'Unable to open file!');
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/lib/ui/components/page_title_widget.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | class TitleText extends StatelessWidget {
5 | const TitleText(this.text, {super.key});
6 |
7 | final String text;
8 | @override
9 | Widget build(BuildContext context) {
10 | return Padding(
11 | padding: const EdgeInsets.only(left: 10, bottom: 7),
12 | child: Text(
13 | text,
14 | style: TextStyle(
15 | fontSize: 19,
16 | fontWeight: FontWeight.bold,
17 | color: Theme.of(context).colorScheme.secondary,
18 | ),
19 | ),
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib/ui/components/snack_bar_widget.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | void showSnackBar({required BuildContext context, required String message}) {
5 | ScaffoldMessenger.of(context).showSnackBar(SnackBar(
6 | content: Text(
7 | message,
8 | style: const TextStyle(
9 | fontSize: 11,
10 | fontWeight: FontWeight.bold,
11 | color: Colors.white,
12 | ),
13 | textAlign: TextAlign.center,
14 | ),
15 | // ignore: use_build_context_synchronously
16 | backgroundColor: Theme.of(context).colorScheme.secondary,
17 | width: 300,
18 | shape: const RoundedRectangleBorder(
19 | borderRadius: BorderRadius.all(Radius.circular(50))),
20 | behavior: SnackBarBehavior.floating,
21 | ));
22 | }
23 |
--------------------------------------------------------------------------------
/lib/ui/extensions.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | extension ColorExtension on String {
5 | toColor() {
6 | var hexString = this;
7 | final buffer = StringBuffer();
8 | if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
9 | buffer.write(hexString.replaceFirst('#', ''));
10 | return Color(int.parse(buffer.toString(), radix: 16));
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/lib/ui/mybook_page.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:flutter_riverpod/flutter_riverpod.dart';
6 |
7 | // Project imports:
8 | import 'package:openlib/services/database.dart';
9 | import 'package:openlib/services/share_book.dart';
10 | import 'package:openlib/ui/components/book_info_widget.dart';
11 | import 'package:openlib/ui/components/file_buttons_widget.dart';
12 |
13 | class BookPage extends StatelessWidget {
14 | const BookPage({super.key, required this.id});
15 |
16 | final String id;
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | MyLibraryDb dataBase = MyLibraryDb.instance;
21 | final bookInfo = dataBase.getId(id);
22 |
23 | return Scaffold(
24 | appBar: AppBar(
25 | backgroundColor: Theme.of(context).colorScheme.surface,
26 | title: const Text("Openlib"),
27 | titleTextStyle: Theme.of(context).textTheme.displayLarge,
28 | actions: [
29 | FutureBuilder(
30 | future: bookInfo,
31 | builder: (BuildContext context, AsyncSnapshot snapshot) {
32 | if (snapshot.hasData &&
33 | snapshot.data?.title != null &&
34 | snapshot.data?.link != null) {
35 | return IconButton(
36 | icon: Icon(
37 | Icons.share_sharp,
38 | color: Theme.of(context).colorScheme.tertiary,
39 | ),
40 | iconSize: 19.0,
41 | onPressed: () async {
42 | await shareBook(snapshot.data!.title, snapshot.data!.link,
43 | snapshot.data?.thumbnail ?? '');
44 | },
45 | );
46 | } else {
47 | return const SizedBox.shrink();
48 | }
49 | })
50 | ],
51 | ),
52 | body: Consumer(
53 | builder: (BuildContext context, WidgetRef ref, _) {
54 | return FutureBuilder(
55 | future: bookInfo,
56 | builder: (BuildContext context, AsyncSnapshot snapshot) {
57 | if (snapshot.hasData) {
58 | return BookInfoWidget(
59 | data: snapshot.data,
60 | child: FileOpenAndDeleteButtons(
61 | id: snapshot.data!.id,
62 | format: snapshot.data!.format!,
63 | onDelete: () {
64 | Navigator.of(context).pop();
65 | },
66 | ));
67 | } else if (snapshot.hasError) {
68 | return Center(
69 | child: Text(snapshot.toString()),
70 | );
71 | } else {
72 | return Center(
73 | child: SizedBox(
74 | width: 25,
75 | height: 25,
76 | child: CircularProgressIndicator(
77 | color: Theme.of(context).colorScheme.secondary,
78 | ),
79 | ));
80 | }
81 | });
82 | },
83 | ),
84 | );
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/lib/ui/mylibrary_page.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:flutter_riverpod/flutter_riverpod.dart';
6 | import 'package:flutter_svg/flutter_svg.dart';
7 |
8 | // Project imports:
9 | import 'package:openlib/state/state.dart' show myLibraryProvider;
10 | import 'package:openlib/ui/components/book_card_widget.dart';
11 | import 'package:openlib/ui/components/error_widget.dart';
12 | import 'package:openlib/ui/components/page_title_widget.dart';
13 | import 'package:openlib/ui/extensions.dart';
14 | import 'package:openlib/ui/mybook_page.dart';
15 |
16 | class MyLibraryPage extends ConsumerWidget {
17 | const MyLibraryPage({super.key});
18 |
19 | @override
20 | Widget build(BuildContext context, WidgetRef ref) {
21 | final myBooks = ref.watch(myLibraryProvider);
22 | return myBooks.when(
23 | data: (data) {
24 | if (data.isNotEmpty) {
25 | return Padding(
26 | padding: const EdgeInsets.only(left: 5, right: 5, top: 10),
27 | child: CustomScrollView(
28 | physics: const BouncingScrollPhysics(),
29 | slivers: [
30 | const SliverToBoxAdapter(
31 | child: TitleText("My Library"),
32 | ),
33 | SliverPadding(
34 | padding: const EdgeInsets.only(left: 5, right: 5, top: 10),
35 | sliver: SliverList(
36 | delegate: SliverChildListDelegate(data
37 | .map((i) => BookInfoCard(
38 | title: i.title,
39 | author: i.author ?? "",
40 | publisher: i.publisher ?? "",
41 | thumbnail: i.thumbnail,
42 | info: i.info,
43 | link: i.link,
44 | onClick: () {
45 | Navigator.push(context, MaterialPageRoute(
46 | builder: (BuildContext context) {
47 | return BookPage(id: i.id);
48 | }));
49 | }))
50 | .toList()),
51 | ),
52 | ),
53 | ],
54 | ),
55 | );
56 | } else {
57 | return Column(
58 | mainAxisAlignment: MainAxisAlignment.center,
59 | crossAxisAlignment: CrossAxisAlignment.stretch,
60 | children: [
61 | SizedBox(
62 | width: 200,
63 | child: SvgPicture.asset(
64 | 'assets/empty_mylib.svg',
65 | width: 200,
66 | ),
67 | ),
68 | const SizedBox(
69 | height: 30,
70 | ),
71 | Text(
72 | "My Library Is Empty!",
73 | textAlign: TextAlign.center,
74 | style: TextStyle(
75 | fontSize: 18,
76 | fontWeight: FontWeight.bold,
77 | color: "#4D4D4D".toColor(),
78 | overflow: TextOverflow.ellipsis,
79 | ),
80 | )
81 | ],
82 | );
83 | }
84 | },
85 | error: (error, _) {
86 | return CustomErrorWidget(error: error, stackTrace: _);
87 | },
88 | loading: () {
89 | return Center(
90 | child: SizedBox(
91 | width: 25,
92 | height: 25,
93 | child: CircularProgressIndicator(
94 | color: Theme.of(context).colorScheme.secondary,
95 | ),
96 | ));
97 | },
98 | );
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/lib/ui/results_page.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:flutter_riverpod/flutter_riverpod.dart';
6 | import 'package:flutter_svg/flutter_svg.dart';
7 |
8 | // Project imports:
9 | import 'package:openlib/state/state.dart' show searchProvider;
10 | import 'package:openlib/ui/book_info_page.dart';
11 | import 'package:openlib/ui/components/book_card_widget.dart';
12 | import 'package:openlib/ui/components/error_widget.dart';
13 | import 'package:openlib/ui/components/page_title_widget.dart';
14 | import 'package:openlib/ui/extensions.dart';
15 |
16 | class ResultPage extends ConsumerWidget {
17 | const ResultPage({super.key, required this.searchQuery});
18 |
19 | final String searchQuery;
20 |
21 | @override
22 | Widget build(BuildContext context, WidgetRef ref) {
23 | final searchBooks = ref.watch(searchProvider(searchQuery));
24 |
25 | return Scaffold(
26 | appBar: AppBar(
27 | backgroundColor: Theme.of(context).colorScheme.surface,
28 | title: const Text("Openlib"),
29 | titleTextStyle: Theme.of(context).textTheme.displayLarge,
30 | ),
31 | body: searchBooks.when(
32 | data: (data) {
33 | if (data.isNotEmpty) {
34 | return Padding(
35 | padding: const EdgeInsets.only(left: 5, right: 5, top: 10),
36 | child: CustomScrollView(
37 | slivers: [
38 | const SliverToBoxAdapter(
39 | child: TitleText("Results"),
40 | ),
41 | SliverPadding(
42 | padding: const EdgeInsets.only(left: 5, right: 5, top: 10),
43 | sliver: SliverList(
44 | delegate: SliverChildListDelegate(data
45 | .map((i) => BookInfoCard(
46 | title: i.title,
47 | author: i.author ?? "unknown",
48 | publisher: i.publisher ?? "unknown",
49 | thumbnail: i.thumbnail ?? '',
50 | info: i.info ?? '',
51 | link: i.link,
52 | onClick: () {
53 | Navigator.push(context, MaterialPageRoute(
54 | builder: (BuildContext context) {
55 | return BookInfoPage(url: i.link);
56 | }));
57 | },
58 | ))
59 | .toList()),
60 | ),
61 | ),
62 | ],
63 | ),
64 | );
65 | } else {
66 | return Column(
67 | mainAxisAlignment: MainAxisAlignment.center,
68 | crossAxisAlignment: CrossAxisAlignment.stretch,
69 | children: [
70 | SizedBox(
71 | width: 200,
72 | child: SvgPicture.asset(
73 | 'assets/no_results.svg',
74 | width: 200,
75 | ),
76 | ),
77 | const SizedBox(
78 | height: 30,
79 | ),
80 | Text(
81 | "No Results Found !",
82 | textAlign: TextAlign.center,
83 | style: TextStyle(
84 | fontSize: 18,
85 | fontWeight: FontWeight.bold,
86 | color: "#4D4D4D".toColor(),
87 | overflow: TextOverflow.ellipsis,
88 | ),
89 | )
90 | ],
91 | );
92 | }
93 | },
94 | error: (error, _) {
95 | return CustomErrorWidget(
96 | error: error,
97 | stackTrace: _,
98 | onRefresh: () {
99 | // ignore: unused_result
100 | ref.refresh(searchProvider(searchQuery));
101 | });
102 | },
103 | loading: () {
104 | return Column(
105 | mainAxisAlignment: MainAxisAlignment.start,
106 | crossAxisAlignment: CrossAxisAlignment.start,
107 | children: [
108 | const Padding(
109 | padding: EdgeInsets.only(left: 5, right: 5, top: 10),
110 | child: TitleText("Results"),
111 | ),
112 | Expanded(
113 | child: Row(
114 | mainAxisAlignment: MainAxisAlignment.center,
115 | crossAxisAlignment: CrossAxisAlignment.center,
116 | children: [
117 | Center(
118 | child: SizedBox(
119 | width: 25,
120 | height: 25,
121 | child: CircularProgressIndicator(
122 | color: Theme.of(context).colorScheme.secondary,
123 | strokeCap: StrokeCap.round,
124 | ),
125 | ))
126 | ],
127 | ),
128 | ),
129 | ],
130 | );
131 | },
132 | ),
133 | );
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/lib/ui/themes.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:google_fonts/google_fonts.dart';
6 |
7 | // Project imports:
8 | import 'package:openlib/ui/extensions.dart';
9 |
10 | final secondaryColor = '#FB0101'.toColor();
11 |
12 | ThemeData lightTheme = ThemeData(
13 | primaryColor: Colors.white,
14 | colorScheme: ColorScheme.light(
15 | primary: Colors.white,
16 | secondary: secondaryColor,
17 | tertiary: Colors.black,
18 | tertiaryContainer: '#F2F2F2'.toColor(),
19 | ),
20 | textTheme: TextTheme(
21 | displayLarge: const TextStyle(
22 | color: Colors.black,
23 | fontWeight: FontWeight.bold,
24 | fontSize: 21,
25 | ),
26 | displayMedium: const TextStyle(
27 | fontSize: 13,
28 | fontWeight: FontWeight.bold,
29 | color: Colors.black,
30 | overflow: TextOverflow.ellipsis,
31 | ),
32 | headlineMedium: TextStyle(
33 | color: "#595E60".toColor(),
34 | ),
35 | headlineSmall: TextStyle(
36 | color: "#7F7F7F".toColor(),
37 | )),
38 | fontFamily: GoogleFonts.nunito().fontFamily,
39 | useMaterial3: true,
40 | textSelectionTheme: TextSelectionThemeData(
41 | selectionColor: secondaryColor,
42 | selectionHandleColor: secondaryColor,
43 | ),
44 | );
45 |
46 | ThemeData darkTheme = ThemeData(
47 | primaryColor: Colors.black,
48 | scaffoldBackgroundColor: Colors.black,
49 | colorScheme: ColorScheme.dark(
50 | primary: Colors.black,
51 | secondary: secondaryColor,
52 | tertiary: Colors.white,
53 | tertiaryContainer: '#141414'.toColor(),
54 | surface: Colors.black,
55 | ),
56 | textTheme: TextTheme(
57 | displayLarge: const TextStyle(
58 | color: Colors.white,
59 | fontWeight: FontWeight.bold,
60 | fontSize: 21,
61 | ),
62 | displayMedium: const TextStyle(
63 | fontSize: 13,
64 | fontWeight: FontWeight.bold,
65 | color: Colors.white,
66 | overflow: TextOverflow.ellipsis,
67 | ),
68 | headlineMedium: TextStyle(
69 | color: "#F5F5F5".toColor(),
70 | ),
71 | headlineSmall: TextStyle(
72 | color: "#E8E2E2".toColor(),
73 | ),
74 | ),
75 | fontFamily: GoogleFonts.nunito().fontFamily,
76 | useMaterial3: true,
77 | textSelectionTheme: TextSelectionThemeData(
78 | selectionColor: secondaryColor,
79 | selectionHandleColor: secondaryColor,
80 | ),
81 | );
82 |
--------------------------------------------------------------------------------
/lib/ui/webview_page.dart:
--------------------------------------------------------------------------------
1 | // Flutter imports:
2 | import 'package:flutter/material.dart';
3 |
4 | // Package imports:
5 | import 'package:flutter_riverpod/flutter_riverpod.dart';
6 | import 'package:flutter_inappwebview/flutter_inappwebview.dart';
7 |
8 | class Webview extends ConsumerStatefulWidget {
9 | const Webview({super.key, required this.url});
10 | final String url;
11 | @override
12 | // ignore: library_private_types_in_public_api
13 | _WebviewState createState() => _WebviewState();
14 | }
15 |
16 | class _WebviewState extends ConsumerState {
17 | final GlobalKey webViewKey = GlobalKey();
18 |
19 | InAppWebViewController? webViewController;
20 |
21 | final urlController = TextEditingController();
22 |
23 | @override
24 | void initState() {
25 | super.initState();
26 | }
27 |
28 | @override
29 | void dispose() {
30 | super.dispose();
31 | }
32 |
33 | @override
34 | Widget build(BuildContext context) {
35 | return Scaffold(
36 | appBar: AppBar(
37 | automaticallyImplyLeading: false,
38 | title: const Text("Solve Captcha"),
39 | ),
40 | body: SafeArea(
41 | child: Column(
42 | children: [
43 | Expanded(
44 | child: Stack(
45 | children: [
46 | InAppWebView(
47 | key: webViewKey,
48 | initialUrlRequest: URLRequest(url: WebUri(widget.url)),
49 | onWebViewCreated: (controller) {
50 | webViewController = controller;
51 | },
52 | onLoadStart: (controller, url) {},
53 | onLoadStop: (controller, url) async {
54 | List bookDownloadLinks = [];
55 | if (url.toString().contains("slow_download")) {
56 | String query =
57 | """var paragraphTag=document.querySelector('p[class="mb-4 text-xl font-bold"]');var anchorTagHref=paragraphTag.querySelector('a').href;var url=()=>{return anchorTagHref};url();""";
58 | String? mirrorLink = await webViewController
59 | ?.evaluateJavascript(source: query);
60 | if (mirrorLink != null) {
61 | bookDownloadLinks.add(mirrorLink);
62 | }
63 | } else {
64 | String query =
65 | """var ipfsLinkTags=document.querySelectorAll('ul>li>a');var ipfsLinks=[];var getIpfsLinks=()=>{ipfsLinkTags.forEach(e=>{ipfsLinks.push(e.href)});return ipfsLinks};getIpfsLinks();""";
66 | List mirrorLinks = await webViewController
67 | ?.evaluateJavascript(source: query);
68 | bookDownloadLinks = mirrorLinks.cast();
69 | }
70 |
71 | if (bookDownloadLinks.isNotEmpty) {
72 | Future.delayed(const Duration(milliseconds: 70), () {
73 | // ignore: use_build_context_synchronously
74 | Navigator.pop(context, bookDownloadLinks);
75 | });
76 | }
77 | },
78 | ),
79 | ],
80 | ),
81 | ),
82 | ],
83 | ),
84 | ),
85 | );
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.10)
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 "Openlib")
8 | # The unique GTK application identifier for this application. See:
9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID
10 | set(APPLICATION_ID "com.app.openlib")
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 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58 |
59 | # Define the application target. To change its name, change BINARY_NAME above,
60 | # not the value here, or `flutter run` will no longer work.
61 | #
62 | # Any new source files that you add to the application should be added here.
63 | add_executable(${BINARY_NAME}
64 | "main.cc"
65 | "my_application.cc"
66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67 | )
68 |
69 | # Apply the standard set of build settings. This can be removed for applications
70 | # that need different build settings.
71 | apply_standard_settings(${BINARY_NAME})
72 |
73 | # Add dependency libraries. Add any application-specific dependencies here.
74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76 |
77 | # Run the Flutter tool portions of the build. This must not be removed.
78 | add_dependencies(${BINARY_NAME} flutter_assemble)
79 |
80 | # Only the install-generated bundle's copy of the executable will launch
81 | # correctly, since the resources must in the right relative locations. To avoid
82 | # people trying to run the unbundled copy, put it in a subdirectory instead of
83 | # the default top-level location.
84 | set_target_properties(${BINARY_NAME}
85 | PROPERTIES
86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87 | )
88 |
89 |
90 | # Generated plugin build rules, which manage building the plugins and adding
91 | # them to the application.
92 | include(flutter/generated_plugins.cmake)
93 |
94 |
95 | # === Installation ===
96 | # By default, "installing" just makes a relocatable bundle in the build
97 | # directory.
98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
101 | endif()
102 |
103 | # Start with a clean build bundle directory every time.
104 | install(CODE "
105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
106 | " COMPONENT Runtime)
107 |
108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
110 |
111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
112 | COMPONENT Runtime)
113 |
114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
115 | COMPONENT Runtime)
116 |
117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
118 | COMPONENT Runtime)
119 |
120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
121 | install(FILES "${bundled_library}"
122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
123 | COMPONENT Runtime)
124 | endforeach(bundled_library)
125 |
126 | # Fully re-copy the assets directory on each build to avoid having stale files
127 | # from a previous install.
128 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
129 | install(CODE "
130 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
131 | " COMPONENT Runtime)
132 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
133 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
134 |
135 | # Install the AOT library on non-Debug builds only.
136 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
137 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
138 | COMPONENT Runtime)
139 | endif()
140 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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) open_file_linux_registrar =
14 | fl_plugin_registry_get_registrar_for_plugin(registry, "OpenFileLinuxPlugin");
15 | open_file_linux_plugin_register_with_registrar(open_file_linux_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_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 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | open_file_linux
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 |
--------------------------------------------------------------------------------
/linux/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 |
--------------------------------------------------------------------------------
/linux/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, "libgen");
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, "libgen");
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 GObject::dispose.
85 | static void my_application_dispose(GObject* object) {
86 | MyApplication* self = MY_APPLICATION(object);
87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
89 | }
90 |
91 | static void my_application_class_init(MyApplicationClass* klass) {
92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95 | }
96 |
97 | static void my_application_init(MyApplication* self) {}
98 |
99 | MyApplication* my_application_new() {
100 | return MY_APPLICATION(g_object_new(my_application_get_type(),
101 | "application-id", APPLICATION_ID,
102 | "flags", G_APPLICATION_NON_UNIQUE,
103 | nullptr));
104 | }
105 |
--------------------------------------------------------------------------------
/linux/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 |
--------------------------------------------------------------------------------
/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import device_info_plus
9 | import flutter_inappwebview_macos
10 | import open_file_mac
11 | import path_provider_foundation
12 | import share_plus
13 | import sqflite_darwin
14 | import url_launcher_macos
15 |
16 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
17 | DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
18 | InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
19 | OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
20 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
21 | SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
22 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
23 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
24 | }
25 |
--------------------------------------------------------------------------------
/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.14'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | target 'RunnerTests' do
35 | inherit! :search_paths
36 | end
37 | end
38 |
39 | post_install do |installer|
40 | installer.pods_project.targets.each do |target|
41 | flutter_additional_macos_build_settings(target)
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/macos/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - device_info_plus (0.0.1):
3 | - FlutterMacOS
4 | - flutter_inappwebview_macos (0.0.1):
5 | - FlutterMacOS
6 | - OrderedSet (~> 5.0)
7 | - FlutterMacOS (1.0.0)
8 | - open_file_mac (0.0.1):
9 | - FlutterMacOS
10 | - OrderedSet (5.0.0)
11 | - path_provider_foundation (0.0.1):
12 | - Flutter
13 | - FlutterMacOS
14 | - sqflite (0.0.3):
15 | - Flutter
16 | - FlutterMacOS
17 | - url_launcher_macos (0.0.1):
18 | - FlutterMacOS
19 |
20 | DEPENDENCIES:
21 | - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
22 | - flutter_inappwebview_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos`)
23 | - FlutterMacOS (from `Flutter/ephemeral`)
24 | - open_file_mac (from `Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos`)
25 | - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
26 | - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
27 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
28 |
29 | SPEC REPOS:
30 | trunk:
31 | - OrderedSet
32 |
33 | EXTERNAL SOURCES:
34 | device_info_plus:
35 | :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos
36 | flutter_inappwebview_macos:
37 | :path: Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos
38 | FlutterMacOS:
39 | :path: Flutter/ephemeral
40 | open_file_mac:
41 | :path: Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos
42 | path_provider_foundation:
43 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
44 | sqflite:
45 | :path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin
46 | url_launcher_macos:
47 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
48 |
49 | SPEC CHECKSUMS:
50 | device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
51 | flutter_inappwebview_macos: 9600c9df9fdb346aaa8933812009f8d94304203d
52 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
53 | open_file_mac: 0e554648e2a87ce59e9438e3e5ca3e552e90d89a
54 | OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
55 | path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
56 | sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
57 | url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
58 |
59 | PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367
60 |
61 | COCOAPODS: 1.15.2
62 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
63 |
65 |
71 |
72 |
73 |
74 |
80 |
82 |
88 |
89 |
90 |
91 |
93 |
94 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/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 = Openlib;
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.app.openlib;
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | com.apple.security.network.client
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.network.client
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/macos/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import FlutterMacOS
2 | import Cocoa
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 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: openlib
2 | description: An Open source app to download and read books from shadow library (Anna`s Archive)
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.11+14
20 |
21 | environment:
22 | sdk: ">=3.3.0 <4.0.0"
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_riverpod: ^2.3.6
34 |
35 | google_nav_bar: ^5.0.6
36 |
37 | flutter_pdfview: ^1.2.7
38 | epub_view: ^3.2.0
39 | vocsy_epub_viewer: ^3.0.0
40 | # syncfusion_flutter_pdfviewer: ^22.2.5
41 | # pdfx: ^2.4.0
42 |
43 | dio: ^5.4.0
44 | html: ^0.15.4
45 |
46 | sqflite: ^2.3.0
47 | path_provider: ^2.0.15
48 | permission_handler: ^11.2.0
49 | open_file: ^3.3.2
50 |
51 | flutter_svg: ^2.0.7
52 | google_fonts: ^6.1.0
53 |
54 | cached_network_image: 3.3.0
55 |
56 | sqflite_common_ffi: ^2.3.0+2
57 | url_launcher: ^6.1.12
58 | # The following adds the Cupertino Icons font to your application.
59 | # Use with the CupertinoIcons class for iOS style icons.
60 | cupertino_icons: ^1.0.2
61 | dev: ^1.0.0
62 | crypto: ^3.0.3
63 | file_picker: ^8.1.2
64 | device_info_plus: ^10.1.2
65 | flutter_inappwebview: ^6.0.0
66 | http: ^1.2.2
67 | path: ^1.9.0
68 | share_plus: ^10.1.0
69 |
70 | dev_dependencies:
71 | import_sorter: ^4.6.0
72 | flutter_test:
73 | sdk: flutter
74 |
75 | flutter_launcher_icons: ^0.11.0
76 | # The "flutter_lints" package below contains a set of recommended lints to
77 | # encourage good coding practices. The lint set provided by the package is
78 | # activated in the `analysis_options.yaml` file located at the root of your
79 | # package. See that file for information about deactivating specific lint
80 | # rules and activating additional ones.
81 | flutter_lints: ^3.0.1
82 |
83 | flutter_icons:
84 | android: "launcher_icon"
85 | ios: true
86 | image_path: "assets/icons/appIcon.png"
87 |
88 | # For information on the generic Dart part of this file, see the
89 | # following page: https://dart.dev/tools/pub/pubspec
90 |
91 | # The following section is specific to Flutter packages.
92 | flutter:
93 | # The following line ensures that the Material Icons font is
94 | # included with your application, so that you can use the icons in
95 | # the material Icons class.
96 | uses-material-design: true
97 |
98 | # To add assets to your application, add an assets section, like this:
99 | # assets:
100 | # - images/a_dot_burr.jpeg
101 | # - images/a_dot_ham.jpeg
102 |
103 | assets:
104 | - assets/
105 | - google_fonts/
106 | # An image asset can refer to one or more resolution-specific "variants", see
107 | # https://flutter.dev/assets-and-images/#resolution-aware
108 |
109 | # For details regarding adding assets from package dependencies, see
110 | # https://flutter.dev/assets-and-images/#from-packages
111 |
112 | # To add custom fonts to your application, add a fonts section here,
113 | # in this "flutter" section. Each entry in this list should have a
114 | # "family" key with the font family name, and a "fonts" key with a
115 | # list giving the asset and other descriptors for the font. For
116 | # example:
117 | # fonts:
118 | # - family: Schyler
119 | # fonts:
120 | # - asset: fonts/Schyler-Regular.ttf
121 | # - asset: fonts/Schyler-Italic.ttf
122 | # style: italic
123 | # - family: Trajan Pro
124 | # fonts:
125 | # - asset: fonts/TrajanPro.ttf
126 | # - asset: fonts/TrajanPro_Bold.ttf
127 | # weight: 700
128 | #
129 | # For details regarding fonts from package dependencies,
130 | # see https://flutter.dev/custom-fonts/#from-packages
131 |
--------------------------------------------------------------------------------
/screenshots/Screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_1.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_2.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_3.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_4.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_5.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_6.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_7.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/screenshots/Screenshot_8.png
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | // Flutter imports:
9 | import 'package:flutter/material.dart';
10 |
11 | // Package imports:
12 | import 'package:flutter_test/flutter_test.dart';
13 |
14 | // Project imports:
15 | import 'package:openlib/main.dart';
16 |
17 | void main() {
18 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
19 | // Build our app and trigger a frame.
20 | await tester.pumpWidget(const MyApp());
21 |
22 | // Verify that our counter starts at 0.
23 | expect(find.text('0'), findsOneWidget);
24 | expect(find.text('1'), findsNothing);
25 |
26 | // Tap the '+' icon and trigger a frame.
27 | await tester.tap(find.byIcon(Icons.add));
28 | await tester.pump();
29 |
30 | // Verify that our counter has incremented.
31 | expect(find.text('0'), findsNothing);
32 | expect(find.text('1'), findsOneWidget);
33 | });
34 | }
35 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/web/favicon.png
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Openlib
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "libgen",
3 | "short_name": "libgen",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A Flutter app for library genesis.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(libgen 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 "libgen")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
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 | # Fully re-copy the assets directory on each build to avoid having stale files
91 | # from a previous install.
92 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
93 | install(CODE "
94 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
95 | " COMPONENT Runtime)
96 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
97 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
98 |
99 | # Install the AOT library on non-Debug builds only.
100 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
101 | CONFIGURATIONS Profile;Release
102 | COMPONENT Runtime)
103 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
14 | void RegisterPlugins(flutter::PluginRegistry* registry) {
15 | FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar(
16 | registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi"));
17 | PermissionHandlerWindowsPluginRegisterWithRegistrar(
18 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
19 | SharePlusWindowsPluginCApiRegisterWithRegistrar(
20 | registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
21 | UrlLauncherWindowsRegisterWithRegistrar(
22 | registry->GetRegistrarForPlugin("UrlLauncherWindows"));
23 | }
24 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | flutter_inappwebview_windows
7 | permission_handler_windows
8 | share_plus
9 | url_launcher_windows
10 | )
11 |
12 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
13 | )
14 |
15 | set(PLUGIN_BUNDLED_LIBRARIES)
16 |
17 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
18 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
19 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
21 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
22 | endforeach(plugin)
23 |
24 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
25 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
26 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
27 | endforeach(ffi_plugin)
28 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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", "com.example" "\0"
93 | VALUE "FileDescription", "Openlib" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "Openlib" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "libgen.exe" "\0"
98 | VALUE "ProductName", "Openlib" "\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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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"libgen", 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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstark5/Openlib/a7b38023bfea87cd847381d43295ebab5fd44c50/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/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 | 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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------