diff --git a/CHANGELOG.md b/CHANGELOG.md index 875ad9e..0204f34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ -## 5.1.0-rc.2 +## 5.1.0-rc.3 * Split Split authenticationValidityDurationSeconds between android and iOS * `darwinTouchIDAuthenticationForceReuseContextDuration`: Basically the equivalent to `androidAuthenticationValidityDuration` * `darwinTouchIDAuthenticationAllowableReuseDuration` * android: return correct code if no biometric is enrolled #115 @ThomasLamprecht +* web: migrate from dart:html to package:web (for wasm support). ## 5.0.1 diff --git a/example/.metadata b/example/.metadata index f812083..72aedeb 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,27 @@ # This file should be version controlled and should not be manually edited. version: - revision: 4984d1a33dd6de2862578e3f08b4ca7dfce7d54b - channel: dev + revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 + - platform: web + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/lib/generated_plugin_registrant.dart b/example/lib/generated_plugin_registrant.dart deleted file mode 100644 index 1b37f14..0000000 --- a/example/lib/generated_plugin_registrant.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// Generated file. Do not edit. -// - -// ignore_for_file: directives_ordering -// ignore_for_file: lines_longer_than_80_chars -// ignore_for_file: depend_on_referenced_packages - -import 'package:biometric_storage/src/biometric_storage_web.dart'; - -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - -// ignore: public_member_api_docs -void registerPlugins(Registrar registrar) { - BiometricStoragePluginWeb.registerWith(registrar); - registrar.registerMessageHandler(); -} diff --git a/example/pubspec.lock b/example/pubspec.lock index ac3fa63..e25f116 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -15,7 +15,7 @@ packages: path: ".." relative: true source: path - version: "5.0.1" + version: "5.1.0-rc.2" boolean_selector: dependency: transitive description: @@ -276,6 +276,14 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.1" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" win32: dependency: transitive description: diff --git a/example/web/icons/Icon-maskable-192.png b/example/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/example/web/icons/Icon-maskable-192.png differ diff --git a/example/web/icons/Icon-maskable-512.png b/example/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/example/web/icons/Icon-maskable-512.png differ diff --git a/example/web/index.html b/example/web/index.html index ae61592..1aa025d 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -1,33 +1,38 @@ + + + - + - + - + - biometric_storage_example + example - - - + diff --git a/example/web/manifest.json b/example/web/manifest.json index 3d4da00..096edf8 100644 --- a/example/web/manifest.json +++ b/example/web/manifest.json @@ -1,11 +1,11 @@ { - "name": "biometric_storage_example", - "short_name": "biometric_storage_example", + "name": "example", + "short_name": "example", "start_url": ".", "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", - "description": "Demonstrates how to use the biometric_storage plugin.", + "description": "A new Flutter project.", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [ @@ -18,6 +18,18 @@ "src": "icons/Icon-512.png", "sizes": "512x512", "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" } ] } diff --git a/lib/src/biometric_storage_web.dart b/lib/src/biometric_storage_web.dart index 324bb96..607fa89 100644 --- a/lib/src/biometric_storage_web.dart +++ b/lib/src/biometric_storage_web.dart @@ -1,9 +1,5 @@ import 'dart:async'; -// In order to *not* need this ignore, consider extracting the "web" version -// of your plugin as a separate package, instead of inlining it in the same -// package as the core of your plugin. -// ignore: avoid_web_libraries_in_flutter -import 'dart:html' as html show window; +import 'package:web/web.dart' as web show window; import 'package:biometric_storage/src/biometric_storage.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; @@ -37,7 +33,9 @@ class BiometricStoragePluginWeb extends BiometricStorage { String name, PromptInfo promptInfo, ) async { - return html.window.localStorage.remove(name) != null; + final oldValue = web.window.localStorage.getItem(name); + web.window.localStorage.removeItem(name); + return oldValue != null; } @override @@ -48,7 +46,7 @@ class BiometricStoragePluginWeb extends BiometricStorage { String name, PromptInfo promptInfo, ) async { - return html.window.localStorage[name]; + return web.window.localStorage.getItem(name); } @override @@ -57,6 +55,6 @@ class BiometricStoragePluginWeb extends BiometricStorage { String content, PromptInfo promptInfo, ) async { - html.window.localStorage[name] = content; + web.window.localStorage.setItem(name, content); } } diff --git a/pubspec.yaml b/pubspec.yaml index 53713c4..7f31d50 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: biometric_storage description: | Secure Storage: Encrypted data store optionally secured by biometric lock with support for iOS, Android, MacOS. Partial support for Linux, Windows and web (localStorage). -version: 5.1.0-rc.2 +version: 5.1.0-rc.3 homepage: https://github.com/authpass/biometric_storage/ environment: @@ -19,6 +19,7 @@ dependencies: ffi: '>=1.0.0 <3.0.0' win32: '>=2.0.0 <6.0.0' + web: ">=0.5.0 <1.0.0" dev_dependencies: flutter_test: