Compare commits

...

144 Commits

Author SHA1 Message Date
Rajarshee Chatterjee 49e4d78c92 chore: Update translations (#569)
* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]
2023-04-06 21:54:50 +05:30
r1di c88b2e5d2a feat: extending Volume button feature, by scroll amount (#587)
Closes #447 

* Main
Added volume button scroll amount

* Volume button scroll amount

---------

Co-authored-by: Ridi <Ridi>
2023-04-06 20:42:36 +05:30
Rider21 be2dab5b5d feat: Add New Sources (#583)
* fix

* Update ranobelib.js

* fix

* test

* fix

* fix path

* test

* added sources

* added ALL sources on novel.tl

* add tags

* Update NovelTlScraper.js

* fix
2023-03-30 13:19:00 +05:30
Jaydeep Patel 2d986f263d feat: Add custom Javascript (Closes #572) (#575)
feat: Add custom Javascript
2023-03-11 11:52:16 +05:30
Rajarshee Chatterjee 684463754c chore: Update translations (#546)
* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]
2023-03-05 12:08:28 +05:30
Rajarshee Chatterjee 6879d77ef1 feat: Add Last Updated Sort (Closes #482) 2023-03-05 11:56:02 +05:30
Rajarshee Chatterjee 41ed198a1d refactor: Remove totalPages 2023-03-05 11:39:52 +05:30
Rajarshee Chatterjee 550e116be5 feat: Add Chapter Name Sort (Closes #525) 2023-03-05 11:12:43 +05:30
Rajarshee Chatterjee 1c21c180ab refactor: Tweak Updates Card 2023-03-05 11:08:53 +05:30
nyagami 08860c0715 fix: Minor Fixes and Optimizations (#566)
Closes #557
2023-03-05 09:43:00 +05:30
K1ngfish3r d65170c85a Minor: prerequisites/build cmd to CONTRIBUTING.md (#565)
* Minor: prerequisites/build cmd to CONTRIBUTING.md

* switch npm start under developing section

* link CONTRIBUTING.md in README.md

* make clearer
2023-03-01 14:30:39 +05:30
Patrick Loser cf19eb6892 feat: Collapsible Updates and Downloads (#562)
* implemented extendable list for updates

* finished creating extendable list (buggy deleteChapter)

* fixed downloadbutton bug

* fixed ts problems

* set navigatetonovel to onLongPress

* removed

* key fixes

* implemented extendable list for updates

* finished creating extendable list (buggy deleteChapter)

* fixed downloadbutton bug

* fixed ts problems

* set navigatetonovel to onLongPress

* removed

* key fixes

* translation strings

* single chapter + style updates

* removed test method
2023-03-01 14:29:48 +05:30
nyagami 3289f357d9 refactor: Downloading Images Logic (#554)
* default language for browse source.
To test this. please clear all all app data

* fix: for some reason, locale from expo is uncorrect

* bypass some sites with referer in header.

* update logic for loading img on reader.
some sources should have headers when fetch image data

* minor fix

* fix warning: 2 childs have the same key

* fix(download): Download chapter image fixes

- Saving images in binary form, not utf-8 base64 so that gallery etc can see them
- Downloads work with new WebViewReader's image loading features
- Added loading icons when images are loading asynchronusely

* fix(dq.ts): DownloadQueries type

* fix(img): remove delayed-src from downloaded imgs

* fix(download): Fix promise rejection and css issue

- Fix promise rejection when trying to overwrite image file (shouldn't happen in production, but it miraculously did in dev)
- Fix CSS class 'loadIcon' not being applied to downladed chapter image loader icons and loader spinners not spinning
- Made loader spinners smaller. Now they look "a bit better" (according to my friend whom I showed the spinners)

* fix(loadimg): Change loadImage to smaller one

* fix(loadImg): change the class to load-img

* minor fix

* fix hako source: popular novels and novel cover

* update sendHeight logic

---------

Co-authored-by: SkillGG <skilletssgames@gmail.com>
2023-02-26 13:15:13 +05:30
K1ngfish3r fe2b2524a7 feat(source): Add Pawread (#561)
Closes LNReader/lnreader-sources#439
2023-02-23 07:40:27 +05:30
Patrick Loser 2e4ff916aa fix(source): Foxaholic (#563) 2023-02-23 07:38:38 +05:30
K1ngfish3r b40e9331d7 fix(source): SakuraNovel (#560)
Closes LNReader/lnreader-sources#456
2023-02-22 10:05:45 +05:30
Rajarshee Chatterjee 84a2561c41 Minor Fixes 2023-02-18 14:02:04 +05:30
K1ngfish3r 929bd2c97d feat(source): Add New multiSrc WQMangaStreamScraper & PandaMtl (#552)
Closes #LNReader/lnreader-sources#453
2023-02-18 09:00:20 +05:30
Rajarshee Chatterjee 9028a82318 Minor Fix 2023-02-17 23:22:17 +05:30
Rajarshee Chatterjee c6c41a2d1b Cleanup 2023-02-17 22:59:20 +05:30
Nyagami 9a0c08e7b8 refactor: Remove Swipe Margins (#553)
* refactor swipeGesture, remove swipeMargin

* trying to resolve conflict

* again :(

* cleanup
2023-02-17 22:21:17 +05:30
Patrick Loser 0abdff25eb feat: Add Settings and Translations (#548)
* started setting repositioning

* started setting repositioning

* added novel badges and sort to general + some js to ts

* translations General

* readersettingsscreen + fix font style selection in Bottomsheet

* started setting repositioning

* added novel badges and sort to general + some js to ts

* translations General

* readersettingsscreen + fix font style selection in Bottomsheet

* update

* ts map

* small fix
2023-02-17 21:39:30 +05:30
Patrick Loser f238b20f6d fix: Cleanup Sources (#545)
* removed Asada Translation (dead)

* update boxnovel.online to cratenovel

* fixed Daonovel

* updated fastnovel.net to fastnovel.org

* removed JPMTL (dead)

* removed Kisslightnovels (dead)

* removed Asada Translation (dead)

* update boxnovel.online to cratenovel

* fixed Daonovel

* updated fastnovel.net to fastnovel.org

* removed JPMTL (dead)

* removed Kisslightnovels (dead)

* update latestnovel to lightnovelfull (Doesn't work since there are multiple pages and can't find source API)

* fixed LightNovelReader search and metadata

* added ts-ignore to sourceManager

* removed LightNovelsHub (dead)

* fixed lnmtl metadata

* update mtnovel to novelfull.net

* fixed MTL-Novel

* removed MTL-Corner (dead)

* fixed mylovenovel

* removed NovelCake (dead)

* removed NovelOwl (is lightnovelfull.com)

* removed NovelPassion (dead)

* removed NovelsCafe (dead)

* removed NovelsRock (dead)

* removed noveltrench (dead)

* fixed novelupdatescc partly (can't open Novel)

* fixed OnlyMTL

* tried fix still broken but lists some novels

* removed SkyNovel (dead)

* changed scraping page of wuxiacity

* removed wuxiaworldcloud (dead)

* fixed wuxiaworld.site

* removed wuxiaworldsite (broken website)

* removed Asada Translation (dead)

* update boxnovel.online to cratenovel

* fixed Daonovel

* updated fastnovel.net to fastnovel.org

* removed JPMTL (dead)

* removed Kisslightnovels (dead)

* update latestnovel to lightnovelfull (Doesn't work since there are multiple pages and can't find source API)

* fixed LightNovelReader search and metadata

* added ts-ignore to sourceManager

* removed LightNovelsHub (dead)

* fixed lnmtl metadata

* update mtnovel to novelfull.net

* fixed MTL-Novel

* removed MTL-Corner (dead)

* fixed mylovenovel

* removed NovelCake (dead)

* removed NovelOwl (is lightnovelfull.com)

* removed NovelPassion (dead)

* removed NovelsCafe (dead)

* removed NovelsRock (dead)

* removed noveltrench (dead)

* fixed novelupdatescc partly (can't open Novel)

* fixed OnlyMTL

* tried fix still broken but lists some novels

* removed SkyNovel (dead)

* changed scraping page of wuxiacity

* removed wuxiaworldcloud (dead)

* fixed wuxiaworld.site

* removed wuxiaworldsite (broken website)

* fixed errors

* removed readfreenovel (without js list only kidsbooks and crashes the app)

* small change
2023-02-17 16:40:05 +05:30
Nyagami cc9022cf12 fix: App Crashing when Deleting Downloaded Chapter (#549)
* fix: app crashes when deleting downloaded chapter

* fix lint
2023-02-17 09:23:05 +05:30
Rajarshee Chatterjee fbadd41733 Minor Fix 2023-02-17 09:19:57 +05:30
Rajarshee Chatterjee c30b884428 refactor: Replace lodash with lodash-es 2023-02-17 09:17:28 +05:30
dependabot[bot] 8fc9e04d97 chore(deps): bump @sideway/formula from 3.0.0 to 3.0.1 (#532)
Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/sideway/formula/releases)
- [Commits](https://github.com/sideway/formula/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: "@sideway/formula"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 09:00:44 +05:30
dependabot[bot] 84bc83b7a2 chore(deps): bump ua-parser-js from 0.7.31 to 0.7.33 (#519)
Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.31 to 0.7.33.
- [Release notes](https://github.com/faisalman/ua-parser-js/releases)
- [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md)
- [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.31...0.7.33)

---
updated-dependencies:
- dependency-name: ua-parser-js
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 09:00:36 +05:30
dependabot[bot] 2bb0c28591 chore(deps): bump minimatch from 3.0.4 to 3.1.2 (#469)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 09:00:09 +05:30
dependabot[bot] 52ae111e98 chore(deps): bump @xmldom/xmldom from 0.7.5 to 0.7.9 (#491)
Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.7.5 to 0.7.9.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.7.5...0.7.9)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 08:59:51 +05:30
dependabot[bot] ecd383b586 chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (#490)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-17 08:59:41 +05:30
Rajarshee Chatterjee 606b2c8f12 Cleanup 2023-02-17 08:55:36 +05:30
Nyagami d9bbae444a refactor: Remove Text Reader (#538)
* auto scroll using saved position.
not using currentScroll cause it maybe baka sometimes

* merge 2 navigate chapter function

* merge text and web scroll. enable scrollToTop for web

* seekbar display better after sliding

* minor fix

* trying to remove wvUseNewSwipes var

* Starting remove TextView.
Firstly, always use WebView

* remove useWebViewForChapter var

* remove TextView related thing

* scroll to save position when layout on

* always scroll with mooth mode

* no need scrollview

* move volume scroll effect

* complete the removal

* Better logic for volumeButton.
change state name

* also rename showsipemargins state

* drawerSwipe doesnt support webview.
So maybe re-implement if it supports one day

* update logic for autoScroll

* wrap useCallback for saveProgress

* only position state is enough

* remove reset progree in mark as read action

* mini fix for volumebutton. rename state variables

* fix bug on volumeButton.
2023-02-17 05:08:16 +05:30
K1ngfish3r 2e9a7adc2c fix(source): Add Author and Status for WPMangaStreamScraper (#547)
Closes LNReader/lnreader-sources#444
2023-02-17 04:57:59 +05:30
K1ngfish3r 63909bf52e fix(source): Update WPMangaStreamScraper's Cover Selector (#543)
* fixes images on noblemtl

* fix images on noblemtl

* fix ESLint errors
2023-02-15 23:18:58 +05:30
Vigneshwar M 8fe1dacab0 feat(source): Add Agitoon (#542)
* add: kr sources

* add: latest/popular novels

* bug: parseNovelAndChapters()

* fix: parse parseNovelAndChapters bug and add: parseChapter

* add: search feature

* add: popular gets the popular list of the current day; refactor

* fix: 'chapterId doesnt exist'

* fix: reverted back the package-lock.json file

---------

Co-authored-by: Vigneshwar M <vigneshwarm@Vigneshwars-MacBook-Pro.local>
2023-02-15 22:39:20 +05:30
Rajarshee Chatterjee a193656cb2 Update Crowdin configuration file 2023-02-15 09:53:55 +05:30
Rajarshee Chatterjee ed23040287 chore: Update Translation Locales 2023-02-15 09:48:11 +05:30
Rajarshee Chatterjee c9d834a2f0 chore: Update translations (#521)
* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]
2023-02-14 15:21:32 +05:30
Nyagami 7faabc5d9c fix: Update Seekbar Position Logic (#535)
* fix slider displays uncorrectly, rearrange seekbar props

* Removal contensize variable, using math to solve.
Also need percen of device height as float.
Format readerscreen.js easilier to read (at least for me :>)

* set loadding when "scroll to" is unnecessary

* enable scroll even on loading (no making re-rerender)

* add attributes to chapter element for custom css

* shorten variable name. remove unuse function

* seekbar display more correctly for webview.
removal duplicate var

* trying to removal webViewScroll state

* Seekbar should work properly.
Need to implement save position.
And sync TextView and WebView

* just rearrange props to make easier for handling

* using state currentScroll instead of scrollPercentage

* share offsetY between text and web view.
Still issue when turn back from web to text. It cant scroll back.

* this should work well, unless users touch so fast

* clean up code

* use Promise.all instead

* the same logic but shoten code

* not saving croll when closing layout
2023-02-14 15:19:43 +05:30
Rajarshee Chatterjee 330abf25d7 fix(source): Add reverseChapters Option in WPMangaStreamScraper 2023-02-14 15:15:51 +05:30
Rajarshee Chatterjee d75ef3f444 feat(source): Add NobleMtl
Closes LNReader/lnreader-sources #409
2023-02-13 09:42:49 +05:30
Rajarshee Chatterjee 6e665dabf4 fix(source): Add sourceId in WPMangaStreamScraper 2023-02-13 09:42:49 +05:30
Nyagami 12b83f4de7 fix: Simplify TTS Logic to Prevent Freezing the App (#530)
* simply tts to prevent it freezes the app

* ensure tts uses the chapter text. correct spelling
2023-02-09 13:07:43 +05:30
Rajarshee Chatterjee 518f73f6fd Update README.md 2023-01-31 07:49:45 +05:30
Rajarshee Chatterjee cab9a83dc0 Release v1.1.14 2023-01-29 20:53:08 +05:30
Rajarshee Chatterjee 934798809d Minor Fixes 2023-01-29 20:45:49 +05:30
Rajarshee Chatterjee 4ceacdf324 fix(source): IndoWebNovel
Closes LNReader/lnreader-sources#405
2023-01-29 18:24:13 +05:30
Rajarshee Chatterjee 650ed2ff67 Minor Fixes 2023-01-29 18:22:30 +05:30
Rajarshee Chatterjee c38fc3232e chore: Update translations (#493)
* New translations strings.json (French)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Chinese Simplified)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]
2023-01-29 17:11:26 +05:30
Rajarshee Chatterjee f109c5747e fix: Fix Lint 2023-01-29 17:09:07 +05:30
Rajarshee Chatterjee 79b4db0cd2 fix: Reader Settings Screen Crash (Closes #322) 2023-01-29 17:05:11 +05:30
Rajarshee Chatterjee 8858ea3d94 fix(source): Minor Fixes 2023-01-29 17:03:59 +05:30
Rajarshee Chatterjee dea534557e fix(source): Ranobes
Closes LNReader/lnreader-sources#435
2023-01-29 16:20:08 +05:30
Rajarshee Chatterjee 0b112d9465 Minor Fixes 2023-01-29 16:09:00 +05:30
Rajarshee Chatterjee ddb8cd402a refactor: Use Batch Queries 2023-01-29 15:14:00 +05:30
Rajarshee Chatterjee 172145278f feat: Bypass Cloudflare
Closes LNReader/lnreader-sources#146
Closes LNReader/lnreader-sources#172
Closes LNReader/lnreader-sources#150
Closes LNReader/lnreader-sources#319
Closes LNReader/lnreader-sources#397
Closes LNReader/lnreader-sources#404
Closes LNReader/lnreader-sources#406
Closes LNReader/lnreader-sources#407
Closes LNReader/lnreader-sources#411
2023-01-29 14:53:42 +05:30
Rider21 7acb63e0f0 fix(source): Jaomix (#520)
* fix

* Update jaomix.js
2023-01-29 10:56:54 +05:30
Patrick Loser deefc10d41 feat: New Bottom Sheet Package (#515)
* setup

* implemented new bottomsheets

* set containerHeight

* NovelBottomSheet fix

* fixed BottomInsets

* edited FilterBottomSheet + cleanup

* TrackSheet + cleanup

* removal of rn-sliding-up-panel

Closes #506
2023-01-13 05:02:45 +05:30
Patrick Loser 7880cd0187 fix: Bottom Navbar Icon Color (#513)
* fixed library button color

* changed to onSecondaryContainer
2023-01-13 04:56:15 +05:30
Patrick Loser 9a594c4dd3 feat: Skeleton Loading Screens (#510)
* CategorySkeletonLoading

* getLoadingColors

* UpdatesSkeletonLoading

* Loading for Migrate

* HistorySkeletonLoading

* HistoryScreen fix

* HistoryScreen fix

* GlobalSearchLoading name change

* SourceScreenSkeletonLoading + implementation in Library + set unread fix

* set SkeletonLoading for LoadingMoreIndicator

* ESLint fix
2023-01-11 06:52:53 +05:30
Rajarshee Chatterjee 11a32d6776 fix: Mark Chapter as Read on TTS Finish (Closes #466) 2022-12-30 10:36:11 +05:30
Rajarshee Chatterjee 49e4e87f9e feat: Add Error Boundary 2022-12-30 10:28:54 +05:30
Rajarshee Chatterjee 1d0d7be968 Minor Fixes 2022-12-30 10:20:59 +05:30
Patrick Loser 06c5efd3a6 feat: Skeleton Loading Screens (#504)
* chapter drawer themed textcolor

* started with skeleton loading

* added new package

* added way to adebt to reader styles

* MAL loading

* type fix

* SourceScreenLoading

* NovelScreenLoading

* ESLint fix

* cleanup

* resolved conflict

* GlobalSearchLoading

Co-authored-by: Patrick <patrick.los@proton.me>
2022-12-28 13:20:44 +05:30
Patrick Loser 6d67c67d5f feat: Animated Splashscreen (#499)
* chapter drawer themed textcolor

* animated splashscreen

* added lotti animation

* splashscreen centered

* upgrade to android sdk 31

* reverted sdk changes

* fixed unstyled bars

* fixed animation

Co-authored-by: Patrick <patrick.los@proton.me>
2022-12-22 16:03:49 +05:30
Patrick Loser e559824718 feat: FAB for Last Read Chapter in Library (#500)
* chapter drawer themed textcolor

* added FAB to Library screen + some insets

* Added Settings butten

Co-authored-by: Patrick <patrick.los@proton.me>
2022-12-20 21:39:30 +05:30
Patrick Loser 2aaedfcfbf feat: Adaptive Icon (#497)
Closes #475

Co-authored-by: Patrick <patrick.los@proton.me>
2022-12-18 21:26:44 +05:30
Rajarshee Chatterjee 4cbd52a369 fix: Tweak Jump to Modal UI 2022-12-10 18:55:55 +05:30
Patrick Loser 87a42d2766 fix: Chapter Drawer Themed Text Color (#492)
Co-authored-by: Patrick <patrick.los@proton.me>
2022-12-10 17:08:22 +05:30
Patrick Loser 1453c39fc3 feat: Jump to Chapter Modal Redesign (#486)
* start up

* started to change jumpToChapterModal

* finished JumpToChapterModal redesign

* delete of results and no result if no text

* edited listElement width

* reverted (automatic) changes in package-lock and build.gradle

* design changes & bugfixes

* added translations

Co-authored-by: Patrick <patrick.los@proton.me>

Closes #472
2022-12-10 16:36:46 +05:30
Rajarshee Chatterjee eccb84b4a3 chore: Update translations (#448)
* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (French)
[ci skip]
2022-12-10 10:18:57 +05:30
Rajarshee Chatterjee 3d69f46b44 fix: Minor Fixes 2022-12-10 10:09:55 +05:30
Rajarshee Chatterjee cc94bbd152 fix: Tweak Chapter Drawer UI 2022-12-10 09:34:29 +05:30
Patrick Loser 599224a5d4 feat: Chapter Drawer (#485)
* start up

* started with the implementation of chapter_Drawer

* changed data transer via route and the navigation between chapters

* changed ReadButton and butten at the end of chapter

* changed ReadButton and butten at the end of chapter

* changed ReadButton and butten at the end of chapter

* worked on behaviour, added buttons and styled

* fixed Buttons

* highlighted current chapter

* fixed bug caused of fast scrolling

* Changed Padding/Margin Behaviour of WebViewReader for Drawer to work properly

* fixed gradients in chapter list

* changed GestureRecognizer back

* shorted given props at chapter change

* fixed and changed scroll behaviour

* added Translation

* Changed drawer chapter naming

* review

* added chapterDrawer setting

* unessecary

* swipe optional for normal ReaderScreen, impossible for WebView, openDrawerButton in the middle of footer

* changed setting name "chapterDrawer" to "useChapterDrawerSwipeNavigation"

* put useNovel Hook in chapterDrawer and reverted navigate functions

* reverted changes from original ReaderScreen line 356-359

* removed Chapter transformation

* fixed switch between chapters and mistake in switch

* unified nacigation Params + changed name and location of handleNavigateChapterParams

* fixed loading problems from other screens than Novel and added LoadingScreenV2

Co-authored-by: Patrick <patrick.los@proton.me>
Co-authored-by: Patrick Loser <69157453+AustriaGamer@users.noreply.github.com>
2022-12-10 08:39:43 +05:30
Rajarshee Chatterjee 70a22518be fix(source): NovelUpdates: Add WordPress Selector
Closes LNReader/lnreader-sources#412
2022-12-09 21:15:29 +05:30
Rajarshee Chatterjee 900a569886 fix(source): NovelRingan: Remove Duplicated Chapter Text
Closes LNReader/lnreader-sources#414
2022-12-09 10:44:19 +05:30
Rajarshee Chatterjee 6e851eed94 fix(source): ReadLightNovel Search
Closes LNReader/lnreader-sources#371
2022-12-09 10:27:17 +05:30
Rajarshee Chatterjee a2ceba9019 fix(source): ReinoWuxia
Closes LNReader/lnreader-sources#186
2022-12-09 10:11:29 +05:30
Rajarshee Chatterjee 412f216bf5 fix(source): ReadNovelFull
Closes LNReader/lnreader-sources#325
2022-12-09 09:58:09 +05:30
dependabot[bot] 1e2dddf46c chore(deps): bump qs from 6.10.1 to 6.10.3 (#488)
Bumps [qs](https://github.com/ljharb/qs) from 6.10.1 to 6.10.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.10.1...v6.10.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-08 09:10:30 +05:30
Rider21 3e526658bf fix(source): Ranobes (#489) 2022-12-07 09:22:59 +05:30
Rider21 15cdeb30ad fix(source): Update Rulate (#483)
update
2022-12-02 07:03:47 +05:30
Marcin Majewski 3cb573681f fix(delete_chapter): Excessive number of pending callbacks warn (#481)
* fix(delete_chapter): fix delete all not working

Sometimes there would be "Excessive number of pending callbacks" warn shown.
Removing chapters in batches of 10 (I tried 30 but it was still an issue) seems to work fine now.
TODO: Add some icon about deletion status and make it not lag the entire app.

* fix(delete_chapter): always-coccurent deletion

Make deleting chapters do 3 coccurent deletion at a time making it work similarly to bluebird's `Promise.map(,{coccurent:3})` and removing the `Excessive number of pending callbacks` warn gone.

* Remove unnecesarry console.log
2022-11-26 06:48:53 +05:30
Rajarshee Chatterjee 383c8f791b fix: Stats Screen Fixes 2022-11-05 23:13:02 +05:30
Rajarshee Chatterjee 125632b9ff fix: Workaround for Build Failures
https://github.com/facebook/react-native/issues/35210
2022-11-05 23:12:29 +05:30
Rider21 cb67d17747 Fix Date String (#457)
* typo correction

* fix image

* agree
2022-10-26 17:43:11 +05:30
Rajarshee Chatterjee 7ec578639e feat: Stats Screen 2022-10-24 08:08:28 +05:30
Rajarshee Chatterjee a1d6e1d6ce fix(source): WBNovel: Update Language
Closes LNReader/lnreader-sources##408
2022-10-24 07:02:04 +05:30
Rajarshee Chatterjee 1fed66792d build: Upload Artifact 2022-10-22 09:57:26 +05:30
Rajarshee Chatterjee abc815e413 Revert "chore(deps): bump react-native-reanimated from 2.2.4 to 2.10.0" (#455)
Revert "chore(deps): bump react-native-reanimated from 2.2.4 to 2.10.0 (#452)"

This reverts commit 8cb27bf95f.
2022-10-21 17:02:49 +05:30
dependabot[bot] 8cb27bf95f chore(deps): bump react-native-reanimated from 2.2.4 to 2.10.0 (#452)
Bumps [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) from 2.2.4 to 2.10.0.
- [Release notes](https://github.com/software-mansion/react-native-reanimated/releases)
- [Commits](https://github.com/software-mansion/react-native-reanimated/compare/2.2.4...2.10.0)

---
updated-dependencies:
- dependency-name: react-native-reanimated
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-21 16:44:28 +05:30
Rajarshee Chatterjee a84ee5ade4 chore: Update translations (#424)
* New translations strings.json (French)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]
2022-10-10 20:01:49 +05:30
Rajarshee Chatterjee 30ce798c2a feat(source): Add WebNovelOku (Closes LNReader/lnreader-sources#378) 2022-10-10 19:59:22 +05:30
Rajarshee Chatterjee 5ed221648c fix: Add Cloudflare Error Message for LightNovelPub 2022-09-27 21:01:11 +05:30
Rajarshee Chatterjee 93bc5f19ff fix: Update NovelTrench baseUrl (Closes LNReader/lnreader-sources#385) 2022-09-27 08:56:12 +05:30
Rider21 d527319901 feat(source): Add AuthorToday (#434)
* AuthorToday

* fix

* prettier

* test

* ok
2022-09-11 11:57:18 +05:30
Rhino 20470929e5 fix: updates tab sort as data displayed is wrong when release datetime similar (#427)
* Added following sources Zetro Translation, Nocturne, Asada Translation and Sugar Babies

* added time stamp to backup file

* fixed: updates tab sort as data displayed is wrong when release datetime similar
2022-09-10 17:19:15 +05:30
J. Fronny 69dc329fdb build: Generate versionCode (#432)
* Generate versionCode

* Fix comment
2022-09-10 17:18:27 +05:30
Rajarshee Chatterjee 78165b072e Release v1.1.13 2022-09-02 09:30:49 +05:30
Rajarshee Chatterjee d749225820 chore: Update translations (#343)
* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Russian)
[ci skip]

* New translations strings.json (Japanese)
[ci skip]

* New translations strings.json (Hindi)
[ci skip]

* New translations strings.json (Vietnamese)
[ci skip]

* New translations strings.json (Chinese Traditional)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Swedish)
[ci skip]

* New translations strings.json (Serbian (Cyrillic))
[ci skip]

* New translations strings.json (Albanian)
[ci skip]

* New translations strings.json (Portuguese)
[ci skip]

* New translations strings.json (Polish)
[ci skip]

* New translations strings.json (Norwegian)
[ci skip]

* New translations strings.json (Dutch)
[ci skip]

* New translations strings.json (Korean)
[ci skip]

* New translations strings.json (Italian)
[ci skip]

* New translations strings.json (Ukrainian)
[ci skip]

* New translations strings.json (Hungarian)
[ci skip]

* New translations strings.json (Hebrew)
[ci skip]

* New translations strings.json (Finnish)
[ci skip]

* New translations strings.json (Greek)
[ci skip]

* New translations strings.json (German)
[ci skip]

* New translations strings.json (Danish)
[ci skip]

* New translations strings.json (Czech)
[ci skip]

* New translations strings.json (Catalan)
[ci skip]

* New translations strings.json (Arabic)
[ci skip]

* New translations strings.json (Afrikaans)
[ci skip]

* New translations strings.json (Spanish)
[ci skip]

* New translations strings.json (French)
[ci skip]

* New translations strings.json (Romanian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Indonesian)
[ci skip]

* New translations strings.json (Portuguese, Brazilian)
[ci skip]

* New translations strings.json (Turkish)
[ci skip]

* New translations strings.json (Russian)
[ci skip]
2022-09-02 09:30:32 +05:30
Rajarshee Chatterjee d6d487101b feat(source): Add Madara Sources
Closes LNReader/lnreader-sources#365
Closes LNReader/lnreader-sources#363
2022-08-28 11:49:05 +05:30
Rajarshee Chatterjee ba62c1ba0a Minor Fixes 2022-08-28 11:37:04 +05:30
Rajarshee Chatterjee 75f4f18448 Minor Fixes 2022-08-28 11:05:25 +05:30
Rajarshee Chatterjee f9ebec4a30 fix: Global Search Navigation (Closes #406) 2022-08-28 10:56:05 +05:30
Rajarshee Chatterjee de18e3d9d8 fix: Category Fixes 2022-08-28 10:56:05 +05:30
Rajarshee Chatterjee acaac74db4 fix: Add Chapter Name Back in Reader (Closes #410) 2022-08-28 10:56:05 +05:30
Rajarshee Chatterjee d8845661a7 fix: Long Category Names (Closes #407) 2022-08-28 10:56:05 +05:30
Rider21 b66a6130c5 feat(source): Add Ficbook (#409)
* update

* fix

* oops
2022-08-25 07:15:34 +05:30
Rhino 220f25bf72 feat: Update chapter tab sort (#402)
* Added following sources Zetro Translation, Nocturne, Asada Translation and Sugar Babies

* added time stamp to backup file

* tweaks updated chapter sort order in Updates Tab
2022-08-25 07:12:45 +05:30
Rajarshee Chatterjee 934edbb84c feat: Add Change Default Category (Closes #383) 2022-08-18 21:16:35 +05:30
Rajarshee Chatterjee 0d8a5d6172 fix: Navbar Color (Closes #386) 2022-08-18 21:13:36 +05:30
Rajarshee Chatterjee e706745f30 feat: Select Current Category in Library (Closes #396) 2022-08-18 09:43:05 +05:30
Rajarshee Chatterjee dce3652ae8 feat: Add Select All in Library (Closes #380) 2022-08-18 09:07:12 +05:30
Rajarshee Chatterjee 0ca3b8ce15 fix: Cleanup
Closes #378
Closes #393
2022-08-18 08:40:49 +05:30
Rajarshee Chatterjee c62db5cb23 chore: Update Source Icon Links 2022-08-18 07:44:55 +05:30
Rajarshee Chatterjee e33b433e84 fix: Change status bar style on background color change (Closes #150) 2022-08-17 08:18:12 +05:30
Rhino c95f376e20 feat(source): Add following sources Zetro, Nocturne, Asada and SugarBB (#389)
* Added following sources Zetro Translation, Nocturne, Asada Translation and Sugar Babies

* added time stamp to backup file
2022-08-16 23:20:00 +05:30
Rhino 9b45375638 feat: Add time stamp to backup file (#390) 2022-08-16 23:17:03 +05:30
Rajarshee Chatterjee 7fbdc6732c fix: Reset Category to default on removing from current category (Closes #379) 2022-08-16 13:27:54 +05:30
Rajarshee Chatterjee 3f9549d320 fix: Path Aliases 2022-08-16 13:03:29 +05:30
Rajarshee Chatterjee 079010b6ca chore: Fix Issue Template Label 2022-08-16 13:00:34 +05:30
Rajarshee Chatterjee 107e534565 Cleanup 2022-08-16 12:38:13 +05:30
Rajarshee Chatterjee f0665866ae feat: Custom Order in Categories (Closes #376) 2022-08-16 10:56:08 +05:30
Rajarshee Chatterjee 706b4581b1 fix: Hide "Removed from library" toast if novel is in library 2022-08-16 07:26:06 +05:30
Rajarshee Chatterjee a8d9c3abfa chore: Add Issue Templates and Moderator 2022-08-15 20:27:19 +05:30
Rajarshee Chatterjee 66798c46db Minor fixes
Closes #373
Closes #374
2022-08-15 16:51:21 +05:30
Rajarshee Chatterjee 87fa081cfd feat: Material You (#377)
* feat: Material You

* feat: Material You
2022-08-15 15:36:06 +05:30
Rajarshee Chatterjee ea26cd67e4 fix(source): Add Status in Ranobes (Closes LNReader/lnreader-sources#359) 2022-08-14 15:44:09 +05:30
Rajarshee Chatterjee 9400fcd252 feat(source): Add NeoSekai Translations and MTL-Novel
Closes LNReader/lnreader-sources#306
Closes LNReader/lnreader-sources#328
2022-08-14 15:43:22 +05:30
Rajarshee Chatterjee 30ca05df06 feat: Add novel in library on long press in search results (Closes #151) 2022-08-14 13:00:21 +05:30
Rajarshee Chatterjee eac3ee32c8 fix: Add Empty Summary placeholder and show Full Novel Title (Closes #355) 2022-08-14 11:43:49 +05:30
Rajarshee Chatterjee 0cf249eec5 fix: Use Separate States for Search Results in Browse Screen (Closes #359) 2022-08-14 11:15:56 +05:30
Rajarshee Chatterjee 27e5300f4f fix: Clear Searchbar when Screen is Unfocused (Closes #358) 2022-08-14 11:13:10 +05:30
Rajarshee Chatterjee 97e02177a4 fix: Global Search from Novel and MAL Screen (Closes #356) 2022-08-14 10:23:04 +05:30
Rajarshee Chatterjee 42b37f87fe fix(source): Remove NovelSpace and Move ArNovel to MadaraGenerator
(Closes LNReader/lnreader-sources#353)
2022-08-14 10:06:03 +05:30
Rajarshee Chatterjee 4ad1c0253b fix: Reset Novel Categories on deleting a Category (Closes #370) 2022-08-14 09:52:00 +05:30
Rajarshee Chatterjee a57ed7a7a2 feat: Add category-wise updates 2022-08-14 09:30:16 +05:30
Rajarshee Chatterjee 9fa00d9d9b fix(source): Update WuxiaWorldCo baseUrl 2022-08-14 09:28:33 +05:30
Rajarshee Chatterjee 18f63a217f fix: Category/Library bugs 2022-08-14 07:44:53 +05:30
Rajarshee Chatterjee 05401ada6b fix: Fix deleting downloaded chapters (Closes #341) 2022-08-14 07:02:25 +05:30
Rajarshee Chatterjee e256537079 feat: Add Categories (#366)
* feat: Add Categories (Closes #45)

* fix: ESLint Errors

* feat: Add Validation for Duplicate Category Name

* feat: Multiple Categories Support & Hide Default Category

* fix: Creating Tables on Clean Installation

* feat: Add Started Filter
2022-08-13 23:07:58 +05:30
Rider21 0eec38f26f feat: Source Updates (#350)
- Fix ranobes.net (Closes LNReader/lnreader-sources#70)
- Add ranobes.com source
2022-08-05 21:22:24 +05:30
Rider21 fa90d57eff refactor: Replace moment with Dayjs (#346)
* dayjs

* locales added

* fix
2022-08-02 13:17:45 +05:30
457 changed files with 30056 additions and 17049 deletions
+94
View File
@@ -0,0 +1,94 @@
# Cloned from tachiyomi
name: Issue report
description: Report an issue in LNReader
labels: [Bug]
body:
- type: textarea
id: reproduce-steps
attributes:
label: Steps to reproduce
description: Provide an example of the issue.
placeholder: |
Example:
1. First step
2. Second step
3. Issue here
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: Explain what you should expect to happen.
placeholder: |
Example:
"This should happen..."
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: Explain what actually happens.
placeholder: |
Example:
"This happened instead..."
validations:
required: true
- type: input
id: lnreader-version
attributes:
label: LNReader version
description: You can find your LNReader version in **More → About**.
placeholder: |
Example: "1.1.14"
validations:
required: true
- type: input
id: android-version
attributes:
label: Android version
description: You can find this somewhere in your Android settings.
placeholder: |
Example: "Android 11"
validations:
required: true
- type: input
id: device
attributes:
label: Device
description: List your device and model.
placeholder: |
Example: "Google Pixel 5"
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Read this carefully, we will close and ignore your issue if you skimmed through this.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open or closed issue.
required: true
- label: I have written a short but informative title.
required: true
- label: If this is an issue with a source, I should be opening an issue in the [sources repository](https://github.com/lnreader/lnreader-sources/issues/new/choose).
required: true
- label: I have updated the app to version **[1.1.14](https://github.com/lnreader/lnreader/releases/latest)**.
required: true
- label: I will fill out all of the requested information in this form.
required: true
@@ -0,0 +1,40 @@
# Cloned from tachiyomi
name: Feature request
description: Suggest a feature to improve LNReader
labels: [Feature Request]
body:
- type: textarea
id: feature-description
attributes:
label: Describe your suggested feature
description: How can LNReader be improved?
placeholder: |
Example:
"It should work like this..."
validations:
required: true
- type: textarea
id: other-details
attributes:
label: Other details
placeholder: |
Additional details and attachments.
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Read this carefully, we will close and ignore your issue if you skimmed through this.
options:
- label: I have searched the existing issues and this is a new ticket, **NOT** a duplicate or related to another open or closed issue.
required: true
- label: I have written a short but informative title.
required: true
- label: If this is an issue with a source, I should be opening an issue in the [sources repository](https://github.com/LNReader/lnreader-sources/issues/new/choose).
required: true
- label: I have updated the app to version **[1.1.14](https://github.com/LNReader/lnreader/releases/latest)**.
required: true
- label: I will fill out all of the requested information in this form.
required: true
+17 -3
View File
@@ -8,19 +8,22 @@ jobs:
name: Build App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Dependencies
run: |
npm install --legacy-peer-deps
- name: Cache Gradle Wrapper
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle Dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
@@ -33,3 +36,14 @@ jobs:
- name: Build Android Release
run: |
cd android && ./gradlew assembleRelease --no-daemon
- name: Set Env
run: |
set -x
echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: LNReader-r${{ env.COMMIT_COUNT }}
path: android/app/build/outputs/apk/release/app-release.apk
+31
View File
@@ -0,0 +1,31 @@
# Cloned from tachiyomi
name: Issue moderator
on:
issues:
types: [opened, edited, reopened]
issue_comment:
types: [created]
jobs:
moderate:
runs-on: ubuntu-latest
steps:
- name: Moderate issues
uses: tachiyomiorg/issue-moderator-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
auto-close-rules: |
[
{
"type": "body",
"regex": ".*DELETE THIS SECTION IF YOU HAVE READ AND ACKNOWLEDGED IT.*",
"message": "The acknowledgment section was not removed."
},
{
"type": "body",
"regex": ".*\\* (LNReader version|Android version|Device): \\?.*",
"message": "Requested information in the template was not filled out."
}
]
+34 -17
View File
@@ -1,38 +1,55 @@
import 'react-native-gesture-handler';
import { enableFreeze } from 'react-native-screens';
enableFreeze(true);
import React, { useEffect } from 'react';
import { StatusBar } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import LottieSplashScreen from 'react-native-lottie-splash-screen';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Provider as PaperProvider } from 'react-native-paper';
import { Provider } from 'react-redux';
import { persistor, store } from './src/redux/store';
import { PersistGate } from 'redux-persist/lib/integration/react';
import * as SplashScreen from 'expo-splash-screen';
import * as Notifications from 'expo-notifications';
import { createDatabase } from '@database/db';
import { persistor, store } from '@redux/store';
import AppErrorBoundary from '@components/AppErrorBoundary/AppErrorBoundary';
import Main from './src/navigators/Main';
import { createDB } from './src/database/db';
import { SafeAreaProvider } from 'react-native-safe-area-context';
Notifications.setNotificationHandler({
handleNotification: async () => {
return {
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
};
},
});
const App = () => {
useEffect(() => {
SplashScreen.preventAutoHideAsync();
createDB();
LottieSplashScreen.hide();
createDatabase();
}, []);
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<SafeAreaProvider>
<PaperProvider>
<StatusBar translucent={true} backgroundColor="transparent" />
<Main />
</PaperProvider>
</SafeAreaProvider>
</PersistGate>
</Provider>
<GestureHandlerRootView style={{ flex: 1 }}>
<AppErrorBoundary>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<SafeAreaProvider>
<PaperProvider>
<StatusBar translucent={true} backgroundColor="transparent" />
<Main />
</PaperProvider>
</SafeAreaProvider>
</PersistGate>
</Provider>
</AppErrorBoundary>
</GestureHandlerRootView>
);
};
+24 -5
View File
@@ -7,6 +7,11 @@ Contributions are welcome and are greatly appreciated!
After forking to your own github org or account, do the following steps to get started:
```bash
# prerequisites
node --version <= 16.13.1 (for version management, get nvm [recommended])
java sdk --version <= 11 (for version management, get jenv [optional])
android sdk (https://developer.android.com/studio)
# clone your fork to your local machine
git clone https://github.com/<your-account-name>/lnreader.git
@@ -14,20 +19,34 @@ git clone https://github.com/<your-account-name>/lnreader.git
cd lnreader
# install dependencies
npm install
npm install --legacy-peer-deps
# run metro for development
npm start
# build the apk (the built apk will be found in ~/lnreader/android/app/build/outputs/apk/release/)
npm run buildRelease
```
### Developing on Android
While the packager is running and you have an Android device or emulator connected to your computer, build and launch the Android app.
You will need an Android device or emulator connected to your computer as well as an IDE of your choice. (eg: vscode)
```
```bash
# prerequisites
adb (https://developer.android.com/studio/command-line/adb)
IDE
# check if android device/emulator is connected
adb devices
# run metro for development
npm start
# then to view on your android device (new terminal)
npm run android
```
To view any changes to the app with new code, save your code and press "r" on the metro terminal to
reload it. The app on the android device/emulator will reload shortly.
### Style & Linting
This codebase's linting rules are enforced using [ESLint](http://eslint.org/).
+6 -2
View File
@@ -9,7 +9,7 @@
</p>
<div align="center">
<a href="https://github.com/LNReader/lnreader/actions/workflows/build.yml">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/LNReader/lnreader/CI">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/LNReader/lnreader/build.yml?branch=main">
</a>
<a href="https://discord.gg/QdcWN4MD63">
<img alt="Discord Chat" src="https://img.shields.io/discord/835746409357246465.svg?logo=discord&logoColor=white&logoWidth=20&labelColor=7289DA&label=Discord&color=17cf48">
@@ -43,6 +43,10 @@ LNReader does not have any affiliation with the content providers available.
Source requests should be created at [LNReader/lnreader-sources](https://github.com/LNReader/lnreader-sources).
## Building & Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md)
## License
[MIT ](https://github.com/rajarsheechatterjee/lnreader/blob/main/LICENSE)
[MIT](https://github.com/rajarsheechatterjee/lnreader/blob/main/LICENSE)
+10 -3
View File
@@ -122,6 +122,12 @@ def jscFlavor = 'org.webkit:android-jsc:+'
*/
def enableHermes = project.ext.react.get("enableHermes", false);
ext {
versionMajor = 1
versionMinor = 1
versionPatch = 14
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
@@ -134,8 +140,9 @@ android {
applicationId 'com.rajarsheechatterjee.LNReader'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.1.12"
// Generated version code. Supports versions up to 1024.1024.2048
versionCode ((((versionMajor << 10) | versionMinor) << 11) | versionPatch)
versionName "$versionMajor.$versionMinor.$versionPatch"
}
splits {
abi {
@@ -187,7 +194,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation project(':react-native-lottie-splash-screen')
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
+2
View File
@@ -8,6 +8,8 @@
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
-keep class com.swmansion.reanimated.** { *; }
-keep class com.facebook.react.turbomodule.** { *; }
-keep class com.facebook.hermes.unicode.** { *; }
-keep class com.facebook.jni.** { *; }
-keep public class com.dylanvann.fastimage.* {*;}
+38 -39
View File
@@ -1,26 +1,26 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rajarsheechatterjee.LNReader">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rajarsheechatterjee.LNReader">
<!-- Internet -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<!-- Storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- For background jobs -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<queries>
<intent>
@@ -28,24 +28,23 @@
</intent>
</queries>
<application
android:name=".MainApplication"
<application
android:name=".MainApplication"
android:largeHeap="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<meta-data
android:name="expo.modules.notifications.default_notification_icon"
android:resource="@drawable/notification_icon"/>
android:resource="@drawable/notification_icon" />
<meta-data
android:name="expo.modules.notifications.default_notification_color"
android:resource="@color/notification_icon_color"/>
android:resource="@color/notification_icon_color" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
@@ -54,24 +53,24 @@
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.App.SplashScreen"
android:screenOrientation="unspecified">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="lnreader"/>
<data android:scheme="com.rajarsheechatterjee.LNReader"/>
</intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="lnreader" />
<data android:scheme="com.rajarsheechatterjee.LNReader" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" />
</application>
</manifest>
</application>
</manifest>
@@ -1,15 +1,15 @@
package com.rajarsheechatterjee.LNReader;
import android.content.res.Configuration;
import android.content.Intent;
import android.os.Bundle;
import android.content.res.Configuration;
import android.graphics.Color;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.ScrollView;
import android.view.WindowManager;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
@@ -17,9 +17,7 @@ import com.facebook.react.ReactRootView;
import com.rajarsheechatterjee.VolumeButtonListener.VolumeButtonListener;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import expo.modules.splashscreen.singletons.SplashScreen;
import expo.modules.splashscreen.SplashScreenImageResizeMode;
import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {
@@ -35,7 +33,8 @@ public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// SplashScreen.show(...) has to be called after super.onCreate(...)
// Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
// Below line is handled by '@expo/configure-splash-screen' command and it's
// discouraged to modify it manually
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
@@ -45,11 +44,11 @@ public class MainActivity extends ReactActivity {
Window w = getWindow();
w.setStatusBarColor(Color.TRANSPARENT);
w.setNavigationBarColor(Color.TRANSPARENT);
w.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
w.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
SplashScreen.show(this,R.style.SplashScreenTheme, R.id.lottie);
SplashScreen.setAnimationFinished(true);
super.onCreate(null);
SplashScreen.show(this, SplashScreenImageResizeMode.COVER, ReactRootView.class, false);
}
@Override
@@ -62,15 +61,15 @@ public class MainActivity extends ReactActivity {
case KeyEvent.KEYCODE_VOLUME_UP:
if (action == KeyEvent.ACTION_DOWN) {
// volup
VolumeButtonListener.up();
VolumeButtonListener.up(VolumeButtonListener.getScrollAmount());
if (!VolumeButtonListener.prevent)
return super.dispatchKeyEvent(event);
}
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
if (action == KeyEvent.ACTION_DOWN) {
//voldown
VolumeButtonListener.down();
// voldown
VolumeButtonListener.down(VolumeButtonListener.getScrollAmount());
if (!VolumeButtonListener.prevent)
return super.dispatchKeyEvent(event);
}
@@ -81,7 +80,6 @@ public class MainActivity extends ReactActivity {
}
return super.dispatchKeyEvent(event);
}
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
@@ -101,4 +99,4 @@ public class MainActivity extends ReactActivity {
};
}
}
}
@@ -21,10 +21,11 @@ import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
new BasePackageList().getPackageList()
);
new BasePackageList().getPackageList());
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
@@ -66,7 +67,8 @@ public class MainApplication extends Application implements ReactApplication {
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* Loads Flipper in React Native templates. Call this in the onCreate method
* with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
@@ -77,9 +79,9 @@ public class MainApplication extends Application implements ReactApplication {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
* We use reflection here to pick up the class that initializes Flipper,
* since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.rajarsheechatterjee.LNReader.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
@@ -20,7 +20,6 @@ public class BasePackageList {
new expo.modules.localization.LocalizationPackage(),
new expo.modules.notifications.NotificationsPackage(),
new expo.modules.permissions.PermissionsPackage(),
new expo.modules.splashscreen.SplashScreenPackage(),
new expo.modules.sqlite.SQLitePackage(),
new expo.modules.webbrowser.WebBrowserPackage()
);
@@ -1,11 +1,11 @@
package com.rajarsheechatterjee.VolumeButtonListener;
import androidx.annotation.NonNull;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
@@ -27,9 +27,10 @@ public class VolumeButtonListener extends ReactContextBaseJavaModule {
public static boolean prevent = false;
public static void sendEvent(boolean up) {
public static void sendEvent(boolean up, int amount) {
if (active) {
WritableMap args = Arguments.createMap();
args.putInt("scrollAmount", amount); // add scroll amount to event data
if (up)
appContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("VolumeUp", args);
else
@@ -37,12 +38,22 @@ public class VolumeButtonListener extends ReactContextBaseJavaModule {
}
}
public static void down() {
sendEvent(false);
public static void down(int amount) {
sendEvent(false, amount);
}
public static void up() {
sendEvent(true);
public static void up(int amount) {
sendEvent(true, amount);
}
private static int scrollAmount = 100;
public static void setScrollAmount(int amount) {
scrollAmount = amount;
}
public static int getScrollAmount() {
return scrollAmount;
}
@ReactMethod
@@ -90,4 +101,14 @@ public class VolumeButtonListener extends ReactContextBaseJavaModule {
public void removeListeners(Integer count) {
// Keep: Required for RN built in Event Emitter Calls.
}
}
@ReactMethod
public void setVolumeButtonScrollAmount(int amount) {
setScrollAmount(amount);
}
@ReactMethod
public void getVolumeButtonScrollAmount(Promise promise) {
promise.resolve(getScrollAmount());
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 67 KiB

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/colorPrimaryDark"
android:gravity="center"
android:orientation="vertical"
android:scaleType="centerCrop"
android:navigationBarColor="#333333"
tools:context=".MainActivity">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottie"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:paddingLeft="25dp"
app:lottie_autoPlay="true"
app:lottie_loop="false"
app:lottie_rawRes="@raw/loading" />
</LinearLayout>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/iconBackground"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<background android:drawable="@mipmap/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
</adaptive-icon>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/iconBackground"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

File diff suppressed because one or more lines are too long
@@ -6,4 +6,5 @@
<color name="colorPrimaryDark">#202125</color>
<color name="navigationBarColor">#202125</color>
<color name="notification_icon_color">#00adb5</color>
<color name="ic_launcher_background">#222831</color>
</resources>
+11 -7
View File
@@ -8,16 +8,20 @@
<item name="android:textColor">#000000</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:navigationBarColor">#202125</item>
<item name="android:statusBarColor">#202125</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
</style>
<style name="Theme.App.SplashScreen" parent="Theme.AppCompat.Light.NoActionBar">
<style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
</style>
<style name="Theme.App.SplashScreen" parent="AppTheme">
<!-- Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually -->
<!-- Customize your splash screen theme here -->
<!-- <item name="icon">@drawable/no_icon</item> -->
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:navigationBarColor">#202125</item>
<item name="android:statusBarColor">#202125</item>
</style>
</resources>
+15
View File
@@ -6,6 +6,7 @@ buildscript {
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.1.6352462"
}
repositories {
google()
@@ -21,6 +22,20 @@ buildscript {
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
+3
View File
@@ -6,4 +6,7 @@ includeUnimodulesProjects()
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesSettingsGradle(settings)
include ':react-native-lottie-splash-screen'
project(':react-native-lottie-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-lottie-splash-screen/android')
include ':app'
+6 -2
View File
@@ -6,17 +6,21 @@ module.exports = function (api) {
[
'module-resolver',
{
root: ['./src'],
alias: {
'@components': './src/components',
'@database': './src/database',
'@hooks': './src/hooks',
'@screens': './src/screens',
'@strings': './strings',
'@redux': './src/redux',
'@services': './src/services',
'@sources': './src/sources',
'@utils': './src/utils',
'@theme': './src/theme',
},
extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
},
],
'react-native-reanimated/plugin',
],
};
};
+1 -1
View File
@@ -2,4 +2,4 @@ pull_request_title: 'chore: Update translations'
commit_message: '[ci skip]'
files:
- source: /strings/languages/en/strings.json
translation: /strings/languages/%two_letters_code%/strings.json
translation: /strings/languages/%locale_with_underscore%/strings.json
+992 -1377
View File
File diff suppressed because it is too large Load Diff
+22 -15
View File
@@ -1,6 +1,6 @@
{
"name": "lnreader",
"version": "1.1.12",
"version": "1.1.14",
"private": true,
"scripts": {
"android": "react-native run-android",
@@ -8,24 +8,30 @@
"start": "react-native start",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"prettier": "prettier --write \"./src/**/*.{js,jsx,ts,tsx}\"",
"buildRelease": "cd android && gradlew clean && gradlew assembleRelease",
"sources:madara": "node scripts/generateMadaraSource.cjs && prettier --write {src/sources/multisrc/madara/MadaraGenerator.ts,src/sources/sources.json}",
"buildRelease": "cd android && ./gradlew clean && ./gradlew assembleRelease",
"open": "open ./android/app/build/outputs/apk/release/",
"sources:madara": "node scripts/generateMadaraSource.cjs",
"source:generator": "node scripts/generateSource.cjs",
"strings": "node scripts/stringTypes.cjs",
"prepare": "husky install"
},
"dependencies": {
"@gorhom/bottom-sheet": "^4.4.5",
"@react-native-async-storage/async-storage": "^1.15.11",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/slider": "^4.1.12",
"@react-native-cookies/cookies": "^6.2.1",
"@react-native-picker/picker": "^2.4.1",
"@react-navigation/drawer": "^6.0.1",
"@react-navigation/material-bottom-tabs": "^6.0.9",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"@reduxjs/toolkit": "^1.7.2",
"buffer": "^6.0.3",
"@shopify/flash-list": "^1.2.1",
"cheerio": "^1.0.0-rc.10",
"color": "^4.2.3",
"dayjs": "^1.11.4",
"expo": "^41.0.1",
"expo-document-picker": "^9.2.4",
"expo-file-system": "~11.0.2",
@@ -35,30 +41,31 @@
"expo-linking": "~2.2.3",
"expo-localization": "~10.1.0",
"expo-notifications": "~0.11.6",
"expo-splash-screen": "^0.11.4",
"expo-sqlite": "~9.1.0",
"expo-web-browser": "~9.1.0",
"i18n-js": "^3.8.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"lodash-es": "^4.17.21",
"lottie-react-native": "^5.1.4",
"prop-types": "^15.7.2",
"qs": "^6.10.1",
"qs": "^6.10.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "^0.64.3",
"react-native-background-actions": "^2.6.5",
"react-native-device-info": "^8.4.7",
"react-native-easing-gradient": "^1.0.0",
"react-native-error-boundary": "^1.1.16",
"react-native-fast-image": "^8.5.11",
"react-native-gesture-handler": "~1.10.2",
"react-native-gesture-handler": "~2.1.3",
"react-native-lottie-splash-screen": "^1.0.1",
"react-native-markdown-display": "^7.0.0-alpha.2",
"react-native-mmkv": "^2.4.3",
"react-native-pager-view": "^5.4.9",
"react-native-paper": "^4.10.1",
"react-native-reanimated": "^2.2.4",
"react-native-render-html": "^6.3.4",
"react-native-paper": "^5.2.0",
"react-native-reanimated": "^2.13.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.9.0",
"react-native-swipe-gestures": "^1.0.5",
"react-native-shimmer-placeholder": "^2.0.9",
"react-native-tab-view": "^3.1.1",
"react-native-tts": "^4.1.0",
"react-native-unimodules": "^0.13.3",
@@ -68,15 +75,15 @@
"redux": "^4.1.2",
"redux-persist": "^6.0.0",
"rn-fetch-blob": "^0.12.0",
"rn-sliding-up-panel": "^2.4.4",
"sanitize-html": "^2.7.0"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@react-native-community/eslint-config": "^3.0.1",
"@types/color": "^3.0.3",
"@types/i18n-js": "^3.8.2",
"@types/jest": "^27.4.0",
"@types/lodash": "^4.14.179",
"@types/lodash-es": "^4.17.6",
"@types/react-native": "^0.66.15",
"@types/react-native-vector-icons": "^6.4.10",
"@types/react-test-renderer": "^17.0.1",
+14
View File
@@ -1,5 +1,7 @@
const path = require('path');
const fs = require('fs');
const prettier = require('prettier');
const prettierConfig = require('../.prettierrc');
const MadaraSources = require('../src/sources/multisrc/madara/MadaraSources.json');
const AllSources = require('../src/sources/sources.json');
@@ -7,6 +9,7 @@ const AllSources = require('../src/sources/sources.json');
const getScraperName = scraperName => {
let name = scraperName
.replace(/\s+/g, '')
.replace(/-/g, 'Dash')
.replace(/\./g, 'Dot')
.replace('1st', 'First');
@@ -26,6 +29,11 @@ MadaraSources.forEach(source => {
}", ${source.options ? JSON.stringify(source.options) : ''});\n\n`;
});
content = prettier.format(content, {
parser: 'typescript',
...prettierConfig,
});
fs.writeFile(
path.resolve(process.cwd(), 'src/sources/multisrc/madara/MadaraGenerator.ts'),
content,
@@ -52,6 +60,12 @@ MadaraSources.forEach(madaraSource => {
allSourcesContent = JSON.stringify(allSourcesContent);
allSourcesContent = prettier.format(allSourcesContent, {
parser: 'json5',
quoteProps: 'preserve',
trailingComma: 'none',
});
fs.writeFile(
path.resolve(process.cwd(), 'src/sources/sources.json'),
allSourcesContent,
+2 -3
View File
@@ -18,6 +18,7 @@ const getLanguageCode = language => {
Chinese: 'cn',
Japanese: 'jp',
Vietnamese: 'vi',
Korean: 'kr',
};
return codes[language];
@@ -58,7 +59,6 @@ try {
: ''
}
const popularNovels = async (page: number) => {
const totalPages = ${source.popularNovels.totalPages};
const url = \`${source.popularNovels.url}\`;
const result = await fetch(url);
@@ -102,8 +102,7 @@ try {
}
});
return { totalPages, novels };
};
return { novels };
const parseNovelAndChapters = async (novelUrl: string) => {
const url = novelUrl;
-47
View File
@@ -1,47 +0,0 @@
import React from 'react';
import { Dimensions, StyleSheet, View } from 'react-native';
import { IconButton } from 'react-native-paper';
export const Actionbar = ({ active, actions, theme, style }) => {
if (active) {
return (
<View
style={[
styles.actionbarContainer,
{ backgroundColor: theme.colorPrimary },
style,
]}
>
{actions.map(
(action, index) =>
action.icon && (
<IconButton
key={index}
icon={action.icon}
color={theme.textColorPrimary}
onPress={action.onPress}
/>
),
)}
</View>
);
} else {
return null;
}
};
const styles = StyleSheet.create({
actionbarContainer: {
position: 'absolute',
width: Dimensions.get('window').width - 32,
bottom: 0,
margin: 16,
borderRadius: 6,
flexDirection: 'row',
justifyContent: 'space-between',
paddingHorizontal: 8,
paddingVertical: 4,
elevation: 2,
},
});
+83
View File
@@ -0,0 +1,83 @@
import { useTheme } from '@hooks/useTheme';
import React from 'react';
import {
Dimensions,
Pressable,
StyleProp,
StyleSheet,
View,
ViewProps,
} from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
type Action = {
icon: string;
onPress: () => void;
};
interface ActionbarProps {
active: boolean;
actions: Action[];
viewStyle?: StyleProp<ViewProps>;
}
export const Actionbar: React.FC<ActionbarProps> = ({
active,
actions,
viewStyle,
}) => {
const theme = useTheme();
const { bottom } = useSafeAreaInsets();
if (active) {
return (
<View
style={[
styles.actionbarContainer,
{
backgroundColor: theme.surface2,
minHeight: 80 + bottom,
paddingBottom: bottom,
},
viewStyle,
]}
>
{actions.map(({ icon, onPress }, id) => (
<Pressable
key={id}
android_ripple={{
radius: 50,
color: theme.rippleColor,
borderless: true,
}}
onPress={onPress}
>
<MaterialCommunityIcons
name={icon}
color={theme.onSurface}
size={24}
/>
</Pressable>
))}
</View>
);
} else {
return null;
}
};
const styles = StyleSheet.create({
actionbarContainer: {
position: 'absolute',
width: Dimensions.get('window').width,
bottom: 0,
borderTopLeftRadius: 16,
borderTopRightRadius: 16,
elevation: 1,
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
},
});
@@ -0,0 +1,96 @@
import React from 'react';
import { StyleSheet, View, Text, StatusBar } from 'react-native';
import ErrorBoundary from 'react-native-error-boundary';
import { Button, List } from '@components';
import { useTheme } from '@hooks';
interface ErrorFallbackProps {
error: Error;
resetError: () => void;
}
export const ErrorFallback: React.FC<ErrorFallbackProps> = ({
error,
resetError,
}) => {
const theme = useTheme();
return (
<View style={[styles.mainCtn, { backgroundColor: theme.background }]}>
<StatusBar translucent={true} backgroundColor="transparent" />
<View style={styles.errorInfoCtn}>
<Text style={[styles.errorTitle, { color: theme.onSurface }]}>
An Unexpected Error Ocurred
</Text>
<Text style={[styles.errorDesc, { color: theme.onSurface }]}>
The application ran into an unexpected error. We suggest you
screenshot this message and then share it in our support channel on
Discord.
</Text>
<Text
style={[
styles.errorCtn,
{
backgroundColor: theme.surfaceVariant,
color: theme.onSurfaceVariant,
},
]}
numberOfLines={20}
>
{`${error.message}\n\n${error.stack}`}
</Text>
</View>
<List.Divider theme={theme} />
<Button
onPress={resetError}
title={'Restart the application'}
style={styles.buttonCtn}
mode="contained"
/>
</View>
);
};
interface AppErrorBoundaryProps {
children: React.ReactNode | React.ReactElement;
}
const AppErrorBoundary: React.FC<AppErrorBoundaryProps> = ({ children }) => {
return (
<ErrorBoundary FallbackComponent={ErrorFallback}>{children}</ErrorBoundary>
);
};
export default AppErrorBoundary;
const styles = StyleSheet.create({
mainCtn: {
flex: 1,
},
errorInfoCtn: {
flex: 1,
justifyContent: 'center',
padding: 16,
},
buttonCtn: {
margin: 16,
marginBottom: 32,
},
errorTitle: {
marginBottom: 8,
textAlign: 'center',
fontSize: 20,
},
errorDesc: {
lineHeight: 20,
marginVertical: 8,
},
errorCtn: {
borderRadius: 8,
lineHeight: 20,
marginVertical: 16,
paddingVertical: 16,
paddingHorizontal: 8,
},
});
-30
View File
@@ -1,30 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Appbar as MaterialAppbar } from 'react-native-paper';
import { useTheme } from '../hooks/reduxHooks';
import { ViewPropTypes } from 'react-native';
export const Appbar = ({ title, onBackAction, style, children }) => {
const theme = useTheme();
return (
<MaterialAppbar.Header
style={[{ backgroundColor: theme.colorPrimary }, style]}
>
{onBackAction && <MaterialAppbar.BackAction onPress={onBackAction} />}
<MaterialAppbar.Content
title={title}
titleStyle={{ color: theme.textColorPrimary }}
/>
{children}
</MaterialAppbar.Header>
);
};
Appbar.propTypes = {
title: PropTypes.string,
onBackAction: PropTypes.func,
style: ViewPropTypes.style,
};
+20 -6
View File
@@ -2,24 +2,38 @@ import React from 'react';
import { StatusBar } from 'react-native';
import { Appbar as PaperAppbar } from 'react-native-paper';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
interface AppbarProps {
title: string;
handleGoBack: () => void;
theme: ThemeType;
theme: ThemeColors;
mode?: 'small' | 'medium' | 'large' | 'center-aligned';
}
const Appbar: React.FC<AppbarProps> = ({ title, handleGoBack, theme }) => (
const Appbar: React.FC<AppbarProps> = ({
title,
handleGoBack,
theme,
mode = 'large',
children,
}) => (
<PaperAppbar.Header
style={{ backgroundColor: theme.colorPrimary }}
style={{ backgroundColor: theme.surface }}
statusBarHeight={StatusBar.currentHeight}
mode={mode}
>
{handleGoBack && <PaperAppbar.BackAction onPress={handleGoBack} />}
{handleGoBack && (
<PaperAppbar.BackAction
onPress={handleGoBack}
iconColor={theme.onSurface}
/>
)}
<PaperAppbar.Content
title={title}
titleStyle={{ color: theme.textColorPrimary }}
titleStyle={{ color: theme.onSurface }}
/>
{children}
</PaperAppbar.Header>
);
@@ -0,0 +1,49 @@
import React, { ReactElement, Ref, useCallback } from 'react';
import { overlay } from 'react-native-paper';
import { default as BS, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { ThemeColors } from '@theme/types';
import { StyleSheet } from 'react-native';
interface BottomSheetProps {
bottomSheetRef: Ref<BS>;
snapPoints: Array<number>;
height: number;
theme: ThemeColors;
children: ReactElement;
}
const BottomSheet: React.FC<BottomSheetProps> = ({
bottomSheetRef,
snapPoints,
height,
theme,
children,
}) => {
const { bottom } = useSafeAreaInsets();
const renderBackdrop = useCallback(
props => <BottomSheetBackdrop {...props} disappearsOnIndex={0} />,
[],
);
return (
<BS
index={-1}
backdropComponent={renderBackdrop}
snapPoints={[0.1].concat(snapPoints)}
enablePanDownToClose={true}
ref={bottomSheetRef}
handleStyle={styles.handle}
containerHeight={height + bottom}
containerStyle={{ paddingBottom: bottom }}
backgroundStyle={{ backgroundColor: overlay(2, theme.surface) }}
>
{children}
</BS>
);
};
const styles = StyleSheet.create({
handle: {
display: 'none',
},
});
export default BottomSheet;
+12 -76
View File
@@ -1,87 +1,23 @@
import { Pressable, StyleSheet, Text, View, ViewStyle } from 'react-native';
import React from 'react';
import {
Button as PaperButton,
ButtonProps as PaperButtonProps,
} from 'react-native-paper';
import { ThemeType } from '../../theme/types';
import { useTheme } from '@hooks';
export enum ButtonVariation {
DEFAULT = 'default',
OUTLINED = 'outlined',
CLEAR = 'clear',
interface ButtonProps extends Omit<PaperButtonProps, 'children' | 'theme'> {
title?: string;
}
interface Props {
variation?: ButtonVariation;
title: string;
textColor?: string;
onPress?: () => void;
theme: ThemeType;
style?: ViewStyle;
}
const Button: React.FC<ButtonProps> = props => {
const theme = useTheme();
const Button: React.FC<Props> = ({
variation = ButtonVariation.DEFAULT,
title,
textColor,
onPress,
theme,
style,
}) => {
return (
<View
style={[
styles.button,
variation === ButtonVariation.OUTLINED
? {
...styles.outlined,
borderColor: theme.textColorHint,
}
: variation !== ButtonVariation.CLEAR && {
backgroundColor: theme.colorAccent,
},
style,
]}
>
<Pressable
style={styles.pressable}
onPress={onPress}
android_ripple={{ color: theme.rippleColor }}
>
<Text
style={{
color: textColor
? textColor
: variation === ButtonVariation.OUTLINED
? theme.colorAccent
: variation === ButtonVariation.CLEAR
? theme.colorAccent
: theme.textColorPrimary,
}}
numberOfLines={1}
>
{title}
</Text>
</Pressable>
</View>
<PaperButton {...props} theme={{ colors: theme }}>
{props.title || props.children}
</PaperButton>
);
};
export default Button;
const styles = StyleSheet.create({
button: {
minHeight: 40,
justifyContent: 'center',
borderRadius: 50,
overflow: 'hidden',
},
pressable: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 8,
paddingHorizontal: 24,
},
outlined: {
borderWidth: 1,
},
});
@@ -1,19 +1,39 @@
import React from 'react';
import { Pressable, StyleSheet, Text } from 'react-native';
import {
Pressable,
StyleProp,
StyleSheet,
Text,
TextStyle,
ViewStyle,
} from 'react-native';
import { Checkbox as PaperCheckbox } from 'react-native-paper';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
export const Checkbox = ({
import { ThemeColors } from '../../theme/types';
interface CheckboxProps {
label: string;
status: boolean | 'indeterminate';
onPress?: () => void;
disabled?: boolean;
theme: ThemeColors;
viewStyle?: StyleProp<ViewStyle>;
labelStyle?: StyleProp<TextStyle>;
}
export const Checkbox: React.FC<CheckboxProps> = ({
label,
status,
onPress,
disabled = false,
theme,
disabled,
onPress,
viewStyle,
labelStyle,
}) => (
<Pressable
android_ripple={{ color: theme.rippleColor }}
style={styles.pressable}
style={[styles.pressable, viewStyle]}
onPress={onPress}
disabled={disabled}
>
@@ -26,11 +46,14 @@ export const Checkbox = ({
: 'unchecked'
}
onPress={onPress}
color={theme.colorAccent}
uncheckedColor={theme.textColorSecondary}
color={theme.primary}
theme={{
colors: { disabled: theme.onSurfaceVariant },
}}
uncheckedColor={theme.onSurfaceVariant}
disabled={disabled}
/>
<Text style={{ color: theme.textColorSecondary, marginLeft: 12 }}>
<Text style={[styles.defaultLabel, { color: theme.onSurface }, labelStyle]}>
{label}
</Text>
</Pressable>
@@ -45,12 +68,12 @@ export const SortItem = ({ label, status, onPress, theme }) => (
{status && (
<MaterialCommunityIcons
name={status === 'asc' ? 'arrow-up' : 'arrow-down'}
color={theme.colorAccent}
color={theme.primary}
size={21}
style={styles.icon}
/>
)}
<Text style={{ color: theme.textColorPrimary }}>{label}</Text>
<Text style={{ color: theme.onSurface }}>{label}</Text>
</Pressable>
);
@@ -66,4 +89,7 @@ const styles = StyleSheet.create({
left: 24,
alignSelf: 'center',
},
defaultLabel: {
marginLeft: 12,
},
});
+22 -5
View File
@@ -1,20 +1,37 @@
import React from 'react';
import { Pressable, StyleSheet, Text, View } from 'react-native';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
import { overlay } from 'react-native-paper';
interface ChipProps {
label: string;
theme: ThemeType;
theme: ThemeColors;
}
const Chip: React.FC<ChipProps> = ({ label, theme }) => (
<View style={[styles.chipContainer, { backgroundColor: theme.colorPrimary }]}>
<View
style={[
styles.chipContainer,
{
backgroundColor: theme.isDark
? overlay(1, theme.surface)
: theme.secondaryContainer,
},
]}
>
<Pressable
android_ripple={{ color: theme.rippleColor }}
style={styles.pressable}
>
<Text style={[styles.label, { color: theme.textColorSecondary }]}>
<Text
style={[
styles.label,
{
color: theme.isDark ? theme.onSurface : theme.onSecondaryContainer,
},
]}
>
{label}
</Text>
</Pressable>
@@ -27,7 +44,7 @@ const styles = StyleSheet.create({
chipContainer: {
overflow: 'hidden',
borderRadius: 8,
height: 28,
height: 32,
marginRight: 8,
},
pressable: {
@@ -1,8 +1,8 @@
import React, { useState } from 'react';
import { FlatList, Pressable, StyleSheet, Text, View } from 'react-native';
import { Modal, Portal, TextInput } from 'react-native-paper';
import { ThemeType } from '../../theme/types';
import { Modal, overlay, Portal, TextInput } from 'react-native-paper';
import { ThemeColors } from '../../theme/types';
interface ColorPickerModalProps {
visible: boolean;
@@ -10,7 +10,7 @@ interface ColorPickerModalProps {
color: string;
onSubmit: (val: string) => void;
closeModal: () => void;
theme: ThemeType;
theme: ThemeColors;
showAccentColors?: boolean;
}
@@ -47,15 +47,6 @@ const ColorPickerModal: React.FC<ColorPickerModalProps> = ({
}
};
const textInputTheme = {
colors: {
primary: color,
placeholder: theme.textColorHint,
text: theme.textColorPrimary,
background: 'transparent',
},
};
const accentColors = [
'#EF5350',
'#EC407A',
@@ -86,10 +77,10 @@ const ColorPickerModal: React.FC<ColorPickerModalProps> = ({
onDismiss={onDismiss}
contentContainerStyle={[
styles.modalContainer,
{ backgroundColor: theme.colorPrimary },
{ backgroundColor: overlay(2, theme.surface) },
]}
>
<Text style={[styles.modalTitle, { color: theme.textColorPrimary }]}>
<Text style={[styles.modalTitle, { color: theme.onSurface }]}>
{title}
</Text>
{showAccentColors ? (
@@ -131,8 +122,8 @@ const ColorPickerModal: React.FC<ColorPickerModalProps> = ({
onChangeText={onChangeText}
onSubmitEditing={onSubmitEditing}
mode="outlined"
theme={textInputTheme}
underlineColor={theme.textColorHint}
theme={{ colors: { ...theme } }}
underlineColor={theme.outline}
dense
error={Boolean(error)}
/>
@@ -147,11 +138,11 @@ export default ColorPickerModal;
const styles = StyleSheet.create({
modalContainer: {
margin: 30,
padding: 20,
borderRadius: 8,
padding: 24,
borderRadius: 28,
},
modalTitle: {
fontSize: 18,
fontSize: 24,
marginBottom: 16,
},
errorText: {
@@ -22,10 +22,8 @@ const ColorPreferenceItem: React.FC<ColorPreferenceItemProps> = ({
onPress={onPress}
>
<View>
<Text style={[styles.label, { color: theme.textColorPrimary }]}>
{label}
</Text>
<Text style={{ color: theme.textColorSecondary }}>
<Text style={[styles.label, { color: theme.onSurface }]}>{label}</Text>
<Text style={{ color: theme.onSurfaceVariant }}>
{description?.toUpperCase?.()}
</Text>
</View>
+1 -1
View File
@@ -18,7 +18,7 @@ const ScreenContainer = ({ children, theme }) => {
);
};
const Row = ({ children, style }) => (
const Row = ({ children, style = {} }) => (
<View style={[styles.row, style]}>{children}</View>
);
-110
View File
@@ -1,110 +0,0 @@
/* eslint-disable no-bitwise */
import PropTypes from 'prop-types';
import React, { PureComponent, Children } from 'react';
import { View, Animated, StyleSheet } from 'react-native';
export default class FadeView extends PureComponent {
static defaultProps = {
animationDuration: 225,
active: false,
removeHiddenSubviews: true,
};
static propTypes = {
animationDuration: PropTypes.number,
active: PropTypes.bool,
removeHiddenSubviews: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]),
};
constructor(props) {
super(props);
this.renderChild = this.renderChild.bind(this);
this.mounted = false;
let { active } = this.props;
this.state = {
progress: new Animated.Value(Number(active)),
animating: false,
};
}
componentDidMount() {
this.mounted = true;
}
componentWillUnmount() {
this.mounted = false;
}
UNSAFE_componentWillReceiveProps({ active, animationDuration }) {
let { progress } = this.state;
if (active ^ this.props.active) {
this.setState({ animating: true });
Animated.timing(progress, {
toValue: Number(active),
duration: animationDuration,
useNativeDriver: true,
}).start(() => {
if (this.mounted) {
this.setState({ animating: false });
}
});
}
}
renderChild(child, index) {
let { active, removeHiddenSubviews } = this.props;
let { animating, progress } = this.state;
let opacity = progress.interpolate({
inputRange: [0, 1],
outputRange: index ? [0, 1] : [1, 0],
});
let hidden = active ^ !!index;
if (removeHiddenSubviews) {
if (!animating && hidden) {
return null;
}
}
let pointerEvents = hidden ? 'none' : 'box-none';
return (
<Animated.View
style={[styles.container, { opacity }]}
pointerEvents={pointerEvents}
>
{child}
</Animated.View>
);
}
render() {
let { children, ...props } = this.props;
return <View {...props}>{Children.map(children, this.renderChild)}</View>;
}
}
const styles = StyleSheet.create({
container: {
// ...StyleSheet.absoluteFillObject,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
});
+7 -6
View File
@@ -1,12 +1,13 @@
import React from 'react';
import { Pressable, View } from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
import Color from 'color';
interface ToggleButtonProps {
icon: string;
selected: boolean;
theme: ThemeType;
theme: ThemeColors;
color?: string;
onPress: () => void;
}
@@ -31,15 +32,15 @@ export const ToggleButton: React.FC<ToggleButtonProps> = ({
padding: 8,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: selected ? theme.rippleColor : 'transparent',
backgroundColor: selected
? Color(theme.primary).alpha(0.12).string()
: 'transparent',
}}
onPress={onPress}
>
<MaterialCommunityIcons
name={icon}
color={
selected ? theme.colorAccent : color ? color : theme.textColorPrimary
}
color={selected ? theme.primary : color ? color : theme.onSurface}
size={24}
/>
</Pressable>
@@ -1,17 +1,16 @@
import React from 'react';
import { StyleSheet } from 'react-native';
import { StyleSheet, View } from 'react-native';
import { getString } from '@strings/translations';
import { Dialog, Portal } from 'react-native-paper';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
import { Button } from '@components/index';
import { ButtonVariation } from '@components/Button/Button';
interface ConfirmationDialogProps {
title: string;
visible: boolean;
theme: ThemeType;
theme: ThemeColors;
onSubmit: () => void;
onDismiss: () => void;
}
@@ -33,26 +32,15 @@ const ConfirmationDialog: React.FC<ConfirmationDialogProps> = ({
<Dialog
visible={visible}
onDismiss={onDismiss}
style={[styles.container, { backgroundColor: theme.colorPrimary }]}
style={[styles.container, { backgroundColor: theme.overlay3 }]}
>
<Dialog.Title style={[styles.title, { color: theme.textColorPrimary }]}>
<Dialog.Title style={[styles.title, { color: theme.onSurface }]}>
{title}
</Dialog.Title>
<Dialog.Actions>
<Button
theme={theme}
onPress={onDismiss}
title={getString('common.cancel')}
variation={ButtonVariation.CLEAR}
/>
<Button
theme={theme}
onPress={handleOnSubmit}
title={getString('common.ok')}
variation={ButtonVariation.CLEAR}
style={styles.button}
/>
</Dialog.Actions>
<View style={styles.buttonCtn}>
<Button onPress={handleOnSubmit} title={getString('common.ok')} />
<Button onPress={onDismiss} title={getString('common.cancel')} />
</View>
</Dialog>
</Portal>
);
@@ -62,13 +50,14 @@ export default ConfirmationDialog;
const styles = StyleSheet.create({
container: {
borderRadius: 8,
borderRadius: 28,
},
title: {
letterSpacing: 0,
fontSize: 16,
},
button: {
marginLeft: 4,
buttonCtn: {
flexDirection: 'row-reverse',
padding: 16,
},
});
+4 -6
View File
@@ -1,25 +1,23 @@
import { useTheme } from '@hooks/useTheme';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { useSelector } from 'react-redux';
const EmptyView = ({ icon, description, style, children, iconStyle }) => {
const theme = useSelector(state => state.settingsReducer.theme);
const theme = useTheme();
return (
<View style={styles.emptyViewContainer}>
<Text
style={[
styles.emptyViewIcon,
{ color: theme.textColorHint },
{ color: theme.outline },
style,
iconStyle,
]}
>
{icon}
</Text>
<Text
style={[styles.emptyViewText, { color: theme.textColorHint }, style]}
>
<Text style={[styles.emptyViewText, { color: theme.outline }, style]}>
{description}
</Text>
{children}
+5 -6
View File
@@ -1,22 +1,20 @@
import React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
interface EmptyViewProps {
icon?: string;
description: string;
theme: ThemeType;
theme: ThemeColors;
}
const EmptyView: React.FC<EmptyViewProps> = ({ icon, description, theme }) => (
<View style={styles.container}>
{icon ? (
<Text style={[styles.icon, { color: theme.textColorHint }]}>{icon}</Text>
<Text style={[styles.icon, { color: theme.outline }]}>{icon}</Text>
) : null}
<Text style={[styles.text, { color: theme.textColorHint }]}>
{description}
</Text>
<Text style={[styles.text, { color: theme.outline }]}>{description}</Text>
</View>
);
@@ -25,6 +23,7 @@ export default EmptyView;
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 16,
alignItems: 'center',
justifyContent: 'center',
},
@@ -1,20 +1,21 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { ThemeType } from '../../theme/types';
import { useTheme } from '@hooks/useTheme';
interface ErrorScreenProps {
error?: string;
theme: ThemeType;
error: string;
onRetry?: () => void;
retryIconColor?: string;
}
const ErrorScreen: React.FC<ErrorScreenProps> = ({ error, theme }) => {
const ErrorScreen: React.FC<ErrorScreenProps> = ({ error }) => {
const theme = useTheme();
return (
<View style={styles.container}>
<Text style={[styles.icon, { color: theme.textColorHint }]}>ಥ_ಥ</Text>
<Text style={[styles.error, { color: theme.textColorHint }]}>
{error}
</Text>
<Text style={[styles.icon, { color: theme.outline }]}>ಥ_ಥ</Text>
<Text style={[styles.error, { color: theme.outline }]}>{error}</Text>
</View>
);
};
+4 -4
View File
@@ -6,11 +6,11 @@ import { IconButton } from 'react-native-paper';
export const ErrorView = ({ errorName, actions, theme }) => (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={[styles.emptyViewIcon, { color: theme.textColorHint }]}>
<Text style={[styles.emptyViewIcon, { color: theme.outline }]}>
{/* {icons[Math.floor(Math.random() * 5)]} */}
ಥ_ಥ
</Text>
<Text style={[styles.emptyViewText, { color: theme.textColorHint }]}>
<Text style={[styles.emptyViewText, { color: theme.outline }]}>
{errorName}
</Text>
<View style={{ flexDirection: 'row' }}>
@@ -38,14 +38,14 @@ export const ErrorView = ({ errorName, actions, theme }) => (
>
<IconButton
icon={action.icon}
color={theme.textColorHint}
color={theme.outline}
size={24}
style={{ margin: 0 }}
/>
<Text
style={{
fontSize: 12,
color: theme.textColorHint,
color: theme.outline,
}}
>
{action.name}
-42
View File
@@ -1,42 +0,0 @@
import React from 'react';
import { Pressable, StyleSheet, ViewPropTypes } from 'react-native';
import PropTypes from 'prop-types';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
export const IconButton = ({
icon,
size,
color,
onPress,
containerStyle,
theme,
}) => (
<Pressable
style={[styles.container, containerStyle]}
android_ripple={{ color: theme.rippleColor, borderless: true, radius: 20 }}
onPress={onPress}
>
<MaterialCommunityIcons name={icon} size={size} color={color} />
</Pressable>
);
IconButton.defaultProps = {
size: 24,
color: '#FFFFFF',
};
IconButton.propTypes = {
icon: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
color: PropTypes.string,
onPress: PropTypes.func,
containerStyle: ViewPropTypes.style,
theme: PropTypes.object.isRequired,
};
const styles = StyleSheet.create({
container: {
margin: 6,
},
});
+9 -4
View File
@@ -1,8 +1,9 @@
import React from 'react';
import { Pressable, StyleSheet, View, ViewStyle } from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import Color from 'color';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
type Props = {
name: string;
@@ -11,7 +12,7 @@ type Props = {
disabled?: boolean;
padding?: number;
onPress?: () => void;
theme: ThemeType;
theme: ThemeColors;
style?: ViewStyle;
};
@@ -30,12 +31,16 @@ const IconButton: React.FC<Props> = ({
style={[styles.pressable, { padding }]}
onPress={onPress}
disabled={disabled}
android_ripple={{ color: theme.rippleColor }}
android_ripple={
onPress
? { color: Color(theme.primary).alpha(0.12).string() }
: undefined
}
>
<MaterialCommunityIcons
name={name}
size={size}
color={disabled ? theme.textColorHint : color || theme.textColorPrimary}
color={disabled ? theme.outline : color || theme.onSurface}
/>
</Pressable>
</View>
-131
View File
@@ -1,131 +0,0 @@
import React from 'react';
import { Pressable, StyleSheet, Text, View } from 'react-native';
import { List as PaperList, Divider as PaperDivider } from 'react-native-paper';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
const ListSection = ({ children }) => (
<PaperList.Section style={styles.listSection}>{children}</PaperList.Section>
);
const ListSubHeader = ({ children, theme }) => (
<PaperList.Subheader
style={[styles.listSubHeader, { color: theme.colorAccent }]}
>
{children}
</PaperList.Subheader>
);
const ListItem = ({
title,
description,
icon,
onPress,
theme,
right,
iconColor,
titleStyle,
style,
}) => (
<PaperList.Item
title={title}
style={style}
titleStyle={[{ color: theme.textColorPrimary }, titleStyle]}
description={description}
descriptionStyle={{ color: theme.textColorSecondary }}
descriptionNumberOfLines={1}
left={() => (
<View style={{ justifyContent: 'center' }}>
{icon && (
<PaperList.Icon
color={theme.colorAccent}
icon={icon}
style={{
marginVertical: 0,
}}
/>
)}
</View>
)}
right={() =>
right && (
<MaterialCommunityIcons
name={right}
color={iconColor || '#47a84a'}
size={23}
style={{ marginRight: 16, textAlignVertical: 'center' }}
/>
)
}
onPress={onPress}
rippleColor={theme.rippleColor}
/>
);
const Divider = ({ theme }) => (
<PaperDivider style={{ backgroundColor: theme.dividerColor, height: 1 }} />
);
const InfoItem = ({ title, icon, theme }) => (
<PaperList.Item
title={title}
titleStyle={{ color: theme.textColorSecondary, fontSize: 14 }}
titleNumberOfLines={5}
left={() =>
icon && <PaperList.Icon color={theme.textColorSecondary} icon={icon} />
}
/>
);
const ColorItem = ({ title, description, theme, onPress }) => (
<Pressable
style={{
padding: 16,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
}}
android_ripple={{ color: theme.rippleColor }}
onPress={onPress}
>
<View>
<Text style={{ color: theme.textColorPrimary, fontSize: 16 }}>
{title}
</Text>
<Text style={{ color: theme.textColorSecondary }}>{description}</Text>
</View>
<View
style={{
backgroundColor: description,
height: 24,
width: 24,
borderRadius: 50,
marginRight: 16,
}}
/>
</Pressable>
);
const Icon = ({ icon, theme }) => (
<PaperList.Icon color={theme.colorAccent} icon={icon} style={{ margin: 0 }} />
);
export const List = {
Section: ListSection,
SubHeader: ListSubHeader,
Item: ListItem,
Divider,
InfoItem,
ColorItem,
Icon,
};
const styles = StyleSheet.create({
listSection: {
flex: 1,
marginVertical: 0,
},
listSubHeader: {
paddingBottom: 5,
},
});
+75 -38
View File
@@ -1,15 +1,16 @@
import React, { ReactNode } from 'react';
import { StyleSheet, View } from 'react-native';
import { Pressable, StyleSheet, Text, View } from 'react-native';
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
import { List as PaperList, Divider as PaperDivider } from 'react-native-paper';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
interface ListItemProps {
title: string;
description?: string | null;
icon?: string;
onPress?: () => void;
theme: ThemeType;
theme: ThemeColors;
}
const Section = ({ children }: { children: ReactNode }) => (
@@ -21,9 +22,9 @@ const SubHeader = ({
theme,
}: {
children: ReactNode;
theme: ThemeType;
theme: ThemeColors;
}) => (
<PaperList.Subheader style={{ color: theme.colorAccent }}>
<PaperList.Subheader style={{ color: theme.primary }}>
{children}
</PaperList.Subheader>
);
@@ -37,48 +38,76 @@ const Item: React.FC<ListItemProps> = ({
}) => (
<PaperList.Item
title={title}
titleStyle={{ color: theme.textColorPrimary }}
titleStyle={{ color: theme.onSurface }}
description={description}
descriptionStyle={{ color: theme.textColorSecondary }}
left={() => (
<View style={styles.iconContainer}>
{icon && (
<PaperList.Icon
color={theme.colorAccent}
icon={icon}
style={styles.icon}
/>
)}
</View>
)}
descriptionStyle={{ color: theme.onSurfaceVariant }}
left={
icon
? () => (
<PaperList.Icon
color={theme.primary}
icon={icon}
style={styles.iconCtn}
/>
)
: undefined
}
onPress={onPress}
rippleColor={theme.rippleColor}
style={styles.listItemCtn}
/>
);
const Divider = ({ theme }: { theme: ThemeType }) => (
<PaperDivider
style={[styles.divider, { backgroundColor: theme.dividerColor }]}
/>
const Divider = ({ theme }: { theme: ThemeColors }) => (
<PaperDivider style={[styles.divider, { backgroundColor: theme.outline }]} />
);
const InfoItem = ({
title,
icon,
icon = 'information-outline',
theme,
}: {
title: string;
icon: string;
theme: ThemeType;
theme: ThemeColors;
}) => (
<PaperList.Item
title={title}
titleStyle={[{ color: theme.textColorSecondary }, styles.infoItem]}
titleNumberOfLines={5}
left={() =>
icon && <PaperList.Icon color={theme.textColorSecondary} icon={icon} />
}
/>
<View style={styles.infoCtn}>
<MaterialIcon size={20} color={theme.onSurfaceVariant} name={icon} />
<Text style={[styles.infoMsg, { color: theme.onSurfaceVariant }]}>
{title}
</Text>
</View>
);
const Icon = ({ icon, theme }: { icon: string; theme: ThemeColors }) => (
<PaperList.Icon color={theme.primary} icon={icon} style={{ margin: 0 }} />
);
const ColorItem = ({ title, description, theme, onPress }) => (
<Pressable
style={{
padding: 16,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
}}
android_ripple={{ color: theme.rippleColor }}
onPress={onPress}
>
<View>
<Text style={{ color: theme.onSurface, fontSize: 16 }}>{title}</Text>
<Text style={{ color: theme.onSurfaceVariant }}>{description}</Text>
</View>
<View
style={{
backgroundColor: description,
height: 24,
width: 24,
borderRadius: 50,
marginRight: 16,
}}
/>
</Pressable>
);
export default {
@@ -87,6 +116,8 @@ export default {
Item,
Divider,
InfoItem,
Icon,
ColorItem,
};
const styles = StyleSheet.create({
@@ -96,14 +127,20 @@ const styles = StyleSheet.create({
},
divider: {
height: 1,
opacity: 0.5,
},
iconContainer: {
justifyContent: 'center',
infoCtn: {
paddingVertical: 12,
paddingHorizontal: 16,
},
icon: {
marginVertical: 0,
infoMsg: {
marginTop: 12,
fontSize: 12,
},
infoItem: {
fontSize: 14,
iconCtn: {
paddingLeft: 16,
},
listItemCtn: {
paddingVertical: 12,
},
});
+6 -3
View File
@@ -2,9 +2,10 @@ import React from 'react';
import { StyleSheet, View, Text, Pressable } from 'react-native';
import FastImage from 'react-native-fast-image';
import { defaultCoverUri } from '../sources/helpers/constants';
import { coverPlaceholderColor } from '../theme/colors';
import color from 'color';
const ListView = ({
item,
downloadBadge,
@@ -20,7 +21,9 @@ const ListView = ({
android_ripple={{ color: theme.rippleColor }}
style={[
styles.listView,
isSelected && { backgroundColor: theme.rippleColor },
isSelected && {
backgroundColor: color(theme.primary).alpha(0.12).string(),
},
]}
onPress={onPress}
onLongPress={onLongPress}
@@ -32,7 +35,7 @@ const ListView = ({
style={[styles.extensionIcon, inLibraryBadge && { opacity: 0.5 }]}
/>
<Text
style={[{ color: theme.textColorPrimary }, styles.novelName]}
style={[{ color: theme.onSurface }, styles.novelName]}
numberOfLines={1}
>
{item.novelName}
@@ -1,13 +1,13 @@
import React from 'react';
import { ActivityIndicator, StyleSheet } from 'react-native';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
interface Props {
theme: ThemeType;
theme: ThemeColors;
}
const LoadingMoreIndicator: React.FC<Props> = ({ theme }) => (
<ActivityIndicator color={theme.colorAccent} style={styles.indicator} />
<ActivityIndicator color={theme.primary} style={styles.indicator} />
);
export default LoadingMoreIndicator;
@@ -1,8 +0,0 @@
import React from 'react';
import { ActivityIndicator, View } from 'react-native';
export const LoadingScreen = ({ theme }) => (
<View style={{ flex: 1, justifyContent: 'center' }}>
<ActivityIndicator size={50} color={theme.colorAccent} />
</View>
);
@@ -1,14 +1,10 @@
import React from 'react';
import { StyleSheet, ActivityIndicator } from 'react-native';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
const LoadingScreen: React.FC<{ theme: ThemeType }> = ({ theme }) => (
<ActivityIndicator
size={50}
color={theme.colorAccent}
style={styles.indicator}
/>
const LoadingScreen: React.FC<{ theme: ThemeColors }> = ({ theme }) => (
<ActivityIndicator size={50} color={theme.primary} style={styles.indicator} />
);
export default LoadingScreen;
+8 -11
View File
@@ -2,12 +2,13 @@ import React, { useState } from 'react';
import { StyleSheet, View, Text, Dimensions } from 'react-native';
import { Portal, Modal } from 'react-native-paper';
import * as Linking from 'expo-linking';
import { useTheme } from '../hooks/reduxHooks';
import { ScrollView } from 'react-native-gesture-handler';
import Button, { ButtonVariation } from './Button/Button';
import Button from './Button/Button';
import { getString } from '@strings/translations';
import Markdown from 'react-native-markdown-display';
import { useTheme } from '@hooks/useTheme';
interface NewUpdateDialogProps {
newVersion: {
tag_name: string;
@@ -30,26 +31,26 @@ const NewUpdateDialog: React.FC<NewUpdateDialogProps> = ({ newVersion }) => {
onDismiss={() => showNewUpdateDialog(false)}
contentContainerStyle={[
styles.containerStyle,
{ backgroundColor: theme.colorPrimaryDark },
{ backgroundColor: theme.overlay3 },
]}
>
<Text style={[styles.modalHeader, { color: theme.textColorPrimary }]}>
<Text style={[styles.modalHeader, { color: theme.onSurface }]}>
{`${getString('common.newUpdateAvailable')} ${newVersion.tag_name}`}
</Text>
<ScrollView style={{ height: modalHeight }}>
<Markdown
style={{
body: {
color: theme.textColorSecondary,
color: theme.onSurfaceVariant,
lineHeight: 20,
paddingVertical: 8,
},
hr: {
backgroundColor: theme.dividerColor,
backgroundColor: theme.outline,
marginVertical: 16,
},
code_inline: {
backgroundColor: theme.colorPrimaryDark,
backgroundColor: theme.overlay3,
},
}}
>
@@ -59,14 +60,10 @@ const NewUpdateDialog: React.FC<NewUpdateDialogProps> = ({ newVersion }) => {
<View style={styles.buttonCtn}>
<Button
title={getString('common.cancel')}
theme={theme}
variation={ButtonVariation.CLEAR}
onPress={() => showNewUpdateDialog(false)}
/>
<Button
title={getString('common.install')}
theme={theme}
variation={ButtonVariation.CLEAR}
onPress={() => Linking.openURL(newVersion.downloadUrl)}
/>
</View>
+40 -28
View File
@@ -1,4 +1,4 @@
import React, { memo, useCallback } from 'react';
import React, { memo, useMemo } from 'react';
import {
StyleSheet,
View,
@@ -6,15 +6,16 @@ import {
useWindowDimensions,
Pressable,
} from 'react-native';
import color from 'color';
import { LinearGradient } from 'expo-linear-gradient';
import FastImage from 'react-native-fast-image';
import ListView from './ListView';
import { useDeviceOrientation } from '../services/utils/helpers';
import { useSettings } from '../hooks/reduxHooks';
import { useDeviceOrientation } from '@hooks/useDeviceOrientation';
import { coverPlaceholderColor } from '../theme/colors';
import { useLibrarySettings } from '@hooks/useSettings';
import { DisplayModes } from '@screens/library/constants/constants';
const NovelCover = ({
item,
@@ -25,43 +26,48 @@ const NovelCover = ({
onLongPress,
selectedNovels,
}) => {
const { displayMode, novelsPerRow, showDownloadBadges, showUnreadBadges } =
useSettings();
const {
displayMode = DisplayModes.Comfortable,
showDownloadBadges = true,
showUnreadBadges = true,
novelsPerRow = 3,
} = useLibrarySettings();
const window = useWindowDimensions();
const orientation = useDeviceOrientation();
const getNovelsPerRow = () =>
orientation === 'landscape' ? 6 : novelsPerRow;
const numColumns = useMemo(
() => (orientation === 'landscape' ? 6 : novelsPerRow),
[orientation, novelsPerRow],
);
const getHeight = useCallback(
() => (window.width / getNovelsPerRow()) * (4 / 3),
// eslint-disable-next-line react-hooks/exhaustive-deps
[],
const coverHeight = useMemo(
() => (window.width / numColumns) * (4 / 3),
[numColumns],
);
const selectNovel = () => onLongPress && onLongPress(item.novelId);
const uri = item.novelCover;
return displayMode !== 2 ? (
return displayMode !== DisplayModes.List ? (
<View
style={[
{
flex: 1 / getNovelsPerRow(),
flex: 1 / numColumns,
borderRadius: 6,
overflow: 'hidden',
margin: 2,
},
isSelected && {
backgroundColor: theme.colorAccent,
backgroundColor: theme.primary,
opacity: 0.8,
},
]}
>
<Pressable
android_ripple={{ color: theme.colorAccent }}
android_ripple={{ color: theme.rippleColor }}
style={styles.opac}
onPress={
selectedNovels && selectedNovels.length > 0 ? selectNovel : onPress
@@ -75,6 +81,7 @@ const NovelCover = ({
showUnreadBadges={showUnreadBadges}
chaptersDownloaded={item.chaptersDownloaded}
chaptersUnread={item.chaptersUnread}
theme={theme}
/>
)}
{showUnreadBadges && item.chaptersUnread && (
@@ -90,7 +97,7 @@ const NovelCover = ({
source={{ uri }}
style={[
{
height: getHeight(),
height: coverHeight,
borderRadius: 4,
backgroundColor: coverPlaceholderColor,
},
@@ -98,9 +105,11 @@ const NovelCover = ({
]}
/>
<View style={styles.compactTitleContainer}>
{displayMode === 0 && <CompactTitle novelName={item.novelName} />}
{displayMode === DisplayModes.Compact && (
<CompactTitle novelName={item.novelName} />
)}
</View>
{displayMode === 1 && (
{displayMode === DisplayModes.Comfortable && (
<ComfortableTitle novelName={item.novelName} theme={theme} />
)}
</Pressable>
@@ -112,6 +121,7 @@ const NovelCover = ({
showDownloadBadges &&
item.chaptersDownloaded && (
<DownloadBadge
theme={theme}
showUnreadBadges={showUnreadBadges}
chaptersDownloaded={item.chaptersDownloaded}
chaptersUnread={item.chaptersUnread}
@@ -148,7 +158,7 @@ const ComfortableTitle = ({ theme, novelName }) => (
style={[
styles.title,
{
color: theme.textColorPrimary,
color: theme.onSurface,
padding: 4,
},
]}
@@ -186,8 +196,8 @@ const InLibraryBadge = ({ theme }) => (
style={[
styles.inLibraryBadge,
{
backgroundColor: theme.colorAccent,
color: theme.colorButtonText,
backgroundColor: theme.primary,
color: theme.onPrimary,
borderRadius: 4,
},
]}
@@ -213,8 +223,8 @@ const UnreadBadge = ({
borderRadius: 4,
},
{
backgroundColor: theme.colorAccent,
color: theme.colorButtonText,
backgroundColor: theme.primary,
color: theme.onPrimary,
},
]}
>
@@ -226,6 +236,7 @@ const DownloadBadge = ({
chaptersDownloaded,
showUnreadBadges,
chaptersUnread,
theme,
}) => (
<Text
style={[
@@ -237,6 +248,10 @@ const DownloadBadge = ({
!showUnreadBadges && {
borderRadius: 4,
},
{
backgroundColor: theme.tertiary,
color: theme.onTertiary,
},
]}
>
{chaptersDownloaded}
@@ -276,16 +291,13 @@ const styles = StyleSheet.create({
},
downloadBadge: {
backgroundColor: '#2979FF',
color: '#FFFFFF',
borderTopLeftRadius: 4,
borderBottomLeftRadius: 4,
paddingTop: 2,
paddingHorizontal: 4,
paddingHorizontal: 5,
fontSize: 12,
},
unreadBadge: {
color: '#FFFFFF',
borderTopRightRadius: 4,
borderBottomRightRadius: 4,
paddingTop: 2,
-61
View File
@@ -1,61 +0,0 @@
import React, { useCallback } from 'react';
import { StyleSheet, FlatList } from 'react-native';
import { useSettings } from '../hooks/reduxHooks';
import { useDeviceOrientation } from '../services/utils/helpers';
const NovelList = ({
data,
onScroll,
onEndReached,
renderItem,
refreshControl,
ListEmptyComponent,
ListFooterComponent,
}) => {
const { displayMode, novelsPerRow } = useSettings();
const orientation = useDeviceOrientation();
const getNovelsPerRow = () => {
if (displayMode === 2) {
return 1;
}
if (orientation === 'landscape') {
return 6;
} else {
return novelsPerRow;
}
};
const keyExtractor = useCallback(item => item.sourceId + item.novelUrl, []);
return (
<FlatList
contentContainerStyle={[
styles.flatListCont,
displayMode !== 2 && { paddingHorizontal: 4 },
]}
numColumns={getNovelsPerRow()}
key={[orientation, getNovelsPerRow()]}
data={data}
keyExtractor={keyExtractor}
renderItem={renderItem}
refreshControl={refreshControl}
ListEmptyComponent={ListEmptyComponent}
ListFooterComponent={ListFooterComponent}
onScroll={onScroll}
onEndReached={onEndReached}
/>
);
};
export default NovelList;
const styles = StyleSheet.create({
flatListCont: {
flexGrow: 1,
paddingBottom: 56,
},
});
+66
View File
@@ -0,0 +1,66 @@
import { useLibrarySettings } from '@hooks/useSettings';
import { DisplayModes } from '@screens/library/constants/constants';
import React, { useCallback, useMemo } from 'react';
import {
StyleSheet,
FlatList,
FlatListProps,
ListRenderItem,
} from 'react-native';
import { SourceNovelItem } from '../sources/types';
import { LibraryNovelInfo, NovelInfo } from '../database/types';
import { useDeviceOrientation } from '@hooks/useDeviceOrientation';
export type NovelListRenderItem = ListRenderItem<
LibraryNovelInfo | NovelInfo | SourceNovelItem
>;
const NovelList: React.FC<
FlatListProps<LibraryNovelInfo | NovelInfo | SourceNovelItem>
> = props => {
const { displayMode = DisplayModes.Comfortable, novelsPerRow = 3 } =
useLibrarySettings();
const orientation = useDeviceOrientation();
const isListView = displayMode === DisplayModes.List;
const numColumns = useMemo(() => {
if (isListView) {
return 1;
}
if (orientation === 'landscape') {
return 6;
} else {
return novelsPerRow;
}
}, [isListView, orientation, novelsPerRow]);
const keyExtractor = useCallback(item => item.sourceId + item.novelUrl, []);
return (
<FlatList
contentContainerStyle={[
!isListView && styles.listView,
styles.flatListCont,
]}
numColumns={numColumns}
key={numColumns}
keyExtractor={keyExtractor}
{...props}
/>
);
};
export default NovelList;
const styles = StyleSheet.create({
flatListCont: {
flexGrow: 1,
paddingBottom: 56,
},
listView: {
paddingHorizontal: 4,
},
});
-40
View File
@@ -1,40 +0,0 @@
import React from 'react';
import { FlatList, FlatListProps, StyleSheet } from 'react-native';
import { useAppearanceSettings } from '../../redux/hooks';
import { useDeviceOrientation } from '../../hooks';
import { LibraryNovelInfo, NovelInfo } from '../../database/types';
import { SourceNovelItem } from '../../sources/types';
import { DeviceOrientation } from '../../hooks/useDeviceOrientation';
const NovelList: React.FC<
FlatListProps<SourceNovelItem | NovelInfo | LibraryNovelInfo>
> = props => {
const orientation = useDeviceOrientation();
const { novelsPerRowPotrait, novelsPerRowLandscape } =
useAppearanceSettings();
return (
<FlatList
contentContainerStyle={styles.container}
numColumns={
orientation === DeviceOrientation.LANDSCAPE
? novelsPerRowLandscape
: novelsPerRowPotrait
}
key={[orientation, novelsPerRowPotrait] as any}
{...props}
/>
);
};
export default NovelList;
const styles = StyleSheet.create({
container: {
flexGrow: 1,
padding: 4,
},
});
+3 -7
View File
@@ -12,15 +12,11 @@ export const RadioButton = ({ value, label, theme, labelStyle }) => (
<View style={styles.radioButtonContainer}>
<MaterialRadioButton
value={value}
color={theme.colorAccent}
uncheckedColor={theme.textColorSecondary}
color={theme.primary}
uncheckedColor={theme.onSurfaceVariant}
/>
<Text
style={[
styles.radioButtonLabel,
{ color: theme.textColorPrimary },
labelStyle,
]}
style={[styles.radioButtonLabel, { color: theme.onSurface }, labelStyle]}
>
{label}
</Text>
@@ -1,8 +1,25 @@
import React from 'react';
import { Pressable, StyleSheet, Text } from 'react-native';
import {
Pressable,
StyleProp,
StyleSheet,
Text,
TextStyle,
ViewStyle,
} from 'react-native';
import { RadioButton as PaperRadioButton } from 'react-native-paper';
import { ThemeColors } from '../../theme/types';
export const RadioButton = ({
interface Props {
label: string;
status: boolean;
onPress?: () => void;
style?: StyleProp<ViewStyle>;
labelStyle?: StyleProp<TextStyle>;
theme: ThemeColors;
}
export const RadioButton: React.FC<Props> = ({
label,
status,
onPress,
@@ -17,13 +34,12 @@ export const RadioButton = ({
>
<PaperRadioButton
status={status ? 'checked' : 'unchecked'}
value={label}
onPress={onPress}
color={theme.colorAccent}
uncheckedColor={theme.textColorSecondary}
color={theme.primary}
uncheckedColor={theme.onSurfaceVariant}
/>
<Text
style={[labelStyle, { color: theme.textColorPrimary, marginLeft: 12 }]}
>
<Text style={[styles.label, labelStyle, { color: theme.onSurface }]}>
{label}
</Text>
</Pressable>
@@ -41,4 +57,7 @@ const styles = StyleSheet.create({
left: 24,
alignSelf: 'center',
},
label: {
marginLeft: 12,
},
});
-97
View File
@@ -1,97 +0,0 @@
import React, { useRef } from 'react';
import {
StyleSheet,
View,
TextInput,
StatusBar,
Pressable,
} from 'react-native';
import { Row } from '../Common';
import { IconButton } from '../IconButton/IconButton';
export const Searchbar = ({
theme,
placeholder,
searchText,
backAction,
onBackAction,
clearSearchbar,
onChangeText,
onSubmitEditing,
actions,
}) => {
const searchRef = useRef(null);
return (
<View style={styles.searchBar}>
<Pressable
onPress={() => searchRef.current.focus()}
style={[styles.pressable, { backgroundColor: theme.searchBarColor }]}
android_ripple={{ color: theme.rippleColor }}
>
<Row style={{ flex: 1 }}>
{backAction && (
<IconButton
icon={backAction}
color={theme.textColorPrimary}
onPress={onBackAction}
theme={theme}
containerStyle={{ marginLeft: 0 }}
/>
)}
<TextInput
ref={searchRef}
style={{
flex: 1,
fontSize: 16,
color: theme.textColorPrimary,
marginLeft: 4,
}}
placeholder={placeholder}
placeholderTextColor={theme.textColorSecondary}
onChangeText={onChangeText}
onSubmitEditing={onSubmitEditing}
defaultValue={searchText}
/>
</Row>
{searchText !== '' && (
<IconButton
icon="close"
color={theme.textColorPrimary}
onPress={clearSearchbar}
theme={theme}
/>
)}
{actions &&
actions.map((action, index) => (
<IconButton
key={index}
icon={action.icon}
color={action.color ?? theme.textColorPrimary}
onPress={action.onPress}
theme={theme}
containerStyle={{ marginRight: 0, marginLeft: 16 }}
/>
))}
</Pressable>
</View>
);
};
const styles = StyleSheet.create({
searchBar: {
marginTop: StatusBar.currentHeight + 8,
marginBottom: 8,
marginHorizontal: 16,
height: 46,
borderRadius: 50,
overflow: 'hidden',
},
pressable: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingHorizontal: 16,
},
});
+18 -11
View File
@@ -3,7 +3,7 @@ import { Pressable, StyleSheet, View, TextInput } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import IconButtonV2 from '../IconButtonV2/IconButtonV2';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
interface RightIcon {
iconName: string;
@@ -21,7 +21,7 @@ interface SearcbarProps {
handleBackAction?: () => void;
clearSearchbar: () => void;
onLeftIconPress?: () => void;
theme: ThemeType;
theme: ThemeColors;
}
const Searchbar: React.FC<SearcbarProps> = ({
@@ -39,14 +39,21 @@ const Searchbar: React.FC<SearcbarProps> = ({
const searchbarRef = useRef<any>(null);
const focusSearchbar = () => searchbarRef.current.focus();
const { top } = useSafeAreaInsets();
const { top, right, left } = useSafeAreaInsets();
const marginTop = top + 8;
const marginRight = right + 16;
const marginLeft = left + 16;
return (
<View
style={[
styles.searchbarContainer,
{ marginTop, backgroundColor: theme.searchBarColor },
{
marginTop,
marginRight,
marginLeft,
backgroundColor: theme.surface2,
},
]}
>
<Pressable
@@ -56,7 +63,7 @@ const Searchbar: React.FC<SearcbarProps> = ({
>
<IconButtonV2
name={handleBackAction ? 'arrow-left' : leftIcon}
color={theme.textColorPrimary}
color={theme.onSurface}
onPress={() => {
if (handleBackAction) {
handleBackAction();
@@ -69,9 +76,9 @@ const Searchbar: React.FC<SearcbarProps> = ({
<TextInput
ref={searchbarRef}
style={[styles.textInput, { color: theme.textColorPrimary }]}
style={[styles.textInput, { color: theme.onSurface }]}
placeholder={placeholder}
placeholderTextColor={theme.textColorSecondary}
placeholderTextColor={theme.onSurface}
onChangeText={onChangeText}
onSubmitEditing={onSubmitEditing}
defaultValue={searchText}
@@ -79,7 +86,7 @@ const Searchbar: React.FC<SearcbarProps> = ({
{searchText !== '' ? (
<IconButtonV2
name="close"
color={theme.textColorPrimary}
color={theme.onSurface}
onPress={clearSearchbar}
theme={theme}
/>
@@ -88,7 +95,7 @@ const Searchbar: React.FC<SearcbarProps> = ({
<IconButtonV2
key={index}
name={icon.iconName}
color={icon.color || theme.textColorPrimary}
color={icon.color || theme.onSurface}
onPress={icon.onPress}
theme={theme}
/>
@@ -103,8 +110,8 @@ export default Searchbar;
const styles = StyleSheet.create({
searchbarContainer: {
marginHorizontal: 16,
marginBottom: 16,
minHeight: 46,
marginBottom: 12,
minHeight: 56,
borderRadius: 50,
overflow: 'hidden',
zIndex: 1,
-53
View File
@@ -1,53 +0,0 @@
import React from 'react';
import { Pressable, StyleSheet, View, Text } from 'react-native';
import { Switch, List } from 'react-native-paper';
const SwitchSetting = ({ label, description, onPress, theme, icon, value }) => (
<Pressable
android_ripple={{ color: theme.rippleColor }}
style={[styles.container, { paddingVertical: description ? 16 : 12 }]}
onPress={onPress}
>
<View style={{ flexDirection: 'row', flex: 1 }}>
{icon && (
<List.Icon
color={theme.colorAccent}
icon={icon}
style={{ margin: 0 }}
/>
)}
<View style={[icon && { marginLeft: 16 }]}>
<Text
style={{
color: theme.textColorPrimary,
fontSize: 16,
flex: 1,
textAlignVertical: 'center',
}}
>
{label}
</Text>
{description && (
<Text style={{ color: theme.textColorSecondary }}>{description}</Text>
)}
</View>
</View>
<Switch
value={value}
onValueChange={onPress}
color={theme.colorAccent}
style={{ marginLeft: 8 }}
/>
</Pressable>
);
export default SwitchSetting;
const styles = StyleSheet.create({
container: {
paddingHorizontal: 16,
flexDirection: 'row',
justifyContent: 'space-between',
},
});
+77
View File
@@ -0,0 +1,77 @@
import React from 'react';
import { Pressable, StyleSheet, View, Text } from 'react-native';
import { Switch, List } from 'react-native-paper';
import { ThemeColors } from '@theme/types';
interface SwitchProps {
label: string;
description?: string;
onPress: () => void;
theme: ThemeColors;
icon?: string;
value: boolean;
}
const SwitchSetting: React.FC<SwitchProps> = ({
label,
description,
onPress,
theme,
icon,
value,
}) => {
const styles = StyleSheet.create({
container: {
paddingHorizontal: 16,
flexDirection: 'row',
justifyContent: 'space-between',
paddingVertical: description ? 16 : 12,
},
row: {
flexDirection: 'row',
flex: 1,
},
icon: {
margin: 0,
},
textContainer: {
marginLeft: icon && 16,
},
text: {
fontSize: 16,
flex: 1,
textAlignVertical: 'center',
},
switch: { marginLeft: 8 },
});
return (
<Pressable
android_ripple={{
color: theme.rippleColor,
}}
style={styles.container}
onPress={onPress}
>
<View style={styles.row}>
{icon && (
<List.Icon color={theme.primary} icon={icon} style={styles.icon} />
)}
<View style={styles.textContainer}>
<Text style={[styles.text, { color: theme.onSurface }]}>{label}</Text>
{description && (
<Text style={{ color: theme.onSurfaceVariant }}>{description}</Text>
)}
</View>
</View>
<Switch
value={value}
onValueChange={onPress}
color={theme.primary}
style={styles.switch}
/>
</Pressable>
);
};
export default SwitchSetting;
+5 -7
View File
@@ -2,14 +2,14 @@ import React from 'react';
import { Pressable, StyleSheet, View, Text } from 'react-native';
import { Switch } from 'react-native-paper';
import { ThemeType } from '../../theme/types';
import { ThemeColors } from '../../theme/types';
interface SwitchItemProps {
value: boolean;
label: string;
description?: string;
onPress: () => void;
theme: ThemeType;
theme: ThemeColors;
}
const SwitchItem: React.FC<SwitchItemProps> = ({
@@ -25,17 +25,15 @@ const SwitchItem: React.FC<SwitchItemProps> = ({
onPress={onPress}
>
<View style={styles.labelContainer}>
<Text style={[{ color: theme.textColorPrimary }, styles.label]}>
{label}
</Text>
<Text style={[{ color: theme.onSurface }, styles.label]}>{label}</Text>
{description ? (
<Text style={{ color: theme.textColorSecondary }}>{description}</Text>
<Text style={{ color: theme.onSurfaceVariant }}>{description}</Text>
) : null}
</View>
<Switch
value={value}
onValueChange={onPress}
color={theme.colorAccent}
color={theme.primary}
style={styles.switch}
/>
</Pressable>
+19 -17
View File
@@ -1,5 +1,7 @@
import React from 'react';
import { View, Text, /* StyleSheet, */ Pressable } from 'react-native';
import { overlay } from 'react-native-paper';
import color from 'color';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
export const ThemePicker = ({ theme, currentTheme, onPress }) => (
@@ -12,12 +14,12 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
>
<View
style={{
backgroundColor: theme.colorPrimaryDark,
backgroundColor: theme.background,
borderWidth: 3.6,
borderColor:
currentTheme.id === theme.id
? theme.colorAccent
: currentTheme.colorPrimaryDark,
? theme.primary
: currentTheme.background,
width: 95,
height: 140,
borderRadius: 16,
@@ -29,10 +31,10 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
{currentTheme.id === theme.id && (
<MaterialCommunityIcons
name="check"
color={theme.colorButtonText}
color={theme.onPrimary}
size={15}
style={{
backgroundColor: theme.colorAccent,
backgroundColor: theme.primary,
position: 'absolute',
top: 5,
right: 5,
@@ -45,14 +47,14 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
<View
style={{
height: 20,
backgroundColor: theme.colorPrimary,
backgroundColor: overlay(2, theme.surface),
elevation: 1,
justifyContent: 'center',
}}
>
<View
style={{
backgroundColor: theme.textColorPrimary,
backgroundColor: theme.onSurface,
width: 44,
height: 10,
marginLeft: 8,
@@ -64,7 +66,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
<View
style={{
height: 18,
backgroundColor: theme.textColorSecondary,
backgroundColor: theme.onSurfaceVariant,
borderRadius: 4,
}}
/>
@@ -73,7 +75,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
style={{
height: 10,
width: 44,
backgroundColor: theme.textColorPrimary,
backgroundColor: theme.onSurface,
borderRadius: 50,
}}
/>
@@ -82,7 +84,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
height: 10,
width: 16,
marginLeft: 4,
backgroundColor: theme.colorAccent,
backgroundColor: theme.primary,
borderRadius: 50,
}}
/>
@@ -92,7 +94,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
style={{
height: 10,
width: 24,
backgroundColor: theme.textColorSecondary,
backgroundColor: theme.onSurfaceVariant,
borderRadius: 50,
}}
/>
@@ -100,7 +102,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
style={{
height: 10,
width: 24,
backgroundColor: theme.textColorSecondary,
backgroundColor: theme.onSurfaceVariant,
borderRadius: 50,
marginLeft: 4,
}}
@@ -114,7 +116,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
left: 0,
right: 0,
height: 24,
backgroundColor: theme.colorPrimary,
backgroundColor: color(theme.primary).alpha(0.08).string(),
justifyContent: 'center',
}}
>
@@ -132,7 +134,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
height: 12,
width: 12,
borderRadius: 50,
backgroundColor: theme.textColorPrimary,
backgroundColor: theme.onSurface,
opacity: 0.54,
}}
/>
@@ -141,7 +143,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
height: 12,
width: 12,
borderRadius: 50,
backgroundColor: theme.colorAccent,
backgroundColor: theme.primary,
}}
/>
<View
@@ -149,7 +151,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
height: 12,
width: 12,
borderRadius: 50,
backgroundColor: theme.textColorPrimary,
backgroundColor: theme.onSurface,
opacity: 0.54,
}}
/>
@@ -159,7 +161,7 @@ export const ThemePicker = ({ theme, currentTheme, onPress }) => (
</View>
<Text
style={{
color: currentTheme.textColorPrimary,
color: currentTheme.onSurface,
fontSize: 12,
paddingVertical: 4,
}}
+2 -1
View File
@@ -4,7 +4,6 @@ export { default as LoadingScreenV2 } from './LoadingScreenV2/LoadingScreenV2';
export { default as Container } from './Container/Container';
export { default as ErrorScreenV2 } from './ErrorScreenV2/ErrorScreenV2';
export { default as EmptyView } from './EmptyView/EmptyView';
export { default as NovelList } from './NovelList/NovelList';
export { default as Chip } from './Chip/Chip';
export { default as Button } from './Button/Button';
export { default as Appbar } from './Appbar/Appbar';
@@ -12,3 +11,5 @@ export { default as SwitchItem } from './SwitchItem/SwitchItem';
export { default as List } from './List/List';
export { default as ColorPreferenceItem } from './ColorPreferenceItem/ColorPreferenceItem';
export { default as LoadingMoreIndicator } from './LoadingMoreIndicator/LoadingMoreIndicator';
export { Checkbox } from './Checkbox/Checkbox';
export { RadioButton } from './RadioButton/RadioButton';
+66 -14
View File
@@ -3,6 +3,7 @@ import {
createNovelTableQuery,
createUrlIndexQuery,
createLibraryIndexQuery,
addCategoryColumnQuery,
} from './tables/NovelTable';
import {
createChapterTableQuery,
@@ -13,38 +14,89 @@ import {
createHistoryTableQuery,
createChapterIdIndexQuery,
} from './tables/HistoryTable';
import { createDownloadTableQuery } from './tables/DownloadTable';
import {
createDownloadIdIndex,
createDownloadTableQuery,
} from './tables/DownloadTable';
import { createUpdatesTableQuery } from './tables/UpdateTable';
import {
addCategorySortColumnQuery,
createCategoriesTableQuery,
createCategorydIndexQuery,
createDefaultCategoryQuery,
} from './tables/CategoryTable';
import {
dbTxnErrorCallback,
txnErrorCallbackWithoutToast,
} from './utils/helpers';
import { noop } from 'lodash-es';
const dbName = 'lnreader.db';
const db = SQLite.openDatabase(dbName);
export const createDB = () => {
const createTables = () => {
db.transaction(tx => {
tx.executeSql(createNovelTableQuery);
tx.executeSql(createCategoriesTableQuery, [], () => {
tx.executeSql(
addCategorySortColumnQuery,
undefined,
noop,
txnErrorCallbackWithoutToast,
);
tx.executeSql(
createDefaultCategoryQuery,
undefined,
noop,
txnErrorCallbackWithoutToast,
);
});
tx.executeSql(createNovelTableQuery, [], () => {
tx.executeSql(
addCategoryColumnQuery,
undefined,
noop,
txnErrorCallbackWithoutToast,
);
});
tx.executeSql(createChapterTableQuery);
tx.executeSql(createHistoryTableQuery);
tx.executeSql(createDownloadTableQuery);
tx.executeSql(createUpdatesTableQuery);
});
};
/**
* Indexes
*/
const createIndexes = () => {
db.transaction(tx => {
tx.executeSql(createUrlIndexQuery);
tx.executeSql(createLibraryIndexQuery);
tx.executeSql(createNovelIdIndexQuery);
tx.executeSql(createUnreadChaptersIndexQuery);
tx.executeSql(createChapterIdIndexQuery);
tx.executeSql(createCategorydIndexQuery);
tx.executeSql(createDownloadIdIndex);
});
};
export const deleteDb = () => {
db.transaction(tx => {
tx.executeSql('DROP TABLE novels');
tx.executeSql('DROP TABLE chapters');
tx.executeSql('DROP TABLE history');
tx.executeSql('DROP TABLE downloads');
tx.executeSql('DROP TABLE updates');
});
export const createDatabase = async () => {
createTables();
createIndexes();
};
/**
* For Testing
*/
export const deleteDatabase = () => {
db.transaction(
tx => {
tx.executeSql('DROP TABLE novels');
tx.executeSql('DROP TABLE chapters');
tx.executeSql('DROP TABLE history');
tx.executeSql('DROP TABLE downloads');
tx.executeSql('DROP TABLE updates');
tx.executeSql('DROP TABLE categories');
},
dbTxnErrorCallback,
noop,
);
};
+99
View File
@@ -0,0 +1,99 @@
import * as SQLite from 'expo-sqlite';
import { noop } from 'lodash-es';
import { Category } from '../types';
import { txnErrorCallback } from '../utils/helpers';
const db = SQLite.openDatabase('lnreader.db');
const getCategoriesQuery = `
SELECT * FROM categories ORDER BY CASE WHEN id > 1 THEN 1 ELSE 0 END, IFNULL(sort, 9999)
`;
export const getCategoriesFromDb = (): Promise<Category[]> => {
return new Promise(resolve =>
db.transaction(tx => {
tx.executeSql(
getCategoriesQuery,
[],
(txObj, { rows }) => resolve((rows as any)._array),
txnErrorCallback,
);
}),
);
};
const createCategoryQuery = `
INSERT INTO categories (name)
VALUES
(?)
`;
export const createCategory = (categoryName: string): void =>
db.transaction(tx =>
tx.executeSql(createCategoryQuery, [categoryName], noop, txnErrorCallback),
);
const deleteCategoryQuery = `
DELETE FROM categories
WHERE
id = ?
`;
export const deleteCategoryById = (categoryId: number): void =>
db.transaction(tx =>
tx.executeSql(deleteCategoryQuery, [categoryId], noop, txnErrorCallback),
);
const updateCategoryQuery = `
UPDATE categories SET name = ? WHERE id = ?
`;
export const updateCategory = (
categoryId: number,
categoryName: string,
): void =>
db.transaction(tx =>
tx.executeSql(
updateCategoryQuery,
[categoryName, categoryId],
noop,
txnErrorCallback,
),
);
const isCategoryNameDuplicateQuery = `
SELECT COUNT(*) as isDuplicate FROM categories WHERE name = ?
`;
export const isCategoryNameDuplicate = (
categoryName: string,
): Promise<boolean> => {
return new Promise(resolve =>
db.transaction(tx => {
tx.executeSql(
isCategoryNameDuplicateQuery,
[categoryName],
(txObj, { rows }) => {
const { _array } = rows as any;
resolve(Boolean(_array[0]?.isDuplicate));
},
txnErrorCallback,
);
}),
);
};
const updateCategoryOrderQuery = `
UPDATE categories SET sort = ? WHERE id = ?
`;
export const updateCategoryOrderInDb = (categories: Category[]): void =>
db.transaction(tx => {
categories.map(category => {
tx.executeSql(
updateCategoryOrderQuery,
[category.sort, category.id],
noop,
txnErrorCallback,
);
});
});
+146 -83
View File
@@ -5,47 +5,37 @@ import { ChapterItem } from '../types';
import * as cheerio from 'cheerio';
import RNFetchBlob from 'rn-fetch-blob';
import { txnErrorCallback } from '@database/utils/helpers';
const db = SQLite.openDatabase('lnreader.db');
const insertChaptersQuery =
'INSERT INTO chapters (chapterUrl, chapterName, releaseDate, novelId) values (?, ?, ?, ?)';
const insertChaptersQuery = `
INSERT INTO chapters (
chapterUrl, chapterName, releaseDate,
novelId
)
values
(?, ?, ?, ?)
`;
export const insertChapters = async (
novelId: number,
chapters: ChapterItem[],
chapters?: ChapterItem[],
) => {
db.transaction(
tx => {
chapters.map(chapter =>
tx.executeSql(
insertChaptersQuery,
[
chapter.chapterUrl,
chapter.chapterName,
chapter.releaseDate,
novelId,
],
(_txObj, _res) => {},
(_txObj, _error) => false,
// console.log(
// "Error ",
// error,
// " Chapter URL: ",
// chapter.chapterUrl,
// " Novel ID ",
// novelId
// )
),
);
},
_err => {
// console.log('Error', err);
},
() => {
// console.log('Success ')
},
);
if (!chapters?.length) {
return;
}
db.transaction(tx => {
chapters.map(chapter =>
tx.executeSql(insertChaptersQuery, [
chapter.chapterUrl,
chapter.chapterName,
chapter.releaseDate,
novelId,
]),
);
});
};
const getChaptersQuery = (sort = 'ORDER BY chapterId ASC', filter = '') =>
@@ -61,10 +51,7 @@ export const getChapters = (novelId: number, sort: string, filter: string) => {
const _array = (rows as any)._array;
resolve(_array);
},
(_txObj, _error) => {
// console.log('Error ', error)
return false;
},
txnErrorCallback,
);
}),
);
@@ -256,11 +243,16 @@ const createImageFolder = async (
},
): Promise<string> => {
const mkdirIfNot = async (p: string) => {
const nomediaPath =
p + (p.charAt(p.length - 1) === '/' ? '' : '/') + '.nomedia';
if (!(await RNFetchBlob.fs.exists(p))) {
await RNFetchBlob.fs.mkdir(p);
await RNFetchBlob.fs.createFile(nomediaPath, ',', 'utf8');
}
};
await mkdirIfNot(path);
if (data) {
const { sourceId, novelId, chapterId } = data;
await mkdirIfNot(`${path}/${sourceId}/`);
@@ -279,31 +271,53 @@ const downloadImages = async (
chapterId: number,
): Promise<string> => {
try {
const headers = sourceManager(sourceId)?.headers || {};
const loadedCheerio = cheerio.load(html);
const imgs = loadedCheerio('img').toArray();
for (let i = 0; i < imgs.length; i++) {
const elem = loadedCheerio(imgs[i]);
const url = elem.attr('src');
if (url) {
const imageb64 = (await RNFetchBlob.fetch('GET', url)).base64();
const imageb64 = (
await RNFetchBlob.fetch('GET', url, headers)
).base64();
const fileurl =
(await createImageFolder(
`${RNFetchBlob.fs.dirs.DownloadDir}/LNReader`,
{ sourceId, novelId, chapterId },
)) +
).catch(() => {
showToast(
`Unexpected storage error!\nRemove ${fileurl} and try downloading again`,
);
return '--';
})) +
i +
'.b64.png';
elem.replaceWith(
`<img type="file" src="${url}" file-src="${fileurl}" file-id="${i}">`,
);
const exists = await RNFetchBlob.fs.exists(fileurl);
if (fileurl.charAt(0) === '-') {
return loadedCheerio.html();
}
elem.attr('src', `file://${fileurl}`);
const exists = await RNFetchBlob.fs.exists(fileurl).catch(() => {
showToast(
`Unexpected storage error!\nRemove ${fileurl} and try downloading again`,
);
});
if (!exists) {
RNFetchBlob.fs.createFile(fileurl, imageb64, 'utf8');
RNFetchBlob.fs.createFile(fileurl, imageb64, 'base64').catch(() => {
showToast(
`Unexpected storage error!\nRemove ${fileurl} and try downloading again`,
);
});
} else {
RNFetchBlob.fs.writeFile(fileurl, imageb64, 'utf8');
RNFetchBlob.fs.writeFile(fileurl, imageb64, 'base64').catch(() => {
showToast(
`Unexpected storage error!\nRemove ${fileurl} and try downloading again`,
);
});
}
}
}
loadedCheerio('body').prepend("<input type='hidden' offline />");
return loadedCheerio.html();
} catch (e) {
return html;
@@ -317,30 +331,63 @@ export const downloadChapter = async (
chapterUrl: string,
chapterId: number,
) => {
const source = sourceManager(sourceId);
try {
const source = sourceManager(sourceId);
const chapter = await source.parseChapter(novelUrl, chapterUrl);
const chapter = await source.parseChapter(novelUrl, chapterUrl);
const imagedChapterText =
chapter.chapterText &&
(await downloadImages(chapter.chapterText, sourceId, novelId, chapterId));
if (chapter.chapterText?.length) {
const imagedChapterText =
chapter.chapterText &&
(await downloadImages(
chapter.chapterText,
sourceId,
novelId,
chapterId,
));
db.transaction(tx => {
tx.executeSql('UPDATE chapters SET downloaded = 1 WHERE chapterId = ?', [
chapterId,
]);
tx.executeSql(
downloadChapterQuery,
[chapterId, chapter.chapterName, imagedChapterText],
(_txObj, _res) => {
// console.log(`Downloaded Chapter ${chapter.chapterUrl}`);
},
(_txObj, _error) => {
// console.log('Error ', error)
return false;
},
db.transaction(tx => {
tx.executeSql(
'UPDATE chapters SET downloaded = 1 WHERE chapterId = ?',
[chapterId],
);
tx.executeSql(
downloadChapterQuery,
[chapterId, chapter.chapterName, imagedChapterText],
(_txObj, _res) => {
return true;
},
txnErrorCallback,
);
});
} else {
throw new Error("Either chapter is empty or the app couldn't scrape it");
}
} catch (error) {
throw error;
}
};
const deleteDownloadedImages = async (
sourceId: number,
novelId: number,
chapterId: number,
) => {
try {
const path = await createImageFolder(
`${RNFetchBlob.fs.dirs.DownloadDir}/LNReader`,
{ sourceId, novelId, chapterId },
);
});
const files = await RNFetchBlob.fs.ls(path);
for (let i = 0; i < files.length; i++) {
const ex = /\.b64\.png/.exec(files[i]);
if (ex) {
if (await RNFetchBlob.fs.exists(`${path}${files[i]}`)) {
RNFetchBlob.fs.unlink(`${path}${files[i]}`);
}
}
}
} catch (error) {}
};
export const deleteChapter = async (
@@ -352,23 +399,7 @@ export const deleteChapter = async (
'UPDATE chapters SET downloaded = 0 WHERE chapterId=?';
const deleteChapterQuery = 'DELETE FROM downloads WHERE downloadChapterId=?';
const path = `${RNFetchBlob.fs.dirs.DownloadDir}/LNReader/`;
const files = await RNFetchBlob.fs.ls(
await createImageFolder(path, { sourceId, novelId, chapterId }),
);
for (let i = 0; i < files.length; i++) {
const ex = /(.*?)_(.*?)#(.*?)/.exec(files[i]);
if (ex) {
if (
parseInt(ex[1], 10) === sourceId &&
parseInt(ex[2], 10) === chapterId
) {
if (await RNFetchBlob.fs.exists(`${path}${files[i]}`)) {
RNFetchBlob.fs.unlink(`${path}${files[i]}`);
}
}
}
}
await deleteDownloadedImages(sourceId, novelId, chapterId);
db.transaction(tx => {
tx.executeSql(
@@ -394,6 +425,38 @@ export const deleteChapter = async (
});
};
export const deleteChapters = async (
sourceId: number,
chapters?: ChapterItem[],
) => {
if (!chapters?.length) {
return;
}
const chapterIdsString = chapters
?.map(chapter => chapter.chapterId)
.toString();
const updateIsDownloadedQuery = `UPDATE chapters SET downloaded = 0 WHERE chapterId IN (${chapterIdsString})`;
const deleteChapterQuery = `DELETE FROM downloads WHERE downloadChapterId IN (${chapterIdsString})`;
await Promise.all(
chapters?.map(chapter =>
deleteDownloadedImages(sourceId, chapter.novelId, chapter.chapterId),
),
);
db.transaction(tx => {
tx.executeSql(
updateIsDownloadedQuery,
undefined,
undefined,
txnErrorCallback,
);
tx.executeSql(deleteChapterQuery, undefined, undefined, txnErrorCallback);
});
};
const getLastReadChapterQuery = `
SELECT chapters.*
FROM history

Some files were not shown because too many files have changed in this diff Show More