Skip to content

Commit

Permalink
Make remote verification more prominent
Browse files Browse the repository at this point in the history
Moves the enable remote verification button out to the main screen
  • Loading branch information
t895 authored and thestinger committed Sep 7, 2024
1 parent 7d7f01d commit c9c9614
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
22 changes: 16 additions & 6 deletions app/src/main/java/app/attestation/auditor/AttestationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,21 @@ public void handleOnBackPressed() {
RemoteVerifyJob.restore(this);
}

@Override
protected void onResume() {
super.onResume();
final boolean isRemoteVerifyEnabled = RemoteVerifyJob.isEnabled(this);
int visibility = View.VISIBLE;
if (isRemoteVerifyEnabled) {
visibility = View.GONE;
}
binding.content.remoteVerify.setVisibility(visibility);
binding.content.remoteVerify.setOnClickListener(view -> {
stage = Stage.EnableRemoteVerify;
startQrScanner();
});
}

@Override
public void onSaveInstanceState(@NonNull final Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
Expand Down Expand Up @@ -477,8 +492,6 @@ public boolean onCreateOptionsMenu(final Menu menu) {
@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
final boolean isRemoteVerifyEnabled = RemoteVerifyJob.isEnabled(this);
menu.findItem(R.id.action_enable_remote_verify)
.setEnabled(isSupportedAuditee && !isRemoteVerifyEnabled);
menu.findItem(R.id.action_disable_remote_verify).setEnabled(isRemoteVerifyEnabled);
menu.findItem(R.id.action_submit_sample).setEnabled(canSubmitSample &&
!SubmitSampleJob.isScheduled(this));
Expand Down Expand Up @@ -518,10 +531,6 @@ public boolean onOptionsItemSelected(final MenuItem item) {
.setNegativeButton(R.string.cancel, null)
.show();
return true;
} else if (itemId == R.id.action_enable_remote_verify) {
stage = Stage.EnableRemoteVerify;
startQrScanner();
return true;
} else if (itemId == R.id.action_disable_remote_verify) {
new MaterialAlertDialogBuilder(this)
.setMessage(getString(R.string.action_disable_remote_verify) + "?")
Expand All @@ -548,6 +557,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {

snackbar.setText(R.string.disable_remote_verify_success).show();
});
binding.content.remoteVerify.setVisibility(View.VISIBLE);
})
.setNegativeButton(R.string.cancel, null)
.show();
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/content_attestation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
android:text="@string/auditor_button"
android:textAllCaps="false" />

<Button
android:id="@+id/remote_verify"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/action_enable_remote_verify" />

</LinearLayout>

</ScrollView>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/menu/menu_attestation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
<item android:id="@+id/action_clear_auditor"
android:title="@string/action_clear_auditor"
app:showAsAction="never" />
<item android:id="@+id/action_enable_remote_verify"
android:title="@string/action_enable_remote_verify"
app:showAsAction="never" />
<item android:id="@+id/action_disable_remote_verify"
android:title="@string/action_disable_remote_verify"
app:showAsAction="never" />
Expand Down

0 comments on commit c9c9614

Please sign in to comment.