parent
e9176adb80
commit
b11ea8e215
2 changed files with 41 additions and 27 deletions
|
@ -57,9 +57,9 @@ export class MyApp {
|
||||||
|
|
||||||
this.statusBar.styleDefault();
|
this.statusBar.styleDefault();
|
||||||
this.splashScreen.hide();
|
this.splashScreen.hide();
|
||||||
console.log('---');
|
// console.log('---');
|
||||||
console.log(this.device.platform);
|
// console.log(this.device.platform);
|
||||||
console.log('---');
|
// console.log('---');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,8 @@ export class MyApp {
|
||||||
// Reset the content nav to have just this page
|
// Reset the content nav to have just this page
|
||||||
// we wouldn't want the back button to show in this scenario
|
// we wouldn't want the back button to show in this scenario
|
||||||
if (page.title === 'Logout') {
|
if (page.title === 'Logout') {
|
||||||
this.storage.remove('token');
|
// this.storage.remove('token');
|
||||||
|
this.storage.clear();
|
||||||
this.nav.setRoot(LoginPage);
|
this.nav.setRoot(LoginPage);
|
||||||
} else if (page.title === 'Settings') {
|
} else if (page.title === 'Settings') {
|
||||||
this.nav.push(page.component, page.params);
|
this.nav.push(page.component, page.params);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, ViewChild, ChangeDetectorRef } from '@angular/core';
|
import { Component, ViewChild, ChangeDetectorRef } from '@angular/core';
|
||||||
import { ViewController, NavController, NavParams, ModalController, Content, ToastController, PopoverController } from 'ionic-angular';
|
import { ViewController, NavController, NavParams, ModalController, Content, ToastController, PopoverController } from 'ionic-angular';
|
||||||
import { ThreadPage } from '../thread/thread';
|
import { ThreadPage } from '../thread/thread';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
import * as pnut from 'pnut-butter';
|
import * as pnut from 'pnut-butter';
|
||||||
|
|
||||||
|
@ -26,11 +27,16 @@ export class StreamPage {
|
||||||
fcaller: any;
|
fcaller: any;
|
||||||
myUsername: string;
|
myUsername: string;
|
||||||
showScrollBtn: boolean = false;
|
showScrollBtn: boolean = false;
|
||||||
|
showUnified: boolean;
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController,
|
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController,
|
||||||
private changeDetectorRef: ChangeDetectorRef, public toastCtrl: ToastController, public popoverCtrl: PopoverController) {
|
private changeDetectorRef: ChangeDetectorRef, public toastCtrl: ToastController, private storage: Storage,
|
||||||
|
public popoverCtrl: PopoverController) {
|
||||||
// console.log(JSON.stringify(navParams));
|
// console.log(JSON.stringify(navParams));
|
||||||
|
|
||||||
|
this.storage.get('unified').then((val) => {
|
||||||
|
this.showUnified = val;
|
||||||
|
|
||||||
switch (navParams.data.stream) {
|
switch (navParams.data.stream) {
|
||||||
case 'global':
|
case 'global':
|
||||||
this.title = 'Global';
|
this.title = 'Global';
|
||||||
|
@ -39,7 +45,8 @@ export class StreamPage {
|
||||||
break;
|
break;
|
||||||
case 'personal':
|
case 'personal':
|
||||||
this.title = 'Timeline';
|
this.title = 'Timeline';
|
||||||
this.fetcher = pnut.personal;
|
console.log(this.showUnified);
|
||||||
|
this.fetcher = this.showUnified ? pnut.unified : pnut.personal;
|
||||||
this.fetchPosts();
|
this.fetchPosts();
|
||||||
break;
|
break;
|
||||||
case 'mentions':
|
case 'mentions':
|
||||||
|
@ -53,6 +60,12 @@ export class StreamPage {
|
||||||
this.fetchMyPosts();
|
this.fetchMyPosts();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR: ' + err);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
pnut.user('me').then(res => {
|
pnut.user('me').then(res => {
|
||||||
this.myUsername = res.data.username;
|
this.myUsername = res.data.username;
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|
Reference in a new issue