diff --git a/examples/platform_channel/android/app/src/main/java/com/example/platformchannel/MainActivity.java b/examples/platform_channel/android/app/src/main/java/com/example/platformchannel/MainActivity.java index 036d88d931..dc06146663 100644 --- a/examples/platform_channel/android/app/src/main/java/com/example/platformchannel/MainActivity.java +++ b/examples/platform_channel/android/app/src/main/java/com/example/platformchannel/MainActivity.java @@ -22,6 +22,7 @@ import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.plugin.common.MethodCall; +import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { private static final String BATTERY_CHANNEL = "samples.flutter.io/battery"; @@ -30,7 +31,7 @@ public class MainActivity extends FlutterActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + GeneratedPluginRegistrant.registerWith(this); new EventChannel(getFlutterView(), CHARGING_CHANNEL).setStreamHandler( new StreamHandler() { private BroadcastReceiver chargingStateChangeReceiver; diff --git a/examples/platform_channel/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/platform_channel/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000000..e07931dc42 --- /dev/null +++ b/examples/platform_channel/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/examples/platform_channel/ios/Runner.xcodeproj/project.pbxproj b/examples/platform_channel/ios/Runner.xcodeproj/project.pbxproj index 956fd14388..4aedd3e18c 100644 --- a/examples/platform_channel/ios/Runner.xcodeproj/project.pbxproj +++ b/examples/platform_channel/ios/Runner.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 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, ); }; }; + 74970F681EDC0F26000507F3 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 74970F671EDC0F26000507F3 /* 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 */; }; @@ -40,6 +41,8 @@ /* Begin PBXFileReference section */ 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 = ""; }; + 74970F661EDC0F26000507F3 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 74970F671EDC0F26000507F3 /* 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 = ""; }; @@ -103,6 +106,8 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 74970F661EDC0F26000507F3 /* GeneratedPluginRegistrant.h */, + 74970F671EDC0F26000507F3 /* GeneratedPluginRegistrant.m */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, @@ -239,6 +244,7 @@ files = ( 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, + 74970F681EDC0F26000507F3 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/platform_channel/ios/Runner/AppDelegate.m b/examples/platform_channel/ios/Runner/AppDelegate.m index d8fd0f561a..2c0add8359 100644 --- a/examples/platform_channel/ios/Runner/AppDelegate.m +++ b/examples/platform_channel/ios/Runner/AppDelegate.m @@ -4,7 +4,7 @@ #import "AppDelegate.h" #import - +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate { FlutterEventSink _eventSink; @@ -12,6 +12,7 @@ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController; @@ -38,7 +39,7 @@ eventChannelWithName:@"samples.flutter.io/charging" binaryMessenger:controller]; [chargingChannel setStreamHandler:self]; - return YES; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (int)getBatteryLevel { diff --git a/examples/platform_channel/ios/Runner/GeneratedPluginRegistrant.h b/examples/platform_channel/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000000..3b700eb481 --- /dev/null +++ b/examples/platform_channel/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/examples/platform_channel/ios/Runner/GeneratedPluginRegistrant.m b/examples/platform_channel/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000000..60dfa42b32 --- /dev/null +++ b/examples/platform_channel/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/examples/platform_channel_swift/ios/Runner.xcodeproj/project.pbxproj b/examples/platform_channel_swift/ios/Runner.xcodeproj/project.pbxproj index c30ad652c4..62d9d80acf 100644 --- a/examples/platform_channel_swift/ios/Runner.xcodeproj/project.pbxproj +++ b/examples/platform_channel_swift/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 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, ); }; }; 3BAEBBFF1EBA9DA300EE9294 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BAEBBFE1EBA9DA300EE9294 /* AppDelegate.swift */; }; + 74970F6B1EDC12EC000507F3 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 74970F6A1EDC12EC000507F3 /* 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 */; }; @@ -41,6 +42,8 @@ 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 3BAEBBFE1EBA9DA300EE9294 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 3BAEBC001EBA9DCA00EE9294 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74970F691EDC12EC000507F3 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 74970F6A1EDC12EC000507F3 /* 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 = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -101,6 +104,8 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 74970F691EDC12EC000507F3 /* GeneratedPluginRegistrant.h */, + 74970F6A1EDC12EC000507F3 /* GeneratedPluginRegistrant.m */, 3BAEBBFE1EBA9DA300EE9294 /* AppDelegate.swift */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, @@ -236,6 +241,7 @@ buildActionMask = 2147483647; files = ( 3BAEBBFF1EBA9DA300EE9294 /* AppDelegate.swift in Sources */, + 74970F6B1EDC12EC000507F3 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -400,7 +406,6 @@ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; - }; name = Release; }; diff --git a/examples/platform_channel_swift/ios/Runner/AppDelegate.swift b/examples/platform_channel_swift/ios/Runner/AppDelegate.swift index 976635a85a..2aca64d55c 100644 --- a/examples/platform_channel_swift/ios/Runner/AppDelegate.swift +++ b/examples/platform_channel_swift/ios/Runner/AppDelegate.swift @@ -12,6 +12,7 @@ import Flutter override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + GeneratedPluginRegistrant.register(with: self); let controller : FlutterViewController = window?.rootViewController as! FlutterViewController; let batteryChannel = FlutterMethodChannel.init(name: "samples.flutter.io/battery", binaryMessenger: controller); @@ -27,7 +28,7 @@ import Flutter let chargingChannel = FlutterEventChannel.init(name: "samples.flutter.io/charging", binaryMessenger: controller); chargingChannel.setStreamHandler(self); - return true + return super.application(application, didFinishLaunchingWithOptions: launchOptions); } private func receiveBatteryLevel(result: FlutterResult) { diff --git a/examples/platform_channel_swift/ios/Runner/GeneratedPluginRegistrant.h b/examples/platform_channel_swift/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000000..3b700eb481 --- /dev/null +++ b/examples/platform_channel_swift/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/examples/platform_channel_swift/ios/Runner/GeneratedPluginRegistrant.m b/examples/platform_channel_swift/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000000..60dfa42b32 --- /dev/null +++ b/examples/platform_channel_swift/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/examples/platform_channel_swift/ios/Runner/Runner-Bridging-Header.h b/examples/platform_channel_swift/ios/Runner/Runner-Bridging-Header.h index b314265990..0592e2dd55 100644 --- a/examples/platform_channel_swift/ios/Runner/Runner-Bridging-Header.h +++ b/examples/platform_channel_swift/ios/Runner/Runner-Bridging-Header.h @@ -1,3 +1,5 @@ +// 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 "../Flutter/Flutter.framework/Headers/Flutter.h" - +#import "GeneratedPluginRegistrant.h"