Merge pull request #3923 from nextcloud/editOnShareLink

Allow edit on link share on a file
This commit is contained in:
Andy Scherzinger 2019-04-29 16:19:02 +02:00 committed by GitHub
commit 4c72f3f9a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 21 deletions

View file

@ -43,7 +43,8 @@ public class UpdateShareViaLinkOperation extends SyncOperation {
@Getter private String path;
@Getter @Setter private String password;
/** Enable upload permissions to update in Share resource. */
@Setter private Boolean publicUpload;
@Setter private Boolean publicUploadOnFolder;
@Setter private Boolean publicUploadOnFile;
@Setter private Boolean hideFileDownload;
@Setter private long expirationDateInMillis;
@ -69,7 +70,8 @@ public class UpdateShareViaLinkOperation extends SyncOperation {
UpdateRemoteShareOperation updateOp = new UpdateRemoteShareOperation(publicShare.getRemoteId());
updateOp.setPassword(password);
updateOp.setExpirationDate(expirationDateInMillis);
updateOp.setPublicUpload(publicUpload);
updateOp.setPublicUploadOnFolder(publicUploadOnFolder);
updateOp.setPublicUploadOnFile(publicUploadOnFile);
updateOp.setHideFileDownload(hideFileDownload);
RemoteOperationResult result = updateOp.execute(client);

View file

@ -581,8 +581,13 @@ public class OperationsService extends Service {
updateLinkOperation.setHideFileDownload(hideFileDownload);
if (operationIntent.hasExtra(EXTRA_SHARE_PUBLIC_UPLOAD)) {
updateLinkOperation.setPublicUpload(
if (remotePath.endsWith("/")) {
updateLinkOperation.setPublicUploadOnFolder(
operationIntent.getBooleanExtra(EXTRA_SHARE_PUBLIC_UPLOAD, false));
} else {
updateLinkOperation.setPublicUploadOnFile(
operationIntent.getBooleanExtra(EXTRA_SHARE_PUBLIC_UPLOAD, false));
}
}
operation = updateLinkOperation;
} else if (shareId > 0) {

View file

@ -37,17 +37,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.appcompat.widget.SearchView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import com.google.android.material.snackbar.Snackbar;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
@ -74,6 +64,18 @@ import com.owncloud.android.utils.ThemeUtils;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.appcompat.widget.SearchView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
public class FileDetailSharingFragment extends Fragment implements UserListAdapter.ShareeListAdapterListener,
DisplayUtils.AvatarGenerationListener {
@ -246,11 +248,7 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
private void setLinkDetailVisible(boolean visible) {
if (visible) {
if (file.isFolder()) {
shareByLinkAllowEditing.setVisibility(View.VISIBLE);
} else {
shareByLinkAllowEditing.setVisibility(View.INVISIBLE);
}
overflowMenuShareLink.setVisibility(View.VISIBLE);
} else {
shareByLinkAllowEditing.setVisibility(View.INVISIBLE);

View file

@ -109,7 +109,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/share_via_link_section_title"/>
android:text="@string/share_via_link_section_title" />
<ImageView
android:id="@+id/share_link_copy_icon"
@ -125,7 +125,7 @@
android:paddingRight="@dimen/standard_eighth_margin"
android:paddingBottom="@dimen/standard_quarter_margin"
android:scaleType="fitStart"
android:src="@drawable/ic_content_copy"/>
android:src="@drawable/ic_content_copy" />
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/share_by_link_allow_editing"
@ -134,7 +134,7 @@
android:layout_gravity="center_vertical"
android:ellipsize="middle"
android:text="@string/edit_permission_label"
android:textSize="16sp"/>
android:textSize="16sp" />
</com.google.android.flexbox.FlexboxLayout>
<ImageView