Verify that committed GeneratedPluginRegistrant are up-to-date (#13541)

This commit is contained in:
Michael Goderbauer
2017-12-13 17:49:54 -08:00
committed by GitHub
parent 998bf194a3
commit e5846d962e
13 changed files with 216 additions and 3 deletions

View File

@@ -11,9 +11,21 @@ import io.flutter.videoplayer.VideoPlayerPlugin;
*/
public final class GeneratedPluginRegistrant {
public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
}
ConnectivityPlugin.registerWith(registry.registrarFor("io.flutter.plugins.connectivity.ConnectivityPlugin"));
DeviceInfoPlugin.registerWith(registry.registrarFor("io.flutter.plugins.deviceinfo.DeviceInfoPlugin"));
UrlLauncherPlugin.registerWith(registry.registrarFor("io.flutter.plugins.urllauncher.UrlLauncherPlugin"));
VideoPlayerPlugin.registerWith(registry.registrarFor("io.flutter.videoplayer.VideoPlayerPlugin"));
}
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
if (registry.hasPlugin(key)) {
return true;
}
registry.registrarFor(key);
return false;
}
}