Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@hellohuanlin
Copy link
Contributor

@hellohuanlin hellohuanlin commented Aug 1, 2022

This is to prepare for backfilling unit tests, which is a pre-requisite for swift migration.

This plugin is chosen to be the first plugin for Swift migration, because:

  • It's relatively smaller, but not too small
  • It has good UI test coverage. Good candidate to showcase ui test in swift.
  • It has 0% unit tests coverage. Good candidate to showcase how to backfill unit tests
  • Needs to refactor a few internal states for unit tests. Good candidate to showcase pre-migration refactoring.

List which issues are fixed by this PR. You must list at least one issue.

flutter/flutter#108750

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/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin 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.

<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these changes are automatically added when i do flutter build ios

Copy link
Contributor

Choose a reason for hiding this comment

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

These should be fine I think?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, these and the alwaysOutOfDate change are from auto-migrations.

@hellohuanlin hellohuanlin marked this pull request as ready for review August 1, 2022 19:04
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'
Copy link
Contributor Author

@hellohuanlin hellohuanlin Aug 1, 2022

Choose a reason for hiding this comment

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

these changes are automatically added when i do flutter build ios

Copy link
Contributor

Choose a reason for hiding this comment

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

You need to manually undo them; it's a change that's on master but hasn't rolled out to stable, and we keep our plugin OS support the same as Flutter stable's OS support (except in cases where we can't for technical reasons).

@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to manually undo them; it's a change that's on master but hasn't rolled out to stable, and we keep our plugin OS support the same as Flutter stable's OS support (except in cases where we can't for technical reasons).

<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be fine I think?


/// Initializes a FLTQuickActionsPlugin with the given method channel.
/// API exposed for unit tests.
/// @param channel a method channel
Copy link
Contributor

Choose a reason for hiding this comment

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

Doxygen comments follow the usual comment rules about being sentences. E.g.:

@param channel A method channel.
@return The initialized FLTQuickActionsPlugin.

s.documentation_url = 'https://pub.dev/packages/quick_actions'
s.source_files = 'Classes/**/*'
s.source_files = 'Classes/**/*.{h,m}'
s.public_header_files = 'Classes/**/*.h'
Copy link
Contributor

Choose a reason for hiding this comment

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

This is making the test header a public header. We've made that mistake in other plugins, but we shouldn't replicate it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stuartmorgan Looks like the test header must be public. I got this error when not adding the test header to this public_header_files:

    - ERROR | [iOS] xcodebuild:  /Users/admin/Library/Developer/Xcode/DerivedData/App-cgyuubhexmicjpawtwtidfnntejc/Build/Products/Debug-iphonesimulator/quick_actions_ios/quick_actions_ios.framework/Modules/module.modulemap:8:12: error: header 'FLTQuickActionsPlugin_Test.h' not found

If I understand this error correctly, modulemap file defines the module by mapping headers in the output directory. The Test submodule is no difference than regular module in terms of visibility, except that it's scoped under a submodule.

CC @jmagman probably know more about modulemap.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please ignore my previous comment, I misunderstood how private headers work. It turned out that private headers ARE copied to the output directory (so that modulemap can refer to them).

<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
Copy link
Member

Choose a reason for hiding this comment

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

Yes, these and the alwaysOutOfDate change are from auto-migrations.

[registrar addApplicationDelegate:instance];
}

- (instancetype)initWithChannel:(FlutterMethodChannel *)channel {
Copy link
Member

Choose a reason for hiding this comment

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

should -init and +new be marked unavailable in the header then?

/// API exposed for unit tests.
/// @param channel A method channel.
/// @return The initialized FLTQuickActionsPlugin.
- (instancetype)initWithChannel:(FlutterMethodChannel *)channel;
Copy link
Member

Choose a reason for hiding this comment

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

Designated initializer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got this error. Looks like designated initializer does not support class categories:

'objc_designated_initializer' attribute only applies to init methods of interface or class extension declarations

Copy link
Member

Choose a reason for hiding this comment

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

Oh right

@hellohuanlin hellohuanlin force-pushed the quick_actions_modulemap branch 2 times, most recently from e76e91f to 8a780b8 Compare August 2, 2022 21:45
@hellohuanlin hellohuanlin force-pushed the quick_actions_modulemap branch from 8a780b8 to db79c26 Compare August 3, 2022 17:48
@hellohuanlin
Copy link
Contributor Author

@stuartmorgan friendly ping

@hellohuanlin hellohuanlin force-pushed the quick_actions_modulemap branch from 4c3dc31 to e732cfc Compare August 4, 2022 18:23
@@ -1,5 +1,6 @@
## NEXT
## 0.6.0+12
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, looks like the version bump is not picked up by the CI.

Copy link
Contributor

Choose a reason for hiding this comment

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

You changed the version in the wrong package; the changes are in quick_actions_ios.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 4, 2022
@auto-submit auto-submit bot merged commit 0146406 into flutter:main Aug 4, 2022
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.source_files = 'Classes/**/*.{h,m}'
s.public_header_files = 'Classes/*.h'
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this also match Classes/PrivateHeaders/*.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I removed /**, so it won't include the private headers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See this:

Screen Shot 2022-08-04 at 4 43 10 PM


@interface FLTQuickActionsPlugin : NSObject <FlutterPlugin>

/// Unavailable. Please use `initWithChannel:` instead.
Copy link
Member

Choose a reason for hiding this comment

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

But that's "private", how would they be able to do it? I think registerWithRegistrar: is the only way for developers to create an instance.

Copy link
Contributor Author

@hellohuanlin hellohuanlin Aug 4, 2022

Choose a reason for hiding this comment

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

Oh the unit tests will import the Test submodule that contains initWithChannel: private API. But I think you made a good point that a public header shouldn't mention about this private API. I will remove this comment in next PR.

/// API exposed for unit tests.
/// @param channel A method channel.
/// @return The initialized FLTQuickActionsPlugin.
- (instancetype)initWithChannel:(FlutterMethodChannel *)channel;
Copy link
Member

Choose a reason for hiding this comment

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

Oh right

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 5, 2022
yutaaraki-toydium pushed a commit to yutaaraki-toydium/plugins that referenced this pull request Aug 12, 2022
moisefeelin pushed a commit to feelinproject/plugins that referenced this pull request Aug 26, 2022
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

3 participants