-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[in_app_purchase_storekit] Add support for macOS #6517
Conversation
Addressing the 4 failing tests:
|
Could you delete the assets (*png) from the example? |
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.
I haven't had time to do a full review yet, but to address the above:
- macos-platform_tests CHANNEL:master
I don't know why no driver tests are found forin_app_purchase/in_app_purchase_storekit/example
.
It looks like it was set up wrong when the current (placeholder, unfortunately) tests were added, and since there's an exclusion still for iOS from before it was added, that wasn't caught. Moving example/integration_test/test/integration_test.dart
to example/integration_test/integration_test.dart
should fix that. You should also be able to remove the exclusion from script/configs/exclude_integration_ios.yaml
when fixing that.
- macos-build_all_plugins CHANNEL:stable
I expect this test to pass if theall_plugins
project had a minimum deployment target of 10.15 for macOS. But I don't know how to change this.
This would be done in script/tool/lib/src/create_all_plugins_app_command.dart
. See _updateAppGradle
for an example of making a similar change to some Android values.
5fe1d16
to
1af7bf4
Compare
I tried implementing it like outlined but unfortunately I hit a road-block rather quickly. As a first workaround, I forced the |
Running |
Would this still be done in |
Yes, it would still be part of that tool command. I think the flow we would want for the top-level
|
Great, changed the flow as suggested. |
|
||
import XCTest | ||
|
||
final class RunnerTests: XCTestCase { |
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.
Are these tests necessary?
From the wiki.
Write what you need and no more, but when you write it, do it right.
If the class is necessary in order for the project to compile, then I would remove any code we aren't using.
If you have other plans to implement, then you can ignore this comment.
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 class itself is necessary, but I was able to remove all empty function overrides.
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.
A small follow up:
I initially setup the RunnerTests target wrong for macOS. Trusting in the automatic generation, I didn't realize that a Swift-Testsuite was newly created and existing (iOS) tests written in Objective-C – tho located in the same directory – were not run on macOS.
This was corrected in 8865423 and now neither the class nor the file are necessary anymore, hence I deleted the file.
I've somehow (unintentionally) removed some reviewers 🙈 and I cannot figure out how to add them back… |
Previously they were no-ops on macOS.
faaceb0
to
5b1ec11
Compare
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.
Ugh, moving and symlinking files defeats git rename detection because there's still a file at the original location, so the complete diff is pretty much unusable now 😞
Using the GitHub UI to selectively view commit ranges to look at everything before the switch to file symlink and everything after, I think all of my concerns were addressed, so LGTM. Thanks again for all of the work here!
@a-wallen this should be ready for another review. (@cyanglaz Did you want to review the changes to the shared code before this lands?)
packages/in_app_purchase/in_app_purchase_storekit/shared/Classes/FIATransactionCache.h
Show resolved
Hide resolved
packages/in_app_purchase/in_app_purchase_storekit/shared/Classes/FIAObjectTranslator.m
Show resolved
Hide resolved
...p_purchase/in_app_purchase_storekit/example/shared/RunnerTests/FIAPPaymentQueueDeleteTests.m
Show resolved
Hide resolved
Thanks again for this contribution! It should be published soon (once the post-submit tests have all run). |
* e911e0564 b8f7f1f [flutter_releases] Flutter stable 3.3.9 Framework Cherrypicks (#115856) (flutter/plugins#6751) * bdf1a98a1 Roll Flutter from 0eb2d51 to cb23473 (13 revisions) (flutter/plugins#6755) * 614d7c0df Roll Flutter from cb23473 to ff59250 (3 revisions) (flutter/plugins#6757) * 2be1da958 Roll Flutter from ff59250 to 17c1dbc (31 revisions) (flutter/plugins#6764) * 381541628 [in_app_purchase_storekit] Add support for macOS (flutter/plugins#6517) * eb796fe2e Roll Flutter from 17c1dbc to b2672fe (26 revisions) (flutter/plugins#6766) * 89ad5a9d6 enable test (flutter/plugins#5312)
…#116356) * e911e0564 b8f7f1f [flutter_releases] Flutter stable 3.3.9 Framework Cherrypicks (flutter#115856) (flutter/plugins#6751) * bdf1a98a1 Roll Flutter from 0eb2d51 to cb23473 (13 revisions) (flutter/plugins#6755) * 614d7c0df Roll Flutter from cb23473 to ff59250 (3 revisions) (flutter/plugins#6757) * 2be1da958 Roll Flutter from ff59250 to 17c1dbc (31 revisions) (flutter/plugins#6764) * 381541628 [in_app_purchase_storekit] Add support for macOS (flutter/plugins#6517) * eb796fe2e Roll Flutter from 17c1dbc to b2672fe (26 revisions) (flutter/plugins#6766) * 89ad5a9d6 enable test (flutter/plugins#5312)
…#116356) * e911e0564 b8f7f1f [flutter_releases] Flutter stable 3.3.9 Framework Cherrypicks (flutter#115856) (flutter/plugins#6751) * bdf1a98a1 Roll Flutter from 0eb2d51 to cb23473 (13 revisions) (flutter/plugins#6755) * 614d7c0df Roll Flutter from cb23473 to ff59250 (3 revisions) (flutter/plugins#6757) * 2be1da958 Roll Flutter from ff59250 to 17c1dbc (31 revisions) (flutter/plugins#6764) * 381541628 [in_app_purchase_storekit] Add support for macOS (flutter/plugins#6517) * eb796fe2e Roll Flutter from 17c1dbc to b2672fe (26 revisions) (flutter/plugins#6766) * 89ad5a9d6 enable test (flutter/plugins#5312)
…#116356) * e911e0564 b8f7f1f [flutter_releases] Flutter stable 3.3.9 Framework Cherrypicks (flutter#115856) (flutter/plugins#6751) * bdf1a98a1 Roll Flutter from 0eb2d51 to cb23473 (13 revisions) (flutter/plugins#6755) * 614d7c0df Roll Flutter from cb23473 to ff59250 (3 revisions) (flutter/plugins#6757) * 2be1da958 Roll Flutter from ff59250 to 17c1dbc (31 revisions) (flutter/plugins#6764) * 381541628 [in_app_purchase_storekit] Add support for macOS (flutter/plugins#6517) * eb796fe2e Roll Flutter from 17c1dbc to b2672fe (26 revisions) (flutter/plugins#6766) * 89ad5a9d6 enable test (flutter/plugins#5312)
* Initial commit of adding MacOS support. Heavily inspired by flutter#5854 * Updated version and changelog. * Updated documentation. * Added missing license comments. * Fixed podspec lint issue. * Moved native tests to a shared location. * Decreased minimum macOS version from 10.15 to 10.11. This seems wrong to me, since StoreKit is only properly supported on MacOS 10.15+. However, now all existing tests should pass. * Added RunnerTests target to macos example. * Unified macOS capitalization. * Deleted generated macOS icon assets. * Removed empty function overrides. * Enabled tests for macOS. * Added OCMock to RunnerTests target. * Adapted tests for macOS. * Reverted relative path dependencies. * Updated to a proper version bump. * Make macOS no-op tests run only on iOS. * Replace directory symlinks with file symlinks. * Marked iOS-only API as iOS-only. Previously they were no-ops on macOS. * Re-worded doc-comment. * Formatted code.
This PR adds MacOS as a supported platform to
in_app_purchase_storekit
.The implementation is now fully shared between iOS and MacOS (no code duplication), at least as far as permitted by the underlying storekit framework.
On MacOS the following methods are no-ops:
showPriceConsentIfNeeded
presentCodeRedemptionSheet
Part of flutter/flutter#84391.
I tried my best to follow the steps outlined in this comment on the original issue.
If there is anything missing, I'm happy to update the PR.
I intend to submit the necessary changes to the app-facing plugin
in_app_purchase
in a second PR (#6519).Note: I am aware of two previous PRs (#2708 and #5854). But those are either closed or still in draft and have not had any recent activity.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.