Skip to content

Commit

Permalink
refactor: Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Dec 3, 2024
1 parent 12a7d38 commit 16b9d36
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import androidx.activity.ComponentActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.infomaniak.swisstransfer.ui.utils.AccountUtils
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import javax.inject.Inject

@AndroidEntryPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRoun
val AppIcons.Bell: ImageVector
get() {

if (_notificationBell != null) return _notificationBell!!
if (_bell != null) return _bell!!

_notificationBell = Builder(
_bell = Builder(
name = "Bell",
defaultWidth = 24.0.dp,
defaultHeight = 24.0.dp,
Expand Down Expand Up @@ -72,10 +72,10 @@ val AppIcons.Bell: ImageVector
}
}.build()

return _notificationBell!!
return _bell!!
}

private var _notificationBell: ImageVector? = null
private var _bell: ImageVector? = null

@Preview
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,52 @@ class FileUiListPreviewParameter : PreviewParameterProvider<List<FileUi>> {
val filesPreviewData = listOf(
FileUi(
// Non-preview file (i.e. pdf, txt, etc.)
fileName = "How to not get fired.pdf",
uid = "How to not get fired.pdf",
fileName = "How to not get fired.pdf",
isFolder = false,
fileSize = 10_302_130L,
mimeType = null,
localPath = "",
isFolder = false,
),
FileUi(
// Preview file (i.e. png, jpg, etc.)
fileName = "Opening images tutorial.png",
uid = "Opening images tutorial.png",
fileName = "Opening images tutorial.png",
isFolder = false,
fileSize = 456_782L,
mimeType = null,
localPath = "https://picsum.photos/200/300",
isFolder = false,
),
FileUi(
fileName = "The 5 step guide to turning it off and on again.docx",
uid = "The 5 step guide to turning it off and on again.docx",
fileName = "The 5 step guide to turning it off and on again.docx",
isFolder = false,
fileSize = 89_723_143L,
mimeType = null,
localPath = "",
isFolder = false,
),
FileUi(
uid = UUID.randomUUID().toString(),
fileName = "Learning to Copy and Paste: A Complete Guide.docx",
isFolder = false,
fileSize = 237_866_728L,
mimeType = null,
localPath = null,
isFolder = false,
),
FileUi(
uid = UUID.randomUUID().toString(),
fileName = "Introduction to Turning It Off and On Again.pptx",
isFolder = false,
fileSize = 98_723_143L,
mimeType = null,
localPath = null,
isFolder = false,
),
FileUi(
uid = UUID.randomUUID().toString(),
fileName = "The 5-Step Guide to Not Breaking Your Code.txt",
isFolder = false,
fileSize = 57_689_032L,
mimeType = null,
localPath = null,
isFolder = false,
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ class ImportationFilesManager @Inject constructor(
FileUi(
uid = fileToImport.fileName,
fileName = fileToImport.fileName,
isFolder = false,
fileSize = fileToImport.fileSizeInBytes,
mimeType = FileType.guessMimeTypeFromFileName(fileToImport.fileName),
localPath = copiedFile.toUri().toString(),
isFolder = false,
)
)
}
Expand Down Expand Up @@ -134,10 +134,10 @@ class ImportationFilesManager @Inject constructor(
FileUi(
uid = localFile.name,
fileName = localFile.name,
isFolder = false,
fileSize = fileSizeInBytes,
mimeType = null,
localPath = localFile.toUri().toString(),
isFolder = false,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private fun UploadProgressScreenPreview() {
totalSizeInBytes = 76_321_894L,
adScreenType = UploadProgressAdType.INDEPENDENCE,
onCancel = {},
showBottomSheet = GetSetCallbacks(get = { false }, set = { }),
showBottomSheet = GetSetCallbacks(get = { false }, set = {}),
)
}
}

0 comments on commit 16b9d36

Please sign in to comment.