Skip to content

Commit

Permalink
Merge branch 'master' into gmain
Browse files Browse the repository at this point in the history
* master:
  [in_app_purchase] Android Code Inspection and Clean up (flutter#3120)
  Android Code Inspection and Clean up (flutter#3117)
  [in_app_purchase] Fix finishing purchases upon payment cancellation (flutter#3106)
  [google_maps_flutter_web] Fix convert.dart issues (flutter#3093)
  [multiple] Opt-out tests of null-safety (flutter#3113)
  [webview_flutter] add public documentation. (flutter#3114)
  in_app_purchase: started supported null as a parameter for the sandbox arguement (flutter#3110)
  [connectivity] Android Code Inspection and Clean up (flutter#3051)
  [android_intent] Android Code Inspection and Clean up (flutter#3043)
  Remove `io.flutter.embedded_views_preview` from README
  [google_maps_flutter] Fix headline in the readme (flutter#3100)
  [webview_flutter] Add new entrypoint that uses hybrid composition on Android (flutter#3067)
  [google_maps_flutter] Out of developers preview, bump to 1.0.0 (flutter#3091)
  [url_launcher_web] Move third_party under src. (flutter#3080)
  [plugin_platform_interface] Fix homepage in pubspec.yaml (flutter#3088)
  [connectivity_for_web] Fix homepage in pubspec.yaml (flutter#3089)
  [in_app_purchase] Update typo in example main.dart (flutter#3073)
  • Loading branch information
yasargil committed Oct 8, 2020
2 parents 49d258c + c8e3aa1 commit 5c53cee
Show file tree
Hide file tree
Showing 56 changed files with 656 additions and 144 deletions.
4 changes: 4 additions & 0 deletions packages/android_intent/CHANGELOG.md
@@ -1,3 +1,7 @@
## 0.3.7+5

* Android Code Inspection and Clean up.

## 0.3.7+4

* Keep handling deprecated Android v1 classes for backward compatibility.
Expand Down
5 changes: 5 additions & 0 deletions packages/android_intent/android/build.gradle
@@ -1,5 +1,6 @@
group 'io.flutter.plugins.androidintent'
version '1.0-SNAPSHOT'
def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"]

buildscript {
repositories {
Expand All @@ -19,6 +20,10 @@ rootProject.allprojects {
}
}

project.getTasks().withType(JavaCompile){
options.compilerArgs.addAll(args)
}

apply plugin: 'com.android.library'

android {
Expand Down
Expand Up @@ -15,6 +15,7 @@
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/** Forwards incoming {@link MethodCall}s to {@link IntentSender#send}. */
Expand Down Expand Up @@ -75,14 +76,19 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
String action = convertAction((String) call.argument("action"));
Integer flags = call.argument("flags");
String category = call.argument("category");
Uri data = call.argument("data") != null ? Uri.parse((String) call.argument("data")) : null;
Bundle arguments = convertArguments((Map<String, ?>) call.argument("arguments"));
String stringData = call.argument("data");
Uri data = call.argument("data") != null ? Uri.parse(stringData) : null;
Map<String, ?> stringMap = call.argument("arguments");
Bundle arguments = convertArguments(stringMap);
String packageName = call.argument("package");
ComponentName componentName =
(!TextUtils.isEmpty(packageName)
&& !TextUtils.isEmpty((String) call.argument("componentName")))
? new ComponentName(packageName, (String) call.argument("componentName"))
: null;
String component = call.argument("componentName");
ComponentName componentName = null;
if (packageName != null
&& component != null
&& !TextUtils.isEmpty(packageName)
&& !TextUtils.isEmpty(component)) {
componentName = new ComponentName(packageName, component);
}
String type = call.argument("type");

Intent intent =
Expand Down Expand Up @@ -128,6 +134,9 @@ private static Bundle convertArguments(Map<String, ?> arguments) {
}
for (String key : arguments.keySet()) {
Object value = arguments.get(key);
ArrayList<String> stringArrayList = isStringArrayList(value);
ArrayList<Integer> integerArrayList = isIntegerArrayList(value);
Map<String, ?> stringMap = isStringKeyedMap(value);
if (value instanceof Integer) {
bundle.putInt(key, (Integer) value);
} else if (value instanceof String) {
Expand All @@ -146,42 +155,67 @@ private static Bundle convertArguments(Map<String, ?> arguments) {
bundle.putLongArray(key, (long[]) value);
} else if (value instanceof double[]) {
bundle.putDoubleArray(key, (double[]) value);
} else if (isTypedArrayList(value, Integer.class)) {
bundle.putIntegerArrayList(key, (ArrayList<Integer>) value);
} else if (isTypedArrayList(value, String.class)) {
bundle.putStringArrayList(key, (ArrayList<String>) value);
} else if (isStringKeyedMap(value)) {
bundle.putBundle(key, convertArguments((Map<String, ?>) value));
} else if (integerArrayList != null) {
bundle.putIntegerArrayList(key, integerArrayList);
} else if (stringArrayList != null) {
bundle.putStringArrayList(key, stringArrayList);
} else if (stringMap != null) {
bundle.putBundle(key, convertArguments(stringMap));
} else {
throw new UnsupportedOperationException("Unsupported type " + value);
}
}
return bundle;
}

private static boolean isTypedArrayList(Object value, Class<?> type) {
private static ArrayList<Integer> isIntegerArrayList(Object value) {
ArrayList<Integer> integerArrayList = new ArrayList<>();
if (!(value instanceof ArrayList)) {
return false;
return null;
}
ArrayList list = (ArrayList) value;
for (Object o : list) {
if (!(o == null || type.isInstance(o))) {
return false;
ArrayList<?> intList = (ArrayList<?>) value;
for (Object o : intList) {
if (!(o instanceof Integer)) {
return null;
} else {
integerArrayList.add((Integer) o);
}
}
return true;
return integerArrayList;
}

private static boolean isStringKeyedMap(Object value) {
private static ArrayList<String> isStringArrayList(Object value) {
ArrayList<String> stringArrayList = new ArrayList<>();
if (!(value instanceof ArrayList)) {
return null;
}
ArrayList<?> stringList = (ArrayList<?>) value;
for (Object o : stringList) {
if (!(o instanceof String)) {
return null;
} else {
stringArrayList.add((String) o);
}
}
return stringArrayList;
}

private static Map<String, ?> isStringKeyedMap(Object value) {
Map<String, Object> stringMap = new HashMap<>();
if (!(value instanceof Map)) {
return false;
return null;
}
Map map = (Map) value;
for (Object key : map.keySet()) {
if (!(key == null || key instanceof String)) {
return false;
Map<?, ?> mapValue = (Map<?, ?>) value;
for (Object key : mapValue.keySet()) {
if (!(key instanceof String)) {
return null;
} else {
Object o = mapValue.get(key);
if (o != null) {
stringMap.put((String) key, o);
}
}
}
return true;
return stringMap;
}
}
2 changes: 1 addition & 1 deletion packages/android_intent/pubspec.yaml
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent
# 0.3.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.3.7+4
version: 0.3.7+5

flutter:
plugin:
Expand Down
5 changes: 5 additions & 0 deletions packages/connectivity/connectivity/CHANGELOG.md
@@ -1,3 +1,8 @@
## 0.4.9+4

* Update README with the updated information about WifiInfo on Android O or higher.
* Android: Avoiding uses or overrides a deprecated API

## 0.4.9+3

* Keep handling deprecated Android v1 classes for backward compatibility.
Expand Down
8 changes: 8 additions & 0 deletions packages/connectivity/connectivity/README.md
Expand Up @@ -59,6 +59,14 @@ dispose() {

Note that connectivity changes are no longer communicated to Android apps in the background starting with Android O. *You should always check for connectivity status when your app is resumed.* The broadcast is only useful when your application is in the foreground.

To successfully get WiFi Name or Wi-Fi BSSID starting with Android O, ensure all of the following conditions are met:

* If your app is targeting Android 10 (API level 29) SDK or higher, your app has the ACCESS_FINE_LOCATION permission.

* If your app is targeting SDK lower than Android 10 (API level 29), your app has the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission.

* Location services are enabled on the device (under Settings > Location).

You can get wi-fi related information using:

```dart
Expand Down
5 changes: 5 additions & 0 deletions packages/connectivity/connectivity/android/build.gradle
@@ -1,5 +1,6 @@
group 'io.flutter.plugins.connectivity'
version '1.0-SNAPSHOT'
def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"]

buildscript {
repositories {
Expand All @@ -19,6 +20,10 @@ rootProject.allprojects {
}
}

project.getTasks().withType(JavaCompile){
options.compilerArgs.addAll(args)
}

apply plugin: 'com.android.library'

android {
Expand Down
Expand Up @@ -100,4 +100,8 @@ private String getNetworkTypeLegacy() {
return "none";
}
}

public ConnectivityManager getConnectivityManager() {
return connectivityManager;
}
}
Expand Up @@ -9,6 +9,11 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.Network;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.RequiresApi;
import io.flutter.plugin.common.EventChannel;

/**
Expand All @@ -24,6 +29,8 @@ class ConnectivityBroadcastReceiver extends BroadcastReceiver
private Context context;
private Connectivity connectivity;
private EventChannel.EventSink events;
private Handler mainHandler = new Handler(Looper.getMainLooper());
public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";

ConnectivityBroadcastReceiver(Context context, Connectivity connectivity) {
this.context = context;
Expand All @@ -33,12 +40,20 @@ class ConnectivityBroadcastReceiver extends BroadcastReceiver
@Override
public void onListen(Object arguments, EventChannel.EventSink events) {
this.events = events;
context.registerReceiver(this, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
connectivity.getConnectivityManager().registerDefaultNetworkCallback(getNetworkCallback());
} else {
context.registerReceiver(this, new IntentFilter(CONNECTIVITY_ACTION));
}
}

@Override
public void onCancel(Object arguments) {
context.unregisterReceiver(this);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
connectivity.getConnectivityManager().unregisterNetworkCallback(getNetworkCallback());
} else {
context.unregisterReceiver(this);
}
}

@Override
Expand All @@ -47,4 +62,30 @@ public void onReceive(Context context, Intent intent) {
events.success(connectivity.getNetworkType());
}
}

@RequiresApi(api = Build.VERSION_CODES.N)
ConnectivityManager.NetworkCallback getNetworkCallback() {
return new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
sendEvent();
}

@Override
public void onLost(Network network) {
sendEvent();
}
};
}

private void sendEvent() {
Runnable runnable =
new Runnable() {
@Override
public void run() {
events.success(connectivity.getNetworkType());
}
};
mainHandler.post(runnable);
}
}
Expand Up @@ -41,7 +41,8 @@ private void setupChannels(BinaryMessenger messenger, Context context) {
eventChannel = new EventChannel(messenger, "plugins.flutter.io/connectivity_status");
ConnectivityManager connectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiManager wifiManager =
(WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);

Connectivity connectivity = new Connectivity(connectivityManager, wifiManager);

Expand Down
2 changes: 1 addition & 1 deletion packages/connectivity/connectivity/pubspec.yaml
Expand Up @@ -5,7 +5,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/connectivity/c
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.4.9+3
version: 0.4.9+4

flutter:
plugin:
Expand Down
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.8

import 'package:connectivity/connectivity.dart';
import 'package:connectivity_platform_interface/connectivity_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down
4 changes: 4 additions & 0 deletions packages/connectivity/connectivity_for_web/CHANGELOG.md
@@ -1,3 +1,7 @@
## 0.3.1+3

* Fix homepage in `pubspec.yaml`.

## 0.3.1+2

* Update package:e2e to use package:integration_test
Expand Down
4 changes: 2 additions & 2 deletions packages/connectivity/connectivity_for_web/pubspec.yaml
@@ -1,7 +1,7 @@
name: connectivity_for_web
description: An implementation for the web platform of the Flutter `connectivity` plugin. This uses the NetworkInformation Web API, with a fallback to Navigator.onLine.
version: 0.3.1+2
homepage: https://github.com/ditman/plugins/tree/connectivity-web/packages/connectivity/experimental_connectivity_web
version: 0.3.1+3
repository: https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_for_web

flutter:
plugin:
Expand Down
12 changes: 12 additions & 0 deletions packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
@@ -1,3 +1,15 @@
## 1.0.2

* Remove `io.flutter.embedded_views_preview` requirement from readme.

## 1.0.1

* Fix headline in the readme.

## 1.0.0 - Out of developer preview 🎉.

* Bump the minimal Flutter SDK to 1.22 where platform views are out of developer preview and performing better on iOS. Flutter 1.22 no longer requires adding the `io.flutter.embedded_views_preview` to `Info.plist` in iOS.

## 0.5.33

* Keep handling deprecated Android v1 classes for backward compatibility.
Expand Down
19 changes: 1 addition & 18 deletions packages/google_maps_flutter/google_maps_flutter/README.md
@@ -1,23 +1,9 @@
# Google Maps for Flutter (Developers Preview)
# Google Maps for Flutter

[![pub package](https://img.shields.io/pub/v/google_maps_flutter.svg)](https://pub.dartlang.org/packages/google_maps_flutter)

A Flutter plugin that provides a [Google Maps](https://developers.google.com/maps/) widget.

## Developers Preview Status
The plugin relies on Flutter's new mechanism for embedding Android and iOS views.
As that mechanism is currently in a developers preview, this plugin should also be
considered a developers preview.

Known issues are tagged with the [platform-views](https://github.com/flutter/flutter/labels/a%3A%20platform-views) and/or [maps](https://github.com/flutter/flutter/labels/p%3A%20maps) labels.

To use this plugin on iOS you need to opt-in for the embedded views preview by
adding a boolean property to the app's `Info.plist` file, with the key `io.flutter.embedded_views_preview`
and the value `YES`.

The API exposed by this plugin is not yet stable, and we expect some breaking changes to land soon.


## Usage

To use this plugin, add `google_maps_flutter` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
Expand Down Expand Up @@ -87,12 +73,9 @@ import GoogleMaps
}
}
```
Opt-in to the embedded views preview by adding a boolean property to the app's `Info.plist` file
with the key `io.flutter.embedded_views_preview` and the value `YES`.

### Both


You can now add a `GoogleMap` widget to your widget tree.

The map view can be controlled with the `GoogleMapController` that is passed to
Expand Down

0 comments on commit 5c53cee

Please sign in to comment.