Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(block => {
// Create 1 block
let data = [];
for (let i = 0; i < NfcManager.MIFARE_BLOCK_SIZE; i++) {
data.push(0);
}
// Fill the block with our text, but don't exceed the block size
for (let i = 0; i < this.state.textToWrite.length && i < NfcManager.MIFARE_BLOCK_SIZE; i++) {
data[i] = parseInt(this.state.textToWrite.charCodeAt(i));
}
return NfcManager.mifareClassicWriteBlock(block, data);
})
.then(read)
.then(block => {
// Create 1 block
let data = [];
for (let i = 0; i < NfcManager.MIFARE_BLOCK_SIZE; i++) {
data.push(0);
}
// Fill the block with our text, but don't exceed the block size
for (let i = 0; i < this.state.textToWrite.length && i < NfcManager.MIFARE_BLOCK_SIZE; i++) {
data[i] = parseInt(this.state.textToWrite.charCodeAt(i));
}
return NfcManager.mifareClassicWriteBlock(block, data);
})
.then(read)