1+ import 'dart:async' ;
12import 'dart:convert' ;
23import 'dart:io' ;
3-
4- import 'package:cli_spin/cli_spin.dart' ;
54import 'package:cwa_plugin_core/cwa_plugin_core.dart' ;
65import 'package:react_native/config/plugin_config.dart' ;
7-
86import '../../model/specification.dart' ;
7+ import '../../utils/cli_spinner.dart' ;
98import '../../utils/download_manager.dart' ;
10-
119class ReactNativeUtils extends Command {
1210 ReactNativeUtils (super .args);
1311
@@ -54,8 +52,11 @@ class ReactNativeUtils extends Command {
5452 }
5553
5654 Future <void > _handleUtilityAndSpecification (String utilityName) async {
57- CliSpin featureLoader =
58- CliSpin (text: "Adding $utilityName to the project" ).start ();
55+ SimpleSpinner spinner = SimpleSpinner ();
56+
57+ spinner.start ("Adding $utilityName to the project" );
58+
59+ CWLogger .namedLog ("message check whether one time call or not" );
5960
6061 try {
6162 String filePath = 'specification_config.json' ;
@@ -69,18 +70,15 @@ class ReactNativeUtils extends Command {
6970 if (specsFileContent != null ) {
7071 Map <String , dynamic > specificationData = json.decode (specsFileContent);
7172
72- // Get the filePath and folderPath from the config
7373 List <dynamic > utilityFilePaths = specificationData['filePath' ] ?? [];
7474 List <dynamic > utilityFolderPaths = specificationData['folderPath' ] ?? [];
7575
76- // Handle file paths if available
7776 if (utilityFilePaths.isNotEmpty) {
7877 for (String utilityFilePath in utilityFilePaths) {
7978 await downloadManager.downloadFile (utilityFilePath, utilityName);
8079 }
8180 }
8281
83- // Handle folder paths if available
8482 if (utilityFolderPaths.isNotEmpty) {
8583 for (String utilityFolderPath in utilityFolderPaths) {
8684 await downloadManager.downloadDirectory (utilityFolderPath, utilityName);
@@ -89,15 +87,15 @@ class ReactNativeUtils extends Command {
8987
9088 await SpecificationUpdater .updateSpecifications (utilityName);
9189
92- featureLoader. success ( );
90+ spinner. stop (isSuccess : true );
9391 } else {
9492 CWLogger .i.trace ('Failed to fetch specification_config.json' );
93+ spinner.stop (isSuccess: false );
9594 }
9695 } catch (e) {
97- featureLoader. fail ( );
96+ spinner. stop (isSuccess : false );
9897 CWLogger .i.trace (
9998 'Error downloading utility $utilityName or updating specifications: $e ' );
10099 }
101100 }
102-
103101}
0 commit comments