Skip to content

Commit ed99de7

Browse files
committed
Merge branch 'develop'
2 parents 135a31f + 6bfd1bb commit ed99de7

File tree

13 files changed

+215
-45
lines changed

13 files changed

+215
-45
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.0.5
2+
3+
* Update Kotlin version and added support for Android X;
4+
* Update static code analysis options to confirm to the latest recommendations from the Flutter team.
5+
16
## 1.0.4
27

38
* Update used Kotlin and Gradle versions.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To use this plugin, add `google_api_availability` as a [dependency in your pubsp
1919

2020
```yaml
2121
dependencies:
22-
google_api_availability: '^1.0.2'
22+
google_api_availability: '^1.0.5'
2323
```
2424
2525
> **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.

analysis_options.yaml

Lines changed: 167 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,179 @@
1-
# https://www.dartlang.org/guides/language/analysis-options
1+
# Specify analysis options.
2+
#
3+
# Until there are meta linter rules, each desired lint must be explicitly enabled.
4+
# See: https://github.com/dart-lang/linter/issues/288
5+
#
6+
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
7+
# See the configuration guide for more
8+
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
9+
#
10+
# There are other similar analysis options files in the flutter repos,
11+
# which should be kept in sync with this file:
12+
#
13+
# - analysis_options.yaml (this file)
14+
# - packages/flutter/lib/analysis_options_user.yaml
15+
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
16+
# - https://github.com/flutter/engine/blob/master/analysis_options.yaml
17+
#
18+
# This file contains the analysis options used by Flutter tools, such as IntelliJ,
19+
# Android Studio, and the `flutter analyze` command.
20+
221
analyzer:
322
strong-mode:
4-
implicit-casts: true
523
implicit-dynamic: false
24+
errors:
25+
# treat missing required parameters as a warning (not a hint)
26+
missing_required_param: warning
27+
# treat missing returns as a warning (not a hint)
28+
missing_return: warning
29+
# allow having TODOs in the code
30+
todo: ignore
31+
# Ignore analyzer hints for updating pubspecs when using Future or
32+
# Stream and not importing dart:async
33+
# Please see https://github.com/flutter/flutter/pull/24528 for details.
34+
#sdk_version_async_exported_from_core: ignore
35+
exclude:
36+
- 'bin/cache/**'
37+
# the following two are relative to the stocks example and the flutter package respectively
38+
# see https://github.com/dart-lang/sdk/issues/28463
39+
- 'lib/i18n/stock_messages_*.dart'
40+
- 'lib/src/http/**'
641

7-
# Source of linter options:
8-
# http://dart-lang.github.io/linter/lints/options/options.html
942
linter:
1043
rules:
44+
# these rules are documented on and in the same order as
45+
# the Dart Lint rules page to make maintenance easier
46+
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
1147
- always_declare_return_types
12-
- camel_case_types
13-
- empty_constructor_bodies
48+
- always_put_control_body_on_new_line
49+
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
50+
- always_require_non_null_named_parameters
51+
- always_specify_types
1452
- annotate_overrides
53+
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
54+
- avoid_as
55+
# - avoid_bool_literals_in_conditional_expressions # not yet tested
56+
# - avoid_catches_without_on_clauses # we do this commonly
57+
# - avoid_catching_errors # we do this commonly
58+
- avoid_classes_with_only_static_members
59+
# - avoid_double_and_int_checks # only useful when targeting JS runtime
60+
- avoid_empty_else
61+
- avoid_field_initializers_in_const_classes
62+
- avoid_function_literals_in_foreach_calls
63+
# - avoid_implementing_value_types # not yet tested
1564
- avoid_init_to_null
16-
- constant_identifier_names
17-
- one_member_abstracts
65+
# - avoid_js_rounded_ints # only useful when targeting JS runtime
66+
- avoid_null_checks_in_equality_operators
67+
# - avoid_positional_boolean_parameters # not yet tested
68+
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
69+
- avoid_relative_lib_imports
70+
- avoid_renaming_method_parameters
71+
- avoid_return_types_on_setters
72+
# - avoid_returning_null # there are plenty of valid reasons to return null
73+
# - avoid_returning_null_for_future # not yet tested
74+
- avoid_returning_null_for_void
75+
# - avoid_returning_this # there are plenty of valid reasons to return this
76+
# - avoid_setters_without_getters # not yet tested
77+
# - avoid_shadowing_type_parameters # not yet tested
78+
# - avoid_single_cascade_in_expression_statements # not yet tested
79+
- avoid_slow_async_io
80+
- avoid_types_as_parameter_names
81+
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
82+
- avoid_unused_constructor_parameters
83+
- avoid_void_async
84+
- await_only_futures
85+
- camel_case_types
86+
- cancel_subscriptions
87+
# - cascade_invocations # not yet tested
88+
# - close_sinks # not reliable enough
89+
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
90+
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
91+
- control_flow_in_finally
92+
# - curly_braces_in_flow_control_structures # not yet tested
93+
- directives_ordering
94+
- empty_catches
95+
- empty_constructor_bodies
96+
- empty_statements
97+
# - file_names # not yet tested
98+
- flutter_style_todos
99+
- hash_and_equals
100+
- implementation_imports
101+
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
102+
- iterable_contains_unrelated_type
103+
# - join_return_with_assignment # not yet tested
104+
- library_names
105+
- library_prefixes
106+
# - lines_longer_than_80_chars # not yet tested
107+
- list_remove_unrelated_type
108+
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
109+
- no_adjacent_strings_in_list
110+
- no_duplicate_case_values
111+
- non_constant_identifier_names
112+
# - null_closures # not yet tested
113+
# - omit_local_variable_types # opposite of always_specify_types
114+
# - one_member_abstracts # too many false positives
115+
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
116+
- overridden_fields
117+
- package_api_docs
118+
- package_names
119+
- package_prefixed_library_names
120+
# - parameter_assignments # we do this commonly
121+
- prefer_adjacent_string_concatenation
122+
- prefer_asserts_in_initializer_lists
123+
- prefer_collection_literals
124+
- prefer_conditional_assignment
125+
- prefer_const_constructors
126+
- prefer_const_constructors_in_immutables
127+
- prefer_const_declarations
128+
- prefer_const_literals_to_create_immutables
129+
# - prefer_constructors_over_static_methods # not yet tested
130+
- prefer_contains
131+
- prefer_equal_for_default_values
132+
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
133+
- prefer_final_fields
134+
- prefer_final_locals
135+
- prefer_foreach
136+
# - prefer_function_declarations_over_variables # not yet tested
137+
- prefer_generic_function_type_aliases
138+
- prefer_initializing_formals
139+
# - prefer_int_literals # not yet tested
140+
# - prefer_interpolation_to_compose_strings # not yet tested
141+
- prefer_is_empty
142+
- prefer_is_not_empty
143+
- prefer_iterable_whereType
144+
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
145+
- prefer_single_quotes
146+
- prefer_typing_uninitialized_variables
147+
- prefer_void_to_null
148+
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
149+
- recursive_getters
18150
- slash_for_doc_comments
19151
- sort_constructors_first
152+
- sort_pub_dependencies
153+
- sort_unnamed_constructors_first
154+
- super_goes_last
155+
- test_types_in_equals
156+
- throw_in_finally
157+
# - type_annotate_public_apis # subset of always_specify_types
158+
- type_init_formals
159+
# - unawaited_futures # too many false positives
160+
# - unnecessary_await_in_return # not yet tested
20161
- unnecessary_brace_in_string_interps
162+
- unnecessary_const
163+
- unnecessary_getters_setters
164+
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
165+
- unnecessary_new
166+
- unnecessary_null_aware_assignments
167+
- unnecessary_null_in_if_null_operators
168+
- unnecessary_overrides
169+
- unnecessary_parenthesis
170+
- unnecessary_statements
171+
- unnecessary_this
172+
- unrelated_type_equality_checks
173+
# - use_function_type_syntax_for_parameters # not yet tested
174+
- use_rethrow_when_possible
175+
# - use_setters_to_change_properties # not yet tested
176+
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
177+
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
178+
- valid_regexps
179+
# - void_checks # not yet tested

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ group 'com.baseflow.googleapiavailability'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.2.71'
5+
ext.kotlin_version = '1.3.0'
66
repositories {
77
google()
88
jcenter()
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
compileSdkVersion 27
28+
compileSdkVersion 28
2929

3030
sourceSets {
3131
main.java.srcDirs += 'src/main/kotlin'

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.2.71'
2+
ext.kotlin_version = '1.3.0'
33
repositories {
44
google()
55
jcenter()

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
446446
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
447447
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
448-
SWIFT_VERSION = 4.0;
448+
SWIFT_VERSION = 4.2;
449449
VALID_ARCHS = "arm64 armv7 armv7s";
450450
VERSIONING_SYSTEM = "apple-generic";
451451
};
@@ -473,7 +473,7 @@
473473
PRODUCT_NAME = "$(TARGET_NAME)";
474474
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
475475
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
476-
SWIFT_VERSION = 4.0;
476+
SWIFT_VERSION = 4.2;
477477
VERSIONING_SYSTEM = "apple-generic";
478478
};
479479
name = Release;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>BuildSystemType</key>
6+
<string>Original</string>
7+
</dict>
8+
</plist>

example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Flutter
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,
8-
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
8+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
99
) -> Bool {
1010
GeneratedPluginRegistrant.register(with: self)
1111
return super.application(application, didFinishLaunchingWithOptions: launchOptions)

example/lib/main.dart

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
import 'package:flutter/material.dart';
21
import 'dart:async';
32

3+
import 'package:flutter/material.dart';
44
import 'package:flutter/services.dart';
55
import 'package:google_api_availability/google_api_availability.dart';
66

7-
void main() => runApp(new MyApp());
7+
void main() => runApp(MyApp());
88

99
class MyApp extends StatefulWidget {
1010
@override
11-
_MyAppState createState() => new _MyAppState();
11+
_MyAppState createState() => _MyAppState();
1212
}
1313

1414
class _MyAppState extends State<MyApp> {
1515
GooglePlayServicesAvailability _playStoreAvailability =
1616
GooglePlayServicesAvailability.unknown;
1717

18-
@override
19-
void initState() {
20-
super.initState();
21-
}
22-
2318
// Platform messages are asynchronous, so we initialize in an async method.
2419
Future<void> checkPlayServices([bool showDialog = false]) async {
2520
GooglePlayServicesAvailability playStoreAvailability;
@@ -34,7 +29,9 @@ class _MyAppState extends State<MyApp> {
3429
// If the widget was removed from the tree while the asynchronous platform
3530
// message was in flight, we want to discard the reply rather than calling
3631
// setState to update our non-existent appearance.
37-
if (!mounted) return;
32+
if (!mounted) {
33+
return;
34+
}
3835

3936
setState(() {
4037
_playStoreAvailability = playStoreAvailability;
@@ -43,25 +40,25 @@ class _MyAppState extends State<MyApp> {
4340

4441
@override
4542
Widget build(BuildContext context) {
46-
return new MaterialApp(
47-
home: new Scaffold(
48-
appBar: new AppBar(
43+
return MaterialApp(
44+
home: Scaffold(
45+
appBar: AppBar(
4946
title: const Text('Plugin example app'),
5047
),
51-
body: new ListView(
48+
body: ListView(
5249
children: <Widget>[
53-
new MaterialButton(
50+
MaterialButton(
5451
onPressed: () => checkPlayServices(),
55-
child: new Text("Get PlayServices availability"),
52+
child: const Text('Get PlayServices availability'),
5653
color: Colors.red,
5754
),
58-
new MaterialButton(
55+
MaterialButton(
5956
onPressed: () => checkPlayServices(true),
6057
child:
61-
new Text("Get PlayServices availability with fix dialog"),
58+
const Text('Get PlayServices availability with fix dialog'),
6259
color: Colors.redAccent,
6360
),
64-
new Center(
61+
Center(
6562
child: Text(
6663
'Google Play Store status: ${_playStoreAvailability.toString().split('.').last}\n')),
6764
],

ios/google_api_availability.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
Pod::Spec.new do |s|
55
s.name = 'google_api_availability'
6-
s.version = '1.0.4'
6+
s.version = '1.0.5'
77
s.summary = 'A Flutter plugin to check the availability of Google Play Services on an Android device.'
88
s.description = <<-DESC
99
A Flutter plugin to check the availability of Google Play Services on an Android device.
@@ -15,7 +15,7 @@ A Flutter plugin to check the availability of Google Play Services on an Android
1515
s.source_files = 'Classes/**/*'
1616
s.public_header_files = 'Classes/**/*.h'
1717
s.dependency 'Flutter'
18-
18+
s.swift_version = '4.2'
1919
s.ios.deployment_target = '8.0'
2020
end
2121

0 commit comments

Comments
 (0)