Unverified Commit 3dbd65b9 authored by Ruslan Konviser's avatar Ruslan Konviser Committed by GitHub
Browse files

Merge pull request #1259 from ever-co/feat/help-about-privacy-shopmobile

feat: implemented functionality for help/about/privacy shopMobile
parents 599b6046 a529f059
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -15,12 +15,15 @@

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

@Component({
@@ -9,36 +8,29 @@ import { environment } from 'environments/environment';
	templateUrl: 'about.html',
	styleUrls: ['about.scss'],
})
export class AboutPage {
	aboutHtml: string;
	appVersion: string;

	private _pageSubscriptions: Subscription[] = [];

	constructor(private userRouter: UserRouter, private store: Store) {
		this._getAboutHtml();
export class AboutPage implements OnInit, OnDestroy {
	public useAboutHtml: string = '<h1>Loading...</h1>';
	public selectedLanguage: string;
	private sub: Subscription;
	public deviceId: string;
	public userId: string;
	public appVersion: string;

	constructor(private userRouter: UserRouter) {
		this.selectedLanguage = localStorage.getItem('_language') || 'en-US';
		this.deviceId = localStorage.getItem('_deviceId');
		this.userId = localStorage.getItem('_userId');
		this.appVersion = environment.APP_VERSION;
	}

	get userId() {
		return this.store.carrierId;
	}

	get deviceId() {
		return this.store.deviceId;
	}

	private _getAboutHtml() {
		if (this.userId && this.deviceId) {
			const aboutSubscription = this.userRouter
				.getAboutUs(this.userId, this.deviceId)
				.subscribe((html) => (this.aboutHtml = html));

			this._pageSubscriptions.push(aboutSubscription);
		}
	ngOnInit() {
		this.sub = this.userRouter
			.getAboutUs(this.userId, this.deviceId, this.selectedLanguage)
			.subscribe((html) => {
				this.useAboutHtml = html;
			});
	}

	ionViewWillLeave() {
		this._pageSubscriptions.forEach((s) => s.unsubscribe);
	ngOnDestroy() {
		this.sub.unsubscribe();
	}
}
+13 −12
Original line number Diff line number Diff line
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';

import { UserRouter } from '@modules/client.common.angular2/routers/user-router.service';
import { Subscription } from 'rxjs';

@Component({
	selector: 'page-terms-of-use',
	templateUrl: 'terms-of-use.html',
	styleUrls: ['terms-of-use.scss'],
})
export class TermsOfUsePage implements OnInit {
export class TermsOfUsePage implements OnInit, OnDestroy {
	public useTermsHtml: string = '<h1>Loading...</h1>';
	public selectedLanguage: string;
	private sub: Subscription;
	public deviceId: string;
	public userId: string;

	constructor(private userRouter: UserRouter) {
		this.selectedLanguage = localStorage.getItem('_language');
		this.selectedLanguage = localStorage.getItem('_language') || 'en-US';
		this.deviceId = localStorage.getItem('_deviceId');
		this.userId = localStorage.getItem('_userId');
	}

	ngOnInit() {
		this.userRouter
			.getTermsOfUseByLanguage(this.selectedLanguage)
		this.sub = this.userRouter
			.getTermsOfUse(this.userId, this.deviceId, this.selectedLanguage)
			.subscribe((html) => {
				this.useTermsHtml = html;
			});
	}

	private get _userId() {
		return localStorage.getItem('_userId');
	}

	private get _deviceId() {
		return localStorage.getItem('_deviceId');
	ngOnDestroy() {
		this.sub.unsubscribe();
	}
}
+29 −8
Original line number Diff line number Diff line
@@ -60,34 +60,55 @@ export class UserRouter implements IUserRouter {
		return this._userFactory(user);
	}

	getAboutUs(userId: string, deviceId: string): Observable<string> {
	getAboutUs(
		userId: string,
		deviceId: string,
		selectedLanguage: string
	): Observable<string> {
		return this.router.runAndObserve<string>(
			'getAboutUs',
			userId,
			deviceId
			deviceId,
			selectedLanguage
		);
	}

	getTermsOfUse(userId: string, deviceId: string): Observable<string> {
	getTermsOfUse(
		userId: string,
		deviceId: string,
		selectedLanguage: string
	): Observable<string> {
		return this.router.runAndObserve<string>(
			'getTermsOfUse',
			userId,
			deviceId
			deviceId,
			selectedLanguage
		);
	}

	getTermsOfUseByLanguage(selectedLanguage: string): Observable<string> {
	getHelp(
		userId: string,
		deviceId: string,
		selectedLanguage: string
	): Observable<string> {
		return this.router.runAndObserve<string>(
			'getTermsOfUseByLanguage',
			'getHelp',
			userId,
			deviceId,
			selectedLanguage
		);
	}

	getPrivacy(userId: string, deviceId: string): Observable<string> {
	getPrivacy(
		userId: string,
		deviceId: string,
		selectedLanguage: string
	): Observable<string> {
		return this.router.runAndObserve<string>(
			'getPrivacy',
			userId,
			deviceId
			deviceId,
			selectedLanguage
		);
	}

+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
	"name": "@ever-platform/common",
	"description": "Ever Platform Shared Core",
	"license": "AGPL-3.0",
	"version": "0.3.15",
	"version": "0.3.20",
	"homepage": "https://ever.co",
	"repository": {
		"type": "git",
Loading