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.6k
[quick_actions] Add DartDoc and test coverage #2298
Merged
mklim
merged 4 commits into
flutter-team-archive:master
from
mklim:quick_actions_polish
Nov 26, 2019
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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 was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,10 @@ typedef void QuickActionHandler(String type); | |
|
|
||
| /// Home screen quick-action shortcut item. | ||
| class ShortcutItem { | ||
| /// Constructs an instance with the given [type], [localizedTitle], and | ||
| /// [icon]. | ||
| /// | ||
| /// Only [icon] should be nullable. It will remain `null` if unset. | ||
| const ShortcutItem({ | ||
| @required this.type, | ||
| @required this.localizedTitle, | ||
|
|
@@ -36,14 +40,21 @@ class ShortcutItem { | |
|
|
||
| /// Quick actions plugin. | ||
| class QuickActions { | ||
| /// Gets an instance of the plugin with the default methodChannel. | ||
| /// | ||
| /// [initialize] should be called before using any other methods. | ||
| factory QuickActions() => _instance; | ||
|
|
||
| /// This is a test-only constructor. Do not call this, it can break at any | ||
| /// time. | ||
| @visibleForTesting | ||
| QuickActions.withMethodChannel(this.channel); | ||
|
|
||
| static final QuickActions _instance = | ||
| QuickActions.withMethodChannel(_kChannel); | ||
|
|
||
| /// This is a test-only accessor. Do not call this, it can break at any time. | ||
| @visibleForTesting | ||
| final MethodChannel channel; | ||
|
|
||
| /// Initializes this plugin. | ||
|
|
@@ -54,9 +65,14 @@ class QuickActions { | |
| assert(call.method == 'launch'); | ||
| handler(call.arguments); | ||
| }); | ||
| // ignore: deprecated_member_use_from_same_package | ||
| runLaunchAction(handler); | ||
| } | ||
|
|
||
| /// This is only exposed for the unit tests. Do not rely on it, it may break | ||
| /// without warning in the future. | ||
| @visibleForTesting | ||
| @deprecated | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're making a breaking change anyway (removing |
||
| void runLaunchAction(QuickActionHandler handler) async { | ||
| final String action = await channel.invokeMethod<String>('getLaunchAction'); | ||
| if (action != null) { | ||
|
|
||
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.
@collinjackson @diesersamat as far as I can tell this method isn't intended to be part of the public API, but I'm not sure if I'm misunderstanding the original intent here. From what I could tell reading through the codebase this looks like it's purely a helper method for
intialize, and users of the plugin are never expected to call this on its own. I think it was originally added to help with testing. If my reading is wrong, what's the intended use case of this and callinggetLaunchActionoutside ofinitialize? It was added in #1800. if that helps.