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

[path_provider] Merge iOS and macOS implementations #6988

Merged
merged 16 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ packages/image_picker/image_picker_ios/** @vashworth
packages/in_app_purchase/in_app_purchase_storekit/** @cyanglaz
packages/ios_platform_images/ios/** @jmagman
packages/local_auth/local_auth_ios/** @hellohuanlin
packages/path_provider/path_provider_ios/** @jmagman
packages/path_provider/path_provider_foundation/** @jmagman
packages/quick_actions/quick_actions_ios/** @hellohuanlin
packages/shared_preferences/shared_preferences_foundation/** @cyanglaz
packages/url_launcher/url_launcher_ios/** @jmagman
Expand All @@ -64,7 +64,6 @@ packages/url_launcher/url_launcher_linux/** @cbracken

# - macOS
packages/file_selector/file_selector_macos/** @cbracken
packages/path_provider/path_provider_macos/** @cbracken
packages/url_launcher/url_launcher_macos/** @cbracken

# - Windows
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 2.1.0

* Renames the package previously published as
[`path_provider_macos`](https://pub.dev/packages/path_provider_macos)
* Adds iOS support.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# path\_provider\_ios
# path\_provider\_foundation

The iOS implementation of [`path_provider`][1].
The iOS and macOS implementation of [`path_provider`][1].

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import FlutterMacOS
import Foundation

#if os(iOS)
import Flutter
#elseif os(macOS)
import FlutterMacOS
#endif

public class PathProviderPlugin: NSObject, FlutterPlugin, PathProviderApi {
public static func register(with registrar: FlutterPluginRegistrar) {
let instance = PathProviderPlugin()
PathProviderApiSetup.setUp(binaryMessenger: registrar.messenger, api: instance)
// Workaround for https://github.com/flutter/flutter/issues/118103.
#if os(iOS)
let messenger = registrar.messenger()
#else
let messenger = registrar.messenger
#endif
PathProviderApiSetup.setUp(binaryMessenger: messenger, api: instance)
}

func getDirectoryPath(type: DirectoryType) -> String? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import FlutterMacOS
import XCTest
@testable import path_provider_macos
@testable import path_provider_foundation

#if os(iOS)
import Flutter
#elseif os(macOS)
import FlutterMacOS
#endif

class RunnerTests: XCTestCase {
func testGetTemporaryDirectory() throws {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'path_provider_foundation'
s.version = '0.0.1'
s.summary = 'An iOS and macOS implementation of the path_provider plugin.'
s.description = <<-DESC
An iOS and macOS implementation of the Flutter plugin for getting commonly used locations on the filesystem.
DESC
s.homepage = 'https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_foundation'
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Flutter Dev Team' => '[email protected]' }
s.source = { :http => 'https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_foundation' }
s.source_files = 'Classes/**/*'
s.ios.dependency 'Flutter'
s.osx.dependency 'FlutterMacOS'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.ios.xcconfig = {
'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)/ $(SDKROOT)/usr/lib/swift',
'LD_RUNPATH_SEARCH_PATHS' => '/usr/lib/swift',
}
s.swift_version = '5.0'
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
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 "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 "Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down Expand Up @@ -28,7 +28,11 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

target 'RunnerTests' do
inherit! :search_paths
end
Expand Down
Loading