mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 05:55:39 +03:00
Reduce number of return statements
Codacy reported: Function itemFromObject has 4 return statements which exceeds the limit of 2. Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
43f2d1badf
commit
aae7e851c9
1 changed files with 6 additions and 4 deletions
|
@ -134,9 +134,10 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||
actorParameters: HashMap<String?, String?>,
|
||||
dateTime: String
|
||||
): SharedItem {
|
||||
val returnValue: SharedItem
|
||||
when (objectParameters["type"]) {
|
||||
"talk-poll" -> {
|
||||
return SharedPollItem(
|
||||
returnValue = SharedPollItem(
|
||||
objectParameters["id"]!!,
|
||||
objectParameters["name"]!!,
|
||||
actorParameters["id"]!!,
|
||||
|
@ -145,7 +146,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||
)
|
||||
}
|
||||
"geo-location" -> {
|
||||
return SharedLocationItem(
|
||||
returnValue = SharedLocationItem(
|
||||
objectParameters["id"]!!,
|
||||
objectParameters["name"]!!,
|
||||
actorParameters["id"]!!,
|
||||
|
@ -155,7 +156,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||
)
|
||||
}
|
||||
"deck-card" -> {
|
||||
return SharedDeckCardItem(
|
||||
returnValue = SharedDeckCardItem(
|
||||
objectParameters["id"]!!,
|
||||
objectParameters["name"]!!,
|
||||
actorParameters["id"]!!,
|
||||
|
@ -165,7 +166,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||
)
|
||||
}
|
||||
else -> {
|
||||
return SharedOtherItem(
|
||||
returnValue = SharedOtherItem(
|
||||
objectParameters["id"]!!,
|
||||
objectParameters["name"]!!,
|
||||
actorParameters["id"]!!,
|
||||
|
@ -174,6 +175,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||
)
|
||||
}
|
||||
}
|
||||
return returnValue
|
||||
}
|
||||
|
||||
override fun availableTypes(parameters: SharedItemsRepository.Parameters): Observable<Set<SharedItemType>> {
|
||||
|
|
Loading…
Reference in a new issue