From 73f2a297abf948d534596a61b08a9fa2ba9c869a Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 23 Jul 2017 07:48:29 -0700 Subject: [PATCH] Initial settings page, issue #31 --- src/app/app.component.ts | 4 +++ src/app/app.module.ts | 3 ++ src/pages/settings/settings.html | 36 +++++++++++++++++++++ src/pages/settings/settings.module.ts | 16 ++++++++++ src/pages/settings/settings.scss | 3 ++ src/pages/settings/settings.ts | 46 +++++++++++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 src/pages/settings/settings.html create mode 100644 src/pages/settings/settings.module.ts create mode 100644 src/pages/settings/settings.scss create mode 100644 src/pages/settings/settings.ts diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ff7de7e..84d4711 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -7,6 +7,7 @@ import { Device } from '@ionic-native/device'; import { LoginPage } from '../pages/login/login'; import { StreamPage } from '../pages/stream/stream'; +import { SettingsPage } from '../pages/settings/settings'; import * as pnut from 'pnut-butter'; @@ -30,6 +31,7 @@ export class MyApp { { title: 'Mentions', component: StreamPage, params: {stream: 'mentions'} }, { title: 'Global', component: StreamPage, params: {stream: 'global'} }, { title: 'Bookmarks', component: StreamPage, params: {stream: 'bookmarks'} }, + { title: 'Settings', component: SettingsPage, params: {}}, { title: 'Logout', component: {}, params: {}}, ]; @@ -67,6 +69,8 @@ export class MyApp { if (page.title === 'Logout') { this.storage.remove('token'); this.nav.setRoot(LoginPage); + } else if (page.title === 'Settings') { + this.nav.push(page.component, page.params); } else { this.nav.setRoot(page.component, page.params); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 36f2709..d403eeb 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -6,6 +6,7 @@ import { MyApp } from './app.component'; import { LoginPage } from '../pages/login/login'; import { StreamPage, NewPostModal, PostMenu } from '../pages/stream/stream'; import { ThreadPage } from '../pages/thread/thread'; +import { SettingsPage } from '../pages/settings/settings'; import { StatusBar } from '@ionic-native/status-bar'; import { SplashScreen } from '@ionic-native/splash-screen'; @@ -20,6 +21,7 @@ import { ParserPipe } from '../pipes/parser/parser'; LoginPage, StreamPage, ThreadPage, + SettingsPage, TimeagoPipe, NewPostModal, PostMenu, @@ -36,6 +38,7 @@ import { ParserPipe } from '../pipes/parser/parser'; LoginPage, StreamPage, ThreadPage, + SettingsPage, NewPostModal, PostMenu ], diff --git a/src/pages/settings/settings.html b/src/pages/settings/settings.html new file mode 100644 index 0000000..8bb524c --- /dev/null +++ b/src/pages/settings/settings.html @@ -0,0 +1,36 @@ + + + + + settings + + + + + + + + + + +

Unified Home

+

Include mentions in home timeline

+
+ +
+ + + +

Use CC on Reply All

+

Additional mentions follow /

+
+ +
+ +
+
diff --git a/src/pages/settings/settings.module.ts b/src/pages/settings/settings.module.ts new file mode 100644 index 0000000..6c20669 --- /dev/null +++ b/src/pages/settings/settings.module.ts @@ -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 {} diff --git a/src/pages/settings/settings.scss b/src/pages/settings/settings.scss new file mode 100644 index 0000000..ee78e1c --- /dev/null +++ b/src/pages/settings/settings.scss @@ -0,0 +1,3 @@ +page-settings { + +} diff --git a/src/pages/settings/settings.ts b/src/pages/settings/settings.ts new file mode 100644 index 0000000..faef6e8 --- /dev/null +++ b/src/pages/settings/settings.ts @@ -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); + } + +}