Added setting for default timeline, issue #40
This commit is contained in:
parent
d0269b11a3
commit
db9cd43d58
3 changed files with 36 additions and 5 deletions
|
@ -45,14 +45,14 @@ export class MyApp {
|
|||
// Okay, so the platform is ready and our plugins are available.
|
||||
// Here you can do any higher level native things you might need.
|
||||
|
||||
this.storage.get('token').then((val) => {
|
||||
this.storage.get('timeline').then((val) => {
|
||||
if (val.length > 1) {
|
||||
pnut.token = val;
|
||||
this.nav.setRoot(StreamPage, {stream: 'personal'});
|
||||
this.initialPage(val);
|
||||
} else {
|
||||
console.log('ERR WHUT?');
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log('ERROR: ' + err);
|
||||
this.nav.setRoot(LoginPage);
|
||||
this.initialPage('personal');
|
||||
});
|
||||
|
||||
this.statusBar.styleDefault();
|
||||
|
@ -63,6 +63,18 @@ export class MyApp {
|
|||
});
|
||||
}
|
||||
|
||||
initialPage(timeline) {
|
||||
this.storage.get('token').then((val) => {
|
||||
if (val.length > 1) {
|
||||
pnut.token = val;
|
||||
this.nav.setRoot(StreamPage, {stream: timeline});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log('ERROR: ' + err);
|
||||
this.nav.setRoot(LoginPage);
|
||||
});
|
||||
}
|
||||
|
||||
openPage(page) {
|
||||
// Reset the content nav to have just this page
|
||||
// we wouldn't want the back button to show in this scenario
|
||||
|
|
|
@ -16,6 +16,14 @@
|
|||
<ion-content overflow-scroll=”true”>
|
||||
<ion-list>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Default Timeline</ion-label>
|
||||
<ion-select [(ngModel)]="set_default" (ionChange)="updateDefault()" interface="popover">
|
||||
<ion-option value="personal">Home Timeline</ion-option>
|
||||
<ion-option value="global">Global Timeline</ion-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>
|
||||
<h2>Unified Home</h2>
|
||||
|
|
|
@ -17,12 +17,19 @@ export class SettingsPage {
|
|||
|
||||
private set_unified: boolean;
|
||||
private set_cc: boolean;
|
||||
private set_default: string;
|
||||
|
||||
constructor(public navCtrl: NavController, private storage: Storage, public navParams: NavParams,
|
||||
public events: Events) {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.storage.get('timeline').then((val) => {
|
||||
this.set_default = val;
|
||||
}).catch(err => {
|
||||
console.log('ERROR: ' +err);
|
||||
});
|
||||
|
||||
this.storage.get('unified').then((val) => {
|
||||
this.set_unified = val;
|
||||
}).catch(err => {
|
||||
|
@ -48,4 +55,8 @@ export class SettingsPage {
|
|||
this.storage.set('cc', this.set_cc);
|
||||
}
|
||||
|
||||
updateDefault() {
|
||||
this.storage.set('timeline', this.set_default);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue