Example #1
0
File: pin.ts Project: bitjson/copay
    this.events.subscribe('showPinModalEvent', (action: string) => {

      this.ATTEMPT_LIMIT = 3;
      this.ATTEMPT_LOCK_OUT_TIME = 5 * 60;
      this.currentAttempts = 0;
      this.currentPin = '';
      this.firstPinEntered = '';
      this.confirmingPin = false;
      this.action = '';
      this.disableButtons = false;
      this.expires = '';
      this.incorrect = false;

      this.showPinModal = true;
      this.unregister = this.platform.registerBackButtonAction(() => { });

      this.action = action;

      if (this.action === 'checkPin' || this.action === 'removeLock') {
        this.persistenceProvider.getLockStatus().then((isLocked: string) => {
          if (!isLocked) return;
          this.showLocktimer();
          this.setLockRelease();
        });
      }
    });
    private handleBackButton() {
        let lastTimeBackPress = 0;
        const timePeriodToExit  = 2000;
        this.navPath = [];
        this.platform.registerBackButtonAction(() => {
            if (this.isMessagesOpened) {
                this.isMessagesOpened = false;
                return;
            }
            if (this.navPath.length < 1) {
                if (new Date().getTime() - lastTimeBackPress < timePeriodToExit) {
                    this.platform.exitApp();
                } else {
                    let toast = this.toastCtrl.create({
                        message:  'Press back again to exit',
                        duration: 3000,
                        position: 'bottom'
                    });
                    toast.present();
                    lastTimeBackPress = new Date().getTime();
                }
                return;
            }

            this.navPath.pop();
            this.slide = this.navPath[this.navPath.length - 1];
            this.slides.slideTo(this.slide);
            this.isGoingBack = true;
        });
    }
Example #3
0
    this.events.subscribe('showWalletsSelectorEvent', (wallets: any[], selectedWalletId: string, title?: string) => {
      this.title = title ? title : null;
      this.showWalletsSelector = true;
      this.selectedWalletId = selectedWalletId;
      setTimeout(() => {
        this.showSlideEffect = true;
      }, 50);
      this.wallets = wallets;
      this.separeWallets();

      let unregisterBackButtonAction = this.platform.registerBackButtonAction(() => {
        unregisterBackButtonAction();
        this.backdropDismiss();
      }, 0);

    });
Example #4
0
	constructor(private nav: NavController, private platform: Platform) {
		// this tells the tabs component which Pages
		// should be each tab's root Page
		this.tab1Root = UsaPage;
		this.tab2Root = AboutPage;
		this.tab3Root = EuropePage;

		this.platform.registerBackButtonAction(() => {
			let child: Tab = this.tabs.getSelected();
			if(child['_views'].length > 1) {
				child.pop();
			} else {
				navigator['app'].exitApp();
			}
		});
	}
Example #5
0
 // TODO: do this when leaving gameboard.
 ionViewWillEnter(): void {
     this._networkingHelper.closeConnection();
     this.unRegisterBackButtonAction = this._platform.registerBackButtonAction(() => {
         this._appMinimize.minimize().then(() => { this.unRegisterBackButtonAction() });
     }, 200);
 }
 private registerBackButton() {
     this.unregisterBackButton(); //remove any previous handlers
     this.unregisterBackButtonAction = this.platform.registerBackButtonAction(() => this.onBackButton(), Number.MAX_VALUE);
 }
Example #7
0
 this.events.subscribe('showFingerprintModalEvent', (isCopay) => {
   this.isCopay = isCopay;
   this.showFingerprintModal = true;
   this.unregister = this.platform.registerBackButtonAction(() => { });
   this.checkFingerprint();
 });
Example #8
0
  constructor(
    private platform: Platform,
    private http: Http,
    private parser: Parser,
    private banderas : Banderas,
    private translator: Translator,
    private _ngZone: NgZone,
    public events: Events,
    private nav: NavController) {

    platform.registerBackButtonAction((event) => {
        if(this.viewInScreen){
          this.backButtonAction();
        }else{
          this.nav.pop();
        }   
      }, 100);
      
    this.loading = Loading.create({
    content: ''
  });

  this.nav.present(this.loading);

 
    if(!localStorage.getItem('lang')){
      localStorage.setItem('lang','es');
    }


    if(Network.connection != 'No network connection' ){//Connection.NONE
      
      this.downloadData();  
          
      
    }else{
      
     this.getDBLocal();
     
     
    }
    


    events.subscribe('lang:changed', (lang) => {
      this.ajustes = this.translator_object[lang[0]]['TIT_AJUSTES'];
      console.log(this.ajustes);
      this.pages = new Array();
      this.importancia1 = new Array();
      this.importancia2 = new Array();
      this.importancia3 = new Array();
      
        var i = 0;
        this.typeItems.forEach(typeItem => {
          this.pages.push({ idx: i,
                            idTypeItem: typeItem.idTypeItem,
                            title: typeItem[lang[0]] || typeItem.type,
                            section: typeItem.type,
                            importance: typeItem.importance,
                            img: typeItem.backgroundImage,
                            component: Lista,
                            mostrarType: typeItem.mostrarType });
                            console.log(this.pages);
          i++;
          if(i === this.typeItems.length){
            for (var _i = 0; _i < this.pages.length; _i++) {
              if(this.pages[_i].importance === 1){
                this.importancia1.push(new Array(this.pages[_i]));

              }else if(this.pages[_i].importance === 2){
                this.importancia2.push([this.pages[_i],this.pages[_i+1]]);
                _i = _i + 1;
              }else{
                this.importancia3.push([this.pages[_i],this.pages[_i+1],this.pages[_i+2]]);
                _i = _i + 2;
              }

            }
          }
        });
        
      });
    
  }