Initial settings page, issue #31
This commit is contained in:
parent
61024e18ca
commit
73f2a297ab
6 changed files with 108 additions and 0 deletions
|
@ -7,6 +7,7 @@ import { Device } from '@ionic-native/device';
|
||||||
|
|
||||||
import { LoginPage } from '../pages/login/login';
|
import { LoginPage } from '../pages/login/login';
|
||||||
import { StreamPage } from '../pages/stream/stream';
|
import { StreamPage } from '../pages/stream/stream';
|
||||||
|
import { SettingsPage } from '../pages/settings/settings';
|
||||||
|
|
||||||
import * as pnut from 'pnut-butter';
|
import * as pnut from 'pnut-butter';
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ export class MyApp {
|
||||||
{ title: 'Mentions', component: StreamPage, params: {stream: 'mentions'} },
|
{ title: 'Mentions', component: StreamPage, params: {stream: 'mentions'} },
|
||||||
{ title: 'Global', component: StreamPage, params: {stream: 'global'} },
|
{ title: 'Global', component: StreamPage, params: {stream: 'global'} },
|
||||||
{ title: 'Bookmarks', component: StreamPage, params: {stream: 'bookmarks'} },
|
{ title: 'Bookmarks', component: StreamPage, params: {stream: 'bookmarks'} },
|
||||||
|
{ title: 'Settings', component: SettingsPage, params: {}},
|
||||||
{ title: 'Logout', component: {}, params: {}},
|
{ title: 'Logout', component: {}, params: {}},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -67,6 +69,8 @@ export class MyApp {
|
||||||
if (page.title === 'Logout') {
|
if (page.title === 'Logout') {
|
||||||
this.storage.remove('token');
|
this.storage.remove('token');
|
||||||
this.nav.setRoot(LoginPage);
|
this.nav.setRoot(LoginPage);
|
||||||
|
} else if (page.title === 'Settings') {
|
||||||
|
this.nav.push(page.component, page.params);
|
||||||
} else {
|
} else {
|
||||||
this.nav.setRoot(page.component, page.params);
|
this.nav.setRoot(page.component, page.params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { MyApp } from './app.component';
|
||||||
import { LoginPage } from '../pages/login/login';
|
import { LoginPage } from '../pages/login/login';
|
||||||
import { StreamPage, NewPostModal, PostMenu } from '../pages/stream/stream';
|
import { StreamPage, NewPostModal, PostMenu } from '../pages/stream/stream';
|
||||||
import { ThreadPage } from '../pages/thread/thread';
|
import { ThreadPage } from '../pages/thread/thread';
|
||||||
|
import { SettingsPage } from '../pages/settings/settings';
|
||||||
|
|
||||||
import { StatusBar } from '@ionic-native/status-bar';
|
import { StatusBar } from '@ionic-native/status-bar';
|
||||||
import { SplashScreen } from '@ionic-native/splash-screen';
|
import { SplashScreen } from '@ionic-native/splash-screen';
|
||||||
|
@ -20,6 +21,7 @@ import { ParserPipe } from '../pipes/parser/parser';
|
||||||
LoginPage,
|
LoginPage,
|
||||||
StreamPage,
|
StreamPage,
|
||||||
ThreadPage,
|
ThreadPage,
|
||||||
|
SettingsPage,
|
||||||
TimeagoPipe,
|
TimeagoPipe,
|
||||||
NewPostModal,
|
NewPostModal,
|
||||||
PostMenu,
|
PostMenu,
|
||||||
|
@ -36,6 +38,7 @@ import { ParserPipe } from '../pipes/parser/parser';
|
||||||
LoginPage,
|
LoginPage,
|
||||||
StreamPage,
|
StreamPage,
|
||||||
ThreadPage,
|
ThreadPage,
|
||||||
|
SettingsPage,
|
||||||
NewPostModal,
|
NewPostModal,
|
||||||
PostMenu
|
PostMenu
|
||||||
],
|
],
|
||||||
|
|
36
src/pages/settings/settings.html
Normal file
36
src/pages/settings/settings.html
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<!--
|
||||||
|
Generated template for the SettingsPage page.
|
||||||
|
|
||||||
|
See http://ionicframework.com/docs/components/#navigation for more info on
|
||||||
|
Ionic pages and navigation.
|
||||||
|
-->
|
||||||
|
<ion-header>
|
||||||
|
|
||||||
|
<ion-navbar>
|
||||||
|
<ion-title>settings</ion-title>
|
||||||
|
</ion-navbar>
|
||||||
|
|
||||||
|
</ion-header>
|
||||||
|
|
||||||
|
|
||||||
|
<ion-content overflow-scroll=”true”>
|
||||||
|
<ion-list>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>
|
||||||
|
<h2>Unified Home</h2>
|
||||||
|
<p>Include mentions in home timeline</p>
|
||||||
|
</ion-label>
|
||||||
|
<ion-toggle [(ngModel)]="set_unified" (ionChange)="updateUnified()"></ion-toggle>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>
|
||||||
|
<h2>Use CC on Reply All</h2>
|
||||||
|
<p>Additional mentions follow /</p>
|
||||||
|
</ion-label>
|
||||||
|
<ion-toggle [(ngModel)]="set_cc" (ionChange)="updateCc()"></ion-toggle>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
|
</ion-list>
|
||||||
|
</ion-content>
|
16
src/pages/settings/settings.module.ts
Normal file
16
src/pages/settings/settings.module.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { IonicPageModule } from 'ionic-angular';
|
||||||
|
import { SettingsPage } from './settings';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
SettingsPage,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicPageModule.forChild(SettingsPage),
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
SettingsPage
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SettingsPageModule {}
|
3
src/pages/settings/settings.scss
Normal file
3
src/pages/settings/settings.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
page-settings {
|
||||||
|
|
||||||
|
}
|
46
src/pages/settings/settings.ts
Normal file
46
src/pages/settings/settings.ts
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated class for the SettingsPage page.
|
||||||
|
*
|
||||||
|
* See http://ionicframework.com/docs/components/#navigation for more info
|
||||||
|
* on Ionic pages and navigation.
|
||||||
|
*/
|
||||||
|
@IonicPage()
|
||||||
|
@Component({
|
||||||
|
selector: 'page-settings',
|
||||||
|
templateUrl: 'settings.html',
|
||||||
|
})
|
||||||
|
export class SettingsPage {
|
||||||
|
|
||||||
|
private set_unified: boolean;
|
||||||
|
private set_cc: boolean;
|
||||||
|
|
||||||
|
constructor(public navCtrl: NavController, private storage: Storage, public navParams: NavParams) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.storage.get('unified').then((val) => {
|
||||||
|
this.set_unified = val;
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR: ' + err);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.storage.get('cc').then((val) => {
|
||||||
|
this.set_cc = val;
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR: ' + err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
updateUnified() {
|
||||||
|
this.storage.set('unified', this.set_unified);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCc() {
|
||||||
|
this.storage.set('cc', this.set_cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in a new issue