diff --git a/autologin/test/autologin_test.dart b/autologin/test/autologin_test.dart index 99c73c7..e253d0d 100644 --- a/autologin/test/autologin_test.dart +++ b/autologin/test/autologin_test.dart @@ -21,7 +21,6 @@ void main() { setUp(() { autologinPlatform = MockAutologinPlatform(); - autologinPlatform.setup(); // just for code coverage Credential? cache; String? cachedToken; when( @@ -52,6 +51,7 @@ void main() { }); test('performCompatibilityChecks returns expected compatibilities', () async { + AutologinPlugin.setup(); // just for code coverage expect( await AutologinPlugin.performCompatibilityChecks(), equals(compatibilityReport), diff --git a/autologin_web/lib/autologin_web.dart b/autologin_web/lib/autologin_web.dart index 9ad385a..7a5c312 100644 --- a/autologin_web/lib/autologin_web.dart +++ b/autologin_web/lib/autologin_web.dart @@ -12,12 +12,16 @@ class AutologinWeb extends AutologinPlatform { } @override - Future performCompatibilityChecks() async => Compatibilities( - isPlatformSupported: window.navigator.credentials != null && context.hasProperty('PasswordCredential'), - ); + Future performCompatibilityChecks() async { + final canSafeSecrets = window.navigator.credentials != null && context.hasProperty('PasswordCredential'); + return Compatibilities( + isPlatformSupported: canSafeSecrets, + canSafeSecrets: canSafeSecrets, + ); + } @override - Future requestCredentials({String? domain}) async { + Future requestCredentials() async { final data = await window.navigator.credentials?.get({ 'password': true, }) as PasswordCredential?; @@ -50,6 +54,6 @@ class AutologinWeb extends AutologinPlatform { @override Future saveLoginToken(String token) async { - throw UnsupportedError('The web platform does not support login tokens'); + return false; } } diff --git a/autologin_web/test/autologin_web_test.dart b/autologin_web/test/autologin_web_test.dart index 500fa29..f4bdd02 100644 --- a/autologin_web/test/autologin_web_test.dart +++ b/autologin_web/test/autologin_web_test.dart @@ -7,7 +7,7 @@ void main() { group('AutologinWeb', () { late AutologinWeb autologin; - const expectedCompatibilities = Compatibilities(isPlatformSupported: true); + const expectedCompatibilities = Compatibilities(isPlatformSupported: true, canSafeSecrets: true); const expectedCredentials = Credential(username: 'foo', password: 'bar'); setUp(() async {