Skip to content

Commit

Permalink
[in_app_purchase] Add support for macOS (flutter#6519)
Browse files Browse the repository at this point in the history
* Updated version and changelog.

* Updated readme to mention MacOS as a supported platform.

* Minor fixup.

* Fixed capitalization in readme.

* Added macos to example.

* Updated MacOS example.

* Unified macOS capitalization.

* Removed generated app icons.

* Updated version and deployment target.

* Updated version to a minor version change.

Was previously only a patch.
  • Loading branch information
IVLIVS-III authored Dec 21, 2022
1 parent 3d8b73b commit c5220ef
Show file tree
Hide file tree
Showing 23 changed files with 1,261 additions and 8 deletions.
4 changes: 4 additions & 0 deletions packages/in_app_purchase/in_app_purchase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.1.0

* Adds macOS as a supported platform.

## 3.0.8

* Updates minimum Flutter version to 2.10.
Expand Down
8 changes: 4 additions & 4 deletions packages/in_app_purchase/in_app_purchase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ A storefront-independent API for purchases in Flutter apps.
<!-- If this package were in its own repo, we'd put badges here -->

This plugin supports in-app purchases (_IAP_) through an _underlying store_,
which can be the App Store (on iOS) or Google Play (on Android).
which can be the App Store (on iOS and macOS) or Google Play (on Android).

| | Android | iOS |
|-------------|---------|------|
| **Support** | SDK 16+ | 9.0+ |
| | Android | iOS | macOS |
|-------------|---------|------|--------|
| **Support** | SDK 16+ | 9.0+ | 10.15+ |

<p>
<img src="https://github.com/flutter/plugins/blob/main/packages/in_app_purchase/in_app_purchase/doc/iap_ios.gif?raw=true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
40 changes: 40 additions & 0 deletions packages/in_app_purchase/in_app_purchase/example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
platform :osx, '10.15'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
Loading

0 comments on commit c5220ef

Please sign in to comment.