/// import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import { Storage } from '@ionic/storage'; import {UserHelpers} from '../../Helpers'; @Component({ selector: 'settings', templateUrl: 'settings.html' }) export class SettingsPage { user: User = { strongs_modal: true, clear_search_after_query: true, items: [], append_to_bottom: false, insert_next_to_item: false }; constructor(public navCtrl: NavController, public local: Storage) { // Check if there is a profile saved in local storage this.local.get('profile').then(profile => { let t = this.user; if (profile !== null) t = JSON.parse(profile); new UserHelpers(local).validate(this.user, t); this.user = t; }).catch(error => { console.log(error); }); } save() { this.local.set('profile', JSON.stringify(this.user)); } reset() { this.user = { strongs_modal: true, clear_search_after_query: true, items: [], append_to_bottom: false, insert_next_to_item: false }; this.save(); } ionViewDidLoad() { console.log('Hello SettingsPage Page'); } }