Skip to content

Commit

Permalink
updated some libs
Browse files Browse the repository at this point in the history
  • Loading branch information
yamin8000 committed May 17, 2024
1 parent 89b9f38 commit b143f51
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {
id("kotlin-parcelize")
}

private val composeCompilerVersion = "1.5.13"
private val composeCompilerVersion = "1.5.14"

private val appId = "io.github.yamin8000.owl"

Expand All @@ -39,8 +39,8 @@ android {
applicationId = appId
minSdk = 21
targetSdk = 34
versionCode = 40
versionName = "1.6.3"
versionCode = 41
versionName = "1.6.4"
vectorDrawables.useSupportLibrary = true
archivesName = "$applicationId-v$versionCode($versionName)"
}
Expand Down Expand Up @@ -96,7 +96,7 @@ dependencies {
implementation(project(":network"))
//core android/kotlin
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.0")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7")
implementation("androidx.core:core-splashscreen:1.0.1")
//compose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ internal class HomeViewModel(
val cache = findCachedDefinitionOrNull(searchTerm)
if (cache == null) {
return try {
val result = Web.retrofit.getAPI<APIs.FreeDictionaryAPI>().search(searchTerm.trim())
val result = Web.getRetrofit().getAPI<APIs.FreeDictionaryAPI>().search(searchTerm.trim())
val entry = result.firstOrNull()
if (entry != null) {
addWordToDatabase(entry)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
plugins {
id("com.android.application") version "8.4.0" apply false
id("com.android.library") version "8.4.0" apply false
id("org.jetbrains.kotlin.android") version "1.9.23" apply false
id("com.google.devtools.ksp") version "1.9.23-1.0.20"
id("org.jetbrains.kotlin.android") version "1.9.24" apply false
id("com.google.devtools.ksp") version "1.9.24-1.0.20"
}
2 changes: 1 addition & 1 deletion data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp") version ("1.9.23-1.0.20")
id("com.google.devtools.ksp") version ("1.9.24-1.0.20")
}

android {
Expand Down
22 changes: 10 additions & 12 deletions network/src/main/java/io/github/yamin8000/owl/network/Web.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@ package io.github.yamin8000.owl.network
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory

/**
* App-wide Web Helper Singleton
*/
/** App-wide Web Helper Singleton */
object Web {

private const val BASE_URL = "https://api.dictionaryapi.dev/api/v2/"

/**
* App-wide [Retrofit] singleton object
*/
val retrofit: Retrofit by lazy(LazyThreadSafetyMode.NONE) { createRetrofit() }
private lateinit var retrofit: Retrofit

private fun createRetrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create())
.build()
fun getRetrofit(): Retrofit {
if (!this::retrofit.isInitialized) {
retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create())
.build()
}
return retrofit
}

/**
Expand Down

0 comments on commit b143f51

Please sign in to comment.