mirror of
https://github.com/venera-app/venera.git
synced 2025-12-18 23:41:15 +00:00
Compare commits
9 Commits
v1.5.2-dev
...
8ca0a7785f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ca0a7785f | |||
| 0eb5d76687 | |||
| 29d25f7fcd | |||
| 7d60e78f27 | |||
|
|
e93b56a008 | ||
|
|
d10873a903 | ||
|
|
2d27f7d650 | ||
|
|
5a76a10fb2 | ||
|
|
f09e766a8a |
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -116,6 +116,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
choco install yq -y
|
choco install yq -y
|
||||||
pip install httpx
|
pip install httpx
|
||||||
|
- name: Install Inno Setup
|
||||||
|
run: choco install innosetup --no-progress
|
||||||
- uses: subosito/flutter-action@v2
|
- uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: "stable"
|
channel: "stable"
|
||||||
|
|||||||
35
.github/workflows/update_alt_store.yml
vendored
35
.github/workflows/update_alt_store.yml
vendored
@@ -31,19 +31,30 @@ jobs:
|
|||||||
- name: Update AltStore source
|
- name: Update AltStore source
|
||||||
id: update_source
|
id: update_source
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
python update_alt_store.py
|
python update_alt_store.py
|
||||||
git config --global user.name 'GitHub Action'
|
git config --global user.name 'GitHub Action'
|
||||||
git config --global user.email 'action@github.com'
|
git config --global user.email 'action@github.com'
|
||||||
git add alt_store.json
|
git add alt_store.json
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "changes=false" >> $GITHUB_OUTPUT
|
echo "changes=false" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
git commit -m "Updated source with latest release"
|
# Create a new branch for the PR
|
||||||
git push
|
branch_name="update-altstore-$(date +%Y%m%d-%H%M%S)"
|
||||||
echo "changes=true" >> $GITHUB_OUTPUT
|
git checkout -b "$branch_name"
|
||||||
fi
|
git commit -m "Updated source with latest release"
|
||||||
|
git push -u origin "$branch_name"
|
||||||
|
|
||||||
|
# Create PR using GitHub CLI
|
||||||
|
gh pr create \
|
||||||
|
--title "Update AltStore source with latest release" \
|
||||||
|
--body "This PR updates the alt_store.json file with the latest release information." \
|
||||||
|
--head "$branch_name" \
|
||||||
|
--base main
|
||||||
|
|
||||||
|
echo "changes=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Calculate job duration
|
- name: Calculate job duration
|
||||||
id: duration
|
id: duration
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export "widget_utils.dart";
|
|||||||
export "context.dart";
|
export "context.dart";
|
||||||
|
|
||||||
class _App {
|
class _App {
|
||||||
final version = "1.5.2";
|
final version = "1.5.3";
|
||||||
|
|
||||||
bool get isAndroid => Platform.isAndroid;
|
bool get isAndroid => Platform.isAndroid;
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ mixin _AppRouteTransitionMixin<T> on PageRoute<T> {
|
|||||||
context,
|
context,
|
||||||
animation,
|
animation,
|
||||||
secondaryAnimation,
|
secondaryAnimation,
|
||||||
enableIOSGesture
|
enableIOSGesture && App.isIOS
|
||||||
? IOSBackGestureDetector(
|
? IOSBackGestureDetector(
|
||||||
gestureWidth: _kBackGestureWidth,
|
gestureWidth: _kBackGestureWidth,
|
||||||
enabledCallback: () => _isPopGestureEnabled<T>(this),
|
enabledCallback: () => _isPopGestureEnabled<T>(this),
|
||||||
@@ -302,7 +302,7 @@ class _IOSBackGestureDetectorState extends State<IOSBackGestureDetector> {
|
|||||||
assert(mounted);
|
assert(mounted);
|
||||||
assert(_backGestureController != null);
|
assert(_backGestureController != null);
|
||||||
_backGestureController!.dragUpdate(
|
_backGestureController!.dragUpdate(
|
||||||
_convertToLogical(details.primaryDelta! / context.size!.width));
|
_convertToLogical(details.primaryDelta! / context.size!.width));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -237,10 +237,12 @@ abstract mixin class _ComicPageActions {
|
|||||||
isGettingLink = false;
|
isGettingLink = false;
|
||||||
});
|
});
|
||||||
} else if (context.mounted) {
|
} else if (context.mounted) {
|
||||||
LocalManager()
|
if (res.data.isNotEmpty) {
|
||||||
|
LocalManager()
|
||||||
.addTask(ArchiveDownloadTask(res.data, comic));
|
.addTask(ArchiveDownloadTask(res.data, comic));
|
||||||
App.rootContext
|
App.rootContext
|
||||||
.showMessage(message: "Download started".tl);
|
.showMessage(message: "Download started".tl);
|
||||||
|
}
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -140,12 +140,12 @@ class _GalleryModeState extends State<_GalleryMode>
|
|||||||
int get totalPages {
|
int get totalPages {
|
||||||
if (!reader.showSingleImageOnFirstPage()) {
|
if (!reader.showSingleImageOnFirstPage()) {
|
||||||
return (reader.images!.length /
|
return (reader.images!.length /
|
||||||
reader.imagesPerPage())
|
reader.imagesPerPage)
|
||||||
.ceil();
|
.ceil();
|
||||||
} else {
|
} else {
|
||||||
return 1 +
|
return 1 +
|
||||||
((reader.images!.length - 1) /
|
((reader.images!.length - 1) /
|
||||||
reader.imagesPerPage())
|
reader.imagesPerPage)
|
||||||
.ceil();
|
.ceil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ class _GalleryModeState extends State<_GalleryMode>
|
|||||||
|
|
||||||
/// Get the range of images for the given page. [page] is 1-based.
|
/// Get the range of images for the given page. [page] is 1-based.
|
||||||
(int start, int end) getPageImagesRange(int page) {
|
(int start, int end) getPageImagesRange(int page) {
|
||||||
var imagesPerPage = reader.imagesPerPage();
|
var imagesPerPage = reader.imagesPerPage;
|
||||||
if (reader.showSingleImageOnFirstPage()) {
|
if (reader.showSingleImageOnFirstPage()) {
|
||||||
if (page == 1) {
|
if (page == 1) {
|
||||||
return (0, 1);
|
return (0, 1);
|
||||||
@@ -191,6 +191,16 @@ class _GalleryModeState extends State<_GalleryMode>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the image indices for current page. Returns null if no images.
|
||||||
|
/// Returns a single index if only one image, or a range if multiple images.
|
||||||
|
(int, int)? getCurrentPageImageRange() {
|
||||||
|
if (reader.images == null || reader.images!.isEmpty) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var (startIndex, endIndex) = getPageImagesRange(reader.page);
|
||||||
|
return (startIndex, endIndex);
|
||||||
|
}
|
||||||
|
|
||||||
/// [cache] is used to cache the images.
|
/// [cache] is used to cache the images.
|
||||||
/// The count of images to cache is determined by the [preCacheCount] setting.
|
/// The count of images to cache is determined by the [preCacheCount] setting.
|
||||||
/// For previous page and next page, it will do a memory cache.
|
/// For previous page and next page, it will do a memory cache.
|
||||||
@@ -259,7 +269,7 @@ class _GalleryModeState extends State<_GalleryMode>
|
|||||||
|
|
||||||
photoViewControllers[index] ??= PhotoViewController();
|
photoViewControllers[index] ??= PhotoViewController();
|
||||||
|
|
||||||
if (reader.imagesPerPage() == 1 ||
|
if (reader.imagesPerPage == 1 ||
|
||||||
pageImages.length == 1) {
|
pageImages.length == 1) {
|
||||||
return PhotoViewGalleryPageOptions(
|
return PhotoViewGalleryPageOptions(
|
||||||
filterQuality: FilterQuality.medium,
|
filterQuality: FilterQuality.medium,
|
||||||
@@ -533,17 +543,27 @@ class _GalleryModeState extends State<_GalleryMode>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String? getImageKeyByOffset(Offset offset) {
|
String? getImageKeyByOffset(Offset offset) {
|
||||||
String? imageKey;
|
var range = getCurrentPageImageRange();
|
||||||
if (reader.imagesPerPage() == 1) {
|
if (range == null) return null;
|
||||||
imageKey = reader.images![reader.page - 1];
|
|
||||||
} else {
|
var (startIndex, endIndex) = range;
|
||||||
for (var imageState in imageStates) {
|
int actualImageCount = endIndex - startIndex;
|
||||||
if ((imageState as _ComicImageState).containsPoint(offset)) {
|
|
||||||
imageKey = (imageState.widget.image as ReaderImageProvider).imageKey;
|
if (actualImageCount == 1) {
|
||||||
|
return reader.images![startIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var imageState in imageStates) {
|
||||||
|
if ((imageState as _ComicImageState).containsPoint(offset)) {
|
||||||
|
var imageKey = (imageState.widget.image as ReaderImageProvider).imageKey;
|
||||||
|
int index = reader.images!.indexOf(imageKey);
|
||||||
|
if (index >= startIndex && index < endIndex) {
|
||||||
|
return imageKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return imageKey;
|
|
||||||
|
return reader.images![startIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,9 +116,9 @@ class _ReaderState extends State<Reader>
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!showSingleImageOnFirstPage()) {
|
if (!showSingleImageOnFirstPage()) {
|
||||||
return (images!.length / imagesPerPage()).ceil();
|
return (images!.length / imagesPerPage).ceil();
|
||||||
} else {
|
} else {
|
||||||
return 1 + ((images!.length - 1) / imagesPerPage()).ceil();
|
return 1 + ((images!.length - 1) / imagesPerPage).ceil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,13 +277,13 @@ class _ReaderState extends State<Reader>
|
|||||||
history!.page = images?.length ?? 1;
|
history!.page = images?.length ?? 1;
|
||||||
} else {
|
} else {
|
||||||
/// Record the first image of the page
|
/// Record the first image of the page
|
||||||
if (!showSingleImageOnFirstPage() || imagesPerPage() == 1) {
|
if (!showSingleImageOnFirstPage() || imagesPerPage == 1) {
|
||||||
history!.page = (page - 1) * imagesPerPage() + 1;
|
history!.page = (page - 1) * imagesPerPage + 1;
|
||||||
} else {
|
} else {
|
||||||
if (page == 1) {
|
if (page == 1) {
|
||||||
history!.page = 1;
|
history!.page = 1;
|
||||||
} else {
|
} else {
|
||||||
history!.page = (page - 2) * imagesPerPage() + 2;
|
history!.page = (page - 2) * imagesPerPage + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,13 +371,13 @@ abstract mixin class _ImagePerPageHandler {
|
|||||||
ComicType get type;
|
ComicType get type;
|
||||||
|
|
||||||
void initImagesPerPage(int initialPage) {
|
void initImagesPerPage(int initialPage) {
|
||||||
_lastImagesPerPage = imagesPerPage();
|
_lastImagesPerPage = imagesPerPage;
|
||||||
_lastOrientation = isPortrait;
|
_lastOrientation = isPortrait;
|
||||||
if (imagesPerPage() != 1) {
|
if (imagesPerPage != 1) {
|
||||||
if (showSingleImageOnFirstPage()) {
|
if (showSingleImageOnFirstPage()) {
|
||||||
page = ((initialPage - 1) / imagesPerPage()).ceil() + 1;
|
page = ((initialPage - 1) / imagesPerPage).ceil() + 1;
|
||||||
} else {
|
} else {
|
||||||
page = (initialPage / imagesPerPage()).ceil();
|
page = (initialPage / imagesPerPage).ceil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ abstract mixin class _ImagePerPageHandler {
|
|||||||
appdata.settings.getReaderSetting(cid, type.sourceKey, 'showSingleImageOnFirstPage');
|
appdata.settings.getReaderSetting(cid, type.sourceKey, 'showSingleImageOnFirstPage');
|
||||||
|
|
||||||
/// The number of images displayed on one screen
|
/// The number of images displayed on one screen
|
||||||
int imagesPerPage() {
|
int get imagesPerPage {
|
||||||
if (mode.isContinuous) return 1;
|
if (mode.isContinuous) return 1;
|
||||||
if (isPortrait) {
|
if (isPortrait) {
|
||||||
return appdata.settings.getReaderSetting(cid, type.sourceKey, 'readerScreenPicNumberForPortrait') ?? 1;
|
return appdata.settings.getReaderSetting(cid, type.sourceKey, 'readerScreenPicNumberForPortrait') ?? 1;
|
||||||
@@ -397,7 +397,7 @@ abstract mixin class _ImagePerPageHandler {
|
|||||||
|
|
||||||
/// Check if the number of images per page has changed
|
/// Check if the number of images per page has changed
|
||||||
void _checkImagesPerPageChange() {
|
void _checkImagesPerPageChange() {
|
||||||
int currentImagesPerPage = imagesPerPage();
|
int currentImagesPerPage = imagesPerPage;
|
||||||
bool currentOrientation = isPortrait;
|
bool currentOrientation = isPortrait;
|
||||||
|
|
||||||
if (_lastImagesPerPage != currentImagesPerPage || _lastOrientation != currentOrientation) {
|
if (_lastImagesPerPage != currentImagesPerPage || _lastOrientation != currentOrientation) {
|
||||||
|
|||||||
@@ -599,22 +599,24 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void saveCurrentImage() async {
|
void saveCurrentImage() async {
|
||||||
var data = await selectImageToData();
|
var result = await selectImageToData();
|
||||||
if (data == null) {
|
if (result == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var (imageIndex, data) = result;
|
||||||
var fileType = detectFileType(data);
|
var fileType = detectFileType(data);
|
||||||
var filename = "${context.reader.page}${fileType.ext}";
|
var filename = "${context.reader.widget.name}_${imageIndex + 1}${fileType.ext}";
|
||||||
saveFile(data: data, filename: filename);
|
saveFile(data: data, filename: filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void share() async {
|
void share() async {
|
||||||
var data = await selectImageToData();
|
var result = await selectImageToData();
|
||||||
if (data == null) {
|
if (result == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var (imageIndex, data) = result;
|
||||||
var fileType = detectFileType(data);
|
var fileType = detectFileType(data);
|
||||||
var filename = "${context.reader.page}${fileType.ext}";
|
var filename = "${context.reader.widget.name}_${imageIndex + 1}${fileType.ext}";
|
||||||
Share.shareFile(data: data, filename: filename, mime: fileType.mime);
|
Share.shareFile(data: data, filename: filename, mime: fileType.mime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,8 +721,29 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
|
|||||||
Future<int?> selectImage() async {
|
Future<int?> selectImage() async {
|
||||||
var reader = context.reader;
|
var reader = context.reader;
|
||||||
var imageViewController = context.reader._imageViewController;
|
var imageViewController = context.reader._imageViewController;
|
||||||
if (imageViewController is _GalleryModeState && reader.imagesPerPage == 1) {
|
|
||||||
return reader.page - 1;
|
bool needsSelection = false;
|
||||||
|
int? singleImageIndex;
|
||||||
|
|
||||||
|
if (imageViewController is _GalleryModeState) {
|
||||||
|
var range = imageViewController.getCurrentPageImageRange();
|
||||||
|
if (range != null) {
|
||||||
|
var (startIndex, endIndex) = range;
|
||||||
|
int actualImageCount = endIndex - startIndex;
|
||||||
|
if (actualImageCount == 1) {
|
||||||
|
needsSelection = false;
|
||||||
|
singleImageIndex = startIndex;
|
||||||
|
} else {
|
||||||
|
needsSelection = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (imageViewController is _ContinuousModeState) {
|
||||||
|
needsSelection = false;
|
||||||
|
singleImageIndex = reader.page - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!needsSelection && singleImageIndex != null) {
|
||||||
|
return singleImageIndex;
|
||||||
} else {
|
} else {
|
||||||
var location = await _showSelectImageOverlay();
|
var location = await _showSelectImageOverlay();
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
@@ -734,20 +757,23 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same as [selectImage], but return the image data.
|
/// Same as [selectImage], but return the image data with its index.
|
||||||
Future<Uint8List?> selectImageToData() async {
|
/// Returns (imageIndex, imageData) or null if cancelled.
|
||||||
|
Future<(int, Uint8List)?> selectImageToData() async {
|
||||||
var i = await selectImage();
|
var i = await selectImage();
|
||||||
if (i == null) {
|
if (i == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var imageKey = context.reader.images![i];
|
var imageKey = context.reader.images![i];
|
||||||
|
Uint8List data;
|
||||||
if (imageKey.startsWith("file://")) {
|
if (imageKey.startsWith("file://")) {
|
||||||
return await File(imageKey.substring(7)).readAsBytes();
|
data = await File(imageKey.substring(7)).readAsBytes();
|
||||||
} else {
|
} else {
|
||||||
return (await CacheManager().findCache(
|
data = await (await CacheManager().findCache(
|
||||||
"$imageKey@${context.reader.type.sourceKey}@${context.reader.cid}@${context.reader.eid}",
|
"$imageKey@${context.reader.type.sourceKey}@${context.reader.cid}@${context.reader.eid}",
|
||||||
))!.readAsBytes();
|
))!.readAsBytes();
|
||||||
}
|
}
|
||||||
|
return (i, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Offset?> _showSelectImageOverlay() {
|
Future<Offset?> _showSelectImageOverlay() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: venera
|
|||||||
description: "A comic app."
|
description: "A comic app."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.5.2+152
|
version: 1.5.3+153
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.8.0 <4.0.0'
|
sdk: '>=3.8.0 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user