diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-07-15 14:02:42 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2022-07-15 14:53:52 +0530 |
commit | a1f838151ec5423510fd9d52c89f3705e04040ce (patch) | |
tree | 90b65a51c6848bcfd592a7e6126a85909e93aaa8 /app/src/main/java | |
parent | bcf33e90a574e072c0a5aa027dd2cf78e3f4e3f0 (diff) |
Remove unnecessary V2 suffix
Diffstat (limited to 'app/src/main/java')
12 files changed, 45 insertions, 48 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivityV2.kt b/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt index 35d6ca44..acc8958a 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivityV2.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt @@ -40,7 +40,7 @@ import logcat.logcat @RequiresApi(26) @AndroidEntryPoint -class AutofillDecryptActivityV2 : AppCompatActivity() { +class AutofillDecryptActivity : AppCompatActivity() { companion object { @@ -50,7 +50,7 @@ class AutofillDecryptActivityV2 : AppCompatActivity() { private var decryptFileRequestCode = 1 fun makeDecryptFileIntent(file: File, forwardedExtras: Bundle, context: Context): Intent { - return Intent(context, AutofillDecryptActivityV2::class.java).apply { + return Intent(context, AutofillDecryptActivity::class.java).apply { putExtras(forwardedExtras) putExtra(EXTRA_SEARCH_ACTION, true) putExtra(EXTRA_FILE_PATH, file.absolutePath) @@ -59,7 +59,7 @@ class AutofillDecryptActivityV2 : AppCompatActivity() { fun makeDecryptFileIntentSender(file: File, context: Context): IntentSender { val intent = - Intent(context, AutofillDecryptActivityV2::class.java).apply { + Intent(context, AutofillDecryptActivity::class.java).apply { putExtra(EXTRA_SEARCH_ACTION, false) putExtra(EXTRA_FILE_PATH, file.absolutePath) } @@ -87,14 +87,14 @@ class AutofillDecryptActivityV2 : AppCompatActivity() { val filePath = intent?.getStringExtra(EXTRA_FILE_PATH) ?: run { - logcat(ERROR) { "AutofillDecryptActivityV2 started without EXTRA_FILE_PATH" } + logcat(ERROR) { "AutofillDecryptActivity started without EXTRA_FILE_PATH" } finish() return } val clientState = intent?.getBundleExtra(AutofillManager.EXTRA_CLIENT_STATE) ?: run { - logcat(ERROR) { "AutofillDecryptActivityV2 started without EXTRA_CLIENT_STATE" } + logcat(ERROR) { "AutofillDecryptActivity started without EXTRA_CLIENT_STATE" } finish() return } @@ -127,7 +127,7 @@ class AutofillDecryptActivityV2 : AppCompatActivity() { } else { val fillInDataset = AutofillResponseBuilder.makeFillInDataset( - this@AutofillDecryptActivityV2, + this@AutofillDecryptActivity, credentials, clientState, action diff --git a/app/src/main/java/app/passwordstore/ui/autofill/AutofillFilterView.kt b/app/src/main/java/app/passwordstore/ui/autofill/AutofillFilterView.kt index af8f563b..66927ca3 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillFilterView.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillFilterView.kt @@ -227,7 +227,7 @@ class AutofillFilterView : AppCompatActivity() { AutofillMatcher.addMatchFor(applicationContext, formOrigin, item.file) // intent?.extras? is checked to be non-null in onCreate decryptAction.launch( - AutofillDecryptActivityV2.makeDecryptFileIntent(item.file, intent!!.extras!!, this) + AutofillDecryptActivity.makeDecryptFileIntent(item.file, intent!!.extras!!, this) ) } } diff --git a/app/src/main/java/app/passwordstore/ui/autofill/AutofillSaveActivity.kt b/app/src/main/java/app/passwordstore/ui/autofill/AutofillSaveActivity.kt index 65ec4229..6f3a6462 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillSaveActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillSaveActivity.kt @@ -15,7 +15,7 @@ import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.core.os.bundleOf import app.passwordstore.data.repo.PasswordRepository -import app.passwordstore.ui.crypto.PasswordCreationActivityV2 +import app.passwordstore.ui.crypto.PasswordCreationActivity import app.passwordstore.util.autofill.AutofillMatcher import app.passwordstore.util.autofill.AutofillPreferences import app.passwordstore.util.autofill.AutofillResponseBuilder @@ -108,14 +108,14 @@ class AutofillSaveActivity : AppCompatActivity() { super.onCreate(savedInstanceState) val repo = PasswordRepository.getRepositoryDirectory() val saveIntent = - Intent(this, PasswordCreationActivityV2::class.java).apply { + Intent(this, PasswordCreationActivity::class.java).apply { putExtras( bundleOf( "REPO_PATH" to repo.absolutePath, "FILE_PATH" to repo.resolve(intent.getStringExtra(EXTRA_FOLDER_NAME)!!).absolutePath, - PasswordCreationActivityV2.EXTRA_FILE_NAME to intent.getStringExtra(EXTRA_NAME), - PasswordCreationActivityV2.EXTRA_PASSWORD to intent.getStringExtra(EXTRA_PASSWORD), - PasswordCreationActivityV2.EXTRA_GENERATE_PASSWORD to + PasswordCreationActivity.EXTRA_FILE_NAME to intent.getStringExtra(EXTRA_NAME), + PasswordCreationActivity.EXTRA_PASSWORD to intent.getStringExtra(EXTRA_PASSWORD), + PasswordCreationActivity.EXTRA_GENERATE_PASSWORD to intent.getBooleanExtra(EXTRA_GENERATE_PASSWORD, false) ) ) diff --git a/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivityV2.kt b/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt index fc5cb90b..7b288ca6 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivityV2.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/DecryptActivity.kt @@ -38,12 +38,12 @@ import kotlinx.coroutines.withContext @OptIn(ExperimentalTime::class) @AndroidEntryPoint -class DecryptActivityV2 : BasePgpActivity() { +class DecryptActivity : BasePgpActivity() { private val binding by viewBinding(DecryptLayoutBinding::inflate) + private val relativeParentPath by unsafeLazy { getParentPath(fullPath, repoPath) } @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory @Inject lateinit var repository: CryptoRepository - private val relativeParentPath by unsafeLazy { getParentPath(fullPath, repoPath) } private var passwordEntry: PasswordEntry? = null private var retries = 0 @@ -103,16 +103,13 @@ class DecryptActivityV2 : BasePgpActivity() { * result triggers they can be repopulated with new data. */ private fun editPassword() { - val intent = Intent(this, PasswordCreationActivityV2::class.java) + val intent = Intent(this, PasswordCreationActivity::class.java) intent.putExtra("FILE_PATH", relativeParentPath) intent.putExtra("REPO_PATH", repoPath) - intent.putExtra(PasswordCreationActivityV2.EXTRA_FILE_NAME, name) - intent.putExtra(PasswordCreationActivityV2.EXTRA_PASSWORD, passwordEntry?.password) - intent.putExtra( - PasswordCreationActivityV2.EXTRA_EXTRA_CONTENT, - passwordEntry?.extraContentString - ) - intent.putExtra(PasswordCreationActivityV2.EXTRA_EDITING, true) + intent.putExtra(PasswordCreationActivity.EXTRA_FILE_NAME, name) + intent.putExtra(PasswordCreationActivity.EXTRA_PASSWORD, passwordEntry?.password) + intent.putExtra(PasswordCreationActivity.EXTRA_EXTRA_CONTENT, passwordEntry?.extraContentString) + intent.putExtra(PasswordCreationActivity.EXTRA_EDITING, true) startActivity(intent) finish() } diff --git a/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivityV2.kt b/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt index 50a6e825..b8221a46 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivityV2.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt @@ -65,7 +65,7 @@ import logcat.asLog import logcat.logcat @AndroidEntryPoint -class PasswordCreationActivityV2 : BasePgpActivity() { +class PasswordCreationActivity : BasePgpActivity() { private val binding by viewBinding(PasswordCreationActivityBinding::inflate) @Inject lateinit var passwordEntryFactory: PasswordEntry.Factory @@ -142,7 +142,7 @@ class PasswordCreationActivityV2 : BasePgpActivity() { otpImportButton.setOnClickListener { supportFragmentManager.setFragmentResultListener( OTP_RESULT_REQUEST_KEY, - this@PasswordCreationActivityV2 + this@PasswordCreationActivity ) { requestKey, bundle -> if (requestKey == OTP_RESULT_REQUEST_KEY) { val contents = bundle.getString(RESULT) @@ -160,12 +160,12 @@ class PasswordCreationActivityV2 : BasePgpActivity() { getString(R.string.otp_import_from_file), getString(R.string.otp_import_manual_entry), ) - MaterialAlertDialogBuilder(this@PasswordCreationActivityV2) + MaterialAlertDialogBuilder(this@PasswordCreationActivity) .setItems(items) { _, index -> when (index) { 0 -> otpImportAction.launch( - IntentIntegrator(this@PasswordCreationActivityV2) + IntentIntegrator(this@PasswordCreationActivity) .setOrientationLocked(false) .setBeepEnabled(false) .setDesiredBarcodeFormats(QR_CODE) @@ -205,7 +205,7 @@ class PasswordCreationActivityV2 : BasePgpActivity() { // FileBased. if ( suggestedName == null && - AutofillPreferences.directoryStructure(this@PasswordCreationActivityV2) == + AutofillPreferences.directoryStructure(this@PasswordCreationActivity) == DirectoryStructure.FileBased ) { encryptUsername.apply { @@ -415,7 +415,7 @@ class PasswordCreationActivityV2 : BasePgpActivity() { val oldFile = File("$repoPath/${oldCategory?.trim('/')}/$oldFileName.gpg") if (oldFile.path != file.path && !oldFile.delete()) { setResult(RESULT_CANCELED) - MaterialAlertDialogBuilder(this@PasswordCreationActivityV2) + MaterialAlertDialogBuilder(this@PasswordCreationActivity) .setTitle(R.string.password_creation_file_fail_title) .setMessage( getString(R.string.password_creation_file_delete_fail_message, oldFileName) @@ -443,7 +443,7 @@ class PasswordCreationActivityV2 : BasePgpActivity() { if (e is IOException) { logcat(ERROR) { e.asLog("Failed to write password file") } setResult(RESULT_CANCELED) - MaterialAlertDialogBuilder(this@PasswordCreationActivityV2) + MaterialAlertDialogBuilder(this@PasswordCreationActivity) .setTitle(getString(R.string.password_creation_file_fail_title)) .setMessage(getString(R.string.password_creation_file_write_fail_message)) .setCancelable(false) diff --git a/app/src/main/java/app/passwordstore/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt b/app/src/main/java/app/passwordstore/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt index 04488e90..bb3b6f6f 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt @@ -19,7 +19,7 @@ import app.passwordstore.R import app.passwordstore.databinding.FragmentPwgenDicewareBinding import app.passwordstore.injection.prefs.PasswordGeneratorPreferences import app.passwordstore.passgen.diceware.DicewarePassphraseGenerator -import app.passwordstore.ui.crypto.PasswordCreationActivityV2 +import app.passwordstore.ui.crypto.PasswordCreationActivity import app.passwordstore.util.extensions.getString import app.passwordstore.util.settings.PreferenceKeys.DICEWARE_LENGTH import app.passwordstore.util.settings.PreferenceKeys.DICEWARE_SEPARATOR @@ -58,8 +58,8 @@ class DicewarePasswordGeneratorDialogFragment : DialogFragment() { setTitle(R.string.pwgen_title) setPositiveButton(R.string.dialog_ok) { _, _ -> setFragmentResult( - PasswordCreationActivityV2.PASSWORD_RESULT_REQUEST_KEY, - bundleOf(PasswordCreationActivityV2.RESULT to "${binding.passwordText.text}") + PasswordCreationActivity.PASSWORD_RESULT_REQUEST_KEY, + bundleOf(PasswordCreationActivity.RESULT to "${binding.passwordText.text}") ) } setNeutralButton(R.string.dialog_cancel) { _, _ -> } diff --git a/app/src/main/java/app/passwordstore/ui/dialogs/OtpImportDialogFragment.kt b/app/src/main/java/app/passwordstore/ui/dialogs/OtpImportDialogFragment.kt index cd36be04..4d2413d4 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/OtpImportDialogFragment.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/OtpImportDialogFragment.kt @@ -13,7 +13,7 @@ import androidx.core.os.bundleOf import androidx.fragment.app.DialogFragment import androidx.fragment.app.setFragmentResult import app.passwordstore.databinding.FragmentManualOtpEntryBinding -import app.passwordstore.ui.crypto.PasswordCreationActivityV2 +import app.passwordstore.ui.crypto.PasswordCreationActivity import com.google.android.material.dialog.MaterialAlertDialogBuilder class OtpImportDialogFragment : DialogFragment() { @@ -24,8 +24,8 @@ class OtpImportDialogFragment : DialogFragment() { builder.setView(binding.root) builder.setPositiveButton(android.R.string.ok) { _, _ -> setFragmentResult( - PasswordCreationActivityV2.OTP_RESULT_REQUEST_KEY, - bundleOf(PasswordCreationActivityV2.RESULT to getTOTPUri(binding)) + PasswordCreationActivity.OTP_RESULT_REQUEST_KEY, + bundleOf(PasswordCreationActivity.RESULT to getTOTPUri(binding)) ) } val dialog = builder.create() diff --git a/app/src/main/java/app/passwordstore/ui/dialogs/PasswordGeneratorDialogFragment.kt b/app/src/main/java/app/passwordstore/ui/dialogs/PasswordGeneratorDialogFragment.kt index 352c755f..06ce2d92 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/PasswordGeneratorDialogFragment.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/PasswordGeneratorDialogFragment.kt @@ -26,7 +26,7 @@ import app.passwordstore.passgen.random.NoCharactersIncludedException import app.passwordstore.passgen.random.PasswordGenerator import app.passwordstore.passgen.random.PasswordLengthTooShortException import app.passwordstore.passgen.random.PasswordOption -import app.passwordstore.ui.crypto.PasswordCreationActivityV2 +import app.passwordstore.ui.crypto.PasswordCreationActivity import app.passwordstore.util.settings.PreferenceKeys import com.github.michaelbull.result.getOrElse import com.github.michaelbull.result.runCatching @@ -72,8 +72,8 @@ class PasswordGeneratorDialogFragment : DialogFragment() { setTitle(R.string.pwgen_title) setPositiveButton(R.string.dialog_ok) { _, _ -> setFragmentResult( - PasswordCreationActivityV2.PASSWORD_RESULT_REQUEST_KEY, - bundleOf(PasswordCreationActivityV2.RESULT to "${binding.passwordText.text}") + PasswordCreationActivity.PASSWORD_RESULT_REQUEST_KEY, + bundleOf(PasswordCreationActivity.RESULT to "${binding.passwordText.text}") ) } setNeutralButton(R.string.dialog_cancel) { _, _ -> } diff --git a/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt b/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt index 1a2e1a60..0c38e3da 100644 --- a/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt @@ -11,7 +11,7 @@ import android.os.Looper import androidx.appcompat.app.AppCompatActivity import androidx.core.content.edit import app.passwordstore.ui.crypto.BasePgpActivity -import app.passwordstore.ui.crypto.DecryptActivityV2 +import app.passwordstore.ui.crypto.DecryptActivity import app.passwordstore.ui.passwords.PasswordStore import app.passwordstore.util.auth.BiometricAuthenticator import app.passwordstore.util.auth.BiometricAuthenticator.Result @@ -52,7 +52,7 @@ class LaunchActivity : AppCompatActivity() { } private fun getDecryptIntent(): Intent { - return Intent(this, DecryptActivityV2::class.java) + return Intent(this, DecryptActivity::class.java) } private fun startTargetActivity(noAuth: Boolean) { diff --git a/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt b/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt index eb8967f5..0078f08e 100644 --- a/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt +++ b/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt @@ -29,8 +29,8 @@ import app.passwordstore.data.password.PasswordItem import app.passwordstore.data.repo.PasswordRepository import app.passwordstore.ui.crypto.BasePgpActivity import app.passwordstore.ui.crypto.BasePgpActivity.Companion.getLongName -import app.passwordstore.ui.crypto.DecryptActivityV2 -import app.passwordstore.ui.crypto.PasswordCreationActivityV2 +import app.passwordstore.ui.crypto.DecryptActivity +import app.passwordstore.ui.crypto.PasswordCreationActivity import app.passwordstore.ui.dialogs.FolderCreationDialogFragment import app.passwordstore.ui.folderselect.SelectFolderActivity import app.passwordstore.ui.git.base.BaseGitActivity @@ -383,7 +383,7 @@ class PasswordStore : BaseGitActivity() { val authDecryptIntent = item.createAuthEnabledIntent(this) val decryptIntent = (authDecryptIntent.clone() as Intent).setComponent( - ComponentName(this, DecryptActivityV2::class.java) + ComponentName(this, DecryptActivity::class.java) ) startActivity(decryptIntent) @@ -407,7 +407,7 @@ class PasswordStore : BaseGitActivity() { if (!validateState()) return val currentDir = currentDir logcat(INFO) { "Adding file to : ${currentDir.absolutePath}" } - val intent = Intent(this, PasswordCreationActivityV2::class.java) + val intent = Intent(this, PasswordCreationActivity::class.java) intent.putExtra(BasePgpActivity.EXTRA_FILE_PATH, currentDir.absolutePath) intent.putExtra( BasePgpActivity.EXTRA_REPO_PATH, diff --git a/app/src/main/java/app/passwordstore/util/autofill/Api30AutofillResponseBuilder.kt b/app/src/main/java/app/passwordstore/util/autofill/Api30AutofillResponseBuilder.kt index 45cc1f61..f46d3c1a 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/Api30AutofillResponseBuilder.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/Api30AutofillResponseBuilder.kt @@ -15,7 +15,7 @@ import android.view.inputmethod.InlineSuggestionsRequest import android.widget.inline.InlinePresentationSpec import androidx.annotation.RequiresApi import app.passwordstore.autofill.oreo.ui.AutofillSmsActivity -import app.passwordstore.ui.autofill.AutofillDecryptActivityV2 +import app.passwordstore.ui.autofill.AutofillDecryptActivity import app.passwordstore.ui.autofill.AutofillFilterView import app.passwordstore.ui.autofill.AutofillPublisherChangedActivity import app.passwordstore.ui.autofill.AutofillSaveActivity @@ -81,7 +81,7 @@ constructor( ): Dataset? { if (!scenario.hasFieldsToFillOn(AutofillAction.Match)) return null val metadata = makeFillMatchMetadata(context, file) - val intentSender = AutofillDecryptActivityV2.makeDecryptFileIntentSender(file, context) + val intentSender = AutofillDecryptActivity.makeDecryptFileIntentSender(file, context) return makeIntentDataset(context, AutofillAction.Match, intentSender, metadata, imeSpec) } diff --git a/app/src/main/java/app/passwordstore/util/autofill/AutofillResponseBuilder.kt b/app/src/main/java/app/passwordstore/util/autofill/AutofillResponseBuilder.kt index 8f96a67d..94a4a564 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/AutofillResponseBuilder.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/AutofillResponseBuilder.kt @@ -14,7 +14,7 @@ import android.service.autofill.FillResponse import android.service.autofill.SaveInfo import androidx.annotation.RequiresApi import app.passwordstore.autofill.oreo.ui.AutofillSmsActivity -import app.passwordstore.ui.autofill.AutofillDecryptActivityV2 +import app.passwordstore.ui.autofill.AutofillDecryptActivity import app.passwordstore.ui.autofill.AutofillFilterView import app.passwordstore.ui.autofill.AutofillPublisherChangedActivity import app.passwordstore.ui.autofill.AutofillSaveActivity @@ -70,7 +70,7 @@ constructor( private fun makeMatchDataset(context: Context, file: File): Dataset? { if (!scenario.hasFieldsToFillOn(AutofillAction.Match)) return null val metadata = makeFillMatchMetadata(context, file) - val intentSender = AutofillDecryptActivityV2.makeDecryptFileIntentSender(file, context) + val intentSender = AutofillDecryptActivity.makeDecryptFileIntentSender(file, context) return makeIntentDataset(context, AutofillAction.Match, intentSender, metadata) } |