mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Merge branch '814-enable-QrScanner-after-QrCode-was-created' into 'master'
Ignore QR code results until local QR code is created * Make scanning only possible after we are "ready" (= our QrCode was created and set). Signed-off-by: goapunk <noobie@goapunks.net> Closes #814 See merge request !454
This commit is contained in:
@@ -86,6 +86,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
|
||||
private BluetoothStateReceiver receiver;
|
||||
private boolean gotRemotePayload, waitingForBluetooth;
|
||||
private volatile boolean gotLocalPayload;
|
||||
private KeyAgreementTask task;
|
||||
|
||||
public static ShowQrCodeFragment newInstance() {
|
||||
@@ -202,6 +203,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
statusView.setVisibility(INVISIBLE);
|
||||
cameraView.setVisibility(VISIBLE);
|
||||
gotRemotePayload = false;
|
||||
gotLocalPayload = false;
|
||||
startListening();
|
||||
}
|
||||
|
||||
@@ -227,6 +229,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
public void eventOccurred(Event e) {
|
||||
if (e instanceof KeyAgreementListeningEvent) {
|
||||
KeyAgreementListeningEvent event = (KeyAgreementListeningEvent) e;
|
||||
gotLocalPayload = true;
|
||||
setQrCode(event.getLocalPayload());
|
||||
} else if (e instanceof KeyAgreementFailedEvent) {
|
||||
keyAgreementFailed();
|
||||
@@ -341,6 +344,10 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.info("Got result from decoder");
|
||||
// Ignore results until the KeyAgreementTask is ready
|
||||
if (!gotLocalPayload) {
|
||||
return;
|
||||
}
|
||||
if (!gotRemotePayload) {
|
||||
gotRemotePayload = true;
|
||||
qrCodeScanned(result.getText());
|
||||
|
||||
Reference in New Issue
Block a user