From e644c9e74ebb732a909e0d2d1987fa707a32d749 Mon Sep 17 00:00:00 2001 From: Brandon Parrish Date: Mon, 16 Apr 2018 16:12:35 -0700 Subject: [PATCH] Updated plugin channel names to 'plugins.flutter.io/' (#498) --- packages/firebase_analytics/CHANGELOG.md | 4 ++++ .../FirebaseAnalyticsPlugin.java | 3 ++- .../ios/Classes/FirebaseAnalyticsPlugin.m | 2 +- .../lib/firebase_analytics.dart | 4 ++-- packages/firebase_analytics/pubspec.yaml | 2 +- packages/firebase_messaging/CHANGELOG.md | 4 ++++ .../FirebaseMessagingPlugin.java | 3 ++- .../ios/Classes/FirebaseMessagingPlugin.m | 2 +- .../lib/firebase_messaging.dart | 3 ++- packages/firebase_messaging/pubspec.yaml | 2 +- packages/firebase_storage/CHANGELOG.md | 4 ++++ .../storage/FirebaseStoragePlugin.java | 3 ++- .../ios/Classes/FirebaseStoragePlugin.m | 2 +- .../lib/firebase_storage.dart | 11 +++++----- packages/firebase_storage/pubspec.yaml | 2 +- .../test/firebase_storage_test.dart | 21 ++++++------------- 16 files changed, 40 insertions(+), 32 deletions(-) diff --git a/packages/firebase_analytics/CHANGELOG.md b/packages/firebase_analytics/CHANGELOG.md index e8c7e933d9f3..f9c5c67b8500 100644 --- a/packages/firebase_analytics/CHANGELOG.md +++ b/packages/firebase_analytics/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.2 + +* Updated package channel name + ## 0.3.1 * Simplified podspec for Cocoapods 1.5.0, avoiding link issues in app archives. diff --git a/packages/firebase_analytics/android/src/main/java/io/flutter/plugins/firebaseanalytics/FirebaseAnalyticsPlugin.java b/packages/firebase_analytics/android/src/main/java/io/flutter/plugins/firebaseanalytics/FirebaseAnalyticsPlugin.java index a6003de70a28..8255b3fc5efa 100755 --- a/packages/firebase_analytics/android/src/main/java/io/flutter/plugins/firebaseanalytics/FirebaseAnalyticsPlugin.java +++ b/packages/firebase_analytics/android/src/main/java/io/flutter/plugins/firebaseanalytics/FirebaseAnalyticsPlugin.java @@ -21,7 +21,8 @@ public class FirebaseAnalyticsPlugin implements MethodCallHandler { private final FirebaseAnalytics firebaseAnalytics; public static void registerWith(PluginRegistry.Registrar registrar) { - final MethodChannel channel = new MethodChannel(registrar.messenger(), "firebase_analytics"); + final MethodChannel channel = + new MethodChannel(registrar.messenger(), "plugins.flutter.io/firebase_analytics"); channel.setMethodCallHandler(new FirebaseAnalyticsPlugin(registrar)); } diff --git a/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.m b/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.m index 3fc831007e26..2a8750af023f 100644 --- a/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.m +++ b/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.m @@ -11,7 +11,7 @@ @implementation FLTFirebaseAnalyticsPlugin { + (void)registerWithRegistrar:(NSObject *)registrar { FlutterMethodChannel *channel = - [FlutterMethodChannel methodChannelWithName:@"firebase_analytics" + [FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/firebase_analytics" binaryMessenger:[registrar messenger]]; FLTFirebaseAnalyticsPlugin *instance = [[FLTFirebaseAnalyticsPlugin alloc] init]; [registrar addMethodCallDelegate:instance channel:channel]; diff --git a/packages/firebase_analytics/lib/firebase_analytics.dart b/packages/firebase_analytics/lib/firebase_analytics.dart index c4ef87e7c228..43e69170f878 100755 --- a/packages/firebase_analytics/lib/firebase_analytics.dart +++ b/packages/firebase_analytics/lib/firebase_analytics.dart @@ -11,8 +11,8 @@ import 'package:flutter/foundation.dart'; /// Firebase Analytics API. class FirebaseAnalytics { - static final FirebaseAnalytics _instance = - new FirebaseAnalytics.private(const MethodChannel('firebase_analytics')); + static final FirebaseAnalytics _instance = new FirebaseAnalytics.private( + const MethodChannel('plugins.flutter.io/firebase_analytics')); /// Provides an instance of this class. factory FirebaseAnalytics() => _instance; diff --git a/packages/firebase_analytics/pubspec.yaml b/packages/firebase_analytics/pubspec.yaml index cef61743359e..7403c244da4c 100755 --- a/packages/firebase_analytics/pubspec.yaml +++ b/packages/firebase_analytics/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Analytics for Firebase, an app measuremen solution that provides insight on app usage and user engagement on Android and iOS. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_analytics -version: 0.3.1 +version: 0.3.2 flutter: plugin: diff --git a/packages/firebase_messaging/CHANGELOG.md b/packages/firebase_messaging/CHANGELOG.md index 759424ba228e..3c07790e10a5 100644 --- a/packages/firebase_messaging/CHANGELOG.md +++ b/packages/firebase_messaging/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.3 + +* Updated package channel name + ## 0.2.2 * Simplified podspec for Cocoapods 1.5.0, avoiding link issues in app archives. diff --git a/packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java b/packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java index 374b2db36ba6..a9d8a76c6bcf 100644 --- a/packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java +++ b/packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java @@ -31,7 +31,8 @@ public class FirebaseMessagingPlugin extends BroadcastReceiver private static final String CLICK_ACTION_VALUE = "FLUTTER_NOTIFICATION_CLICK"; public static void registerWith(Registrar registrar) { - final MethodChannel channel = new MethodChannel(registrar.messenger(), "firebase_messaging"); + final MethodChannel channel = + new MethodChannel(registrar.messenger(), "plugins.flutter.io/firebase_messaging"); final FirebaseMessagingPlugin plugin = new FirebaseMessagingPlugin(registrar, channel); registrar.addNewIntentListener(plugin); channel.setMethodCallHandler(plugin); diff --git a/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m b/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m index 2f59002961d8..b3b6da4d62d9 100644 --- a/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m +++ b/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m @@ -19,7 +19,7 @@ @implementation FLTFirebaseMessagingPlugin { + (void)registerWithRegistrar:(NSObject *)registrar { FlutterMethodChannel *channel = - [FlutterMethodChannel methodChannelWithName:@"firebase_messaging" + [FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/firebase_messaging" binaryMessenger:[registrar messenger]]; FLTFirebaseMessagingPlugin *instance = [[FLTFirebaseMessagingPlugin alloc] initWithChannel:channel]; diff --git a/packages/firebase_messaging/lib/firebase_messaging.dart b/packages/firebase_messaging/lib/firebase_messaging.dart index d81fcb6eda53..4527c644bfed 100644 --- a/packages/firebase_messaging/lib/firebase_messaging.dart +++ b/packages/firebase_messaging/lib/firebase_messaging.dart @@ -23,7 +23,8 @@ class FirebaseMessaging { _platform = platform; static final FirebaseMessaging _instance = new FirebaseMessaging.private( - const MethodChannel('firebase_messaging'), const LocalPlatform()); + const MethodChannel('plugins.flutter.io/firebase_messaging'), + const LocalPlatform()); final MethodChannel _channel; final Platform _platform; diff --git a/packages/firebase_messaging/pubspec.yaml b/packages/firebase_messaging/pubspec.yaml index ff2457974a53..8221023c0bc2 100644 --- a/packages/firebase_messaging/pubspec.yaml +++ b/packages/firebase_messaging/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Firebase Cloud Messaging, a cross-platform messaging solution that lets you reliably deliver messages on Android and iOS. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_messaging -version: 0.2.2 +version: 0.2.3 flutter: plugin: diff --git a/packages/firebase_storage/CHANGELOG.md b/packages/firebase_storage/CHANGELOG.md index 428f3508a010..ab509f7a0701 100644 --- a/packages/firebase_storage/CHANGELOG.md +++ b/packages/firebase_storage/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.3 + +* Updated package channel name and made channel visible for testing + ## 0.2.2 * Simplified podspec for Cocoapods 1.5.0, avoiding link issues in app archives. diff --git a/packages/firebase_storage/android/src/main/java/io/flutter/plugins/firebase/storage/FirebaseStoragePlugin.java b/packages/firebase_storage/android/src/main/java/io/flutter/plugins/firebase/storage/FirebaseStoragePlugin.java index e7930a7cd640..b17eab510754 100755 --- a/packages/firebase_storage/android/src/main/java/io/flutter/plugins/firebase/storage/FirebaseStoragePlugin.java +++ b/packages/firebase_storage/android/src/main/java/io/flutter/plugins/firebase/storage/FirebaseStoragePlugin.java @@ -27,7 +27,8 @@ public class FirebaseStoragePlugin implements MethodCallHandler { private FirebaseStorage firebaseStorage; public static void registerWith(Registrar registrar) { - final MethodChannel channel = new MethodChannel(registrar.messenger(), "firebase_storage"); + final MethodChannel channel = + new MethodChannel(registrar.messenger(), "plugins.flutter.io/firebase_storage"); channel.setMethodCallHandler(new FirebaseStoragePlugin(registrar)); } diff --git a/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m b/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m index 14ae8de62578..b5ac71e064a9 100644 --- a/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m +++ b/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m @@ -23,7 +23,7 @@ @implementation FLTFirebaseStoragePlugin { + (void)registerWithRegistrar:(NSObject *)registrar { FlutterMethodChannel *channel = - [FlutterMethodChannel methodChannelWithName:@"firebase_storage" + [FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/firebase_storage" binaryMessenger:[registrar messenger]]; FLTFirebaseStoragePlugin *instance = [[FLTFirebaseStoragePlugin alloc] init]; [registrar addMethodCallDelegate:instance channel:channel]; diff --git a/packages/firebase_storage/lib/firebase_storage.dart b/packages/firebase_storage/lib/firebase_storage.dart index 7cef465e4135..0ef711b7bf63 100755 --- a/packages/firebase_storage/lib/firebase_storage.dart +++ b/packages/firebase_storage/lib/firebase_storage.dart @@ -9,7 +9,8 @@ import 'dart:typed_data'; import 'package:flutter/services.dart'; class FirebaseStorage { - static const MethodChannel _channel = const MethodChannel('firebase_storage'); + static const MethodChannel channel = + const MethodChannel('plugins.flutter.io/firebase_storage'); static FirebaseStorage get instance => new FirebaseStorage(); @@ -39,7 +40,7 @@ class StorageReference { /// Asynchronously downloads the object at the StorageReference to a list in memory. /// A list of the provided max size will be allocated. Future getData(int maxSize) async { - return await FirebaseStorage._channel.invokeMethod( + return await FirebaseStorage.channel.invokeMethod( "StorageReference#getData", { 'maxSize': maxSize, @@ -49,14 +50,14 @@ class StorageReference { } Future getDownloadURL() async { - return await FirebaseStorage._channel + return await FirebaseStorage.channel .invokeMethod("StorageReference#getDownloadUrl", { 'path': _pathComponents.join("/"), }); } Future delete() { - return FirebaseStorage._channel.invokeMethod("StorageReference#delete", + return FirebaseStorage.channel.invokeMethod("StorageReference#delete", {'path': _pathComponents.join("/")}); } @@ -73,7 +74,7 @@ class StorageUploadTask { Future get future => _completer.future; Future _start() async { - final String downloadUrl = await FirebaseStorage._channel.invokeMethod( + final String downloadUrl = await FirebaseStorage.channel.invokeMethod( "StorageReference#putFile", { 'filename': file.absolute.path, diff --git a/packages/firebase_storage/pubspec.yaml b/packages/firebase_storage/pubspec.yaml index 9e7a9f6e7426..0f1cb5a84bfa 100755 --- a/packages/firebase_storage/pubspec.yaml +++ b/packages/firebase_storage/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Firebase Cloud Storage, a powerful, simple, and cost-effective object storage service for Android and iOS. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_storage -version: 0.2.2 +version: 0.2.3 flutter: plugin: diff --git a/packages/firebase_storage/test/firebase_storage_test.dart b/packages/firebase_storage/test/firebase_storage_test.dart index 56ab6a114811..3871b298afde 100644 --- a/packages/firebase_storage/test/firebase_storage_test.dart +++ b/packages/firebase_storage/test/firebase_storage_test.dart @@ -12,16 +12,13 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('StorageReference', () { group('getData', () { - const MethodChannel channel = const MethodChannel( - 'firebase_storage', - ); - final List log = []; StorageReference ref; setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) { + FirebaseStorage.channel + .setMockMethodCallHandler((MethodCall methodCall) { log.add(methodCall); return new Future.value( new Uint8List.fromList([1, 2, 3, 4])); @@ -54,16 +51,13 @@ void main() { }); group('getDownloadUrl', () { - const MethodChannel channel = const MethodChannel( - 'firebase_storage', - ); - final List log = []; StorageReference ref; setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { + FirebaseStorage.channel + .setMockMethodCallHandler((MethodCall methodCall) async { log.add(methodCall); return 'https://path/to/file'; }); @@ -93,16 +87,13 @@ void main() { }); group('delete', () { - const MethodChannel channel = const MethodChannel( - 'firebase_storage', - ); - final List log = []; StorageReference ref; setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { + FirebaseStorage.channel + .setMockMethodCallHandler((MethodCall methodCall) async { log.add(methodCall); return null; });