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 SyncState currentSyncState;
|
||||
private ReadQrStatus currentReadQrStatus;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -185,7 +186,7 @@ public class ExchangeActivity extends AppCompatActivity {
|
|||
|
||||
private void setReadQrStatus(ReadQrStatus status) {
|
||||
|
||||
Log.d("DEBUG", "QR STATUS: " + status);
|
||||
currentReadQrStatus = status;
|
||||
|
||||
final Drawable drawable;
|
||||
final int color;
|
||||
|
@ -251,10 +252,13 @@ public class ExchangeActivity extends AppCompatActivity {
|
|||
diffieHellman.setForeignPublicKey(DiffieHellman.publicKeyFromString(qrData));
|
||||
setSyncState(SyncState.KEY_EXCHANGE_DONE);
|
||||
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
|
||||
if (currentReadQrStatus == ReadQrStatus.PENDING) {
|
||||
setReadQrStatus(ReadQrStatus.FAILURE);
|
||||
cameraFragment.setReadQrEnabled(true);
|
||||
Snackbar.make(rootLayout, "Public key not parsable", Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
cameraFragment.setReadQrEnabled(true);
|
||||
}
|
||||
break;
|
||||
case DATA_EXCHANGE:
|
||||
try {
|
||||
|
@ -288,10 +292,13 @@ public class ExchangeActivity extends AppCompatActivity {
|
|||
preferenceManager.addUploadInformation(uploadInformation);
|
||||
setSyncState(SyncState.DATA_EXCHANGE_DONE);
|
||||
} catch (JsonSyntaxException e) {
|
||||
if (currentReadQrStatus == ReadQrStatus.PENDING) {
|
||||
setReadQrStatus(ReadQrStatus.FAILURE);
|
||||
cameraFragment.setReadQrEnabled(true);
|
||||
Snackbar.make(rootLayout, "Sync information not parsable", Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
cameraFragment.setReadQrEnabled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,28 +6,28 @@ import android.graphics.Shader;
|
|||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
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.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
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 lu.circl.mispbump.R;
|
||||
import lu.circl.mispbump.auxiliary.MispRestClient;
|
||||
import lu.circl.mispbump.auxiliary.PreferenceManager;
|
||||
import lu.circl.mispbump.auxiliary.TileDrawable;
|
||||
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.User;
|
||||
import lu.circl.mispbump.security.KeyStoreWrapper;
|
||||
|
@ -83,12 +83,6 @@ public class ProfileActivity extends AppCompatActivity {
|
|||
|
||||
final MaterialPreferenceText uuid = findViewById(R.id.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);
|
||||
nationality.setSubtitle(organisation.nationality);
|
||||
|
@ -150,6 +144,7 @@ public class ProfileActivity extends AppCompatActivity {
|
|||
public void success(Organisation organisation) {
|
||||
fabLoadingDrawable.stop();
|
||||
preferenceManager.setUserOrgInfo(organisation);
|
||||
Snackbar.make(rootLayout, "Successfully update profile", Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -183,7 +178,7 @@ public class ProfileActivity extends AppCompatActivity {
|
|||
builder.setPositiveButton("Delete & Logout", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PreferenceManager prefs = PreferenceManager.getInstance(getApplicationContext());
|
||||
PreferenceManager prefs = PreferenceManager.getInstance(ProfileActivity.this);
|
||||
prefs.clearAllData();
|
||||
KeyStoreWrapper.deleteAllStoredKeys();
|
||||
|
||||
|
|
Loading…
Reference in New Issue