Skip to content

Commit cb9f7e2

Browse files
authored
chore(core):mark asyncConfig api as deprecated and to be removed in 2.0.0(#4692)
1 parent a51c31e commit cb9f7e2

File tree

7 files changed

+23
-0
lines changed

7 files changed

+23
-0
lines changed

packages/amplify_core/lib/src/amplify_class.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ abstract class AmplifyClass {
9292
bool get isConfigured => _configCompleter.isCompleted;
9393

9494
/// A future when completes when Amplify has been successfully configured.
95+
@Deprecated('Will be removed in 2.0.0')
9596
Future<AmplifyConfig> get asyncConfig => _configCompleter.future;
9697

9798
/// Configures Amplify with the provided configuration string.

packages/amplify_core/test/amplify_class_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ void main() {
1919
});
2020

2121
test('completes', () async {
22+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
23+
// ignore: deprecated_member_use_from_same_package
2224
expect(Amplify.asyncConfig, completes);
2325
await Amplify.addPlugin(SuccessPlugin());
2426
expect(Amplify.configure(dummyConfiguration), completes);
2527
});
2628

2729
test('plugin is configured even if addPlugin is not awaited', () async {
30+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
31+
// ignore: deprecated_member_use_from_same_package
2832
expect(Amplify.asyncConfig, completes);
2933
final plugin = AsyncAddPlugin();
3034
unawaited(Amplify.addPlugin(plugin));
@@ -36,6 +40,8 @@ void main() {
3640

3741
test('throws for invalid JSON', () async {
3842
expect(
43+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
44+
// ignore: deprecated_member_use_from_same_package
3945
Amplify.asyncConfig,
4046
throwsA(isA<ConfigurationError>()),
4147
);
@@ -47,6 +53,8 @@ void main() {
4753

4854
test('throws for configuration exceptions', () async {
4955
expect(
56+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
57+
// ignore: deprecated_member_use_from_same_package
5058
Amplify.asyncConfig,
5159
throwsA(isA<ConfigurationError>()),
5260
);
@@ -58,6 +66,8 @@ void main() {
5866
});
5967

6068
test('throws non-configuration exceptions', () async {
69+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
70+
// ignore: deprecated_member_use_from_same_package
6171
expect(Amplify.asyncConfig, completes);
6272
await Amplify.addPlugin(NonConfigErrorPlugin());
6373
expect(

packages/auth/amplify_auth_cognito/example/integration_test/sign_out_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ void main() {
4949
environmentName: environmentName,
5050
);
5151

52+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
53+
// ignore: deprecated_member_use
5254
final config = await Amplify.asyncConfig;
5355
final authConfig = config.auth!.awsPlugin!.cognitoUserPool!.default$!;
5456
client = AWSHttpClient()

packages/auth/amplify_auth_cognito_dart/example/web/components/app_component.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ class AppComponent extends StatefulComponent {
6262
if (Amplify.isConfigured) return;
6363
try {
6464
await configure();
65+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
66+
// ignore: deprecated_member_use
6567
config = await Amplify.asyncConfig;
6668

6769
Amplify.Hub.listen(HubChannel.Auth, (AuthHubEvent event) {
6870
if (event.type == AuthHubEventType.signedIn) {
71+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
72+
// ignore: deprecated_member_use
6973
Amplify.asyncConfig.then((_) {
7074
if (!appState.authState.isAuthenticatedRoute) {
7175
setState(

packages/authenticator/amplify_authenticator/lib/amplify_authenticator.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ class _AuthenticatorState extends State<Authenticator> {
633633
}
634634

635635
Future<void> _waitForConfiguration() async {
636+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
637+
// ignore: deprecated_member_use
636638
final config = await Amplify.asyncConfig;
637639
if (!mounted) return;
638640
setState(() {

packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ class AmplifyAuthService
332332
);
333333
});
334334
try {
335+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
336+
// ignore: deprecated_member_use
335337
return await Amplify.asyncConfig;
336338
} finally {
337339
timer.cancel();

packages/storage/amplify_storage_s3_dart/lib/src/amplify_storage_s3_dart_impl.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ class AmplifyStorageS3Dart extends StoragePluginInterface
123123
);
124124

125125
scheduleMicrotask(() async {
126+
// TODO(nikahsn): remove after making the api internal in 2.0.0.
127+
// ignore: deprecated_member_use
126128
await Amplify.asyncConfig;
127129
if (_zIsTest) {
128130
return;

0 commit comments

Comments
 (0)