diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3c41314..a955009 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -53,6 +53,8 @@ + + + CFBundleURLTypes + + + CFBundleURLSchemes + + pika + + + CADisableMinimumFrameDurationOnPhone CFBundleDevelopmentRegion @@ -23,35 +32,35 @@ UTExportedTypeDeclarations - - - UTTypeIdentifier - niuhuan.pkz - UTTypeConformsTo - - public.data - public.content - com.apple.package - - UTTypeDescription - PKZ Archive - UTTypeTagSpecification - - public.filename-extension - - pkz - pki - zip - - public.mime-type - - text/vnd.niuhuan.pkz - text/vnd.niuhuan.pki - text/vnd.niuhuan.zip - - - - + + + UTTypeIdentifier + niuhuan.pkz + UTTypeConformsTo + + public.data + public.content + com.apple.package + + UTTypeDescription + PKZ Archive + UTTypeTagSpecification + + public.filename-extension + + pkz + pki + zip + + public.mime-type + + text/vnd.niuhuan.pkz + text/vnd.niuhuan.pki + text/vnd.niuhuan.zip + + + + CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/lib/basic/Common.dart b/lib/basic/Common.dart index 16c0c1f..3b870e5 100644 --- a/lib/basic/Common.dart +++ b/lib/basic/Common.dart @@ -6,6 +6,7 @@ import 'package:flutter_styled_toast/flutter_styled_toast.dart'; import 'package:uni_links/uni_links.dart'; import 'package:uri_to_file/uri_to_file.dart'; +import '../screens/ComicInfoScreen.dart'; import '../screens/DownloadOnlyImportScreen.dart'; import '../screens/PkzArchiveScreen.dart'; import 'config/TimeOffsetHour.dart'; @@ -297,7 +298,17 @@ Future inputString(BuildContext context, String title, StreamSubscription linkSubscript(BuildContext context) { return linkStream.listen((uri) async { if (uri == null) return; - if (RegExp(r"^.*\.pkz$").allMatches(uri).isNotEmpty) { + if (RegExp(r"^pika://comic/([0-9A-z]+)/$").allMatches(uri).isNotEmpty) { + String comicId = RegExp(r"^pika://comic/([0-9A-z]+)/$") + .allMatches(uri) + .first + .group(1)!; + Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => ComicInfoScreen(comicId: comicId), + ), + ); + } else if (RegExp(r"^.*\.pkz$").allMatches(uri).isNotEmpty) { File file = await toFile(uri); Navigator.of(context).push( MaterialPageRoute( diff --git a/lib/screens/ComicInfoScreen.dart b/lib/screens/ComicInfoScreen.dart index b60ba78..6fc85e0 100644 --- a/lib/screens/ComicInfoScreen.dart +++ b/lib/screens/ComicInfoScreen.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:pikapika/basic/Common.dart'; import 'package:pikapika/basic/Cross.dart'; @@ -23,8 +25,10 @@ import 'components/RightClickPop.dart'; // 漫画详情 class ComicInfoScreen extends StatefulWidget { final String comicId; + final bool holdPkz; - const ComicInfoScreen({Key? key, required this.comicId}) : super(key: key); + const ComicInfoScreen({Key? key, required this.comicId, this.holdPkz = false}) + : super(key: key); @override State createState() => _ComicInfoScreenState(); @@ -36,6 +40,7 @@ class _ComicInfoScreenState extends State with RouteAware { late Key _comicFutureKey = UniqueKey(); late Future _viewFuture = _loadViewLog(); late Future> _epListFuture = _loadEps(); + StreamSubscription? _linkSubscription; Future _loadComic() async { return await method.comicInfo(widget.comicId); @@ -69,14 +74,23 @@ class _ComicInfoScreenState extends State with RouteAware { }); } + @override + void initState() { + if (widget.holdPkz) { + _linkSubscription = linkSubscript(context); + } + super.initState(); + } + @override void dispose() { + _linkSubscription?.cancel(); routeObserver.unsubscribe(this); super.dispose(); } @override - Widget build(BuildContext context){ + Widget build(BuildContext context) { return rightClickPop( child: buildScreen(context), context: context, diff --git a/lib/screens/InitScreen.dart b/lib/screens/InitScreen.dart index a80543f..668a7e9 100644 --- a/lib/screens/InitScreen.dart +++ b/lib/screens/InitScreen.dart @@ -33,6 +33,7 @@ import 'package:pikapika/basic/config/UsingRightClickPop.dart'; import 'package:pikapika/basic/config/Version.dart'; import 'package:pikapika/basic/config/VolumeController.dart'; import 'package:pikapika/basic/config/ShadowCategoriesMode.dart'; +import 'package:pikapika/screens/ComicInfoScreen.dart'; import 'package:pikapika/screens/PkzArchiveScreen.dart'; import 'package:uni_links/uni_links.dart'; import 'package:uri_to_file/uri_to_file.dart'; @@ -107,7 +108,14 @@ class _InitScreenState extends State { } } if (initUrl != null) { - if (RegExp(r"^.*\.pkz$").allMatches(initUrl!).isNotEmpty) { + if (RegExp(r"^pika://comic/([0-9A-z]+)/$").allMatches(initUrl!).isNotEmpty) { + String comicId = RegExp(r"^pika://comic/([0-9A-z]+)/$").allMatches(initUrl!).first.group(1)!; + Navigator.of(context).pushReplacement(MaterialPageRoute( + builder: (BuildContext context) => + ComicInfoScreen(comicId: comicId, holdPkz: true), + )); + return; + } else if (RegExp(r"^.*\.pkz$").allMatches(initUrl!).isNotEmpty) { File file = await toFile(initUrl!); Navigator.of(context).pushReplacement(MaterialPageRoute( builder: (BuildContext context) => diff --git a/lib/screens/RankingsScreen.dart b/lib/screens/RankingsScreen.dart index 742145d..3c9e2e8 100644 --- a/lib/screens/RankingsScreen.dart +++ b/lib/screens/RankingsScreen.dart @@ -104,14 +104,17 @@ class _KnightLeaderBoard extends StatefulWidget { class _KnightLeaderBoardState extends State<_KnightLeaderBoard> { Future> _future = method.leaderboardOfKnight(); + Key _key = UniqueKey(); @override Widget build(BuildContext context) { return ContentBuilder( + key: _key, future: _future, onRefresh: () async { setState(() { _future = method.leaderboardOfKnight(); + _key = UniqueKey(); }); }, successBuilder: ( diff --git a/lib/screens/components/ImageReader.dart b/lib/screens/components/ImageReader.dart index f6a856a..02f4095 100644 --- a/lib/screens/components/ImageReader.dart +++ b/lib/screens/components/ImageReader.dart @@ -387,6 +387,15 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> { ], ), ), + widget.struct.fullScreen + ? Container() + : Container( + color: const Color(0x88000000), + child: SafeArea( + top: false, + child: Container(), + ), + ), ], ); case ReaderSliderPosition.RIGHT: @@ -1579,7 +1588,7 @@ class _GalleryReaderState extends _ImageReaderContentState { if (item.pkzFile != null) { return PhotoViewGalleryPageOptions( imageProvider: - PkzImageProvider(item.pkzFile!.pkzPath, item.pkzFile!.path), + PkzImageProvider(item.pkzFile!.pkzPath, item.pkzFile!.path), errorBuilder: (b, e, s) { print("$e,$s"); return LayoutBuilder(