Compare commits

...

8 Commits

Author SHA1 Message Date
2365e0b907 Perbaikan UI/UX 2026-01-10 00:05:29 +07:00
HadiPrakosou-HD
6602e0e143 fixing Oauth 2026-01-09 22:59:13 +07:00
HadiPrakosou-HD
5ae0b78497 Merge remote-tracking branch 'HadiPsikologi/Submain' into Submain
# Conflicts:
#	app/build.gradle.kts
#	app/src/main/java/com/example/ppb_kelompok2/MainActivity.kt
2026-01-05 21:02:12 +07:00
HadiPrakosou-HD
b7315ea5c0 fixing 2026-01-05 21:01:18 +07:00
7046948c70 update 2026-01-02 23:37:01 +07:00
RyanMaulana23
d0b773b6ef fixing 2026-01-02 22:28:31 +07:00
RyanMaulana23
6d21baa3f3 fixing 2026-01-02 22:15:11 +07:00
RyanMaulana23
a83e671ece fixxing 2026-01-02 22:12:06 +07:00
4 changed files with 494 additions and 446 deletions

View File

@ -1,3 +1,6 @@
import java.util.Properties
import java.io.FileInputStream
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
@ -5,20 +8,29 @@ plugins {
alias(libs.plugins.google.services)
}
// Load properties from local.properties file
val localProperties = Properties()
val localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localProperties.load(FileInputStream(localPropertiesFile))
}
android {
namespace = "com.example.ppb_kelompok2"
compileSdk {
version = release(36)
}
compileSdk = 35
defaultConfig {
applicationId = "com.example.ppb_kelompok2"
minSdk = 25
targetSdk = 36
targetSdk = 35
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// Expose the API key as a BuildConfig field
// This reads the HF_API_KEY from your local.properties file
buildConfigField("String", "HF_API_KEY", "\"${localProperties.getProperty("HF_API_KEY") ?: ""}\"")
}
buildTypes {
@ -39,6 +51,7 @@ android {
}
buildFeatures {
compose = true
buildConfig = true // Ensure this is enabled
}
}
@ -60,6 +73,8 @@ dependencies {
implementation(libs.retrofit)
implementation(libs.retrofit.gson)
implementation(libs.okhttp.logging)
implementation(libs.coil.compose)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)

View File

@ -1,5 +1,7 @@
package com.example.ppb_kelompok2
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Body
@ -16,7 +18,7 @@ data class EmotionScore(
val score: Float
)
// --- 2. Zero-Shot Classification Models w ---
// --- 2. Zero-Shot Classification Models ---
data class ZeroShotRequest(
val inputs: String,
val parameters: ZeroShotParameters
@ -52,13 +54,24 @@ interface HuggingFaceApiService {
): ZeroShotResponse
}
// --- 4. Singleton Instance ---
// --- 4. Singleton Instance (with Logging) ---
object RetrofitClient {
private const val BASE_URL = "https://api-inference.huggingface.co/"
// Membuat Interceptor untuk logging. Level BODY akan menampilkan semua detail request/response.
private val loggingInterceptor = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
// Menambahkan interceptor ke OkHttpClient
private val httpClient = OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.build()
val apiService: HuggingFaceApiService by lazy {
Retrofit.Builder()
.baseUrl(BASE_URL)
.client(httpClient) // Menggunakan client custom yang sudah ada logger-nya
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(HuggingFaceApiService::class.java)

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ firebaseBom = "33.1.2"
playServicesAuth = "20.7.0"
retrofit = "2.9.0"
okhttp = "4.12.0"
coil = "2.5.0"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@ -36,6 +37,7 @@ play-services-auth = { group = "com.google.android.gms", name = "play-services-a
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
retrofit-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" }
okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }