File
Implements
Methods
Async
ngOnInit
|
ngOnInit()
|
|
|
openThirdPartyApps
|
openThirdPartyApps(packageId: string, appListAvailability)
|
|
Parameters :
Name |
Type |
Optional |
packageId |
string
|
No
|
appListAvailability |
|
No
|
|
appListAvailability
|
Type : object
|
Default value : {}
|
|
appLists
|
Type : []
|
Default value : []
|
|
appName
|
Type : string
|
Default value : ''
|
|
isAppListAvailable
|
Default value : false
|
|
import {Component, OnInit} from '@angular/core';
import {CommonUtilService, TelemetryGeneratorService, UtilityService} from '@app/services';
import {NavParams, PopoverController} from '@ionic/angular';
@Component({
selector: 'show-vendor-apps',
templateUrl: './show-vendor-apps.component.html',
styleUrls: ['./show-vendor-apps.component.scss'],
})
export class ShowVendorAppsComponent implements OnInit {
appLists = [];
content: any;
appListAvailability = {};
isAppListAvailable = false;
appName = '';
constructor(
private navParams: NavParams,
private utilityService: UtilityService,
private telemetryGeneratorService: TelemetryGeneratorService,
private popOverCtrl: PopoverController,
private commonUtilService: CommonUtilService
) {
this.content = this.navParams.get('content');
this.appLists = this.navParams.get('appLists');
}
async ngOnInit() {
this.appName = await this.commonUtilService.getAppName();
this.appListAvailability = await this.utilityService.checkAvailableAppList(this.appLists.map((a) => a.android.packageId));
this.isAppListAvailable = Object.keys(this.appListAvailability).some((packageId) => {
return this.appListAvailability[packageId];
});
}
openThirdPartyApps(packageId: string, appListAvailability) {
if (appListAvailability) {
this.utilityService.startActivityForResult({
package: packageId,
extras: {
content: this.content
},
requestCode: 101,
}).then((result: any) => {
const telemetryResult = result.extras;
this.telemetryGeneratorService.generateSummaryTelemetry(
telemetryResult.edata.type,
telemetryResult.edata.starttime,
telemetryResult.edata.endtime,
telemetryResult.edata.timespent,
telemetryResult.edata.pageviews,
telemetryResult.edata.interactions,
'home'
);
this.popOverCtrl.dismiss();
}).catch((error) => {
// error
console.log('------------', error);
});
} else {
this.utilityService.openPlayStore(packageId);
}
}
}
<ion-header class="sb-popover-header">
<ion-toolbar class="sb-popover-toolbar">
<ion-title class="sb-popover-title">{{'FRMELEMNTS_LBL_OPEN_CONTENT_WITH' | translate}}
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-grid>
<ion-row>
<ion-col size="12" *ngIf="!isAppListAvailable">
{{'FRMELEMENTS_VENDOR_APP_DESCRIPTION' | translate: {'appName': appName} }}
</ion-col>
</ion-row>
<ion-row>
<ion-col size="4" *ngFor="let apps of appLists">
<div class="app-content" [ngClass]="{'not-available': isAppListAvailable && !appListAvailability[apps?.android?.packageId]}"
(click)="openThirdPartyApps(apps?.android?.packageId, appListAvailability[apps?.android?.packageId])">
<img class="app-logo" [src]="apps?.logo" alt="">
{{apps.name}}
</div>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
.app-content {
display: flex;
flex-direction: column;
align-items: center;
}
.not-available {
filter: grayscale(1);
}
Legend
Html element with directive