mirror of https://github.com/MISP/misp-bump
improve wrong qr code info
parent
baba45767b
commit
95c9fb690c
|
@ -52,6 +52,7 @@ public class ExchangeActivity extends AppCompatActivity {
|
||||||
private Bitmap publicKeyQr, dataQr;
|
private Bitmap publicKeyQr, dataQr;
|
||||||
|
|
||||||
private SyncState currentSyncState;
|
private SyncState currentSyncState;
|
||||||
|
private ReadQrStatus currentReadQrStatus;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -185,7 +186,7 @@ public class ExchangeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private void setReadQrStatus(ReadQrStatus status) {
|
private void setReadQrStatus(ReadQrStatus status) {
|
||||||
|
|
||||||
Log.d("DEBUG", "QR STATUS: " + status);
|
currentReadQrStatus = status;
|
||||||
|
|
||||||
final Drawable drawable;
|
final Drawable drawable;
|
||||||
final int color;
|
final int color;
|
||||||
|
@ -251,9 +252,12 @@ public class ExchangeActivity extends AppCompatActivity {
|
||||||
diffieHellman.setForeignPublicKey(DiffieHellman.publicKeyFromString(qrData));
|
diffieHellman.setForeignPublicKey(DiffieHellman.publicKeyFromString(qrData));
|
||||||
setSyncState(SyncState.KEY_EXCHANGE_DONE);
|
setSyncState(SyncState.KEY_EXCHANGE_DONE);
|
||||||
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
|
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
|
||||||
setReadQrStatus(ReadQrStatus.FAILURE);
|
if (currentReadQrStatus == ReadQrStatus.PENDING) {
|
||||||
|
setReadQrStatus(ReadQrStatus.FAILURE);
|
||||||
|
Snackbar.make(rootLayout, "Public key not parsable", Snackbar.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
cameraFragment.setReadQrEnabled(true);
|
cameraFragment.setReadQrEnabled(true);
|
||||||
Snackbar.make(rootLayout, "Public key not parsable", Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DATA_EXCHANGE:
|
case DATA_EXCHANGE:
|
||||||
|
@ -288,9 +292,12 @@ public class ExchangeActivity extends AppCompatActivity {
|
||||||
preferenceManager.addUploadInformation(uploadInformation);
|
preferenceManager.addUploadInformation(uploadInformation);
|
||||||
setSyncState(SyncState.DATA_EXCHANGE_DONE);
|
setSyncState(SyncState.DATA_EXCHANGE_DONE);
|
||||||
} catch (JsonSyntaxException e) {
|
} catch (JsonSyntaxException e) {
|
||||||
setReadQrStatus(ReadQrStatus.FAILURE);
|
if (currentReadQrStatus == ReadQrStatus.PENDING) {
|
||||||
|
setReadQrStatus(ReadQrStatus.FAILURE);
|
||||||
|
Snackbar.make(rootLayout, "Sync information not parsable", Snackbar.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
cameraFragment.setReadQrEnabled(true);
|
cameraFragment.setReadQrEnabled(true);
|
||||||
Snackbar.make(rootLayout, "Sync information not parsable", Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,28 +6,28 @@ import android.graphics.Shader;
|
||||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
import androidx.appcompat.app.ActionBar;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import lu.circl.mispbump.R;
|
import lu.circl.mispbump.R;
|
||||||
|
import lu.circl.mispbump.auxiliary.MispRestClient;
|
||||||
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
||||||
import lu.circl.mispbump.auxiliary.TileDrawable;
|
import lu.circl.mispbump.auxiliary.TileDrawable;
|
||||||
import lu.circl.mispbump.customViews.MaterialPreferenceText;
|
import lu.circl.mispbump.customViews.MaterialPreferenceText;
|
||||||
import lu.circl.mispbump.auxiliary.MispRestClient;
|
|
||||||
import lu.circl.mispbump.models.restModels.Organisation;
|
import lu.circl.mispbump.models.restModels.Organisation;
|
||||||
import lu.circl.mispbump.models.restModels.User;
|
import lu.circl.mispbump.models.restModels.User;
|
||||||
import lu.circl.mispbump.security.KeyStoreWrapper;
|
import lu.circl.mispbump.security.KeyStoreWrapper;
|
||||||
|
@ -83,12 +83,6 @@ public class ProfileActivity extends AppCompatActivity {
|
||||||
|
|
||||||
final MaterialPreferenceText uuid = findViewById(R.id.uuid);
|
final MaterialPreferenceText uuid = findViewById(R.id.uuid);
|
||||||
uuid.setSubtitle(organisation.uuid);
|
uuid.setSubtitle(organisation.uuid);
|
||||||
// uuid.setOnClickListener(new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(View v) {
|
|
||||||
// Snackbar.make(rootLayout, "Copied to clipboard", Snackbar.LENGTH_LONG).show();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
MaterialPreferenceText nationality = findViewById(R.id.nationality);
|
MaterialPreferenceText nationality = findViewById(R.id.nationality);
|
||||||
nationality.setSubtitle(organisation.nationality);
|
nationality.setSubtitle(organisation.nationality);
|
||||||
|
@ -150,6 +144,7 @@ public class ProfileActivity extends AppCompatActivity {
|
||||||
public void success(Organisation organisation) {
|
public void success(Organisation organisation) {
|
||||||
fabLoadingDrawable.stop();
|
fabLoadingDrawable.stop();
|
||||||
preferenceManager.setUserOrgInfo(organisation);
|
preferenceManager.setUserOrgInfo(organisation);
|
||||||
|
Snackbar.make(rootLayout, "Successfully update profile", Snackbar.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -183,7 +178,7 @@ public class ProfileActivity extends AppCompatActivity {
|
||||||
builder.setPositiveButton("Delete & Logout", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton("Delete & Logout", new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
PreferenceManager prefs = PreferenceManager.getInstance(getApplicationContext());
|
PreferenceManager prefs = PreferenceManager.getInstance(ProfileActivity.this);
|
||||||
prefs.clearAllData();
|
prefs.clearAllData();
|
||||||
KeyStoreWrapper.deleteAllStoredKeys();
|
KeyStoreWrapper.deleteAllStoredKeys();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue