@@ -12,10 +12,7 @@ import {
12
12
AnalyticsEventLabelDelimiter ,
13
13
CONFIG_FILE_NAME_JS ,
14
14
CONFIG_FILE_NAME_TS ,
15
- SCOPED_IOS_RUNTIME_NAME ,
16
- SCOPED_ANDROID_RUNTIME_NAME ,
17
- TNS_IOS_RUNTIME_NAME ,
18
- TNS_ANDROID_RUNTIME_NAME ,
15
+ SupportedPlatform ,
19
16
} from "../constants" ;
20
17
import {
21
18
IProjectDataService ,
@@ -79,6 +76,14 @@ export class PrepareController extends EventEmitter {
79
76
await this . $markingModeService . handleMarkingModeFullDeprecation ( {
80
77
projectDir : projectData . projectDir ,
81
78
} ) ;
79
+
80
+ this . $projectConfigService . writeLegacyNSConfigIfNeeded (
81
+ projectData . projectDir ,
82
+ this . $projectDataService . getRuntimePackage (
83
+ projectData . projectDir ,
84
+ prepareData . platform as SupportedPlatform
85
+ )
86
+ ) ;
82
87
}
83
88
84
89
await this . trackRuntimeVersion ( prepareData . platform , projectData ) ;
@@ -443,32 +448,22 @@ export class PrepareController extends EventEmitter {
443
448
platform : string ,
444
449
projectData : IProjectData
445
450
) : Promise < void > {
446
- let runtimeVersion : string = null ;
447
- try {
448
- if ( projectData . devDependencies ) {
449
- if ( platform . toLowerCase ( ) === "ios" ) {
450
- runtimeVersion =
451
- projectData . devDependencies [ SCOPED_IOS_RUNTIME_NAME ] ||
452
- projectData . devDependencies [ TNS_IOS_RUNTIME_NAME ] ;
453
- } else {
454
- runtimeVersion =
455
- projectData . devDependencies [ SCOPED_ANDROID_RUNTIME_NAME ] ||
456
- projectData . devDependencies [ TNS_ANDROID_RUNTIME_NAME ] ;
457
- }
458
- }
459
- } catch ( err ) {
451
+ const { version } = this . $projectDataService . getRuntimePackage (
452
+ projectData . projectDir ,
453
+ platform as SupportedPlatform
454
+ ) ;
455
+
456
+ if ( ! version ) {
460
457
this . $logger . trace (
461
- `Unable to get runtime version for project directory: ${ projectData . projectDir } and platform ${ platform } . Error is: ` ,
462
- err
458
+ `Unable to get runtime version for project directory: ${ projectData . projectDir } and platform ${ platform } .`
463
459
) ;
460
+ return ;
464
461
}
465
462
466
- if ( runtimeVersion ) {
467
- await this . $analyticsService . trackEventActionInGoogleAnalytics ( {
468
- action : TrackActionNames . UsingRuntimeVersion ,
469
- additionalData : `${ platform . toLowerCase ( ) } ${ AnalyticsEventLabelDelimiter } ${ runtimeVersion } ` ,
470
- } ) ;
471
- }
463
+ await this . $analyticsService . trackEventActionInGoogleAnalytics ( {
464
+ action : TrackActionNames . UsingRuntimeVersion ,
465
+ additionalData : `${ platform . toLowerCase ( ) } ${ AnalyticsEventLabelDelimiter } ${ version } ` ,
466
+ } ) ;
472
467
}
473
468
}
474
469
injector . register ( "prepareController" , PrepareController ) ;
0 commit comments