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

[RELEASE] 4.1.1 #4189

Merged
merged 11 commits into from
Oct 19, 2023
Next Next commit
Avoiding crashes when it's null
  • Loading branch information
Aitorbp authored and JuancaG05 committed Oct 17, 2023
commit f14747f9133024db2e5ed91782d4a9e6e3e0e20e
Original file line number Diff line number Diff line change
Expand Up @@ -309,23 +309,23 @@ class FileDetailsFragment : FileFragment() {
}

private fun setLastSync(ocFile: OCFile) {
if (ocFile.lastSyncDateForData!! > ZERO_MILLISECOND_TIME) {
if (ocFile.lastSyncDateForData?.let { it > ZERO_MILLISECOND_TIME } == true) {
binding.fdLastSync.visibility = View.VISIBLE
binding.fdLastSyncLabel.visibility = View.VISIBLE
binding.fdLastSync.text = DisplayUtils.unixTimeToHumanReadable(ocFile.lastSyncDateForData!!)
}
}

private fun setModified(ocFile: OCFile) {
if (ocFile.modificationTimestamp!! > ZERO_MILLISECOND_TIME) {
if (ocFile.modificationTimestamp?.let { it > ZERO_MILLISECOND_TIME } == true) {
binding.fdModified.visibility = View.VISIBLE
binding.fdModifiedLabel.visibility = View.VISIBLE
binding.fdModified.text = DisplayUtils.unixTimeToHumanReadable(ocFile.modificationTimestamp!!)
binding.fdModified.text = DisplayUtils.unixTimeToHumanReadable(ocFile.modificationTimestamp)
}
}

private fun setCreated(ocFile: OCFile) {
if (ocFile.creationTimestamp!! > ZERO_MILLISECOND_TIME) {
if (ocFile.creationTimestamp?.let { it > ZERO_MILLISECOND_TIME } == true) {
binding.fdCreated.visibility = View.VISIBLE
binding.fdCreatedLabel.visibility = View.VISIBLE
binding.fdCreated.text = DisplayUtils.unixTimeToHumanReadable(ocFile.creationTimestamp!!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class MainFileListViewModel(
TODO()
}

updateFolderToDisplay(parentDir!!)
parentDir?.let { updateFolderToDisplay(it) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class OCFileRepository(
val personalSpace = localSpacesDataSource.getPersonalSpaceForAccount(owner)
if (personalSpace == null) {
val legacyRootFolder = localFileDataSource.getFileByRemotePath(remotePath = ROOT_PATH, owner = owner, spaceId = null)
return legacyRootFolder!!
return legacyRootFolder ?: throw IllegalStateException("LegacyRootFolder not found")
}
// TODO: Retrieving the root folders should return a non nullable. If they don't exist yet, they are created and returned. Remove nullability
val personalRootFolder = localFileDataSource.getFileByRemotePath(remotePath = ROOT_PATH, owner = owner, spaceId = personalSpace.root.id)
Expand Down