diff --git a/.github/workflows/cleanup-merged-branch.yml b/.github/workflows/cleanup-merged-branch.yml new file mode 100644 index 0000000..1162d65 --- /dev/null +++ b/.github/workflows/cleanup-merged-branch.yml @@ -0,0 +1,22 @@ +# 자동으로 되서 주석처리 +#name: cleanup-merged-branch +# +#on: +# pull_request: +# types: [ closed ] +# branches: +# - 'feat/**' +# +#jobs: +# delete_branch: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# +# - name: Delete merged branch +# if: github.event.pull_request.merged == true +# id: open-pr +# run: | +# git branch -d ${{ github.event.pull_request.head.ref }} +# git push origin --delete ${{ github.event.pull_request.head.ref }} diff --git a/.github/workflows/r2d_chk.yml b/.github/workflows/r2d_chk.yml deleted file mode 100644 index bfd580e..0000000 --- a/.github/workflows/r2d_chk.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: clean-up-feat-pull-request - -on: - pull_request: - types: [ closed ] - branches: - - 'feat/**' - -jobs: - delete_branch: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Delete merged branch - if: github.event.pull_request.merged == true - id: open-pr - run: | - git branch -d ${{ github.event.pull_request.head.ref }} - git push origin --delete ${{ github.event.pull_request.head.ref }} diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 04ed4df..df62d16 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,10 +1,8 @@ plugins { alias(libs.plugins.androidApplication) alias(libs.plugins.kotlinAndroid) - alias(libs.plugins.kotlinSerialization) alias(libs.plugins.hiltAndroid) alias(libs.plugins.ksp) - alias(libs.plugins.secrets) } android { @@ -50,11 +48,12 @@ android { } } -secrets { - defaultPropertiesFileName = "local.defaults.properties" -} - dependencies { + implementation(project(":presentation")) + implementation(project(":entity")) + implementation(project(":domain")) + implementation(project(":data")) + // hilt implementation(libs.dagger.hilt.android) ksp(libs.dagger.hilt.compiler) @@ -69,35 +68,9 @@ dependencies { implementation(libs.core.ktx) - implementation(libs.androidx.lifecycle.runtime.ktx) - implementation(libs.androidx.lifecycle.runtime.compose) implementation(libs.androidx.activity.compose) - // api - implementation(libs.bundles.retrofit) - testImplementation(libs.mockwebserver) - - // database - implementation(libs.androidx.room.runtime) - implementation(libs.androidx.room.ktx) - ksp(libs.androidx.room.compiler) - testImplementation(libs.androidx.room.testing) - - implementation(libs.androidx.datastore) - // compose implementation(platform(libs.androidx.compose.bom)) implementation(libs.bundles.compose) - androidTestImplementation(platform(libs.androidx.compose.bom)) - androidTestImplementation(libs.bundles.compose.android.test) - debugImplementation(libs.bundles.compose.ui.test) - - // test - testImplementation(libs.junit) - testImplementation(libs.mockk.android) - testImplementation(libs.mockk.agent) - androidTestImplementation(libs.androidx.junit) - androidTestImplementation(libs.androidx.espresso.core) - androidTestImplementation(libs.mockk.android) - androidTestImplementation(libs.mockk.agent) } diff --git a/app/src/main/java/today/pathos/android/portfolio/core/di/ViewModule.kt b/app/src/main/java/today/pathos/android/portfolio/core/di/ViewModule.kt new file mode 100644 index 0000000..ccf6099 --- /dev/null +++ b/app/src/main/java/today/pathos/android/portfolio/core/di/ViewModule.kt @@ -0,0 +1,45 @@ +package today.pathos.android.portfolio.core.di + +import android.content.Context +import coil.ImageLoader +import coil.disk.DiskCache +import coil.memory.MemoryCache +import coil.util.DebugLogger +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.android.qualifiers.ApplicationContext +import dagger.hilt.components.SingletonComponent +import okhttp3.OkHttpClient +import today.pathos.android.portfolio.BuildConfig +import javax.inject.Singleton + +@InstallIn(SingletonComponent::class) +@Module +object ViewModule { + @Singleton + @Provides + fun providesImageLoader( + client: OkHttpClient, + @ApplicationContext context: Context, + ): ImageLoader = ImageLoader.Builder(context) + .callFactory { client } + .crossfade(true) + .memoryCache { + MemoryCache.Builder(context) + .maxSizePercent(0.25) + .build() + } + .diskCache { + DiskCache.Builder() + .directory(context.cacheDir.resolve("image_cache")) + .maxSizePercent(0.02) + .build() + } + .apply { + if (BuildConfig.DEBUG) { + logger(DebugLogger()) + } + } + .build() +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a4e27da..59d1d35 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,10 +1,3 @@ Android Portfolio 2024 - - Lv.%,d - 명성치 : %,d - <%s> - [%1$s] %2$s - Lv.%1$d %2$s - +%,d diff --git a/build.gradle.kts b/build.gradle.kts index 19c3a4f..4db7715 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,5 +6,7 @@ plugins { alias(libs.plugins.kotlinSerialization) apply false alias(libs.plugins.hiltAndroid) apply false alias(libs.plugins.ksp) apply false + alias(libs.plugins.androidxRoom) apply false alias(libs.plugins.secrets) apply false + alias(libs.plugins.jetbrainsKotlinJvm) apply false } diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/data/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 0000000..042ef3c --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,88 @@ +plugins { + alias(libs.plugins.androidLibrary) + alias(libs.plugins.kotlinAndroid) + alias(libs.plugins.kotlinSerialization) + alias(libs.plugins.hiltAndroid) + alias(libs.plugins.ksp) + alias(libs.plugins.androidxRoom) + alias(libs.plugins.secrets) +} + +android { + namespace = "today.pathos.android.portfolio.data" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + buildFeatures { + buildConfig = true + } + room { + schemaDirectory("$projectDir/schemas") + } + packaging { + resources { + excludes += "/META-INF/{LICENSE*.md}" + } + } +} + +secrets { + defaultPropertiesFileName = "local.defaults.properties" +} + +dependencies { + implementation(project(":entity")) + implementation(project(":domain")) + + // hilt + implementation(libs.dagger.hilt.android) + ksp(libs.dagger.hilt.compiler) + androidTestImplementation(libs.dagger.hilt.android.testing) + kspAndroidTest(libs.dagger.hilt.android.compiler) + testImplementation(libs.dagger.hilt.android.testing) + kspTest(libs.dagger.hilt.android.compiler) + + // kotlin + implementation(libs.bundles.kotlin) + testImplementation(libs.bundles.kotlin.test) + + // api + implementation(libs.bundles.retrofit) + testImplementation(libs.mockwebserver) + + // database + implementation(libs.androidx.room.runtime) + implementation(libs.androidx.room.ktx) + ksp(libs.androidx.room.compiler) + testImplementation(libs.androidx.room.testing) + + implementation(libs.androidx.datastore) + + // test + testImplementation(libs.junit) + testImplementation(libs.mockk.android) + testImplementation(libs.mockk.agent) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(libs.mockk.android) + androidTestImplementation(libs.mockk.agent) +} diff --git a/data/consumer-rules.pro b/data/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/data/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/data/schemas/today.pathos.android.portfolio.data.datasource.local.db.CacheDatabase/1.json b/data/schemas/today.pathos.android.portfolio.data.datasource.local.db.CacheDatabase/1.json new file mode 100644 index 0000000..d901f90 --- /dev/null +++ b/data/schemas/today.pathos.android.portfolio.data.datasource.local.db.CacheDatabase/1.json @@ -0,0 +1,376 @@ +{ + "formatVersion": 1, + "database": { + "version": 1, + "identityHash": "9be3ca79794285b741c34ebbabba54d1", + "entities": [ + { + "tableName": "FAME_TBL", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`server_id` TEXT NOT NULL, `character_id` TEXT NOT NULL, `character_name` TEXT NOT NULL, `level` INTEGER NOT NULL, `job_id` TEXT NOT NULL, `job_grow_id` TEXT NOT NULL, `job_name` TEXT NOT NULL, `job_grow_name` TEXT NOT NULL, `fame` INTEGER NOT NULL, PRIMARY KEY(`server_id`, `character_id`))", + "fields": [ + { + "fieldPath": "serverId", + "columnName": "server_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "characterId", + "columnName": "character_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "characterName", + "columnName": "character_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "level", + "columnName": "level", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "jobId", + "columnName": "job_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "jobGrowId", + "columnName": "job_grow_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "jobName", + "columnName": "job_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "jobGrowName", + "columnName": "job_grow_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "fame", + "columnName": "fame", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "server_id", + "character_id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "CHARACTER_TBL", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`server_id` TEXT NOT NULL, `character_id` TEXT NOT NULL, `character_name` TEXT NOT NULL, `level` INTEGER NOT NULL, `job_id` TEXT NOT NULL, `job_grow_id` TEXT NOT NULL, `job_name` TEXT NOT NULL, `job_grow_name` TEXT NOT NULL, `fame` INTEGER NOT NULL, `adventure_name` TEXT, `guild_id` TEXT, `guild_name` TEXT, PRIMARY KEY(`server_id`, `character_id`))", + "fields": [ + { + "fieldPath": "serverId", + "columnName": "server_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "characterId", + "columnName": "character_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "characterName", + "columnName": "character_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "level", + "columnName": "level", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "jobId", + "columnName": "job_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "jobGrowId", + "columnName": "job_grow_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "jobName", + "columnName": "job_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "jobGrowName", + "columnName": "job_grow_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "fame", + "columnName": "fame", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "adventureName", + "columnName": "adventure_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "guildId", + "columnName": "guild_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "guildName", + "columnName": "guild_name", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "server_id", + "character_id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "EQUIPMENT_TBL", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`server_id` TEXT NOT NULL, `character_id` TEXT NOT NULL, `item_id` TEXT NOT NULL, `item_name` TEXT NOT NULL, `slot_id` TEXT NOT NULL, `slot_name` TEXT NOT NULL, `item_type_id` TEXT NOT NULL, `item_type` TEXT NOT NULL, `item_type_detail_id` TEXT NOT NULL, `item_type_detail` TEXT NOT NULL, `item_available_level` INTEGER NOT NULL, `item_rarity` TEXT NOT NULL, `set_item_id` TEXT, `set_item_name` TEXT, `reinforce` INTEGER NOT NULL, `item_grade_name` TEXT, `amplification_name` TEXT, `expired_date` INTEGER, `refine` INTEGER NOT NULL, PRIMARY KEY(`server_id`, `character_id`, `item_id`))", + "fields": [ + { + "fieldPath": "serverId", + "columnName": "server_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "characterId", + "columnName": "character_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemId", + "columnName": "item_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemName", + "columnName": "item_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "slotId", + "columnName": "slot_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "slotName", + "columnName": "slot_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemTypeId", + "columnName": "item_type_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemType", + "columnName": "item_type", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemTypeDetailId", + "columnName": "item_type_detail_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemTypeDetail", + "columnName": "item_type_detail", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemAvailableLevel", + "columnName": "item_available_level", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "itemRarity", + "columnName": "item_rarity", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "setItemId", + "columnName": "set_item_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "setItemName", + "columnName": "set_item_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "reinforce", + "columnName": "reinforce", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "itemGradeName", + "columnName": "item_grade_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "amplificationName", + "columnName": "amplification_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "expiredDate", + "columnName": "expired_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "refine", + "columnName": "refine", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "server_id", + "character_id", + "item_id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "AVATAR_TBL", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`server_id` TEXT NOT NULL, `character_id` TEXT NOT NULL, `item_id` TEXT NOT NULL, `item_name` TEXT NOT NULL, `slot_id` TEXT NOT NULL, `slot_name` TEXT NOT NULL, `clone_item_id` TEXT, `clone_item_name` TEXT, `item_rarity` TEXT NOT NULL, `option_ability` TEXT, PRIMARY KEY(`server_id`, `character_id`, `item_id`))", + "fields": [ + { + "fieldPath": "serverId", + "columnName": "server_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "characterId", + "columnName": "character_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemId", + "columnName": "item_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "itemName", + "columnName": "item_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "slotId", + "columnName": "slot_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "slotName", + "columnName": "slot_name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cloneItemId", + "columnName": "clone_item_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "cloneItemName", + "columnName": "clone_item_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "itemRarity", + "columnName": "item_rarity", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "optionAbility", + "columnName": "option_ability", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "server_id", + "character_id", + "item_id" + ] + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9be3ca79794285b741c34ebbabba54d1')" + ] + } +} \ No newline at end of file diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8bdb7e1 --- /dev/null +++ b/data/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/LocalDataSource.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/LocalDataSource.kt similarity index 95% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/LocalDataSource.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/LocalDataSource.kt index 9d7e749..5ef1bdd 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/LocalDataSource.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/LocalDataSource.kt @@ -9,7 +9,6 @@ import today.pathos.android.portfolio.data.datasource.local.db.table.FameTbl import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResAvatar import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResCharacter import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResEquipment -import today.pathos.android.portfolio.entity.Character import javax.inject.Inject class LocalDataSource @Inject constructor( @@ -29,7 +28,6 @@ class LocalDataSource @Inject constructor( serverId = checkNotNull(it.serverId), characterId = it.characterId, characterName = it.characterName, - characterImage = Character.getCharacterImageUrl(it.serverId, it.characterId, 3), level = it.level, jobId = it.jobId, jobGrowId = it.jobGrowId, @@ -60,7 +58,6 @@ class LocalDataSource @Inject constructor( serverId = serverId, characterId = character.characterId, characterName = character.characterName, - characterImage = Character.getCharacterImageUrl(serverId, character.characterId, 3), level = character.level, jobId = character.jobId, jobGrowId = character.jobGrowId, diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/CacheDatabase.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/CacheDatabase.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/CacheDatabase.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/CacheDatabase.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/CharacterDao.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/CharacterDao.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/CharacterDao.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/CharacterDao.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/FameDao.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/FameDao.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/FameDao.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/dao/FameDao.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/AvatarTbl.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/AvatarTbl.kt similarity index 90% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/AvatarTbl.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/AvatarTbl.kt index 5fbdc4e..26331a9 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/AvatarTbl.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/AvatarTbl.kt @@ -2,9 +2,7 @@ package today.pathos.android.portfolio.data.datasource.local.db.table import androidx.room.ColumnInfo import androidx.room.Entity -import androidx.room.PrimaryKey import today.pathos.android.portfolio.entity.AvatarSlotId -import today.pathos.android.portfolio.entity.EquipmentSlotId @Entity( tableName = "AVATAR_TBL", diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/CharacterTbl.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/CharacterTbl.kt similarity index 93% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/CharacterTbl.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/CharacterTbl.kt index 871a27b..48b547c 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/CharacterTbl.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/CharacterTbl.kt @@ -11,7 +11,6 @@ data class CharacterTbl( @ColumnInfo(name = "server_id") val serverId: String, @ColumnInfo(name = "character_id") val characterId: String, @ColumnInfo(name = "character_name") val characterName: String, - @ColumnInfo(name = "character_image") val characterImage: String, @ColumnInfo(name = "level") val level: Int, @ColumnInfo(name = "job_id") val jobId: String, @ColumnInfo(name = "job_grow_id") val jobGrowId: String, diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/EquipmentTbl.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/EquipmentTbl.kt similarity index 97% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/EquipmentTbl.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/EquipmentTbl.kt index 17e0b16..7e05a39 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/EquipmentTbl.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/EquipmentTbl.kt @@ -2,7 +2,6 @@ package today.pathos.android.portfolio.data.datasource.local.db.table import androidx.room.ColumnInfo import androidx.room.Entity -import androidx.room.PrimaryKey import today.pathos.android.portfolio.entity.EquipmentSlotId @Entity( diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/FameTbl.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/FameTbl.kt similarity index 91% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/FameTbl.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/FameTbl.kt index c1446cf..4f0eb19 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/FameTbl.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/datasource/local/db/table/FameTbl.kt @@ -11,7 +11,6 @@ data class FameTbl( @ColumnInfo(name = "server_id") val serverId: String, @ColumnInfo(name = "character_id") val characterId: String, @ColumnInfo(name = "character_name") val characterName: String, - @ColumnInfo(name = "character_image") val characterImage: String, @ColumnInfo(name = "level") val level: Int, @ColumnInfo(name = "job_id") val jobId: String, @ColumnInfo(name = "job_grow_id") val jobGrowId: String, diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSource.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSource.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSource.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSource.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResAvatar.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResAvatar.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResAvatar.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResAvatar.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResCharacter.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResCharacter.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResCharacter.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResCharacter.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResEquipment.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResEquipment.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResEquipment.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResEquipment.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResError.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResError.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResError.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResError.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResItem.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResItem.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResItem.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResItem.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResRows.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResRows.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResRows.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResRows.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResServer.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResServer.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResServer.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/dto/res/ResServer.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/service/DNFService.kt b/data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/service/DNFService.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/data/datasource/remote/service/DNFService.kt rename to data/src/main/java/today/pathos/android/portfolio/data/datasource/remote/service/DNFService.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/core/di/CoroutinesModule.kt b/data/src/main/java/today/pathos/android/portfolio/data/di/CoroutinesModule.kt similarity index 95% rename from app/src/main/java/today/pathos/android/portfolio/core/di/CoroutinesModule.kt rename to data/src/main/java/today/pathos/android/portfolio/data/di/CoroutinesModule.kt index 4f62888..74761a2 100644 --- a/app/src/main/java/today/pathos/android/portfolio/core/di/CoroutinesModule.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/di/CoroutinesModule.kt @@ -1,4 +1,4 @@ -package today.pathos.android.portfolio.core.di +package today.pathos.android.portfolio.data.di import dagger.Module import dagger.Provides diff --git a/app/src/main/java/today/pathos/android/portfolio/core/di/LocalModule.kt b/data/src/main/java/today/pathos/android/portfolio/data/di/LocalModule.kt similarity index 95% rename from app/src/main/java/today/pathos/android/portfolio/core/di/LocalModule.kt rename to data/src/main/java/today/pathos/android/portfolio/data/di/LocalModule.kt index b5c6ef2..3c93ca4 100644 --- a/app/src/main/java/today/pathos/android/portfolio/core/di/LocalModule.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/di/LocalModule.kt @@ -1,4 +1,4 @@ -package today.pathos.android.portfolio.core.di +package today.pathos.android.portfolio.data.di import android.content.Context import androidx.room.Room diff --git a/app/src/main/java/today/pathos/android/portfolio/core/di/NetworkModule.kt b/data/src/main/java/today/pathos/android/portfolio/data/di/NetworkModule.kt similarity index 66% rename from app/src/main/java/today/pathos/android/portfolio/core/di/NetworkModule.kt rename to data/src/main/java/today/pathos/android/portfolio/data/di/NetworkModule.kt index 5bb6e32..ae9d177 100644 --- a/app/src/main/java/today/pathos/android/portfolio/core/di/NetworkModule.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/di/NetworkModule.kt @@ -1,14 +1,8 @@ -package today.pathos.android.portfolio.core.di +package today.pathos.android.portfolio.data.di -import android.content.Context -import coil.ImageLoader -import coil.disk.DiskCache -import coil.memory.MemoryCache -import coil.util.DebugLogger import dagger.Module import dagger.Provides import dagger.hilt.InstallIn -import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent import kotlinx.serialization.json.Json import okhttp3.MediaType.Companion.toMediaType @@ -16,7 +10,7 @@ import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit import retrofit2.converter.kotlinx.serialization.asConverterFactory -import today.pathos.android.portfolio.BuildConfig +import today.pathos.android.portfolio.data.BuildConfig import today.pathos.android.portfolio.data.datasource.remote.service.DNFService import javax.inject.Singleton @@ -74,30 +68,4 @@ object NetworkModule { @Singleton @Provides fun providesDNFService(retrofit: Retrofit): DNFService = retrofit.create(DNFService::class.java) - - @Singleton - @Provides - fun providesImageLoader( - client: OkHttpClient, - @ApplicationContext context: Context, - ): ImageLoader = ImageLoader.Builder(context) - .callFactory { client } - .crossfade(true) - .memoryCache { - MemoryCache.Builder(context) - .maxSizePercent(0.25) - .build() - } - .diskCache { - DiskCache.Builder() - .directory(context.cacheDir.resolve("image_cache")) - .maxSizePercent(0.02) - .build() - } - .apply { - if (BuildConfig.DEBUG) { - logger(DebugLogger()) - } - } - .build() } diff --git a/app/src/main/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepository.kt b/data/src/main/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepository.kt similarity index 89% rename from app/src/main/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepository.kt rename to data/src/main/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepository.kt index 151b0d6..c37147d 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepository.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepository.kt @@ -2,14 +2,12 @@ package today.pathos.android.portfolio.data.repository import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext -import today.pathos.android.portfolio.core.di.IoDispatcher import today.pathos.android.portfolio.data.datasource.remote.NetworkDataSource import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResAvatar import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResCharacter import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResEquipment import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResItem -import today.pathos.android.portfolio.domain.repository.CharacterRepository -import today.pathos.android.portfolio.entity.Avatar +import today.pathos.android.portfolio.data.di.IoDispatcher import today.pathos.android.portfolio.entity.Character import today.pathos.android.portfolio.entity.Equipment import today.pathos.android.portfolio.entity.Item @@ -18,7 +16,7 @@ import javax.inject.Inject class NetworkCharacterRepository @Inject constructor( private val dataSource: NetworkDataSource, @IoDispatcher private val dispatcher: CoroutineDispatcher, -) : CharacterRepository { +) : today.pathos.android.portfolio.domain.repository.CharacterRepository { override suspend fun getCharacter( serverId: String, characterId: String, @@ -36,7 +34,7 @@ class NetworkCharacterRepository @Inject constructor( override suspend fun getCharacterAvatar( serverId: String, characterId: String, - ): List = withContext(dispatcher) { + ): List = withContext(dispatcher) { dataSource.getCharacterAvatar(serverId, characterId).avatar.toEntity() } @@ -49,7 +47,6 @@ private fun ResCharacter.toEntity(serverId: String) = Character( serverId = serverId, characterId = characterId, characterName = characterName, - characterImage = Character.getCharacterImageUrl(serverId, characterId, 3), level = level, jobId = jobId, jobGrowId = jobGrowId, @@ -84,7 +81,7 @@ private fun ResEquipment.toEntity() = Equipment( @JvmName("callFromEquipment") private fun List.toEntity() = map { it.toEntity() } -private fun ResAvatar.toEntity() = Avatar( +private fun ResAvatar.toEntity() = today.pathos.android.portfolio.entity.Avatar( slotId = slotId, slotName = slotName, itemId = itemId, @@ -101,7 +98,6 @@ private fun List.toEntity() = map { it.toEntity() } private fun ResItem.toEntity() = Item( itemId = itemId, itemName = itemName, - itemImage = Item.getItemImageUrl(itemId), itemRarity = itemRarity, itemTypeId = itemTypeId, itemType = itemType, diff --git a/app/src/main/java/today/pathos/android/portfolio/data/repository/NetworkFameRepository.kt b/data/src/main/java/today/pathos/android/portfolio/data/repository/NetworkFameRepository.kt similarity index 89% rename from app/src/main/java/today/pathos/android/portfolio/data/repository/NetworkFameRepository.kt rename to data/src/main/java/today/pathos/android/portfolio/data/repository/NetworkFameRepository.kt index 97c0e00..1037639 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/repository/NetworkFameRepository.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/repository/NetworkFameRepository.kt @@ -2,9 +2,9 @@ package today.pathos.android.portfolio.data.repository import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext -import today.pathos.android.portfolio.core.di.IoDispatcher import today.pathos.android.portfolio.data.datasource.remote.NetworkDataSource import today.pathos.android.portfolio.data.datasource.remote.dto.res.ResCharacter +import today.pathos.android.portfolio.data.di.IoDispatcher import today.pathos.android.portfolio.domain.repository.FameRepository import today.pathos.android.portfolio.entity.Character import javax.inject.Inject @@ -22,7 +22,6 @@ private fun ResCharacter.toEntity() = Character( serverId = checkNotNull(serverId), characterId = characterId, characterName = characterName, - characterImage = Character.getCharacterImageUrl(serverId, characterId, 3), level = level, jobId = jobId, jobGrowId = jobGrowId, diff --git a/app/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstCharacterRepository.kt b/data/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstCharacterRepository.kt similarity index 97% rename from app/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstCharacterRepository.kt rename to data/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstCharacterRepository.kt index 946e13d..c221198 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstCharacterRepository.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstCharacterRepository.kt @@ -2,12 +2,12 @@ package today.pathos.android.portfolio.data.repository import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext -import today.pathos.android.portfolio.core.di.IoDispatcher import today.pathos.android.portfolio.data.datasource.local.LocalDataSource import today.pathos.android.portfolio.data.datasource.local.db.table.AvatarTbl import today.pathos.android.portfolio.data.datasource.local.db.table.CharacterTbl import today.pathos.android.portfolio.data.datasource.local.db.table.EquipmentTbl import today.pathos.android.portfolio.data.datasource.remote.NetworkDataSource +import today.pathos.android.portfolio.data.di.IoDispatcher import today.pathos.android.portfolio.domain.repository.CharacterRepository import today.pathos.android.portfolio.entity.Avatar import today.pathos.android.portfolio.entity.Character @@ -66,7 +66,6 @@ private fun CharacterTbl.toEntity() = Character( serverId = serverId, characterId = characterId, characterName = characterName, - characterImage = characterImage, level = level, jobId = jobId, jobGrowId = jobGrowId, diff --git a/app/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstFameRepository.kt b/data/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstFameRepository.kt similarity index 93% rename from app/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstFameRepository.kt rename to data/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstFameRepository.kt index c45330c..2293bb9 100644 --- a/app/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstFameRepository.kt +++ b/data/src/main/java/today/pathos/android/portfolio/data/repository/OfflineFirstFameRepository.kt @@ -2,10 +2,10 @@ package today.pathos.android.portfolio.data.repository import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext -import today.pathos.android.portfolio.core.di.IoDispatcher import today.pathos.android.portfolio.data.datasource.local.LocalDataSource import today.pathos.android.portfolio.data.datasource.local.db.table.FameTbl import today.pathos.android.portfolio.data.datasource.remote.NetworkDataSource +import today.pathos.android.portfolio.data.di.IoDispatcher import today.pathos.android.portfolio.domain.repository.FameRepository import today.pathos.android.portfolio.entity.Character import javax.inject.Inject @@ -29,7 +29,6 @@ private fun FameTbl.toEntity() = Character( serverId = serverId, characterId = characterId, characterName = characterName, - characterImage = characterImage, level = level, jobId = jobId, jobGrowId = jobGrowId, diff --git a/app/src/test/java/today/pathos/android/portfolio/data/datasource/remote/MockServerRule.kt b/data/src/test/java/today/pathos/android/portfolio/data/datasource/remote/MockServerRule.kt similarity index 100% rename from app/src/test/java/today/pathos/android/portfolio/data/datasource/remote/MockServerRule.kt rename to data/src/test/java/today/pathos/android/portfolio/data/datasource/remote/MockServerRule.kt diff --git a/app/src/test/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSourceTest.kt b/data/src/test/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSourceTest.kt similarity index 100% rename from app/src/test/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSourceTest.kt rename to data/src/test/java/today/pathos/android/portfolio/data/datasource/remote/NetworkDataSourceTest.kt diff --git a/app/src/test/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepositoryTest.kt b/data/src/test/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepositoryTest.kt similarity index 100% rename from app/src/test/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepositoryTest.kt rename to data/src/test/java/today/pathos/android/portfolio/data/repository/NetworkCharacterRepositoryTest.kt diff --git a/app/src/test/java/today/pathos/android/portfolio/data/repository/NetworkFameRepositoryTest.kt b/data/src/test/java/today/pathos/android/portfolio/data/repository/NetworkFameRepositoryTest.kt similarity index 100% rename from app/src/test/java/today/pathos/android/portfolio/data/repository/NetworkFameRepositoryTest.kt rename to data/src/test/java/today/pathos/android/portfolio/data/repository/NetworkFameRepositoryTest.kt diff --git a/app/src/test/resources/api-response/401_not_found_apikey.json b/data/src/test/resources/api-response/401_not_found_apikey.json similarity index 100% rename from app/src/test/resources/api-response/401_not_found_apikey.json rename to data/src/test/resources/api-response/401_not_found_apikey.json diff --git a/app/src/test/resources/api-response/404_not_found_character.json b/data/src/test/resources/api-response/404_not_found_character.json similarity index 100% rename from app/src/test/resources/api-response/404_not_found_character.json rename to data/src/test/resources/api-response/404_not_found_character.json diff --git a/app/src/test/resources/api-response/getCharacterAvatar.json b/data/src/test/resources/api-response/getCharacterAvatar.json similarity index 100% rename from app/src/test/resources/api-response/getCharacterAvatar.json rename to data/src/test/resources/api-response/getCharacterAvatar.json diff --git a/app/src/test/resources/api-response/getCharacterEquipment.json b/data/src/test/resources/api-response/getCharacterEquipment.json similarity index 100% rename from app/src/test/resources/api-response/getCharacterEquipment.json rename to data/src/test/resources/api-response/getCharacterEquipment.json diff --git a/app/src/test/resources/api-response/getCharacterFame.json b/data/src/test/resources/api-response/getCharacterFame.json similarity index 100% rename from app/src/test/resources/api-response/getCharacterFame.json rename to data/src/test/resources/api-response/getCharacterFame.json diff --git a/app/src/test/resources/api-response/getCharacterInfo.json b/data/src/test/resources/api-response/getCharacterInfo.json similarity index 100% rename from app/src/test/resources/api-response/getCharacterInfo.json rename to data/src/test/resources/api-response/getCharacterInfo.json diff --git a/app/src/test/resources/api-response/getItemInfo.json b/data/src/test/resources/api-response/getItemInfo.json similarity index 100% rename from app/src/test/resources/api-response/getItemInfo.json rename to data/src/test/resources/api-response/getItemInfo.json diff --git a/app/src/test/resources/api-response/getServerList.json b/data/src/test/resources/api-response/getServerList.json similarity index 100% rename from app/src/test/resources/api-response/getServerList.json rename to data/src/test/resources/api-response/getServerList.json diff --git a/app/src/test/resources/api-response/searchCharacter.json b/data/src/test/resources/api-response/searchCharacter.json similarity index 100% rename from app/src/test/resources/api-response/searchCharacter.json rename to data/src/test/resources/api-response/searchCharacter.json diff --git a/domain/.gitignore b/domain/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/domain/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts new file mode 100644 index 0000000..8bb09c7 --- /dev/null +++ b/domain/build.gradle.kts @@ -0,0 +1,48 @@ +plugins { + alias(libs.plugins.androidLibrary) + alias(libs.plugins.kotlinAndroid) + alias(libs.plugins.hiltAndroid) + alias(libs.plugins.ksp) +} + +android { + namespace = "today.pathos.android.portfolio.domain" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } +} + +dependencies { + implementation(project(":entity")) + + // hilt + implementation(libs.dagger.hilt.android) + ksp(libs.dagger.hilt.compiler) + androidTestImplementation(libs.dagger.hilt.android.testing) + kspAndroidTest(libs.dagger.hilt.android.compiler) + testImplementation(libs.dagger.hilt.android.testing) + kspTest(libs.dagger.hilt.android.compiler) + + // kotlin + implementation(libs.bundles.kotlin) + testImplementation(libs.bundles.kotlin.test) +} diff --git a/domain/consumer-rules.pro b/domain/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/domain/proguard-rules.pro b/domain/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/domain/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/domain/src/main/AndroidManifest.xml b/domain/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8bdb7e1 --- /dev/null +++ b/domain/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/java/today/pathos/android/portfolio/domain/repository/CharacterRepository.kt b/domain/src/main/java/today/pathos/android/portfolio/domain/repository/CharacterRepository.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/domain/repository/CharacterRepository.kt rename to domain/src/main/java/today/pathos/android/portfolio/domain/repository/CharacterRepository.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/domain/repository/FameRepository.kt b/domain/src/main/java/today/pathos/android/portfolio/domain/repository/FameRepository.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/domain/repository/FameRepository.kt rename to domain/src/main/java/today/pathos/android/portfolio/domain/repository/FameRepository.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/domain/usecase/GetCharacterInfoUseCase.kt b/domain/src/main/java/today/pathos/android/portfolio/domain/usecase/GetCharacterInfoUseCase.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/domain/usecase/GetCharacterInfoUseCase.kt rename to domain/src/main/java/today/pathos/android/portfolio/domain/usecase/GetCharacterInfoUseCase.kt diff --git a/entity/.gitignore b/entity/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/entity/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/entity/build.gradle.kts b/entity/build.gradle.kts new file mode 100644 index 0000000..94084c5 --- /dev/null +++ b/entity/build.gradle.kts @@ -0,0 +1,15 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +plugins { + id("java-library") + alias(libs.plugins.jetbrainsKotlinJvm) +} +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} +kotlin { + compilerOptions { + jvmTarget = JvmTarget.JVM_17 + } +} diff --git a/app/src/main/java/today/pathos/android/portfolio/entity/Avatar.kt b/entity/src/main/java/today/pathos/android/portfolio/entity/Avatar.kt similarity index 74% rename from app/src/main/java/today/pathos/android/portfolio/entity/Avatar.kt rename to entity/src/main/java/today/pathos/android/portfolio/entity/Avatar.kt index cbc955a..b4cfb07 100644 --- a/app/src/main/java/today/pathos/android/portfolio/entity/Avatar.kt +++ b/entity/src/main/java/today/pathos/android/portfolio/entity/Avatar.kt @@ -1,8 +1,5 @@ package today.pathos.android.portfolio.entity -import kotlinx.serialization.Serializable -import today.pathos.android.portfolio.entity.AvatarSlotId - data class Avatar( val slotId: AvatarSlotId, val slotName: String, diff --git a/app/src/main/java/today/pathos/android/portfolio/entity/AvatarSlotId.kt b/entity/src/main/java/today/pathos/android/portfolio/entity/AvatarSlotId.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/entity/AvatarSlotId.kt rename to entity/src/main/java/today/pathos/android/portfolio/entity/AvatarSlotId.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/entity/Character.kt b/entity/src/main/java/today/pathos/android/portfolio/entity/Character.kt similarity index 59% rename from app/src/main/java/today/pathos/android/portfolio/entity/Character.kt rename to entity/src/main/java/today/pathos/android/portfolio/entity/Character.kt index cfa07f7..202d8e2 100644 --- a/app/src/main/java/today/pathos/android/portfolio/entity/Character.kt +++ b/entity/src/main/java/today/pathos/android/portfolio/entity/Character.kt @@ -1,12 +1,9 @@ package today.pathos.android.portfolio.entity -import today.pathos.android.portfolio.BuildConfig - data class Character( val serverId: String, val characterId: String, val characterName: String, - val characterImage: String, val level: Int, val jobId: String, val jobGrowId: String, @@ -18,15 +15,5 @@ data class Character( val guildName: String? = null, val equipment: List = emptyList(), val avatar: List = emptyList() -) { - - companion object { - fun getCharacterImageUrl( - serverId: String, - characterId: String, - zoom: Int, - ): String = - BuildConfig.CHARACTER_IMAGE_URL.format(serverId, characterId, zoom) - } -} +) diff --git a/app/src/main/java/today/pathos/android/portfolio/entity/Equipment.kt b/entity/src/main/java/today/pathos/android/portfolio/entity/Equipment.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/entity/Equipment.kt rename to entity/src/main/java/today/pathos/android/portfolio/entity/Equipment.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/entity/EquipmentSlotId.kt b/entity/src/main/java/today/pathos/android/portfolio/entity/EquipmentSlotId.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/entity/EquipmentSlotId.kt rename to entity/src/main/java/today/pathos/android/portfolio/entity/EquipmentSlotId.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/entity/Item.kt b/entity/src/main/java/today/pathos/android/portfolio/entity/Item.kt similarity index 64% rename from app/src/main/java/today/pathos/android/portfolio/entity/Item.kt rename to entity/src/main/java/today/pathos/android/portfolio/entity/Item.kt index 21ea99f..ba0fd77 100644 --- a/app/src/main/java/today/pathos/android/portfolio/entity/Item.kt +++ b/entity/src/main/java/today/pathos/android/portfolio/entity/Item.kt @@ -1,11 +1,8 @@ package today.pathos.android.portfolio.entity -import today.pathos.android.portfolio.BuildConfig - data class Item( val itemId: String, val itemName: String, - val itemImage: String, val itemRarity: String, val itemTypeId: String, val itemType: String, @@ -17,13 +14,5 @@ data class Item( val itemFlavorText: String, val setItemId: String?, val setItemName: String?, -) { - - companion object { - fun getItemImageUrl( - itemId: String, - ): String = - BuildConfig.ITEM_IMAGE_URL.format(itemId) - } -} +) diff --git a/fastlane/report.xml b/fastlane/report.xml index da35309..cb7ca90 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,12 +5,12 @@ - + - + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index caf1e4b..aec467d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,6 +32,9 @@ junit = "4.13.2" junitExt = "1.1.5" espressoCore = "3.5.1" mockk = "1.13.10" +jetbrainsKotlinJvm = "1.9.23" +appcompat = "1.6.1" +material = "1.10.0" [libraries] core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } @@ -84,6 +87,8 @@ androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junitExt" androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" } mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" } mockk-agent = { module = "io.mockk:mockk-agent", version.ref = "mockk" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } [bundles] kotlin = ["kotlinx-coroutines-core", "kotlinx-datetime", "kotlinx-serialization"] @@ -101,10 +106,12 @@ compose-ui-test = ["androidx-ui-tooling", "androidx-ui-test-manifest"] retrofit = ["retrofit", "retrofit-converter-kotlin-serialization", "retrofit-interceptor-logging"] [plugins] +jetbrainsKotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "jetbrainsKotlinJvm" } androidApplication = { id = "com.android.application", version.ref = "agp" } androidLibrary = { id = "com.android.library", version.ref = "agp" } kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } hiltAndroid = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +androidxRoom = { id = "androidx.room", version.ref = "room" } secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets" } diff --git a/local.defaults.properties b/local.defaults.properties index d0c62e2..564c354 100644 --- a/local.defaults.properties +++ b/local.defaults.properties @@ -1,4 +1,2 @@ API_URL=DEFAULT_API_URL API_KEY=DEFAULT_API_KEY -CHARACTER_IMAGE_URL=DEFAULT_CHARACTER_IMAGE_URL -ITEM_IMAGE_URL=DEFAULT_ITEM_IMAGE_URL diff --git a/presentation/.gitignore b/presentation/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/presentation/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts new file mode 100644 index 0000000..c85cc87 --- /dev/null +++ b/presentation/build.gradle.kts @@ -0,0 +1,61 @@ +plugins { + alias(libs.plugins.androidLibrary) + alias(libs.plugins.kotlinAndroid) + alias(libs.plugins.hiltAndroid) + alias(libs.plugins.ksp) +} + +android { + namespace = "today.pathos.android.portfolio.presentation" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } + buildFeatures { + buildConfig = true + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.composeKotlinCompiler.get() + } +} + +dependencies { + implementation(project(":entity")) + implementation(project(":domain")) + + // hilt + implementation(libs.dagger.hilt.android) + ksp(libs.dagger.hilt.compiler) + androidTestImplementation(libs.dagger.hilt.android.testing) + kspAndroidTest(libs.dagger.hilt.android.compiler) + testImplementation(libs.dagger.hilt.android.testing) + kspTest(libs.dagger.hilt.android.compiler) + + implementation(libs.androidx.lifecycle.runtime.compose) + + // compose + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.bundles.compose) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.bundles.compose.android.test) + debugImplementation(libs.bundles.compose.ui.test) +} diff --git a/presentation/consumer-rules.pro b/presentation/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/presentation/proguard-rules.pro b/presentation/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/presentation/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/app/src/androidTest/java/today/pathos/android/portfolio/ExampleInstrumentedTest.kt b/presentation/src/androidTest/java/today/pathos/android/portfolio/presentation/ExampleInstrumentedTest.kt similarity index 79% rename from app/src/androidTest/java/today/pathos/android/portfolio/ExampleInstrumentedTest.kt rename to presentation/src/androidTest/java/today/pathos/android/portfolio/presentation/ExampleInstrumentedTest.kt index 0ed3d91..953404c 100644 --- a/app/src/androidTest/java/today/pathos/android/portfolio/ExampleInstrumentedTest.kt +++ b/presentation/src/androidTest/java/today/pathos/android/portfolio/presentation/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package today.pathos.android.portfolio +package today.pathos.android.portfolio.presentation import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -19,6 +19,6 @@ class ExampleInstrumentedTest { fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("android.template", appContext.packageName) + assertEquals("today.pathos.android.portfolio.presentation.test", appContext.packageName) } } diff --git a/presentation/src/main/AndroidManifest.xml b/presentation/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8bdb7e1 --- /dev/null +++ b/presentation/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/state/PortfolioAppState.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/state/PortfolioAppState.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/state/PortfolioAppState.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/state/PortfolioAppState.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioApp.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioApp.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioApp.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioApp.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioNavHost.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioNavHost.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioNavHost.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/PortfolioNavHost.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterInfo.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterInfo.kt similarity index 94% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterInfo.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterInfo.kt index c71d319..95353bc 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterInfo.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterInfo.kt @@ -1,10 +1,8 @@ package today.pathos.android.portfolio.presentation.view.character -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -18,7 +16,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest -import today.pathos.android.portfolio.R +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.view.theme.Typography @Composable diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterWithEquipment.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterWithEquipment.kt similarity index 91% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterWithEquipment.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterWithEquipment.kt index c2263ef..9d89578 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterWithEquipment.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/CharacterWithEquipment.kt @@ -8,9 +8,11 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import today.pathos.android.portfolio.entity.Character +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.viewmodel.ItemSlotInfo @Composable @@ -31,7 +33,7 @@ fun CharacterWithEquipment( CharacterInfo( guildName = guildName, serverName = serverId, - characterImage = characterImage, + characterImage = stringResource(id = R.string.character_image_url, serverId, characterId, 3), characterName = characterName, level = level, jobGrowName = jobGrowName, @@ -62,7 +64,6 @@ fun CharacterWithEquipmentPreview() { serverId = "서버아이디", characterId = "", characterName = "캐릭터이름", - characterImage = "", level = 50, jobId = "", jobGrowId = "클래스이름", diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentAccessoryInfo.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentAccessoryInfo.kt similarity index 78% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentAccessoryInfo.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentAccessoryInfo.kt index 0c4e29c..09da2e8 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentAccessoryInfo.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentAccessoryInfo.kt @@ -8,8 +8,10 @@ import androidx.compose.foundation.lazy.grid.items import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.viewmodel.ItemSlotInfo @Composable @@ -32,7 +34,7 @@ fun EquipmentAccessoryInfo( ) { armor -> ItemSlot( reinforce = armor.reinforce, - itemImage = armor.itemImage + itemImage = stringResource(id = R.string.item_image_url, armor.itemId) ) } } @@ -43,12 +45,12 @@ fun EquipmentAccessoryInfo( fun EquipmentAccessoryInfoPreview() { EquipmentAccessoryInfo( armorList = listOf( - ItemSlotInfo("", "", null), - ItemSlotInfo("", "", 15), - ItemSlotInfo("", "", 3), - ItemSlotInfo("", "", 2), - ItemSlotInfo("", "", 5), - ItemSlotInfo("", "", null), + ItemSlotInfo("", null), + ItemSlotInfo("", 15), + ItemSlotInfo("", 3), + ItemSlotInfo("", 2), + ItemSlotInfo("", 5), + ItemSlotInfo("", null), ), ) } diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentArmorInfo.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentArmorInfo.kt similarity index 77% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentArmorInfo.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentArmorInfo.kt index 7328597..5072b52 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentArmorInfo.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/EquipmentArmorInfo.kt @@ -8,8 +8,10 @@ import androidx.compose.foundation.lazy.grid.items import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.viewmodel.ItemSlotInfo @Composable @@ -32,7 +34,7 @@ fun EquipmentArmorInfo( ) { armor -> ItemSlot( reinforce = armor.reinforce, - itemImage = armor.itemImage + itemImage = stringResource(id = R.string.item_image_url, armor.itemId) ) } } @@ -43,12 +45,12 @@ fun EquipmentArmorInfo( fun EquipmentArmorInfoPreview() { EquipmentArmorInfo( armorList = listOf( - ItemSlotInfo("", "", null), - ItemSlotInfo("", "", 15), - ItemSlotInfo("", "", 3), - ItemSlotInfo("", "", 2), - ItemSlotInfo("", "", 5), - ItemSlotInfo("", "", null), + ItemSlotInfo("", null), + ItemSlotInfo("", 15), + ItemSlotInfo("", 3), + ItemSlotInfo("", 2), + ItemSlotInfo("", 5), + ItemSlotInfo("", null), ), ) } diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/ItemSlot.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/ItemSlot.kt similarity index 96% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/character/ItemSlot.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/ItemSlot.kt index c36e097..6b5397c 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/character/ItemSlot.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/character/ItemSlot.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -22,7 +21,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest -import today.pathos.android.portfolio.R +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.view.theme.Typography @Composable diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/widget/FameCarousel.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/fame/FameCarousel.kt similarity index 87% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/widget/FameCarousel.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/fame/FameCarousel.kt index cac159e..a172e71 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/widget/FameCarousel.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/fame/FameCarousel.kt @@ -1,4 +1,4 @@ -package today.pathos.android.portfolio.presentation.view.widget +package today.pathos.android.portfolio.presentation.view.fame import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background @@ -14,17 +14,18 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.util.lerp -import today.pathos.android.portfolio.entity.Character +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.view.item.FameCarouselItem import kotlin.math.absoluteValue @OptIn(ExperimentalFoundationApi::class) @Composable fun FameCarousel( - fameList: List, + fameList: List, modifier: Modifier = Modifier, initialPage: Int = 0, ) { @@ -45,7 +46,12 @@ fun FameCarousel( FameCarouselItem( rank = (page + 1).toString(), - characterImage = character.characterImage, + characterImage = stringResource( + id = R.string.character_image_url, + character.serverId, + character.characterId, + 3 + ), characterName = character.characterName, level = character.level, jobGrowName = character.jobGrowName, diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameCarouselItem.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameCarouselItem.kt similarity index 98% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameCarouselItem.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameCarouselItem.kt index 7ddf132..815312f 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameCarouselItem.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameCarouselItem.kt @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text @@ -26,7 +25,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest -import today.pathos.android.portfolio.R +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.view.theme.Typography @Composable diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameItem.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameItem.kt similarity index 98% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameItem.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameItem.kt index 3e54c7f..a79568e 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameItem.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/item/FameItem.kt @@ -24,7 +24,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest -import today.pathos.android.portfolio.R +import today.pathos.android.portfolio.presentation.R import today.pathos.android.portfolio.presentation.view.theme.Typography @Composable diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/screen/CharacterInfoScreen.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/screen/CharacterInfoScreen.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/screen/CharacterInfoScreen.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/screen/CharacterInfoScreen.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/screen/MainScreen.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/screen/MainScreen.kt similarity index 89% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/screen/MainScreen.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/screen/MainScreen.kt index d255a39..040d6ab 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/view/screen/MainScreen.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/screen/MainScreen.kt @@ -9,22 +9,20 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.ripple.rememberRipple -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel +import today.pathos.android.portfolio.presentation.R +import today.pathos.android.portfolio.presentation.view.fame.FameCarousel import today.pathos.android.portfolio.presentation.view.item.FameItem -import today.pathos.android.portfolio.presentation.view.widget.FameCarousel import today.pathos.android.portfolio.presentation.viewmodel.MainUiState import today.pathos.android.portfolio.presentation.viewmodel.MainViewModel @@ -64,7 +62,7 @@ fun MainScreen( LazyColumn { items(state.fameList) { FameItem( - characterImage = it.characterImage, + characterImage = stringResource(id = R.string.character_image_url, it.serverId, it.characterId, 3), characterName = it.characterName, level = it.level, jobGrowName = it.jobGrowName, diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/screen/SplashScreen.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/screen/SplashScreen.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/screen/SplashScreen.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/screen/SplashScreen.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Color.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Color.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Color.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Color.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Theme.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Theme.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Theme.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Theme.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Type.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Type.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Type.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/view/theme/Type.kt diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/CharacterInfoViewModel.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/CharacterInfoViewModel.kt similarity index 89% rename from app/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/CharacterInfoViewModel.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/CharacterInfoViewModel.kt index d59269f..f8f436b 100644 --- a/app/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/CharacterInfoViewModel.kt +++ b/presentation/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/CharacterInfoViewModel.kt @@ -12,7 +12,6 @@ import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import today.pathos.android.portfolio.domain.usecase.GetCharacterInfoUseCase import today.pathos.android.portfolio.entity.Character -import today.pathos.android.portfolio.entity.Item import javax.inject.Inject @HiltViewModel @@ -40,16 +39,14 @@ class CharacterInfoViewModel @Inject constructor( .map { equipment -> ItemSlotInfo( itemId = equipment.itemId, - itemImage = Item.getItemImageUrl(equipment.itemId), reinforce = equipment.reinforce.takeIf { it > 0 } ) } val accessoryList = characterInfo.equipment - .filter { it.itemType in listOf("무기","액세서리", "추가장비") } + .filter { it.itemType in listOf("무기", "액세서리", "추가장비") } .map { equipment -> ItemSlotInfo( itemId = equipment.itemId, - itemImage = Item.getItemImageUrl(equipment.itemId), reinforce = equipment.reinforce.takeIf { it > 0 } ) } @@ -76,7 +73,6 @@ data class CharacterInfoUiState( serverId = "", characterId = "", characterName = "", - characterImage = "", level = 0, jobId = "", jobGrowId = "", @@ -93,6 +89,5 @@ data class CharacterInfoUiState( data class ItemSlotInfo( val itemId: String, - val itemImage: String, val reinforce: Int?, ) diff --git a/app/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/MainViewModel.kt b/presentation/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/MainViewModel.kt similarity index 100% rename from app/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/MainViewModel.kt rename to presentation/src/main/java/today/pathos/android/portfolio/presentation/viewmodel/MainViewModel.kt diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml new file mode 100644 index 0000000..dbe2b4a --- /dev/null +++ b/presentation/src/main/res/values/strings.xml @@ -0,0 +1,11 @@ + + Lv.%,d + 명성치 : %,d + <%s> + [%1$s] %2$s + Lv.%1$d %2$s + +%,d + + https://img-api.neople.co.kr/df/servers/%1$s/characters/%2$s?zoom=%3$d + https://img-api.neople.co.kr/df/items/%1$s + diff --git a/app/src/test/java/today/pathos/android/portfolio/ExampleUnitTest.kt b/presentation/src/test/java/today/pathos/android/portfolio/presentation/ExampleUnitTest.kt similarity index 56% rename from app/src/test/java/today/pathos/android/portfolio/ExampleUnitTest.kt rename to presentation/src/test/java/today/pathos/android/portfolio/presentation/ExampleUnitTest.kt index 9744496..b48fe25 100644 --- a/app/src/test/java/today/pathos/android/portfolio/ExampleUnitTest.kt +++ b/presentation/src/test/java/today/pathos/android/portfolio/presentation/ExampleUnitTest.kt @@ -1,6 +1,5 @@ -package today.pathos.android.portfolio +package today.pathos.android.portfolio.presentation -import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.Assert.* @@ -15,13 +14,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } - - @Test - fun check_testRun() = runTest { - assertEquals(true, suspendRun()) - } - - private suspend fun suspendRun(): Boolean { - return true - } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 5304c49..bdc52f8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -20,3 +20,7 @@ dependencyResolutionManagement { } rootProject.name = "Android Portfolio 2024" include(":app") +include(":domain") +include(":entity") +include(":data") +include(":presentation")