Skip to content

Commit

Permalink
style: wrap lines more than 150 characters in module owncloudApp
Browse files Browse the repository at this point in the history
  • Loading branch information
JuancaG05 committed Dec 4, 2024
1 parent d7550ec commit 54ef180
Show file tree
Hide file tree
Showing 22 changed files with 96 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ class FileDataStorageManager(
getFileByPathAndAccount(remotePath, account.name, spaceId)
}

private fun getFileByPathAndAccount(remotePath: String, accountName: String, spaceId: String? = null): OCFile? = runBlocking(CoroutinesDispatcherProvider().io) {
val getFileByRemotePathUseCase: GetFileByRemotePathUseCase by inject()

val result = withContext(CoroutineScope(CoroutinesDispatcherProvider().io).coroutineContext) {
getFileByRemotePathUseCase(GetFileByRemotePathUseCase.Params(accountName, remotePath, spaceId))
}.getDataOrNull()
result
}
private fun getFileByPathAndAccount(remotePath: String, accountName: String, spaceId: String? = null): OCFile? =
runBlocking(CoroutinesDispatcherProvider().io) {
val getFileByRemotePathUseCase: GetFileByRemotePathUseCase by inject()

val result = withContext(CoroutineScope(CoroutinesDispatcherProvider().io).coroutineContext) {
getFileByRemotePathUseCase(GetFileByRemotePathUseCase.Params(accountName, remotePath, spaceId))
}.getDataOrNull()
result
}

