Skip to content

Commit 575fb74

Browse files
committed
fix(app): update isStrongBoxSupported
1 parent 768e282 commit 575fb74

File tree

6 files changed

+28
-9
lines changed

6 files changed

+28
-9
lines changed

flutter_secure_storage/lib/flutter_secure_storage.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,13 @@ class FlutterSecureStorage {
344344
});
345345
}
346346

347-
Future<bool> isStrongBoxSupported() async {
347+
Future<bool> isStrongBoxSupported({
348+
AndroidOptions? aOptions,
349+
}) async {
348350
if (defaultTargetPlatform == TargetPlatform.android) {
349-
return await _platform.isStrongBoxSupported();
351+
return _platform.isStrongBoxSupported(
352+
options: aOptions?.params ?? this.aOptions.params,
353+
);
350354
} else {
351355
throw UnsupportedError(_unsupportedPlatform);
352356
}

flutter_secure_storage/lib/test/test_flutter_secure_storage_platform.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@ class TestFlutterSecureStoragePlatform extends FlutterSecureStoragePlatform {
5454
data[key] = value;
5555

5656
@override
57-
Future<bool> isStrongBoxSupported() async => true;
57+
Future<bool> isStrongBoxSupported({
58+
required Map<String, String> options,
59+
}) async =>
60+
true;
5861
}

flutter_secure_storage_platform_interface/lib/flutter_secure_storage_platform_interface.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ abstract class FlutterSecureStoragePlatform extends PlatformInterface {
126126
/// Returns:
127127
/// - A [Future] that resolves to `true` if the device supports secure
128128
/// hardware-backed storage, or `false` otherwise.
129-
Future<bool> isStrongBoxSupported() {
129+
Future<bool> isStrongBoxSupported({
130+
required Map<String, String> options,
131+
}) {
130132
throw UnsupportedError(
131133
'isStrongBoxSupported() is not available on this platform',
132134
);

flutter_secure_storage_platform_interface/lib/src/method_channel_flutter_secure_storage.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,18 @@ class MethodChannelFlutterSecureStorage extends FlutterSecureStoragePlatform {
116116
});
117117

118118
@override
119-
Future<bool> isStrongBoxSupported() async {
119+
Future<bool> isStrongBoxSupported({
120+
required Map<String, String> options,
121+
}) async {
120122
if (defaultTargetPlatform != TargetPlatform.android) {
121123
throw UnsupportedError('StrongBox is only supported on Android.');
122124
}
123-
return (await _channel
124-
.invokeMethod<bool>('isStrongBoxSupported', {'key': ''})) ??
125+
return (await _channel.invokeMethod<bool>(
126+
'isStrongBoxSupported',
127+
{
128+
'options': options,
129+
},
130+
)) ??
125131
false;
126132
}
127133
}

flutter_secure_storage_windows/lib/src/flutter_secure_storage_windows_ffi.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ class FlutterSecureStorageWindows extends FlutterSecureStoragePlatform {
180180
}
181181

182182
@override
183-
Future<bool> isStrongBoxSupported() async {
183+
Future<bool> isStrongBoxSupported({
184+
required Map<String, String> options,
185+
}) async {
184186
throw UnsupportedError(
185187
'isStrongBoxSupported() is not available on this platform',
186188
);

flutter_secure_storage_windows/lib/src/flutter_secure_storage_windows_stub.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ class FlutterSecureStorageWindows extends FlutterSecureStoragePlatform {
5050
Future.value();
5151

5252
@override
53-
Future<bool> isStrongBoxSupported() async {
53+
Future<bool> isStrongBoxSupported({
54+
required Map<String, String> options,
55+
}) async {
5456
throw UnsupportedError(
5557
'isStrongBoxSupported() is not available on this platform',
5658
);

0 commit comments

Comments
 (0)