Skip to content

Commit

Permalink
style: consistent braces on if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
JuancaG05 committed Jan 28, 2025
1 parent 231a761 commit 025440b
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,9 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted
setResult(Activity.RESULT_CANCELED)
goToUrl(url = getString(R.string.welcome_link_url))
}
} else isVisible = false
} else {
isVisible = false
}
}

val legacyWebfingerLookupServer = mdmProvider.getBrandingString(NO_MDM_RESTRICTION_YET, R.string.webfinger_lookup_server)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class SpaceCursor(projection: Array<String>?) : MatrixCursor(projection ?: DEFAU
fun addSpace(space: OCSpace, rootFolder: OCFile, context: Context?) {
val flags = if (rootFolder.hasAddFilePermission && rootFolder.hasAddSubdirectoriesPermission) {
Document.FLAG_DIR_SUPPORTS_CREATE
} else 0
} else {
0
}

val name = if (space.isPersonal) context?.getString(R.string.bottom_nav_personal) else space.name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,18 @@ class MainFileListViewModel(
parentDir =
if (fileById != null && (!fileById.sharedByLink || fileById.sharedWithSharee != true) && fileById.spaceId == null) {
getFileByRemotePathUseCase(GetFileByRemotePathUseCase.Params(fileById.owner, ROOT_PATH)).getDataOrNull()
} else fileById
} else {
fileById
}
}

FileListOption.AV_OFFLINE -> {
val fileById = fileByIdResult.getDataOrNull()
parentDir = if (fileById != null && (!fileById.isAvailableOffline)) {
getFileByRemotePathUseCase(GetFileByRemotePathUseCase.Params(fileById.owner, ROOT_PATH)).getDataOrNull()
} else fileById
} else {
fileById
}
}

FileListOption.SPACES_LIST -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ class BiometricViewModel(
fun isBiometricLockAvailable(): Boolean =
if (!BiometricManager.isHardwareDetected()) { // Biometric not supported
false
} else BiometricManager.hasEnrolledBiometric() // Biometric not enrolled
} else {
BiometricManager.hasEnrolledBiometric() // Biometric not enrolled
}

companion object {
private const val ANDROID_KEY_STORE = "AndroidKeyStore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class SettingsSecurityFragment : PreferenceFragmentCompat() {

private val enablePasscodeLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode != Activity.RESULT_OK) return@registerForActivityResult
if (result.resultCode != Activity.RESULT_OK) { return@registerForActivityResult }
else {
prefPasscode?.isChecked = true
prefBiometric?.isChecked = securityViewModel.getBiometricsState()
Expand All @@ -71,7 +71,7 @@ class SettingsSecurityFragment : PreferenceFragmentCompat() {

private val disablePasscodeLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode != Activity.RESULT_OK) return@registerForActivityResult
if (result.resultCode != Activity.RESULT_OK) { return@registerForActivityResult }
else {
prefPasscode?.isChecked = false

Expand All @@ -83,7 +83,7 @@ class SettingsSecurityFragment : PreferenceFragmentCompat() {

private val enablePatternLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode != Activity.RESULT_OK) return@registerForActivityResult
if (result.resultCode != Activity.RESULT_OK) { return@registerForActivityResult }
else {
prefPattern?.isChecked = true
prefBiometric?.isChecked = securityViewModel.getBiometricsState()
Expand All @@ -95,7 +95,7 @@ class SettingsSecurityFragment : PreferenceFragmentCompat() {

private val disablePatternLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode != Activity.RESULT_OK) return@registerForActivityResult
if (result.resultCode != Activity.RESULT_OK) { return@registerForActivityResult }
else {
prefPattern?.isChecked = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ class PublicShareDialogFragment : DialogFragment() {
capabilities?.filesSharingPublicExpireDateDays!!
)
.time
} else -1
} else {
-1
}

private val capabilityViewModel: CapabilityViewModel by viewModel {
parametersOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ class MdmProvider(

return if (isMdmFlavor()) {
preferencesProvider.getString(key = mdmKey, defaultValue = setupValue) ?: throw IllegalStateException("Key $stringKey is not supported")
} else setupValue
} else {
setupValue
}
}

fun getBrandingBoolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ class PreviewImagePagerAdapter(
// trigger the creation of new PreviewImageFragment to replace current FileDownloadFragment
// only if the download succeeded. If not trigger an error
notifyDataSetChanged()
} else fragment?.onSyncEvent(action, success, file)
} else {
fragment?.onSyncEvent(action, success, file)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class OCFileLoggingTree(
element.lineNumber // format ensures line numbers have at least 3 places to align consecutive output from the same file
)
return "(${element.fileName}:${element.lineNumber})"
} else
} else {
return String.format(
Locale.US,
"(%s:%d) %s.%s()",
Expand All @@ -114,6 +114,8 @@ class OCFileLoggingTree(
super.createStackElementTag(element)?.replaceFirst(element.fileName.takeWhile { it != '.' }, ""),
element.methodName
)
}

}

@SuppressLint("LogNotTimber")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ class GetRemoteUserQuotaOperation : RemoteOperation<RemoteQuota>() {
val roundedRelativeQuota = if (totalQuota > 0) {
val relativeQuota = (quotaUsed * 100).toDouble() / totalQuota
(relativeQuota * 100).roundToLong() / 100.0
} else 0.0
} else {
0.0
}

RemoteQuota(quotaAvailable, quotaUsed, totalQuota, roundedRelativeQuota)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ fun File.moveRecursively(
val relPath = src.toRelativeString(this)
val dstFile = File(target, relPath)
if (dstFile.exists() && !(src.isDirectory && dstFile.isDirectory)) {
val stillExists = if (!overwrite) true else {
val stillExists = if (!overwrite) { true }
else {
if (dstFile.isDirectory)
!dstFile.deleteRecursively()
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ interface FileDao {
AVAILABLE_OFFLINE_PARENT.ordinal
} else if (currentFileAvailableOfflineStatus == AVAILABLE_OFFLINE.ordinal) {
AVAILABLE_OFFLINE.ordinal
} else NOT_AVAILABLE_OFFLINE.ordinal
} else {
NOT_AVAILABLE_OFFLINE.ordinal
}

companion object {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class GetServerInfoAsyncUseCase(
!url.lowercase(Locale.getDefault()).startsWith(HTTPS_PREFIX)
) {
"$HTTPS_PREFIX$url"
} else url
} else {
url
}

companion object {
const val TRAILING_SLASH = '/'
Expand Down

0 comments on commit 025440b

Please sign in to comment.