From 63e74e3bc17f4ab40137a591d0dea7aaf6da69be Mon Sep 17 00:00:00 2001 From: davigonz Date: Mon, 5 Aug 2019 12:35:01 +0200 Subject: [PATCH] Fix some tests --- .../shares/domain/publicShares/EditPublicShareTest.kt | 2 +- .../shares/presentation/fragment/ShareFileFragment.kt | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/owncloudApp/src/androidTest/java/com/owncloud/android/shares/domain/publicShares/EditPublicShareTest.kt b/owncloudApp/src/androidTest/java/com/owncloud/android/shares/domain/publicShares/EditPublicShareTest.kt index cce86558add..b17523abca8 100644 --- a/owncloudApp/src/androidTest/java/com/owncloud/android/shares/domain/publicShares/EditPublicShareTest.kt +++ b/owncloudApp/src/androidTest/java/com/owncloud/android/shares/domain/publicShares/EditPublicShareTest.kt @@ -325,7 +325,7 @@ class EditPublicShareTest { calendar.add(Calendar.DAY_OF_YEAR, 1) val formatter: DateFormat = SimpleDateFormat("MMM dd, yyyy"); val expirationDate = formatter.format(calendar.time); - val publicLinkExpirationDateInMillis = SimpleDateFormat.getDateInstance().parse(expirationDate).time + val publicLinkExpirationDateInMillis = formatter.parse(expirationDate).time // 1. Open dialog to edit an existing public share onView(withId(R.id.editPublicLinkButton)).perform(click()) diff --git a/owncloudApp/src/main/java/com/owncloud/android/shares/presentation/fragment/ShareFileFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/shares/presentation/fragment/ShareFileFragment.kt index 92ac931ed72..5b9dcade9ee 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/shares/presentation/fragment/ShareFileFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/shares/presentation/fragment/ShareFileFragment.kt @@ -184,8 +184,9 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe /** * @return 'True' when public share is disabled in the server */ - private val isPublicShareDisabled: Boolean - get() = capabilities?.filesSharingPublicEnabled == CapabilityBooleanType.FALSE.value + private val isPublicShareEnabled: Boolean + get() = capabilities?.filesSharingPublicEnabled == CapabilityBooleanType.TRUE.value || + capabilities?.filesSharingPublicEnabled == CapabilityBooleanType.UNKNOWN.value /** * {@inheritDoc} @@ -329,9 +330,7 @@ class ShareFileFragment : Fragment(), ShareUserListAdapter.ShareUserAdapterListe // Update view depending on updated capabilities shareHeaderDivider.isVisible = isShareApiEnabled shareWithUsersSection.isVisible = isShareApiEnabled - shareViaLinkSection.isVisible = isShareApiEnabled - - shareViaLinkSection.isGone = isPublicShareDisabled + shareViaLinkSection.isVisible = isShareApiEnabled && isPublicShareEnabled } /**************************************************************************************************************