fun getRootPersonalFolder() = runBlocking(CoroutinesDispatcherProvider().io) {
val getPersonalRootFolderForAccountUseCase: GetPersonalRootFolderForAccountUseCase by inject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ val viewModelModule = module {
ShareViewModel(filePath, accountName, get(), get(), get(), get(), get(), get(), get(), get(), get(), get())
}
viewModel { (initialFolderToDisplay: OCFile, fileListOption: FileListOption) ->
MainFileListViewModel(get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), initialFolderToDisplay, fileListOption)
MainFileListViewModel(get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(),
initialFolderToDisplay, fileListOption)
}
viewModel { (ocFile: OCFile) -> ConflictsResolveViewModel(get(), get(), get(), get(), get(), ocFile) }
viewModel { AuthenticationViewModel(get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get()) }
viewModel { MigrationViewModel(MainApp.dataFolder, get(), get(), get(), get(), get(), get(), get()) }
viewModel { TransfersViewModel(get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get()) }
viewModel { TransfersViewModel(get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(),
get()) }
viewModel { ReceiveExternalFilesViewModel(get(), get(), get(), get()) }
viewModel { (accountName: String, showPersonalSpace: Boolean) ->
SpacesListViewModel(get(), get(), get(), get(), get(), accountName, showPersonalSpace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted
codeChallenge = authenticationViewModel.codeChallenge,
state = authenticationViewModel.oidcState,
username = username,
sendLoginHintAndUser = mdmProvider.getBrandingBoolean(mdmKey = CONFIGURATION_SEND_LOGIN_HINT_AND_USER, booleanKey = R.bool.send_login_hint_and_user),
sendLoginHintAndUser = mdmProvider.getBrandingBoolean(mdmKey = CONFIGURATION_SEND_LOGIN_HINT_AND_USER,
booleanKey = R.bool.send_login_hint_and_user),
)

try {
Expand Down Expand Up @@ -585,7 +586,8 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted
val authorizationError = intent.data?.getQueryParameter("error")
val authorizationErrorDescription = intent.data?.getQueryParameter("error_description")

Timber.e("OAuth request to get authorization code failed. Error: [$authorizationError]. Error description: [$authorizationErrorDescription]")
Timber.e("OAuth request to get authorization code failed. Error: [$authorizationError]." +
" Error description: [$authorizationErrorDescription]")
val authorizationException =
if (authorizationError == "access_denied") UnauthorizedException() else Throwable()
updateOAuthStatusIconAndText(authorizationException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class ConflictsResolveActivity : AppCompatActivity(), ConflictsResolveDialogFrag
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
conflictsResolveViewModel.currentFile.collectLatest { updatedOCFile ->
Timber.d("File ${updatedOCFile?.remotePath} from ${updatedOCFile?.owner} needs to fix a conflict with etag in conflict ${updatedOCFile?.etagInConflict}")
Timber.d("File ${updatedOCFile?.remotePath} from ${updatedOCFile?.owner} needs to fix a conflict with etag" +
" in conflict ${updatedOCFile?.etagInConflict}")
// Finish if the file does not exists or if the file is not in conflict anymore.
updatedOCFile?.etagInConflict ?: finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ class FileDetailsFragment : FileFragment() {
// Mimetypes not supported via open in web, send 500
if (uiResult.error is InstanceNotConfiguredException) {
val message =
getString(R.string.open_in_web_error_generic) + " " + getString(R.string.error_reason) + " " + getString(R.string.open_in_web_error_not_supported)
getString(R.string.open_in_web_error_generic) + " " + getString(R.string.error_reason) +
" " + getString(R.string.open_in_web_error_not_supported)
this.showMessageInSnackbar(message, Snackbar.LENGTH_LONG)
} else if (uiResult.error is TooEarlyException) {
this.showMessageInSnackbar(getString(R.string.open_in_web_error_too_early), Snackbar.LENGTH_LONG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ class MainFileListFragment : Fragment(),
// Mimetypes not supported via open in web, send 500
if (uiResult.error is InstanceNotConfiguredException) {
val message =
getString(R.string.open_in_web_error_generic) + " " + getString(R.string.error_reason) + " " + getString(R.string.open_in_web_error_not_supported)
getString(R.string.open_in_web_error_generic) + " " + getString(R.string.error_reason) +
" " + getString(R.string.open_in_web_error_not_supported)
this.showMessageInSnackbar(message, Snackbar.LENGTH_LONG)
} else if (uiResult.error is TooEarlyException) {
this.showMessageInSnackbar(getString(R.string.open_in_web_error_too_early), Snackbar.LENGTH_LONG)
Expand Down Expand Up @@ -826,7 +827,8 @@ class MainFileListFragment : Fragment(),
* @param newFileListOption new file list option to enable.
*/
private fun showOrHideFab(newFileListOption: FileListOption, currentFolder: OCFile) {
if (!newFileListOption.isAllFiles() || isPickingAFolder() || (!currentFolder.hasAddFilePermission && !currentFolder.hasAddSubdirectoriesPermission)) {
if (!newFileListOption.isAllFiles() || isPickingAFolder() ||
(!currentFolder.hasAddFilePermission && !currentFolder.hasAddSubdirectoriesPermission)) {
toggleFabVisibility(false)
} else {
toggleFabVisibility(true)
Expand Down Expand Up @@ -872,7 +874,8 @@ class MainFileListFragment : Fragment(),
fabNewfile.isFocusable = isFabExpanded()
fabNewshortcut.isFocusable = isFabExpanded()
if (fabMain.isExpanded) {
binding.fabMain.findViewById<AddFloatingActionButton>(com.getbase.floatingactionbutton.R.id.fab_expand_menu_button).contentDescription = getString(R.string.content_description_add_new_content_expanded)
binding.fabMain.findViewById<AddFloatingActionButton>(com.getbase.floatingactionbutton.R.id.fab_expand_menu_button)
.contentDescription = getString(R.string.content_description_add_new_content_expanded)
} else {
setFabMainContentDescription()
}
Expand Down Expand Up @@ -1442,16 +1445,23 @@ class MainFileListFragment : Fragment(),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val roleAccessibilityDescription = getString(R.string.button_role_accessibility)
menu?.apply {
findItem(R.id.file_action_select_all)?.contentDescription = "${getString(R.string.actionbar_select_all)} $roleAccessibilityDescription"
findItem(R.id.action_select_inverse)?.contentDescription = "${getString(R.string.actionbar_select_inverse)} $roleAccessibilityDescription"
findItem(R.id.action_open_file_with)?.contentDescription = "${getString(R.string.actionbar_open_with)} $roleAccessibilityDescription"
findItem(R.id.file_action_select_all)?.contentDescription =
"${getString(R.string.actionbar_select_all)} $roleAccessibilityDescription"
findItem(R.id.action_select_inverse)?.contentDescription =
"${getString(R.string.actionbar_select_inverse)} $roleAccessibilityDescription"
findItem(R.id.action_open_file_with)?.contentDescription =
"${getString(R.string.actionbar_open_with)} $roleAccessibilityDescription"
findItem(R.id.action_rename_file)?.contentDescription = "${getString(R.string.common_rename)} $roleAccessibilityDescription"
findItem(R.id.action_move)?.contentDescription = "${getString(R.string.actionbar_move)} $roleAccessibilityDescription"
findItem(R.id.action_copy)?.contentDescription = "${getString(R.string.copy)} $roleAccessibilityDescription"
findItem(R.id.action_send_file)?.contentDescription = "${getString(R.string.actionbar_send_file)} $roleAccessibilityDescription"
findItem(R.id.action_set_available_offline)?.contentDescription = "${getString(R.string.set_available_offline)} $roleAccessibilityDescription"
findItem(R.id.action_unset_available_offline)?.contentDescription = "${getString(R.string.unset_available_offline)} $roleAccessibilityDescription"
findItem(R.id.action_see_details)?.contentDescription = "${getString(R.string.actionbar_see_details)} $roleAccessibilityDescription"
findItem(R.id.action_send_file)?.contentDescription =
"${getString(R.string.actionbar_send_file)} $roleAccessibilityDescription"
findItem(R.id.action_set_available_offline)?.contentDescription =
"${getString(R.string.set_available_offline)} $roleAccessibilityDescription"
findItem(R.id.action_unset_available_offline)?.contentDescription =
"${getString(R.string.unset_available_offline)} $roleAccessibilityDescription"
findItem(R.id.action_see_details)?.contentDescription =
"${getString(R.string.actionbar_see_details)} $roleAccessibilityDescription"
findItem(R.id.action_remove_file)?.contentDescription = "${getString(R.string.common_remove)} $roleAccessibilityDescription"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ class MainFileListViewModel(

FileListOption.SHARED_BY_LINK -> {
val fileById = fileByIdResult.getDataOrNull()
parentDir = if (fileById != null && (!fileById.sharedByLink || fileById.sharedWithSharee != true) && fileById.spaceId == null) {
getFileByRemotePathUseCase(GetFileByRemotePathUseCase.Params(fileById.owner, ROOT_PATH)).getDataOrNull()
} else fileById
parentDir =
if (fileById != null && (!fileById.sharedByLink || fileById.sharedWithSharee != true) && fileById.spaceId == null) {
getFileByRemotePathUseCase(GetFileByRemotePathUseCase.Params(fileById.owner, ROOT_PATH)).getDataOrNull()
} else fileById
}

FileListOption.AV_OFFLINE -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ class FileOperationsViewModel(
remotePath = fileOperation.folderToRefresh.remotePath,
accountName = fileOperation.folderToRefresh.owner,
spaceId = fileOperation.folderToRefresh.spaceId,
syncMode = if (fileOperation.shouldSyncContents) SynchronizeFolderUseCase.SyncFolderMode.SYNC_CONTENTS else SynchronizeFolderUseCase.SyncFolderMode.REFRESH_FOLDER
syncMode = if (fileOperation.shouldSyncContents) SynchronizeFolderUseCase.SyncFolderMode.SYNC_CONTENTS
else SynchronizeFolderUseCase.SyncFolderMode.REFRESH_FOLDER
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ class SettingsVideoUploadsFragment : PreferenceFragmentCompat() {
prefVideoUploadsSourcePath = findPreference(PREF__CAMERA_VIDEO_UPLOADS_SOURCE)
prefVideoUploadsLastSync = findPreference(PreferenceManager.PREF__CAMERA_VIDEO_UPLOADS_LAST_SYNC)
prefVideoUploadsBehaviour = findPreference<ListPreference>(PREF__CAMERA_VIDEO_UPLOADS_BEHAVIOUR)?.apply {
entries = listOf(getString(R.string.pref_behaviour_entries_keep_file), getString(R.string.pref_behaviour_entries_remove_original_file)).toTypedArray()
entries = listOf(getString(R.string.pref_behaviour_entries_keep_file),
getString(R.string.pref_behaviour_entries_remove_original_file)).toTypedArray()
entryValues = listOf(UploadBehavior.COPY.name, UploadBehavior.MOVE.name).toTypedArray()
}
prefVideoUploadsAccount = findPreference<ListPreference>(PREF__CAMERA_VIDEO_UPLOADS_ACCOUNT_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ class SettingsSecurityFragment : PreferenceFragmentCompat() {
if (!BiometricManager.isHardwareDetected()) { // Biometric not supported
screenSecurity?.removePreferenceFromScreen(prefBiometric)
} else {
if (prefPasscode?.isChecked == false && prefPattern?.isChecked == false) { // Disable biometric lock if Passcode or Pattern locks are disabled
// Disable biometric lock if Passcode or Pattern locks are disabled
if (prefPasscode?.isChecked == false && prefPattern?.isChecked == false) {
disableBiometric()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import java.security.SecureRandom
private val charsetLowercase = ('a'..'z').toList()
private val charsetUppercase = ('A'..'Z').toList()
private val charsetDigits = ('0'..'9').toList()
private val charsetSpecial = listOf('!', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~')
private val charsetSpecial = listOf('!', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@',
'[', '\\', ']', '^', '_', '`', '{', '|', '}', '~')

fun generatePassword(
minChars: Int?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import com.owncloud.android.domain.sharing.shares.model.OCShare
* contained in that activity.
*
*
* See the Android Training lesson [Communicating with Other Fragments](http://developer.android.com/training/basics/fragments/communicating.html) for more information.
* See the Android docs [Communicating with fragments](https://developer.android.com/guide/fragments/communicate) for more information.
*/
interface ShareFragmentListener {
fun copyOrSendPrivateLink(file: OCFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ class PublicShareDialogFragment : DialogFragment() {
val x = event.x.toInt()
val y = event.y.toInt()
val bounds = rightDrawable.bounds
if (x >= view.right - bounds.width() - fuzz && x <= view.right - view.paddingRight + fuzz && y >= view.paddingTop - fuzz && y <= view.height - view.paddingBottom + fuzz) {
if (x >= view.right - bounds.width() - fuzz && x <= view.right - view.paddingRight + fuzz && y >= view.paddingTop - fuzz &&
y <= view.height - view.paddingBottom + fuzz) {

return onDrawableTouch(event)
}
Expand Down Expand Up @@ -836,7 +837,9 @@ class PublicShareDialogFragment : DialogFragment() {
// - Upload only is supported by the server version
// - Upload only capability is set
// - Allow editing capability is set
if (!(isSharedFolder && serverVersion?.isPublicSharingWriteOnlySupported == true && capabilities?.filesSharingPublicSupportsUploadOnly == CapabilityBooleanType.TRUE && capabilities?.filesSharingPublicUpload == CapabilityBooleanType.TRUE)) {
if (!(isSharedFolder && serverVersion?.isPublicSharingWriteOnlySupported == true &&
capabilities?.filesSharingPublicSupportsUploadOnly == CapabilityBooleanType.TRUE &&
capabilities?.filesSharingPublicUpload == CapabilityBooleanType.TRUE)) {
binding.shareViaLinkEditPermissionGroup.isVisible = false
}

Expand Down Expand Up @@ -867,7 +870,12 @@ class PublicShareDialogFragment : DialogFragment() {
}

// Set password label when opening the dialog
if (binding.shareViaLinkEditPermissionReadOnly.isChecked && capabilities?.filesSharingPublicPasswordEnforcedReadOnly == CapabilityBooleanType.TRUE || binding.shareViaLinkEditPermissionReadAndWrite.isChecked && capabilities?.filesSharingPublicPasswordEnforcedReadWrite == CapabilityBooleanType.TRUE || binding.shareViaLinkEditPermissionUploadFiles.isChecked && capabilities?.filesSharingPublicPasswordEnforcedUploadOnly == CapabilityBooleanType.TRUE) {
if (binding.shareViaLinkEditPermissionReadOnly.isChecked &&
capabilities?.filesSharingPublicPasswordEnforcedReadOnly == CapabilityBooleanType.TRUE ||
binding.shareViaLinkEditPermissionReadAndWrite.isChecked &&
capabilities?.filesSharingPublicPasswordEnforcedReadWrite == CapabilityBooleanType.TRUE ||
binding.shareViaLinkEditPermissionUploadFiles.isChecked &&
capabilities?.filesSharingPublicPasswordEnforcedUploadOnly == CapabilityBooleanType.TRUE) {
setPasswordEnforced()
}

Expand Down Expand Up @@ -898,7 +906,9 @@ class PublicShareDialogFragment : DialogFragment() {

// When there's no password enforced for capability
val hasPasswordEnforcedFor =
capabilities?.filesSharingPublicPasswordEnforcedReadOnly == CapabilityBooleanType.TRUE || capabilities?.filesSharingPublicPasswordEnforcedReadWrite == CapabilityBooleanType.TRUE || capabilities?.filesSharingPublicPasswordEnforcedUploadOnly == CapabilityBooleanType.TRUE
capabilities?.filesSharingPublicPasswordEnforcedReadOnly == CapabilityBooleanType.TRUE ||
capabilities?.filesSharingPublicPasswordEnforcedReadWrite == CapabilityBooleanType.TRUE ||
capabilities?.filesSharingPublicPasswordEnforcedUploadOnly == CapabilityBooleanType.TRUE

// hide password switch if password is enforced to prevent it is removed
if (!hasPasswordEnforcedFor && capabilities?.filesSharingPublicPasswordEnforced == CapabilityBooleanType.TRUE) {
Expand Down
Loading

0 comments on commit 54ef180

Please sign in to comment.