Skip to content

Commit 32da945

Browse files
committed
cleanup: update version constraints, update README, fix warnings
1 parent daae973 commit 32da945

16 files changed

Lines changed: 89 additions & 241 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
## 5.0.1-dev.1
1+
## 5.0.1
22

33
* Add option for iOS/MacOS to allow non-biometric authentication (`darwinBiometricOnly`) #101
44
* Improve [canAuthenticate] to differentiate between no available biometry and no available
55
user code.
6+
* Bump dart sdk requirement to `3.2`.
67

78
## 5.0.0+4
89

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,33 @@ makes heavy use of this plugin.
3030
* `android/build.gradle`: `ext.kotlin_version = '1.4.31'`
3131
* MainActivity must extend FlutterFragmentActivity
3232
* Theme for the main activity must use `Theme.AppCompat` thme.
33-
(Otherwise there will be crases on Android < 29)
33+
(Otherwise there will be crashes on Android < 29)
3434
For example:
3535

36-
**AndroidManifest.xml**:
36+
**android/app/src/main/AndroidManifest.xml**:
3737
```xml
3838
<activity
39-
android:name=".MainActivity"
40-
android:launchMode="singleTop"
41-
android:theme="@style/LaunchTheme"
39+
android:name=".MainActivity"
40+
android:launchMode="singleTop"
41+
android:theme="@style/LaunchTheme">
42+
[...]
43+
<meta-data
44+
android:name="io.flutter.embedding.android.NormalTheme"
45+
android:resource="@style/NormalTheme"
46+
/>
47+
</activity>
4248
```
4349

44-
**xml/styles.xml**:
50+
**android/app/src/main/res/values/styles.xml**:
4551
```xml
46-
<style name="LaunchTheme" parent="Theme.AppCompat.NoActionBar">
47-
<!-- Show a splash screen on the activity. Automatically removed when
48-
Flutter draws its first frame -->
49-
<item name="android:windowBackground">@drawable/launch_background</item>
50-
51-
<item name="android:windowNoTitle">true</item>
52-
<item name="android:windowActionBar">false</item>
53-
<item name="android:windowFullscreen">true</item>
54-
<item name="android:windowContentOverlay">@null</item>
55-
</style>
52+
<resources>
53+
<style name="LaunchTheme" parent="Theme.AppCompat.NoActionBar">
54+
...
55+
</style>
56+
<style name="NormalTheme" parent="Theme.AppCompat.NoActionBar">
57+
...
58+
</style>
59+
</resources>
5660
```
5761

5862
##### Resources
@@ -65,7 +69,7 @@ makes heavy use of this plugin.
6569
https://developer.apple.com/documentation/localauthentication/logging_a_user_into_your_app_with_face_id_or_touch_id
6670

6771
* include the NSFaceIDUsageDescription key in your app’s Info.plist file
68-
* Requires at least iOS 9
72+
* Supports all iOS versions supported by Flutter. (ie. iOS 12)
6973

