From c980c898de8417e16942741d469ebef8532b822a Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 28 May 2024 15:11:50 +0530 Subject: chore: reformat with trailing commas changes --- .../passwordstore/data/crypto/CryptoRepository.kt | 7 +- .../data/crypto/PGPPassphraseCache.kt | 22 +---- .../app/passwordstore/data/password/FieldItem.kt | 2 +- .../passwordstore/data/password/PasswordItem.kt | 2 +- .../passwordstore/data/repo/PasswordRepository.kt | 2 +- .../injection/crypto/KeyManagerModule.kt | 5 +- .../injection/prefs/PreferenceModule.kt | 2 +- .../injection/pwgen/DicewareModule.kt | 4 +- .../ui/autofill/AutofillDecryptActivity.kt | 15 ++-- .../ui/autofill/AutofillFilterView.kt | 6 +- .../autofill/AutofillPublisherChangedActivity.kt | 10 +-- .../ui/autofill/AutofillSaveActivity.kt | 14 ++-- .../app/passwordstore/ui/crypto/BasePGPActivity.kt | 2 +- .../passwordstore/ui/crypto/EditPasswordScreen.kt | 9 +-- .../ui/crypto/PasswordCreationActivity.kt | 2 +- .../passwordstore/ui/crypto/ViewPasswordScreen.kt | 15 +--- .../passwordstore/ui/dialogs/BasicBottomSheet.kt | 6 +- .../DicewarePasswordGeneratorDialogFragment.kt | 2 +- .../ui/dialogs/ItemCreationBottomSheet.kt | 2 +- .../ui/dialogs/OtpImportDialogFragment.kt | 2 +- .../ui/dialogs/PasswordGeneratorDialogFragment.kt | 4 +- .../ui/folderselect/SelectFolderActivity.kt | 2 +- .../passwordstore/ui/git/base/BaseGitActivity.kt | 4 +- .../ui/git/config/GitConfigActivity.kt | 2 +- .../ui/git/config/GitServerConfigActivity.kt | 12 +-- .../app/passwordstore/ui/main/LaunchActivity.kt | 4 +- .../passwordstore/ui/passwords/PasswordFragment.kt | 6 +- .../passwordstore/ui/passwords/PasswordStore.kt | 29 +++---- .../java/app/passwordstore/ui/pgp/PGPKeyList.kt | 8 +- .../app/passwordstore/ui/pgp/PGPKeyListActivity.kt | 4 +- .../passwordstore/ui/settings/PasswordSettings.kt | 5 +- .../passwordstore/ui/settings/SettingsActivity.kt | 2 +- .../ui/sshkeygen/SshKeyGenActivity.kt | 2 +- .../ui/sshkeygen/SshKeyImportActivity.kt | 2 +- .../app/passwordstore/ui/util/OnOffItemAnimator.kt | 8 +- .../util/auth/BiometricAuthenticator.kt | 14 ++-- .../util/autofill/Api26AutofillResponseBuilder.kt | 19 ++--- .../util/autofill/Api30AutofillResponseBuilder.kt | 29 +++---- .../passwordstore/util/autofill/AutofillMatcher.kt | 6 +- .../util/autofill/AutofillPreferences.kt | 2 +- .../util/autofill/AutofillResponseBuilder.kt | 2 +- .../util/autofill/AutofillViewUtils.kt | 10 +-- .../util/extensions/AndroidExtensions.kt | 6 +- .../util/extensions/FragmentExtensions.kt | 4 +- .../util/extensions/FragmentViewBindingDelegate.kt | 2 +- .../app/passwordstore/util/features/Feature.kt | 2 +- .../app/passwordstore/util/features/Features.kt | 4 +- .../passwordstore/util/git/GitCommandExecutor.kt | 6 +- .../java/app/passwordstore/util/git/GitCommit.kt | 2 +- .../util/git/operation/CloneOperation.kt | 4 +- .../util/git/operation/GcOperation.kt | 4 +- .../util/git/operation/GitOperation.kt | 15 ++-- .../util/git/operation/PullOperation.kt | 6 +- .../util/git/operation/PushOperation.kt | 4 +- .../util/git/operation/SyncOperation.kt | 6 +- .../java/app/passwordstore/util/git/sshj/SshKey.kt | 17 ++-- .../app/passwordstore/util/git/sshj/SshjConfig.kt | 12 +-- .../util/git/sshj/SshjSessionFactory.kt | 4 +- .../util/services/ClipboardService.kt | 4 +- .../util/services/OreoAutofillService.kt | 4 +- .../util/services/PasswordExportService.kt | 2 +- .../app/passwordstore/util/settings/GitSettings.kt | 8 +- .../app/passwordstore/util/settings/Migrations.kt | 4 +- .../passwordstore/util/settings/PreferenceKeys.kt | 2 +- .../util/shortcuts/ShortcutHandler.kt | 6 +- .../viewmodel/SearchableRepositoryViewModel.kt | 22 ++--- .../autofill/oreo/ui/AutofillSmsActivity.kt | 6 +- .../passwordstore/util/settings/MigrationsTest.kt | 18 ++--- .../autofillparser/AutofillFormParser.kt | 12 +-- .../autofillparser/AutofillHelper.kt | 4 +- .../autofillparser/AutofillScenario.kt | 28 +++---- .../autofillparser/AutofillStrategyDsl.kt | 44 +++++----- .../autofillparser/FeatureAndTrustDetection.kt | 23 +++--- .../autofillparser/FormField.kt | 72 +++-------------- .../autofillparser/PublicSuffixListCache.kt | 4 +- .../lib/publicsuffixlist/PublicSuffixList.kt | 2 +- .../lib/publicsuffixlist/PublicSuffixListData.kt | 2 +- .../app/passwordstore/gradle/KotlinCommonPlugin.kt | 5 +- .../passwordstore/gradle/crowdin/CrowdinPlugin.kt | 5 +- .../passwordstore/gradle/ktfmt/KtfmtCheckTask.kt | 2 +- .../app/passwordstore/gradle/ktfmt/KtfmtDiffer.kt | 2 +- .../passwordstore/gradle/ktfmt/KtfmtFormatTask.kt | 6 +- .../app/passwordstore/gradle/psl/PSLUpdateTask.kt | 2 +- .../app/passwordstore/gradle/tasks/GitHooks.kt | 2 +- .../app/passwordstore/crypto/PGPDecryptOptions.kt | 6 +- .../app/passwordstore/crypto/PGPEncryptOptions.kt | 6 +- .../app/passwordstore/crypto/PGPKeyManager.kt | 6 +- .../app/passwordstore/crypto/PGPKeyManagerTest.kt | 5 +- .../passwordstore/data/passfile/PasswordEntry.kt | 9 +-- .../data/passfile/PasswordEntryTest.kt | 10 +-- .../kotlin/app/passwordstore/util/totp/OtpTest.kt | 93 +++------------------- .../passwordstore/util/totp/UriTotpFinderTest.kt | 2 +- .../diceware/DicewarePassphraseGenerator.kt | 5 +- .../app/passwordstore/passgen/diceware/Die.kt | 5 +- .../diceware/DicewarePassphraseGeneratorTest.kt | 6 +- .../passwordstore/passgen/random/PasswordOption.kt | 2 +- .../passgen/random/RandomPhonemesGenerator.kt | 2 +- .../main/kotlin/app/passwordstore/ui/APSAppBar.kt | 7 +- .../app/passwordstore/ui/compose/PasswordField.kt | 10 +-- .../app/passwordstore/ui/compose/PasswordItem.kt | 2 +- 100 files changed, 309 insertions(+), 563 deletions(-) diff --git a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt index 773a355a..e3e165dd 100644 --- a/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt +++ b/app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt @@ -77,11 +77,6 @@ constructor( .withAsciiArmor(settings.getBoolean(PreferenceKeys.ASCII_ARMOR, false)) .build() val keys = identities.map { id -> pgpKeyManager.getKeyById(id) }.filterValues() - return pgpCryptoHandler.encrypt( - keys, - content, - out, - encryptionOptions, - ) + return pgpCryptoHandler.encrypt(keys, content, out, encryptionOptions) } } diff --git a/app/src/main/java/app/passwordstore/data/crypto/PGPPassphraseCache.kt b/app/src/main/java/app/passwordstore/data/crypto/PGPPassphraseCache.kt index 0632e3c8..4eb8f396 100644 --- a/app/src/main/java/app/passwordstore/data/crypto/PGPPassphraseCache.kt +++ b/app/src/main/java/app/passwordstore/data/crypto/PGPPassphraseCache.kt @@ -11,35 +11,21 @@ import javax.inject.Inject import kotlinx.coroutines.withContext /** Implements a rudimentary [EncryptedSharedPreferences]-backed cache for GPG passphrases. */ -class PGPPassphraseCache -@Inject -constructor( - private val dispatcherProvider: DispatcherProvider, -) { +class PGPPassphraseCache @Inject constructor(private val dispatcherProvider: DispatcherProvider) { - suspend fun cachePassphrase( - context: Context, - identifier: PGPIdentifier, - passphrase: String, - ) { + suspend fun cachePassphrase(context: Context, identifier: PGPIdentifier, passphrase: String) { withContext(dispatcherProvider.io()) { getPreferences(context).edit { putString(identifier.toString(), passphrase) } } } - suspend fun retrieveCachedPassphrase( - context: Context, - identifier: PGPIdentifier, - ): String? { + suspend fun retrieveCachedPassphrase(context: Context, identifier: PGPIdentifier): String? { return withContext(dispatcherProvider.io()) { getPreferences(context).getString(identifier.toString()) } } - suspend fun clearCachedPassphrase( - context: Context, - identifier: PGPIdentifier, - ) { + suspend fun clearCachedPassphrase(context: Context, identifier: PGPIdentifier) { withContext(dispatcherProvider.io()) { getPreferences(context).edit { remove(identifier.toString()) } } diff --git a/app/src/main/java/app/passwordstore/data/password/FieldItem.kt b/app/src/main/java/app/passwordstore/data/password/FieldItem.kt index 9997fcda..2fb5cf0e 100644 --- a/app/src/main/java/app/passwordstore/data/password/FieldItem.kt +++ b/app/src/main/java/app/passwordstore/data/password/FieldItem.kt @@ -10,7 +10,7 @@ import app.passwordstore.data.passfile.Totp class FieldItem(val key: String, val value: String, val action: ActionType) { enum class ActionType { COPY, - HIDE + HIDE, } enum class ItemType(val type: String, val label: String) { diff --git a/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt b/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt index be3443ef..330c1e40 100644 --- a/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt +++ b/app/src/main/java/app/passwordstore/data/password/PasswordItem.kt @@ -16,7 +16,7 @@ data class PasswordItem( val parent: PasswordItem? = null, val type: Char, val file: File, - val rootDir: File + val rootDir: File, ) : Comparable { val fullPathToParent = file.absolutePath.replace(rootDir.absolutePath, "").replace(file.name, "") diff --git a/app/src/main/java/app/passwordstore/data/repo/PasswordRepository.kt b/app/src/main/java/app/passwordstore/data/repo/PasswordRepository.kt index 39c6b384..ed18f87a 100644 --- a/app/src/main/java/app/passwordstore/data/repo/PasswordRepository.kt +++ b/app/src/main/java/app/passwordstore/data/repo/PasswordRepository.kt @@ -167,7 +167,7 @@ object PasswordRepository { fun getPasswords( path: File, rootDir: File, - sortOrder: PasswordSortOrder + sortOrder: PasswordSortOrder, ): ArrayList { // We need to recover the passwords then parse the files val passList = getFilesList(path).also { it.sortBy { f -> f.name } } diff --git a/app/src/main/java/app/passwordstore/injection/crypto/KeyManagerModule.kt b/app/src/main/java/app/passwordstore/injection/crypto/KeyManagerModule.kt index 69174394..ae7af010 100644 --- a/app/src/main/java/app/passwordstore/injection/crypto/KeyManagerModule.kt +++ b/app/src/main/java/app/passwordstore/injection/crypto/KeyManagerModule.kt @@ -23,10 +23,7 @@ object KeyManagerModule { @PGPKeyDir keyDir: String, dispatcherProvider: DispatcherProvider, ): PGPKeyManager { - return PGPKeyManager( - keyDir, - dispatcherProvider.io(), - ) + return PGPKeyManager(keyDir, dispatcherProvider.io()) } @Provides diff --git a/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt b/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt index 797c7563..5e788348 100644 --- a/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt +++ b/app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt @@ -25,7 +25,7 @@ class PreferenceModule { fileName, masterKeyAlias, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, - EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM + EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM, ) } diff --git a/app/src/main/java/app/passwordstore/injection/pwgen/DicewareModule.kt b/app/src/main/java/app/passwordstore/injection/pwgen/DicewareModule.kt index d8057356..acaa7511 100644 --- a/app/src/main/java/app/passwordstore/injection/pwgen/DicewareModule.kt +++ b/app/src/main/java/app/passwordstore/injection/pwgen/DicewareModule.kt @@ -32,9 +32,7 @@ object DicewareModule { } @Provides - fun provideDie( - intGenerator: RandomIntGenerator, - ): Die { + fun provideDie(intGenerator: RandomIntGenerator): Die { return Die(6, intGenerator) } diff --git a/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt b/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt index 4518e62f..c4114685 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt @@ -113,7 +113,7 @@ class AutofillDecryptActivity : BasePGPActivity() { val cachedPassphrase = passphraseCache.retrieveCachedPassphrase( this@AutofillDecryptActivity, - gpgIdentifiers.first() + gpgIdentifiers.first(), ) if (cachedPassphrase != null) { decryptWithPassphrase( @@ -121,7 +121,7 @@ class AutofillDecryptActivity : BasePGPActivity() { gpgIdentifiers, clientState, action, - cachedPassphrase + cachedPassphrase, ) } else { askPassphrase(filePath, gpgIdentifiers, clientState, action) @@ -169,12 +169,12 @@ class AutofillDecryptActivity : BasePGPActivity() { this@AutofillDecryptActivity, credentials, clientState, - action + action, ) withContext(dispatcherProvider.main()) { setResult( RESULT_OK, - Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) } + Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) }, ) } } @@ -195,12 +195,7 @@ class AutofillDecryptActivity : BasePGPActivity() { runCatching { withContext(dispatcherProvider.io()) { val outputStream = ByteArrayOutputStream() - repository.decrypt( - password, - identifiers, - encryptedInput, - outputStream, - ) + repository.decrypt(password, identifiers, encryptedInput, outputStream) outputStream } } 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 f0267f26..70dcd78d 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillFilterView.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillFilterView.kt @@ -61,7 +61,7 @@ class AutofillFilterView : AppCompatActivity() { fun makeMatchAndDecryptFileIntentSender( context: Context, - formOrigin: FormOrigin + formOrigin: FormOrigin, ): IntentSender { val intent = Intent(context, AutofillFilterView::class.java).apply { @@ -193,7 +193,7 @@ class AutofillFilterView : AppCompatActivity() { shouldMatch.text = getString( R.string.oreo_autofill_match_with, - formOrigin.getPrettyIdentifier(applicationContext) + formOrigin.getPrettyIdentifier(applicationContext), ) lifecycleScope.launch { handleSearchResults() } } @@ -222,7 +222,7 @@ class AutofillFilterView : AppCompatActivity() { filterMode = if (binding.strictDomainSearch.isChecked) FilterMode.StrictDomain else FilterMode.Fuzzy, searchMode = SearchMode.RecursivelyInSubdirectories, - listMode = ListMode.FilesOnly + listMode = ListMode.FilesOnly, ) } diff --git a/app/src/main/java/app/passwordstore/ui/autofill/AutofillPublisherChangedActivity.kt b/app/src/main/java/app/passwordstore/ui/autofill/AutofillPublisherChangedActivity.kt index 30347c0c..cbcf6bef 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillPublisherChangedActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillPublisherChangedActivity.kt @@ -92,17 +92,17 @@ class AutofillPublisherChangedActivity : AppCompatActivity() { resetButton.setOnClickListener { AutofillMatcher.clearMatchesFor( this@AutofillPublisherChangedActivity, - FormOrigin.App(appPackage) + FormOrigin.App(appPackage), ) val fillResponse = IntentCompat.getParcelableExtra( intent, EXTRA_FILL_RESPONSE_AFTER_RESET, - FillResponse::class.java + FillResponse::class.java, ) setResult( RESULT_OK, - Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillResponse) } + Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillResponse) }, ) finish() } @@ -122,7 +122,7 @@ class AutofillPublisherChangedActivity : AppCompatActivity() { warningAppName.text = getString( R.string.oreo_autofill_warning_publisher_app_name, - packageManager.getApplicationLabel(appInfo) + packageManager.getApplicationLabel(appInfo), ) val currentHash = @@ -131,7 +131,7 @@ class AutofillPublisherChangedActivity : AppCompatActivity() { getString( R.string.oreo_autofill_warning_publisher_advanced_info_template, appPackage, - currentHash + currentHash, ) } } 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 b0cfde5b..c645ea04 100644 --- a/app/src/main/java/app/passwordstore/ui/autofill/AutofillSaveActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/autofill/AutofillSaveActivity.kt @@ -47,7 +47,7 @@ class AutofillSaveActivity : AppCompatActivity() { fun makeSaveIntentSender( context: Context, credentials: Credentials?, - formOrigin: FormOrigin + formOrigin: FormOrigin, ): IntentSender { val identifier = formOrigin.getPrettyIdentifier(context, untrusted = false) // Prevent directory traversals @@ -58,12 +58,12 @@ class AutofillSaveActivity : AppCompatActivity() { val folderName = directoryStructure.getSaveFolderName( sanitizedIdentifier = sanitizedIdentifier, - username = credentials?.username + username = credentials?.username, ) val fileName = directoryStructure.getSaveFileName( username = credentials?.username, - identifier = identifier + identifier = identifier, ) val intent = Intent(context, AutofillSaveActivity::class.java).apply { @@ -76,7 +76,7 @@ class AutofillSaveActivity : AppCompatActivity() { formOrigin.identifier.takeIf { formOrigin is FormOrigin.App }, EXTRA_SHOULD_MATCH_WEB to formOrigin.identifier.takeIf { formOrigin is FormOrigin.Web }, - EXTRA_GENERATE_PASSWORD to (credentials == null) + EXTRA_GENERATE_PASSWORD to (credentials == null), ) ) } @@ -84,7 +84,7 @@ class AutofillSaveActivity : AppCompatActivity() { context, saveRequestCode++, intent, - PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE + PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) .intentSender } @@ -114,7 +114,7 @@ class AutofillSaveActivity : AppCompatActivity() { 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) + intent.getBooleanExtra(EXTRA_GENERATE_PASSWORD, false), ) ) } @@ -141,7 +141,7 @@ class AutofillSaveActivity : AppCompatActivity() { this, credentials, clientState, - AutofillAction.Generate + AutofillAction.Generate, ) Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) diff --git a/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt b/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt index 7fa56333..a0cf6f7c 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt @@ -90,7 +90,7 @@ open class BasePGPActivity : AppCompatActivity() { fun copyTextToClipboard( text: String?, showSnackbar: Boolean = true, - @StringRes snackbarTextRes: Int = R.string.clipboard_copied_text + @StringRes snackbarTextRes: Int = R.string.clipboard_copied_text, ) { val clipboard = clipboard ?: return val clip = ClipData.newPlainText("pgp_handler_result_pm", text) diff --git a/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt b/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt index 4a7b1aa2..b456fcc5 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt @@ -40,7 +40,7 @@ fun EditPasswordScreen( onNavigationIconClick = onNavigateUp, backgroundColor = MaterialTheme.colorScheme.surface, ) - }, + } ) { paddingValues -> Box(modifier = modifier.padding(paddingValues)) { Column(modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp).fillMaxSize()) { @@ -59,10 +59,7 @@ fun EditPasswordScreen( } @Composable -private fun ExtraContent( - entry: PasswordEntry, - modifier: Modifier = Modifier, -) { +private fun ExtraContent(entry: PasswordEntry, modifier: Modifier = Modifier) { TextField( value = entry.extraContentString, onValueChange = {}, @@ -95,5 +92,5 @@ private fun createTestEntry() = |URL: example.com """ .trimMargin() - .encodeToByteArray() + .encodeToByteArray(), ) diff --git a/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt b/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt index 6370677f..525d9f95 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt @@ -147,7 +147,7 @@ class PasswordCreationActivity : BasePGPActivity() { otpImportButton.setOnClickListener { supportFragmentManager.setFragmentResultListener( OTP_RESULT_REQUEST_KEY, - this@PasswordCreationActivity + this@PasswordCreationActivity, ) { requestKey, bundle -> if (requestKey == OTP_RESULT_REQUEST_KEY) { val contents = bundle.getString(RESULT) diff --git a/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt b/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt index 70933ab4..18a07893 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt @@ -46,7 +46,7 @@ fun ViewPasswordScreen( onNavigationIconClick = onNavigateUp, backgroundColor = MaterialTheme.colorScheme.surface, ) - }, + } ) { paddingValues -> Box(modifier = modifier.padding(paddingValues)) { Column(modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp).fillMaxSize()) { @@ -87,10 +87,7 @@ fun ViewPasswordScreen( } @Composable -private fun ExtraContent( - entry: PasswordEntry, - modifier: Modifier = Modifier, -) { +private fun ExtraContent(entry: PasswordEntry, modifier: Modifier = Modifier) { entry.extraContent.forEach { (label, value) -> TextField( value = value, @@ -107,11 +104,7 @@ private fun ExtraContent( @Composable private fun ViewPasswordScreenPreview() { APSTheme { - ViewPasswordScreen( - entryName = "Test Entry", - entry = createTestEntry(), - onNavigateUp = {}, - ) + ViewPasswordScreen(entryName = "Test Entry", entry = createTestEntry(), onNavigateUp = {}) } } @@ -126,5 +119,5 @@ private fun createTestEntry() = |URL: example.com """ .trimMargin() - .encodeToByteArray() + .encodeToByteArray(), ) diff --git a/app/src/main/java/app/passwordstore/ui/dialogs/BasicBottomSheet.kt b/app/src/main/java/app/passwordstore/ui/dialogs/BasicBottomSheet.kt index 11c23311..2545d073 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/BasicBottomSheet.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/BasicBottomSheet.kt @@ -54,7 +54,7 @@ private constructor( override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { if (savedInstanceState != null) dismiss() return layoutInflater.inflate(R.layout.basic_bottom_sheet, container, false) @@ -157,9 +157,7 @@ private constructor( return this } - fun setOnDismissListener( - onDismissListener: OnDismissListener, - ): Builder { + fun setOnDismissListener(onDismissListener: OnDismissListener): Builder { this.onDismissListener = onDismissListener return this } 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 e158a4c1..2ae698a5 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/DicewarePasswordGeneratorDialogFragment.kt @@ -59,7 +59,7 @@ class DicewarePasswordGeneratorDialogFragment : DialogFragment() { setPositiveButton(R.string.dialog_ok) { _, _ -> setFragmentResult( PasswordCreationActivity.PASSWORD_RESULT_REQUEST_KEY, - bundleOf(PasswordCreationActivity.RESULT to "${binding.passwordText.text}") + bundleOf(PasswordCreationActivity.RESULT to "${binding.passwordText.text}"), ) } setNeutralButton(R.string.dialog_cancel) { _, _ -> } diff --git a/app/src/main/java/app/passwordstore/ui/dialogs/ItemCreationBottomSheet.kt b/app/src/main/java/app/passwordstore/ui/dialogs/ItemCreationBottomSheet.kt index 82228f20..73e41239 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/ItemCreationBottomSheet.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/ItemCreationBottomSheet.kt @@ -38,7 +38,7 @@ class ItemCreationBottomSheet : BottomSheetDialogFragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { if (savedInstanceState != null) dismiss() return inflater.inflate(R.layout.item_create_sheet, container, false) 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 4d2413d4..16f6f17f 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/OtpImportDialogFragment.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/OtpImportDialogFragment.kt @@ -25,7 +25,7 @@ class OtpImportDialogFragment : DialogFragment() { builder.setPositiveButton(android.R.string.ok) { _, _ -> setFragmentResult( PasswordCreationActivity.OTP_RESULT_REQUEST_KEY, - bundleOf(PasswordCreationActivity.RESULT to getTOTPUri(binding)) + 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 1f37e205..cb7576dd 100644 --- a/app/src/main/java/app/passwordstore/ui/dialogs/PasswordGeneratorDialogFragment.kt +++ b/app/src/main/java/app/passwordstore/ui/dialogs/PasswordGeneratorDialogFragment.kt @@ -73,7 +73,7 @@ class PasswordGeneratorDialogFragment : DialogFragment() { setPositiveButton(R.string.dialog_ok) { _, _ -> setFragmentResult( PasswordCreationActivity.PASSWORD_RESULT_REQUEST_KEY, - bundleOf(PasswordCreationActivity.RESULT to "${binding.passwordText.text}") + bundleOf(PasswordCreationActivity.RESULT to "${binding.passwordText.text}"), ) } setNeutralButton(R.string.dialog_cancel) { _, _ -> } @@ -123,7 +123,7 @@ class PasswordGeneratorDialogFragment : DialogFragment() { PasswordOption.NoUppercaseLetters.takeIf { !isChecked(R.id.uppercase) }, PasswordOption.NoAmbiguousCharacters.takeIf { !isChecked(R.id.ambiguous) }, PasswordOption.FullyRandom.takeIf { !isChecked(R.id.pronounceable) }, - PasswordOption.NoLowercaseLetters.takeIf { !isChecked(R.id.lowercase) } + PasswordOption.NoLowercaseLetters.takeIf { !isChecked(R.id.lowercase) }, ) } diff --git a/app/src/main/java/app/passwordstore/ui/folderselect/SelectFolderActivity.kt b/app/src/main/java/app/passwordstore/ui/folderselect/SelectFolderActivity.kt index 3fffa90d..9d4531f4 100644 --- a/app/src/main/java/app/passwordstore/ui/folderselect/SelectFolderActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/folderselect/SelectFolderActivity.kt @@ -28,7 +28,7 @@ class SelectFolderActivity : AppCompatActivity(R.layout.select_folder_layout) { val args = Bundle() args.putString( PasswordStore.REQUEST_ARG_PATH, - PasswordRepository.getRepositoryDirectory().absolutePath + PasswordRepository.getRepositoryDirectory().absolutePath, ) passwordList.arguments = args diff --git a/app/src/main/java/app/passwordstore/ui/git/base/BaseGitActivity.kt b/app/src/main/java/app/passwordstore/ui/git/base/BaseGitActivity.kt index 54a26365..16bd46d3 100644 --- a/app/src/main/java/app/passwordstore/ui/git/base/BaseGitActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/git/base/BaseGitActivity.kt @@ -131,7 +131,7 @@ abstract class BaseGitActivity : AppCompatActivity() { gitSettings.useMultiplexing = false SSHException( DisconnectReason.TOO_MANY_CONNECTIONS, - "The server does not support multiple Git operations per SSH session. Please try again, a slower fallback mode will be used." + "The server does not support multiple Git operations per SSH session. Please try again, a slower fallback mode will be used.", ) } err.message?.contains("int org.eclipse.jgit.lib.AnyObjectId.w1") == true -> { @@ -143,7 +143,7 @@ abstract class BaseGitActivity : AppCompatActivity() { err.disconnectReason == DisconnectReason.HOST_KEY_NOT_VERIFIABLE -> { SSHException( DisconnectReason.HOST_KEY_NOT_VERIFIABLE, - "WARNING: The remote host key has changed. If this is expected, please go to Git server settings and clear the saved host key." + "WARNING: The remote host key has changed. If this is expected, please go to Git server settings and clear the saved host key.", ) } else -> { diff --git a/app/src/main/java/app/passwordstore/ui/git/config/GitConfigActivity.kt b/app/src/main/java/app/passwordstore/ui/git/config/GitConfigActivity.kt index d7584e69..68681d7f 100644 --- a/app/src/main/java/app/passwordstore/ui/git/config/GitConfigActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/git/config/GitConfigActivity.kt @@ -61,7 +61,7 @@ class GitConfigActivity : BaseGitActivity() { Snackbar.make( binding.root, getString(R.string.git_server_config_save_success), - Snackbar.LENGTH_SHORT + Snackbar.LENGTH_SHORT, ) .show() Handler(Looper.getMainLooper()).postDelayed(500) { finish() } diff --git a/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt b/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt index 9a3029bc..e292cf4e 100644 --- a/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt @@ -94,7 +94,7 @@ class GitServerConfigActivity : BaseGitActivity() { Snackbar.make( binding.root, getString(R.string.clear_saved_host_key_success), - Snackbar.LENGTH_LONG + Snackbar.LENGTH_LONG, ) .show() it.isVisible = false @@ -140,14 +140,14 @@ class GitServerConfigActivity : BaseGitActivity() { val updateResult = gitSettings.updateConnectionSettingsIfValid( newAuthMode = newAuthMode, - newUrl = binding.serverUrl.text.toString().trim() + newUrl = binding.serverUrl.text.toString().trim(), ) ) { GitSettings.UpdateConnectionSettingsResult.FailedToParseUrl -> { Snackbar.make( binding.root, getString(R.string.git_server_config_save_error), - Snackbar.LENGTH_LONG + Snackbar.LENGTH_LONG, ) .show() } @@ -175,7 +175,7 @@ class GitServerConfigActivity : BaseGitActivity() { Snackbar.make( binding.root, getString(R.string.git_server_config_save_success), - Snackbar.LENGTH_SHORT + Snackbar.LENGTH_SHORT, ) .show() Handler(Looper.getMainLooper()).postDelayed(500) { finish() } @@ -242,7 +242,7 @@ class GitServerConfigActivity : BaseGitActivity() { val snackbar = snackbar( message = getString(R.string.delete_directory_progress_text), - length = Snackbar.LENGTH_INDEFINITE + length = Snackbar.LENGTH_INDEFINITE, ) withContext(dispatcherProvider.io()) { localDir.deleteRecursively() @@ -255,7 +255,7 @@ class GitServerConfigActivity : BaseGitActivity() { setResult(RESULT_OK) finish() }, - failure = { err -> promptOnErrorHandler(err) { finish() } } + failure = { err -> promptOnErrorHandler(err) { finish() } }, ) } } 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 91c826ce..30b4d272 100644 --- a/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/main/LaunchActivity.kt @@ -58,11 +58,11 @@ class LaunchActivity : AppCompatActivity() { getDecryptIntent().apply { putExtra( BasePGPActivity.EXTRA_FILE_PATH, - intent.getStringExtra(BasePGPActivity.EXTRA_FILE_PATH) + intent.getStringExtra(BasePGPActivity.EXTRA_FILE_PATH), ) putExtra( BasePGPActivity.EXTRA_REPO_PATH, - intent.getStringExtra(BasePGPActivity.EXTRA_REPO_PATH) + intent.getStringExtra(BasePGPActivity.EXTRA_REPO_PATH), ) } else Intent(this, PasswordStore::class.java).setAction(Intent.ACTION_VIEW) diff --git a/app/src/main/java/app/passwordstore/ui/passwords/PasswordFragment.kt b/app/src/main/java/app/passwordstore/ui/passwords/PasswordFragment.kt index 60580ff5..5b6826bc 100644 --- a/app/src/main/java/app/passwordstore/ui/passwords/PasswordFragment.kt +++ b/app/src/main/java/app/passwordstore/ui/passwords/PasswordFragment.kt @@ -156,7 +156,7 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) { resources.getQuantityString( R.plurals.delete_title, selection.size(), - selection.size() + selection.size(), ) actionMode!!.invalidate() } else { @@ -256,7 +256,7 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) { val passwordItem = recyclerAdapter.getSelectedItems()[0] shortcutHandler.addPinnedShortcut( passwordItem, - passwordItem.createAuthEnabledIntent(requireContext()) + passwordItem.createAuthEnabledIntent(requireContext()), ) false } @@ -372,7 +372,7 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) { requireStore().clearSearch() model.navigateTo( file, - recyclerViewState = binding.passRecycler.layoutManager!!.onSaveInstanceState() + recyclerViewState = binding.passRecycler.layoutManager!!.onSaveInstanceState(), ) requireStore().supportActionBar?.setDisplayHomeAsUpEnabled(true) } 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 24cd8bbd..c4dd631e 100644 --- a/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt +++ b/app/src/main/java/app/passwordstore/ui/passwords/PasswordStore.kt @@ -115,7 +115,7 @@ class PasswordStore : BaseGitActivity() { getLongName( requireNotNull(source.parent) { "$file has no parent" }, repositoryPath, - basename + basename, ) val destinationLongName = getLongName(target.absolutePath, repositoryPath, basename) if (destinationFile.exists()) { @@ -127,7 +127,7 @@ class PasswordStore : BaseGitActivity() { resources.getString( R.string.password_exists_message, destinationLongName, - sourceLongName + sourceLongName, ) ) .setPositiveButton(R.string.dialog_ok) { _, _ -> @@ -148,7 +148,7 @@ class PasswordStore : BaseGitActivity() { getLongName( requireNotNull(source.parent) { "$basename has no parent" }, repositoryPath, - basename + basename, ) val destinationLongName = getLongName(target.absolutePath, repositoryPath, basename) withContext(dispatcherProvider.main()) { @@ -156,8 +156,8 @@ class PasswordStore : BaseGitActivity() { resources.getString( R.string.git_commit_move_text, sourceLongName, - destinationLongName - ), + destinationLongName, + ) ) } } @@ -166,7 +166,7 @@ class PasswordStore : BaseGitActivity() { val relativePath = getRelativePath("${target.absolutePath}/", repoDir) withContext(dispatcherProvider.main()) { commitChange( - resources.getString(R.string.git_commit_move_multiple_text, relativePath), + resources.getString(R.string.git_commit_move_multiple_text, relativePath) ) } } @@ -340,10 +340,7 @@ class PasswordStore : BaseGitActivity() { private fun runGitOperation(operation: GitOp) = lifecycleScope.launch { launchGitOperation(operation) - .fold( - success = { refreshPasswordList() }, - failure = { promptOnErrorHandler(it) }, - ) + .fold(success = { refreshPasswordList() }, failure = { promptOnErrorHandler(it) }) } private fun checkLocalRepository() { @@ -414,7 +411,7 @@ class PasswordStore : BaseGitActivity() { intent.putExtra(BasePGPActivity.EXTRA_FILE_PATH, currentDir.absolutePath) intent.putExtra( BasePGPActivity.EXTRA_REPO_PATH, - PasswordRepository.getRepositoryDirectory().absolutePath + PasswordRepository.getRepositoryDirectory().absolutePath, ) listRefreshAction.launch(intent) } @@ -450,9 +447,7 @@ class PasswordStore : BaseGitActivity() { item.file.toRelativeString(PasswordRepository.getRepositoryDirectory()) } lifecycleScope.launch { - commitChange( - resources.getString(R.string.git_commit_remove_text, fmt), - ) + commitChange(resources.getString(R.string.git_commit_remove_text, fmt)) } } .setNegativeButton(resources.getString(R.string.dialog_no), null) @@ -487,7 +482,7 @@ class PasswordStore : BaseGitActivity() { */ private fun renameCategory( oldCategory: PasswordItem, - error: CategoryRenameError = CategoryRenameError.None + error: CategoryRenameError = CategoryRenameError.None, ) { val view = layoutInflater.inflate(R.layout.folder_dialog_fragment, null) val newCategoryEditText = view.findViewById(R.id.folder_name_text) @@ -530,8 +525,8 @@ class PasswordStore : BaseGitActivity() { resources.getString( R.string.git_commit_move_text, oldCategory.name, - newCategory.name - ), + newCategory.name, + ) ) } } diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt index 5b12fd88..dae2ce0b 100644 --- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt +++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt @@ -54,7 +54,7 @@ fun KeyList( ) { Image( painter = painterResource(id = R.drawable.ic_launcher_foreground), - contentDescription = "Password Store logo" + contentDescription = "Password Store logo", ) Text(stringResource(R.string.pgp_key_manager_no_keys_guidance)) } @@ -81,7 +81,7 @@ private fun KeyItem( onConfirm = { onItemClick(identifier) isDeleting = false - } + }, ) val label = when (identifier) { @@ -106,7 +106,7 @@ private fun KeyItem( IconButton(onClick = { isDeleting = true }, modifier = Modifier.requiredSize(24.dp)) { Icon( painter = painterResource(R.drawable.ic_delete_24dp), - stringResource(id = R.string.delete) + stringResource(id = R.string.delete), ) } } @@ -148,7 +148,7 @@ private fun KeyListPreview() { PGPIdentifier.fromString("0xB950AE2813841585"), ) .toPersistentList(), - onItemClick = {} + onItemClick = {}, ) } } diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt index 9ae9f879..8c6743f9 100644 --- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt @@ -52,10 +52,10 @@ class PGPKeyListActivity : ComponentActivity() { ) { Icon( painter = painterResource(R.drawable.ic_add_48dp), - stringResource(R.string.pref_import_pgp_key_title) + stringResource(R.string.pref_import_pgp_key_title), ) } - } + }, ) { paddingValues -> KeyList( identifiers = viewModel.keys, diff --git a/app/src/main/java/app/passwordstore/ui/settings/PasswordSettings.kt b/app/src/main/java/app/passwordstore/ui/settings/PasswordSettings.kt index cb1643b0..5ce45e8f 100644 --- a/app/src/main/java/app/passwordstore/ui/settings/PasswordSettings.kt +++ b/app/src/main/java/app/passwordstore/ui/settings/PasswordSettings.kt @@ -22,10 +22,7 @@ class PasswordSettings(private val activity: FragmentActivity) : SettingsProvide val values = activity.resources.getStringArray(R.array.pwgen_provider_values) val labels = activity.resources.getStringArray(R.array.pwgen_provider_labels) val items = values.zip(labels).map { SelectionItem(it.first, it.second, null) } - singleChoice( - PreferenceKeys.PREF_KEY_PWGEN_TYPE, - items, - ) { + singleChoice(PreferenceKeys.PREF_KEY_PWGEN_TYPE, items) { initialSelection = "diceware" titleRes = R.string.pref_password_generator_type_title } diff --git a/app/src/main/java/app/passwordstore/ui/settings/SettingsActivity.kt b/app/src/main/java/app/passwordstore/ui/settings/SettingsActivity.kt index 7c9d8e8b..6b378e8c 100644 --- a/app/src/main/java/app/passwordstore/ui/settings/SettingsActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/settings/SettingsActivity.kt @@ -103,7 +103,7 @@ class SettingsActivity : AppCompatActivity() { BundleCompat.getParcelable( savedInstanceState, "adapter", - PreferencesAdapter.SavedState::class.java + PreferencesAdapter.SavedState::class.java, ) ?.let(adapter::loadSavedState) } diff --git a/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyGenActivity.kt b/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyGenActivity.kt index 68d5a40c..79b6cbc1 100644 --- a/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyGenActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyGenActivity.kt @@ -126,7 +126,7 @@ class SshKeyGenActivity : AppCompatActivity() { suspendCoroutine { cont -> BiometricAuthenticator.authenticate( this@SshKeyGenActivity, - R.string.biometric_prompt_title_ssh_keygen + R.string.biometric_prompt_title_ssh_keygen, ) { result -> // Do not cancel on failed attempts as these are handled by the // authenticator UI. diff --git a/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyImportActivity.kt b/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyImportActivity.kt index 99b3bf3f..6245635b 100644 --- a/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyImportActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/sshkeygen/SshKeyImportActivity.kt @@ -29,7 +29,7 @@ class SshKeyImportActivity : AppCompatActivity() { Toast.makeText( this, resources.getString(R.string.ssh_key_success_dialog_title), - Toast.LENGTH_LONG + Toast.LENGTH_LONG, ) .show() setResult(RESULT_OK) diff --git a/app/src/main/java/app/passwordstore/ui/util/OnOffItemAnimator.kt b/app/src/main/java/app/passwordstore/ui/util/OnOffItemAnimator.kt index c315766a..1a2a8194 100644 --- a/app/src/main/java/app/passwordstore/ui/util/OnOffItemAnimator.kt +++ b/app/src/main/java/app/passwordstore/ui/util/OnOffItemAnimator.kt @@ -23,7 +23,7 @@ class OnOffItemAnimator : DefaultItemAnimator() { override fun animateAppearance( viewHolder: RecyclerView.ViewHolder, preLayoutInfo: ItemHolderInfo?, - postLayoutInfo: ItemHolderInfo + postLayoutInfo: ItemHolderInfo, ): Boolean { return if (isEnabled) { super.animateAppearance(viewHolder, preLayoutInfo, postLayoutInfo) @@ -36,7 +36,7 @@ class OnOffItemAnimator : DefaultItemAnimator() { oldHolder: RecyclerView.ViewHolder, newHolder: RecyclerView.ViewHolder, preInfo: ItemHolderInfo, - postInfo: ItemHolderInfo + postInfo: ItemHolderInfo, ): Boolean { return if (isEnabled) { super.animateChange(oldHolder, newHolder, preInfo, postInfo) @@ -48,7 +48,7 @@ class OnOffItemAnimator : DefaultItemAnimator() { override fun animateDisappearance( viewHolder: RecyclerView.ViewHolder, preLayoutInfo: ItemHolderInfo, - postLayoutInfo: ItemHolderInfo? + postLayoutInfo: ItemHolderInfo?, ): Boolean { return if (isEnabled) { super.animateDisappearance(viewHolder, preLayoutInfo, postLayoutInfo) @@ -60,7 +60,7 @@ class OnOffItemAnimator : DefaultItemAnimator() { override fun animatePersistence( viewHolder: RecyclerView.ViewHolder, preInfo: ItemHolderInfo, - postInfo: ItemHolderInfo + postInfo: ItemHolderInfo, ): Boolean { return if (isEnabled) { super.animatePersistence(viewHolder, preInfo, postInfo) diff --git a/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt b/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt index c6cd5820..e24311be 100644 --- a/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt +++ b/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt @@ -57,7 +57,7 @@ object BiometricAuthenticator { fun authenticate( activity: FragmentActivity, @StringRes dialogTitleRes: Int = R.string.biometric_prompt_title, - callback: (Result) -> Unit + callback: (Result) -> Unit, ) { val authCallback = createPromptAuthenticationCallback(activity, callback) val deviceHasKeyguard = activity.getSystemService()?.isDeviceSecure == true @@ -94,14 +94,14 @@ object BiometricAuthenticator { callback( Result.Failure( errorCode, - activity.getString(R.string.biometric_auth_error_reason, errString) + activity.getString(R.string.biometric_auth_error_reason, errString), ) ) BiometricPrompt.ERROR_NO_SPACE -> callback( Result.Failure( errorCode, - activity.getString(R.string.biometric_auth_error_reason, errString) + activity.getString(R.string.biometric_auth_error_reason, errString), ) ) BiometricPrompt.ERROR_CANCELED -> callback(Result.CanceledBySystem) @@ -109,21 +109,21 @@ object BiometricAuthenticator { callback( Result.Failure( errorCode, - activity.getString(R.string.biometric_auth_error_reason, errString) + activity.getString(R.string.biometric_auth_error_reason, errString), ) ) BiometricPrompt.ERROR_VENDOR -> callback( Result.Failure( errorCode, - activity.getString(R.string.biometric_auth_error_reason, errString) + activity.getString(R.string.biometric_auth_error_reason, errString), ) ) BiometricPrompt.ERROR_LOCKOUT_PERMANENT -> callback( Result.Failure( errorCode, - activity.getString(R.string.biometric_auth_error_reason, errString) + activity.getString(R.string.biometric_auth_error_reason, errString), ) ) BiometricPrompt.ERROR_USER_CANCELED -> callback(Result.CanceledByUser) @@ -138,7 +138,7 @@ object BiometricAuthenticator { callback( Result.Failure( errorCode, - activity.getString(R.string.biometric_auth_error_reason, errString) + activity.getString(R.string.biometric_auth_error_reason, errString), ) ) } diff --git a/app/src/main/java/app/passwordstore/util/autofill/Api26AutofillResponseBuilder.kt b/app/src/main/java/app/passwordstore/util/autofill/Api26AutofillResponseBuilder.kt index 8b087f99..d1257f14 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/Api26AutofillResponseBuilder.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/Api26AutofillResponseBuilder.kt @@ -26,15 +26,12 @@ import logcat.LogPriority.ERROR import logcat.asLog import logcat.logcat -class Api26AutofillResponseBuilder -private constructor( - form: FillableForm, -) : AutofillResponseBuilder { +class Api26AutofillResponseBuilder private constructor(form: FillableForm) : + AutofillResponseBuilder { object Factory : AutofillResponseBuilder.Factory { - override fun create( - form: FillableForm, - ): AutofillResponseBuilder = Api26AutofillResponseBuilder(form) + override fun create(form: FillableForm): AutofillResponseBuilder = + Api26AutofillResponseBuilder(form) } private val formOrigin = form.formOrigin @@ -104,14 +101,14 @@ private constructor( AutofillPublisherChangedActivity.makePublisherChangedIntentSender( context, publisherChangedException, - fillResponseAfterReset + fillResponseAfterReset, ) return makeIntentDataset(context, AutofillAction.Match, intentSender, metadata) } private fun makePublisherChangedResponse( context: Context, - publisherChangedException: AutofillPublisherChangedException + publisherChangedException: AutofillPublisherChangedException, ): FillResponse { return FillResponse.Builder().run { addDataset(makePublisherChangedDataset(context, publisherChangedException)) @@ -164,7 +161,7 @@ private constructor( setHeader( makeRemoteView( context, - makeHeaderMetadata(formOrigin.getPrettyIdentifier(context, untrusted = true)) + makeHeaderMetadata(formOrigin.getPrettyIdentifier(context, untrusted = true)), ) ) } @@ -183,7 +180,7 @@ private constructor( failure = { e -> logcat(ERROR) { e.asLog() } callback.onSuccess(makePublisherChangedResponse(context, e)) - } + }, ) } } 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 ef1c302c..743d6944 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/Api30AutofillResponseBuilder.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/Api30AutofillResponseBuilder.kt @@ -33,15 +33,12 @@ import logcat.logcat /** Implements [AutofillResponseBuilder]'s methods for API 30 and above */ @RequiresApi(Build.VERSION_CODES.R) -class Api30AutofillResponseBuilder -private constructor( - form: FillableForm, -) : AutofillResponseBuilder { +class Api30AutofillResponseBuilder private constructor(form: FillableForm) : + AutofillResponseBuilder { object Factory : AutofillResponseBuilder.Factory { - override fun create( - form: FillableForm, - ): AutofillResponseBuilder = Api30AutofillResponseBuilder(form) + override fun create(form: FillableForm): AutofillResponseBuilder = + Api30AutofillResponseBuilder(form) } private val formOrigin = form.formOrigin @@ -127,7 +124,7 @@ private constructor( private fun makeMatchDataset( context: Context, file: File, - imeSpec: InlinePresentationSpec? + imeSpec: InlinePresentationSpec?, ): Dataset? { if (!scenario.hasFieldsToFillOn(AutofillAction.Match)) return null val metadata = makeFillMatchMetadata(context, file) @@ -151,7 +148,7 @@ private constructor( private fun makeFillOtpFromSmsDataset( context: Context, - imeSpec: InlinePresentationSpec? + imeSpec: InlinePresentationSpec?, ): Dataset? { if (!scenario.hasFieldsToFillOn(AutofillAction.FillOtpFromSms)) return null if (!AutofillSmsActivity.shouldOfferFillFromSms(context)) return null @@ -162,14 +159,14 @@ private constructor( AutofillAction.FillOtpFromSms, intentSender, metadata, - imeSpec + imeSpec, ) } private fun makePublisherChangedDataset( context: Context, publisherChangedException: AutofillPublisherChangedException, - imeSpec: InlinePresentationSpec? + imeSpec: InlinePresentationSpec?, ): Dataset { val metadata = makeWarningMetadata(context) // If the user decides to trust the new publisher, they can choose reset the list of @@ -181,7 +178,7 @@ private constructor( AutofillPublisherChangedActivity.makePublisherChangedIntentSender( context, publisherChangedException, - fillResponseAfterReset + fillResponseAfterReset, ) return makeIntentDataset(context, AutofillAction.Match, intentSender, metadata, imeSpec) } @@ -189,7 +186,7 @@ private constructor( private fun makePublisherChangedResponse( context: Context, inlineSuggestionsRequest: InlineSuggestionsRequest?, - publisherChangedException: AutofillPublisherChangedException + publisherChangedException: AutofillPublisherChangedException, ): FillResponse { val imeSpec = inlineSuggestionsRequest?.inlinePresentationSpecs?.firstOrNull() return FillResponse.Builder().run { @@ -202,7 +199,7 @@ private constructor( private fun makeFillResponse( context: Context, inlineSuggestionsRequest: InlineSuggestionsRequest?, - matchedFiles: List + matchedFiles: List, ): FillResponse? { var datasetCount = 0 val imeSpecs = inlineSuggestionsRequest?.inlinePresentationSpecs ?: emptyList() @@ -229,7 +226,7 @@ private constructor( setHeader( makeRemoteView( context, - makeHeaderMetadata(formOrigin.getPrettyIdentifier(context, untrusted = true)) + makeHeaderMetadata(formOrigin.getPrettyIdentifier(context, untrusted = true)), ) ) makeSaveInfo()?.let { setSaveInfo(it) } @@ -271,7 +268,7 @@ private constructor( callback.onSuccess( makePublisherChangedResponse(context, fillRequest.inlineSuggestionsRequest, e) ) - } + }, ) } } diff --git a/app/src/main/java/app/passwordstore/util/autofill/AutofillMatcher.kt b/app/src/main/java/app/passwordstore/util/autofill/AutofillMatcher.kt index 56171f6b..66edaafd 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/AutofillMatcher.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/AutofillMatcher.kt @@ -102,7 +102,7 @@ class AutofillMatcher { */ fun getMatchesFor( context: Context, - formOrigin: FormOrigin + formOrigin: FormOrigin, ): Result, AutofillPublisherChangedException> { if (hasFormOriginHashChanged(context, formOrigin)) { return Err(AutofillPublisherChangedException(formOrigin)) @@ -151,7 +151,7 @@ class AutofillMatcher { Toast.makeText( context, context.getString(R.string.oreo_autofill_max_matches_reached, MAX_NUM_MATCHES), - Toast.LENGTH_LONG + Toast.LENGTH_LONG, ) .show() return @@ -170,7 +170,7 @@ class AutofillMatcher { fun updateMatches( context: Context, moveFromTo: Map = emptyMap(), - delete: Collection = emptyList() + delete: Collection = emptyList(), ) { val deletePathList = delete.map { it.absolutePath } val oldNewPathMap = diff --git a/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt b/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt index b8490054..70de5972 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt @@ -134,7 +134,7 @@ object AutofillPreferences { context: Context, file: File, entry: PasswordEntry, - directoryStructure: DirectoryStructure + directoryStructure: DirectoryStructure, ): Credentials { // Always give priority to a username stored in the encrypted extras val username = 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 762603e1..4236fcb7 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/AutofillResponseBuilder.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/AutofillResponseBuilder.kt @@ -26,7 +26,7 @@ interface AutofillResponseBuilder { context: Context, credentials: Credentials, clientState: Bundle, - action: AutofillAction + action: AutofillAction, ): Dataset { val scenario = AutofillScenario.fromClientState(clientState) // Before Android P, Datasets used for fill-in had to come with a RemoteViews, even diff --git a/app/src/main/java/app/passwordstore/util/autofill/AutofillViewUtils.kt b/app/src/main/java/app/passwordstore/util/autofill/AutofillViewUtils.kt index 75d9efc6..639f1073 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/AutofillViewUtils.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/AutofillViewUtils.kt @@ -45,7 +45,7 @@ fun makeRemoteView(context: Context, metadata: DatasetMetadata): RemoteViews { fun makeInlinePresentation( context: Context, imeSpec: InlinePresentationSpec, - metadata: DatasetMetadata + metadata: DatasetMetadata, ): InlinePresentation? { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) return null @@ -91,21 +91,21 @@ fun makeSearchAndFillMetadata(context: Context) = DatasetMetadata( context.getString(R.string.oreo_autofill_search_in_store), null, - R.drawable.ic_search_black_24dp + R.drawable.ic_search_black_24dp, ) fun makeGenerateAndFillMetadata(context: Context) = DatasetMetadata( context.getString(R.string.oreo_autofill_generate_password), null, - R.drawable.ic_autofill_new_password + R.drawable.ic_autofill_new_password, ) fun makeFillOtpFromSmsMetadata(context: Context) = DatasetMetadata( context.getString(R.string.oreo_autofill_fill_otp_from_sms), null, - R.drawable.ic_autofill_sms + R.drawable.ic_autofill_sms, ) fun makeEmptyMetadata() = DatasetMetadata("PLACEHOLDER", "PLACEHOLDER", R.mipmap.ic_launcher) @@ -114,7 +114,7 @@ fun makeWarningMetadata(context: Context) = DatasetMetadata( context.getString(R.string.oreo_autofill_warning_publisher_dataset_title), context.getString(R.string.oreo_autofill_warning_publisher_dataset_summary), - R.drawable.ic_warning_red_24dp + R.drawable.ic_warning_red_24dp, ) fun makeHeaderMetadata(title: String) = DatasetMetadata(title, null, 0) diff --git a/app/src/main/java/app/passwordstore/util/extensions/AndroidExtensions.kt b/app/src/main/java/app/passwordstore/util/extensions/AndroidExtensions.kt index 565ecaf4..04f60a6d 100644 --- a/app/src/main/java/app/passwordstore/util/extensions/AndroidExtensions.kt +++ b/app/src/main/java/app/passwordstore/util/extensions/AndroidExtensions.kt @@ -56,7 +56,7 @@ private fun Context.getEncryptedPrefs(fileName: String): SharedPreferences { fileName, masterKeyAlias, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, - EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM + EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM, ) } @@ -79,9 +79,7 @@ fun Context.resolveAttribute(attr: Int): Int { * Commit changes to the store from a [FragmentActivity] using a custom implementation of * [GitOperation] */ -suspend fun FragmentActivity.commitChange( - message: String, -): Result { +suspend fun FragmentActivity.commitChange(message: String): Result { if (!PasswordRepository.isInitialized) { return Ok(Unit) } diff --git a/app/src/main/java/app/passwordstore/util/extensions/FragmentExtensions.kt b/app/src/main/java/app/passwordstore/util/extensions/FragmentExtensions.kt index 791196ff..c9606b0b 100644 --- a/app/src/main/java/app/passwordstore/util/extensions/FragmentExtensions.kt +++ b/app/src/main/java/app/passwordstore/util/extensions/FragmentExtensions.kt @@ -25,7 +25,7 @@ fun Fragment.finish() = requireActivity().finish() */ fun FragmentManager.performTransactionWithBackStack( destinationFragment: Fragment, - @IdRes containerViewId: Int = android.R.id.content + @IdRes containerViewId: Int = android.R.id.content, ) { commit { addToBackStack(destinationFragment.tag) @@ -33,7 +33,7 @@ fun FragmentManager.performTransactionWithBackStack( R.animator.slide_in_left, R.animator.slide_out_left, R.animator.slide_in_right, - R.animator.slide_out_right + R.animator.slide_out_right, ) replace(containerViewId, destinationFragment) } diff --git a/app/src/main/java/app/passwordstore/util/extensions/FragmentViewBindingDelegate.kt b/app/src/main/java/app/passwordstore/util/extensions/FragmentViewBindingDelegate.kt index 617f3b84..19491483 100644 --- a/app/src/main/java/app/passwordstore/util/extensions/FragmentViewBindingDelegate.kt +++ b/app/src/main/java/app/passwordstore/util/extensions/FragmentViewBindingDelegate.kt @@ -22,7 +22,7 @@ import kotlin.reflect.KProperty */ class FragmentViewBindingDelegate( val fragment: Fragment, - val viewBindingFactory: (View) -> T + val viewBindingFactory: (View) -> T, ) : ReadOnlyProperty { private var binding: T? = null diff --git a/app/src/main/java/app/passwordstore/util/features/Feature.kt b/app/src/main/java/app/passwordstore/util/features/Feature.kt index 6cea1031..46f0914c 100644 --- a/app/src/main/java/app/passwordstore/util/features/Feature.kt +++ b/app/src/main/java/app/passwordstore/util/features/Feature.kt @@ -14,5 +14,5 @@ enum class Feature( ) { /** Opt into a cache layer for PGP passphrases. */ - EnablePGPPassphraseCache(false, "enable_gpg_passphrase_cache"), + EnablePGPPassphraseCache(false, "enable_gpg_passphrase_cache") } diff --git a/app/src/main/java/app/passwordstore/util/features/Features.kt b/app/src/main/java/app/passwordstore/util/features/Features.kt index fbba15f9..139516e2 100644 --- a/app/src/main/java/app/passwordstore/util/features/Features.kt +++ b/app/src/main/java/app/passwordstore/util/features/Features.kt @@ -11,9 +11,7 @@ import javax.inject.Inject class Features @Inject -constructor( - @SettingsPreferences private val preferences: SharedPreferences, -) { +constructor(@SettingsPreferences private val preferences: SharedPreferences) { fun isEnabled(feature: Feature): Boolean { return preferences.getBoolean(feature.configKey, feature.defaultValue) diff --git a/app/src/main/java/app/passwordstore/util/git/GitCommandExecutor.kt b/app/src/main/java/app/passwordstore/util/git/GitCommandExecutor.kt index 4299d968..d9119f4d 100644 --- a/app/src/main/java/app/passwordstore/util/git/GitCommandExecutor.kt +++ b/app/src/main/java/app/passwordstore/util/git/GitCommandExecutor.kt @@ -38,7 +38,7 @@ class GitCommandExecutor( private val hiltEntryPoint by unsafeLazy { EntryPointAccessors.fromApplication( activity.applicationContext, - GitCommandExecutorEntryPoint::class.java + GitCommandExecutorEntryPoint::class.java, ) } @@ -93,7 +93,7 @@ class GitCommandExecutor( RemoteRefUpdate.Status.REJECTED_NODELETE, RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED, RemoteRefUpdate.Status.NON_EXISTING, - RemoteRefUpdate.Status.NOT_ATTEMPTED, -> + RemoteRefUpdate.Status.NOT_ATTEMPTED -> throw PushException.Generic(rru.status.name) RemoteRefUpdate.Status.REJECTED_OTHER_REASON -> { throw if ("non-fast-forward" == rru.message) { @@ -107,7 +107,7 @@ class GitCommandExecutor( Toast.makeText( activity, activity.applicationContext.getString(R.string.git_push_up_to_date), - Toast.LENGTH_SHORT + Toast.LENGTH_SHORT, ) .show() } diff --git a/app/src/main/java/app/passwordstore/util/git/GitCommit.kt b/app/src/main/java/app/passwordstore/util/git/GitCommit.kt index 559b0e4a..e5665462 100644 --- a/app/src/main/java/app/passwordstore/util/git/GitCommit.kt +++ b/app/src/main/java/app/passwordstore/util/git/GitCommit.kt @@ -19,5 +19,5 @@ data class GitCommit( val hash: String, val shortMessage: String, val authorName: String, - val time: Instant + val time: Instant, ) diff --git a/app/src/main/java/app/passwordstore/util/git/operation/CloneOperation.kt b/app/src/main/java/app/passwordstore/util/git/operation/CloneOperation.kt index 67a64cd5..209342bf 100644 --- a/app/src/main/java/app/passwordstore/util/git/operation/CloneOperation.kt +++ b/app/src/main/java/app/passwordstore/util/git/operation/CloneOperation.kt @@ -18,7 +18,5 @@ class CloneOperation(callingActivity: AppCompatActivity, uri: String) : GitOperation(callingActivity) { override val commands: Array> = - arrayOf( - Git.cloneRepository().setDirectory(repository.workTree).setURI(uri), - ) + arrayOf(Git.cloneRepository().setDirectory(repository.workTree).setURI(uri)) } diff --git a/app/src/main/java/app/passwordstore/util/git/operation/GcOperation.kt b/app/src/main/java/app/passwordstore/util/git/operation/GcOperation.kt index 69535fc3..825ae7f0 100644 --- a/app/src/main/java/app/passwordstore/util/git/operation/GcOperation.kt +++ b/app/src/main/java/app/passwordstore/util/git/operation/GcOperation.kt @@ -12,9 +12,7 @@ import org.eclipse.jgit.api.GitCommand * Run an aggressive garbage collection job on the repository, expiring every loose object to * achieve the best compression. */ -class GcOperation( - callingActivity: AppCompatActivity, -) : GitOperation(callingActivity) { +class GcOperation(callingActivity: AppCompatActivity) : GitOperation(callingActivity) { override val requiresAuth: Boolean = false override val commands: Array> = diff --git a/app/src/main/java/app/passwordstore/util/git/operation/GitOperation.kt b/app/src/main/java/app/passwordstore/util/git/operation/GitOperation.kt index 5887903d..863721a5 100644 --- a/app/src/main/java/app/passwordstore/util/git/operation/GitOperation.kt +++ b/app/src/main/java/app/passwordstore/util/git/operation/GitOperation.kt @@ -116,7 +116,7 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) { private fun registerAuthProviders( authMethod: SshAuthMethod, - credentialsProvider: CredentialsProvider? = null + credentialsProvider: CredentialsProvider? = null, ) { sshSessionFactory = SshjSessionFactory(authMethod, hostKeyFile, hiltEntryPoint.dispatcherProvider()) @@ -134,12 +134,7 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) { if (!preExecute()) { return Ok(Unit) } - val operationResult = - GitCommandExecutor( - callingActivity, - this, - ) - .execute() + val operationResult = GitCommandExecutor(callingActivity, this).execute() postExecute() return operationResult } @@ -174,7 +169,7 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) { suspendCoroutine { cont -> BiometricAuthenticator.authenticate( callingActivity, - R.string.biometric_prompt_title_ssh_auth + R.string.biometric_prompt_title_ssh_auth, ) { result -> if (result !is Failure && result !is Retry) cont.resume(result) } @@ -199,7 +194,7 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) { Toast.makeText( callingActivity, R.string.biometric_auth_generic_failure, - Toast.LENGTH_LONG + Toast.LENGTH_LONG, ) .show() callingActivity.finish() @@ -220,7 +215,7 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) { CredentialFinder( callingActivity, AuthMode.Password, - hiltEntryPoint.dispatcherProvider() + hiltEntryPoint.dispatcherProvider(), ) ) registerAuthProviders(SshAuthMethod.Password(authActivity), httpsCredentialProvider) diff --git a/app/src/main/java/app/passwordstore/util/git/operation/PullOperation.kt b/app/src/main/java/app/passwordstore/util/git/operation/PullOperation.kt index a211a2f7..f73442ac 100644 --- a/app/src/main/java/app/passwordstore/util/git/operation/PullOperation.kt +++ b/app/src/main/java/app/passwordstore/util/git/operation/PullOperation.kt @@ -7,10 +7,8 @@ package app.passwordstore.util.git.operation import androidx.appcompat.app.AppCompatActivity import org.eclipse.jgit.api.GitCommand -class PullOperation( - callingActivity: AppCompatActivity, - rebase: Boolean, -) : GitOperation(callingActivity) { +class PullOperation(callingActivity: AppCompatActivity, rebase: Boolean) : + GitOperation(callingActivity) { /** * The story of why the pull operation is committing files goes like this: Once upon a time when diff --git a/app/src/main/java/app/passwordstore/util/git/operation/PushOperation.kt b/app/src/main/java/app/passwordstore/util/git/operation/PushOperation.kt index fa2dd1ba..39a1dc24 100644 --- a/app/src/main/java/app/passwordstore/util/git/operation/PushOperation.kt +++ b/app/src/main/java/app/passwordstore/util/git/operation/PushOperation.kt @@ -10,7 +10,5 @@ import org.eclipse.jgit.api.GitCommand class PushOperation(callingActivity: AppCompatActivity) : GitOperation(callingActivity) { override val commands: Array> = - arrayOf( - git.push().setPushAll().setRemote("origin"), - ) + arrayOf(git.push().setPushAll().setRemote("origin")) } diff --git a/app/src/main/java/app/passwordstore/util/git/operation/SyncOperation.kt b/app/src/main/java/app/passwordstore/util/git/operation/SyncOperation.kt index 57be9439..c693876e 100644 --- a/app/src/main/java/app/passwordstore/util/git/operation/SyncOperation.kt +++ b/app/src/main/java/app/passwordstore/util/git/operation/SyncOperation.kt @@ -7,10 +7,8 @@ package app.passwordstore.util.git.operation import androidx.appcompat.app.AppCompatActivity import org.eclipse.jgit.api.GitCommand -class SyncOperation( - callingActivity: AppCompatActivity, - rebase: Boolean, -) : GitOperation(callingActivity) { +class SyncOperation(callingActivity: AppCompatActivity, rebase: Boolean) : + GitOperation(callingActivity) { override val commands: Array> = arrayOf( diff --git a/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt b/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt index 1386bf97..3f1b58d0 100644 --- a/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt +++ b/app/src/main/java/app/passwordstore/util/git/sshj/SshKey.kt @@ -135,8 +135,7 @@ object SshKey { KeystoreWrappedEd25519("keystore_wrapped_ed25519"), // Behaves like `Imported`, but allows to view the public key. - LegacyGenerated("legacy_generated"), - ; + LegacyGenerated("legacy_generated"); companion object { @@ -146,7 +145,7 @@ object SshKey { enum class Algorithm( val algorithm: String, - val applyToSpec: KeyGenParameterSpec.Builder.() -> Unit + val applyToSpec: KeyGenParameterSpec.Builder.() -> Unit, ) { Rsa( KeyProperties.KEY_ALGORITHM_RSA, @@ -156,9 +155,9 @@ object SshKey { setDigests( KeyProperties.DIGEST_SHA1, KeyProperties.DIGEST_SHA256, - KeyProperties.DIGEST_SHA512 + KeyProperties.DIGEST_SHA512, ) - } + }, ), Ecdsa( KeyProperties.KEY_ALGORITHM_EC, @@ -169,7 +168,7 @@ object SshKey { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { setIsStrongBoxBacked(isStrongBoxSupported) } - } + }, ), } @@ -250,7 +249,7 @@ object SshKey { context, privateKeyFile, getOrCreateWrappingMasterKey(requireAuthentication), - EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB + EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB, ) .setKeysetPrefName(ANDROIDX_SECURITY_KEYSET_PREF_NAME) .build() @@ -319,7 +318,7 @@ object SshKey { logcat { error.asLog() } throw IOException( "Failed to get public key '$KEYSTORE_ALIAS' from Android Keystore", - error + error, ) } @@ -329,7 +328,7 @@ object SshKey { logcat { error.asLog() } throw IOException( "Failed to access private key '$KEYSTORE_ALIAS' from Android Keystore", - error + error, ) } diff --git a/app/src/main/java/app/passwordstore/util/git/sshj/SshjConfig.kt b/app/src/main/java/app/passwordstore/util/git/sshj/SshjConfig.kt index 34f37d8c..2cce7128 100644 --- a/app/src/main/java/app/passwordstore/util/git/sshj/SshjConfig.kt +++ b/app/src/main/java/app/passwordstore/util/git/sshj/SshjConfig.kt @@ -140,18 +140,10 @@ class SshjConfig : ConfigImpl() { private fun initMACFactories() { macFactories = - listOf( - Macs.HMACSHA2512Etm(), - Macs.HMACSHA2256Etm(), - Macs.HMACSHA2512(), - Macs.HMACSHA2256(), - ) + listOf(Macs.HMACSHA2512Etm(), Macs.HMACSHA2256Etm(), Macs.HMACSHA2512(), Macs.HMACSHA2256()) } private fun initCompressionFactories() { - compressionFactories = - listOf( - NoneCompression.Factory(), - ) + compressionFactories = listOf(NoneCompression.Factory()) } } diff --git a/app/src/main/java/app/passwordstore/util/git/sshj/SshjSessionFactory.kt b/app/src/main/java/app/passwordstore/util/git/sshj/SshjSessionFactory.kt index 5e11a636..c03575d4 100644 --- a/app/src/main/java/app/passwordstore/util/git/sshj/SshjSessionFactory.kt +++ b/app/src/main/java/app/passwordstore/util/git/sshj/SshjSessionFactory.kt @@ -79,7 +79,7 @@ class SshjSessionFactory( uri: URIish, credentialsProvider: CredentialsProvider?, fs: FS?, - tms: Int + tms: Int, ): RemoteSession { return currentSession ?: SshjSession(uri, uri.user, authMethod, hostKeyFile, dispatcherProvider).connect().also { @@ -164,7 +164,7 @@ private class SshjSession( AuthPublickey( SshKey.provide( ssh, - CredentialFinder(authMethod.activity, AuthMode.SshKey, dispatcherProvider) + CredentialFinder(authMethod.activity, AuthMode.SshKey, dispatcherProvider), ) ) ssh.auth(username, pubkeyAuth, passwordAuth) diff --git a/app/src/main/java/app/passwordstore/util/services/ClipboardService.kt b/app/src/main/java/app/passwordstore/util/services/ClipboardService.kt index 47cf5926..7f1ca44e 100644 --- a/app/src/main/java/app/passwordstore/util/services/ClipboardService.kt +++ b/app/src/main/java/app/passwordstore/util/services/ClipboardService.kt @@ -125,7 +125,7 @@ class ClipboardService : Service() { PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE } else { PendingIntent.FLAG_UPDATE_CURRENT - } + }, ) val notification = createNotification(pendingIntent, clearTimeMs) @@ -152,7 +152,7 @@ class ClipboardService : Service() { NotificationChannel( CHANNEL_ID, getString(R.string.app_name), - NotificationManager.IMPORTANCE_LOW + NotificationManager.IMPORTANCE_LOW, ) val manager = getSystemService() if (manager != null) { diff --git a/app/src/main/java/app/passwordstore/util/services/OreoAutofillService.kt b/app/src/main/java/app/passwordstore/util/services/OreoAutofillService.kt index 9e5051e5..c5c31e65 100644 --- a/app/src/main/java/app/passwordstore/util/services/OreoAutofillService.kt +++ b/app/src/main/java/app/passwordstore/util/services/OreoAutofillService.kt @@ -65,7 +65,7 @@ class OreoAutofillService : AutofillService() { override fun onFillRequest( request: FillRequest, cancellationSignal: CancellationSignal, - callback: FillCallback + callback: FillCallback, ) { val structure = request.fillContexts.lastOrNull()?.structure @@ -144,7 +144,7 @@ class OreoAutofillService : AutofillService() { AutofillSaveActivity.makeSaveIntentSender( this, credentials = Credentials(username, password, null), - formOrigin = formOrigin + formOrigin = formOrigin, ) ) } diff --git a/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt b/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt index d5032f4f..ad70062a 100644 --- a/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt +++ b/app/src/main/java/app/passwordstore/util/services/PasswordExportService.kt @@ -134,7 +134,7 @@ class PasswordExportService : Service() { NotificationChannel( CHANNEL_ID, getString(R.string.app_name), - NotificationManager.IMPORTANCE_LOW + NotificationManager.IMPORTANCE_LOW, ) val manager = getSystemService() if (manager != null) { diff --git a/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt b/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt index bfbf9c85..d15269be 100644 --- a/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt +++ b/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt @@ -21,8 +21,7 @@ import org.eclipse.jgit.transport.URIish enum class Protocol(val pref: String) { Ssh("ssh://"), - Https("https://"), - ; + Https("https://"); companion object { @@ -36,8 +35,7 @@ enum class Protocol(val pref: String) { enum class AuthMode(val pref: String) { SshKey("ssh-key"), Password("username/password"), - None("None"), - ; + None("None"); companion object { @@ -140,7 +138,7 @@ constructor( fun updateConnectionSettingsIfValid( newAuthMode: AuthMode, - newUrl: String + newUrl: String, ): UpdateConnectionSettingsResult { val parsedUrl = runCatching { URIish(newUrl) } diff --git a/app/src/main/java/app/passwordstore/util/settings/Migrations.kt b/app/src/main/java/app/passwordstore/util/settings/Migrations.kt index 848b3bd9..47187080 100644 --- a/app/src/main/java/app/passwordstore/util/settings/Migrations.kt +++ b/app/src/main/java/app/passwordstore/util/settings/Migrations.kt @@ -91,7 +91,7 @@ private fun migrateToGitUrlBasedConfig(sharedPrefs: SharedPreferences, gitSettin url == null || gitSettings.updateConnectionSettingsIfValid( newAuthMode = gitSettings.authMode, - newUrl = url + newUrl = url, ) != GitSettings.UpdateConnectionSettingsResult.Valid ) { logcat(TAG, ERROR) { "Failed to migrate to URL-based Git config, generated URL is invalid" } @@ -128,7 +128,7 @@ private fun migrateToClipboardHistory(sharedPrefs: SharedPreferences) { sharedPrefs.edit { putBoolean( PreferenceKeys.CLEAR_CLIPBOARD_HISTORY, - sharedPrefs.getBoolean(PreferenceKeys.CLEAR_CLIPBOARD_20X, false) + sharedPrefs.getBoolean(PreferenceKeys.CLEAR_CLIPBOARD_20X, false), ) remove(PreferenceKeys.CLEAR_CLIPBOARD_20X) } diff --git a/app/src/main/java/app/passwordstore/util/settings/PreferenceKeys.kt b/app/src/main/java/app/passwordstore/util/settings/PreferenceKeys.kt index d67a4bef..3624c95f 100644 --- a/app/src/main/java/app/passwordstore/util/settings/PreferenceKeys.kt +++ b/app/src/main/java/app/passwordstore/util/settings/PreferenceKeys.kt @@ -64,7 +64,7 @@ object PreferenceKeys { @Deprecated( message = "Use SHOW_HIDDEN_CONTENTS instead", - replaceWith = ReplaceWith("PreferenceKeys.SHOW_HIDDEN_CONTENTS") + replaceWith = ReplaceWith("PreferenceKeys.SHOW_HIDDEN_CONTENTS"), ) const val SHOW_HIDDEN_FOLDERS = "show_hidden_folders" const val SHOW_HIDDEN_CONTENTS = "show_hidden_contents" diff --git a/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt b/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt index 86f38a8d..b7e6549a 100644 --- a/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt +++ b/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt @@ -19,11 +19,7 @@ import javax.inject.Inject import logcat.logcat @Reusable -class ShortcutHandler -@Inject -constructor( - @ApplicationContext val context: Context, -) { +class ShortcutHandler @Inject constructor(@ApplicationContext val context: Context) { private companion object { diff --git a/app/src/main/java/app/passwordstore/util/viewmodel/SearchableRepositoryViewModel.kt b/app/src/main/java/app/passwordstore/util/viewmodel/SearchableRepositoryViewModel.kt index cd7dbc78..3c3db292 100644 --- a/app/src/main/java/app/passwordstore/util/viewmodel/SearchableRepositoryViewModel.kt +++ b/app/src/main/java/app/passwordstore/util/viewmodel/SearchableRepositoryViewModel.kt @@ -67,7 +67,7 @@ private val CaseInsensitiveComparator = Collator.getInstance().apply { strength private fun PasswordItem.Companion.makeComparator( typeSortOrder: PasswordSortOrder, - directoryStructure: DirectoryStructure + directoryStructure: DirectoryStructure, ): Comparator { return when (typeSortOrder) { PasswordSortOrder.FOLDER_FIRST -> compareBy { it.type } @@ -158,7 +158,7 @@ constructor( val listMode: ListMode, // This counter can be increased to force a reexecution of the search action even if all // other arguments are left unchanged. - val updateCounter: Int + val updateCounter: Int, ) private fun makeSearchAction( @@ -166,7 +166,7 @@ constructor( filter: String, filterMode: FilterMode, searchMode: SearchMode, - listMode: ListMode + listMode: ListMode, ): SearchAction { return SearchAction( baseDirectory = baseDirectory, @@ -174,7 +174,7 @@ constructor( filterMode = filterMode, searchMode = searchMode, listMode = listMode, - updateCounter = updateCounter + updateCounter = updateCounter, ) } @@ -187,7 +187,7 @@ constructor( filter = "", filterMode = FilterMode.NoFilter, searchMode = SearchMode.InCurrentDirectoryOnly, - listMode = ListMode.AllEntries + listMode = ListMode.AllEntries, ) ) @@ -310,7 +310,7 @@ constructor( newDirectory: File = root, listMode: ListMode = ListMode.AllEntries, recyclerViewState: Parcelable? = null, - pushPreviousLocation: Boolean = true + pushPreviousLocation: Boolean = true, ) { if (!newDirectory.exists()) return require(newDirectory.isDirectory) { "Can only navigate to a directory" } @@ -323,7 +323,7 @@ constructor( baseDirectory = newDirectory, filterMode = FilterMode.NoFilter, searchMode = SearchMode.InCurrentDirectoryOnly, - listMode = listMode + listMode = listMode, ) } _currentDir.update { newDirectory } @@ -356,7 +356,7 @@ constructor( baseDirectory: File? = null, filterMode: FilterMode = FilterMode.Fuzzy, searchMode: SearchMode? = null, - listMode: ListMode = ListMode.AllEntries + listMode: ListMode = ListMode.AllEntries, ) { require(baseDirectory?.isDirectory != false) { "Can only search in a directory" } searchActionFlow.update { @@ -365,7 +365,7 @@ constructor( baseDirectory = baseDirectory ?: _currentDir.value, filterMode = filterMode, searchMode = searchMode ?: defaultSearchMode, - listMode = listMode + listMode = listMode, ) } } @@ -417,7 +417,7 @@ open class SearchableRepositoryAdapter( fun > makeSelectable( recyclerView: RecyclerView, - itemDetailsLookupCreator: (recyclerView: RecyclerView) -> T + itemDetailsLookupCreator: (recyclerView: RecyclerView) -> T, ) { selectionTracker = SelectionTracker.Builder( @@ -425,7 +425,7 @@ open class SearchableRepositoryAdapter( recyclerView, itemKeyProvider, itemDetailsLookupCreator(recyclerView), - StorageStrategy.createStringStorage() + StorageStrategy.createStringStorage(), ) .withSelectionPredicate(SelectionPredicates.createSelectAnything()) .build() diff --git a/app/src/nonFree/java/app/passwordstore/autofill/oreo/ui/AutofillSmsActivity.kt b/app/src/nonFree/java/app/passwordstore/autofill/oreo/ui/AutofillSmsActivity.kt index ebd10020..1f627c06 100644 --- a/app/src/nonFree/java/app/passwordstore/autofill/oreo/ui/AutofillSmsActivity.kt +++ b/app/src/nonFree/java/app/passwordstore/autofill/oreo/ui/AutofillSmsActivity.kt @@ -87,7 +87,7 @@ class AutofillSmsActivity : AppCompatActivity() { context, fillOtpFromSmsRequestCode++, intent, - PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE + PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) .intentSender } @@ -159,11 +159,11 @@ class AutofillSmsActivity : AppCompatActivity() { this@AutofillSmsActivity, Credentials(null, null, smsCode), clientState, - AutofillAction.FillOtpFromSms + AutofillAction.FillOtpFromSms, ) setResult( RESULT_OK, - Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) } + Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) }, ) finish() } diff --git a/app/src/test/java/app/passwordstore/util/settings/MigrationsTest.kt b/app/src/test/java/app/passwordstore/util/settings/MigrationsTest.kt index d8864453..ca72513b 100644 --- a/app/src/test/java/app/passwordstore/util/settings/MigrationsTest.kt +++ b/app/src/test/java/app/passwordstore/util/settings/MigrationsTest.kt @@ -61,12 +61,12 @@ class MigrationsTest { runMigrations( filesDir, sharedPrefs, - GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir) + GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir), ) checkOldKeysAreRemoved() assertEquals( sharedPrefs.getString(PreferenceKeys.GIT_REMOTE_URL), - "ssh://msfjarvis@192.168.0.102:2200/mnt/disk3/pass-repo" + "ssh://msfjarvis@192.168.0.102:2200/mnt/disk3/pass-repo", ) } @@ -82,12 +82,12 @@ class MigrationsTest { runMigrations( filesDir, sharedPrefs, - GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir) + GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir), ) checkOldKeysAreRemoved() assertEquals( sharedPrefs.getString(PreferenceKeys.GIT_REMOTE_URL), - "msfjarvis@192.168.0.102:/mnt/disk3/pass-repo" + "msfjarvis@192.168.0.102:/mnt/disk3/pass-repo", ) } @@ -103,12 +103,12 @@ class MigrationsTest { runMigrations( filesDir, sharedPrefs, - GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir) + GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir), ) checkOldKeysAreRemoved() assertEquals( sharedPrefs.getString(PreferenceKeys.GIT_REMOTE_URL), - "https://github.com/Android-Password-Store/pass-test" + "https://github.com/Android-Password-Store/pass-test", ) } @@ -117,7 +117,7 @@ class MigrationsTest { runMigrations( filesDir, sharedPrefs, - GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir) + GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir), ) assertEquals(true, sharedPrefs.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, true)) assertEquals(false, sharedPrefs.getBoolean(PreferenceKeys.SHOW_HIDDEN_CONTENTS, false)) @@ -129,7 +129,7 @@ class MigrationsTest { runMigrations( filesDir, sharedPrefs, - GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir) + GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir), ) assertEquals(false, sharedPrefs.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, false)) assertEquals(true, sharedPrefs.getBoolean(PreferenceKeys.SHOW_HIDDEN_CONTENTS, false)) @@ -141,7 +141,7 @@ class MigrationsTest { runMigrations( filesDir, sharedPrefs, - GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir) + GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir), ) assertEquals(true, sharedPrefs.getBoolean(PreferenceKeys.CLEAR_CLIPBOARD_HISTORY, false)) assertFalse(sharedPrefs.contains(PreferenceKeys.CLEAR_CLIPBOARD_20X)) diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt index badaabcb..89359057 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt @@ -47,7 +47,7 @@ public sealed class FormOrigin(public open val identifier: String) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { context.packageManager.getApplicationInfo( identifier, - ApplicationInfoFlags.of(PackageManager.GET_META_DATA.toLong()) + ApplicationInfoFlags.of(PackageManager.GET_META_DATA.toLong()), ) } else { context.packageManager.getApplicationInfo(identifier, PackageManager.GET_META_DATA) @@ -74,7 +74,7 @@ private class AutofillFormParser( context: Context, structure: AssistStructure, isManualRequest: Boolean, - private val customSuffixes: Sequence + private val customSuffixes: Sequence, ) { companion object { @@ -136,7 +136,7 @@ private class AutofillFormParser( autofillStrategy.match( relevantFields, singleOriginMode = trustedBrowserInfo?.multiOriginMethod == BrowserMultiOriginMethod.None, - isManualRequest = isManualRequest + isManualRequest = isManualRequest, ) private fun trackOrigin(node: AssistStructure.ViewNode) { @@ -187,7 +187,7 @@ private class AutofillFormParser( // situation is uncertain and Autofill should not be offered. webOriginToFormOrigin( context, - scenario.allFields.map { it.webOrigin }.toSet().singleOrNull() ?: return null + scenario.allFields.map { it.webOrigin }.toSet().singleOrNull() ?: return null, ) } } @@ -206,7 +206,7 @@ private constructor( public val formOrigin: FormOrigin, public val scenario: AutofillScenario, public val ignoredIds: List, - public val saveFlags: Int? + public val saveFlags: Int?, ) { public companion object { /** Returns a [FillableForm] if a login form could be detected in [structure]. */ @@ -222,7 +222,7 @@ private constructor( form.formOrigin, form.scenario.map { it.autofillId }, form.ignoredIds, - form.saveFlags + form.saveFlags, ) } } diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt index b12fd9c1..f08f3172 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt @@ -57,7 +57,7 @@ public fun computeCertificatesHash(context: Context, appPackage: String): String if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { context.packageManager.getPackageInfo( appPackage, - PackageManager.PackageInfoFlags.of(PackageManager.GET_SIGNING_CERTIFICATES.toLong()) + PackageManager.PackageInfoFlags.of(PackageManager.GET_SIGNING_CERTIFICATES.toLong()), ) } else { context.packageManager.getPackageInfo(appPackage, PackageManager.GET_SIGNING_CERTIFICATES) @@ -121,7 +121,7 @@ private fun visitViewNodes(structure: AssistStructure, block: (AssistStructure.V private fun visitViewNode( node: AssistStructure.ViewNode, - block: (AssistStructure.ViewNode) -> Unit + block: (AssistStructure.ViewNode) -> Unit, ) { block(node) for (i in 0 until node.childCount) { diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt index c7bd99fc..9c32d62f 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt @@ -21,7 +21,7 @@ public enum class AutofillAction { Match, Search, Generate, - FillOtpFromSms + FillOtpFromSms, } /** @@ -46,8 +46,8 @@ public sealed class AutofillScenario { "Use `fromClientState` instead.", ReplaceWith( "fromClientState(clientState)", - "com.github.androidpasswordstore.autofillparser.AutofillScenario.Companion.fromClientState" - ) + "com.github.androidpasswordstore.autofillparser.AutofillScenario.Companion.fromClientState", + ), ) public fun fromBundle(clientState: Bundle): AutofillScenario? { return fromClientState(clientState) @@ -61,7 +61,7 @@ public sealed class AutofillScenario { BundleCompat.getParcelable( clientState, BUNDLE_KEY_USERNAME_ID, - AutofillId::class.java + AutofillId::class.java, ) fillUsername = clientState.getBoolean(BUNDLE_KEY_FILL_USERNAME) otp = BundleCompat.getParcelable(clientState, BUNDLE_KEY_OTP_ID, AutofillId::class.java) @@ -69,21 +69,21 @@ public sealed class AutofillScenario { BundleCompat.getParcelableArrayList( clientState, BUNDLE_KEY_CURRENT_PASSWORD_IDS, - AutofillId::class.java + AutofillId::class.java, ) ?: emptyList() ) newPassword.addAll( BundleCompat.getParcelableArrayList( clientState, BUNDLE_KEY_NEW_PASSWORD_IDS, - AutofillId::class.java + AutofillId::class.java, ) ?: emptyList() ) genericPassword.addAll( BundleCompat.getParcelableArrayList( clientState, BUNDLE_KEY_GENERIC_PASSWORD_IDS, - AutofillId::class.java + AutofillId::class.java, ) ?: emptyList() ) } @@ -114,14 +114,14 @@ public sealed class AutofillScenario { fillUsername = fillUsername, otp = otp, currentPassword = currentPassword, - newPassword = newPassword + newPassword = newPassword, ) } else { GenericAutofillScenario( username = username, fillUsername = fillUsername, otp = otp, - genericPassword = genericPassword + genericPassword = genericPassword, ) } } @@ -193,7 +193,7 @@ internal data class ClassifiedAutofillScenario( override val fillUsername: Boolean, override val otp: T?, val currentPassword: List, - val newPassword: List + val newPassword: List, ) : AutofillScenario() { override val allPasswordFields @@ -217,7 +217,7 @@ internal data class GenericAutofillScenario( override val username: T?, override val fillUsername: Boolean, override val otp: T?, - val genericPassword: List + val genericPassword: List, ) : AutofillScenario() { override val allPasswordFields @@ -254,7 +254,7 @@ internal fun AutofillScenario.passesOriginCheck(singleOriginMode: Boo public fun Dataset.Builder.fillWith( scenario: AutofillScenario, action: AutofillAction, - credentials: Credentials? + credentials: Credentials?, ) { val credentialsToFill = credentials ?: Credentials("USERNAME", "PASSWORD", "OTP") for (field in scenario.fieldsToFillOn(action)) { @@ -303,7 +303,7 @@ internal fun AutofillScenario.toBundle(): Bundle = putParcelable(AutofillScenario.BUNDLE_KEY_OTP_ID, otp) putParcelableArrayList( AutofillScenario.BUNDLE_KEY_CURRENT_PASSWORD_IDS, - ArrayList(currentPassword) + ArrayList(currentPassword), ) putParcelableArrayList(AutofillScenario.BUNDLE_KEY_NEW_PASSWORD_IDS, ArrayList(newPassword)) } @@ -315,7 +315,7 @@ internal fun AutofillScenario.toBundle(): Bundle = putParcelable(AutofillScenario.BUNDLE_KEY_OTP_ID, otp) putParcelableArrayList( AutofillScenario.BUNDLE_KEY_GENERIC_PASSWORD_IDS, - ArrayList(genericPassword) + ArrayList(genericPassword), ) } } diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt index 04e8d98c..6cd6afc7 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt @@ -75,7 +75,7 @@ internal interface FieldMatcher { @RequiresApi(Build.VERSION_CODES.O) internal class SingleFieldMatcher( private val take: (FormField, List) -> Boolean, - private val tieBreakers: List<(FormField, List) -> Boolean> + private val tieBreakers: List<(FormField, List) -> Boolean>, ) : FieldMatcher { @AutofillDsl @@ -100,7 +100,7 @@ internal class SingleFieldMatcher( fun build() = SingleFieldMatcher( takeSingle ?: throw IllegalArgumentException("Every block needs a take{Single,Pair} block"), - tieBreakersSingle + tieBreakersSingle, ) } @@ -139,7 +139,7 @@ internal class SingleFieldMatcher( @RequiresApi(Build.VERSION_CODES.O) private class PairOfFieldsMatcher( private val take: (Pair, List) -> Boolean, - private val tieBreakers: List<(Pair, List) -> Boolean> + private val tieBreakers: List<(Pair, List) -> Boolean>, ) : FieldMatcher { override fun match(fields: List, alreadyMatched: List): List? { @@ -180,14 +180,14 @@ private constructor( private val matchers: List, private val applyInSingleOriginMode: Boolean, private val applyOnManualRequestOnly: Boolean, - private val name: String + private val name: String, ) { data class AutofillRuleMatcher( val type: FillableFieldType, val matcher: FieldMatcher, val optional: Boolean, - val matchHidden: Boolean + val matchHidden: Boolean, ) enum class FillableFieldType { @@ -201,7 +201,7 @@ private constructor( @AutofillDsl class Builder( private val applyInSingleOriginMode: Boolean, - private val applyOnManualRequestOnly: Boolean + private val applyOnManualRequestOnly: Boolean, ) { companion object { @@ -215,7 +215,7 @@ private constructor( fun username( optional: Boolean = false, matchHidden: Boolean = false, - block: SingleFieldMatcher.Builder.() -> Unit + block: SingleFieldMatcher.Builder.() -> Unit, ) { require(matchers.none { it.type == FillableFieldType.Username }) { "Every rule block can only have at most one username block" @@ -225,7 +225,7 @@ private constructor( type = FillableFieldType.Username, matcher = SingleFieldMatcher.Builder().apply(block).build(), optional = optional, - matchHidden = matchHidden + matchHidden = matchHidden, ) ) } @@ -239,7 +239,7 @@ private constructor( type = FillableFieldType.Otp, matcher = SingleFieldMatcher.Builder().apply(block).build(), optional = optional, - matchHidden = false + matchHidden = false, ) ) } @@ -247,7 +247,7 @@ private constructor( fun currentPassword( optional: Boolean = false, matchHidden: Boolean = false, - block: FieldMatcher.Builder.() -> Unit + block: FieldMatcher.Builder.() -> Unit, ) { require(matchers.none { it.type == FillableFieldType.GenericPassword }) { "Every rule block can only have either genericPassword or {current,new}Password blocks" @@ -257,7 +257,7 @@ private constructor( type = FillableFieldType.CurrentPassword, matcher = FieldMatcher.Builder().apply(block).build(), optional = optional, - matchHidden = matchHidden + matchHidden = matchHidden, ) ) } @@ -271,7 +271,7 @@ private constructor( type = FillableFieldType.NewPassword, matcher = FieldMatcher.Builder().apply(block).build(), optional = optional, - matchHidden = false + matchHidden = false, ) ) } @@ -279,11 +279,7 @@ private constructor( fun genericPassword(optional: Boolean = false, block: FieldMatcher.Builder.() -> Unit) { require( matchers.none { - it.type in - listOf( - FillableFieldType.CurrentPassword, - FillableFieldType.NewPassword, - ) + it.type in listOf(FillableFieldType.CurrentPassword, FillableFieldType.NewPassword) } ) { "Every rule block can only have either genericPassword or {current,new}Password blocks" @@ -293,7 +289,7 @@ private constructor( type = FillableFieldType.GenericPassword, matcher = FieldMatcher.Builder().apply(block).build(), optional = optional, - matchHidden = false + matchHidden = false, ) ) } @@ -314,7 +310,7 @@ private constructor( matchers, applyInSingleOriginMode, applyOnManualRequestOnly, - name ?: "Rule #$ruleId" + name ?: "Rule #$ruleId", ) .also { ruleId++ } } @@ -325,7 +321,7 @@ private constructor( allUsername: List, allOtp: List, singleOriginMode: Boolean, - isManualRequest: Boolean + isManualRequest: Boolean, ): AutofillScenario? { if (singleOriginMode && !applyInSingleOriginMode) { logcat { "$name: Skipped in single origin mode" } @@ -399,12 +395,12 @@ internal class AutofillStrategy private constructor(private val rules: List Unit + block: AutofillRule.Builder.() -> Unit, ) { rules.add( AutofillRule.Builder( applyInSingleOriginMode = applyInSingleOriginMode, - applyOnManualRequestOnly = applyOnManualRequestOnly + applyOnManualRequestOnly = applyOnManualRequestOnly, ) .apply(block) .build() @@ -417,7 +413,7 @@ internal class AutofillStrategy private constructor(private val rules: List, singleOriginMode: Boolean, - isManualRequest: Boolean + isManualRequest: Boolean, ): AutofillScenario? { val possiblePasswordFields = fields.filter { it.passwordCertainty >= CertaintyLevel.Possible } logcat { "Possible password fields: ${possiblePasswordFields.size}" } @@ -433,7 +429,7 @@ internal class AutofillStrategy private constructor(private val rules: List= Build.VERSION_CODES.TIRAMISU) { context.packageManager.queryIntentActivities( testWebIntent, - ResolveInfoFlags.of(PackageManager.MATCH_ALL.toLong()) + ResolveInfoFlags.of(PackageManager.MATCH_ALL.toLong()), ) } else { context.packageManager.queryIntentActivities(testWebIntent, PackageManager.MATCH_ALL) diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt index 4d4dd218..5bcc7479 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt @@ -17,7 +17,7 @@ internal enum class CertaintyLevel { Impossible, Possible, Likely, - Certain + Certain, } /** @@ -29,31 +29,19 @@ internal class FormField( node: AssistStructure.ViewNode, private val index: Int, passDownWebViewOrigins: Boolean, - passedDownWebOrigin: String? = null + passedDownWebOrigin: String? = null, ) { companion object { private val HINTS_USERNAME = - listOf( - HintConstants.AUTOFILL_HINT_USERNAME, - HintConstants.AUTOFILL_HINT_NEW_USERNAME, - ) - private val HINTS_NEW_PASSWORD = - listOf( - HintConstants.AUTOFILL_HINT_NEW_PASSWORD, - ) + listOf(HintConstants.AUTOFILL_HINT_USERNAME, HintConstants.AUTOFILL_HINT_NEW_USERNAME) + private val HINTS_NEW_PASSWORD = listOf(HintConstants.AUTOFILL_HINT_NEW_PASSWORD) private val HINTS_PASSWORD = HINTS_NEW_PASSWORD + - listOf( - HintConstants.AUTOFILL_HINT_PASSWORD, - HintConstants.AUTOFILL_HINT_WIFI_PASSWORD, - ) + listOf(HintConstants.AUTOFILL_HINT_PASSWORD, HintConstants.AUTOFILL_HINT_WIFI_PASSWORD) private val HINTS_OTP = - listOf( - HintConstants.AUTOFILL_HINT_SMS_OTP, - HintConstants.AUTOFILL_HINT_2FA_APP_OTP, - ) + listOf(HintConstants.AUTOFILL_HINT_SMS_OTP, HintConstants.AUTOFILL_HINT_2FA_APP_OTP) @Suppress("DEPRECATION") private val HINTS_FILLABLE = @@ -93,21 +81,9 @@ internal class FormField( } } - private val HTML_INPUT_FIELD_TYPES_USERNAME = - listOf( - "email", - "tel", - "text", - ) - private val HTML_INPUT_FIELD_TYPES_PASSWORD = - listOf( - "password", - ) - private val HTML_INPUT_FIELD_TYPES_OTP = - listOf( - "tel", - "text", - ) + private val HTML_INPUT_FIELD_TYPES_USERNAME = listOf("email", "tel", "text") + private val HTML_INPUT_FIELD_TYPES_PASSWORD = listOf("password") + private val HTML_INPUT_FIELD_TYPES_OTP = listOf("tel", "text") private val HTML_INPUT_FIELD_TYPES_FILLABLE = (HTML_INPUT_FIELD_TYPES_USERNAME + HTML_INPUT_FIELD_TYPES_PASSWORD + @@ -128,33 +104,11 @@ internal class FormField( "captcha", "postal", // Prevent postal code fields from being mistaken for OTP fields ) - private val PASSWORD_HEURISTIC_TERMS = - listOf( - "pass", - "pswd", - "pwd", - ) + private val PASSWORD_HEURISTIC_TERMS = listOf("pass", "pswd", "pwd") private val USERNAME_HEURISTIC_TERMS = - listOf( - "alias", - "benutzername", - "e-mail", - "email", - "mail", - "login", - "user", - ) - private val OTP_HEURISTIC_TERMS = - listOf( - "einmal", - "otp", - "challenge", - "verification", - ) - private val OTP_WEAK_HEURISTIC_TERMS = - listOf( - "code", - ) + listOf("alias", "benutzername", "e-mail", "email", "mail", "login", "user") + private val OTP_HEURISTIC_TERMS = listOf("einmal", "otp", "challenge", "verification") + private val OTP_WEAK_HEURISTIC_TERMS = listOf("code") } private val List.anyMatchesFieldInfo diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt index 706aa6c5..64fb854f 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/PublicSuffixListCache.kt @@ -39,7 +39,7 @@ public fun cachePublicSuffixList(context: Context) { internal fun getPublicSuffixPlusOne( context: Context, domain: String, - customSuffixes: Sequence + customSuffixes: Sequence, ) = runBlocking { // We only feed valid domain names which are not IP addresses into getPublicSuffixPlusOne. // We do not check whether the domain actually exists (actually, not even whether its TLD @@ -77,7 +77,7 @@ private fun getSuffixPlusUpToOne(domain: String, suffix: String): String? { private suspend fun getCanonicalSuffix( context: Context, domain: String, - customSuffixes: Sequence + customSuffixes: Sequence, ): String { val publicSuffixList = PublicSuffixListCache.getOrCachePublicSuffixList(context) val publicSuffixPlusOne = diff --git a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt index 4b45cd1c..eedde89f 100644 --- a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt +++ b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixList.kt @@ -29,7 +29,7 @@ import kotlinx.coroutines.async internal class PublicSuffixList( context: Context, dispatcher: CoroutineDispatcher = Dispatchers.IO, - private val scope: CoroutineScope = CoroutineScope(dispatcher) + private val scope: CoroutineScope = CoroutineScope(dispatcher), ) { private val data: PublicSuffixListData by diff --git a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt index 97a2fbae..6f503b76 100644 --- a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt +++ b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt @@ -14,7 +14,7 @@ import mozilla.components.lib.publicsuffixlist.ext.binarySearch /** Class wrapping the public suffix list data and offering methods for accessing rules in it. */ internal class PublicSuffixListData( private val rules: ByteArray, - private val exceptions: ByteArray + private val exceptions: ByteArray, ) { private fun binarySearchRules(labels: List, labelIndex: Int): String? { diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt index 68195033..de481981 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt @@ -41,10 +41,7 @@ class KotlinCommonPlugin : Plugin { companion object { private val ADDITIONAL_COMPILER_ARGS = - listOf( - "-opt-in=kotlin.RequiresOptIn", - "-Xsuppress-version-warnings", - ) + listOf("-opt-in=kotlin.RequiresOptIn", "-Xsuppress-version-warnings") val JVM_TOOLCHAIN_ACTION = Action { languageVersion.set(JavaLanguageVersion.of(17)) } diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/crowdin/CrowdinPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/crowdin/CrowdinPlugin.kt index 83705a74..989b495f 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/crowdin/CrowdinPlugin.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/crowdin/CrowdinPlugin.kt @@ -62,10 +62,7 @@ class CrowdinDownloadPlugin : Plugin { if (extension.skipCleanup.getOrElse(false)) { emptySet() } else { - setOf( - extractStrings.map { it.source }, - downloadCrowdin.map { it.outputFiles }, - ) + setOf(extractStrings.map { it.source }, downloadCrowdin.map { it.outputFiles }) } } } diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtCheckTask.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtCheckTask.kt index 72dd4111..c29dbd2f 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtCheckTask.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtCheckTask.kt @@ -57,7 +57,7 @@ abstract class KtfmtCheckTask : SourceTask() { maxWidth = 100, continuationIndent = 2, ), - originCode + originCode, ) val pathNormalizer = { file: File -> file.toRelativeString(projectDirectory.asFile.get()) } return (originCode != formattedCode) to diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtDiffer.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtDiffer.kt index 6eb76eab..f1332923 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtDiffer.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtDiffer.kt @@ -10,7 +10,7 @@ object KtfmtDiffer { fun computeDiff( inputFile: File, formattedCode: String, - pathNormalizer: (File) -> String + pathNormalizer: (File) -> String, ): List { val originCode = inputFile.readText() return DiffUtils.diff(originCode, formattedCode, null).deltas.map { diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtFormatTask.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtFormatTask.kt index 505e7462..c76b5c89 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtFormatTask.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/ktfmt/KtfmtFormatTask.kt @@ -11,10 +11,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty abstract class KtfmtFormatTask @Inject -constructor( - private val workerExecutor: WorkerExecutor, - private val projectLayout: ProjectLayout, -) : SourceTask() { +constructor(private val workerExecutor: WorkerExecutor, private val projectLayout: ProjectLayout) : + SourceTask() { @TaskAction fun execute() { diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/psl/PSLUpdateTask.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/psl/PSLUpdateTask.kt index 914ea188..a23baabb 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/psl/PSLUpdateTask.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/psl/PSLUpdateTask.kt @@ -104,7 +104,7 @@ abstract class PSLUpdateTask : DefaultTask() { var totalRuleBytes: Int = 0, var totalExceptionRuleBytes: Int = 0, val sortedRules: TreeSet = TreeSet(), - val sortedExceptionRules: TreeSet = TreeSet() + val sortedExceptionRules: TreeSet = TreeSet(), ) private companion object { diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/tasks/GitHooks.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/tasks/GitHooks.kt index 3ffb4c71..53601a92 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/tasks/GitHooks.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/tasks/GitHooks.kt @@ -48,7 +48,7 @@ abstract class GitHooks : DefaultTask() { GROUP_EXECUTE, OTHERS_READ, OTHERS_EXECUTE, - ) + ), ) } } diff --git a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPDecryptOptions.kt b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPDecryptOptions.kt index 15ce92f0..4596478e 100644 --- a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPDecryptOptions.kt +++ b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPDecryptOptions.kt @@ -1,10 +1,8 @@ package app.passwordstore.crypto /** [CryptoOptions] implementation for PGPainless decrypt operations. */ -public class PGPDecryptOptions -private constructor( - private val values: Map, -) : CryptoOptions { +public class PGPDecryptOptions private constructor(private val values: Map) : + CryptoOptions { override fun isOptionEnabled(option: String): Boolean { return values.getOrDefault(option, false) diff --git a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPEncryptOptions.kt b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPEncryptOptions.kt index 90de6b51..09531b61 100644 --- a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPEncryptOptions.kt +++ b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPEncryptOptions.kt @@ -1,10 +1,8 @@ package app.passwordstore.crypto /** [CryptoOptions] implementation for PGPainless encrypt operations. */ -public class PGPEncryptOptions -private constructor( - private val values: Map, -) : CryptoOptions { +public class PGPEncryptOptions private constructor(private val values: Map) : + CryptoOptions { internal companion object { const val ASCII_ARMOR = "ASCII_ARMOR" diff --git a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPKeyManager.kt b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPKeyManager.kt index 8aa11803..cbaa110d 100644 --- a/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPKeyManager.kt +++ b/crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto/PGPKeyManager.kt @@ -31,10 +31,8 @@ import org.pgpainless.util.selection.userid.SelectUserId public class PGPKeyManager @Inject -constructor( - filesDir: String, - private val dispatcher: CoroutineDispatcher, -) : KeyManager { +constructor(filesDir: String, private val dispatcher: CoroutineDispatcher) : + KeyManager { private val keyDir = File(filesDir, KEY_DIR_NAME) diff --git a/crypto/pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt b/crypto/pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt index d0cc693e..8893d0eb 100644 --- a/crypto/pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt +++ b/crypto/pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt @@ -217,10 +217,7 @@ class PGPKeyManagerTest { KeyId(-961222705095032109), // Bobby ) val userIds = - arrayOf( - UserId("Alice "), - UserId("Bobby "), - ) + arrayOf(UserId("Alice "), UserId("Bobby ")) for (idCollection in arrayOf(longKeyIds, userIds)) { val alice1 = keyManager.getKeyById(idCollection[0]) diff --git a/format/common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt b/format/common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt index f4dcc2b7..cd152c9a 100644 --- a/format/common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt +++ b/format/common/src/main/kotlin/app/passwordstore/data/passfile/PasswordEntry.kt @@ -205,7 +205,7 @@ constructor( millis / (THOUSAND_MILLIS * totpPeriod), totpAlgorithm, digits, - issuer + issuer, ) .mapBoth({ code -> Ok(Totp(code, remainingTime)) }, ::Err) } @@ -233,12 +233,7 @@ constructor( "identity:", ) @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - public val PASSWORD_FIELDS: Array = - arrayOf( - "password:", - "secret:", - "pass:", - ) + public val PASSWORD_FIELDS: Array = arrayOf("password:", "secret:", "pass:") private const val THOUSAND_MILLIS = 1000L } } diff --git a/format/common/src/test/kotlin/app/passwordstore/data/passfile/PasswordEntryTest.kt b/format/common/src/test/kotlin/app/passwordstore/data/passfile/PasswordEntryTest.kt index 95fb3e62..ccac0b81 100644 --- a/format/common/src/test/kotlin/app/passwordstore/data/passfile/PasswordEntryTest.kt +++ b/format/common/src/test/kotlin/app/passwordstore/data/passfile/PasswordEntryTest.kt @@ -26,11 +26,7 @@ class PasswordEntryTest { private val totpFinder = UriTotpFinder() private fun makeEntry(content: String, clock: UserClock = fakeClock) = - PasswordEntry( - clock, - totpFinder, - content.encodeToByteArray(), - ) + PasswordEntry(clock, totpFinder, content.encodeToByteArray()) @Test fun getPassword() { @@ -62,7 +58,7 @@ class PasswordEntryTest { assertEquals("blubb", makeEntry("password: foo\nblubb").extraContentString) assertEquals( "blubb\nusername: bar", - makeEntry("blubb\npassword: foo\nusername: bar").extraContentString + makeEntry("blubb\npassword: foo\nusername: bar").extraContentString, ) assertEquals("", makeEntry("\n").extraContentString) assertEquals("", makeEntry("").extraContentString) @@ -107,7 +103,7 @@ class PasswordEntryTest { assertEquals("username", makeEntry("\n$field username").username) assertEquals( "username", - makeEntry("\n${field.uppercase(Locale.getDefault())} username").username + makeEntry("\n${field.uppercase(Locale.getDefault())} username").username, ) } assertEquals("username", makeEntry("secret\nextra\nlogin: username\ncontent\n").username) diff --git a/format/common/src/test/kotlin/app/passwordstore/util/totp/OtpTest.kt b/format/common/src/test/kotlin/app/passwordstore/util/totp/OtpTest.kt index 54ac492d..6f94bda5 100644 --- a/format/common/src/test/kotlin/app/passwordstore/util/totp/OtpTest.kt +++ b/format/common/src/test/kotlin/app/passwordstore/util/totp/OtpTest.kt @@ -25,103 +25,36 @@ class OtpTest { @Test fun otpGeneration6Digits() { - assertEquals( - "953550", - generateOtp( - counter = 1593333298159 / (1000 * 30), - ) - ) - assertEquals( - "275379", - generateOtp( - counter = 1593333571918 / (1000 * 30), - ) - ) - assertEquals( - "867507", - generateOtp( - counter = 1593333600517 / (1000 * 57), - ) - ) + assertEquals("953550", generateOtp(counter = 1593333298159 / (1000 * 30))) + assertEquals("275379", generateOtp(counter = 1593333571918 / (1000 * 30))) + assertEquals("867507", generateOtp(counter = 1593333600517 / (1000 * 57))) } @Test fun otpGeneration10Digits() { - assertEquals( - "0740900914", - generateOtp( - counter = 1593333655044 / (1000 * 30), - digits = "10", - ) - ) - assertEquals( - "0070632029", - generateOtp( - counter = 1593333691405 / (1000 * 30), - digits = "10", - ) - ) - assertEquals( - "1017265882", - generateOtp( - counter = 1593333728893 / (1000 * 83), - digits = "10", - ) - ) + assertEquals("0740900914", generateOtp(counter = 1593333655044 / (1000 * 30), digits = "10")) + assertEquals("0070632029", generateOtp(counter = 1593333691405 / (1000 * 30), digits = "10")) + assertEquals("1017265882", generateOtp(counter = 1593333728893 / (1000 * 83), digits = "10")) } @Test fun otpGenerationIllegalInput() { - assertNull( - generateOtp( - counter = 10000, - algorithm = "SHA0", - digits = "10", - ) - ) - assertNull( - generateOtp( - counter = 10000, - digits = "a", - ) - ) - assertNull( - generateOtp( - counter = 10000, - algorithm = "SHA1", - digits = "5", - ) - ) - assertNull( - generateOtp( - counter = 10000, - digits = "11", - ) - ) - assertNull( - generateOtp( - counter = 10000, - secret = "JBSWY3DPEHPK3PXPAAAAB", - digits = "6", - ) - ) + assertNull(generateOtp(counter = 10000, algorithm = "SHA0", digits = "10")) + assertNull(generateOtp(counter = 10000, digits = "a")) + assertNull(generateOtp(counter = 10000, algorithm = "SHA1", digits = "5")) + assertNull(generateOtp(counter = 10000, digits = "11")) + assertNull(generateOtp(counter = 10000, secret = "JBSWY3DPEHPK3PXPAAAAB", digits = "6")) } @Test fun otpGenerationUnusualSecrets() { assertEquals( "127764", - generateOtp( - counter = 1593367111963 / (1000 * 30), - secret = "JBSWY3DPEHPK3PXPAAAAAAAA", - ) + generateOtp(counter = 1593367111963 / (1000 * 30), secret = "JBSWY3DPEHPK3PXPAAAAAAAA"), ) assertEquals( "047515", - generateOtp( - counter = 1593367171420 / (1000 * 30), - secret = "JBSWY3DPEHPK3PXPAAAAA", - ) + generateOtp(counter = 1593367171420 / (1000 * 30), secret = "JBSWY3DPEHPK3PXPAAAAA"), ) } diff --git a/format/common/src/test/kotlin/app/passwordstore/util/totp/UriTotpFinderTest.kt b/format/common/src/test/kotlin/app/passwordstore/util/totp/UriTotpFinderTest.kt index e462c490..16d9900c 100644 --- a/format/common/src/test/kotlin/app/passwordstore/util/totp/UriTotpFinderTest.kt +++ b/format/common/src/test/kotlin/app/passwordstore/util/totp/UriTotpFinderTest.kt @@ -17,7 +17,7 @@ class UriTotpFinderTest { assertEquals("HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ", totpFinder.findSecret(TOTP_URI)) assertEquals( "HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ", - totpFinder.findSecret("name\npassword\ntotp: HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ") + totpFinder.findSecret("name\npassword\ntotp: HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ"), ) assertEquals("HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ", totpFinder.findSecret(PASS_FILE_CONTENT)) } diff --git a/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGenerator.kt b/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGenerator.kt index 841eb31b..36d7e600 100644 --- a/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGenerator.kt +++ b/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGenerator.kt @@ -14,10 +14,7 @@ import javax.inject.Inject */ public class DicewarePassphraseGenerator @Inject -constructor( - private val die: Die, - wordList: InputStream, -) { +constructor(private val die: Die, wordList: InputStream) { private val wordMap = WordListParser.parse(wordList) diff --git a/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/Die.kt b/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/Die.kt index e3db4b80..c93fc40f 100644 --- a/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/Die.kt +++ b/passgen/diceware/src/main/kotlin/app/passwordstore/passgen/diceware/Die.kt @@ -10,10 +10,7 @@ import javax.inject.Inject /** Basic implementation of a die with configurable number of sides. */ public class Die @Inject -constructor( - private val sides: Int, - private val random: RandomIntGenerator, -) { +constructor(private val sides: Int, private val random: RandomIntGenerator) { /** Roll the die to return a single number. */ public fun roll(): Int { diff --git a/passgen/diceware/src/test/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGeneratorTest.kt b/passgen/diceware/src/test/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGeneratorTest.kt index c12161c2..976e0345 100644 --- a/passgen/diceware/src/test/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGeneratorTest.kt +++ b/passgen/diceware/src/test/kotlin/app/passwordstore/passgen/diceware/DicewarePassphraseGeneratorTest.kt @@ -19,11 +19,7 @@ class DicewarePassphraseGeneratorTest { fun generatePassphrase() { val die = Die(6, intGenerator) - val generator = - DicewarePassphraseGenerator( - die, - WordListParserTest.getDefaultWordList(), - ) + val generator = DicewarePassphraseGenerator(die, WordListParserTest.getDefaultWordList()) assertEquals("salvation_cozily_croon_trustee_fidgety", generator.generatePassphrase(5, '_')) } diff --git a/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/PasswordOption.kt b/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/PasswordOption.kt index ead3b02a..860e3573 100644 --- a/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/PasswordOption.kt +++ b/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/PasswordOption.kt @@ -6,5 +6,5 @@ public enum class PasswordOption(public val key: String) { NoAmbiguousCharacters("B"), FullyRandom("s"), AtLeastOneSymbol("y"), - NoLowercaseLetters("L") + NoLowercaseLetters("L"), } diff --git a/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/RandomPhonemesGenerator.kt b/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/RandomPhonemesGenerator.kt index 8ca196f7..b23acb5e 100644 --- a/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/RandomPhonemesGenerator.kt +++ b/passgen/random/src/main/kotlin/app/passwordstore/passgen/random/RandomPhonemesGenerator.kt @@ -55,7 +55,7 @@ internal object RandomPhonemesGenerator { Element("w", CONSONANT), Element("x", CONSONANT), Element("y", CONSONANT), - Element("z", CONSONANT) + Element("z", CONSONANT), ) private class Element(str: String, val flags: Int) { diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt index c076686f..4af1a80e 100644 --- a/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt +++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt @@ -39,10 +39,7 @@ public fun APSAppBar( navigationIcon = { if (navigationIcon != null) { IconButton(onClick = { onNavigationIconClick.invoke() }) { - Icon( - painter = navigationIcon, - contentDescription = null, - ) + Icon(painter = navigationIcon, contentDescription = null) } } }, @@ -68,7 +65,7 @@ private fun APSAppBarPreview() { contentDescription = "Search items", ) } - } + }, ) } } diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordField.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordField.kt index d2a04777..b8cc74b8 100644 --- a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordField.kt +++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordField.kt @@ -56,10 +56,7 @@ private fun ToggleButton( val icon = if (visible) painterResource(id = R.drawable.baseline_visibility_off_24) else painterResource(id = R.drawable.baseline_visibility_24) - Icon( - painter = icon, - contentDescription = contentDescription, - ) + Icon(painter = icon, contentDescription = contentDescription) } } @@ -70,10 +67,7 @@ public fun CopyButton( modifier: Modifier = Modifier, ) { val clipboard = LocalClipboardManager.current - IconButton( - onClick = { clipboard.setText(AnnotatedString(textToCopy)) }, - modifier = modifier, - ) { + IconButton(onClick = { clipboard.setText(AnnotatedString(textToCopy)) }, modifier = modifier) { Icon( painter = painterResource(R.drawable.ic_content_copy), contentDescription = stringResource(buttonLabelRes), diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt index 63cc8304..01b42093 100644 --- a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt +++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt @@ -34,7 +34,7 @@ public fun PasswordItem( label: String, type: ItemType, onClick: () -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { Row( modifier = -- cgit v1.2.3