From 3739aa302f057e3d180757c202f9a154d487ea6d Mon Sep 17 00:00:00 2001 From: krawieck Date: Mon, 28 Sep 2020 20:04:44 +0200 Subject: [PATCH] swap custom go to functions for premade ones --- lib/url_launcher.dart | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/url_launcher.dart b/lib/url_launcher.dart index e1384d1..f17b335 100644 --- a/lib/url_launcher.dart +++ b/lib/url_launcher.dart @@ -4,8 +4,8 @@ import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart' as ul; import 'pages/community.dart'; -import 'pages/full_post.dart'; import 'pages/instance.dart'; +import 'pages/media_view.dart'; import 'pages/user.dart'; import 'stores/accounts_store.dart'; import 'util/goto.dart'; @@ -51,28 +51,23 @@ Future linkLauncher({ final split = rest.split('/'); switch (split[1]) { case 'c': - return push(() => CommunityPage.fromName( - communityName: split[2], instanceUrl: matchedInstance)); + return goToCommunity.byName(context, matchedInstance, split[2]); case 'u': - return push(() => UserPage.fromName( - instanceUrl: matchedInstance, username: split[2])); + return goToUser.byName(context, matchedInstance, split[2]); case 'post': if (split.length == 3) { - return push(() => FullPostPage( - id: int.parse(split[2]), instanceUrl: matchedInstance)); + return goToPost(context, matchedInstance, int.parse(split[2])); } else if (split.length == 5) { // TODO: post with focus on comment thread print('comment in post'); - return; + return goToPost(context, matchedInstance, int.parse(split[2])); } break; case 'pictrs': - // TODO: put here push to media view - print('pictrs'); - return; + return push(() => MediaViewPage(url)); case 'communities': // TODO: put here push to communities page