Skip to content

Conversation

@nav-28
Copy link
Collaborator

@nav-28 nav-28 commented Jan 8, 2024

Some user have links in their bio and we should make them clickable.

Preview

screen

Usernames will open a user screen if the user exists. Other urls will launch a window.

@veloce
Copy link
Contributor

veloce commented Jan 8, 2024

Thanks for this. I'm not very fond of the underline style though. It would be better to leave just the blue color without the underline.

http: ^1.1.0
intl: ^0.18.0
json_annotation: ^4.7.0
linkify: ^5.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this package since flutter_linkify is already handling the job alone it seems?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cause flutter_linkify is depended on this library but it's not showing UserTagLinkifier which is needed to link user tags.
repo link

One way to solve that would be to create our own Linkify widget by copying it from flutter_linkify

Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes of the UserScreen should be reverted before merging it.

  • go back to only LightUser param
  • handle user not found in the error handler
  • don't try to fetch user before going to the screen in UserProfile

Linkify(
onOpen: (link) async {
if (link.originText.startsWith('@')) {
final userId =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to immediately go to the user screen with the id, and load the user while in the screen.

);

final LightUser user;
const factory UserScreen.fromUser({required User user, Key? key}) =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change actually.

Why adding more complexity? We should always load the user from ID.

It looks like this change was made to handle the case where the user is not found in a profile link. But it is better to handle this case in the async error handler and show a "User not found" here instead.

@nav-28 nav-28 requested a review from veloce January 15, 2024 00:50
pushPlatformRoute(
context,
builder: (ctx) => UserScreen(
user: LightUser(id: userId, name: userId.value),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd do instead:

final username = link.originText.substring(1);
final user = LightUser(id: UserId.fromUserName(username), name: username);
pushPlatformRoute(
  ...

@veloce veloce merged commit 01af37a into main Jan 17, 2024
@veloce veloce deleted the profile-enhancement branch January 17, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants