add better handling of uncommon links

This commit is contained in:
krawieck 2020-09-28 19:58:09 +02:00
parent 147db8e1fe
commit b4b41e848b
1 changed files with 3 additions and 2 deletions

View File

@ -22,15 +22,16 @@ Future<void> linkLauncher({
final instances = context.read<AccountsStore>().users.keys.toList();
final chonks = url.split('/');
if (chonks.length == 1) return openInBrowser(url);
// CHECK IF LINK TO USER
if (chonks[1] == 'u') {
if (url.startsWith('/u/')) {
return push(
() => UserPage.fromName(instanceUrl: instanceUrl, username: chonks[2]));
}
// CHECK IF LINK TO COMMUNITY
if (chonks[1] == 'c') {
if (url.startsWith('/c/')) {
return push(() => CommunityPage.fromName(
communityName: chonks[2], instanceUrl: instanceUrl));
}