From cc105e3b5e7939d309f72a79ea36c84f5f951de3 Mon Sep 17 00:00:00 2001 From: Flavia Handrea Date: Thu, 21 Mar 2024 19:16:10 +0200 Subject: [PATCH 1/2] Fixed bugs: archive photo could not be changed and the more options button from file selection screen should not have been visible. --- .../java/org/permanent/permanent/network/NetworkClient.kt | 5 +++-- .../org/permanent/permanent/network/RequestContainer.kt | 8 +++++++- .../permanent/repositories/ArchiveRepositoryImpl.kt | 1 + .../org/permanent/permanent/ui/myFiles/MyFilesFragment.kt | 3 ++- app/src/main/res/layout/fragment_my_files.xml | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/permanent/permanent/network/NetworkClient.kt b/app/src/main/java/org/permanent/permanent/network/NetworkClient.kt index 9e3a047c..10d75992 100644 --- a/app/src/main/java/org/permanent/permanent/network/NetworkClient.kt +++ b/app/src/main/java/org/permanent/permanent/network/NetworkClient.kt @@ -533,9 +533,10 @@ class NetworkClient(private var okHttpClient: OkHttpClient?, context: Context) { } fun updateProfilePhoto( - archiveNr: String?, archiveId: Int, thumbArchiveNr: String? + archiveNr: String?, archiveId: Int, archiveType: ArchiveType, thumbArchiveNr: String? ): Call { - val request = toJson(RequestContainer().addArchive(archiveNr, archiveId, thumbArchiveNr)) + val request = + toJson(RequestContainer().addArchive(archiveNr, archiveId, archiveType, thumbArchiveNr)) val requestBody: RequestBody = request.toRequestBody(jsonMediaType) return archiveService.updateProfilePhoto(requestBody) } diff --git a/app/src/main/java/org/permanent/permanent/network/RequestContainer.kt b/app/src/main/java/org/permanent/permanent/network/RequestContainer.kt index 575c29cd..ca2bc80d 100644 --- a/app/src/main/java/org/permanent/permanent/network/RequestContainer.kt +++ b/app/src/main/java/org/permanent/permanent/network/RequestContainer.kt @@ -396,10 +396,16 @@ class RequestContainer { return this } - fun addArchive(archiveNr: String?, archiveId: Int, thumbArchiveNr: String?): RequestContainer { + fun addArchive( + archiveNr: String?, + archiveId: Int, + type: ArchiveType, + thumbArchiveNr: String? + ): RequestContainer { val archiveVO = ArchiveVO() archiveVO.archiveId = archiveId archiveVO.archiveNbr = archiveNr + archiveVO.type = type.backendString archiveVO.thumbArchiveNbr = thumbArchiveNr RequestVO.data?.get(0)?.ArchiveVO = archiveVO return this diff --git a/app/src/main/java/org/permanent/permanent/repositories/ArchiveRepositoryImpl.kt b/app/src/main/java/org/permanent/permanent/repositories/ArchiveRepositoryImpl.kt index 3370a63a..7d58a415 100644 --- a/app/src/main/java/org/permanent/permanent/repositories/ArchiveRepositoryImpl.kt +++ b/app/src/main/java/org/permanent/permanent/repositories/ArchiveRepositoryImpl.kt @@ -61,6 +61,7 @@ class ArchiveRepositoryImpl(val context: Context) : IArchiveRepository { NetworkClient.instance().updateProfilePhoto( prefsHelper.getCurrentArchiveNr(), prefsHelper.getCurrentArchiveId(), + prefsHelper.getCurrentArchiveType(), thumbRecord.archiveNr ) .enqueue(object : Callback { diff --git a/app/src/main/java/org/permanent/permanent/ui/myFiles/MyFilesFragment.kt b/app/src/main/java/org/permanent/permanent/ui/myFiles/MyFilesFragment.kt index 053310ff..909796f2 100644 --- a/app/src/main/java/org/permanent/permanent/ui/myFiles/MyFilesFragment.kt +++ b/app/src/main/java/org/permanent/permanent/ui/myFiles/MyFilesFragment.kt @@ -128,13 +128,14 @@ class MyFilesFragment : PermanentBaseFragment() { viewModel.initSwipeRefreshLayout(binding.swipeRefreshLayout) viewModel.loadRootFiles() initDownloadsRecyclerView(binding.rvDownloads) - initFilesRecyclerView(binding.rvFiles, showScreenSimplified) viewModel.registerDeviceForFCM() arguments?.takeIf { it.containsKey(SHOW_SCREEN_SIMPLIFIED_KEY) }?.apply { showScreenSimplified = getBoolean(SHOW_SCREEN_SIMPLIFIED_KEY) if (showScreenSimplified) viewModel.setShowScreenSimplified() } + initFilesRecyclerView(binding.rvFiles, showScreenSimplified) + arguments?.getParcelableArrayList(MainActivity.SAVE_TO_PERMANENT_FILE_URIS_KEY) ?.let { showSaveToPermanentFragment(it) } if (viewModel.isRelocationMode.value == true) resizeIslandWidthAnimated( diff --git a/app/src/main/res/layout/fragment_my_files.xml b/app/src/main/res/layout/fragment_my_files.xml index 8a9d34c7..42df9aff 100644 --- a/app/src/main/res/layout/fragment_my_files.xml +++ b/app/src/main/res/layout/fragment_my_files.xml @@ -149,7 +149,7 @@ app:layout_constraintBottom_toBottomOf="@+id/clFolderOptions" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/clFolderOptions" - android:visibility="@{viewModel.existsFiles == false ? View.GONE : View.VISIBLE}" + android:visibility="@{viewModel.existsFiles == false || viewModel.showScreenSimplified ? View.GONE : View.VISIBLE}" app:viewModeIcon="@{viewModel.isListViewMode}" /> Date: Thu, 21 Mar 2024 19:24:37 +0200 Subject: [PATCH 2/2] Updated version. --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a82c48a7..8b1a1833 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "org.permanent.PermanentArchive" minSdkVersion 26 targetSdkVersion 34 - versionCode 66 - versionName "1.9.0" + versionCode 67 + versionName "1.9.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" }