Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class GrantStoragePermissionRule private constructor() {
Build.VERSION.SDK_INT < Build.VERSION_CODES.R -> GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE
)

else -> GrantManageExternalStoragePermissionRule()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ abstract class FileUploaderIT : AbstractOnServerIT() {
uploadsStorageManager = UploadsStorageManager(accountManager, contentResolver)
}

/**
* uploads a file, overwrites it with an empty one, check if overwritten
*/
// /**
// * uploads a file, overwrites it with an empty one, check if overwritten
// */
// disabled, flaky test
// @Test
// fun testKeepLocalAndOverwriteRemote() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TrashbinLocalRepository(private val testCase: TrashbinActivityIT.TestCase)
override fun getFolder(remotePath: String?, callback: LoadFolderCallback?) {
when (testCase) {
TrashbinActivityIT.TestCase.ERROR -> callback?.onError(R.string.trashbin_loading_failed)

TrashbinActivityIT.TestCase.FILES -> {
val files = ArrayList<TrashbinFile>()
files.add(
Expand Down Expand Up @@ -69,6 +70,7 @@ class TrashbinLocalRepository(private val testCase: TrashbinActivityIT.TestCase)

callback?.onSuccess(files)
}

TrashbinActivityIT.TestCase.EMPTY -> callback?.onSuccess(ArrayList<TrashbinFile>())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,15 @@ class AssistantViewModel(

when {
selectedTaskType == null -> AssistantScreenState.Loading

isTranslation -> AssistantScreenState.Translation(selectedTask)

isChat && chats.isEmpty() -> AssistantScreenState.emptyChatList()

isChat -> AssistantScreenState.ChatContent

!isChat && (tasks == null || tasks.isEmpty()) -> AssistantScreenState.emptyTaskList()

else -> {
if (!_isTranslationTask.value) {
AssistantScreenState.TaskContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package com.nextcloud.client.assistant.extensions

import android.content.Context
import androidx.compose.ui.res.stringResource
import com.nextcloud.utils.date.DateFormatPattern
import com.nextcloud.utils.date.DateFormatter
import com.owncloud.android.R
Expand Down Expand Up @@ -58,18 +57,23 @@ private fun Task.getStatusIconV1(): Int = when (status) {
"0" -> {
R.drawable.ic_unknown
}

"1" -> {
R.drawable.ic_clock
}

"2" -> {
R.drawable.ic_modification_desc
}

"3" -> {
R.drawable.ic_check_circle_outline
}

"4" -> {
R.drawable.image_fail
}

else -> {
R.drawable.ic_unknown
}
Expand All @@ -79,18 +83,23 @@ private fun Task.getStatusIconDescriptionV1(): Int = when (status) {
"0" -> {
R.string.assistant_task_status_unknown
}

"1" -> {
R.string.assistant_task_status_scheduled
}

"2" -> {
R.string.assistant_task_status_running
}

"3" -> {
R.string.assistant_task_status_successful
}

"4" -> {
R.string.assistant_task_status_failed
}

else -> {
R.string.assistant_task_status_unknown
}
Expand All @@ -100,18 +109,23 @@ private fun Task.getStatusIconV2(): Int = when (status) {
"STATUS_UNKNOWN" -> {
R.drawable.ic_unknown
}

"STATUS_SCHEDULED" -> {
R.drawable.ic_clock
}

"STATUS_RUNNING" -> {
R.drawable.ic_modification_desc
}

"STATUS_SUCCESSFUL" -> {
R.drawable.ic_check_circle_outline
}

"STATUS_FAILED" -> {
R.drawable.image_fail
}

else -> {
R.drawable.ic_unknown
}
Expand All @@ -121,18 +135,23 @@ private fun Task.getStatusIconDescriptionV2(): Int = when (status) {
"STATUS_UNKNOWN" -> {
R.string.assistant_task_status_unknown
}

"STATUS_SCHEDULED" -> {
R.string.assistant_task_status_scheduled
}

"STATUS_RUNNING" -> {
R.string.assistant_task_status_running
}

"STATUS_SUCCESSFUL" -> {
R.string.assistant_task_status_successful
}

"STATUS_FAILED" -> {
R.string.assistant_task_status_failed
}

else -> {
R.string.assistant_task_status_unknown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ data class EditedTranslation(

fun TranslationScreenState.withShimmer(shimmer: Boolean): TranslationScreenState = when (this) {
is NewTranslation -> copy(shimmer = shimmer)

is ExistingTranslation -> copy(shimmer = shimmer)

is EditedTranslation -> copy(shimmer = shimmer)

Uninitialized -> {
Uninitialized
}
Expand Down Expand Up @@ -162,6 +165,7 @@ fun TranslationScreenState.withTargetText(text: String): TranslationScreenState

fun TranslationScreenState.withSource(newSource: TranslationSideState): TranslationScreenState = when (this) {
is NewTranslation -> copy(source = newSource)

is ExistingTranslation -> EditedTranslation(
taskTypeData = taskTypeData,
source = newSource,
Expand All @@ -170,6 +174,7 @@ fun TranslationScreenState.withSource(newSource: TranslationSideState): Translat
)

is EditedTranslation -> copy(source = newSource)

Uninitialized -> {
Uninitialized
}
Expand All @@ -188,6 +193,7 @@ fun TranslationScreenState.withTarget(newTarget: TranslationSideState): Translat
)

is EditedTranslation -> copy(target = newTarget)

Uninitialized -> {
Uninitialized
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ class DocumentScanActivity :
viewModel.onClickDone()
true
}

android.R.id.home -> {
onBackPressedDispatcher.onBackPressed()
true
}

else -> false
}
}
Expand All @@ -129,6 +131,7 @@ class DocumentScanActivity :
startPageScan()
}
}

is DocumentScanViewModel.UIState.RequestExportState -> {
updateButtonsEnabled(false)
if (state.shouldRequestExportType) {
Expand All @@ -137,6 +140,7 @@ class DocumentScanActivity :
}
}
}

DocumentScanViewModel.UIState.DoneState, DocumentScanViewModel.UIState.CanceledState -> {
finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class DocumentScanViewModel @Inject constructor(
ExportType.PDF -> {
exportToPdf(state.pageList)
}

ExportType.IMAGES -> {
exportToImages(state.pageList)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class EditImageActivity :
// determine output file format
format = when (file.mimeType) {
MimeType.PNG -> Bitmap.CompressFormat.PNG

MimeType.WEBP -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Bitmap.CompressFormat.WEBP_LOSSY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class ShowErrorActivity : AppCompatActivity() {
onClickedShare()
true
}

else -> super.onOptionsItemSelected(item)
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/nextcloud/client/etm/EtmActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class EtmActivity :
}
true
}

else -> super.onOptionsItemSelected(item)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class EtmAccountsFragment : EtmBaseFragment() {
onClickedShare()
true
}

else -> super.onOptionsItemSelected(item)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ class EtmFileTransferFragment : EtmBaseFragment() {
scheduleTestDownload()
true
}

R.id.etm_test_upload -> {
scheduleTestUpload()
true
}

else -> super.onOptionsItemSelected(item)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class EtmMigrations : EtmBaseFragment() {
onDeleteMigrationsClicked()
true
}

else -> super.onOptionsItemSelected(item)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class EtmPreferencesFragment : EtmBaseFragment() {
onClickedShare()
true
}

else -> super.onOptionsItemSelected(item)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,20 @@ class OfflineSyncWork(
Log_OC.d(TAG, "$folderName: eTag unchanged")
null
}

ResultCode.FILE_NOT_FOUND -> {
val removalResult = storageManager.removeFolder(folder, true, true)
if (!removalResult) {
Log_OC.e(TAG, "removal of " + folder.storagePath + " failed: file not found")
}
null
}

ResultCode.ETAG_CHANGED -> {
Log_OC.d(TAG, "$folderName: eTag changed")
result?.data?.get(0) as? String
}

else -> if (connectivityService.isInternetWalled) {
Log_OC.d(TAG, "No connectivity, skipping sync")
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class AutoUploadHelper {
is AccessDeniedException -> {
Log_OC.w(TAG, "Access denied: $file")
}

else -> {
Log_OC.e(TAG, "Failed to visit file: $file", exc)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,22 @@ class OfflineOperationsWorker(
Log_OC.d(TAG, "📂 Creating folder at ${type.path}")
createFolder(operation, client)
}

is OfflineOperationType.CreateFile -> {
Log_OC.d(TAG, "📤 Uploading file: local=${type.localPath} → remote=${type.remotePath}")
createFile(operation, client)
}

is OfflineOperationType.RenameFile -> {
Log_OC.d(TAG, "✏️ Renaming ${operation.path} → ${type.newName}")
renameFile(operation, client)
}

is OfflineOperationType.RemoveFile -> {
Log_OC.d(TAG, "🗑 Removing file: ${operation.path}")
ocFile?.let { removeFile(it, client) }
}

else -> {
Log_OC.d(TAG, "⚠️ Unsupported operation type: $type")
null
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/nextcloud/client/logger/LogEntry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data class LogEntry(val timestamp: Date, val level: Level, val tag: String, val
*/
private val ENTRY_PARSE_REGEXP = Regex(
pattern =
"""(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z);([ADEIVW]);([^;]+);(.*)"""
"""(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z);([ADEIVW]);([^;]+);(.*)"""
)

@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ internal class LoggerImpl(
event.onResult(entries, loaded.logSize)
}
}

is Delete -> handler.deleteAll()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,17 @@ class LogsViewModel @Inject constructor(
val sizeKb = logsSize / KILOBYTE
return when {
isLoading.value == true -> context.getString(R.string.logs_status_loading)

isFiltered -> context.getString(
R.string.logs_status_filtered,
sizeKb,
displayedEntries,
allEntries.size,
filterDurationMs
)

!isFiltered -> context.getString(R.string.logs_status_not_filtered, sizeKb)

else -> ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ internal class AudioFocusManager(
AudioManager.AUDIOFOCUS_GAIN,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK -> AudioFocus.FOCUS

AudioManager.AUDIOFOCUS_LOSS,
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> AudioFocus.LOST

AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> AudioFocus.DUCK

else -> null
}
focus?.let { onFocusChange(it) }
Expand Down
Loading
Loading