Friday 16 October 2020

Ionic v3: Toggle Hide/Unhide Passwords works only after round-progress ends

I got an app that works as a 2FA and I got an issue with the iOS platform.

  • When I toggle hide/unhide password, the ng-container changes only after the round-progress countdown ends (30 sec) and gets the next password from the database.

The problem is that this issue is only on iOS. On Android the ng-container changes on each toggle state, after you save and close the configuration page. So with the same code, on iOS I have to wait the counter to end and load the next password, after you switch the toggle hide/unhide password.

[list.html]

<ng-container *ngIf="cod.hide == 1"> 
     <p class="generatedCode">--- ---</p>
     <p class="nameCode"></p>
</ng-container>
<ng-container *ngIf="cod.hide == 0"> 
     <p class="generatedCode"></p>
     <p class="nameCode"></p>
</ng-container>

[list.ts]

presentPopover(myEvent) {
    let popover = this.popoverCtrl.create(PopoverComponent);
    popover.present({
      ev: myEvent
    });

    popover.onDidDismiss(data => {
      this.getHidePassword();
      this.changeClockColor();

      setTimeout(() =>{
        for(let item of this.passwords){
          item["hide"] = this.hidePassword;
        }
      }, 200);
    });
  }

[config.html]

<ion-toggle [(ngModel)]="hidePassword" [checked]="hidePassword" (ionChange)="toggleChange($event)"></ion-toggle>

[config.ts]

toggleChange($event){
    var check = 0;

    if($event.checked){
      check = 1;
    }

    this.database.setDataHide("hidePassword", check).then(() => {        
      console.log("Saved!");
    }).catch(e => console.log(e)); 
  }

Any suggestion on how to make the iOS version work like the Android version ? Or what should I check.

  • To hide/unhide ng-container (password) every time I change the hide/unhide toggle in config page. Not wait for the counter to end (and get the next password from the database).

I opened a thread in Ionic Forum, but no suggestion til now.

Thank you in advance.



from Ionic v3: Toggle Hide/Unhide Passwords works only after round-progress ends

No comments:

Post a Comment