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

Commit c980c89

Browse files
committed
chore: reformat with trailing commas changes
1 parent de6cdfe commit c980c89

File tree

100 files changed

+309
-563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+309
-563
lines changed

app/src/main/java/app/passwordstore/data/crypto/CryptoRepository.kt

+1-6
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ constructor(
7777
.withAsciiArmor(settings.getBoolean(PreferenceKeys.ASCII_ARMOR, false))
7878
.build()
7979
val keys = identities.map { id -> pgpKeyManager.getKeyById(id) }.filterValues()
80-
return pgpCryptoHandler.encrypt(
81-
keys,
82-
content,
83-
out,
84-
encryptionOptions,
85-
)
80+
return pgpCryptoHandler.encrypt(keys, content, out, encryptionOptions)
8681
}
8782
}

app/src/main/java/app/passwordstore/data/crypto/PGPPassphraseCache.kt

+4-18
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,21 @@ import javax.inject.Inject
1111
import kotlinx.coroutines.withContext
1212

1313
/** Implements a rudimentary [EncryptedSharedPreferences]-backed cache for GPG passphrases. */
14-
class PGPPassphraseCache
15-
@Inject
16-
constructor(
17-
private val dispatcherProvider: DispatcherProvider,
18-
) {
14+
class PGPPassphraseCache @Inject constructor(private val dispatcherProvider: DispatcherProvider) {
1915

20-
suspend fun cachePassphrase(
21-
context: Context,
22-
identifier: PGPIdentifier,
23-
passphrase: String,
24-
) {
16+
suspend fun cachePassphrase(context: Context, identifier: PGPIdentifier, passphrase: String) {
2517
withContext(dispatcherProvider.io()) {
2618
getPreferences(context).edit { putString(identifier.toString(), passphrase) }
2719
}
2820
}
2921

30-
suspend fun retrieveCachedPassphrase(
31-
context: Context,
32-
identifier: PGPIdentifier,
33-
): String? {
22+
suspend fun retrieveCachedPassphrase(context: Context, identifier: PGPIdentifier): String? {
3423
return withContext(dispatcherProvider.io()) {
3524
getPreferences(context).getString(identifier.toString())
3625
}
3726
}
3827

39-
suspend fun clearCachedPassphrase(
40-
context: Context,
41-
identifier: PGPIdentifier,
42-
) {
28+
suspend fun clearCachedPassphrase(context: Context, identifier: PGPIdentifier) {
4329
withContext(dispatcherProvider.io()) {
4430
getPreferences(context).edit { remove(identifier.toString()) }
4531
}

app/src/main/java/app/passwordstore/data/password/FieldItem.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import app.passwordstore.data.passfile.Totp
1010
class FieldItem(val key: String, val value: String, val action: ActionType) {
1111
enum class ActionType {
1212
COPY,
13-
HIDE
13+
HIDE,
1414
}
1515

1616
enum class ItemType(val type: String, val label: String) {

app/src/main/java/app/passwordstore/data/password/PasswordItem.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ data class PasswordItem(
1616
val parent: PasswordItem? = null,
1717
val type: Char,
1818
val file: File,
19-
val rootDir: File
19+
val rootDir: File,
2020
) : Comparable<PasswordItem> {
2121

2222
val fullPathToParent = file.absolutePath.replace(rootDir.absolutePath, "").replace(file.name, "")

app/src/main/java/app/passwordstore/data/repo/PasswordRepository.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ object PasswordRepository {
167167
fun getPasswords(
168168
path: File,
169169
rootDir: File,
170-
sortOrder: PasswordSortOrder
170+
sortOrder: PasswordSortOrder,
171171
): ArrayList<PasswordItem> {
172172
// We need to recover the passwords then parse the files
173173
val passList = getFilesList(path).also { it.sortBy { f -> f.name } }

app/src/main/java/app/passwordstore/injection/crypto/KeyManagerModule.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ object KeyManagerModule {
2323
@PGPKeyDir keyDir: String,
2424
dispatcherProvider: DispatcherProvider,
2525
): PGPKeyManager {
26-
return PGPKeyManager(
27-
keyDir,
28-
dispatcherProvider.io(),
29-
)
26+
return PGPKeyManager(keyDir, dispatcherProvider.io())
3027
}
3128

3229
@Provides

app/src/main/java/app/passwordstore/injection/prefs/PreferenceModule.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PreferenceModule {
2525
fileName,
2626
masterKeyAlias,
2727
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
28-
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
28+
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM,
2929
)
3030
}
3131

app/src/main/java/app/passwordstore/injection/pwgen/DicewareModule.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ object DicewareModule {
3232
}
3333

3434
@Provides
35-
fun provideDie(
36-
intGenerator: RandomIntGenerator,
37-
): Die {
35+
fun provideDie(intGenerator: RandomIntGenerator): Die {
3836
return Die(6, intGenerator)
3937
}
4038

app/src/main/java/app/passwordstore/ui/autofill/AutofillDecryptActivity.kt

+5-10
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ class AutofillDecryptActivity : BasePGPActivity() {
113113
val cachedPassphrase =
114114
passphraseCache.retrieveCachedPassphrase(
115115
this@AutofillDecryptActivity,
116-
gpgIdentifiers.first()
116+
gpgIdentifiers.first(),
117117
)
118118
if (cachedPassphrase != null) {
119119
decryptWithPassphrase(
120120
File(filePath),
121121
gpgIdentifiers,
122122
clientState,
123123
action,
124-
cachedPassphrase
124+
cachedPassphrase,
125125
)
126126
} else {
127127
askPassphrase(filePath, gpgIdentifiers, clientState, action)
@@ -169,12 +169,12 @@ class AutofillDecryptActivity : BasePGPActivity() {
169169
this@AutofillDecryptActivity,
170170
credentials,
171171
clientState,
172-
action
172+
action,
173173
)
174174
withContext(dispatcherProvider.main()) {
175175
setResult(
176176
RESULT_OK,
177-
Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) }
177+
Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) },
178178
)
179179
}
180180
}
@@ -195,12 +195,7 @@ class AutofillDecryptActivity : BasePGPActivity() {
195195
runCatching {
196196
withContext(dispatcherProvider.io()) {
197197
val outputStream = ByteArrayOutputStream()
198-
repository.decrypt(
199-
password,
200-
identifiers,
201-
encryptedInput,
202-
outputStream,
203-
)
198+
repository.decrypt(password, identifiers, encryptedInput, outputStream)
204199
outputStream
205200
}
206201
}

app/src/main/java/app/passwordstore/ui/autofill/AutofillFilterView.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class AutofillFilterView : AppCompatActivity() {
6161

6262
fun makeMatchAndDecryptFileIntentSender(
6363
context: Context,
64-
formOrigin: FormOrigin
64+
formOrigin: FormOrigin,
6565
): IntentSender {
6666
val intent =
6767
Intent(context, AutofillFilterView::class.java).apply {
@@ -193,7 +193,7 @@ class AutofillFilterView : AppCompatActivity() {
193193
shouldMatch.text =
194194
getString(
195195
R.string.oreo_autofill_match_with,
196-
formOrigin.getPrettyIdentifier(applicationContext)
196+
formOrigin.getPrettyIdentifier(applicationContext),
197197
)
198198
lifecycleScope.launch { handleSearchResults() }
199199
}
@@ -222,7 +222,7 @@ class AutofillFilterView : AppCompatActivity() {
222222
filterMode =
223223
if (binding.strictDomainSearch.isChecked) FilterMode.StrictDomain else FilterMode.Fuzzy,
224224
searchMode = SearchMode.RecursivelyInSubdirectories,
225-
listMode = ListMode.FilesOnly
225+
listMode = ListMode.FilesOnly,
226226
)
227227
}
228228

app/src/main/java/app/passwordstore/ui/autofill/AutofillPublisherChangedActivity.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@ class AutofillPublisherChangedActivity : AppCompatActivity() {
9292
resetButton.setOnClickListener {
9393
AutofillMatcher.clearMatchesFor(
9494
this@AutofillPublisherChangedActivity,
95-
FormOrigin.App(appPackage)
95+
FormOrigin.App(appPackage),
9696
)
9797
val fillResponse =
9898
IntentCompat.getParcelableExtra(
9999
intent,
100100
EXTRA_FILL_RESPONSE_AFTER_RESET,
101-
FillResponse::class.java
101+
FillResponse::class.java,
102102
)
103103
setResult(
104104
RESULT_OK,
105-
Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillResponse) }
105+
Intent().apply { putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillResponse) },
106106
)
107107
finish()
108108
}
@@ -122,7 +122,7 @@ class AutofillPublisherChangedActivity : AppCompatActivity() {
122122
warningAppName.text =
123123
getString(
124124
R.string.oreo_autofill_warning_publisher_app_name,
125-
packageManager.getApplicationLabel(appInfo)
125+
packageManager.getApplicationLabel(appInfo),
126126
)
127127

128128
val currentHash =
@@ -131,7 +131,7 @@ class AutofillPublisherChangedActivity : AppCompatActivity() {
131131
getString(
132132
R.string.oreo_autofill_warning_publisher_advanced_info_template,
133133
appPackage,
134-
currentHash
134+
currentHash,
135135
)
136136
}
137137
}

app/src/main/java/app/passwordstore/ui/autofill/AutofillSaveActivity.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class AutofillSaveActivity : AppCompatActivity() {
4747
fun makeSaveIntentSender(
4848
context: Context,
4949
credentials: Credentials?,
50-
formOrigin: FormOrigin
50+
formOrigin: FormOrigin,
5151
): IntentSender {
5252
val identifier = formOrigin.getPrettyIdentifier(context, untrusted = false)
5353
// Prevent directory traversals
@@ -58,12 +58,12 @@ class AutofillSaveActivity : AppCompatActivity() {
5858
val folderName =
5959
directoryStructure.getSaveFolderName(
6060
sanitizedIdentifier = sanitizedIdentifier,
61-
username = credentials?.username
61+
username = credentials?.username,
6262
)
6363
val fileName =
6464
directoryStructure.getSaveFileName(
6565
username = credentials?.username,
66-
identifier = identifier
66+
identifier = identifier,
6767
)
6868
val intent =
6969
Intent(context, AutofillSaveActivity::class.java).apply {
@@ -76,15 +76,15 @@ class AutofillSaveActivity : AppCompatActivity() {
7676
formOrigin.identifier.takeIf { formOrigin is FormOrigin.App },
7777
EXTRA_SHOULD_MATCH_WEB to
7878
formOrigin.identifier.takeIf { formOrigin is FormOrigin.Web },
79-
EXTRA_GENERATE_PASSWORD to (credentials == null)
79+
EXTRA_GENERATE_PASSWORD to (credentials == null),
8080
)
8181
)
8282
}
8383
return PendingIntent.getActivity(
8484
context,
8585
saveRequestCode++,
8686
intent,
87-
PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE
87+
PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE,
8888
)
8989
.intentSender
9090
}
@@ -114,7 +114,7 @@ class AutofillSaveActivity : AppCompatActivity() {
114114
PasswordCreationActivity.EXTRA_FILE_NAME to intent.getStringExtra(EXTRA_NAME),
115115
PasswordCreationActivity.EXTRA_PASSWORD to intent.getStringExtra(EXTRA_PASSWORD),
116116
PasswordCreationActivity.EXTRA_GENERATE_PASSWORD to
117-
intent.getBooleanExtra(EXTRA_GENERATE_PASSWORD, false)
117+
intent.getBooleanExtra(EXTRA_GENERATE_PASSWORD, false),
118118
)
119119
)
120120
}
@@ -141,7 +141,7 @@ class AutofillSaveActivity : AppCompatActivity() {
141141
this,
142142
credentials,
143143
clientState,
144-
AutofillAction.Generate
144+
AutofillAction.Generate,
145145
)
146146
Intent().apply {
147147
putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset)

app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ open class BasePGPActivity : AppCompatActivity() {
9090
fun copyTextToClipboard(
9191
text: String?,
9292
showSnackbar: Boolean = true,
93-
@StringRes snackbarTextRes: Int = R.string.clipboard_copied_text
93+
@StringRes snackbarTextRes: Int = R.string.clipboard_copied_text,
9494
) {
9595
val clipboard = clipboard ?: return
9696
val clip = ClipData.newPlainText("pgp_handler_result_pm", text)

app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt

+3-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fun EditPasswordScreen(
4040
onNavigationIconClick = onNavigateUp,
4141
backgroundColor = MaterialTheme.colorScheme.surface,
4242
)
43-
},
43+
}
4444
) { paddingValues ->
4545
Box(modifier = modifier.padding(paddingValues)) {
4646
Column(modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp).fillMaxSize()) {
@@ -59,10 +59,7 @@ fun EditPasswordScreen(
5959
}
6060

6161
@Composable
62-
private fun ExtraContent(
63-
entry: PasswordEntry,
64-
modifier: Modifier = Modifier,
65-
) {
62+
private fun ExtraContent(entry: PasswordEntry, modifier: Modifier = Modifier) {
6663
TextField(
6764
value = entry.extraContentString,
6865
onValueChange = {},
@@ -95,5 +92,5 @@ private fun createTestEntry() =
9592
|URL: example.com
9693
"""
9794
.trimMargin()
98-
.encodeToByteArray()
95+
.encodeToByteArray(),
9996
)

app/src/main/java/app/passwordstore/ui/crypto/PasswordCreationActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class PasswordCreationActivity : BasePGPActivity() {
147147
otpImportButton.setOnClickListener {
148148
supportFragmentManager.setFragmentResultListener(
149149
OTP_RESULT_REQUEST_KEY,
150-
this@PasswordCreationActivity
150+
this@PasswordCreationActivity,
151151
) { requestKey, bundle ->
152152
if (requestKey == OTP_RESULT_REQUEST_KEY) {
153153
val contents = bundle.getString(RESULT)

app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt

+4-11
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fun ViewPasswordScreen(
4646
onNavigationIconClick = onNavigateUp,
4747
backgroundColor = MaterialTheme.colorScheme.surface,
4848
)
49-
},
49+
}
5050
) { paddingValues ->
5151
Box(modifier = modifier.padding(paddingValues)) {
5252
Column(modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp).fillMaxSize()) {
@@ -87,10 +87,7 @@ fun ViewPasswordScreen(
8787
}
8888

8989
@Composable
90-
private fun ExtraContent(
91-
entry: PasswordEntry,
92-
modifier: Modifier = Modifier,
93-
) {
90+
private fun ExtraContent(entry: PasswordEntry, modifier: Modifier = Modifier) {
9491
entry.extraContent.forEach { (label, value) ->
9592
TextField(
9693
value = value,
@@ -107,11 +104,7 @@ private fun ExtraContent(
107104
@Composable
108105
private fun ViewPasswordScreenPreview() {
109106
APSTheme {
110-
ViewPasswordScreen(
111-
entryName = "Test Entry",
112-
entry = createTestEntry(),
113-
onNavigateUp = {},
114-
)
107+
ViewPasswordScreen(entryName = "Test Entry", entry = createTestEntry(), onNavigateUp = {})
115108
}
116109
}
117110

@@ -126,5 +119,5 @@ private fun createTestEntry() =
126119
|URL: example.com
127120
"""
128121
.trimMargin()
129-
.encodeToByteArray()
122+
.encodeToByteArray(),
130123
)

app/src/main/java/app/passwordstore/ui/dialogs/BasicBottomSheet.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private constructor(
5454
override fun onCreateView(
5555
inflater: LayoutInflater,
5656
container: ViewGroup?,
57-
savedInstanceState: Bundle?
57+
savedInstanceState: Bundle?,
5858
): View? {
5959
if (savedInstanceState != null) dismiss()
6060
return layoutInflater.inflate(R.layout.basic_bottom_sheet, container, false)
@@ -157,9 +157,7 @@ private constructor(
157157
return this
158158
}
159159

160-
fun setOnDismissListener(
161-
onDismissListener: OnDismissListener,
162-
): Builder {
160+
fun setOnDismissListener(onDismissListener: OnDismissListener): Builder {
163161
this.onDismissListener = onDismissListener
164162
return this
165163
}

0 commit comments

Comments
 (0)