55
66#import " FLTLocalAuthPlugin.h"
77
8- @implementation FLTLocalAuthPlugin {
9- NSDictionary *lastCallArgs;
10- FlutterResult lastResult;
11- }
8+ @interface FLTLocalAuthPlugin ()
9+ @property (copy , nullable ) NSDictionary <NSString *, NSNumber *> *lastCallArgs;
10+ @property (nullable ) FlutterResult lastResult;
11+ @end
12+
13+ @implementation FLTLocalAuthPlugin
14+
1215+ (void )registerWithRegistrar : (NSObject <FlutterPluginRegistrar> *)registrar {
1316 FlutterMethodChannel *channel =
1417 [FlutterMethodChannel methodChannelWithName: @" plugins.flutter.io/local_auth"
@@ -91,8 +94,8 @@ - (void)authenticateWithBiometrics:(NSDictionary *)arguments
9194 withFlutterResult : (FlutterResult)result {
9295 LAContext *context = [[LAContext alloc ] init ];
9396 NSError *authError = nil ;
94- lastCallArgs = nil ;
95- lastResult = nil ;
97+ self. lastCallArgs = nil ;
98+ self. lastResult = nil ;
9699 context.localizedFallbackTitle = @" " ;
97100
98101 if ([context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics
@@ -114,8 +117,8 @@ - (void)authenticateWithBiometrics:(NSDictionary *)arguments
114117 return ;
115118 case LAErrorSystemCancel:
116119 if ([arguments[@" stickyAuth" ] boolValue ]) {
117- lastCallArgs = arguments;
118- lastResult = result;
120+ self. lastCallArgs = arguments;
121+ self. lastResult = result;
119122 return ;
120123 }
121124 }
@@ -158,8 +161,8 @@ - (void)handleErrors:(NSError *)authError
158161#pragma mark - AppDelegate
159162
160163- (void )applicationDidBecomeActive : (UIApplication *)application {
161- if (lastCallArgs != nil && lastResult != nil ) {
162- [self authenticateWithBiometrics: lastCallArgs withFlutterResult: lastResult];
164+ if (self. lastCallArgs != nil && self. lastResult != nil ) {
165+ [self authenticateWithBiometrics: _lastCallArgs withFlutterResult: self . lastResult];
163166 }
164167}
165168
0 commit comments