Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Inform users that GPG key selection is mandatory (#1355)
Browse files Browse the repository at this point in the history
* Inform users that GPG key selection is mandatory

Fixes #1342

Signed-off-by: Harsh Shandilya <[email protected]>

* changelog: add GPG key selection improvements

Signed-off-by: Harsh Shandilya <[email protected]>
  • Loading branch information
msfjarvis committed Apr 16, 2021
1 parent c292ba2 commit c60a253
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Fixed

- When prompted to select a GPG key during onboarding, the app would crash if the user did not make a selection in OpenKeychain

## [1.13.4] - 2021-03-20

- Fix support for ECDSA SSH keys and support AES-GCM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.github.michaelbull.result.onFailure
import com.github.michaelbull.result.onSuccess
import com.github.michaelbull.result.runCatching
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import com.google.zxing.integration.android.IntentIntegrator
import com.google.zxing.integration.android.IntentIntegrator.QR_CODE
import com.zeapo.pwdstore.R
Expand Down Expand Up @@ -114,6 +115,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
}
}
}
} else {
snackbar(message = getString(R.string.gpg_key_select_mandatory), length = Snackbar.LENGTH_LONG)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.edit
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.google.android.material.snackbar.Snackbar
import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.crypto.GetKeyIdsActivity
import com.zeapo.pwdstore.databinding.FragmentKeySelectionBinding
Expand All @@ -21,6 +22,7 @@ import com.zeapo.pwdstore.utils.PreferenceKeys
import com.zeapo.pwdstore.utils.commitChange
import com.zeapo.pwdstore.utils.finish
import com.zeapo.pwdstore.utils.sharedPrefs
import com.zeapo.pwdstore.utils.snackbar
import com.zeapo.pwdstore.utils.viewBinding
import java.io.File
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -48,10 +50,11 @@ class KeySelectionFragment : Fragment(R.layout.fragment_key_selection) {
))
}
}
finish()
} else {
throw IllegalStateException("Failed to initialize repository state.")
requireActivity()
.snackbar(message = getString(R.string.gpg_key_select_mandatory), length = Snackbar.LENGTH_LONG)
}
finish()
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -417,5 +417,6 @@
<string name="oreo_autofill_password_fill_and_conditional_save_support">Fill and save passwords (saving requires that no accessibility services are enabled)</string>
<string name="clear_saved_host_key">Clear saved host key</string>
<string name="clear_saved_host_key_success">Successfully cleared saved host key!</string>
<string name="gpg_key_select_mandatory">Selecting a GPG key is necessary to proceed</string>

</resources>

0 comments on commit c60a253

Please sign in to comment.