Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Invisible button on Excel files #1538

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class FileMigration : RealmMigration {
renameField("createdAt", File::addedAt.name)
renameField("fileCreatedAt", File::createdAt.name)
renameField("nameNaturalSorting", File::sortedName.name)
renameField("onlyoffice", File::hasOnlyoffice.name)
renameField("onlyoffice", File::hasOnlyOffice.name)

addField(File::parentId.name, Int::class.java, FieldAttribute.REQUIRED)
addRealmObjectField(File::conversion.name, fileConversionSchema)
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/infomaniak/drive/data/models/File.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ open class File(

) : RealmObject(), Parcelable {

val hasThumbnail inline get() = supportedBy?.contains(SupportedByType.THUMBNAIL.apiValue) ?: false
val hasOnlyoffice inline get() = supportedBy?.contains(SupportedByType.ONLYOFFICE.apiValue) ?: false
val hasThumbnail inline get() = supportedBy?.contains(SupportedByType.THUMBNAIL.apiValue) == true
val hasOnlyOffice inline get() = supportedBy?.contains(SupportedByType.ONLYOFFICE.apiValue) == true

@LinkingObjects("children")
val localParent: RealmResults<File>? = null
Expand Down Expand Up @@ -171,7 +171,7 @@ open class File(
}

fun isOnlyOfficePreview(): Boolean {
return hasOnlyoffice || conversion?.whenOnlyoffice == true
return hasOnlyOffice || conversion?.whenOnlyoffice == true
}

fun isDropBox() = getVisibilityType() == VisibilityType.IS_DROPBOX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class FileDetailsInfoFragment : FileDetailsSubFragment() {
shareLink = newShareLink
val (permissionsGroup, currentPermission) = selectPermissions(
isFolder = file.isFolder(),
isOnlyOffice = file.hasOnlyoffice,
isOnlyOffice = file.hasOnlyOffice,
shareLinkExist = newShareLink != null,
)
findNavController().navigate(
Expand All @@ -215,7 +215,7 @@ class FileDetailsInfoFragment : FileDetailsSubFragment() {
fileId = file.id,
driveId = file.driveId,
shareLink = newShareLink,
isOnlyOfficeFile = file.hasOnlyoffice,
isOnlyOfficeFile = file.hasOnlyOffice,
isFolder = file.isFolder(),
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class FileShareDetailsFragment : Fragment() {
shareLink = newShareLink
val (permissionsGroup, currentPermission) = FileDetailsInfoFragment.selectPermissions(
isFolder = file.isFolder(),
isOnlyOffice = file.hasOnlyoffice,
isOnlyOffice = file.hasOnlyOffice,
shareLinkExist = shareLink != null,
)
safeNavigate(
Expand All @@ -249,7 +249,7 @@ class FileShareDetailsFragment : Fragment() {
fileId = file.id,
driveId = file.driveId,
shareLink = newShareLink,
isOnlyOfficeFile = file.hasOnlyoffice,
isOnlyOfficeFile = file.hasOnlyOffice,
isFolder = file.isFolder(),
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.annotation.CallSuper
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LiveData
import androidx.navigation.fragment.findNavController
Expand Down Expand Up @@ -133,7 +132,7 @@ class FileInfoActionsView @JvmOverloads constructor(
|| isSharedWithMe
|| currentFile.getVisibilityType() == IS_TEAM_SPACE
|| currentFile.getVisibilityType() == IS_SHARED_SPACE
editDocument.isVisible = (currentFile.hasOnlyoffice && rights.canWrite)
editDocument.isVisible = (currentFile.hasOnlyOffice && rights.canWrite)
|| (currentFile.conversion?.whenOnlyoffice == true)
leaveShare.isVisible = rights.canLeave == true
cancelExternalImport.isVisible = file.isImporting()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,11 @@ class PreviewHeaderView @JvmOverloads constructor(
}
}

fun setup(
onBackClicked: (() -> Unit)? = null,
onOpenWithClicked: (() -> Unit)? = null,
onEditClicked: (() -> Unit)? = null,
) = with(binding) {
backButton.setOnClickListener { onBackClicked?.invoke() }
openWithButton.setOnClickListener { onOpenWithClicked?.invoke() }
editButton.apply {
setOnClickListener { onEditClicked?.invoke() }
fun setup(onBackClicked: (() -> Unit)? = null, onOpenWithClicked: (() -> Unit)? = null, onEditClicked: (() -> Unit)? = null) {
with(binding) {
backButton.setOnClickListener { onBackClicked?.invoke() }
openWithButton.setOnClickListener { onOpenWithClicked?.invoke() }
editButton.setOnClickListener { onEditClicked?.invoke() }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class ShareLinkContainerView @JvmOverloads constructor(
return context.getString(resId, permission, fileName, password, validityDate)
}

private fun File.getTypeName(context: Context): String = context.getString(getTypeName(isFolder(), hasOnlyoffice))
private fun File.getTypeName(context: Context): String = context.getString(getTypeName(isFolder(), hasOnlyOffice))

companion object {

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/preview_header_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/buttonEdit"
android:visibility="gone"
app:backgroundTint="@color/previewBackgroundTransparent"
app:icon="@drawable/ic_edit_document"
app:iconSize="20dp"
Expand Down
Loading