Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a0a3910

Browse files
authored
[local_auth] Fix retain self warning and pod lint warnings (#2685)
1 parent 6d9b8ea commit a0a3910

3 files changed

Lines changed: 23 additions & 16 deletions

File tree

packages/local_auth/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* Remove Android dependencies fallback.
44
* Require Flutter SDK 1.12.13+hotfix.5 or greater.
5+
* Fix block implicitly retains 'self' warning.
6+
* Fix CocoaPods podspec lint warnings.
57

68
## 0.6.1+4
79

packages/local_auth/ios/Classes/FLTLocalAuthPlugin.m

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
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

packages/local_auth/ios/local_auth.podspec

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
Pod::Spec.new do |s|
55
s.name = 'local_auth'
66
s.version = '0.0.1'
7-
s.summary = 'A new flutter plugin project.'
7+
s.summary = 'Flutter Local Auth'
88
s.description = <<-DESC
9-
A new flutter plugin project.
9+
This Flutter plugin provides means to perform local, on-device authentication of the user.
10+
Downloaded by pub (not CocoaPods).
1011
DESC
11-
s.homepage = 'http://example.com'
12-
s.license = { :file => '../LICENSE' }
13-
s.author = { 'Your Company' => '[email protected]' }
14-
s.source = { :path => '.' }
12+
s.homepage = 'https://github.com/flutter/plugins'
13+
s.license = { :type => 'BSD', :file => '../LICENSE' }
14+
s.author = { 'Flutter Dev Team' => '[email protected]' }
15+
s.source = { :http => 'https://github.com/flutter/plugins/tree/master/packages/local_auth' }
16+
s.documentation_url = 'https://pub.dev/packages/local_auth'
1517
s.source_files = 'Classes/**/*'
1618
s.public_header_files = 'Classes/**/*.h'
1719
s.dependency 'Flutter'

0 commit comments

Comments
 (0)