diff --git a/lib/util/extensions/api.dart b/lib/util/extensions/api.dart index d0d6a510..8c7e4bd4 100644 --- a/lib/util/extensions/api.dart +++ b/lib/util/extensions/api.dart @@ -41,3 +41,7 @@ extension DisplayNames on UserSafe { return displayName; } } + +extension CommentLink on Comment { + String get link => 'https://$instanceHost/post/$postId/comment/$id'; +} diff --git a/lib/widgets/comment.dart b/lib/widgets/comment.dart index 2a311ee0..8104ce92 100644 --- a/lib/widgets/comment.dart +++ b/lib/widgets/comment.dart @@ -136,8 +136,8 @@ class CommentWidget extends HookWidget { ListTile( leading: const Icon(Icons.open_in_browser), title: const Text('Open in browser'), - onTap: () async => await ul.canLaunch(com.comment.apId) - ? ul.launch(com.comment.apId) + onTap: () async => await ul.canLaunch(com.comment.link) + ? ul.launch(com.comment.link) : Scaffold.of(context).showSnackBar( const SnackBar(content: Text("can't open in browser"))), ), @@ -145,7 +145,7 @@ class CommentWidget extends HookWidget { leading: const Icon(Icons.share), title: const Text('Share url'), onTap: () => Share.text( - 'Share comment url', com.comment.apId, 'text/plain'), + 'Share comment url', com.comment.link, 'text/plain'), ), ListTile( leading: const Icon(Icons.share),