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

Commit 426fc92

Browse files
authored
Upgrade ktfmt (#1942)
* build-logic: upgrade ktfmt * all: reformat
1 parent f968b21 commit 426fc92

File tree

22 files changed

+90
-55
lines changed

22 files changed

+90
-55
lines changed

app/src/main/java/dev/msfjarvis/aps/Application.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
4242
override fun onCreate() {
4343
super.onCreate()
4444
instance = this
45-
if (BuildConfig.ENABLE_DEBUG_FEATURES ||
45+
if (
46+
BuildConfig.ENABLE_DEBUG_FEATURES ||
4647
prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)
4748
) {
4849
LogcatLogger.install(AndroidLogcatLogger(DEBUG))

app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillDecryptActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ class AutofillDecryptActivity : AppCompatActivity() {
195195
return null
196196
}
197197
.onSuccess { result ->
198-
return when (val resultCode =
198+
return when (
199+
val resultCode =
199200
result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)
200201
) {
201202
OpenPgpApi.RESULT_CODE_SUCCESS -> {

app/src/main/java/dev/msfjarvis/aps/ui/autofill/AutofillFilterView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ class AutofillFilterView : AppCompatActivity() {
204204
}
205205
// Switch RecyclerView out for a "no results" message if the new list is empty and
206206
// the message is not yet shown (and vice versa).
207-
if ((list.isEmpty() && rvPasswordSwitcher.nextView.id == rvPasswordEmpty.id) ||
207+
if (
208+
(list.isEmpty() && rvPasswordSwitcher.nextView.id == rvPasswordEmpty.id) ||
208209
(list.isNotEmpty() && rvPasswordSwitcher.nextView.id == rvPassword.id)
209210
) {
210211
rvPasswordSwitcher.showNext()

app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
274274
// Allow the user to quickly switch between storing the username as the filename or
275275
// in the encrypted extras. This only makes sense if the directory structure is
276276
// FileBased.
277-
if (suggestedName == null &&
277+
if (
278+
suggestedName == null &&
278279
AutofillPreferences.directoryStructure(this@PasswordCreationActivity) ==
279280
DirectoryStructure.FileBased
280281
) {
@@ -418,9 +419,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
418419
GpgIdentifier.fromString(line)
419420
?: run {
420421
// The line being empty means this is most likely an empty `.gpg-id`
421-
// file
422-
// we created. Skip the validation so we can make the user add a real
423-
// ID.
422+
// file we created. Skip the validation so we can make the user add a
423+
// real ID.
424424
if (line.isEmpty()) return@run
425425
if (line.removePrefix("0x").matches("[a-fA-F0-9]{8}".toRegex())) {
426426
snackbar(message = resources.getString(R.string.short_key_ids_unsupported))
@@ -488,7 +488,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
488488
// Additionally, if we were editing and the incoming and outgoing
489489
// filenames differ, it means we renamed. Ensure that the target
490490
// doesn't already exist to prevent an accidental overwrite.
491-
if ((!editing || (editing && suggestedName != file.nameWithoutExtension)) &&
491+
if (
492+
(!editing || (editing && suggestedName != file.nameWithoutExtension)) &&
492493
file.exists()
493494
) {
494495
snackbar(message = getString(R.string.password_creation_duplicate_error))
@@ -535,7 +536,8 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
535536
returnIntent.putExtra(RETURN_EXTRA_USERNAME, username)
536537
}
537538

538-
if (directoryInputLayout.isVisible &&
539+
if (
540+
directoryInputLayout.isVisible &&
539541
directoryInputLayout.isEnabled &&
540542
oldFileName != null
541543
) {

app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivityV2.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ class PasswordCreationActivityV2 : BasePgpActivity() {
204204
// Allow the user to quickly switch between storing the username as the filename or
205205
// in the encrypted extras. This only makes sense if the directory structure is
206206
// FileBased.
207-
if (suggestedName == null &&
207+
if (
208+
suggestedName == null &&
208209
AutofillPreferences.directoryStructure(this@PasswordCreationActivityV2) ==
209210
DirectoryStructure.FileBased
210211
) {
@@ -368,8 +369,8 @@ class PasswordCreationActivityV2 : BasePgpActivity() {
368369
// Additionally, if we were editing and the incoming and outgoing
369370
// filenames differ, it means we renamed. Ensure that the target
370371
// doesn't already exist to prevent an accidental overwrite.
371-
if ((!editing || (editing && suggestedName != file.nameWithoutExtension)) &&
372-
file.exists()
372+
if (
373+
(!editing || (editing && suggestedName != file.nameWithoutExtension)) && file.exists()
373374
) {
374375
snackbar(message = getString(R.string.password_creation_duplicate_error))
375376
return@runCatching
@@ -407,7 +408,8 @@ class PasswordCreationActivityV2 : BasePgpActivity() {
407408
returnIntent.putExtra(RETURN_EXTRA_USERNAME, username)
408409
}
409410

410-
if (directoryInputLayout.isVisible &&
411+
if (
412+
directoryInputLayout.isVisible &&
411413
directoryInputLayout.isEnabled &&
412414
oldFileName != null
413415
) {

app/src/main/java/dev/msfjarvis/aps/ui/folderselect/SelectFolderFragment.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class SelectFolderFragment : Fragment(R.layout.password_recycler_view) {
6565
if (item.type == PasswordItem.TYPE_CATEGORY) {
6666
model.navigateTo(item.file, listMode = ListMode.DirectoriesOnly)
6767
(requireActivity() as AppCompatActivity)
68-
.supportActionBar?.setDisplayHomeAsUpEnabled(true)
68+
.supportActionBar
69+
?.setDisplayHomeAsUpEnabled(true)
6970
}
7071
}
7172
}

app/src/main/java/dev/msfjarvis/aps/ui/git/base/BaseGitActivity.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ abstract class BaseGitActivity : ContinuationContainerActivity() {
152152
private fun isExplicitlyUserInitiatedError(throwable: Throwable): Boolean {
153153
var cause: Throwable? = throwable
154154
while (cause != null) {
155-
if (cause is SSHException && cause.disconnectReason == DisconnectReason.AUTH_CANCELLED_BY_USER
155+
if (
156+
cause is SSHException && cause.disconnectReason == DisconnectReason.AUTH_CANCELLED_BY_USER
156157
)
157158
return true
158159
cause = cause.cause
@@ -170,11 +171,13 @@ abstract class BaseGitActivity : ContinuationContainerActivity() {
170171
// exceptions.
171172
// Also, SSHJ's UserAuthException about exhausting available authentication methods hides
172173
// more useful exceptions.
173-
while ((rootCause is org.eclipse.jgit.errors.TransportException ||
174-
rootCause is org.eclipse.jgit.api.errors.TransportException ||
175-
rootCause is org.eclipse.jgit.api.errors.InvalidRemoteException ||
176-
(rootCause is UserAuthException &&
177-
rootCause.message == "Exhausted available authentication methods"))) {
174+
while (
175+
(rootCause is org.eclipse.jgit.errors.TransportException ||
176+
rootCause is org.eclipse.jgit.api.errors.TransportException ||
177+
rootCause is org.eclipse.jgit.api.errors.InvalidRemoteException ||
178+
(rootCause is UserAuthException &&
179+
rootCause.message == "Exhausted available authentication methods"))
180+
) {
178181
rootCause = rootCause.cause ?: break
179182
}
180183
return rootCause

app/src/main/java/dev/msfjarvis/aps/ui/git/config/GitServerConfigActivity.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ class GitServerConfigActivity : BaseGitActivity() {
140140
.show(supportFragmentManager, "SSH_SCHEME_WARNING")
141141
return@setOnClickListener
142142
}
143-
when (val updateResult =
143+
when (
144+
val updateResult =
144145
gitSettings.updateConnectionSettingsIfValid(
145146
newAuthMode = newAuthMode,
146147
newUrl = binding.serverUrl.text.toString().trim(),
@@ -230,7 +231,8 @@ class GitServerConfigActivity : BaseGitActivity() {
230231
val localDir = requireNotNull(PasswordRepository.getRepositoryDirectory())
231232
val localDirFiles = localDir.listFiles() ?: emptyArray()
232233
// Warn if non-empty folder unless it's a just-initialized store that has just a .git folder
233-
if (localDir.exists() &&
234+
if (
235+
localDir.exists() &&
234236
localDirFiles.isNotEmpty() &&
235237
!(localDirFiles.size == 1 && localDirFiles[0].name == ".git")
236238
) {

app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordFragment.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ class PasswordFragment : Fragment(R.layout.password_recycler_view) {
303303
listener =
304304
object : OnFragmentInteractionListener {
305305
override fun onFragmentInteraction(item: PasswordItem) {
306-
if (settings.getString(PreferenceKeys.SORT_ORDER) ==
306+
if (
307+
settings.getString(PreferenceKeys.SORT_ORDER) ==
307308
PasswordSortOrder.RECENTLY_USED.name
308309
) {
309310
// save the time when password was used

app/src/main/java/dev/msfjarvis/aps/ui/passwords/PasswordStore.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ class PasswordStore : BaseGitActivity() {
182182

183183
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
184184
// open search view on search key, or Ctr+F
185-
if ((keyCode == KeyEvent.KEYCODE_SEARCH ||
185+
if (
186+
(keyCode == KeyEvent.KEYCODE_SEARCH ||
186187
keyCode == KeyEvent.KEYCODE_F && event.isCtrlPressed) && !searchItem.isActionViewExpanded
187188
) {
188189
searchItem.expandActionView()
@@ -353,7 +354,8 @@ class PasswordStore : BaseGitActivity() {
353354
if (localDir != null && settings.getBoolean(PreferenceKeys.REPOSITORY_INITIALIZED, false)) {
354355
logcat { "Check, dir: ${localDir.absolutePath}" }
355356
// do not push the fragment if we already have it
356-
if (getPasswordFragment() == null || settings.getBoolean(PreferenceKeys.REPO_CHANGED, false)
357+
if (
358+
getPasswordFragment() == null || settings.getBoolean(PreferenceKeys.REPO_CHANGED, false)
357359
) {
358360
settings.edit { putBoolean(PreferenceKeys.REPO_CHANGED, false) }
359361
val args = Bundle()

0 commit comments

Comments
 (0)