@@ -34,17 +34,17 @@ class LegacyCredentialProviderIOS implements LegacyCredentialProvider {
34
34
AuthOutputs authOutputs,
35
35
) async {
36
36
CognitoUserPoolTokens ? userPoolTokens;
37
- if (authOutputs.userPoolClientId != null ) {
37
+ final userPoolClientId = authOutputs.userPoolClientId;
38
+ if (userPoolClientId != null ) {
38
39
final userPoolStorage = await _getUserPoolStorage ();
39
- final cognitoUserKeys =
40
- LegacyCognitoUserKeys (authOutputs.userPoolClientId! );
40
+ final cognitoUserKeys = LegacyCognitoUserKeys (userPoolClientId);
41
41
final currentUserId = await userPoolStorage.read (
42
42
key: cognitoUserKeys[LegacyCognitoKey .currentUser],
43
43
);
44
44
if (currentUserId != null ) {
45
45
final userPoolKeys = LegacyCognitoUserPoolKeys (
46
46
currentUserId,
47
- authOutputs. userPoolClientId! ,
47
+ userPoolClientId,
48
48
);
49
49
final accessToken = await userPoolStorage.read (
50
50
key: userPoolKeys[LegacyCognitoUserPoolKey .accessToken],
@@ -72,9 +72,10 @@ class LegacyCredentialProviderIOS implements LegacyCredentialProvider {
72
72
73
73
String ? identityId;
74
74
AWSCredentials ? awsCredentials;
75
- if (authOutputs.identityPoolId != null ) {
75
+ final identityPoolId = authOutputs.identityPoolId;
76
+ if (identityPoolId != null ) {
76
77
final identityPoolStorage = await _getIdentityPoolStorage (
77
- authOutputs. identityPoolId! ,
78
+ identityPoolId,
78
79
);
79
80
const identityPoolKeys = LegacyCognitoIdentityPoolKeys ();
80
81
identityId = await identityPoolStorage.read (
@@ -125,17 +126,17 @@ class LegacyCredentialProviderIOS implements LegacyCredentialProvider {
125
126
Future <void > deleteLegacyCredentials (
126
127
AuthOutputs authOutputs,
127
128
) async {
128
- if (authOutputs.userPoolClientId != null ) {
129
+ final userPoolClientId = authOutputs.userPoolClientId;
130
+ if (userPoolClientId != null ) {
129
131
final userPoolStorage = await _getUserPoolStorage ();
130
- final cognitoUserKeys =
131
- LegacyCognitoUserKeys (authOutputs.userPoolClientId! );
132
+ final cognitoUserKeys = LegacyCognitoUserKeys (userPoolClientId);
132
133
final currentUser = await userPoolStorage.read (
133
134
key: cognitoUserKeys[LegacyCognitoKey .currentUser],
134
135
);
135
136
if (currentUser != null ) {
136
137
final userPoolKeys = LegacyCognitoUserPoolKeys (
137
138
currentUser,
138
- authOutputs. userPoolClientId! ,
139
+ userPoolClientId,
139
140
);
140
141
await userPoolStorage.deleteMany ([
141
142
userPoolKeys[LegacyCognitoUserPoolKey .accessToken],
@@ -165,17 +166,18 @@ class LegacyCredentialProviderIOS implements LegacyCredentialProvider {
165
166
String username,
166
167
AuthOutputs authOutputs,
167
168
) async {
168
- if (authOutputs.userPoolClientId == null ) return null ;
169
+ final userPoolClientId = authOutputs.userPoolClientId;
170
+ if (userPoolClientId == null ) return null ;
169
171
final userPoolStorage = await _getUserPoolStorage ();
170
- final cognitoUserKeys =
171
- LegacyCognitoUserKeys (authOutputs.userPoolClientId! );
172
+ final cognitoUserKeys = LegacyCognitoUserKeys (userPoolClientId);
172
173
final currentUserId = await userPoolStorage.read (
173
174
key: cognitoUserKeys[LegacyCognitoKey .currentUser],
174
175
);
175
- if (currentUserId == null || authOutputs.userPoolId == null ) return null ;
176
+ final userPoolId = authOutputs.userPoolId;
177
+ if (currentUserId == null || userPoolId == null ) return null ;
176
178
final keys = LegacyDeviceSecretKeys (
177
179
currentUserId,
178
- authOutputs. userPoolId! ,
180
+ userPoolId,
179
181
);
180
182
final deviceKey = await userPoolStorage.read (
181
183
key: keys[LegacyDeviceSecretKey .id],
@@ -187,7 +189,7 @@ class LegacyCredentialProviderIOS implements LegacyCredentialProvider {
187
189
key: keys[LegacyDeviceSecretKey .group],
188
190
);
189
191
190
- final asfKeys = LegacyAsfDeviceKeys (currentUserId, authOutputs. userPoolId! );
192
+ final asfKeys = LegacyAsfDeviceKeys (currentUserId, userPoolId);
191
193
final asfDeviceId = await userPoolStorage.read (
192
194
key: asfKeys[LegacyAsfDeviceKey .id],
193
195
);
@@ -205,16 +207,17 @@ class LegacyCredentialProviderIOS implements LegacyCredentialProvider {
205
207
String username,
206
208
AuthOutputs authOutputs,
207
209
) async {
208
- if (authOutputs.userPoolClientId == null ) return ;
210
+ final userPoolClientId = authOutputs.userPoolClientId;
211
+ if (userPoolClientId == null ) return ;
209
212
final userPoolStorage = await _getUserPoolStorage ();
210
- final cognitoUserKeys =
211
- LegacyCognitoUserKeys (authOutputs.userPoolClientId! );
213
+ final cognitoUserKeys = LegacyCognitoUserKeys (userPoolClientId);
212
214
final currentUserId = await userPoolStorage.read (
213
215
key: cognitoUserKeys[LegacyCognitoKey .currentUser],
214
216
);
215
- if (currentUserId == null || authOutputs.userPoolId == null ) return ;
216
- final keys = LegacyDeviceSecretKeys (currentUserId, authOutputs.userPoolId! );
217
- final asfKeys = LegacyAsfDeviceKeys (currentUserId, authOutputs.userPoolId! );
217
+ final userPoolId = authOutputs.userPoolId;
218
+ if (currentUserId == null || userPoolId == null ) return ;
219
+ final keys = LegacyDeviceSecretKeys (currentUserId, userPoolId);
220
+ final asfKeys = LegacyAsfDeviceKeys (currentUserId, userPoolId);
218
221
await userPoolStorage.deleteMany ([
219
222
keys[LegacyDeviceSecretKey .id],
220
223
keys[LegacyDeviceSecretKey .secret],
0 commit comments