Skip to content

Commit 7d17e57

Browse files
committed
Various updates.
1 parent e452fd3 commit 7d17e57

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ lib/app.dart
5757
/assets/images/*.si
5858
/assets/images/**/*.si
5959
snap/meta/polkit
60+
open-authenticator_*.snap
6061

6162
# Firebase files
6263
firebase

bin/generate_polkit_policy.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Future<void> main() async {
2222

2323
stdout.writeln('Generating polkit policy file...');
2424
String policyFileContent = '''<?xml version="1.0" encoding="UTF-8"?>
25-
<policyconfig>''';
25+
<policyconfig>
26+
''';
2627
for (UnlockReason reason in UnlockReason.values) {
2728
policyFileContent += '''
2829
<action id="app.openauthenticator.${reason.name}">

lib/utils/local_authentication/method_channel.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LocalAuthenticationMethodChannel extends LocalAuthentication {
1313
await _methodChannel.invokeMethod<bool>(
1414
'localAuth.authenticate',
1515
{
16-
reason: reason.name,
16+
'reason': reason.name,
1717
},
1818
) ==
1919
true;

linux/my_application.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

snap/snapcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Open Authenticator
33
version: 1.4.0
44
summary: A cross-platform OTP app, free and open-source.
55
description: Secure your online accounts with a free, open-source and lovely-crafted app.
6-
license: GNU GPL v3
6+
license: GPL-3.0-only
77
source-code:
88
- https://github.com/Skyost/OpenAuthenticator
99
contact:

0 commit comments

Comments
 (0)