Remove unnecessary V2 suffix

This commit is contained in:
Harsh Shandilya 2022-07-15 14:02:42 +05:30
parent bcf33e90a5
commit a1f838151e
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
15 changed files with 50 additions and 53 deletions

View file

@ -49,7 +49,7 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.crypto.DecryptActivityV2"
android:name=".ui.crypto.DecryptActivity"
android:exported="true" />
<activity
@ -96,7 +96,7 @@
android:parentActivityName=".ui.passwords.PasswordStore" />
<activity
android:name=".ui.crypto.PasswordCreationActivityV2"
android:name=".ui.crypto.PasswordCreationActivity"
android:exported="false"
android:label="@string/new_password_title"
android:windowSoftInputMode="adjustResize" />
@ -135,7 +135,7 @@
android:label="@string/pref_ssh_keygen_title"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.autofill.AutofillDecryptActivityV2"
android:name=".ui.autofill.AutofillDecryptActivity"
android:exported="false"
android:theme="@style/NoBackgroundThemeM3" />
<activity

View file

@ -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

View file

@ -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)
)
}
}

View file

@ -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)
)
)

View file

@ -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()
}

View file

@ -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)

View file

@ -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) { _, _ -> }

View file

@ -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()

View file

@ -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) { _, _ -> }

View file

@ -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) {

View file

@ -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,

View file

@ -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)
}

View file

@ -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)
}

View file

@ -10,7 +10,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="16dp"
tools:context="app.passwordstore.ui.crypto.DecryptActivityV2">
tools:context="app.passwordstore.ui.crypto.DecryptActivity">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/password_category"

View file

@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false"
tools:context="app.passwordstore.ui.crypto.PasswordCreationActivityV2">
tools:context="app.passwordstore.ui.crypto.PasswordCreationActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"