Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-09-23 08:14:22 +02:00
parent 98c963cb10
commit c95615aeaa
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
5 changed files with 12 additions and 77 deletions

View file

@ -34,10 +34,6 @@ import com.owncloud.android.operations.common.SyncOperation;
*/
public class UpdateShareViaLinkOperation extends SyncOperation {
private String password;
/**
* Enable upload permissions to update in Share resource.
*/
private boolean publicUpload;
private Boolean hideFileDownload;
private long expirationDateInMillis;
private long shareId;
@ -81,10 +77,6 @@ public class UpdateShareViaLinkOperation extends SyncOperation {
this.password = password;
}
public void setPublicUpload(boolean publicUpload) {
this.publicUpload = publicUpload;
}
public void setHideFileDownload(Boolean hideFileDownload) {
this.hideFileDownload = hideFileDownload;
}

View file

@ -89,12 +89,10 @@ public class OperationsService extends Service {
public static final String EXTRA_ACCOUNT = "ACCOUNT";
public static final String EXTRA_SERVER_URL = "SERVER_URL";
public static final String EXTRA_OAUTH2_QUERY_PARAMETERS = "OAUTH2_QUERY_PARAMETERS";
public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH";
public static final String EXTRA_NEWNAME = "NEWNAME";
public static final String EXTRA_REMOVE_ONLY_LOCAL = "REMOVE_LOCAL_COPY";
public static final String EXTRA_SYNC_FILE_CONTENTS = "SYNC_FILE_CONTENTS";
public static final String EXTRA_RESULT = "RESULT";
public static final String EXTRA_NEW_PARENT_PATH = "NEW_PARENT_PATH";
public static final String EXTRA_FILE = "FILE";
public static final String EXTRA_FILE_VERSION = "FILE_VERSION";
@ -103,7 +101,6 @@ public class OperationsService extends Service {
public static final String EXTRA_SHARE_WITH = "SHARE_WITH";
public static final String EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS = "SHARE_EXPIRATION_YEAR";
public static final String EXTRA_SHARE_PERMISSIONS = "SHARE_PERMISSIONS";
public static final String EXTRA_SHARE_PUBLIC_UPLOAD = "SHARE_PUBLIC_UPLOAD";
public static final String EXTRA_SHARE_PUBLIC_LABEL = "SHARE_PUBLIC_LABEL";
public static final String EXTRA_SHARE_HIDE_FILE_DOWNLOAD = "HIDE_FILE_DOWNLOAD";
public static final String EXTRA_SHARE_ID = "SHARE_ID";
@ -384,9 +381,7 @@ public class OperationsService extends Service {
* Created with the Looper of a new thread, started in {@link OperationsService#onCreate()}.
*/
private static class ServiceHandler extends Handler {
// don't make it a final class, and don't remove the static ; lint will warn about a p
// ossible memory leak
// don't make it a final class, and don't remove the static ; lint will warn about a possible memory leak
OperationsService mService;
@ -428,7 +423,7 @@ public class OperationsService extends Service {
if (next != null) {
mCurrentOperation = next.second;
RemoteOperationResult result = null;
RemoteOperationResult result;
try {
/// prepare client object to send the request to the ownCloud server
if (mLastTarget == null || !mLastTarget.equals(next.first)) {
@ -553,9 +548,9 @@ public class OperationsService extends Service {
false);
updateLinkOperation.setHideFileDownload(hideFileDownload);
if (operationIntent.hasExtra(EXTRA_SHARE_PUBLIC_UPLOAD)) {
updateLinkOperation.setPublicUpload(true);
}
// if (operationIntent.hasExtra(EXTRA_SHARE_PUBLIC_UPLOAD)) {
// updateLinkOperation.setPublicUpload(true);
// }
if (operationIntent.hasExtra(EXTRA_SHARE_PUBLIC_LABEL)) {
updateLinkOperation.setLabel(operationIntent.getStringExtra(EXTRA_SHARE_PUBLIC_LABEL));
@ -698,7 +693,7 @@ public class OperationsService extends Service {
}
if (operation != null) {
return new Pair<Target, RemoteOperation>(target, operation);
return new Pair<>(target, operation);
} else {
return null;
}

View file

@ -171,7 +171,7 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
/**
* sort all by creation time, then email/link shares on top
*/
protected void sortShares() {
protected final void sortShares() {
List<OCShare> links = new ArrayList<>();
List<OCShare> users = new ArrayList<>();

View file

@ -716,7 +716,7 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
/**
* Load upload items from {@link UploadsStorageManager}.
*/
public void loadUploadItemsFromDb() {
public final void loadUploadItemsFromDb() {
Log_OC.d(TAG, "loadUploadItemsFromDb");
for (UploadGroup group : uploadGroups) {

View file

@ -578,23 +578,6 @@ public class FileOperationsHelper {
fileActivity.startActivity(intent);
}
/**
* Updates a public share on a file to set its password. Starts a request to do it in {@link OperationsService}
*
* @param password Password to set for the public link; null or empty string to clear the current password
*/
public void setPasswordToPublicShare(OCShare share, String password) {
// Set password updating share
Intent updateShareIntent = new Intent(fileActivity, OperationsService.class);
updateShareIntent.setAction(OperationsService.ACTION_UPDATE_PUBLIC_SHARE);
updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, fileActivity.getAccount());
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_ID, share.getId());
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PASSWORD, (password == null) ? "" : password);
queueShareIntent(updateShareIntent);
}
/**
* Updates a public share on a file to set its label. Starts a request to do it in {@link OperationsService}
*
@ -633,23 +616,6 @@ public class FileOperationsHelper {
}
/**
* Updates a public share on a file to set its expiration date. Starts a request to do it in {@link
* OperationsService}
*
* @param share {@link OCShare} instance which permissions will be updated.
* @param expirationTimeInMillis Expiration date to set. A negative value clears the current expiration date,
* leaving the link unrestricted. Zero makes no change.
*/
public void setExpirationDateToPublicShare(OCShare share, long expirationTimeInMillis) {
Intent updateShareIntent = new Intent(fileActivity, OperationsService.class);
updateShareIntent.setAction(OperationsService.ACTION_UPDATE_PUBLIC_SHARE);
updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, fileActivity.getAccount());
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_ID, share.getId());
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS, expirationTimeInMillis);
queueShareIntent(updateShareIntent);
}
/**
* Updates a public share on a file to set its expiration date.
* Starts a request to do it in {@link OperationsService}
@ -693,31 +659,13 @@ public class FileOperationsHelper {
*/
public void setUploadPermissionsToPublicShare(OCShare share, boolean uploadPermission) {
Intent updateShareIntent = new Intent(fileActivity, OperationsService.class);
updateShareIntent.setAction(OperationsService.ACTION_UPDATE_PUBLIC_SHARE);
updateShareIntent.setAction(OperationsService.ACTION_UPDATE_USER_SHARE);
updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, fileActivity.getAccount());
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_ID, share.getId());
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PUBLIC_UPLOAD, uploadPermission);
queueShareIntent(updateShareIntent);
}
/**
* Updates a public share on a folder to set its hide file listing permission.
* Starts a request to do it in {@link OperationsService}
*
* @param share {@link OCShare} instance which permissions will be updated.
* @param hideFileListing New state of the permission for editing the folder shared via link.
*/
public void setHideFileListingPermissionsToPublicShare(OCShare share, boolean hideFileListing) {
Intent updateShareIntent = new Intent(fileActivity, OperationsService.class);
updateShareIntent.setAction(OperationsService.ACTION_UPDATE_PUBLIC_SHARE);
updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, fileActivity.getAccount());
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_ID, share.getId());
if (hideFileListing) {
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS, OCShare.CREATE_PERMISSION_FLAG);
if (uploadPermission) {
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS, 3);
} else {
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS,
OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER);
updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS, 1);
}
queueShareIntent(updateShareIntent);