This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[url_launcher] Added draggable property to link info. #6282
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/url_launcher/url_launcher_platform_interface/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The analyzer failure in CI is surfacing a significant problem here: the use of this class is via
implements, notextends, so adding a default implementation doesn't really do anything in practice; this is a breaking change forurl_launcher.@ditman Do you have any better ideas than making a new abstract class that extends
LinkInfoand adds this field, and then migrating to that? Obviously that approach doesn't scale very well, but hopefully it won't be necessary very often.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If was actually wondering why this is an interface in the first place; since it's just information, there's essentially only one way to implement it, so if we're making breaking changes, I suggest removing this variability from the API entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stuartmorgan looking at how
LinkInfois being used elsewhere, I think the simplest solution would be to first modify theLinkclass to:Using
LinkInfoas amixinonLinkmakes the default implementations of LinkInfo available on Link until overridden; reminds me of default interface methods in Java.(After this change,
Linkwould stillis LinkInfo.)See the following gist:
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, but the problem is that we would still want to make a breaking change here to do that. Even if we make the other change first, someone could (unlikely as it is) update
url_launcher_platform_interfacewithout updatingurl_launcher. That's why I was suggesting a new subclass instead. We could still switchurl_launcherto a mixin of the new subclass to avoid this problem going forward, but if we're okay with an extra class we can avoid the breaking change.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to adding the
draggableattribute to the subclass, if we want to get rid of theLinkInfocompletely, we'll probably have to do something like this in the packages where we define a non-nullLinkDelegatetypedef(which uses aLinkInfo):The problem is that I can't replace
LinkInfoin theLinkDelegateby a subclass, because the type of the parameter must be contravariant (andcovariantdoesn't work in typedefs):plugins/packages/url_launcher/url_launcher_platform_interface/lib/link.dart
Lines 22 to 23 in 7686be7