Skip to content

[quick_actions] convert to pigeon - #5159

Merged
auto-submit[bot] merged 13 commits into
flutter:mainfrom
tarrinneal:QA-pigeon
Oct 20, 2023
Merged

auto-submit[bot] merged 13 commits into
flutter:mainfrom
tarrinneal:QA-pigeon

Conversation

@tarrinneal

@tarrinneal tarrinneal commented Oct 17, 2023 •

Copy link
Copy Markdown
Contributor

Converts from direct use of method channels to using Pigeon.

Part of flutter/flutter#117844
fixes flutter/flutter#117913
fixes flutter/flutter#117112

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Comment thread packages/quick_actions/quick_actions_ios/pigeons/messages.dart Outdated
Comment thread packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart Outdated
Comment thread packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart Outdated
Comment thread packages/quick_actions/quick_actions_ios/lib/messages.g.dart Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/ShortcutItemParser.swift Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/ShortcutItemParser.swift Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated
@hellohuanlin hellohuanlin changed the title Qa pigeon [quick_actions] convert to pigeon Oct 18, 2023
@tarrinneal tarrinneal mentioned this pull request Oct 19, 2023
11 tasks done
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with nits. Thanks for doing that Pigeon PR! The tests are much cleaner now, and that was definitely a good example of why it's valuable for Pigeon development for us to adopt it :)

Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated
@tarrinneal

Copy link
Copy Markdown
Contributor Author

@hellohuanlin I would love to get an approval from you, since I'm still not 100% on Swift etiquette.

Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift Outdated
Comment thread packages/quick_actions/quick_actions_ios/ios/Classes/ShortcutItemParser.swift Outdated
}
}

static func parseShortcutItems(_ items: [ShortcutItemMessage]) -> [UIApplicationShortcutItem] {

@hellohuanlin hellohuanlin Oct 20, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this doesn't seem to belong to a static member of QuickActionsPlugin. I suggest 2 alternatives -

  1. make them private non-static members of QuickActionsPlugin (so they become implementation details QuickActionsPlugin).

  2. A more swifty way I would do is to create class extension of either UIApplicationShortcutItem or ShortcutItemMessage, outside of QuickActionsPlugin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thanks for the feedback!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh also avoid the naming "parse" since it's not parsing anymore. Something like:

extension ShortcutItemMessage {
  var item: UIApplicationShortcutItem {
    return ...
  }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need the tests that I was using this for any longer, since this is now an implementation detail and my understanding is that the swifty thing to do is consider the converter tested, since it is used in code that is already tested.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes if it's implementation detail, it can only be tested via non-private members. You can delete those tests if it's already covered elsewhere

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: quick_actions platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quick_actions] Convert to Pigeon [quick_actions] try out pigeon Swift

3 participants