@@ -4,7 +4,7 @@ import { ApplicationManagerBase } from "../../application-manager-base";
44import { cache } from "../../../decorators" ;
55
66export class IOSApplicationManager extends ApplicationManagerBase {
7- private applicationsLiveSyncInfos : Mobile . ILiveSyncApplicationInfo [ ] ;
7+ private applicationsLiveSyncInfos : Mobile . IApplicationInfo [ ] ;
88
99 constructor ( protected $logger : ILogger ,
1010 protected $hooksService : IHooksService ,
@@ -18,7 +18,7 @@ export class IOSApplicationManager extends ApplicationManagerBase {
1818 }
1919
2020 public async getInstalledApplications ( ) : Promise < string [ ] > {
21- const applicationsLiveSyncStatus = await this . getApplicationsLiveSyncSupportedStatus ( ) ;
21+ const applicationsLiveSyncStatus = await this . getApplicationsInformation ( ) ;
2222
2323 return _ ( applicationsLiveSyncStatus )
2424 . map ( appLiveSyncStatus => appLiveSyncStatus . applicationIdentifier )
@@ -33,39 +33,21 @@ export class IOSApplicationManager extends ApplicationManagerBase {
3333 } ) ;
3434 }
3535
36- public async getApplicationInfo ( applicationIdentifier : string ) : Promise < Mobile . IApplicationInfo > {
37- if ( ! this . applicationsLiveSyncInfos || ! this . applicationsLiveSyncInfos . length ) {
38- await this . getApplicationsLiveSyncSupportedStatus ( ) ;
39- }
40-
41- return _ . find ( this . applicationsLiveSyncInfos , app => app . applicationIdentifier === applicationIdentifier ) ;
42- }
43-
44- public async getApplicationsLiveSyncSupportedStatus ( ) : Promise < Mobile . ILiveSyncApplicationInfo [ ] > {
36+ public async getApplicationsInformation ( ) : Promise < Mobile . IApplicationInfo [ ] > {
4537 const deviceIdentifier = this . device . deviceInfo . identifier ;
4638 const applicationsOnDeviceInfo = _ . first ( ( await this . $iosDeviceOperations . apps ( [ deviceIdentifier ] ) ) [ deviceIdentifier ] ) ;
4739 const applicationsOnDevice = applicationsOnDeviceInfo ? applicationsOnDeviceInfo . response : [ ] ;
48- this . $logger . trace ( "Result when getting applications for which LiveSync is enabled : " , JSON . stringify ( applicationsOnDevice , null , 2 ) ) ;
40+ this . $logger . trace ( "Result when getting applications information : " , JSON . stringify ( applicationsOnDevice , null , 2 ) ) ;
4941
5042 this . applicationsLiveSyncInfos = _ . map ( applicationsOnDevice , app => ( {
5143 applicationIdentifier : app . CFBundleIdentifier ,
52- isLiveSyncSupported : app . IceniumLiveSyncEnabled ,
5344 configuration : app . configuration ,
5445 deviceIdentifier : this . device . deviceInfo . identifier
5546 } ) ) ;
5647
5748 return this . applicationsLiveSyncInfos ;
5849 }
5950
60- public async isLiveSyncSupported ( appIdentifier : string ) : Promise < boolean > {
61- if ( ! this . applicationsLiveSyncInfos || ! this . applicationsLiveSyncInfos . length ) {
62- await this . getApplicationsLiveSyncSupportedStatus ( ) ;
63- }
64-
65- const selectedApplication = _ . find ( this . applicationsLiveSyncInfos , app => app . applicationIdentifier === appIdentifier ) ;
66- return ! ! selectedApplication && selectedApplication . isLiveSyncSupported ;
67- }
68-
6951 public async uninstallApplication ( appIdentifier : string ) : Promise < void > {
7052 await this . $iosDeviceOperations . uninstall ( appIdentifier , [ this . device . deviceInfo . identifier ] , ( err : IOSDeviceLib . IDeviceError ) => {
7153 this . $logger . warn ( `Failed to uninstall ${ appIdentifier } on device with identifier ${ err . deviceId } ` ) ;
0 commit comments