Skip to content

Commit

Permalink
Add hardcoded sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
rekire committed Mar 11, 2024
1 parent c526f80 commit d307eb1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions autologin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ flutter:
default_package: autologin_android
ios:
default_package: autologin_darwin
#linux:
# default_package: autologin_linux
linux:
default_package: autologin_linux
macos:
default_package: autologin_darwin
web:
Expand All @@ -29,8 +29,8 @@ dependencies:
url: https://github.com/rekire/autologin_plugin.git
path: autologin_android
ref: 0.0.6
#autologin_linux:
# path: ../autologin_linux
autologin_linux:
path: ../autologin_linux
autologin_darwin:
git:
url: https://github.com/rekire/autologin_plugin.git
Expand Down
11 changes: 6 additions & 5 deletions autologin_linux/linux/autologin_linux_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstring>

const char kChannelName[] = "autologin_linux";
const char kGetPlatformName[] = "getPlatformName";

struct _FlAutologinPlugin {
GObject parent_instance;
Expand All @@ -23,11 +22,14 @@ G_DEFINE_TYPE(FlAutologinPlugin, fl_autologin_plugin, g_object_get_type())
// Called when a method call is received from Flutter.
static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call,
gpointer user_data) {
//printf("native: method call\n");
const gchar* method = fl_method_call_get_name(method_call);

//printf("native: Invoked %s\n", method);
g_autoptr(FlMethodResponse) response = nullptr;
if (strcmp(method, kGetPlatformName) == 0)
response = FL_METHOD_RESPONSE(fl_method_success_response_new(fl_value_new_string("Linux")));
if (strcmp(method, "performCompatibilityChecks") == 0) {
response = FL_METHOD_RESPONSE(fl_method_success_response_new(fl_value_new_string("{\"isPlatformSupported\":true,\"canSafeSecrets\":true}")));
} else if (strcmp(method, "requestCredentials") == 0)
response = FL_METHOD_RESPONSE(fl_method_success_response_new(fl_value_new_string("{\"username\":\"test\",\"password\":\"test-pwd\"}")));
else
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());

Expand Down Expand Up @@ -56,7 +58,6 @@ FlAutologinPlugin* fl_autologin_plugin_new(FlPluginRegistrar* registrar) {
kChannelName, FL_METHOD_CODEC(codec));
fl_method_channel_set_method_call_handler(self->channel, method_call_cb,
g_object_ref(self), g_object_unref);

return self;
}

Expand Down

0 comments on commit d307eb1

Please sign in to comment.