-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from woodemi/develop
Remove QuickUsbPluign native implementation on desktop
- Loading branch information
Showing
8 changed files
with
4 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,4 @@ | ||
#include "include/quick_usb/quick_usb_plugin.h" | ||
|
||
#include <flutter_linux/flutter_linux.h> | ||
#include <gtk/gtk.h> | ||
#include <sys/utsname.h> | ||
|
||
#include <cstring> | ||
|
||
#define QUICK_USB_PLUGIN(obj) \ | ||
(G_TYPE_CHECK_INSTANCE_CAST((obj), quick_usb_plugin_get_type(), \ | ||
QuickUsbPlugin)) | ||
|
||
struct _QuickUsbPlugin { | ||
GObject parent_instance; | ||
}; | ||
|
||
G_DEFINE_TYPE(QuickUsbPlugin, quick_usb_plugin, g_object_get_type()) | ||
|
||
// Called when a method call is received from Flutter. | ||
static void quick_usb_plugin_handle_method_call( | ||
QuickUsbPlugin* self, | ||
FlMethodCall* method_call) { | ||
g_autoptr(FlMethodResponse) response = nullptr; | ||
|
||
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new()); | ||
|
||
fl_method_call_respond(method_call, response, nullptr); | ||
} | ||
|
||
static void quick_usb_plugin_dispose(GObject* object) { | ||
G_OBJECT_CLASS(quick_usb_plugin_parent_class)->dispose(object); | ||
} | ||
|
||
static void quick_usb_plugin_class_init(QuickUsbPluginClass* klass) { | ||
G_OBJECT_CLASS(klass)->dispose = quick_usb_plugin_dispose; | ||
} | ||
|
||
static void quick_usb_plugin_init(QuickUsbPlugin* self) {} | ||
|
||
static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call, | ||
gpointer user_data) { | ||
QuickUsbPlugin* plugin = QUICK_USB_PLUGIN(user_data); | ||
quick_usb_plugin_handle_method_call(plugin, method_call); | ||
} | ||
|
||
void quick_usb_plugin_register_with_registrar(FlPluginRegistrar* registrar) { | ||
QuickUsbPlugin* plugin = QUICK_USB_PLUGIN( | ||
g_object_new(quick_usb_plugin_get_type(), nullptr)); | ||
|
||
g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); | ||
g_autoptr(FlMethodChannel) channel = | ||
fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar), | ||
"quick_usb", | ||
FL_METHOD_CODEC(codec)); | ||
fl_method_channel_set_method_call_handler(channel, method_call_cb, | ||
g_object_ref(plugin), | ||
g_object_unref); | ||
|
||
g_object_unref(plugin); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,5 @@ | ||
#include "include/quick_usb/quick_usb_plugin.h" | ||
|
||
// This must be included before many other Windows headers. | ||
#include <windows.h> | ||
|
||
// For getPlatformVersion; remove unless needed for your plugin implementation. | ||
#include <VersionHelpers.h> | ||
|
||
#include <flutter/method_channel.h> | ||
#include <flutter/plugin_registrar_windows.h> | ||
#include <flutter/standard_method_codec.h> | ||
|
||
#include <map> | ||
#include <memory> | ||
#include <sstream> | ||
|
||
namespace { | ||
|
||
class QuickUsbPlugin : public flutter::Plugin { | ||
public: | ||
static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar); | ||
|
||
QuickUsbPlugin(); | ||
|
||
virtual ~QuickUsbPlugin(); | ||
|
||
private: | ||
// Called when a method is called on this plugin's channel from Dart. | ||
void HandleMethodCall( | ||
const flutter::MethodCall<flutter::EncodableValue> &method_call, | ||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result); | ||
}; | ||
|
||
// static | ||
void QuickUsbPlugin::RegisterWithRegistrar( | ||
flutter::PluginRegistrarWindows *registrar) { | ||
auto channel = | ||
std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>( | ||
registrar->messenger(), "quick_usb", | ||
&flutter::StandardMethodCodec::GetInstance()); | ||
|
||
auto plugin = std::make_unique<QuickUsbPlugin>(); | ||
|
||
channel->SetMethodCallHandler( | ||
[plugin_pointer = plugin.get()](const auto &call, auto result) { | ||
plugin_pointer->HandleMethodCall(call, std::move(result)); | ||
}); | ||
|
||
registrar->AddPlugin(std::move(plugin)); | ||
} | ||
|
||
QuickUsbPlugin::QuickUsbPlugin() {} | ||
|
||
QuickUsbPlugin::~QuickUsbPlugin() {} | ||
|
||
void QuickUsbPlugin::HandleMethodCall( | ||
const flutter::MethodCall<flutter::EncodableValue> &method_call, | ||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) { | ||
result->NotImplemented(); | ||
} | ||
|
||
} // namespace | ||
|
||
void QuickUsbPluginRegisterWithRegistrar( | ||
FlutterDesktopPluginRegistrarRef registrar) { | ||
QuickUsbPlugin::RegisterWithRegistrar( | ||
flutter::PluginRegistrarManager::GetInstance() | ||
->GetRegistrar<flutter::PluginRegistrarWindows>(registrar)); | ||
} |