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