Commit b7484861 authored by sunko's avatar sunko
Browse files

feat: implemented about us in merchant app

parent 255a9b41
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -11,16 +11,11 @@
	</div>
</div>

<ion-content scroll="true" class="app-view has-header" padding>
	<loading [hidden]="aboutHtml !== null"></loading>
<ion-content padding class="app-view">
	<loading class="pt-4" [hidden]="useAboutHtml !== null"></loading>
	<div
		*ngIf="aboutHtml !== null"
		[innerHTML]="aboutHtml | safe: 'html'"
		class="pt-4"
		*ngIf="useAboutHtml !== null"
		[innerHTML]="useAboutHtml | safe: 'html'"
	></div>
	<h5
		style="padding-left: 10px; padding-top: 20px; color: #888;"
		*ngIf="aboutHtml !== null"
	>
		{{ 'ABOUT_VIEW.APP_VERSION' | translate }}: {{ appVersion }}
	</h5>
</ion-content>
+14 −32
Original line number Diff line number Diff line
import { Component, OnDestroy } from '@angular/core';
import { UserRouter } from '@modules/client.common.angular2/routers/user-router.service';
import { Store } from 'services/store.service';
import { environment } from 'environments/environment';
import { Subscription } from 'rxjs';

@Component({
	selector: 'page-about',
	templateUrl: 'about.html',
})
export class AboutPage implements OnDestroy {
	public aboutHtml: string;

	private s$: any;

	public appVersion: string;

	constructor(private userRouter: UserRouter, private store: Store) {
		this._getAboutHtml();
		this.appVersion = environment.APP_VERSION;
	}

	get userId() {
		return localStorage.getItem('_userId');
	public useAboutHtml: string = '<h1>Loading...</h1>';
	public selectedLanguage: string;
	private sub: Subscription;
	constructor(private userRouter: UserRouter) {
		this.selectedLanguage = localStorage.getItem('_language');
	}

	get deviceId() {
		return localStorage.getItem('_deviceId');
	}

	private _getAboutHtml() {
		const deviceId = this.deviceId;
		if (this.userId && deviceId) {
			this.s$ = this.userRouter
				.getAboutUs(this.userId, deviceId)
	ngOnInit() {
		this.sub = this.userRouter
			.getAboutUsByLanguage(this.selectedLanguage)
			.subscribe((html) => {
					this.aboutHtml = html;
				this.useAboutHtml = html;
			});
	}
	}

	ngOnDestroy(): void {
		if (this.s$) {
			this.s$.unsubscribe();
		}
	ngOnDestroy() {
		this.sub.unsubscribe();
	}
}