Merge pull request #6760 from nextcloud/passwortToShare

Fix crash on setting password
This commit is contained in:
Andy Scherzinger 2020-08-20 14:00:11 +02:00 committed by GitHub
commit dcf7455e57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 8 deletions

View file

@ -334,7 +334,7 @@ public class ShareeListAdapter extends RecyclerView.Adapter<ShareeListAdapter.Us
return true;
}
case R.id.action_password: {
listener.requestPasswordForShare(share);
listener.requestPasswordForShare(share, false);
return true;
}
case R.id.action_expiration_date: {
@ -428,6 +428,6 @@ public class ShareeListAdapter extends RecyclerView.Adapter<ShareeListAdapter.Us
*
* @param share the share for which a password shall be configured/removed
*/
void requestPasswordForShare(OCShare share);
void requestPasswordForShare(OCShare share, boolean askForPassword);
}
}

View file

@ -96,7 +96,22 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
/**
* Public factory method to create new SharePasswordDialogFragment instances.
*
* @param share OCFile bound to the public share that which password will be set or updated
* @param share OCFile bound to the public share that which password will be set or updated
* @return Dialog ready to show.
*/
public static SharePasswordDialogFragment newInstance(OCShare share, boolean askForPassword) {
SharePasswordDialogFragment frag = new SharePasswordDialogFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_SHARE, share);
args.putBoolean(ARG_ASK_FOR_PASSWORD, askForPassword);
frag.setArguments(args);
return frag;
}
/**
* Public factory method to create new SharePasswordDialogFragment instances.
*
* @param share OCFile bound to the public share that which password will be set or updated
* @return Dialog ready to show.
*/
public static SharePasswordDialogFragment newInstance(OCShare share) {
@ -195,7 +210,7 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
if (createShare) {
((FileActivity) getActivity()).getFileOperationsHelper().shareFileViaPublicShare(file, password);
} else {
((FileActivity) getActivity()).getFileOperationsHelper().setPasswordToPublicShare(share, password);
((FileActivity) getActivity()).getFileOperationsHelper().setPasswordToShare(share, password);
}
}

View file

@ -415,8 +415,8 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
RenamePublicShareDialogFragment.RENAME_PUBLIC_SHARE_FRAGMENT);
return true;
case R.id.action_password: {
requestPasswordForShareViaLink(false,
capabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());
requestPasswordForShare(publicShare,
capabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());
return true;
}
case R.id.action_share_expiration_date: {
@ -517,8 +517,8 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
}
@Override
public void requestPasswordForShare(OCShare share) {
SharePasswordDialogFragment dialog = SharePasswordDialogFragment.newInstance(share);
public void requestPasswordForShare(OCShare share, boolean askForPassword) {
SharePasswordDialogFragment dialog = SharePasswordDialogFragment.newInstance(share, askForPassword);
dialog.show(getChildFragmentManager(), SharePasswordDialogFragment.PASSWORD_FRAGMENT);
}