diff --git a/dev/integration_tests/channels/android/app/src/main/java/com/yourcompany/channels/MainActivity.java b/dev/integration_tests/channels/android/app/src/main/java/com/yourcompany/channels/MainActivity.java index ebd9f18c8c..83fae61f45 100644 --- a/dev/integration_tests/channels/android/app/src/main/java/com/yourcompany/channels/MainActivity.java +++ b/dev/integration_tests/channels/android/app/src/main/java/com/yourcompany/channels/MainActivity.java @@ -10,133 +10,128 @@ import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugin.common.*; -import io.flutter.plugins.PluginRegistry; +import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { - PluginRegistry pluginRegistry; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "binary-msg", BinaryCodec.INSTANCE)); + setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "string-msg", StringCodec.INSTANCE)); + setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "json-msg", JSONMessageCodec.INSTANCE)); + setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "std-msg", StandardMessageCodec.INSTANCE)); + setupMethodHandshake(new MethodChannel(getFlutterView(), "json-method", JSONMethodCodec.INSTANCE)); + setupMethodHandshake(new MethodChannel(getFlutterView(), "std-method", StandardMethodCodec.INSTANCE)); + } - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - pluginRegistry = new PluginRegistry(); - pluginRegistry.registerAll(this); - - setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "binary-msg", BinaryCodec.INSTANCE)); - setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "string-msg", StringCodec.INSTANCE)); - setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "json-msg", JSONMessageCodec.INSTANCE)); - setupMessageHandshake(new BasicMessageChannel<>(getFlutterView(), "std-msg", StandardMessageCodec.INSTANCE)); - setupMethodHandshake(new MethodChannel(getFlutterView(), "json-method", JSONMethodCodec.INSTANCE)); - setupMethodHandshake(new MethodChannel(getFlutterView(), "std-method", StandardMethodCodec.INSTANCE)); - } - - private void setupMessageHandshake(final BasicMessageChannel channel) { - // On message receipt, do a send/reply/send round-trip in the other direction, - // then reply to the first message. - channel.setMessageHandler(new BasicMessageChannel.MessageHandler() { - @Override - public void onMessage(final T message, final BasicMessageChannel.Reply reply) { - final T messageEcho = echo(message); - channel.send(messageEcho, new BasicMessageChannel.Reply() { - @Override - public void reply(T replyMessage) { - channel.send(echo(replyMessage)); - reply.reply(messageEcho); - } - }); - } + private void setupMessageHandshake(final BasicMessageChannel channel) { + // On message receipt, do a send/reply/send round-trip in the other direction, + // then reply to the first message. + channel.setMessageHandler(new BasicMessageChannel.MessageHandler() { + @Override + public void onMessage(final T message, final BasicMessageChannel.Reply reply) { + final T messageEcho = echo(message); + channel.send(messageEcho, new BasicMessageChannel.Reply() { + @Override + public void reply(T replyMessage) { + channel.send(echo(replyMessage)); + reply.reply(messageEcho); + } }); - } + } + }); + } - // Outgoing ByteBuffer messages must be direct-allocated and payload placed between - // positon 0 and current position. - @SuppressWarnings("unchecked") - private T echo(T message) { - if (message instanceof ByteBuffer) { - final ByteBuffer buffer = (ByteBuffer) message; - final ByteBuffer echo = ByteBuffer.allocateDirect(buffer.remaining()); - echo.put(buffer); - return (T) echo; + // Outgoing ByteBuffer messages must be direct-allocated and payload placed between + // positon 0 and current position. + @SuppressWarnings("unchecked") + private T echo(T message) { + if (message instanceof ByteBuffer) { + final ByteBuffer buffer = (ByteBuffer) message; + final ByteBuffer echo = ByteBuffer.allocateDirect(buffer.remaining()); + echo.put(buffer); + return (T) echo; + } + return message; + } + + private void setupMethodHandshake(final MethodChannel channel) { + channel.setMethodCallHandler(new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(final MethodCall methodCall, final MethodChannel.Result result) { + switch (methodCall.method) { + case "success": + doSuccessHandshake(channel, methodCall, result); + break; + case "error": + doErrorHandshake(channel, methodCall, result); + break; + default: + doNotImplementedHandshake(channel, methodCall, result); + break; } - return message; - } + } + }); + } - private void setupMethodHandshake(final MethodChannel channel) { - channel.setMethodCallHandler(new MethodChannel.MethodCallHandler() { - @Override - public void onMethodCall(final MethodCall methodCall, final MethodChannel.Result result) { - switch (methodCall.method) { - case "success": - doSuccessHandshake(channel, methodCall, result); - break; - case "error": - doErrorHandshake(channel, methodCall, result); - break; - default: - doNotImplementedHandshake(channel, methodCall, result); - break; + private void doSuccessHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) { + channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() { + @Override + public void success(Object o) { + channel.invokeMethod(methodCall.method, o); + result.success(methodCall.arguments); + } - } - } - }); - } + @Override + public void error(String code, String message, Object details) { + throw new AssertionError("Should not be called"); + } - private void doSuccessHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) { - channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() { - @Override - public void success(Object o) { - channel.invokeMethod(methodCall.method, o); - result.success(methodCall.arguments); - } + @Override + public void notImplemented() { + throw new AssertionError("Should not be called"); + } + }); + } - @Override - public void error(String code, String message, Object details) { - throw new AssertionError("Should not be called"); - } + private void doErrorHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) { + channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() { + @Override + public void success(Object o) { + throw new AssertionError("Should not be called"); + } - @Override - public void notImplemented() { - throw new AssertionError("Should not be called"); - } - }); - } + @Override + public void error(String code, String message, Object details) { + channel.invokeMethod(methodCall.method, details); + result.error(code, message, methodCall.arguments); + } - private void doErrorHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) { - channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() { - @Override - public void success(Object o) { - throw new AssertionError("Should not be called"); - } + @Override + public void notImplemented() { + throw new AssertionError("Should not be called"); + } + }); + } - @Override - public void error(String code, String message, Object details) { - channel.invokeMethod(methodCall.method, details); - result.error(code, message, methodCall.arguments); - } + private void doNotImplementedHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) { + channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() { + @Override + public void success(Object o) { + throw new AssertionError("Should not be called"); + } - @Override - public void notImplemented() { - throw new AssertionError("Should not be called"); - } - }); - } + @Override + public void error(String code, String message, Object details) { + throw new AssertionError("Should not be called"); + } - private void doNotImplementedHandshake(final MethodChannel channel, final MethodCall methodCall, final MethodChannel.Result result) { - channel.invokeMethod(methodCall.method, methodCall.arguments, new MethodChannel.Result() { - @Override - public void success(Object o) { - throw new AssertionError("Should not be called"); - } - - @Override - public void error(String code, String message, Object details) { - throw new AssertionError("Should not be called"); - } - - @Override - public void notImplemented() { - channel.invokeMethod(methodCall.method, null); - result.notImplemented(); - } - }); - } + @Override + public void notImplemented() { + channel.invokeMethod(methodCall.method, null); + result.notImplemented(); + } + }); + } } diff --git a/dev/integration_tests/channels/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/dev/integration_tests/channels/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000000..e07931dc42 --- /dev/null +++ b/dev/integration_tests/channels/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,11 @@ +package io.flutter.plugins; + +import io.flutter.plugin.common.PluginRegistry; + +/** + * Generated file. Do not edit. + */ +public final class GeneratedPluginRegistrant { + public static void registerWith(PluginRegistry registry) { + } +} diff --git a/dev/integration_tests/channels/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java b/dev/integration_tests/channels/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java deleted file mode 100644 index 92f7a749c4..0000000000 --- a/dev/integration_tests/channels/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.flutter.plugins; - -import io.flutter.app.FlutterActivity; - - -/** - * Generated file. Do not edit. - */ - -public class PluginRegistry { - - public void registerAll(FlutterActivity activity) { - } -} diff --git a/dev/integration_tests/channels/ios/Runner.xcodeproj/project.pbxproj b/dev/integration_tests/channels/ios/Runner.xcodeproj/project.pbxproj index 52e0090b82..90c96d998a 100644 --- a/dev/integration_tests/channels/ios/Runner.xcodeproj/project.pbxproj +++ b/dev/integration_tests/channels/ios/Runner.xcodeproj/project.pbxproj @@ -7,10 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* PluginRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* PluginRegistry.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 74970F741EDC3266000507F3 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 74970F731EDC3266000507F3 /* GeneratedPluginRegistrant.m */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; @@ -39,10 +39,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* PluginRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PluginRegistry.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* PluginRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginRegistry.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 74970F721EDC3266000507F3 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 74970F731EDC3266000507F3 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -91,7 +91,6 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, ); sourceTree = ""; }; @@ -106,6 +105,8 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 74970F721EDC3266000507F3 /* GeneratedPluginRegistrant.h */, + 74970F731EDC3266000507F3 /* GeneratedPluginRegistrant.m */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, @@ -113,8 +114,6 @@ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* PluginRegistry.h */, - 1498D2331E8E89220040F4C2 /* PluginRegistry.m */, ); path = Runner; sourceTree = ""; @@ -161,6 +160,7 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = ...; }; }; }; @@ -237,7 +237,7 @@ files = ( 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, - 1498D2341E8E89220040F4C2 /* PluginRegistry.m in Sources */, + 74970F741EDC3266000507F3 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/dev/integration_tests/channels/ios/Runner/AppDelegate.m b/dev/integration_tests/channels/ios/Runner/AppDelegate.m index 94c06d8def..bc3dc67718 100644 --- a/dev/integration_tests/channels/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/channels/ios/Runner/AppDelegate.m @@ -3,17 +3,15 @@ // found in the LICENSE file. #include "AppDelegate.h" -#include "PluginRegistry.h" +#include "GeneratedPluginRegistrant.h" -@implementation AppDelegate { - PluginRegistry *plugins; -} +@implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; // Override point for customization after application launch. FlutterViewController *flutterController = (FlutterViewController *)self.window.rootViewController; - plugins = [[PluginRegistry alloc] initWithController:flutterController]; [self setupMessagingHandshakeOnChannel: [FlutterBasicMessageChannel messageChannelWithName:@"binary-msg" @@ -39,7 +37,7 @@ [FlutterMethodChannel methodChannelWithName:@"std-method" binaryMessenger:flutterController codec:[FlutterStandardMethodCodec sharedInstance]]]; - return YES; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (void)setupMessagingHandshakeOnChannel:(FlutterBasicMessageChannel*)channel { @@ -73,27 +71,4 @@ } }]; } - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - @end diff --git a/dev/integration_tests/channels/ios/Runner/GeneratedPluginRegistrant.h b/dev/integration_tests/channels/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000000..3b700eb481 --- /dev/null +++ b/dev/integration_tests/channels/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +#endif /* GeneratedPluginRegistrant_h */ diff --git a/dev/integration_tests/channels/ios/Runner/GeneratedPluginRegistrant.m b/dev/integration_tests/channels/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000000..60dfa42b32 --- /dev/null +++ b/dev/integration_tests/channels/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +#import "GeneratedPluginRegistrant.h" + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { +} + +@end diff --git a/dev/integration_tests/channels/ios/Runner/PluginRegistry.h b/dev/integration_tests/channels/ios/Runner/PluginRegistry.h deleted file mode 100644 index df039db515..0000000000 --- a/dev/integration_tests/channels/ios/Runner/PluginRegistry.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Generated file. Do not edit. -// - -#ifndef PluginRegistry_h -#define PluginRegistry_h - -#import - - -@interface PluginRegistry : NSObject - - -- (instancetype)initWithController:(FlutterViewController *)controller; - -@end - -#endif /* PluginRegistry_h */ diff --git a/dev/integration_tests/channels/ios/Runner/PluginRegistry.m b/dev/integration_tests/channels/ios/Runner/PluginRegistry.m deleted file mode 100644 index 0a34729946..0000000000 --- a/dev/integration_tests/channels/ios/Runner/PluginRegistry.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -#import "PluginRegistry.h" - -@implementation PluginRegistry - -- (instancetype)initWithController:(FlutterViewController *)controller { - if (self = [super init]) { - } - return self; -} - -@end diff --git a/dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java b/dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java index 96e27d2b7a..1d8b74be86 100644 --- a/dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java +++ b/dev/integration_tests/ui/android/app/src/main/java/com/yourcompany/integration_ui/MainActivity.java @@ -6,15 +6,12 @@ package com.yourcompany.integration_ui; import android.os.Bundle; import io.flutter.app.FlutterActivity; -import io.flutter.plugins.PluginRegistry; +import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { - PluginRegistry pluginRegistry; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - pluginRegistry = new PluginRegistry(); - pluginRegistry.registerAll(this); - } + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + } } diff --git a/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000000..e07931dc42 --- /dev/null +++ b/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,11 @@ +package io.flutter.plugins; + +import io.flutter.plugin.common.PluginRegistry; + +/** + * Generated file. Do not edit. + */ +public final class GeneratedPluginRegistrant { + public static void registerWith(PluginRegistry registry) { + } +} diff --git a/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java b/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java deleted file mode 100644 index 92f7a749c4..0000000000 --- a/dev/integration_tests/ui/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.flutter.plugins; - -import io.flutter.app.FlutterActivity; - - -/** - * Generated file. Do not edit. - */ - -public class PluginRegistry { - - public void registerAll(FlutterActivity activity) { - } -} diff --git a/dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj b/dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj index 0b4c7bcefc..0a4fe0744b 100644 --- a/dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj +++ b/dev/integration_tests/ui/ios/Runner.xcodeproj/project.pbxproj @@ -7,10 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* PluginRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* PluginRegistry.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 74970F771EDC361B000507F3 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 74970F761EDC361B000507F3 /* GeneratedPluginRegistrant.m */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; @@ -38,10 +38,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* PluginRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PluginRegistry.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* PluginRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginRegistry.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 74970F751EDC361B000507F3 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 74970F761EDC361B000507F3 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -104,14 +104,14 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 74970F751EDC361B000507F3 /* GeneratedPluginRegistrant.h */, + 74970F761EDC361B000507F3 /* GeneratedPluginRegistrant.m */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* PluginRegistry.h */, - 1498D2331E8E89220040F4C2 /* PluginRegistry.m */, ); path = Runner; sourceTree = ""; @@ -240,7 +240,7 @@ files = ( 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, - 1498D2341E8E89220040F4C2 /* PluginRegistry.m in Sources */, + 74970F771EDC361B000507F3 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/dev/integration_tests/ui/ios/Runner/AppDelegate.m b/dev/integration_tests/ui/ios/Runner/AppDelegate.m index 32e67603ce..dfa4361f4b 100644 --- a/dev/integration_tests/ui/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/ui/ios/Runner/AppDelegate.m @@ -3,17 +3,13 @@ // found in the LICENSE file. #include "AppDelegate.h" -#include "PluginRegistry.h" +#include "GeneratedPluginRegistrant.h" -@implementation AppDelegate { - PluginRegistry *plugins; -} +@implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - FlutterViewController *flutterController = - (FlutterViewController *)self.window.rootViewController; - plugins = [[PluginRegistry alloc] initWithController:flutterController]; - return YES; + [GeneratedPluginRegistrant registerWithRegistry:self]; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end diff --git a/dev/integration_tests/ui/ios/Runner/GeneratedPluginRegistrant.h b/dev/integration_tests/ui/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000000..3b700eb481 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +#endif /* GeneratedPluginRegistrant_h */ diff --git a/dev/integration_tests/ui/ios/Runner/GeneratedPluginRegistrant.m b/dev/integration_tests/ui/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000000..60dfa42b32 --- /dev/null +++ b/dev/integration_tests/ui/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +#import "GeneratedPluginRegistrant.h" + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { +} + +@end diff --git a/dev/integration_tests/ui/ios/Runner/PluginRegistry.h b/dev/integration_tests/ui/ios/Runner/PluginRegistry.h deleted file mode 100644 index df039db515..0000000000 --- a/dev/integration_tests/ui/ios/Runner/PluginRegistry.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Generated file. Do not edit. -// - -#ifndef PluginRegistry_h -#define PluginRegistry_h - -#import - - -@interface PluginRegistry : NSObject - - -- (instancetype)initWithController:(FlutterViewController *)controller; - -@end - -#endif /* PluginRegistry_h */ diff --git a/dev/integration_tests/ui/ios/Runner/PluginRegistry.m b/dev/integration_tests/ui/ios/Runner/PluginRegistry.m deleted file mode 100644 index 0a34729946..0000000000 --- a/dev/integration_tests/ui/ios/Runner/PluginRegistry.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -#import "PluginRegistry.h" - -@implementation PluginRegistry - -- (instancetype)initWithController:(FlutterViewController *)controller { - if (self = [super init]) { - } - return self; -} - -@end diff --git a/dev/integration_tests/ui/lib/main.dart b/dev/integration_tests/ui/lib/main.dart new file mode 100644 index 0000000000..1e74ba0be1 --- /dev/null +++ b/dev/integration_tests/ui/lib/main.dart @@ -0,0 +1,7 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const Center(child: const Text('flutter run -t xxx.dart'))); diff --git a/dev/manual_tests/android/app/src/main/java/io/flutter/examples/manual_tests/MainActivity.java b/dev/manual_tests/android/app/src/main/java/io/flutter/examples/manual_tests/MainActivity.java index bfcf5a3a66..106c745b52 100644 --- a/dev/manual_tests/android/app/src/main/java/io/flutter/examples/manual_tests/MainActivity.java +++ b/dev/manual_tests/android/app/src/main/java/io/flutter/examples/manual_tests/MainActivity.java @@ -2,15 +2,12 @@ package io.flutter.examples.manual_tests; import android.os.Bundle; import io.flutter.app.FlutterActivity; -import io.flutter.plugins.PluginRegistry; +import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { - PluginRegistry pluginRegistry; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - pluginRegistry = new PluginRegistry(); - pluginRegistry.registerAll(this); - } + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + } } diff --git a/dev/manual_tests/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/dev/manual_tests/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000000..e07931dc42 --- /dev/null +++ b/dev/manual_tests/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,11 @@ +package io.flutter.plugins; + +import io.flutter.plugin.common.PluginRegistry; + +/** + * Generated file. Do not edit. + */ +public final class GeneratedPluginRegistrant { + public static void registerWith(PluginRegistry registry) { + } +} diff --git a/dev/manual_tests/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java b/dev/manual_tests/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java deleted file mode 100644 index 92f7a749c4..0000000000 --- a/dev/manual_tests/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.flutter.plugins; - -import io.flutter.app.FlutterActivity; - - -/** - * Generated file. Do not edit. - */ - -public class PluginRegistry { - - public void registerAll(FlutterActivity activity) { - } -} diff --git a/dev/manual_tests/ios/Runner.xcodeproj/project.pbxproj b/dev/manual_tests/ios/Runner.xcodeproj/project.pbxproj index 4b2405dfc1..7df0fcb01b 100644 --- a/dev/manual_tests/ios/Runner.xcodeproj/project.pbxproj +++ b/dev/manual_tests/ios/Runner.xcodeproj/project.pbxproj @@ -7,10 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* PluginRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* PluginRegistry.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 74970F7A1EDC3B62000507F3 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 74970F791EDC3B62000507F3 /* GeneratedPluginRegistrant.m */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; @@ -39,10 +39,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* PluginRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PluginRegistry.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* PluginRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginRegistry.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 74970F781EDC3B62000507F3 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 74970F791EDC3B62000507F3 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -106,6 +106,8 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 74970F781EDC3B62000507F3 /* GeneratedPluginRegistrant.h */, + 74970F791EDC3B62000507F3 /* GeneratedPluginRegistrant.m */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, @@ -113,8 +115,6 @@ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* PluginRegistry.h */, - 1498D2331E8E89220040F4C2 /* PluginRegistry.m */, ); path = Runner; sourceTree = ""; @@ -244,7 +244,7 @@ files = ( 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, - 1498D2341E8E89220040F4C2 /* PluginRegistry.m in Sources */, + 74970F7A1EDC3B62000507F3 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/dev/manual_tests/ios/Runner/AppDelegate.m b/dev/manual_tests/ios/Runner/AppDelegate.m index f78a1acfd3..74db37fda5 100644 --- a/dev/manual_tests/ios/Runner/AppDelegate.m +++ b/dev/manual_tests/ios/Runner/AppDelegate.m @@ -1,38 +1,15 @@ -#include "AppDelegate.h" -#include "PluginRegistry.h" +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. -@implementation AppDelegate { - PluginRegistry *plugins; -} +#include "AppDelegate.h" +#include "GeneratedPluginRegistrant.h" + +@implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; // Override point for customization after application launch. - FlutterViewController *flutterController = - (FlutterViewController *)self.window.rootViewController; - plugins = [[PluginRegistry alloc] initWithController:flutterController]; - return YES; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - @end diff --git a/dev/manual_tests/ios/Runner/GeneratedPluginRegistrant.h b/dev/manual_tests/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000000..3b700eb481 --- /dev/null +++ b/dev/manual_tests/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +#ifndef GeneratedPluginRegistrant_h +#define GeneratedPluginRegistrant_h + +#import + +@interface GeneratedPluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end + +#endif /* GeneratedPluginRegistrant_h */ diff --git a/dev/manual_tests/ios/Runner/GeneratedPluginRegistrant.m b/dev/manual_tests/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000000..60dfa42b32 --- /dev/null +++ b/dev/manual_tests/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +#import "GeneratedPluginRegistrant.h" + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { +} + +@end diff --git a/dev/manual_tests/lib/main.dart b/dev/manual_tests/lib/main.dart new file mode 100644 index 0000000000..1e74ba0be1 --- /dev/null +++ b/dev/manual_tests/lib/main.dart @@ -0,0 +1,7 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const Center(child: const Text('flutter run -t xxx.dart')));