diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2024-05-28 15:11:50 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2024-05-28 15:11:50 +0530 |
commit | c980c898de8417e16942741d469ebef8532b822a (patch) | |
tree | cc0639b9bbe45bb7ff89fe3a956c0619f3d943b2 /app/src/main | |
parent | de6cdfee0e37aab03bfb91e5e90c3ec4bd740fe3 (diff) |
chore: reformat with trailing commas changes
Diffstat (limited to 'app/src/main')
66 files changed, 184 insertions, 273 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<PasswordItem> { 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<PasswordItem> { // 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<TextInputEditText>(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<KeyguardManager>()?.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<File> + matchedFiles: List<File>, ): 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<List<File>, 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<File, File> = emptyMap(), - delete: Collection<File> = emptyList() + delete: Collection<File> = 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<Unit, Throwable> { +suspend fun FragmentActivity.commitChange(message: String): Result<Unit, Throwable> { 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<T : ViewBinding>( val fragment: Fragment, - val viewBindingFactory: (View) -> T + val viewBindingFactory: (View) -> T, ) : ReadOnlyProperty<Fragment, T> { 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<GitCommand<out Any>> = - 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<GitCommand<out Any>> = 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<GitCommand<out Any>> = - 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<GitCommand<out Any>> = 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<NotificationManager>() 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<NotificationManager>() 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<PasswordItem> { 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<T : RecyclerView.ViewHolder>( fun <T : ItemDetailsLookup<String>> makeSelectable( recyclerView: RecyclerView, - itemDetailsLookupCreator: (recyclerView: RecyclerView) -> T + itemDetailsLookupCreator: (recyclerView: RecyclerView) -> T, ) { selectionTracker = SelectionTracker.Builder( @@ -425,7 +425,7 @@ open class SearchableRepositoryAdapter<T : RecyclerView.ViewHolder>( recyclerView, itemKeyProvider, itemDetailsLookupCreator(recyclerView), - StorageStrategy.createStringStorage() + StorageStrategy.createStringStorage(), ) .withSelectionPredicate(SelectionPredicates.createSelectAnything()) .build() |