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

Commit c60a253

Browse files
committed
Inform users that GPG key selection is mandatory (#1355)
* 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]>
1 parent c292ba2 commit c60a253

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Fixed
8+
9+
- When prompted to select a GPG key during onboarding, the app would crash if the user did not make a selection in OpenKeychain
10+
711
## [1.13.4] - 2021-03-20
812

913
- Fix support for ECDSA SSH keys and support AES-GCM

app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.github.michaelbull.result.onFailure
2424
import com.github.michaelbull.result.onSuccess
2525
import com.github.michaelbull.result.runCatching
2626
import com.google.android.material.dialog.MaterialAlertDialogBuilder
27+
import com.google.android.material.snackbar.Snackbar
2728
import com.google.zxing.integration.android.IntentIntegrator
2829
import com.google.zxing.integration.android.IntentIntegrator.QR_CODE
2930
import com.zeapo.pwdstore.R
@@ -114,6 +115,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
114115
}
115116
}
116117
}
118+
} else {
119+
snackbar(message = getString(R.string.gpg_key_select_mandatory), length = Snackbar.LENGTH_LONG)
117120
}
118121
}
119122

app/src/main/java/com/zeapo/pwdstore/ui/onboarding/fragments/KeySelectionFragment.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity
1313
import androidx.core.content.edit
1414
import androidx.fragment.app.Fragment
1515
import androidx.lifecycle.lifecycleScope
16+
import com.google.android.material.snackbar.Snackbar
1617
import com.zeapo.pwdstore.R
1718
import com.zeapo.pwdstore.crypto.GetKeyIdsActivity
1819
import com.zeapo.pwdstore.databinding.FragmentKeySelectionBinding
@@ -21,6 +22,7 @@ import com.zeapo.pwdstore.utils.PreferenceKeys
2122
import com.zeapo.pwdstore.utils.commitChange
2223
import com.zeapo.pwdstore.utils.finish
2324
import com.zeapo.pwdstore.utils.sharedPrefs
25+
import com.zeapo.pwdstore.utils.snackbar
2426
import com.zeapo.pwdstore.utils.viewBinding
2527
import java.io.File
2628
import kotlinx.coroutines.Dispatchers
@@ -48,10 +50,11 @@ class KeySelectionFragment : Fragment(R.layout.fragment_key_selection) {
4850
))
4951
}
5052
}
53+
finish()
5154
} else {
52-
throw IllegalStateException("Failed to initialize repository state.")
55+
requireActivity()
56+
.snackbar(message = getString(R.string.gpg_key_select_mandatory), length = Snackbar.LENGTH_LONG)
5357
}
54-
finish()
5558
}
5659

5760
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,5 +417,6 @@
417417
<string name="oreo_autofill_password_fill_and_conditional_save_support">Fill and save passwords (saving requires that no accessibility services are enabled)</string>
418418
<string name="clear_saved_host_key">Clear saved host key</string>
419419
<string name="clear_saved_host_key_success">Successfully cleared saved host key!</string>
420+
<string name="gpg_key_select_mandatory">Selecting a GPG key is necessary to proceed</string>
420421

421422
</resources>

0 commit comments

Comments
 (0)