@@ -60,7 +60,7 @@ static void authenticate_async_callback(PolkitAuthority* authority, GAsyncResult
6060 g_object_unref (user_data); // Unref the method call after use
6161}
6262
63- static void authenticate (FlMethodCall* method_call) {
63+ static void authenticate (const std::string reason, FlMethodCall* method_call) {
6464 GError* error = nullptr ;
6565 PolkitAuthority* authority = polkit_authority_get_sync (nullptr , &error);
6666 if (error || authority == nullptr ) {
@@ -72,7 +72,7 @@ static void authenticate(FlMethodCall* method_call) {
7272 polkit_authority_check_authorization (
7373 authority,
7474 subject,
75- " app.openauthenticator.authenticate " ,
75+ ( " app.openauthenticator." + reason). c_str () ,
7676 nullptr ,
7777 POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
7878 nullptr ,
@@ -87,7 +87,9 @@ static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call,
8787 if (strcmp (method, " localAuth.isDeviceSupported" ) == 0 ) {
8888 can_authenticate (method_call);
8989 } else if (strcmp (method, " localAuth.authenticate" ) == 0 ) {
90- authenticate (method_call);
90+ FlValue* args = fl_method_call_get_args (method_call);
91+ FlValue* reason = fl_value_lookup_string (args, " reason" );
92+ authenticate (fl_value_get_string (reason), method_call);
9193 } else {
9294 g_autoptr (FlMethodResponse) response = FL_METHOD_RESPONSE (fl_method_not_implemented_response_new ());
9395 fl_method_call_respond (method_call, response, nullptr );
0 commit comments