Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Updated plugin channel names to 'plugins.flutter.io/<plugin>' (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
bparrishMines authored Apr 16, 2018
1 parent dfbe860 commit e644c9e
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 32 deletions.
4 changes: 4 additions & 0 deletions packages/firebase_analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ @implementation FLTFirebaseAnalyticsPlugin {

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)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];
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_analytics/lib/firebase_analytics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_analytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_analytics
version: 0.3.1
version: 0.3.2

flutter:
plugin:
Expand Down
4 changes: 4 additions & 0 deletions packages/firebase_messaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ @implementation FLTFirebaseMessagingPlugin {

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FlutterMethodChannel *channel =
[FlutterMethodChannel methodChannelWithName:@"firebase_messaging"
[FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/firebase_messaging"
binaryMessenger:[registrar messenger]];
FLTFirebaseMessagingPlugin *instance =
[[FLTFirebaseMessagingPlugin alloc] initWithChannel:channel];
Expand Down
3 changes: 2 additions & 1 deletion packages/firebase_messaging/lib/firebase_messaging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_messaging/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_messaging
version: 0.2.2
version: 0.2.3

flutter:
plugin:
Expand Down
4 changes: 4 additions & 0 deletions packages/firebase_storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ @implementation FLTFirebaseStoragePlugin {

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)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];
Expand Down
11 changes: 6 additions & 5 deletions packages/firebase_storage/lib/firebase_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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<Uint8List> getData(int maxSize) async {
return await FirebaseStorage._channel.invokeMethod(
return await FirebaseStorage.channel.invokeMethod(
"StorageReference#getData",
<String, dynamic>{
'maxSize': maxSize,
Expand All @@ -49,14 +50,14 @@ class StorageReference {
}

Future<dynamic> getDownloadURL() async {
return await FirebaseStorage._channel
return await FirebaseStorage.channel
.invokeMethod("StorageReference#getDownloadUrl", <String, String>{
'path': _pathComponents.join("/"),
});
}

Future<void> delete() {
return FirebaseStorage._channel.invokeMethod("StorageReference#delete",
return FirebaseStorage.channel.invokeMethod("StorageReference#delete",
<String, String>{'path': _pathComponents.join("/")});
}

Expand All @@ -73,7 +74,7 @@ class StorageUploadTask {
Future<UploadTaskSnapshot> get future => _completer.future;

Future<void> _start() async {
final String downloadUrl = await FirebaseStorage._channel.invokeMethod(
final String downloadUrl = await FirebaseStorage.channel.invokeMethod(
"StorageReference#putFile",
<String, String>{
'filename': file.absolute.path,
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_storage/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_storage
version: 0.2.2
version: 0.2.3

flutter:
plugin:
Expand Down
21 changes: 6 additions & 15 deletions packages/firebase_storage/test/firebase_storage_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<MethodCall> log = <MethodCall>[];

StorageReference ref;

setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) {
FirebaseStorage.channel
.setMockMethodCallHandler((MethodCall methodCall) {
log.add(methodCall);
return new Future<Uint8List>.value(
new Uint8List.fromList(<int>[1, 2, 3, 4]));
Expand Down Expand Up @@ -54,16 +51,13 @@ void main() {
});

group('getDownloadUrl', () {
const MethodChannel channel = const MethodChannel(
'firebase_storage',
);

final List<MethodCall> log = <MethodCall>[];

StorageReference ref;

setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
FirebaseStorage.channel
.setMockMethodCallHandler((MethodCall methodCall) async {
log.add(methodCall);
return 'https://path/to/file';
});
Expand Down Expand Up @@ -93,16 +87,13 @@ void main() {
});

group('delete', () {
const MethodChannel channel = const MethodChannel(
'firebase_storage',
);

final List<MethodCall> log = <MethodCall>[];

StorageReference ref;

setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
FirebaseStorage.channel
.setMockMethodCallHandler((MethodCall methodCall) async {
log.add(methodCall);
return null;
});
Expand Down

0 comments on commit e644c9e

Please sign in to comment.