-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties | ||
|
||
plugins { | ||
kotlin("kapt") | ||
id("com.android.application") | ||
id("org.jetbrains.kotlin.android") | ||
id("com.google.dagger.hilt.android") | ||
} | ||
|
||
android { | ||
namespace = "io.iakanoe.github.dolarcito" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
applicationId = "io.iakanoe.github.dolarcito" | ||
minSdk = 27 | ||
targetSdk = 34 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary = true | ||
} | ||
|
||
buildConfigField("String", "API_KEY", gradleLocalProperties(rootDir).getProperty("API_KEY")) | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
buildFeatures { | ||
compose = true | ||
buildConfig = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.5.3" | ||
} | ||
|
||
packaging { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
} | ||
|
||
kapt { | ||
correctErrorTypes = true | ||
} | ||
|
||
dependencies { | ||
implementation("com.google.dagger:hilt-android:2.48") | ||
kapt("com.google.dagger:hilt-android-compiler:2.48") | ||
|
||
implementation("androidx.hilt:hilt-navigation-compose:1.1.0-rc01") | ||
|
||
implementation("com.squareup.retrofit2:retrofit:2.9.0") | ||
implementation("com.squareup.retrofit2:converter-gson:2.9.0") | ||
|
||
implementation("androidx.core:core-ktx:1.12.0") | ||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2") | ||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2") | ||
implementation("androidx.activity:activity-compose:1.8.0") | ||
implementation("androidx.navigation:navigation-compose:2.7.4") | ||
implementation("androidx.datastore:datastore-preferences:1.0.0") | ||
|
||
implementation(platform("androidx.compose:compose-bom:2023.10.01")) | ||
implementation("androidx.compose.ui:ui") | ||
implementation("androidx.compose.ui:ui-graphics") | ||
implementation("androidx.compose.ui:ui-tooling-preview") | ||
implementation("androidx.compose.material3:material3") | ||
debugImplementation("androidx.compose.ui:ui-tooling") | ||
debugImplementation("androidx.compose.ui:ui-test-manifest") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:name=".DolarcitoApplication" | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Dolarcito" | ||
tools:targetApi="31"> | ||
|
||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:theme="@style/Theme.Dolarcito"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.iakanoe.github.dolarcito | ||
|
||
import android.app.Application | ||
import dagger.hilt.android.HiltAndroidApp | ||
|
||
@HiltAndroidApp | ||
class DolarcitoApplication : Application() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.iakanoe.github.dolarcito | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import io.iakanoe.github.dolarcito.ui.DolarcitoNavigation | ||
import io.iakanoe.github.dolarcito.ui.common.theme.DolarcitoTheme | ||
|
||
@AndroidEntryPoint | ||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
DolarcitoTheme { | ||
DolarcitoNavigation() | ||
} | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.iakanoe.github.dolarcito.data | ||
|
||
import io.iakanoe.github.dolarcito.gateway.DolarcitoApiGateway | ||
|
||
class ExchangeRateRepository( | ||
private val apiGateway: DolarcitoApiGateway | ||
) { | ||
suspend fun getExchangeRates() = | ||
apiGateway.getRates().values.filterNotNull() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.iakanoe.github.dolarcito.data | ||
|
||
import io.iakanoe.github.dolarcito.gateway.SettingsGateway | ||
import io.iakanoe.github.dolarcito.model.Settings | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.combine | ||
|
||
class SettingsRepository( | ||
private val settingsGateway: SettingsGateway | ||
) { | ||
fun getSettings(): Flow<Settings> { | ||
val showingRatesNames = settingsGateway.retrieveShowingRatesNames() | ||
val hiddenRatesNames = settingsGateway.retrieveHiddenRatesNames() | ||
return combine(showingRatesNames, hiddenRatesNames) { showing, hidden -> | ||
Settings(showing, hidden) | ||
} | ||
} | ||
|
||
suspend fun setSettings(settings: Settings) = | ||
settingsGateway.saveBothRatesNames(settings.showingRatesNames, settings.hiddenRatesNames) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.iakanoe.github.dolarcito.di | ||
|
||
import android.content.Context | ||
import com.google.gson.Gson | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import io.iakanoe.github.dolarcito.gateway.DolarcitoApiGateway | ||
import io.iakanoe.github.dolarcito.gateway.SettingsGateway | ||
import retrofit2.Retrofit | ||
import retrofit2.create | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object GatewayModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun providesDolarcitoApiGateway( | ||
retrofit: Retrofit | ||
) = retrofit.create<DolarcitoApiGateway>() | ||
|
||
@Provides | ||
@Singleton | ||
fun providesSettingsGateway( | ||
@ApplicationContext context: Context, | ||
gson: Gson | ||
) = SettingsGateway(context, gson) | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.iakanoe.github.dolarcito.di | ||
|
||
import com.google.gson.Gson | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object GsonModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun provideGson() = Gson() | ||
} |