swap custom go to functions for premade ones

This commit is contained in:
krawieck 2020-09-28 20:04:44 +02:00
parent b4b41e848b
commit 3739aa302f
1 changed files with 6 additions and 11 deletions

View File

@ -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<void> 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