mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
Merge pull request #6760 from nextcloud/passwortToShare
Fix crash on setting password
This commit is contained in:
commit
dcf7455e57
3 changed files with 23 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,21 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
|
|||
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, 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.
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
|||
RenamePublicShareDialogFragment.RENAME_PUBLIC_SHARE_FRAGMENT);
|
||||
return true;
|
||||
case R.id.action_password: {
|
||||
requestPasswordForShareViaLink(false,
|
||||
requestPasswordForShare(publicShare,
|
||||
capabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());
|
||||
return true;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue