Skip to content

Commit

Permalink
change capability name
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
  • Loading branch information
tobiasKaminsky committed May 10, 2019
1 parent 9a88056 commit 7248882
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1924,8 +1924,8 @@ public OCCapability saveCapabilities(OCCapability capability) {
capability.getFilesSharingPublicEnabled().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED,
capability.getFilesSharingPublicPasswordEnforced().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_PASSWORD,
capability.getFilesSharingPublicAskForPassword().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_OPTIONAL_PASSWORD,
capability.getFilesSharingPublicAskForOptionalPassword().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED,
capability.getFilesSharingPublicExpireDateEnabled().getValue());
cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_DAYS,
Expand Down Expand Up @@ -2078,8 +2078,9 @@ private OCCapability createCapabilityInstance(Cursor c) {
.getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ENABLED))));
capability.setFilesSharingPublicPasswordEnforced(CapabilityBooleanType.fromValue(c.getInt(c
.getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED))));
capability.setFilesSharingPublicAskForPassword(CapabilityBooleanType.fromValue(c.getInt(c
.getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_PASSWORD))));
capability.setFilesSharingPublicAskForOptionalPassword(
CapabilityBooleanType.fromValue(
c.getInt(c.getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_OPTIONAL_PASSWORD))));
capability.setFilesSharingPublicExpireDateEnabled(CapabilityBooleanType.fromValue(c.getInt(c
.getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED))));
capability.setFilesSharingPublicExpireDateDays(c.getInt(c
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/owncloud/android/db/ProviderMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ static public class ProviderTableMeta implements BaseColumns {
public static final String CAPABILITIES_SHARING_API_ENABLED = "sharing_api_enabled";
public static final String CAPABILITIES_SHARING_PUBLIC_ENABLED = "sharing_public_enabled";
public static final String CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED = "sharing_public_password_enforced";
public static final String CAPABILITIES_SHARING_PUBLIC_ASK_FOR_PASSWORD = "sharing_public_ask_for_password";
public static final String CAPABILITIES_SHARING_PUBLIC_ASK_FOR_OPTIONAL_PASSWORD =
"sharing_public_ask_for_optional_password";
public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED =
"sharing_public_expire_date_enabled";
public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_DAYS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ private void createCapabilitiesTable(SQLiteDatabase db) {
+ ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_MIMETYPE_LIST + TEXT
+ ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_DIRECT_EDITING + INTEGER
+ ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_TEMPLATES + INTEGER
+ ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_PASSWORD + " INTEGER );");
+ ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_OPTIONAL_PASSWORD + " INTEGER );");
}

private void createUploadsTable(SQLiteDatabase db) {
Expand Down Expand Up @@ -1933,7 +1933,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.beginTransaction();
try {
db.execSQL(ALTER_TABLE + ProviderTableMeta.CAPABILITIES_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_PASSWORD +
ADD_COLUMN + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_OPTIONAL_PASSWORD +
" INTEGER ");

upgraded = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation ope
fileDetailFragment
.getFileDetailSharingFragment()
.requestPasswordForShareViaLink(true,
getCapabilities().getFilesSharingPublicAskForPassword()
getCapabilities().getFilesSharingPublicAskForOptionalPassword()
.isTrue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation ope
ShareFileFragment shareFileFragment = getShareFileFragment();
if (shareFileFragment != null && shareFileFragment.isAdded()) { // only if added to the view hierarchy!!

boolean askForPassword = getCapabilities().getFilesSharingPublicAskForPassword().isTrue();
boolean askForPassword = getCapabilities().getFilesSharingPublicAskForOptionalPassword().isTrue();

shareFileFragment.requestPasswordForShareViaLink(true, askForPassword);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static SendShareDialog newInstance(OCFile file, boolean hideNcSharingOpti
args.putBoolean(KEY_SHARING_PUBLIC_PASSWORD_ENFORCED,
capability.getFilesSharingPublicPasswordEnforced().isTrue());
args.putBoolean(KEY_SHARING_PUBLIC_ASK_FOR_PASSWORD,
capability.getFilesSharingPublicAskForPassword().isTrue());
capability.getFilesSharingPublicAskForOptionalPassword().isTrue());
dialogFragment.setArguments(args);

return dialogFragment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,10 @@ public void toggleShareByLink() {

private void createShareLink() {
if (capabilities != null && (capabilities.getFilesSharingPublicPasswordEnforced().isTrue() ||
capabilities.getFilesSharingPublicAskForPassword().isTrue())) {
capabilities.getFilesSharingPublicAskForOptionalPassword().isTrue())) {
// password enforced by server, request to the user before trying to create
requestPasswordForShareViaLink(true, capabilities.getFilesSharingPublicAskForPassword().isTrue());
requestPasswordForShareViaLink(true,
capabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());

} else {
// create without password if not enforced by server or we don't know if enforced;
Expand Down Expand Up @@ -417,7 +418,8 @@ private boolean optionsItemSelected(MenuItem item) {

return true;
case R.id.action_password: {
requestPasswordForShareViaLink(false, capabilities.getFilesSharingPublicAskForPassword().isTrue());
requestPasswordForShareViaLink(false,
capabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());
return true;
}
case R.id.action_share_expiration_date: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,10 @@ public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
}
if (isChecked) {
if (mCapabilities != null && (mCapabilities.getFilesSharingPublicPasswordEnforced().isTrue() ||
mCapabilities.getFilesSharingPublicAskForPassword().isTrue())) {
mCapabilities.getFilesSharingPublicAskForOptionalPassword().isTrue())) {
// password enforced by server, request to the user before trying to create
requestPasswordForShareViaLink(true, mCapabilities.getFilesSharingPublicAskForPassword().isTrue());
requestPasswordForShareViaLink(true,
mCapabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());
} else {
// create without password if not enforced by server or we don't know if enforced;
((FileActivity) getActivity()).getFileOperationsHelper().shareFileViaLink(mFile, null);
Expand Down Expand Up @@ -429,7 +430,8 @@ public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
return;
}
if (isChecked) {
requestPasswordForShareViaLink(false, mCapabilities.getFilesSharingPublicAskForPassword().isTrue());
requestPasswordForShareViaLink(false,
mCapabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());
} else {
((FileActivity) getActivity()).getFileOperationsHelper().setPasswordToShareViaLink(mFile, ""); // clears
}
Expand All @@ -449,7 +451,8 @@ public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
@Override
public void onClick(View passwordView) {
if (mPublicShare != null && mPublicShare.isPasswordProtected()) {
requestPasswordForShareViaLink(false, mCapabilities.getFilesSharingPublicAskForPassword().isTrue());
requestPasswordForShareViaLink(false,
mCapabilities.getFilesSharingPublicAskForOptionalPassword().isTrue());
}
}
}
Expand Down

0 comments on commit 7248882

Please sign in to comment.