Skip to content

Commit

Permalink
chore: remove deprecated method - configureModelProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Fang committed Jun 28, 2021
1 parent d23a816 commit 00dbc7a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 52 deletions.
15 changes: 0 additions & 15 deletions packages/amplify_datastore/lib/amplify_datastore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,6 @@ class AmplifyDataStore extends DataStorePluginInterface {
return streamWrapper.datastoreStreamController;
}

@deprecated
@override
Future<void> configureModelProvider(
{ModelProviderInterface? modelProvider}) async {
ModelProviderInterface provider =
(modelProvider == null ? this.modelProvider : modelProvider)!;
if (provider.modelSchemas.isEmpty) {
throw DataStoreException('No modelProvider or modelSchemas found',
recoverySuggestion:
'Pass in a modelProvider instance while instantiating DataStorePlugin');
}
streamWrapper.registerModelsForHub(provider);
return _instance.configureModelProvider(modelProvider: modelProvider);
}

@override
Future<void> configureDataStore(
{ModelProviderInterface? modelProvider,
Expand Down
30 changes: 0 additions & 30 deletions packages/amplify_datastore/lib/method_channel_datastore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,6 @@ class AmplifyDataStoreMethodChannel extends AmplifyDataStore {
/// Internal use constructor
AmplifyDataStoreMethodChannel() : super.tokenOnly();

/// This method adds model schemas which is necessary to instantiate native plugins
/// This is needed before the Amplify.configure() can be called, since the native
/// plugins are needed to be added before that. As this function is marked for
/// deprecation, it actually now invokes configureDataStore internally.
/// NOTE: modelProvider is nullable because the parent AmplifyDataStore class
/// provides a default value
@deprecated
@override
Future<void> configureModelProvider(
{ModelProviderInterface? modelProvider}) async {
try {
return await _channel
.invokeMethod('configureDataStore', <String, dynamic>{
'modelSchemas': modelProvider!.modelSchemas
.map((schema) => schema.toMap())
.toList(),
'modelProviderVersion': modelProvider.version
});
} on PlatformException catch (e) {
if (e.code == "AmplifyAlreadyConfiguredException") {
throw AmplifyAlreadyConfiguredException(
AmplifyExceptionMessages.alreadyConfiguredDefaultMessage,
recoverySuggestion:
AmplifyExceptionMessages.alreadyConfiguredDefaultSuggestion);
} else {
throw _deserializeException(e);
}
}
}

/// This method instantiates the native DataStore plugins with plugin
/// configurations. This needs to happen before Amplify.configure() can be
/// called.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ abstract class DataStorePluginInterface extends AmplifyPluginInterface {
'streamController getter has not been implemented.');
}

@deprecated
Future<void> configureModelProvider(
{required ModelProviderInterface modelProvider}) {
throw UnimplementedError(
'configureModelProvider() has not been implemented.');
}

/// Configure AmplifyDataStore plugin with mandatory [modelProvider]
/// and optional datastore configuration properties including
///
Expand Down

0 comments on commit 00dbc7a

Please sign in to comment.