diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh deleted file mode 100755 index 81f389f..0000000 --- a/example/ios/Flutter/flutter_export_environment.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/iirokrankka/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/iirokrankka/flutter_facebook_login/example" -export "FLUTTER_TARGET=/Users/iirokrankka/flutter_facebook_login/example/lib/main.dart" -export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/iirokrankka/flutter/bin/cache/artifacts/engine/ios" -export "TRACK_WIDGET_CREATION=true" diff --git a/example/ios/Podfile b/example/ios/Podfile index 8fe8720..e2633ae 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,47 +1,80 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +platform :ios, '9.0' -def parse_KV_file(file,seperator='=') +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +def parse_KV_file(file, separator='=') file_abs_path = File.expand_path(file) if !File.exists? file_abs_path return []; end - pods_ary = [] + generated_key_values = {} skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=seperator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname,:path=>podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary + File.foreach(file_abs_path) do |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + generated_key_values[podname] = podpath + else + puts "Invalid plugin specification: #{line}" + end + end + generated_key_values end target 'Runner' do + use_frameworks! + use_modular_headers! + # Flutter Pods - generated_xcode_build_settings = parse_KV_file("./Flutter/Generated.xcconfig") - if generated_xcode_build_settings.empty? - puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter build or flutter run is executed once first." - end - generated_xcode_build_settings.map{ |p| - if p[:name]=='FLUTTER_FRAMEWORK_DIR' - pod 'Flutter', :path => p[:path] + # Flutter Pod + copied_flutter_dir = File.join(__dir__, 'Flutter') + copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') + copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') + unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) + # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. + # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. + # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. + + generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') + unless File.exist?(generated_xcode_build_settings_path) + raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) + cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; + + unless File.exist?(copied_framework_path) + FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) + end + unless File.exist?(copied_podspec_path) + FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) end - } + end + + # Keep pod path relative so it can be checked into Podfile.lock. + pod 'Flutter', :path => 'Flutter' # Plugin Pods - plugin_pods = parse_KV_file("../.flutter-plugins") - plugin_pods.map{ |p| - pod p[:name], :path => File.expand_path("ios",p[:path]) - } + + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf .symlinks') + system('mkdir -p .symlinks/plugins') + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.each do |name, path| + symlink = File.join('.symlinks', 'plugins', name) + File.symlink(path, symlink) + pod name, :path => File.join(symlink, 'ios') + end end +# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. +install! 'cocoapods', :disable_input_output_paths => true + post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 7b2f9c2..70e4ed5 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,41 +1,41 @@ PODS: - - FBSDKCoreKit (5.6.0): - - FBSDKCoreKit/Basics (= 5.6.0) - - FBSDKCoreKit/Core (= 5.6.0) - - FBSDKCoreKit/Basics (5.6.0) - - FBSDKCoreKit/Core (5.6.0): + - FBSDKCoreKit (6.2.0): + - FBSDKCoreKit/Basics (= 6.2.0) + - FBSDKCoreKit/Core (= 6.2.0) + - FBSDKCoreKit/Basics (6.2.0) + - FBSDKCoreKit/Core (6.2.0): - FBSDKCoreKit/Basics - - FBSDKLoginKit (5.6.0): - - FBSDKLoginKit/Login (= 5.6.0) - - FBSDKLoginKit/Login (5.6.0): - - FBSDKCoreKit (~> 5.0) + - FBSDKLoginKit (6.2.0): + - FBSDKLoginKit/Login (= 6.2.0) + - FBSDKLoginKit/Login (6.2.0): + - FBSDKCoreKit (~> 6.2.0) - Flutter (1.0.0) - flutter_facebook_login (0.0.1): - - FBSDKCoreKit (~> 5.5) - - FBSDKLoginKit (~> 5.5) + - FBSDKCoreKit (~> 6.2.0) + - FBSDKLoginKit (~> 6.2.0) - Flutter DEPENDENCIES: - - Flutter (from `/Users/iirokrankka/flutter/bin/cache/artifacts/engine/ios`) - - flutter_facebook_login (from `/Users/iirokrankka/flutter_facebook_login/ios`) + - Flutter (from `Flutter`) + - flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`) SPEC REPOS: - https://github.com/cocoapods/specs.git: + trunk: - FBSDKCoreKit - FBSDKLoginKit EXTERNAL SOURCES: Flutter: - :path: "/Users/iirokrankka/flutter/bin/cache/artifacts/engine/ios" + :path: Flutter flutter_facebook_login: - :path: "/Users/iirokrankka/flutter_facebook_login/ios" + :path: ".symlinks/plugins/flutter_facebook_login/ios" SPEC CHECKSUMS: - FBSDKCoreKit: d6655a343868d4bb5c29a60859bab07c3be14a0b - FBSDKLoginKit: c5a623de88a6b0cda35b35582921f6cec2efcc36 + FBSDKCoreKit: a7bb9f5ac56c1e11d5f8ae0b90a3610f8744b43a + FBSDKLoginKit: 5877adb09cc249870c352d92ecc3246cb925c771 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_facebook_login: 0266e8cf236ad20f17d377c4251c582638d8bef7 + flutter_facebook_login: 7cecc1fb6c8c100f58d65c666098e5fa0af8a716 -PODFILE CHECKSUM: 3098c51a7edbd004c9f2b45eca5eb135d6f3ff27 +PODFILE CHECKSUM: 8efa1828e4f45f1818932dcc637740d4787792a1 -COCOAPODS: 1.7.5 +COCOAPODS: 1.9.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 0bf7c7e..4d1c77a 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 5FBE8BB1296FD1C467227E0A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40DB63FD4A1841F35D2ECC5C /* Pods_Runner.framework */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; @@ -20,7 +21,6 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - C3120303A90EA96C5CBF73FA /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25C17999D21EE2A5234707B6 /* libPods-Runner.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -41,9 +41,9 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 25C17999D21EE2A5234707B6 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 40DB63FD4A1841F35D2ECC5C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48E8E67ED89ACADA66EFC271 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 6277276A288ACF1BC3AB10A8 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -67,7 +67,7 @@ files = ( 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, - C3120303A90EA96C5CBF73FA /* libPods-Runner.a in Frameworks */, + 5FBE8BB1296FD1C467227E0A /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -142,7 +142,7 @@ CF8BDAC46B3ACA0B5677CFF6 /* Frameworks */ = { isa = PBXGroup; children = ( - 25C17999D21EE2A5234707B6 /* libPods-Runner.a */, + 40DB63FD4A1841F35D2ECC5C /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -162,7 +162,6 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, D12BC00A3A0CBDBD972F8181 /* [CP] Embed Pods Frameworks */, - 8E2FE90C88641752E308946F /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -236,24 +235,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; - 8E2FE90C88641752E308946F /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", - "${PODS_ROOT}/FBSDKCoreKit/FacebookSDKStrings.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FacebookSDKStrings.bundle", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -274,12 +255,9 @@ files = ( ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/ios/flutter_facebook_login.podspec b/ios/flutter_facebook_login.podspec index 4c65efd..f143d3d 100644 --- a/ios/flutter_facebook_login.podspec +++ b/ios/flutter_facebook_login.podspec @@ -15,8 +15,8 @@ A Flutter plugin for allowing users to authenticate with native Android & iO s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' - s.dependency 'FBSDKCoreKit', '~> 5.5' - s.dependency 'FBSDKLoginKit', '~> 5.5' + s.dependency 'FBSDKCoreKit', '~> 6.2.0' + s.dependency 'FBSDKLoginKit', '~> 6.2.0' # https://github.com/flutter/flutter/issues/14161 s.static_framework = true diff --git a/test/facebook_login_test.dart b/test/facebook_login_test.dart index b7f6a76..b354f3c 100644 --- a/test/facebook_login_test.dart +++ b/test/facebook_login_test.dart @@ -1,4 +1,5 @@ import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_facebook_login/flutter_facebook_login.dart'; import 'package:flutter_facebook_login/src/clock.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -7,6 +8,7 @@ import 'custom_matchers.dart'; void main() { group('$FacebookLogin', () { + WidgetsFlutterBinding.ensureInitialized(); const channel = MethodChannel('com.roughike/flutter_facebook_login'); final beforeExpiry =