Skip to content

Commit

Permalink
improve disconnect UX
Browse files Browse the repository at this point in the history
  • Loading branch information
robertclarkson committed Mar 3, 2023
1 parent ce8142e commit 60bdc4d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions screen/boltcard/disconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const BoltCardDisconnect = () => {
error = error + ' Some keys missing, proceed with caution';
}
setKeyJsonError(error ? error : false)
enableResetMode(wipeCardDetails.k0, wipeCardDetails.k1, wipeCardDetails.k2, wipeCardDetails.k3, wipeCardDetails.k4, wipeCardDetails.uid);
}
}, [wipeCardDetails]);

Expand Down Expand Up @@ -155,12 +156,20 @@ const BoltCardDisconnect = () => {
}
}

const enableResetMode = () => {
const enableResetMode = (k0, k1, k2, k3, k4, carduid) => {
NativeModules.MyReactModule.setCardMode("resetkeys");
NativeModules.MyReactModule.setResetKeys(key0,key1,key2,key3,key4,uid, ()=> {
//callback
console.log("reset keys set");
});
if (k0 && k1 && k2 && k3 && k4 && carduid) {
NativeModules.MyReactModule.setResetKeys(k0,k1,k2,k3,k4,carduid, ()=> {
//callback
console.log("reset keys set");
});
}
else {
NativeModules.MyReactModule.setResetKeys(key0,key1,key2,key3,key4,uid, ()=> {
//callback
console.log("reset keys set");
});
}
setWriteKeysOutput(null)
setResetNow(true);
}
Expand Down Expand Up @@ -290,7 +299,7 @@ const BoltCardDisconnect = () => {
}
<BlueButton
style={styles.button}
title="Disconnect card now"
title="Reset Again"
color="#000000"
onPress={enableResetMode}
/>
Expand Down

0 comments on commit 60bdc4d

Please sign in to comment.