7074
**Known Issue**: since iOS 15 the simulator seem to no longer support local authentication:
7175
https://developer.apple.com/forums/thread/685773
@@ -76,7 +80,7 @@ https://developer.apple.com/documentation/localauthentication/logging_a_user_int
7680
* enable keychain sharing and signing. (not sure why this is required. but without it
7781
You will probably see an error like:
7882
> SecurityError, Error while writing data: -34018: A required entitlement isn't present.
79-
* Requires at least Mac OS 10.12
83+
* Supports all MacOS Versions supported by Flutter (ie. >= MacOS 10.14)
8084

8185
### Usage
8286

analysis_options.yaml

Lines changed: 1 addition & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# Defines a default set of lint rules enforced for
2-
# projects at Google. For details and rationale,
3-
# see https://github.com/dart-lang/pedantic#enabled-lints.
4-
include: package:lints/recommended.yaml
1+
include: package:flutter_lints/flutter.yaml
52

63
analyzer:
74
errors:
@@ -20,156 +17,3 @@ analyzer:
2017

2118
linter:
2219
rules:
23-
# these rules are documented on and in the same order as
24-
# the Dart Lint rules page to make maintenance easier
25-
# http://dart-lang.github.io/linter/lints/
26-
27-
# HP mostly in sync with https://github.com/flutter/flutter/blob/master/analysis_options.yaml
28-
29-
- always_declare_return_types
30-
- always_put_control_body_on_new_line
31-
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
32-
- always_require_non_null_named_parameters
33-
#- always_specify_types
34-
- annotate_overrides
35-
# - avoid_annotating_with_dynamic # not yet tested
36-
# - avoid_as
37-
- avoid_bool_literals_in_conditional_expressions
38-
# - avoid_catches_without_on_clauses # not yet tested
39-
# - avoid_catching_errors # not yet tested
40-
# - avoid_classes_with_only_static_members # not yet tested
41-
# - avoid_double_and_int_checks # only useful when targeting JS runtime
42-
- avoid_empty_else
43-
- avoid_field_initializers_in_const_classes
44-
- avoid_function_literals_in_foreach_calls
45-
# - avoid_implementing_value_types # not yet tested
46-
- avoid_init_to_null
47-
# - avoid_js_rounded_ints # only useful when targeting JS runtime
48-
- avoid_null_checks_in_equality_operators
49-
# - avoid_positional_boolean_parameters # not yet tested
50-
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
51-
- avoid_relative_lib_imports
52-
- avoid_renaming_method_parameters
53-
- avoid_return_types_on_setters
54-
# - avoid_returning_null # not yet tested
55-
# - avoid_returning_null_for_future # not yet tested
56-
- avoid_returning_null_for_void
57-
# - avoid_returning_this # not yet tested
58-
# - avoid_setters_without_getters # not yet tested
59-
# - avoid_shadowing_type_parameters # not yet tested
60-
# - avoid_single_cascade_in_expression_statements # not yet tested
61-
- avoid_slow_async_io
62-
- avoid_types_as_parameter_names
63-
# - avoid_types_on_closure_parameters # not yet tested
64-
- avoid_unused_constructor_parameters
65-
- avoid_void_async
66-
- await_only_futures
67-
- camel_case_types
68-
- cancel_subscriptions
69-
# - cascade_invocations # not yet tested
70-
# - close_sinks # not reliable enough
71-
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
72-
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
73-
- control_flow_in_finally
74-
- curly_braces_in_flow_control_structures
75-
# - diagnostic_describe_all_properties # not yet tested
76-
- directives_ordering
77-
- empty_catches
78-
- empty_constructor_bodies
79-
- empty_statements
80-
# - file_names # not yet tested
81-
# - flutter_style_todos TODO(HP)
82-
- hash_and_equals
83-
- implementation_imports
84-
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
85-
- iterable_contains_unrelated_type
86-
# - join_return_with_assignment # not yet tested
87-
- library_names
88-
- library_prefixes
89-
# - lines_longer_than_80_chars # not yet tested
90-
- list_remove_unrelated_type
91-
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
92-
- no_adjacent_strings_in_list
93-
- no_duplicate_case_values
94-
- non_constant_identifier_names
95-
# - null_closures # not yet tested
96-
# - omit_local_variable_types # opposite of always_specify_types
97-
# - one_member_abstracts # too many false positives
98-
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
99-
- overridden_fields
100-
- package_api_docs
101-
- package_names
102-
- package_prefixed_library_names
103-
# - parameter_assignments # we do this commonly
104-
- prefer_adjacent_string_concatenation
105-
- prefer_asserts_in_initializer_lists
106-
# - prefer_asserts_with_message # not yet tested
107-
- prefer_collection_literals
108-
- prefer_conditional_assignment
109-
- prefer_const_constructors
110-
- prefer_const_constructors_in_immutables
111-
- prefer_const_declarations
112-
- prefer_const_literals_to_create_immutables
113-
# - prefer_constructors_over_static_methods # not yet tested
114-
- prefer_contains
115-
# - prefer_double_quotes # opposite of prefer_single_quotes
116-
- prefer_equal_for_default_values
117-
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
118-
- prefer_final_fields
119-
# - prefer_final_in_for_each # not yet tested
120-
- prefer_final_locals
121-
# - prefer_for_elements_to_map_fromIterable # not yet tested
122-
- prefer_foreach
123-
# - prefer_function_declarations_over_variables # not yet tested
124-
- prefer_generic_function_type_aliases
125-
# - prefer_if_elements_to_conditional_expressions # not yet tested
126-
- prefer_if_null_operators
127-
- prefer_initializing_formals
128-
- prefer_inlined_adds
129-
# - prefer_int_literals # not yet tested
130-
# - prefer_interpolation_to_compose_strings # not yet tested
131-
- prefer_is_empty
132-
- prefer_is_not_empty
133-
- prefer_iterable_whereType
134-
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
135-
# - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
136-
- prefer_single_quotes
137-
- prefer_spread_collections
138-
- prefer_typing_uninitialized_variables
139-
- prefer_void_to_null
140-
# - provide_deprecation_message # not yet tested
141-
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
142-
- recursive_getters
143-
- slash_for_doc_comments
144-
# - sort_child_properties_last # not yet tested
145-
- sort_constructors_first
146-
#- sort_pub_dependencies
147-
- sort_unnamed_constructors_first
148-
- test_types_in_equals
149-
- throw_in_finally
150-
# - type_annotate_public_apis # subset of always_specify_types
151-
- type_init_formals
152-
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
153-
# - unnecessary_await_in_return # not yet tested
154-
- unnecessary_brace_in_string_interps
155-
- unnecessary_const
156-
- unnecessary_getters_setters
157-
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
158-
- unnecessary_new
159-
- unnecessary_null_aware_assignments
160-
- unnecessary_null_in_if_null_operators
161-
- unnecessary_overrides
162-
#- unnecessary_parenthesis HP: I like parenthesis :-)
163-
- unnecessary_statements
164-
- unnecessary_this
165-
- unrelated_type_equality_checks
166-
# - unsafe_html # not yet tested
167-
- use_full_hex_values_for_flutter_colors
168-
# - use_function_type_syntax_for_parameters # not yet tested
169-
- use_rethrow_when_possible
170-
# - use_setters_to_change_properties # not yet tested
171-
# - use_string_buffers # https://github.com/dart-lang/linter/pull/664
172-
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
173-
- valid_regexps
174-
# - void_checks # not yet tested
175-

android/src/main/kotlin/design/codeux/biometric_storage/BiometricStoragePlugin.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class BiometricStoragePlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
159159
errorInfo.message.toString(),
160160
errorInfo.errorDetails
161161
)
162-
logger.error("AuthError: $errorInfo")
162+
logger.error { "AuthError: $errorInfo" }
163163

