Skip to content

Commit

Permalink
Merge pull request #15 from kooroshMa/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
kooroshMa authored Jul 29, 2023
2 parents 2bcbac4 + f8c77d6 commit b5d9a5b
Show file tree
Hide file tree
Showing 90 changed files with 2,093 additions and 282 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea
.DS_Store
/build
/captures
Expand Down
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/compiler.xml

This file was deleted.

18 changes: 0 additions & 18 deletions .idea/gradle.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

1 change: 1 addition & 0 deletions app/benchmark-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-dontobfuscate
67 changes: 0 additions & 67 deletions app/build.gradle

This file was deleted.

108 changes: 108 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import com.example.buildsrc.Android
import com.example.buildsrc.Libs

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("kotlin-kapt")
id ("dagger.hilt.android.plugin")
}

android {
namespace = "com.example.composecodechallenge"
compileSdk = Android.compileSdkVersion

defaultConfig {
applicationId = Android.applicationId
minSdk = Android.minSdkVersion
targetSdk = Android.targetSdkVersion
versionCode = Android.versionCode
versionName = Android.versionName

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
buildConfigField("String", "BASE_URL", "\"https://api.github.com\"")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
create("benchmark") {
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks += listOf("release")
isDebuggable = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.6"
}
packaging {
resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
}
}

dependencies {
implementation(project(Libs.Modules.data))
implementation(project(Libs.Modules.domain))
//---------------------------------------------------------------------------------------------
implementation(Libs.Jetpack.androidxCore)
implementation (platform(Libs.Common.kotlinBom))
implementation(Libs.Jetpack.lifecycleRuntime)
implementation(Libs.Jetpack.activityCompose)
implementation (platform(Libs.Jetpack.composeBom))
implementation(Libs.Jetpack.composeUi)
implementation(Libs.Jetpack.composeUiGraphics)
implementation(Libs.Jetpack.composeUiToolingPreview)
implementation(Libs.Jetpack.composeMaterial3)
implementation(Libs.Jetpack.composeMaterial3WindowSzeClass)
implementation(Libs.Jetpack.lifecycleRuntimeCompose)
implementation(Libs.Jetpack.navigationCompose)
implementation(Libs.Jetpack.trace)

testImplementation(Libs.Testing.junit)
testImplementation(Libs.Testing.mockitoKotlin)
testImplementation(Libs.Testing.coroutinesTest)

androidTestImplementation(Libs.Testing.junitEx)
androidTestImplementation(Libs.Testing.espresso)
androidTestImplementation (platform(Libs.Jetpack.composeBom))
androidTestImplementation(Libs.Testing.composeUiTestJunit4)
debugImplementation(Libs.Jetpack.composeTooling)
debugImplementation(Libs.Testing.composeUiTestManifest)
implementation (Libs.Jetpack.workRuntime)
//----------------------------------------------------------------------------------------------
implementation(Libs.Jetpack.hiltAndroid)
kapt(Libs.Jetpack.hiltAndroidCompiler)
implementation(Libs.Jetpack.hiltWork)
kapt(Libs.Jetpack.hiltCompiler)
implementation(Libs.Jetpack.hiltNavCompose)
//----------------------------------------------------------------------------------------------
implementation(Libs.Common.stetho)
implementation(Libs.Common.stetho_OkHttp)
implementation(Libs.Common.okHttpInterceptor)
//----------------------------------------------------------------------------------------------
implementation(Libs.Common.retrofit)
implementation(Libs.Common.retrofitGson)
//----------------------------------------------------------------------------------------------
implementation(Libs.Common.arrowCore)
//----------------------------------------------------------------------------------------------
implementation(Libs.Common.coil)
//----------------------------------------------------------------------------------------------
implementation(Libs.Common.material)
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<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=".app.App"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand All @@ -12,8 +15,12 @@
android:supportsRtl="true"
android:theme="@style/Theme.ComposeCodeChallenge"
tools:targetApi="31">
<profileable
android:shell="true"
tools:targetApi="29" />

<activity
android:name=".MainActivity"
android:name=".main.ui.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.ComposeCodeChallenge">
Expand Down
17 changes: 0 additions & 17 deletions app/src/main/java/com/example/composecodechallenge/MainActivity.kt

This file was deleted.

7 changes: 7 additions & 0 deletions app/src/main/java/com/example/composecodechallenge/app/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.composecodechallenge.app

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class App : Application()
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.example.composecodechallenge.di

import com.example.composecodechallenge.BuildConfig
import com.example.data.di.Cloud
import com.example.data.di.Mock
import com.example.data.restful.API
import com.example.data.source.cloud.BaseCloudRepository
import com.example.data.source.cloud.CloudMockRepository
import com.example.data.source.cloud.CloudRepository
import com.facebook.stetho.okhttp3.StethoInterceptor
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import dagger.Module
import dagger.Provides
import dagger.Reusable
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit

@Module
@InstallIn(SingletonComponent::class)
object NetworkModule {

@Reusable
@Provides
fun provideGson(): Gson {
return GsonBuilder().create()
}

@Reusable
@Provides
fun provideOkHttpClient(): OkHttpClient {
val builder = OkHttpClient.Builder()
if (BuildConfig.DEBUG) {
val loggingInterceptor = HttpLoggingInterceptor()
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
builder.addInterceptor(loggingInterceptor)
builder.addNetworkInterceptor(StethoInterceptor())
}
builder.connectTimeout(20L, TimeUnit.SECONDS)
builder.readTimeout(20L, TimeUnit.SECONDS)
builder.writeTimeout(20L, TimeUnit.SECONDS)
return builder.build()
}

@Reusable
@Provides
fun provideRetrofit(okHttpClient: OkHttpClient, gson: Gson): Retrofit {
return Retrofit.Builder().client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create(gson))
.baseUrl(BuildConfig.BASE_URL)
.build()
}

@Reusable
@Provides
fun provideService(retrofit: Retrofit): API {
return retrofit.create(API::class.java)
}

@Cloud
@Provides
fun provideCloudRepository(apIs: API): BaseCloudRepository {
return CloudRepository(apIs)
}

@Mock
@Provides
fun provideCloudMockRepository(): BaseCloudRepository {
return CloudMockRepository()
}

}
Loading

0 comments on commit b5d9a5b

Please sign in to comment.