Skip to content

Commit 6c204cd

Browse files
committed
solve git conflict
Signed-off-by: alperozturk <[email protected]>
2 parents 4d9bce1 + e9ed5a3 commit 6c204cd

37 files changed

+569
-198
lines changed

.github/workflows/screenShotTest.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ jobs:
2828
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2929

3030
- name: Gradle cache
31-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
31+
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
3232
with:
3333
path: |
3434
~/.gradle/caches
3535
~/.gradle/wrapper
3636
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
3737
- name: AVD cache
38-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
38+
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
3939
id: avd-cache
4040
with:
4141
path: |

app/src/androidTest/java/com/owncloud/android/ui/activity/ConflictsResolveActivityIT.java

+6
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ public class ConflictsResolveActivityIT extends AbstractIT {
4545
@ScreenshotTest
4646
public void screenshotTextFiles() {
4747
OCFile newFile = new OCFile("/newFile.txt");
48+
newFile.setRemoteId("0001");
4849
newFile.setFileLength(56000);
4950
newFile.setModificationTimestamp(1522019340);
5051
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
5152

5253
OCFile existingFile = new OCFile("/newFile.txt");
54+
existingFile.setRemoteId("0002");
5355
existingFile.setFileLength(1024000);
5456
existingFile.setModificationTimestamp(1582019340);
5557

@@ -185,11 +187,13 @@ public void keepExisting() {
185187
user.getAccountName());
186188

187189
OCFile existingFile = new OCFile("/newFile.txt");
190+
existingFile.setRemoteId("0001");
188191
existingFile.setFileLength(1024000);
189192
existingFile.setModificationTimestamp(1582019340);
190193

191194
OCFile newFile = new OCFile("/newFile.txt");
192195
newFile.setFileLength(56000);
196+
newFile.setRemoteId("0002");
193197
newFile.setModificationTimestamp(1522019340);
194198
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
195199

@@ -276,11 +280,13 @@ public void keepBoth() {
276280
user.getAccountName());
277281

278282
OCFile existingFile = new OCFile("/newFile.txt");
283+
existingFile.setRemoteId("0001");
279284
existingFile.setFileLength(1024000);
280285
existingFile.setModificationTimestamp(1582019340);
281286

282287
OCFile newFile = new OCFile("/newFile.txt");
283288
newFile.setFileLength(56000);
289+
newFile.setRemoteId("0002");
284290
newFile.setModificationTimestamp(1522019340);
285291
newFile.setStoragePath(FileStorageUtils.getSavePath(user.getAccountName()) + "/nonEmpty.txt");
286292

app/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java

+1
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ public void testFileActionsBottomSheet() {
587587
}
588588

589589
OCFile ocFile = new OCFile("/test.md");
590+
ocFile.setRemoteId("0001");
590591
final FileActionsBottomSheet sut = FileActionsBottomSheet.newInstance(ocFile, false);
591592
showDialog(sut);
592593
}

app/src/androidTest/java/com/owncloud/android/ui/fragment/FileDetailSharingFragmentIT.kt

+1
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
617617
sut.refreshCapabilitiesFromDB()
618618

619619
val userShare = OCShare().apply {
620+
remoteId = 1001L
620621
isFolder = false
621622
shareType = ShareType.USER
622623
permissions = 17

app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadWorker.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import com.nextcloud.client.preferences.AppPreferences
2323
import com.nextcloud.model.WorkerState
2424
import com.nextcloud.model.WorkerStateLiveData
2525
import com.nextcloud.utils.extensions.getPercent
26-
import com.nextcloud.utils.extensions.showToast
27-
import com.owncloud.android.R
2826
import com.owncloud.android.datamodel.FileDataStorageManager
2927
import com.owncloud.android.datamodel.ThumbnailsCacheManager
3028
import com.owncloud.android.datamodel.UploadsStorageManager
@@ -315,7 +313,7 @@ class FileUploadWorker(
315313
context
316314
)
317315
) {
318-
context.showToast(R.string.file_upload_worker_same_file_already_exists)
316+
uploadFileOperation.handleLocalBehaviour()
319317
return
320318
}
321319

app/src/main/java/com/nextcloud/client/preferences/AppPreferences.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,6 @@ default void onDarkThemeModeChanged(DarkMode mode) {
167167
*/
168168
String[] getPassCode();
169169

170-
/**
171-
* Gets the unlock via fingerprint preference configured by the user.
172-
*
173-
* @implNote this is always false
174-
* @return useFingerprint is unlock with fingerprint enabled
175-
*/
176-
boolean isFingerprintUnlockEnabled();
177-
178170
/**
179171
* Gets the auto upload paths flag last set.
180172
*
@@ -210,7 +202,7 @@ default void onDarkThemeModeChanged(DarkMode mode) {
210202
* Get preferred folder sort order.
211203
*
212204
* @param folder Folder whoch order is being retrieved or null for root folder
213-
* @return sort order the sort order, default is {@link FileSortOrder#sort_a_to_z} (sort by name)
205+
* @return sort order the sort order, default is {@link FileSortOrder# sort_a_to_z} (sort by name)
214206
*/
215207
FileSortOrder getSortOrderByFolder(@Nullable OCFile folder);
216208

@@ -232,7 +224,7 @@ default void onDarkThemeModeChanged(DarkMode mode) {
232224
/**
233225
* Get preferred folder sort order.
234226
*
235-
* @return sort order the sort order, default is {@link FileSortOrder#sort_a_to_z} (sort by name)
227+
* @return sort order the sort order, default is {@link FileSortOrder# sort_a_to_z} (sort by name)
236228
*/
237229
FileSortOrder getSortOrderByType(FileSortOrder.Type type, FileSortOrder defaultOrder);
238230
FileSortOrder getSortOrderByType(FileSortOrder.Type type);

app/src/main/java/com/nextcloud/client/preferences/AppPreferencesImpl.java

-5
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,6 @@ public String[] getPassCode() {
312312
};
313313
}
314314

315-
@Override
316-
public boolean isFingerprintUnlockEnabled() {
317-
return preferences.getBoolean(SettingsActivity.PREFERENCE_USE_FINGERPRINT, false);
318-
}
319-
320315
@Override
321316
public String getFolderLayout(OCFile folder) {
322317
return getFolderPreference(context,

app/src/main/java/com/owncloud/android/authentication/PassCodeManager.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class PassCodeManager(private val preferences: AppPreferences, private val clock
133133
}
134134

135135
private fun deviceCredentialsAreEnabled(activity: Activity): Boolean {
136-
return SettingsActivity.LOCK_DEVICE_CREDENTIALS == preferences.lockPreference ||
137-
(preferences.isFingerprintUnlockEnabled && DeviceCredentialUtils.areCredentialsAvailable(activity))
136+
return (preferences.lockPreference == SettingsActivity.LOCK_DEVICE_CREDENTIALS) &&
137+
DeviceCredentialUtils.areCredentialsAvailable(activity)
138138
}
139139

140140
private fun getActivityRootView(activity: Activity): View? {

app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java

+27-6
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ private void updateMetadataForV2(DecryptedFolderMetadataFile metadata, Encryptio
845845

846846
private void completeE2EUpload(RemoteOperationResult result, E2EFiles e2eFiles, OwnCloudClient client) {
847847
if (result.isSuccess()) {
848-
handleSuccessfulUpload(e2eFiles.getTemporalFile(), e2eFiles.getExpectedFile(), e2eFiles.getOriginalFile(), client);
848+
handleLocalBehaviour(e2eFiles.getTemporalFile(), e2eFiles.getExpectedFile(), e2eFiles.getOriginalFile(), client);
849849
} else if (result.getCode() == ResultCode.SYNC_CONFLICT) {
850850
getStorageManager().saveConflict(mFile, mFile.getEtagInConflict());
851851
}
@@ -1098,7 +1098,7 @@ private RemoteOperationResult normalUpload(OwnCloudClient client) {
10981098
}
10991099

11001100
if (result.isSuccess()) {
1101-
handleSuccessfulUpload(temporalFile, expectedFile, originalFile, client);
1101+
handleLocalBehaviour(temporalFile, expectedFile, originalFile, client);
11021102
} else if (result.getCode() == ResultCode.SYNC_CONFLICT) {
11031103
getStorageManager().saveConflict(mFile, mFile.getEtagInConflict());
11041104
}
@@ -1197,10 +1197,31 @@ private RemoteOperationResult checkNameCollision(OCFile parentFile,
11971197
return null;
11981198
}
11991199

1200-
private void handleSuccessfulUpload(File temporalFile,
1201-
File expectedFile,
1202-
File originalFile,
1203-
OwnCloudClient client) {
1200+
public void handleLocalBehaviour() {
1201+
if (user == null || mFile == null || mContext == null) {
1202+
Log_OC.d(TAG, "handleLocalBehaviour: user, file, or context is null.");
1203+
return;
1204+
}
1205+
1206+
final var client = getClient();
1207+
if (client == null) {
1208+
Log_OC.d(TAG, "handleLocalBehaviour: client is null");
1209+
return;
1210+
}
1211+
1212+
String expectedPath = FileStorageUtils.getDefaultSavePathFor(user.getAccountName(), mFile);
1213+
File expectedFile = new File(expectedPath);
1214+
File originalFile = new File(mOriginalStoragePath);
1215+
String temporalPath = FileStorageUtils.getInternalTemporalPath(user.getAccountName(), mContext) + mFile.getRemotePath();
1216+
File temporalFile = new File(temporalPath);
1217+
1218+
handleLocalBehaviour(temporalFile, expectedFile, originalFile, client);
1219+
}
1220+
1221+
private void handleLocalBehaviour(File temporalFile,
1222+
File expectedFile,
1223+
File originalFile,
1224+
OwnCloudClient client) {
12041225
switch (mLocalBehaviour) {
12051226
case FileUploadWorker.LOCAL_BEHAVIOUR_FORGET:
12061227
default:

app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ public class SettingsActivity extends PreferenceActivity
109109
public static final String LOCK_DEVICE_CREDENTIALS = "device_credentials";
110110

111111

112-
public final static String PREFERENCE_USE_FINGERPRINT = "use_fingerprint";
113112
public static final String PREFERENCE_SHOW_MEDIA_SCAN_NOTIFICATIONS = "show_media_scan_notifications";
114113

115114
private static final int ACTION_REQUEST_PASSCODE = 5;

app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java

+1-46
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import android.content.ContentValues;
1818
import android.content.res.ColorStateList;
1919
import android.content.res.Resources;
20-
import android.graphics.Bitmap;
2120
import android.graphics.Color;
2221
import android.graphics.drawable.Drawable;
2322
import android.os.Handler;
@@ -74,7 +73,6 @@
7473
import com.owncloud.android.ui.fragment.SearchType;
7574
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface;
7675
import com.owncloud.android.ui.preview.PreviewTextFragment;
77-
import com.owncloud.android.utils.BitmapUtils;
7876
import com.owncloud.android.utils.DisplayUtils;
7977
import com.owncloud.android.utils.FileSortOrder;
8078
import com.owncloud.android.utils.FileStorageUtils;
@@ -91,8 +89,7 @@
9189
import java.util.Locale;
9290
import java.util.Set;
9391
import java.util.UUID;
94-
import java.util.concurrent.ExecutorService;
95-
import java.util.concurrent.Executors;
92+
import java.util.stream.Collectors;
9693

9794
import androidx.annotation.NonNull;
9895
import androidx.annotation.Nullable;
@@ -524,8 +521,6 @@ private void bindListGridItemViewHolder(ListGridItemViewHolder holder, OCFile fi
524521
holder.getFileName().setVisibility(View.VISIBLE);
525522
}
526523
}
527-
528-
configureThumbnail(holder, file);
529524
}
530525

531526
private void bindListItemViewHolder(ListItemViewHolder holder, OCFile file) {
@@ -633,8 +628,6 @@ private void bindListItemViewHolder(ListItemViewHolder holder, OCFile file) {
633628
} else {
634629
holder.getOverflowMenu().setImageResource(R.drawable.ic_dots_vertical);
635630
}
636-
637-
configureThumbnail(holder, file);
638631
}
639632

640633
private void applyChipVisuals(Chip chip, Tag tag) {
@@ -674,44 +667,6 @@ private String getFileSizeText(OCFile file, long size) {
674667
return activity.getString(R.string.oc_file_list_adapter_offline_operation_description_text);
675668
}
676669

677-
private final ExecutorService executorService = Executors.newCachedThreadPool();
678-
679-
private void configureThumbnail(ListViewHolder holder, OCFile file) {
680-
final var context = MainApp.getAppContext();
681-
682-
if (file.isOfflineOperation()) {
683-
if (file.isFolder()) {
684-
Drawable icon = ContextCompat.getDrawable(context, R.drawable.ic_folder_offline);
685-
holder.getThumbnail().setImageDrawable(icon);
686-
} else {
687-
executorService.execute(() -> {
688-
OfflineOperationEntity entity = mStorageManager.offlineOperationDao.getByPath(file.getDecryptedRemotePath());
689-
690-
if (entity != null && entity.getType() != null && entity.getType() instanceof OfflineOperationType.CreateFile createFileOperation) {
691-
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(createFileOperation.getLocalPath(), holder.getThumbnail().getWidth(), holder.getThumbnail().getHeight());
692-
if (bitmap == null) return;
693-
694-
Bitmap thumbnail = BitmapUtils.addColorFilter(bitmap, Color.GRAY,100);
695-
activity.runOnUiThread(() -> holder.getThumbnail().setImageBitmap(thumbnail));
696-
}
697-
});
698-
}
699-
} else {
700-
boolean isAutoUpload = SyncedFolderProvider.isAutoUploadFolder(syncedFolderProvider, file, user);
701-
boolean isDarkModeActive = preferences.isDarkModeEnabled();
702-
Drawable icon = MimeTypeUtil.getOCFileIcon(file, context, viewThemeUtils, isAutoUpload, isDarkModeActive);
703-
holder.getThumbnail().setImageDrawable(icon);
704-
705-
if (!file.isFolder()) {
706-
ViewExtensionsKt.makeRounded(holder.getThumbnail(), context, 4);
707-
}
708-
}
709-
}
710-
711-
public void onDestroy() {
712-
executorService.shutdown();
713-
}
714-
715670
@Override
716671
public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) {
717672
if (holder instanceof ListViewHolder) {

app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt

+5
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class OCFileListDelegate(
211211
)
212212
}
213213

214+
@Suppress("MagicNumber")
214215
fun bindGridViewHolder(
215216
gridViewHolder: ListViewHolder,
216217
file: OCFile,
@@ -256,6 +257,10 @@ class OCFileListDelegate(
256257
} else {
257258
configureSharedIconView(gridViewHolder, file)
258259
}
260+
261+
if (!file.isOfflineOperation && !file.isFolder) {
262+
gridViewHolder.thumbnail.makeRounded(context, 4f)
263+
}
259264
}
260265

261266
private fun bindUnreadComments(file: OCFile, gridViewHolder: ListViewHolder) {

0 commit comments

Comments
 (0)