Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rekire committed Mar 31, 2024
1 parent 9518827 commit fbd0b8e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion autologin/test/autologin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ void main() {

setUp(() {
autologinPlatform = MockAutologinPlatform();
autologinPlatform.setup(); // just for code coverage
Credential? cache;
String? cachedToken;
when(
Expand Down Expand Up @@ -52,6 +51,7 @@ void main() {
});

test('performCompatibilityChecks returns expected compatibilities', () async {
AutologinPlugin.setup(); // just for code coverage
expect(
await AutologinPlugin.performCompatibilityChecks(),
equals(compatibilityReport),
Expand Down
14 changes: 9 additions & 5 deletions autologin_web/lib/autologin_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ class AutologinWeb extends AutologinPlatform {
}

@override
Future<Compatibilities> performCompatibilityChecks() async => Compatibilities(
isPlatformSupported: window.navigator.credentials != null && context.hasProperty('PasswordCredential'),
);
Future<Compatibilities> performCompatibilityChecks() async {
final canSafeSecrets = window.navigator.credentials != null && context.hasProperty('PasswordCredential');
return Compatibilities(
isPlatformSupported: canSafeSecrets,
canSafeSecrets: canSafeSecrets,
);
}

@override
Future<Credential?> requestCredentials({String? domain}) async {
Future<Credential?> requestCredentials() async {
final data = await window.navigator.credentials?.get({
'password': true,
}) as PasswordCredential?;
Expand Down Expand Up @@ -50,6 +54,6 @@ class AutologinWeb extends AutologinPlatform {

@override
Future<bool> saveLoginToken(String token) async {
throw UnsupportedError('The web platform does not support login tokens');
return false;
}
}
2 changes: 1 addition & 1 deletion autologin_web/test/autologin_web_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fbd0b8e

Please sign in to comment.