Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fluttercommunity/plus_plugins
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: package_info_plus-v7.0.0
Choose a base ref
...
head repository: fluttercommunity/plus_plugins
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: package_info_plus-v8.0.0
Choose a head ref
  • 6 commits
  • 41 files changed
  • 2 contributors

Commits on Apr 15, 2024

  1. Verified

    This commit was signed with the committer’s verified signature.
    renovate-bot Mend Renovate
    Copy the full SHA
    7d712ef View commit details
  2. feat(package_info_plus)!: Switch to SHA-256 for buildSignature on A…

    …ndroid (#2835)
    miquelbeltran authored Apr 15, 2024
    Copy the full SHA
    7259af2 View commit details
  3. refactor(share_plus)!: Share API cleanup (#2832)

    Co-authored-by: Volodymyr Buberenko <vbuberen@users.noreply.github.com>
    miquelbeltran and vbuberen authored Apr 15, 2024
    Copy the full SHA
    fd0511c View commit details

Commits on Apr 22, 2024

  1. docs(package_info_plus): Add platform specific documentation (#2845)

    miquelbeltran authored Apr 22, 2024
    Copy the full SHA
    ad06a23 View commit details
  2. fix(connectivity_plus): Ensure Connectivity on Android is correctly r…

    …eported when lost (#2836)
    miquelbeltran authored Apr 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2aa6ad7 View commit details
  3. chore(release): prepare for release (#2850)

    vbuberen authored Apr 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0404dd1 View commit details
Showing with 422 additions and 715 deletions.
  1. +4 −0 packages/connectivity_plus/connectivity_plus/CHANGELOG.md
  2. +3 −1 packages/connectivity_plus/connectivity_plus/README.md
  3. +42 −30 .../connectivity_plus/android/src/main/java/dev/fluttercommunity/plus/connectivity/Connectivity.java
  4. +28 −9 ...s/android/src/main/java/dev/fluttercommunity/plus/connectivity/ConnectivityBroadcastReceiver.java
  5. +2 −0 packages/connectivity_plus/connectivity_plus/example/lib/main.dart
  6. +1 −1 packages/connectivity_plus/connectivity_plus/example/pubspec.yaml
  7. +4 −5 packages/connectivity_plus/connectivity_plus/lib/connectivity_plus.dart
  8. +2 −1 packages/connectivity_plus/connectivity_plus/pubspec.yaml
  9. +8 −0 packages/package_info_plus/package_info_plus/CHANGELOG.md
  10. +20 −0 packages/package_info_plus/package_info_plus/README.md
  11. +5 −5 ...kage_info_plus/android/src/main/kotlin/dev/fluttercommunity/plus/packageinfo/PackageInfoPlugin.kt
  12. +1 −1 packages/package_info_plus/package_info_plus/example/pubspec.yaml
  13. +40 −5 packages/package_info_plus/package_info_plus/lib/package_info_plus.dart
  14. +1 −1 packages/package_info_plus/package_info_plus/pubspec.yaml
  15. +6 −0 packages/share_plus/share_plus/CHANGELOG.md
  16. +38 −13 packages/share_plus/share_plus/README.md
  17. +13 −16 ...hare_plus/share_plus/android/src/main/kotlin/dev/fluttercommunity/plus/share/MethodCallHandler.kt
  18. +10 −8 ...re_plus/share_plus/android/src/main/kotlin/dev/fluttercommunity/plus/share/ShareSuccessManager.kt
  19. +6 −8 packages/share_plus/share_plus/example/integration_test/share_plus_test.dart
  20. +1 −1 packages/share_plus/share_plus/example/ios/Flutter/AppFrameworkInfo.plist
  21. +1 −2 packages/share_plus/share_plus/example/ios/Runner.xcodeproj/project.pbxproj
  22. +1 −1 packages/share_plus/share_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  23. +6 −4 packages/share_plus/share_plus/example/ios/Runner/Info.plist
  24. +18 −47 packages/share_plus/share_plus/example/lib/main.dart
  25. +1 −1 packages/share_plus/share_plus/example/macos/Runner.xcodeproj/project.pbxproj
  26. +1 −1 packages/share_plus/share_plus/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  27. +1 −1 packages/share_plus/share_plus/example/pubspec.yaml
  28. +22 −42 packages/share_plus/share_plus/ios/Classes/FPPSharePlusPlugin.m
  29. +15 −99 packages/share_plus/share_plus/lib/share_plus.dart
  30. +13 −12 packages/share_plus/share_plus/lib/src/share_plus_linux.dart
  31. +16 −68 packages/share_plus/share_plus/lib/src/share_plus_web.dart
  32. +13 −14 packages/share_plus/share_plus/lib/src/share_plus_windows.dart
  33. +3 −18 packages/share_plus/share_plus/macos/Classes/SharePlusMacosPlugin.swift
  34. +2 −2 packages/share_plus/share_plus/pubspec.yaml
  35. +4 −18 packages/share_plus/share_plus/windows/share_plus_plugin.cpp
  36. +0 −2 packages/share_plus/share_plus/windows/share_plus_windows_plugin.h
  37. +6 −0 packages/share_plus/share_plus_platform_interface/CHANGELOG.md
  38. +26 −92 packages/share_plus/share_plus_platform_interface/lib/method_channel/method_channel_share.dart
  39. +25 −63 packages/share_plus/share_plus_platform_interface/lib/platform_interface/share_plus_platform.dart
  40. +1 −1 packages/share_plus/share_plus_platform_interface/pubspec.yaml
  41. +12 −122 packages/share_plus/share_plus_platform_interface/test/share_plus_platform_interface_test.dart
4 changes: 4 additions & 0 deletions packages/connectivity_plus/connectivity_plus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.0.3

- **FIX**(connectivity_plus): Ensure Connectivity on Android is correctly reported when lost ([#2836](https://github.com/fluttercommunity/plus_plugins/issues/2836)). ([2aa6ad7a](https://github.com/fluttercommunity/plus_plugins/commit/2aa6ad7a1c05d35b894e6cef515bd9dfa49351dd))

## 6.0.2

- **REFACTOR**(connectivity_plus): remove ReachabilityConnectivityProvider and ReachabilitySwift dependency ([#2813](https://github.com/fluttercommunity/plus_plugins/issues/2813)). ([f9ad927f](https://github.com/fluttercommunity/plus_plugins/commit/f9ad927f5c18f8ed8d4c22a24476430239c13492))
4 changes: 3 additions & 1 deletion packages/connectivity_plus/connectivity_plus/README.md
Original file line number Diff line number Diff line change
@@ -58,7 +58,9 @@ if (connectivityResult.contains(ConnectivityResult.mobile)) {
```

You can also listen for active connectivity types changes by subscribing to the stream
exposed by the plugin:
exposed by the plugin.

This method should ensure emitting only distinct values.

```dart
import 'package:connectivity_plus/connectivity_plus.dart';
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@
import android.net.Network;
import android.net.NetworkCapabilities;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import java.util.ArrayList;
import java.util.List;

@@ -27,44 +29,54 @@ public Connectivity(ConnectivityManager connectivityManager) {
}

List<String> getNetworkTypes() {
List<String> types = new ArrayList<>();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Network network = connectivityManager.getActiveNetwork();
NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(network);
if (capabilities == null
|| !capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
types.add(CONNECTIVITY_NONE);
return types;
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
|| capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI_AWARE)) {
types.add(CONNECTIVITY_WIFI);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) {
types.add(CONNECTIVITY_ETHERNET);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) {
types.add(CONNECTIVITY_VPN);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
types.add(CONNECTIVITY_MOBILE);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_BLUETOOTH)) {
types.add(CONNECTIVITY_BLUETOOTH);
}
if (types.isEmpty()
&& capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
types.add(CONNECTIVITY_OTHER);
}
if (types.isEmpty()) {
types.add(CONNECTIVITY_NONE);
}
return getCapabilitiesFromNetwork(network);
} else {
// For legacy versions, return a single type as before or adapt similarly if multiple types
// need to be supported
return getNetworkTypesLegacy();
}
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
List<String> getCapabilitiesFromNetwork(Network network) {
NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(network);
return getCapabilitiesList(capabilities);
}

@NonNull
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
List<String> getCapabilitiesList(NetworkCapabilities capabilities) {
List<String> types = new ArrayList<>();
if (capabilities == null
|| !capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
types.add(CONNECTIVITY_NONE);
return types;
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
|| capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI_AWARE)) {
types.add(CONNECTIVITY_WIFI);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) {
types.add(CONNECTIVITY_ETHERNET);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN)) {
types.add(CONNECTIVITY_VPN);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
types.add(CONNECTIVITY_MOBILE);
}
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_BLUETOOTH)) {
types.add(CONNECTIVITY_BLUETOOTH);
}
if (types.isEmpty()
&& capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
types.add(CONNECTIVITY_OTHER);
}
if (types.isEmpty()) {
types.add(CONNECTIVITY_NONE);
}
return types;
}

Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
import android.os.Handler;
import android.os.Looper;
import io.flutter.plugin.common.EventChannel;
import java.util.List;

/**
* The ConnectivityBroadcastReceiver receives the connectivity updates and send them to the UIThread
@@ -46,18 +47,31 @@ public void onListen(Object arguments, EventChannel.EventSink events) {
new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
sendEvent();
// onAvailable is called when the phone switches to a new network
// e.g. the phone was offline and gets wifi connection
// or the phone was on wifi and now switches to mobile.
// The plugin sends the current capability connection to the users.
sendEvent(connectivity.getCapabilitiesFromNetwork(network));
}

@Override
public void onCapabilitiesChanged(
Network network, NetworkCapabilities networkCapabilities) {
sendEvent();
// This callback is called multiple times after a call to onAvailable
// this also causes multiple callbacks to the Flutter layer.
sendEvent(connectivity.getCapabilitiesList(networkCapabilities));
}

@Override
public void onLost(Network network) {
sendEvent();
// This callback is called when a capability is lost.
//
// The provided Network object contains information about the
// network capability that has been lost, so we cannot use it.
//
// Instead, post the current network but with a delay long enough
// that we avoid a race condition.
sendCurrentStatusWithDelay();
}
};
connectivity.getConnectivityManager().registerDefaultNetworkCallback(networkCallback);
@@ -66,7 +80,7 @@ public void onLost(Network network) {
}
// Need to emit first event with connectivity types without waiting for first change in system
// that might happen much later
sendEvent();
sendEvent(connectivity.getNetworkTypes());
}

@Override
@@ -92,11 +106,16 @@ public void onReceive(Context context, Intent intent) {
}
}

private void sendEvent() {
private void sendEvent(List<String> networkTypes) {
Runnable runnable = () -> events.success(networkTypes);
// Emit events on main thread
mainHandler.post(runnable);
}

private void sendCurrentStatusWithDelay() {
Runnable runnable = () -> events.success(connectivity.getNetworkTypes());
// The dalay is needed because callback methods suffer from race conditions.
// More info:
// https://developer.android.com/develop/connectivity/network-ops/reading-network-state#listening-events
mainHandler.postDelayed(runnable, 100);
// Emit events on main thread
// 500 milliseconds to avoid race conditions
mainHandler.postDelayed(runnable, 500);
}
}
Original file line number Diff line number Diff line change
@@ -86,6 +86,8 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() {
_connectionStatus = result;
});
// ignore: avoid_print
print('Connectivity changed: $_connectionStatus');
}

@override
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ environment:
dependencies:
flutter:
sdk: flutter
connectivity_plus: ^6.0.2
connectivity_plus: ^6.0.3

dev_dependencies:
flutter_driver:
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import 'dart:async';

import 'package:connectivity_plus_platform_interface/connectivity_plus_platform_interface.dart';
import 'package:collection/collection.dart';

// Export enums from the platform_interface so plugin users can use them directly.
export 'package:connectivity_plus_platform_interface/connectivity_plus_platform_interface.dart'
@@ -40,16 +41,14 @@ class Connectivity {
/// status changes, this is a known issue that only affects simulators.
/// For details see https://github.com/fluttercommunity/plus_plugins/issues/479.
///
/// On Android, the Stream may emit new values even when
/// the [ConnectivityResult] list remains the same.
///
/// The emitted list is never empty. In case of no connectivity, the list contains
/// a single element of [ConnectivityResult.none]. Note also that this is the only
/// case where [ConnectivityResult.none] is present.
///
/// This method doesn't filter events, nor it ensures distinct values.
/// This method applies [Stream.distinct] over the received events to ensure
/// only emiting when connectivity changes.
Stream<List<ConnectivityResult>> get onConnectivityChanged {
return _platform.onConnectivityChanged;
return _platform.onConnectivityChanged.distinct((a, b) => a.equals(b));
}

/// Checks the connection status of the device.
3 changes: 2 additions & 1 deletion packages/connectivity_plus/connectivity_plus/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: connectivity_plus
description: Flutter plugin for discovering the state of the network (WiFi & mobile/cellular) connectivity on Android and iOS.
version: 6.0.2
version: 6.0.3
homepage: https://plus.fluttercommunity.dev/
repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus/connectivity_plus
issue_tracker: https://github.com/fluttercommunity/plus_plugins/labels/connectivity_plus
@@ -41,6 +41,7 @@ dependencies:
web: '>=0.3.0 <=0.6.0'
meta: ^1.8.0
nm: ^0.5.0
collection: ^1.18.0

dev_dependencies:
flutter_test:
8 changes: 8 additions & 0 deletions packages/package_info_plus/package_info_plus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 8.0.0

> Note: This release has breaking changes.
- **DOCS**(package_info_plus): Add platform specific documentation ([#2845](https://github.com/fluttercommunity/plus_plugins/issues/2845)). ([ad06a236](https://github.com/fluttercommunity/plus_plugins/commit/ad06a236d7647e958f4b25cd9ee8fe68f4c4faf3))
- **DOCS**(package_info_plus): Improve web documentation re. CORS ([#2841](https://github.com/fluttercommunity/plus_plugins/issues/2841)). ([7d712ef8](https://github.com/fluttercommunity/plus_plugins/commit/7d712ef816808d533b2fd0b4f8c9f11ebb23ab53))
- **BREAKING** **FEAT**(package_info_plus): Switch to SHA-256 for `buildSignature` on Android ([#2835](https://github.com/fluttercommunity/plus_plugins/issues/2835)). ([7259af20](https://github.com/fluttercommunity/plus_plugins/commit/7259af200810bd717d95688fbcdca67a028f9cd0))

## 7.0.0

> Note: This release has breaking changes.
20 changes: 20 additions & 0 deletions packages/package_info_plus/package_info_plus/README.md
Original file line number Diff line number Diff line change
@@ -71,6 +71,26 @@ See https://github.com/fluttercommunity/plus_plugins/issues/309
There was an [issue](https://github.com/flutter/flutter/issues/73652) in Flutter, which is already resolved since Flutter 3.3.
If your project was created before Flutter 3.3 you need to migrate the project according to [this guide] (https://docs.flutter.dev/release/breaking-changes/windows-version-information) first to get correct version with `package_info_plus`

### Web

In a web environment, the package uses the `version.json` file that it is generated in the build process.

#### Accessing the `version.json`

The package tries to locate the `version.json` using three methods:

1. Using the provided `baseUrl` in the `fromPlatform()` method.
2. Checking the configured `assets` folder in the Flutter web configuration.
3. Checking the path where the application is installed.

See the documentation at the method `fromPlatform()` to learn more.

#### CORS `version.json` access

It could be possible that the plugin cannot access the `version.json` file because the server is preventing it.
This can be due a CORS issue, and it is known to happen when hosting the Flutter code on Firebase Hosting.
Ensure that your CORS Firebase configuration allows it.

## Learn more

- [API Documentation](https://pub.dev/documentation/package_info_plus/latest/package_info_plus/package_info_plus-library.html)
Original file line number Diff line number Diff line change
@@ -94,9 +94,9 @@ class PackageInfoPlugin : MethodCallHandler, FlutterPlugin {
val signingInfo = packageInfo.signingInfo ?: return null

if (signingInfo.hasMultipleSigners()) {
signatureToSha1(signingInfo.apkContentsSigners.first().toByteArray())
signatureToSha256(signingInfo.apkContentsSigners.first().toByteArray())
} else {
signatureToSha1(signingInfo.signingCertificateHistory.first().toByteArray())
signatureToSha256(signingInfo.signingCertificateHistory.first().toByteArray())
}
} else {
val packageInfo = pm.getPackageInfo(
@@ -108,7 +108,7 @@ class PackageInfoPlugin : MethodCallHandler, FlutterPlugin {
if (signatures.isNullOrEmpty() || packageInfo.signatures.first() == null) {
null
} else {
signatureToSha1(signatures.first().toByteArray())
signatureToSha256(signatures.first().toByteArray())
}
}
} catch (e: PackageManager.NameNotFoundException) {
@@ -120,8 +120,8 @@ class PackageInfoPlugin : MethodCallHandler, FlutterPlugin {

// Credits https://gist.github.com/scottyab/b849701972d57cf9562e
@Throws(NoSuchAlgorithmException::class)
private fun signatureToSha1(sig: ByteArray): String {
val digest = MessageDigest.getInstance("SHA1")
private fun signatureToSha256(sig: ByteArray): String {
val digest = MessageDigest.getInstance("SHA-256")
digest.update(sig)
val hashText = digest.digest()
return bytesToHex(hashText)
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ dependencies:
flutter:
sdk: flutter
http: ">=0.13.5 <2.0.0"
package_info_plus: ^7.0.0
package_info_plus: ^8.0.0

dev_dependencies:
build_runner: ^2.3.3
Original file line number Diff line number Diff line change
@@ -92,21 +92,56 @@ class PackageInfo {
return _fromPlatform!;
}

/// The app name. `CFBundleDisplayName` on iOS, `application/label` on Android.
/// The app name.
///
/// - `CFBundleDisplayName` on iOS and macOS, falls back to `CFBundleName`.
/// Defined in the `info.plist` and/or product target in xcode.
/// - `application/label` on Android.
/// Defined in `AndroidManifest.xml` or String resources.
/// - `app_name` from `version.json` on Web.
/// Defined in the `manifest.json`.
/// - `app_name` from `version.json` on Linux.
/// Defined in the `CMakeLists.txt` file.
/// - `ProductName` from the compiled executable file on Windows.
/// Defined in the `Runner.rc` file.
final String appName;

/// The package name. `bundleIdentifier` on iOS, `getPackageName` on Android.
/// The package name.
///
/// - `bundleIdentifier` on iOS and macOS.
/// Defined in the product target in xcode.
/// - `packageName` on Android.
/// Defined in `build.gradle` as `applicationId`.
/// - `package_name` from `version.json` on Web and Linux
/// Generated by Flutter.
/// - `InternalName` from the compiled executable file on Windows.
/// Defined in the `Runner.rc` file.
final String packageName;

/// The package version. `CFBundleShortVersionString` on iOS, `versionName` on Android.
/// The package version.
/// Generated from the version in `pubspec.yaml`.
///
/// - `CFBundleShortVersionString` on iOS and macOS.
/// - `versionName` on Android.
/// - `version` from `version.json` on Web and Linux.
/// - `ProductVersion` from the compiled executable file on Windows.
final String version;

/// The build number. `CFBundleVersion` on iOS, `versionCode` on Android.
/// The build number.
/// Generated from the version in `pubspec.yaml`.
///
/// - `CFBundleVersion` on iOS and macOs.
/// - `versionCode` on Android.
/// - `build_number` from `version.json` on Web and Linux.
/// - `ProductVersion` from the compiled executable file on Windows.
///
/// Note, on iOS if an app has no buildNumber specified this property will return version
/// Docs about CFBundleVersion: https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
final String buildNumber;

/// The build signature. Empty string on iOS, signing key signature (hex) on Android.
/// The build signature.
/// SHA-256 signing key signature (hex) on Android.
/// Empty string on all the other platforms.
final String buildSignature;

/// The installer store. Indicates through which store this application was installed.
2 changes: 1 addition & 1 deletion packages/package_info_plus/package_info_plus/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: package_info_plus
description: Flutter plugin for querying information about the application package, such as CFBundleVersion on iOS or versionCode on Android.
version: 7.0.0
version: 8.0.0
homepage: https://plus.fluttercommunity.dev/
repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/package_info_plus/package_info_plus
issue_tracker: https://github.com/fluttercommunity/plus_plugins/labels/package_info_plus
Loading