diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d4ad710cc..c3197b17c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -34,11 +34,11 @@ dependencies { implementation(projects.core) implementation(projects.coreAndroid) implementation(projects.model) + implementation(projects.auth) implementation(projects.common) - implementation(projects.commonAuth) implementation(projects.commonAndroid) - implementation(projects.commonLocation) - implementation(projects.commonRecognizer) + implementation(projects.utilsLocation) + implementation(projects.utilsRecognizer) implementation(projects.domain) implementation(projects.presentation) implementation(projects.data) @@ -46,6 +46,7 @@ dependencies { implementation(projects.dataDatabase) implementation(projects.dataPreference) implementation(projects.dataRemote) + implementation(projects.dataStorage) implementation(libs.androidX.hilt.work) implementation(libs.androidX.work.runtime.ktx) diff --git a/auth/.gitignore b/auth/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/auth/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/auth/build.gradle.kts b/auth/build.gradle.kts new file mode 100644 index 000000000..2d11d2826 --- /dev/null +++ b/auth/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + id("beep.android.library") + id("beep.android.hilt") +} + +android { + namespace = "com.lighthouse.auth" +} + +dependencies { + implementation(projects.core) + implementation(projects.coreAndroid) + implementation(projects.model) + + implementation(platform(libs.firebase.bom)) + implementation(libs.firebase.auth.ktx) +} diff --git a/commons/common-auth/.gitignore b/commons/common-auth/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/commons/common-auth/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/data-preference/build.gradle.kts b/data/data-preference/build.gradle.kts index 3a27941bd..d605107e9 100644 --- a/data/data-preference/build.gradle.kts +++ b/data/data-preference/build.gradle.kts @@ -15,8 +15,6 @@ dependencies { implementation(projects.model) implementation(projects.common) implementation(projects.commonAndroid) - implementation(projects.commonLocation) - implementation(projects.commonRecognizer) implementation(projects.data) implementation(libs.androidX.datastore.preferences) diff --git a/data/data-storage/.gitignore b/data/data-storage/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/data/data-storage/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/data-storage/build.gradle.kts b/data/data-storage/build.gradle.kts new file mode 100644 index 000000000..0e43e9d7c --- /dev/null +++ b/data/data-storage/build.gradle.kts @@ -0,0 +1,21 @@ +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + id("beep.android.library") + id("beep.android.hilt") + alias(libs.plugins.ksp) +} + +android { + namespace = "com.lighthouse.data.storage" +} + +dependencies { + implementation(projects.core) + implementation(projects.coreAndroid) + implementation(projects.model) + implementation(projects.common) + implementation(projects.commonAndroid) + implementation(projects.data) + + implementation(libs.timber) +} diff --git a/data/data/build.gradle.kts b/data/data/build.gradle.kts index fcdc01254..64ef96920 100644 --- a/data/data/build.gradle.kts +++ b/data/data/build.gradle.kts @@ -1,6 +1,7 @@ @Suppress("DSL_SCOPE_VIOLATION") plugins { id("beep.android.library") + id("beep.android.hilt") alias(libs.plugins.ksp) } @@ -14,8 +15,6 @@ dependencies { implementation(projects.model) implementation(projects.common) implementation(projects.commonAndroid) - implementation(projects.commonLocation) - implementation(projects.commonRecognizer) implementation(projects.domain) // implementation(libs.androidX.room.runtime) diff --git a/data/data/src/main/java/com/lighthouse/datasource/gifticon/GifticonImageSource.kt b/data/data/src/main/java/com/lighthouse/datasource/gifticon/GifticonImageSource.kt deleted file mode 100644 index 63fd6b9a5..000000000 --- a/data/data/src/main/java/com/lighthouse/datasource/gifticon/GifticonImageSource.kt +++ /dev/null @@ -1,66 +0,0 @@ -package com.lighthouse.datasource.gifticon - -import android.content.Context -import android.graphics.Bitmap.CompressFormat -import android.net.Uri -import androidx.core.net.toUri -import com.lighthouse.core.android.exts.calculateSampleSize -import com.lighthouse.core.android.exts.centerCrop -import com.lighthouse.core.android.exts.compressBitmap -import com.lighthouse.core.android.exts.decodeBitmap -import com.lighthouse.core.android.exts.decodeSampledBitmap -import com.lighthouse.core.android.exts.deleteFile -import com.lighthouse.core.android.exts.exists -import com.lighthouse.core.android.exts.openInputStream -import com.lighthouse.model.GifticonImageResult -import dagger.hilt.android.qualifiers.ApplicationContext -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext -import java.io.FileOutputStream -import java.util.Date -import javax.inject.Inject - -class GifticonImageSource @Inject constructor( - @ApplicationContext private val context: Context -) { - suspend fun saveImage(id: String, originUri: Uri?, oldCroppedUri: Uri?): GifticonImageResult = - withContext(Dispatchers.IO) { - originUri ?: throw NullPointerException("originUri 가 Null 입니다.") - oldCroppedUri ?: throw NullPointerException("oldCroppedUri 가 Null 입니다.") - - val outputOriginFile = context.getFileStreamPath("$ORIGIN_PREFIX$id") - - val sampleSize = context.calculateSampleSize(originUri) - val sampledOriginBitmap = context.decodeSampledBitmap(originUri, sampleSize) - outputOriginFile.compressBitmap(sampledOriginBitmap, CompressFormat.JPEG, 100) - - val updated = Date() - val outputCroppedFile = context.getFileStreamPath("${CROPPED_PREFIX}$id${updated.time}") - val cropped = if (context.exists(oldCroppedUri)) { - context.decodeBitmap(oldCroppedUri).also { - context.deleteFile(oldCroppedUri) - } - } else { - sampledOriginBitmap.centerCrop(1f) - } - outputCroppedFile.compressBitmap(cropped, CompressFormat.JPEG, 100) - GifticonImageResult(sampleSize, outputCroppedFile.toUri()) - } - - suspend fun updateImage(id: String, oldCroppedUri: Uri?, newCroppedUri: Uri?): Uri = - withContext(Dispatchers.IO) { - oldCroppedUri ?: throw NullPointerException("oldCroppedUri 가 Null 입니다.") - newCroppedUri ?: throw NullPointerException("newCroppedUri 가 Null 입니다.") - context.deleteFile(oldCroppedUri) - - val updated = Date() - val outputCropped = context.getFileStreamPath("$CROPPED_PREFIX$id${updated.time}") - context.openInputStream(newCroppedUri).copyTo(FileOutputStream(outputCropped)) - outputCropped.toUri() - } - - companion object { - private const val ORIGIN_PREFIX = "origin" - private const val CROPPED_PREFIX = "cropped" - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 966a35de8..3b02838f6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -32,15 +32,17 @@ includeProject(":app") includeProject(":core") includeProject(":core-android") includeProject(":model") +includeProject(":auth") includeProject(":common", "commons") includeProject(":common-auth", "commons") includeProject(":common-android", "commons") -includeProject(":common-location", "commons") -includeProject(":common-recognizer", "commons") +includeProject(":utils-location", "utils") +includeProject(":utils-recognizer", "utils") includeProject(":data", "data") includeProject(":data-database", "data") includeProject(":data-remote", "data") includeProject(":data-content", "data") includeProject(":data-preference", "data") +includeProject(":data-storage", "data") includeProject(":presentation") includeProject(":domain") diff --git a/utils/utils-location/.gitignore b/utils/utils-location/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/utils/utils-location/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/utils/utils-location/build.gradle.kts b/utils/utils-location/build.gradle.kts new file mode 100644 index 000000000..0d8f6fc73 --- /dev/null +++ b/utils/utils-location/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + id("beep.android.library") + id("beep.android.hilt") +} + +android { + namespace = "com.lighthouse.beep.utils.location" +} + +dependencies { + implementation(projects.core) + implementation(projects.coreAndroid) + implementation(projects.model) + + implementation(libs.gms.play.services.location) + +// implementation(libs.androidX.activity.ktx) +// implementation(libs.androidX.appcompat) +// implementation(libs.androidX.core.ktx) +// implementation(libs.androidX.fragment.ktx) +// implementation(libs.zxing.core) +} diff --git a/utils/utils-recognizer/.gitignore b/utils/utils-recognizer/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/utils/utils-recognizer/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/utils/utils-recognizer/build.gradle.kts b/utils/utils-recognizer/build.gradle.kts new file mode 100644 index 000000000..cf134a6be --- /dev/null +++ b/utils/utils-recognizer/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + id("beep.android.library") + id("beep.android.hilt") +} + +android { + namespace = "com.lighthouse.beep.utils.recognizer" +} + +dependencies { + implementation(projects.core) + implementation(projects.coreAndroid) + implementation(projects.model) + + implementation(libs.mlkit.text.recognition.korean) +}