import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Storage } from '@ionic/storage';

/**
 * Generated class for the ConfigurationPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-configuration',
  templateUrl: 'configuration.html',
})
export class ConfigurationPage {

  startAlarm: any;
  time: any;

  constructor(public navCtrl: NavController,
    public navParams: NavParams,
    private storage: Storage) {
  }

  ionViewWillEnter() {
    this.storage.get('startAlarm').then((valAlarm)=>{
        this.startAlarm = valAlarm;
    });
    this.storage.get('time').then((valTime)=>{
        this.time = valTime;
    });
  }

  changeAlarm() {
    this.storage.set('startAlarm', this.startAlarm);
  }

  changeTime() {
    this.storage.set('time', this.time);
  }

}
