mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 12:57:24 +00:00
novel
This commit is contained in:
@@ -3,6 +3,9 @@ import 'dart:io';
|
||||
import 'package:app_links/app_links.dart';
|
||||
import 'package:pixes/foundation/app.dart';
|
||||
import 'package:pixes/foundation/log.dart';
|
||||
import 'package:pixes/pages/illust_page.dart';
|
||||
import 'package:pixes/pages/novel_page.dart';
|
||||
import 'package:pixes/pages/user_info_page.dart';
|
||||
import 'package:win32_registry/win32_registry.dart';
|
||||
|
||||
Future<void> _register(String scheme) async {
|
||||
@@ -37,5 +40,36 @@ void handleLinks() async {
|
||||
if (onLink?.call(uri) == true) {
|
||||
return;
|
||||
}
|
||||
handleLink(uri);
|
||||
});
|
||||
}
|
||||
|
||||
bool handleLink(Uri uri) {
|
||||
if (uri.scheme == "pixiv") {
|
||||
var path = uri.toString().split("/").sublist(2);
|
||||
if (path.isEmpty) {
|
||||
return false;
|
||||
}
|
||||
switch (path[0]) {
|
||||
case "users":
|
||||
if (path.length == 2) {
|
||||
App.mainNavigatorKey?.currentContext?.to(() => UserInfoPage(path[1]));
|
||||
return true;
|
||||
}
|
||||
case "novels":
|
||||
if (path.length == 2) {
|
||||
App.mainNavigatorKey?.currentContext
|
||||
?.to(() => NovelPageWithId(path[1]));
|
||||
return true;
|
||||
}
|
||||
case "illusts":
|
||||
if (path.length == 2) {
|
||||
App.mainNavigatorKey?.currentContext
|
||||
?.to(() => IllustPageWithId(path[1]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user