-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from bibbi-team/release/1.2.0
[RELEASE/1.2.0->MAIN] 앱 버전 v1.2.0 릴리즈
- Loading branch information
Showing
93 changed files
with
4,546 additions
and
1,242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,7 @@ GEM | |
xcpretty (~> 0.2, >= 0.0.7) | ||
|
||
PLATFORMS | ||
arm64-darwin-22 | ||
arm64-darwin-23 | ||
x86_64-darwin-19 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/no5ing/bbibbi/data/datasource/local/MissionCacheProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.no5ing.bbibbi.data.datasource.local | ||
|
||
import com.google.common.cache.CacheBuilder | ||
import com.google.common.cache.CacheLoader | ||
import com.no5ing.bbibbi.data.datasource.network.RestAPI | ||
import com.no5ing.bbibbi.data.model.APIResponse.Companion.wrapToAPIResponse | ||
import com.no5ing.bbibbi.data.model.mission.Mission | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.coroutineScope | ||
import kotlinx.coroutines.runBlocking | ||
import kotlinx.coroutines.withContext | ||
import java.util.concurrent.TimeUnit | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class MissionCacheProvider @Inject constructor( | ||
private val restApi: RestAPI, | ||
) { | ||
private val cache = CacheBuilder.newBuilder() | ||
.maximumSize(100) | ||
.expireAfterWrite(10, TimeUnit.MINUTES) | ||
.build(object : CacheLoader<String, Mission>() { | ||
override fun load(key: String): Mission { | ||
return runBlocking { | ||
restApi.getPostApi().getMissionById(key).wrapToAPIResponse().data | ||
} | ||
} | ||
}) | ||
|
||
suspend fun getMission(missionId: String): Mission? { | ||
return coroutineScope { | ||
withContext(Dispatchers.IO) { | ||
runCatching { | ||
return@runCatching cache.get(missionId) | ||
}.getOrNull() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/no5ing/bbibbi/data/model/mission/Mission.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.no5ing.bbibbi.data.model.mission | ||
|
||
import android.os.Parcelable | ||
import com.no5ing.bbibbi.data.model.BaseModel | ||
import kotlinx.parcelize.Parcelize | ||
import java.time.LocalDate | ||
|
||
@Parcelize | ||
data class Mission( | ||
val id: String, | ||
val date: LocalDate?, | ||
val content: String, | ||
) : Parcelable, BaseModel() |
Oops, something went wrong.