From 95ad990d683d8c5a4a0aa152e67e32e56e8fe016 Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月20日 16:17:01 +0100 Subject: [PATCH 01/13] Updated code and made small improvements and changes --- CHANGELOG.md | 8 ++++ README.md | 2 +- analysis_options.yaml | 4 +- example/android/app/build.gradle | 4 +- .../android/app/src/main/AndroidManifest.xml | 5 ++- example/ios/Flutter/Flutter.podspec | 18 -------- example/lib/main.dart | 1 + example/pubspec.lock | 14 +++---- example/pubspec.yaml | 2 +- lib/src/google_api_availability.dart | 5 +-- .../google_play_services_availability.dart | 3 ++ pubspec.lock | 41 +++++++++++-------- pubspec.yaml | 6 +-- test/google_api_availability_test.dart | 10 ++--- ...oogle_play_services_availability_test.dart | 6 +-- test/method_channel_mock.dart | 3 +- 16 files changed, 65 insertions(+), 67 deletions(-) delete mode 100644 example/ios/Flutter/Flutter.podspec diff --git a/CHANGELOG.md b/CHANGELOG.md index b564874..ee97827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 3.0.2 + +* Updated `pubspec.yaml` to newer versions of `SDK` and `flutter` and adding `flutter_lints` as a dependency; +* Updated `analysis_options.yaml` for using `flutter_lints`; +* Updated code according to the set lint rule(s); +* Updated `compileSdkVersion` and `targetSdkVersion` in the `build.gradle` +* Fixed bug were starting the example app would close on running for the first time by adding internet permission in the `AndroidManifest` + ## 3.0.1 * Added unit-tests to guard API against breaking changes. diff --git a/README.md b/README.md index f3c9361..945d16f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To use this plugin, add `google_api_availability` as a [dependency in your pubsp ```yaml dependencies: - google_api_availability: ^3.0.1 + google_api_availability: ^3.0.2 ``` > **NOTE:** There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. See issue [Flutter#16049](https://github.com/flutter/flutter/issues/16049) for help on integration. diff --git a/analysis_options.yaml b/analysis_options.yaml index 2edc701..04a0dd6 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,12 +1,10 @@ -include: package:pedantic/analysis_options.yaml +include: package:flutter_lints/flutter.yaml analyzer: exclude: # Ignore generated files - '**/*.g.dart' - 'lib/src/generated/*.dart' - # workaround for https://github.com/dart-lang/sdk/issues/42910 - - 'example/**' linter: rules: - public_member_api_docs \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 1c009c1..31cf4f3 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 31 lintOptions { disable 'InvalidPackage' @@ -35,7 +35,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.baseflow.googleapiavailabilityexample" minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index bc672bd..ecc43c1 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -2,8 +2,10 @@ xmlns:tools="http://schemas.android.com/tools" package="com.baseflow.googleapiavailabilityexample"> + + @@ -34,7 +36,6 @@ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" /> - diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec deleted file mode 100644 index 2c4421c..0000000 --- a/example/ios/Flutter/Flutter.podspec +++ /dev/null @@ -1,18 +0,0 @@ -# -# NOTE: This podspec is NOT to be published. It is only used as a local source! -# This is a generated file; do not edit or check into version control. -# - -Pod::Spec.new do |s| - s.name = 'Flutter' - s.version = '1.0.0' - s.summary = 'High-performance, high-fidelity mobile apps.' - s.homepage = 'https://flutter.io' - s.license = { :type => 'MIT' } - s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } - s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '8.0' - # Framework linking is handled by Flutter tooling, not CocoaPods. - # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. - s.vendored_frameworks = 'path/to/nothing' -end diff --git a/example/lib/main.dart b/example/lib/main.dart index eaef6d5..542514b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -6,6 +6,7 @@ import 'package:google_api_availability/google_api_availability.dart'; void main() => runApp(MyApp()); +///Creates the mutable state for this widget class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); diff --git a/example/pubspec.lock b/example/pubspec.lock index e836b6c..ba9ff8a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" collection: dependency: transitive description: @@ -21,7 +21,7 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.1.3" flutter: dependency: "direct main" description: flutter @@ -33,14 +33,14 @@ packages: path: ".." relative: true source: path - version: "3.0.0" + version: "3.0.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" sky_engine: dependency: transitive description: flutter @@ -59,7 +59,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" sdks: - dart: ">=2.12.0-259.9.beta <3.0.0" - flutter: ">=1.12.13+hotfix.6" + dart: ">=2.15.0 <3.0.0" + flutter: ">=2.8.1" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 0bc1e8d..09ac6ea 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the google_api_availability plugin. version: 1.0.0+1 environment: - sdk: ">=2.10.0 <3.0.0" + sdk: ">=2.15.0 <3.0.0" dependencies: flutter: diff --git a/lib/src/google_api_availability.dart b/lib/src/google_api_availability.dart index a7854de..7830af7 100644 --- a/lib/src/google_api_availability.dart +++ b/lib/src/google_api_availability.dart @@ -1,7 +1,5 @@ import 'dart:async'; - import 'package:flutter/foundation.dart'; -import 'package:meta/meta.dart'; import 'package:flutter/services.dart'; import 'package:google_api_availability/src/models/google_play_services_availability.dart'; @@ -12,13 +10,14 @@ import 'models/google_play_services_availability.dart'; class GoogleApiAvailability { const GoogleApiAvailability._(); + ///Only visible for testing purposes @visibleForTesting const GoogleApiAvailability.private(); /// Acquires an instance of the [GoogleApiAvailability] class. static const GoogleApiAvailability instance = GoogleApiAvailability._(); - static final MethodChannel _methodChannel = const MethodChannel( + static const MethodChannel _methodChannel = MethodChannel( 'flutter.baseflow.com/google_api_availability/methods'); /// This feature is only available on Android devices. On any other platforms diff --git a/lib/src/models/google_play_services_availability.dart b/lib/src/models/google_play_services_availability.dart index 8192976..006dd55 100644 --- a/lib/src/models/google_play_services_availability.dart +++ b/lib/src/models/google_play_services_availability.dart @@ -3,8 +3,11 @@ import 'package:meta/meta.dart'; /// Indicates possible states of the Google Api Services availability. class GooglePlayServicesAvailability { const GooglePlayServicesAvailability._(this.value); + + /// Returns the value of the status as a string of the given status integer factory GooglePlayServicesAvailability.byValue(int value) => values[value]; + ///Only used for testing purposes @visibleForTesting const GooglePlayServicesAvailability.private(this.value); diff --git a/pubspec.lock b/pubspec.lock index 12d917e..0321606 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -21,14 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -55,25 +55,39 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" path: dependency: transitive description: @@ -81,13 +95,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" - pedantic: - dependency: "direct dev" - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" sky_engine: dependency: transitive description: flutter @@ -99,7 +106,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -134,7 +141,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.4.3" typed_data: dependency: transitive description: @@ -148,7 +155,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" sdks: - dart: ">=2.12.0-259.9.beta <3.0.0" - flutter: ">=1.12.13+hotfix.6" + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.8.1" diff --git a/pubspec.yaml b/pubspec.yaml index 4c2c542..5dc31ec 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,18 +5,16 @@ homepage: https://github.com/baseflowit/flutter-google-api-availability environment: sdk: '>=2.12.0 <3.0.0' - flutter: ">=1.12.13+hotfix.6" + flutter: ">=2.8.1" dependencies: flutter: sdk: flutter - meta: ^1.3.0 - dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.10.0 + flutter_lints: 1.0.4 flutter: plugin: diff --git a/test/google_api_availability_test.dart b/test/google_api_availability_test.dart index a26e52c..59632ed 100644 --- a/test/google_api_availability_test.dart +++ b/test/google_api_availability_test.dart @@ -10,7 +10,7 @@ void main() { test('Should receive notAvailableOnPlatform is not Android', () async { debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - final googlePlayServiceAvailability = await GoogleApiAvailability.private() + final googlePlayServiceAvailability = await const GoogleApiAvailability.private() .checkGooglePlayServicesAvailability(); expect(googlePlayServiceAvailability, @@ -21,7 +21,7 @@ void main() { test('Should receive the corresponding GooglePlayServiceAvailability', () async { - final availability = GooglePlayServicesAvailability.serviceDisabled; + const availability = GooglePlayServicesAvailability.serviceDisabled; MethodChannelMock( channelName: 'flutter.baseflow.com/google_api_availability/methods', @@ -29,7 +29,7 @@ void main() { result: availability.value, ); - final googlePlayServiceAvailability = await GoogleApiAvailability.private() + final googlePlayServiceAvailability = await const GoogleApiAvailability.private() .checkGooglePlayServicesAvailability(); expect(googlePlayServiceAvailability, availability); @@ -38,7 +38,7 @@ void main() { test( 'Should receive GooglePlayServiceAvailability.unknown when availability is null', () async { - final availability = null; + const availability = null; MethodChannelMock( channelName: 'flutter.baseflow.com/google_api_availability/methods', @@ -46,7 +46,7 @@ void main() { result: availability, ); - final googlePlayServiceAvailability = await GoogleApiAvailability.private() + final googlePlayServiceAvailability = await const GoogleApiAvailability.private() .checkGooglePlayServicesAvailability(); expect( diff --git a/test/google_play_services_availability_test.dart b/test/google_play_services_availability_test.dart index bcfd2f6..35b477d 100644 --- a/test/google_play_services_availability_test.dart +++ b/test/google_play_services_availability_test.dart @@ -5,14 +5,14 @@ void main() { test( 'GooglePlayServicesAvailability has the right amount of availability states', () { - final values = GooglePlayServicesAvailability.values; + const values = GooglePlayServicesAvailability.values; expect(values.length, 8); }); test('check if corresponding status gets received when calling constructor', () { - final values = GooglePlayServicesAvailability.values; + const values = GooglePlayServicesAvailability.values; for (var i = 0; i < values.length; i++) { expect(values[i], GooglePlayServicesAvailability.byValue(i)); @@ -20,7 +20,7 @@ void main() { }); test('check if toString method returns the corresponding name', () { - var playServicesAvailability = GooglePlayServicesAvailability.private(0); + var playServicesAvailability = const GooglePlayServicesAvailability.private(0); expect(playServicesAvailability.toString(), 'GooglePlayServicesAvailability.success'); diff --git a/test/method_channel_mock.dart b/test/method_channel_mock.dart index f09c8c6..2439656 100644 --- a/test/method_channel_mock.dart +++ b/test/method_channel_mock.dart @@ -1,4 +1,5 @@ import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; class MethodChannelMock { final MethodChannel methodChannel; @@ -12,7 +13,7 @@ class MethodChannelMock { this.result, this.delay = Duration.zero, }) : methodChannel = MethodChannel(channelName) { - methodChannel.setMockMethodCallHandler(_handler); + TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger.setMockMethodCallHandler(methodChannel, _handler); } Future _handler(MethodCall methodCall) async { From 0970c7182d6f1e9f34ffadb33f71026aec1bfa83 Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月20日 16:19:29 +0100 Subject: [PATCH 02/13] Ran flutter format --- lib/src/google_api_availability.dart | 4 ++-- test/google_api_availability_test.dart | 15 +++++++++------ test/google_play_services_availability_test.dart | 3 ++- test/method_channel_mock.dart | 3 ++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/src/google_api_availability.dart b/lib/src/google_api_availability.dart index 7830af7..19945ea 100644 --- a/lib/src/google_api_availability.dart +++ b/lib/src/google_api_availability.dart @@ -17,8 +17,8 @@ class GoogleApiAvailability { /// Acquires an instance of the [GoogleApiAvailability] class. static const GoogleApiAvailability instance = GoogleApiAvailability._(); - static const MethodChannel _methodChannel = MethodChannel( - 'flutter.baseflow.com/google_api_availability/methods'); + static const MethodChannel _methodChannel = + MethodChannel('flutter.baseflow.com/google_api_availability/methods'); /// This feature is only available on Android devices. On any other platforms /// the [checkPlayServicesAvailability] method will always return diff --git a/test/google_api_availability_test.dart b/test/google_api_availability_test.dart index 59632ed..21f3cd5 100644 --- a/test/google_api_availability_test.dart +++ b/test/google_api_availability_test.dart @@ -10,8 +10,9 @@ void main() { test('Should receive notAvailableOnPlatform is not Android', () async { debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - final googlePlayServiceAvailability = await const GoogleApiAvailability.private() - .checkGooglePlayServicesAvailability(); + final googlePlayServiceAvailability = + await const GoogleApiAvailability.private() + .checkGooglePlayServicesAvailability(); expect(googlePlayServiceAvailability, GooglePlayServicesAvailability.notAvailableOnPlatform); @@ -29,8 +30,9 @@ void main() { result: availability.value, ); - final googlePlayServiceAvailability = await const GoogleApiAvailability.private() - .checkGooglePlayServicesAvailability(); + final googlePlayServiceAvailability = + await const GoogleApiAvailability.private() + .checkGooglePlayServicesAvailability(); expect(googlePlayServiceAvailability, availability); }); @@ -46,8 +48,9 @@ void main() { result: availability, ); - final googlePlayServiceAvailability = await const GoogleApiAvailability.private() - .checkGooglePlayServicesAvailability(); + final googlePlayServiceAvailability = + await const GoogleApiAvailability.private() + .checkGooglePlayServicesAvailability(); expect( googlePlayServiceAvailability, GooglePlayServicesAvailability.unknown); diff --git a/test/google_play_services_availability_test.dart b/test/google_play_services_availability_test.dart index 35b477d..3abf1cd 100644 --- a/test/google_play_services_availability_test.dart +++ b/test/google_play_services_availability_test.dart @@ -20,7 +20,8 @@ void main() { }); test('check if toString method returns the corresponding name', () { - var playServicesAvailability = const GooglePlayServicesAvailability.private(0); + var playServicesAvailability = + const GooglePlayServicesAvailability.private(0); expect(playServicesAvailability.toString(), 'GooglePlayServicesAvailability.success'); diff --git a/test/method_channel_mock.dart b/test/method_channel_mock.dart index 2439656..ad85720 100644 --- a/test/method_channel_mock.dart +++ b/test/method_channel_mock.dart @@ -13,7 +13,8 @@ class MethodChannelMock { this.result, this.delay = Duration.zero, }) : methodChannel = MethodChannel(channelName) { - TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger.setMockMethodCallHandler(methodChannel, _handler); + TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger + .setMockMethodCallHandler(methodChannel, _handler); } Future _handler(MethodCall methodCall) async { From 748383cf39108432a3b4d4f12e9915fa76a36dbf Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月20日 16:34:58 +0100 Subject: [PATCH 03/13] Fixed lint issues --- example/analysis_options.yaml | 10 ++++++++++ example/lib/main.dart | 5 ++++- example/pubspec.lock | 14 ++++++++++++++ example/pubspec.yaml | 1 + pubspec.yaml | 2 +- 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 example/analysis_options.yaml diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml new file mode 100644 index 0000000..04a0dd6 --- /dev/null +++ b/example/analysis_options.yaml @@ -0,0 +1,10 @@ +include: package:flutter_lints/flutter.yaml + +analyzer: + exclude: + # Ignore generated files + - '**/*.g.dart' + - 'lib/src/generated/*.dart' +linter: + rules: + - public_member_api_docs \ No newline at end of file diff --git a/example/lib/main.dart b/example/lib/main.dart index 542514b..6bcab52 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -4,10 +4,13 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_api_availability/google_api_availability.dart'; -void main() => runApp(MyApp()); +void main() => runApp(const MyApp()); ///Creates the mutable state for this widget class MyApp extends StatefulWidget { + ///Named [key] parameter to identify a widget + const MyApp({Key? key}) : super(key: key); + @override _MyAppState createState() => _MyAppState(); } diff --git a/example/pubspec.lock b/example/pubspec.lock index ba9ff8a..57d4afd 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -27,6 +27,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" google_api_availability: dependency: "direct dev" description: @@ -34,6 +41,13 @@ packages: relative: true source: path version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" meta: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 09ac6ea..4435167 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: dev_dependencies: google_api_availability: path: ../ + flutter_lints: 1.0.4 flutter: uses-material-design: true \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 5dc31ec..edf8fbc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: google_api_availability description: A Flutter plugin to check the availability of Google Play Services on an Android device. -version: 3.0.1 +version: 3.0.2 homepage: https://github.com/baseflowit/flutter-google-api-availability environment: From 44f1ed9b4d82cebd5fc290218f7a3d255403e9cf Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月20日 16:37:02 +0100 Subject: [PATCH 04/13] Fixed lint issues --- analysis_options.yaml | 3 +++ example/analysis_options.yaml | 10 ---------- example/pubspec.yaml | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 example/analysis_options.yaml diff --git a/analysis_options.yaml b/analysis_options.yaml index 04a0dd6..e7622c0 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -5,6 +5,9 @@ analyzer: # Ignore generated files - '**/*.g.dart' - 'lib/src/generated/*.dart' + # workaround for https://github.com/dart-lang/sdk/issues/42910 + - 'example/**' + linter: rules: - public_member_api_docs \ No newline at end of file diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml deleted file mode 100644 index 04a0dd6..0000000 --- a/example/analysis_options.yaml +++ /dev/null @@ -1,10 +0,0 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - exclude: - # Ignore generated files - - '**/*.g.dart' - - 'lib/src/generated/*.dart' -linter: - rules: - - public_member_api_docs \ No newline at end of file diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4435167..09ac6ea 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -13,7 +13,6 @@ dependencies: dev_dependencies: google_api_availability: path: ../ - flutter_lints: 1.0.4 flutter: uses-material-design: true \ No newline at end of file From 771bf6676c7b64e3618e27e86849fd7341fce6a9 Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月20日 16:41:48 +0100 Subject: [PATCH 05/13] Updated pubspec.yaml --- example/pubspec.lock | 16 +--------------- pubspec.lock | 2 +- pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 57d4afd..60300a5 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -27,27 +27,13 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" google_api_availability: dependency: "direct dev" description: path: ".." relative: true source: path - version: "3.0.1" - lints: - dependency: transitive - description: - name: lints - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" + version: "3.0.2" meta: dependency: transitive description: diff --git a/pubspec.lock b/pubspec.lock index 0321606..91cfb9d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -157,5 +157,5 @@ packages: source: hosted version: "2.1.1" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.15.0 <3.0.0" flutter: ">=2.8.1" diff --git a/pubspec.yaml b/pubspec.yaml index edf8fbc..f93aa7c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 3.0.2 homepage: https://github.com/baseflowit/flutter-google-api-availability environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' flutter: ">=2.8.1" dependencies: From f59a16ac2700da2159f4110b3fc36e95072f2527 Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月20日 16:50:02 +0100 Subject: [PATCH 06/13] Updated `pubspec.yaml` by adding `flutter_lints` in example folder --- analysis_options.yaml | 4 +--- example/pubspec.lock | 14 ++++++++++++++ example/pubspec.yaml | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index e7622c0..3bc1bd0 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -5,9 +5,7 @@ analyzer: # Ignore generated files - '**/*.g.dart' - 'lib/src/generated/*.dart' - # workaround for https://github.com/dart-lang/sdk/issues/42910 - - 'example/**' - + linter: rules: - public_member_api_docs \ No newline at end of file diff --git a/example/pubspec.lock b/example/pubspec.lock index 60300a5..cb17ab5 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -27,6 +27,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" google_api_availability: dependency: "direct dev" description: @@ -34,6 +41,13 @@ packages: relative: true source: path version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" meta: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 09ac6ea..4435167 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: dev_dependencies: google_api_availability: path: ../ + flutter_lints: 1.0.4 flutter: uses-material-design: true \ No newline at end of file From 09b4f6b2e9dc38b6dc12bf4ee144f23bbb6d8664 Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月28日 10:16:10 +0100 Subject: [PATCH 07/13] Clean-up, upgrade build.gradle's --- analysis_options.yaml | 1 - android/build.gradle | 13 +++++++++---- example/android/app/build.gradle | 11 ++++++++--- example/android/build.gradle | 6 +++--- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 3bc1bd0..04a0dd6 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -5,7 +5,6 @@ analyzer: # Ignore generated files - '**/*.g.dart' - 'lib/src/generated/*.dart' - linter: rules: - public_member_api_docs \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 9741096..e07bc9b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,25 +4,30 @@ version '1.0-SNAPSHOT' buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.6.1' + classpath 'com.android.tools.build:gradle:4.1.0' } } rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() } } apply plugin: 'com.android.library' android { - compileSdkVersion 28 + compileSdkVersion 31 + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } defaultConfig { minSdkVersion 16 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 31cf4f3..9a70b70 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,12 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 31 + compileSdkVersion flutter.compileSdkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } lintOptions { disable 'InvalidPackage' @@ -34,8 +39,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.baseflow.googleapiavailabilityexample" - minSdkVersion 16 - targetSdkVersion 31 + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/example/android/build.gradle b/example/android/build.gradle index 83f114c..0b4cf53 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,18 +1,18 @@ buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.6.1' + classpath 'com.android.tools.build:gradle:4.1.0' } } allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index c1f1871..59e7060 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip From 0fea16b1a515982ca3637ad2ed76d9ef0439bd13 Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries <47666699+jddv@users.noreply.github.com> Date: 2022年1月28日 10:48:26 +0100 Subject: [PATCH 08/13] Update android/build.gradle Co-authored-by: Maurits van Beusekom --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index e07bc9b..2a8e54b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,7 +22,7 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion 31 + compileSdkVersion flutter.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 From 2a659dac1e0f0c150ca4c1c18840c5046ed8283b Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries <47666699+jddv@users.noreply.github.com> Date: 2022年1月28日 10:48:45 +0100 Subject: [PATCH 09/13] Update lib/src/google_api_availability.dart Co-authored-by: Maurits van Beusekom --- lib/src/google_api_availability.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/google_api_availability.dart b/lib/src/google_api_availability.dart index 19945ea..ac8df36 100644 --- a/lib/src/google_api_availability.dart +++ b/lib/src/google_api_availability.dart @@ -10,7 +10,9 @@ import 'models/google_play_services_availability.dart'; class GoogleApiAvailability { const GoogleApiAvailability._(); - ///Only visible for testing purposes + /// Creates an instance of the [GoogleApiAvailability] class. This + /// constructor is exposed for testing purposes only and should not be used + /// by clients of the plugin as it may break or change at any time. @visibleForTesting const GoogleApiAvailability.private(); From a1f8775568fb076c9e2578161b0de0d9d5bb3b5a Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries <47666699+jddv@users.noreply.github.com> Date: 2022年1月28日 10:48:56 +0100 Subject: [PATCH 10/13] Update lib/src/models/google_play_services_availability.dart Co-authored-by: Maurits van Beusekom --- lib/src/models/google_play_services_availability.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/models/google_play_services_availability.dart b/lib/src/models/google_play_services_availability.dart index 006dd55..fcabe60 100644 --- a/lib/src/models/google_play_services_availability.dart +++ b/lib/src/models/google_play_services_availability.dart @@ -7,7 +7,9 @@ class GooglePlayServicesAvailability { /// Returns the value of the status as a string of the given status integer factory GooglePlayServicesAvailability.byValue(int value) => values[value]; - ///Only used for testing purposes + /// Creates an instance of the [GoogleApiAvailability] class. This + /// constructor is exposed for testing purposes only and should not be used + /// by clients of the plugin as it may break or change at any time. @visibleForTesting const GooglePlayServicesAvailability.private(this.value); From 2eb2def69f2ff64733dc988be17fa5e42036c03a Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries <47666699+jddv@users.noreply.github.com> Date: 2022年1月28日 10:49:05 +0100 Subject: [PATCH 11/13] Update android/build.gradle Co-authored-by: Maurits van Beusekom --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 2a8e54b..9a7df0d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -30,7 +30,7 @@ android { } defaultConfig { - minSdkVersion 16 + minSdkVersion flutter.minSdkVersion testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { From fbb998a90128d4be77d3a7a67932b2d29faf461e Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月28日 10:53:50 +0100 Subject: [PATCH 12/13] Flutter format --- lib/src/google_api_availability.dart | 6 +++--- lib/src/models/google_play_services_availability.dart | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/google_api_availability.dart b/lib/src/google_api_availability.dart index ac8df36..a94306d 100644 --- a/lib/src/google_api_availability.dart +++ b/lib/src/google_api_availability.dart @@ -10,9 +10,9 @@ import 'models/google_play_services_availability.dart'; class GoogleApiAvailability { const GoogleApiAvailability._(); - /// Creates an instance of the [GoogleApiAvailability] class. This - /// constructor is exposed for testing purposes only and should not be used - /// by clients of the plugin as it may break or change at any time. + /// Creates an instance of the [GoogleApiAvailability] class. This + /// constructor is exposed for testing purposes only and should not be used + /// by clients of the plugin as it may break or change at any time. @visibleForTesting const GoogleApiAvailability.private(); diff --git a/lib/src/models/google_play_services_availability.dart b/lib/src/models/google_play_services_availability.dart index fcabe60..ec2f506 100644 --- a/lib/src/models/google_play_services_availability.dart +++ b/lib/src/models/google_play_services_availability.dart @@ -7,9 +7,9 @@ class GooglePlayServicesAvailability { /// Returns the value of the status as a string of the given status integer factory GooglePlayServicesAvailability.byValue(int value) => values[value]; - /// Creates an instance of the [GoogleApiAvailability] class. This - /// constructor is exposed for testing purposes only and should not be used - /// by clients of the plugin as it may break or change at any time. + /// Creates an instance of the [GoogleApiAvailability] class. This + /// constructor is exposed for testing purposes only and should not be used + /// by clients of the plugin as it may break or change at any time. @visibleForTesting const GooglePlayServicesAvailability.private(this.value); From 4be98884f03dec4c80a4c8cc9cc50ce9e0b5fdea Mon Sep 17 00:00:00 2001 From: Jan-Derk de Vries Date: 2022年1月28日 11:45:17 +0100 Subject: [PATCH 13/13] Update build.gradle --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 9a7df0d..b0b7e2b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,7 +22,7 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion flutter.compileSdkVersion + compileSdkVersion 31 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -30,7 +30,7 @@ android { } defaultConfig { - minSdkVersion flutter.minSdkVersion + minSdkVersion 16 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions {

AltStyle によって変換されたページ (->オリジナル) /