File

src/app/modules/public/module/offline/components/about-us/about-us.component.ts

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods

Constructor

constructor(appUpdateService: AppUpdateService, router: Router, activatedRoute: ActivatedRoute, toasterService: ToasterService, connectionService: ConnectionService, resourceService: ResourceService)
Parameters :
Name Type Optional
appUpdateService AppUpdateService No
router Router No
activatedRoute ActivatedRoute No
toasterService ToasterService No
connectionService ConnectionService No
resourceService ResourceService No

Methods

checkOnlineStatus
checkOnlineStatus()
Returns : void
getAppInfo
getAppInfo()
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void
setTelemetryData
setTelemetryData()
Returns : void
updateApp
updateApp(url)
Parameters :
Name Optional
url No
Returns : void

Properties

Public activatedRoute
Type : ActivatedRoute
appInfo
Type : IAppInfo
instance
Type : string
isConnected
Public resourceService
Type : ResourceService
Public telemetryImpression
Type : IImpressionEventInput
Public telemetryInteractButtonEData
Type : IInteractEventEdata
Public telemetryInteractEData
Type : IInteractEventEdata
Public unsubscribe$
Default value : new Subject<void>()
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ResourceService, ServerResponse, ToasterService, ConnectionService } from '@sunbird/shared';
import { IImpressionEventInput, IInteractEventEdata } from '@sunbird/telemetry';
import * as _ from 'lodash-es';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { IAppInfo } from './../../interfaces';
import { AppUpdateService } from '../../../../../core/services/app-update/app-update.service';

@Component({
  selector: 'app-about-us',
  templateUrl: './about-us.component.html',
  styleUrls: ['./about-us.component.scss']
})
export class AboutUsComponent implements OnInit, OnDestroy {
  instance: string;
  appInfo: IAppInfo;
  public unsubscribe$ = new Subject<void>();
  public telemetryImpression: IImpressionEventInput;
  public telemetryInteractButtonEData: IInteractEventEdata;
  public telemetryInteractEData: IInteractEventEdata;
  isConnected;

  constructor(
    private appUpdateService: AppUpdateService,
    private router: Router, public activatedRoute: ActivatedRoute,
    private toasterService: ToasterService,
    private connectionService: ConnectionService,
    public resourceService: ResourceService
  ) { }

  ngOnInit() {
    this.instance = _.upperCase(this.resourceService.instance);
    this.getAppInfo();
    this.checkOnlineStatus();
  }

  checkOnlineStatus() {
    this.connectionService.monitor().pipe(takeUntil(this.unsubscribe$)).subscribe(isConnected => {
      this.isConnected = isConnected;
    });
  }

  getAppInfo() {
    this.appUpdateService.getAppInfo().pipe(takeUntil(this.unsubscribe$)).subscribe((response: ServerResponse) => {
      this.appInfo = _.get(response, 'result');
      this.setTelemetryData();
    });
  }

  updateApp(url) {
    const link = document.createElement('a');
    link.setAttribute('target', '_blank');
    link.setAttribute('href', url);
    document.body.appendChild(link);
    link.click();
    link.remove();
  }

  setTelemetryData() {
    this.telemetryImpression = {
      context: { env: _.get(this.activatedRoute.snapshot.data.telemetry, 'env') || 'about-us' },
      edata: {
        type: 'view',
        pageid: _.get(this.activatedRoute.snapshot.data.telemetry, 'pageid') || 'about-us',
        uri: this.router.url
      }
    };
    this.telemetryInteractButtonEData = {
      id: 'update-app-btn',
      type: 'click',
      pageid: _.get(this.activatedRoute.snapshot.data.telemetry, 'pageid') || 'about-us',
      extra: {
        newVersion: _.get(this.appInfo, 'updateInfo.version')
      }
    };
  }
  ngOnDestroy() {
    this.unsubscribe$.next();
    this.unsubscribe$.complete();
  }
}
<div class="relative9 about-page pt-32" [appTelemetryImpression]="telemetryImpression">
  <div class="mt-24 sb-bg-color-white ui container">
    <div class="sb-about-title">
      <div class="font-weight-bold pt-16 px-16 pb-8 fmedium text-left">{{resourceService?.frmelmnts?.lbl?.desktop?.app | interpolate:'{instance}': instance}}</div>
    </div>

    <div class="d-flex flex-ai-center p-16 flex-w-wrap">
      <!-- left container -->
      <div class="d-flex flex-dc">
        <dl class="sb-left-content mt-8 mb-0">
            <dt class="font-weight-bold fs-0-92">{{resourceService?.frmelmnts?.lbl?.versionKey}}</dt>
            <dd class="list-value fs-0-92 ml-8">{{appInfo?.version}}</dd>
        </dl>
        <dl class="sb-left-content mt-8 mb-0">
            <dt class="font-weight-bold fs-0-92">{{resourceService?.frmelmnts?.lbl?.releaseDateKey}}</dt>
            <dd class="list-value fs-0-92 ml-8" id="date">{{appInfo?.releaseDate | date: 'dd/MM/yyyy'}}</dd>
        </dl>
        <dl class="sb-left-content mt-8 mb-0">
            <dt class="font-weight-bold fs-0-92">{{resourceService?.frmelmnts?.lbl?.supportedLanguages}}</dt>
            <dd class="list-value fs-0-92 ml-8">{{appInfo?.languages}}</dd>
        </dl>
        <dl class="sb-left-content mt-8 mb-0">
              <dt class="font-weight-bold fs-0-92">{{resourceService?.frmelmnts?.lbl?.deviceId}}:</dt>
              <dd class="list-value fs-0-92 ml-8">{{appInfo?.deviceId}}</dd>
          </dl>
      </div>
      <!-- right container -->
      <div class="ml-auto d-flex flex-dc flex-ai-end flex-as-flex-end mt-16" *ngIf="appInfo?.updateInfo?.updateAvailable">
        <button class="sb-btn sb-btn-secondary sb-btn-normal" tabindex="0" (click)="updateApp(appInfo?.updateInfo?.url)" appTelemetryInteract [telemetryInteractEdata]="telemetryInteractButtonEData">{{resourceService?.frmelmnts?.lbl?.desktop?.update | interpolate:'{instance}': instance}}</button>
        <span  class="mt-8 text-right update-link">{{resourceService?.frmelmnts?.lbl?.desktop?.updateAvailable}} {{appInfo?.updateInfo?.version}}</span>
      </div>
    </div>
  </div>
</div>

./about-us.component.scss

@use "@project-sunbird/sb-styles/assets/mixins/mixins" as *;

.sb-about-title {
  border-bottom: calculateRem(1px) solid var(--primary-color);
  color: var(--primary-color);
}

.policy-iframe {
  width: 100%;
  height: 100%;
}

.sb-left-content {
  display: inline-flex;
  color: var(--gray-400);

  @include respond-below(sm) {
    display: block;
  }

  .list-value {
    word-break: break-all;

    @include respond-below(sm) {
      margin-left: 0rem;
    }
  }
}
.update-link {
  color: var(--blue);
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""