164164
}
165165

@@ -221,7 +221,7 @@ class BiometricStoragePlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
221221
}
222222
}
223223

224-
val options = call.argument<Map<String, Any>>("options")?.let { it ->
224+
val options = call.argument<Map<String, Any>>("options")?.let {
225225
InitOptions(
226226
authenticationValidityDurationSeconds = it["authenticationValidityDurationSeconds"] as Int,
227227
authenticationRequired = it["authenticationRequired"] as Boolean,
@@ -318,7 +318,7 @@ class BiometricStoragePlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
318318
}
319319

320320
private fun canAuthenticate(): CanAuthenticateResponse {
321-
val credentialsResponse = biometricManager.canAuthenticate(DEVICE_CREDENTIAL);
321+
val credentialsResponse = biometricManager.canAuthenticate(DEVICE_CREDENTIAL)
322322
logger.debug { "canAuthenticate for DEVICE_CREDENTIAL: $credentialsResponse" }
323323
if (credentialsResponse == BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED) {
324324
return CanAuthenticateResponse.Success
@@ -345,7 +345,7 @@ class BiometricStoragePlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
345345
@WorkerThread onSuccess: (cipher: Cipher?) -> Unit,
346346
onError: ErrorCallback
347347
) {
348-
logger.trace("authenticate()")
348+
logger.trace {"authenticate()" }
349349
val activity = attachedActivity ?: return run {
350350
logger.error { "We are not attached to an activity." }
351351
onError(
@@ -358,7 +358,7 @@ class BiometricStoragePlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
358358
val prompt =
359359
BiometricPrompt(activity, executor, object : BiometricPrompt.AuthenticationCallback() {
360360
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
361-
logger.trace("onAuthenticationError($errorCode, $errString)")
361+
logger.trace { "onAuthenticationError($errorCode, $errString)" }
362362
ui(onError) {
363363
onError(
364364
AuthenticationErrorInfo(
@@ -372,12 +372,12 @@ class BiometricStoragePlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
372372

373373
@WorkerThread
374374
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
375-
logger.trace("onAuthenticationSucceeded($result)")
375+
logger.trace { "onAuthenticationSucceeded($result)" }
376376
worker(onError) { onSuccess(result.cryptoObject?.cipher) }
377377
}
378378

379379
override fun onAuthenticationFailed() {
380-
logger.trace("onAuthenticationFailed()")
380+
logger.trace { "onAuthenticationFailed()" }
381381
// this just means the user was not recognised, but the O/S will handle feedback so we don't have to
382382
}
383383
})

doc/screenshot_ios.png

550 KB
Loading

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>11.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

example/ios/Flutter/Flutter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
1111
s.license = { :type => 'BSD' }
1212
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
1313
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
14-
s.ios.deployment_target = '11.0'
14+
s.ios.deployment_target = '12.0'
1515
# Framework linking is handled by Flutter tooling, not CocoaPods.
1616
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
1717
s.vendored_frameworks = 'path/to/nothing'

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '11.0'
2+
# platform :ios, '12.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ EXTERNAL SOURCES:
1515

1616
SPEC CHECKSUMS:
1717
biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9
18-
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
18+
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
1919

20-
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
20+
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011
2121

22-
COCOAPODS: 1.12.1
22+
COCOAPODS: 1.15.0

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
353353
GCC_WARN_UNUSED_FUNCTION = YES;
354354
GCC_WARN_UNUSED_VARIABLE = YES;
355-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
355+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
356356
MTL_ENABLE_DEBUG_INFO = NO;
357357
SDKROOT = iphoneos;
358358
SUPPORTED_PLATFORMS = iphoneos;
@@ -435,7 +435,7 @@
435435
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
436436
GCC_WARN_UNUSED_FUNCTION = YES;
437437
GCC_WARN_UNUSED_VARIABLE = YES;
438-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
438+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
439439
MTL_ENABLE_DEBUG_INFO = YES;
440440
ONLY_ACTIVE_ARCH = YES;
441441
SDKROOT = iphoneos;
@@ -484,7 +484,7 @@
484484
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
485485
GCC_WARN_UNUSED_FUNCTION = YES;
486486
GCC_WARN_UNUSED_VARIABLE = YES;
487-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
487+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
488488
MTL_ENABLE_DEBUG_INFO = NO;
489489
SDKROOT = iphoneos;
490490
SUPPORTED_PLATFORMS = iphoneos;

0 commit comments

Comments
 (0)