From 416afd596c491b32fd48ee14ee16307a50762bef Mon Sep 17 00:00:00 2001 From: salah3x Date: Tue, 30 Jul 2019 22:48:07 +0100 Subject: [PATCH] Fix #31 --- src/app/app.component.ts | 4 +--- src/app/shared/store.service.ts | 4 ++-- src/app/tabs/tabs.page.ts | 12 +++++++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 719ece1..3b2dd2c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -2,14 +2,13 @@ import { Component } from '@angular/core'; import { Platform } from '@ionic/angular'; import { Plugins, Capacitor } from '@capacitor/core'; -import { StoreService } from './shared/store.service'; @Component({ selector: 'app-root', templateUrl: 'app.component.html' }) export class AppComponent { - constructor(private platform: Platform, private store: StoreService) { + constructor(private platform: Platform) { this.initializeApp(); } @@ -19,6 +18,5 @@ export class AppComponent { Plugins.SplashScreen.hide(); } }); - this.store.shareMyLocation(); } } diff --git a/src/app/shared/store.service.ts b/src/app/shared/store.service.ts index f0dd9d1..8264a95 100644 --- a/src/app/shared/store.service.ts +++ b/src/app/shared/store.service.ts @@ -306,14 +306,14 @@ export class StoreService { tap(() => { this.subs.unsubscribe(); if (sharing) { - this.shareMyLocation(); + this.startSharingMyLocation(); } }) ) .toPromise(); } - shareMyLocation(): void { + startSharingMyLocation(): void { this.subs = this.getUser() .pipe( switchMap(user => diff --git a/src/app/tabs/tabs.page.ts b/src/app/tabs/tabs.page.ts index 8b414d5..02e0f2c 100644 --- a/src/app/tabs/tabs.page.ts +++ b/src/app/tabs/tabs.page.ts @@ -1,10 +1,16 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; + +import { StoreService } from '../shared/store.service'; @Component({ selector: 'app-tabs', templateUrl: 'tabs.page.html', styleUrls: ['tabs.page.scss'] }) -export class TabsPage { - constructor() {} +export class TabsPage implements OnInit { + constructor(private store: StoreService) {} + + ngOnInit() { + this.store.startSharingMyLocation(); + } }