Skip to content
Merged
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 @@ -3,40 +3,32 @@ package com.ninecraft.booket.core.data.impl.repository
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.get
import com.ninecraft.booket.core.common.utils.isUpdateRequired
import com.ninecraft.booket.core.common.utils.runSuspendCatching
import com.ninecraft.booket.core.data.api.repository.RemoteConfigRepository
import com.ninecraft.booket.core.data.impl.BuildConfig
import com.orhanobut.logger.Logger
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.tasks.await
import javax.inject.Inject
import kotlin.coroutines.resume

class DefaultRemoteConfigRepository @Inject constructor(
private val remoteConfig: FirebaseRemoteConfig,
) : RemoteConfigRepository {
override suspend fun getLatestVersion(): Result<String> = suspendCancellableCoroutine { continuation ->
remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
val latestVersion = remoteConfig[KEY_LATEST_VERSION].asString()
Logger.d("LatestVersion: $latestVersion")
continuation.resume(Result.success(latestVersion))
} else {
Logger.e(task.exception, "getLatestVersion failed")
continuation.resume(Result.failure(task.exception ?: Exception("Unknown error")))
}
}
override suspend fun getLatestVersion(): Result<String> = runSuspendCatching {
remoteConfig.fetchAndActivate().await()
val latestVersion = remoteConfig[KEY_LATEST_VERSION].asString()
Logger.d("LatestVersion: $latestVersion")
latestVersion
}.onFailure { exception ->
Logger.e(exception, "getLatestVersion failed")
}

override suspend fun shouldUpdate(): Result<Boolean> = suspendCancellableCoroutine { continuation ->
remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
val minVersion = remoteConfig[KEY_MIN_VERSION].asString()
val currentVersion = BuildConfig.APP_VERSION
continuation.resume(Result.success(isUpdateRequired(currentVersion, minVersion)))
} else {
Logger.e(task.exception, "shouldUpdate: getMinVersion failed")
continuation.resume(Result.failure(task.exception ?: Exception("Unknown error")))
}
}
override suspend fun shouldUpdate(): Result<Boolean> = runSuspendCatching {
remoteConfig.fetchAndActivate().await()
val minVersion = remoteConfig[KEY_MIN_VERSION].asString()
val currentVersion = BuildConfig.APP_VERSION
isUpdateRequired(currentVersion, minVersion)
}.onFailure { exception ->
Logger.e(exception, "shouldUpdate: getMinVersion failed")
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ninecraft.booket.feature.detail.record.component

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -48,7 +49,12 @@ internal fun BookItem(
.padding(end = ReedTheme.spacing.spacing4)
.width(46.dp)
.height(68.dp)
.clip(RoundedCornerShape(size = ReedTheme.radius.xs)),
.clip(RoundedCornerShape(size = ReedTheme.radius.xs))
.border(
width = 1.dp,
color = ReedTheme.colors.borderPrimary,
shape = RoundedCornerShape(ReedTheme.radius.xs),
),
placeholder = painterResource(R.drawable.ic_placeholder),
)
Column(modifier = Modifier.weight(1f)) {
Expand Down
Binary file modified feature/detail/src/main/res/drawable/img_insight.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified feature/detail/src/main/res/drawable/img_joy.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified feature/detail/src/main/res/drawable/img_sad.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified feature/detail/src/main/res/drawable/img_warm.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ninecraft.booket.feature.library.component

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -52,7 +53,12 @@ fun LibraryBookItem(
)
.width(68.dp)
.height(100.dp)
.clip(RoundedCornerShape(size = ReedTheme.radius.sm)),
.clip(RoundedCornerShape(size = ReedTheme.radius.sm))
.border(
width = 1.dp,
color = ReedTheme.colors.borderPrimary,
shape = RoundedCornerShape(ReedTheme.radius.sm),
),
placeholder = painterResource(designR.drawable.ic_placeholder),
)
Column(modifier = Modifier.weight(1f)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ninecraft.booket.feature.search.book.component

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
Expand Down Expand Up @@ -65,7 +66,12 @@ fun BookItem(
)
.width(68.dp)
.height(100.dp)
.clip(RoundedCornerShape(size = ReedTheme.radius.sm)),
.clip(RoundedCornerShape(size = ReedTheme.radius.sm))
.border(
width = 1.dp,
color = ReedTheme.colors.borderPrimary,
shape = RoundedCornerShape(ReedTheme.radius.sm),
),
) {
NetworkImage(
imageUrl = book.coverImageUrl,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ninecraft.booket.feature.search.library.component

import androidx.compose.foundation.border
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -52,7 +53,12 @@ fun LibraryBookItem(
)
.width(68.dp)
.height(100.dp)
.clip(RoundedCornerShape(size = ReedTheme.radius.sm)),
.clip(RoundedCornerShape(size = ReedTheme.radius.sm))
.border(
width = 1.dp,
color = ReedTheme.colors.borderPrimary,
shape = RoundedCornerShape(ReedTheme.radius.sm),
),
placeholder = painterResource(designR.drawable.ic_placeholder),
)
Column(modifier = Modifier.weight(1f)) {
Expand Down
Loading