From b74f1a0393560d071cda7f9b292d814a37b17fc7 Mon Sep 17 00:00:00 2001 From: Alexis L Date: Fri, 18 Nov 2022 14:40:38 +0100 Subject: [PATCH] feat: Change projet configuration for use flutter >= 3.0 BREAKING CHANGE: update pubspec.yaml for use flutter 3.0 and migrate android project for use androidX --- .gitignore | 3 + .idea/misc.xml | 3 + .idea/workspace.xml | 106 +++++++++--------- .../android/app/src/main/AndroidManifest.xml | 1 - example/ios/Flutter/AppFrameworkInfo.plist | 2 +- example/ios/Podfile | 2 +- example/ios/Podfile.lock | 6 +- example/ios/Runner.xcodeproj/project.pbxproj | 10 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- example/ios/Runner/Info.plist | 2 + example/lib/main.dart | 3 - example/pubspec.lock | 55 ++++----- example/pubspec.yaml | 6 +- example/test/widget_test.dart | 3 +- lib/datadome.dart | 10 +- pubspec.lock | 37 +++--- pubspec.yaml | 7 +- test/datadome_test.dart | 1 - 18 files changed, 133 insertions(+), 126 deletions(-) diff --git a/.gitignore b/.gitignore index e9dc58d..c8649c4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ .pub/ build/ + +pubspec.lock +example/pubspec.lock diff --git a/.idea/misc.xml b/.idea/misc.xml index 5c94cb2..c333ca1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,8 @@ + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ca344a7..cbcbc55 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,26 @@ \ No newline at end of file diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 6fdbf64..eab819a 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 11.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index 1e8c3c9..88359b2 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -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' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index a953fcc..975cbc4 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -22,8 +22,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: datadome: cfb156bd2b99a6e571eb2e7ccb6b89416b47f50a DataDomeSDK: b96ca429030aa1377bfe5d2a2d125309f25b14a7 - Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 -PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c +PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.3 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 7a73e44..936c0f1 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -156,7 +156,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -340,7 +340,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -422,7 +422,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -471,7 +471,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..3db53b6 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + diff --git a/example/lib/main.dart b/example/lib/main.dart index 3f8ee55..b529119 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -30,9 +30,6 @@ class _MyAppState extends State { //make request DataDome client = DataDome('test'); - http.Client test = http.Client(); - - http.Response response = await client.post(url: 'https://datadome.co/wp-json', headers: {'User-Agent': 'BLOCKUA'}, body: ['id', 'data', 'test']); print('Response status: ${response.statusCode}'); print('Response headers: ${response.headers}'); diff --git a/example/pubspec.lock b/example/pubspec.lock index dec7ad7..5f16d3f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.0" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,28 +21,21 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" cupertino_icons: dependency: "direct main" description: @@ -56,14 +49,14 @@ packages: path: ".." relative: true source: path - version: "1.0.3" + version: "1.0.5+1" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -80,42 +73,42 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.5" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.2" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" - meta: + version: "0.12.12" + material_color_utilities: dependency: transitive description: - name: meta + name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" - path: + version: "0.1.5" + meta: dependency: transitive description: - name: path + name: meta url: "https://pub.dartlang.org" source: hosted version: "1.8.0" - pedantic: + path: dependency: transitive description: - name: pedantic + name: path url: "https://pub.dartlang.org" source: hosted - version: "1.9.2" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -127,7 +120,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -148,21 +141,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.12" typed_data: dependency: transitive description: @@ -176,7 +169,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" + dart: ">=2.18.4 <3.0.0" + flutter: ">=3.3.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 33399c3..16a4b69 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,15 +1,15 @@ name: datadome_example description: Demonstrates how to use the datadome plugin. - +version: 1.0.5+1 # The following line prevents the package from being accidentally published to # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.18.4 <3.0.0' dependencies: - http: ^0.12.2 + http: ^0.13.3 flutter: sdk: flutter diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index a089508..4fcca6b 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -18,8 +18,7 @@ void main() { // Verify that platform version is retrieved. expect( find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data.startsWith('Running on:'), + (Widget widget) => widget is Text && widget.data != null && widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/lib/datadome.dart b/lib/datadome.dart index f54c0b7..a17607b 100644 --- a/lib/datadome.dart +++ b/lib/datadome.dart @@ -106,11 +106,13 @@ class DataDome { 'body': body }; - final Map response = await (_channel.invokeMapMethod('request', args) as FutureOr>); - Map responseHeaders = new Map.from(response['headers']); + final Map? response = await _channel.invokeMapMethod('request', args); + + Map responseHeaders = new Map.from(response?['headers'] ?? ""); + http.Response httpResponse = http.Response.bytes( - response['data'], - response['code'], + response?['data'] ?? "", + response?['code'] ?? "", headers: responseHeaders ); diff --git a/pubspec.lock b/pubspec.lock index 0bca67c..02c83d6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.0" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,7 +21,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -35,21 +35,21 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -80,21 +80,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" pedantic: dependency: transitive description: @@ -113,7 +120,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -134,21 +141,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.12" typed_data: dependency: transitive description: @@ -162,7 +169,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=1.20.0" + dart: ">=2.18.4 <3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index d1f7f8b..a0c4c9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,14 +1,14 @@ name: datadome description: A DataDome integration for Flutter. -version: 1.0.5 +version: 1.0.5+1 homepage: https://datadome.co repository: https://github.com/DataDome/datadome-flutter issue_tracker: https://github.com/DataDome/datadome-flutter/issues documentation: https://docs.datadome.co/docs/flutter-plugin environment: - sdk: '>=2.12.0 <3.0.0' - flutter: ">=1.20.0" + sdk: '>=2.18.4 <3.0.0' + flutter: '>=3.3.0' dependencies: http: ^0.13.3 @@ -35,7 +35,6 @@ flutter: pluginClass: DatadomePlugin ios: pluginClass: DatadomePlugin - # To add assets to your plugin package, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg diff --git a/test/datadome_test.dart b/test/datadome_test.dart index 2631073..f1ec608 100644 --- a/test/datadome_test.dart +++ b/test/datadome_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:datadome/datadome.dart'; void main() { const MethodChannel channel = MethodChannel('datadome');