Change check status on selction itself

[{"mail":"XXXXXX@YYYYYY.com","checked":false},{"mail":"aaaa@ibbbbb.com","checked":false},{"mail":"xxxx@wwww.com","checked":false},{"mail":"qqqqqq@s.com","checked":false},{"mail":"a@s.com","checked":false},{"mail":"n@ico.com","checked":false},{"mail":"b@ethc.com","checked":false},{"mail":"s@sat.com","checked":false}]

promptAlertForReply() {
    // this.showCheckbox();
    let alert = this.alertCtrl.create();
   // this.chatService.getIncludeLIst();
    for (let i = 0; i < this.uniqueMails.length; i++) {

     // alert.setTitle(receipeints);
      alert.addInput({
        type: 'checkbox',
        label: this.uniqueMails[i].mail,
        value: i.toString(),
        checked: this.uniqueMails[i].checked
      })

    }
    alert.addButton('Cancel');
    alert.addButton({
      text: 'Okay',
      handler: data => {       
        
        for (let i = 0; i < data.length; i++) {
          console.log('Checkbox data:', data[i]+ " email is  "+this.uniqueMails[data[i]].mail);
         this.unCheckArray(data);
          this.receipeintsList = this.receipeintsList  + this.uniqueMails[data[i]].mail+ ";";
         
        }
        // this.chatService.sendReply(this.editorMsg, this.receipeintsList, this.message[index].msgFrom,
        //    this.message[index].room, this.message[index].refId, this.message[index].tetraId, 
        //    this.message[index].parentRefId);

      }
    });
    alert.present();
  }



This is my unCheckArray

unCheckArray(selectedIndexesList){
    //making all list check status as false
    for(var i=0;i<this.uniqueMails.length;i++){
      this.uniqueMails[i].checked=false;

    }
//making all list check status to true
    for(var i=0;i<selectedIndexesList.length;i++){
      this.uniqueMails[selectedIndexesList[i]].checked=true;
      
    }
  }

So is there any other best way to check and uncheck staus to maintan in array when alert is prompted