2016-12-01 15:21:07 -05:00
|
|
|
/// <reference path="../../types.ts" />
|
2016-12-02 13:00:55 -05:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
import { NavController } from 'ionic-angular';
|
|
|
|
import { Storage } from '@ionic/storage';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'settings',
|
|
|
|
templateUrl: 'settings.html'
|
|
|
|
})
|
|
|
|
export class SettingsPage {
|
|
|
|
user: User = { strongs_modal: true };
|
|
|
|
constructor(public navCtrl: NavController, public local: Storage) {
|
|
|
|
|
2016-12-01 15:21:07 -05:00
|
|
|
// Check if there is a profile saved in local storage
|
|
|
|
this.local.get('profile').then(profile => {
|
|
|
|
if (profile === null) {
|
|
|
|
this.save();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
this.user = JSON.parse(profile);
|
|
|
|
}).catch(error => {
|
|
|
|
console.log(error);
|
2016-12-02 13:00:55 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
save() {
|
|
|
|
this.local.set('profile', JSON.stringify(this.user));
|
|
|
|
}
|
|
|
|
|
|
|
|
ionViewDidLoad() {
|
|
|
|
console.log('Hello SettingsPage Page');
|
|
|
|
}
|
2016-12-01 15:21:07 -05:00
|
|
|
}
|