Skip to content
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 10 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,33 @@ 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
minSdkVersion 16
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
Expand Down
11 changes: 8 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 29
compileSdkVersion flutter.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
disable 'InvalidPackage'
Expand All @@ -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 29
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
5 changes: 3 additions & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.baseflow.googleapiavailabilityexample">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name="io.flutter.app.FlutterApplication"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="google_api_availability_example"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
Expand Down Expand Up @@ -34,7 +36,6 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize" />

<meta-data android:name="flutterEmbedding" android:value="2"/>
</application>
</manifest>
6 changes: 3 additions & 3 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 0 additions & 18 deletions example/ios/Flutter/Flutter.podspec

This file was deleted.

6 changes: 5 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +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();
}
Expand Down
28 changes: 21 additions & 7 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -21,26 +21,40 @@ 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
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.0"
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:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -59,7 +73,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"
3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -13,6 +13,7 @@ dependencies:
dev_dependencies:
google_api_availability:
path: ../
flutter_lints: 1.0.4

flutter:
uses-material-design: true
9 changes: 5 additions & 4 deletions lib/src/google_api_availability.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -12,14 +10,17 @@ 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.
@visibleForTesting
const GoogleApiAvailability.private();

/// Acquires an instance of the [GoogleApiAvailability] class.
static const GoogleApiAvailability instance = GoogleApiAvailability._();

static final MethodChannel _methodChannel = const 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
Expand Down
5 changes: 5 additions & 0 deletions lib/src/models/google_play_services_availability.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ 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];

/// 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);

Expand Down
Loading