Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#219/feature/jsp/backend #222

Open
wants to merge 40 commits into
base: android_develop
Choose a base branch
from
Open

Conversation

pknujsp
Copy link
Collaborator

@pknujsp pknujsp commented Mar 11, 2024

๐Ÿ“Œ ๊ด€๋ จ ์ด์Šˆ

#219 ํด๋ผ์ด์–ธํŠธ, ๋ฐฑ์—”๋“œ ์—ฐ๊ฒฐ ์ฝ”๋“œ ์ถ”๊ฐ€(๋กœ๊ทธ์ธ, ํšŒ์›๊ฐ€์ž… ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ)

โœจ ๊ณผ์ œ ๋‚ด์šฉ

ํŒŒ์ผ ๋ณ€๊ฒฝ์ด ์—„์ฒญ๋‚œ๋ฐ Ai์ž‘์—…ํ•  ๋•Œ ์ด๋ฆฌ์ €๋ฆฌ ํ…Œ์ŠคํŠธํ•˜๋ฉด์„œ ์“ด ๋‚˜์ค‘์— ์ œ๊ฑฐํ•  ์ฝ”๋“œ๊ฐ€ ๋งŽ์•„์„œ ๋”ฐ๋กœ ์ •๋ฆฌํ•  ๋กœ๊ทธ์ธ, ํšŒ์›๊ฐ€์ž… ๋ถ€๋ถ„ ํŒŒ์ผ๋“ค๋งŒ ๋ณด์‹œ๋ฉด ๋ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • AccountSessionRepository : ํ˜„์žฌ ๋กœ๊ทธ์ธ ์„ธ์…˜์„ ๊ด€๋ฆฌ
  • AppDataStore : ์ด๋ฉ”์ผ, ๋‹‰๋„ค์ž„ ์ €์žฅ
  • CognitoUserPool : AWS ๊ณ„์ • API ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ชจ๋“ˆ ๊ตฌํ˜„์ฒด

์›๋ž˜ ์žˆ๋˜ TokenRepository๋‚˜ Token ๋‹ค๋ฃจ๋Š” ํด๋ž˜์Šค๋Š” ์ „๋ถ€ ์ œ๊ฑฐํ–ˆ์Šต๋‹ˆ๋‹ค.

CognitoUserPool์—์„œ ๋กœ๊ทธ์ธ ์„ธ์…˜, ํ† ํฐ ๊ด€๋ฆฌ ๋“ฑ๋“ฑ ๋‹ค ํ•ด์ค˜์„œ ์šฐ๋ฆฌ๊ฐ€ ์ง์ ‘ ๋‹ค๋ฃฐ ํ•„์š”๋Š” ์—†์–ด์กŒ๊ณ ,

image

๐Ÿ“ธ ์Šคํฌ๋ฆฐ์ƒท(์„ ํƒ)

๊ฐ€์ž…๋กœ๊ทธ์ธํ…Œ์ŠคํŠธ(1)

๐Ÿ“š ๋ ˆํผ๋Ÿฐ์Šค (๋˜๋Š” ์ƒˆ๋กœ ์•Œ๊ฒŒ ๋œ ๋‚ด์šฉ) ํ˜น์€ ๊ถ๊ธˆํ•œ ์‚ฌํ•ญ๋“ค

@tgyuuAn
Copy link
Member

tgyuuAn commented Mar 12, 2024

ํŒŒ์ผ ์ฒด์ธ์ง€๋“œ ๋ฏธ๋ฅด์“ฐ๋ค ๋‚˜์ค‘์— ์นดํŽ˜๊ฐ€์„œ ํ™•์ธํ•ด๋ณผ๊ฒŒ์šฉ

import kotlinx.coroutines.flow.StateFlow

interface AccountSessionRepository {
val lastSavedEmail: Flow<String>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋กœ๊ทธ์ธ ํ™”๋ฉด์—์„œ ์•„์ด๋”” ์ €์žฅ ๋ˆŒ๋ €์„ ๋•Œ ์ž๋™์ž…๋ ฅ๋˜๋Š” ์ด๋ฉ”์ผ์ธ๋ฐ
์ด๊ฑฐ๋Š” SignRepository๋กœ ๊ฐ€๋Š”๊ฒŒ ๋งž๊ฒ ๋„ค์š”
์ด ๋ ˆํฌ๋Š” ํ˜„์žฌ ๋กœ๊ทธ์ธ ์„ธ์…˜ ๊ด€๋ฆฌํ•˜๋Š” ๋ชฉ์ ์ธ๋ฐ ์ง€๊ธˆ ์—ฌ๊ธฐ์„œ ์•ˆ์“ฐ์ด๊ธฐ๋„ ํ•˜๊ณ  ๊ด€๋ จ์ด ์—†๋„ค์š”

Copy link
Collaborator Author

@pknujsp pknujsp Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋Œ“๊ธ€ ๊ด€๋ จ ์ฝ”๋“œ๋“ค์€ ํ˜„์žฌ ๋กœ๊ทธ์ธ ์„ธ์…˜ ์ƒํƒœ๋ž‘ ์—ฐ๋™ํ•˜๋Š” ๋กœ์ง์„ ์žฌ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๋Š” ๋ถ€๋ถ„๋•Œ๋ฌธ์— ํฐ ๊ณต์‚ฌ๊ฐ€ ๋ ๊ฑฐ ๊ฐ™์•„
๋กœ๊ทธ์ธ/ํšŒ์›๊ฐ€์ž… ๊ตฌํ˜„๋ถ€ํ„ฐ ๋จผ์ €ํ•˜๊ณ ์ž ์ž„์‹œ๋กœ ์ฃผ์„์ฒ˜๋ฆฌ ํ•ด๋†“์€๊ฒŒ ๋งŽ์Šต๋‹ˆ๋‹ค

Comment on lines +3 to +5
class ChangePasswordParameter(
val newPassword: ByteArray,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ, ๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝํ•˜๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ ํด๋ž˜์Šค๋Š” ๋‚ด๋ถ€ ์†์„ฑ์„ ๋‹จ์ˆœ
๋ž˜ํ•‘ํ•˜๋Š” ์ •๋„๋ผ์„œ ์—†์• ๊ณ 

์†์„ฑ์„ ์‹ค์ œ ๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝ, ๋น„๋ฒˆ ๋ณ€๊ฒฝํ•˜๋Š” ๋ฉ”์„œ๋“œ์˜ ์ธ์ž๋กœ ๋„˜๊ธฐ๋Š”๊ฒŒ ์ข‹์„ ๋“ฏํ•œ๋ฐ
์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core/model/requestparameters ํŒจํ‚ค์ง€ ๋‚ด ๋ชจ๋“  ํŒŒ์ผ์— ๋Œ€ํ•ด์„œ ๊ฐ™์€ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pknujsp ๊ทธ๊ฒŒ ๋งž๋Š” ๊ฒƒ ๊ฐ™์•„์š”. ๊ทธ๋ƒฅ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌํ•˜๊ณ  datasource์—์„œ ์š”์ฒญ ๋ณด๋‚ด๋Š” ๊ฒŒ ํ›จ์”ฌ ๊ฐ„๋‹จํ•  ๊ฒƒ ๊ฐ™๋„ค์š”.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ถ€๋ถ„ ์ˆ˜์ •ํ•ด์„œ ๋‹ค์Œ PR์— ๋ฐ˜์˜ํ• ๊ฒŒ์š”

Comment on lines +70 to +86

<TextView
android:id="@+id/positiveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="15dp"
android:background="@drawable/radius_main_5"
android:gravity="center"
android:paddingVertical="10dp"
android:text="@string/complete"
android:textColor="@color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ทฐ๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ์ด๋ฉ”์ผ ์ธ์ฆ ์ฝ”๋“œ๋ฅผ ๋ทฐ๋ชจ๋ธ์—์„œ ๋ฐ›์•„์„œ ์ธ์ฆ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๋Š”๋ฐ
๋ฐ”์ธ๋”ฉ ์–ด๋Œ‘ํ„ฐ๋กœ ์ง์ ‘ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๋ ค๊ณ  ํ•˜๋‹ˆ ๊ตฌํ˜„๋ฒ•์ด ๊ธฐ์–ต์ด ์•ˆ๋‚˜์„œ
์šฐ์„ ์ ์œผ๋กœ ํ”„๋ž˜๊ทธ๋จผํŠธ ํด๋ž˜์Šค๋‚ด์—์„œ ์ง์ ‘ ํด๋ฆญ๋ฆฌ์Šค๋„ˆ๋ฅผ ์—ฐ๊ฒฐํ•ด์คฌ์Šต๋‹ˆ๋‹ค

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๋Ÿฐ ์‹์œผ๋กœ ๋„˜์–ด๊ฐ€๋ฉด ๋ถ„๋ช… ๊นŒ๋จน๊ธด ํ•ฉ๋‹ˆ๋‹ค๋งŒ,

๊ทธ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด์„œ ์–ด๋”” ์จ๋†“๋˜๊ฐ€ ํ•ด์•ผ๊ฒ ์–ด์š”.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊นŒ๋จน์„์ˆ˜๋„ ์žˆ๋Š” ๊ฒƒ๋“ค ์ฐพ์•„๋ณด๊ธฐ ์‰ฝ๊ฒŒ ์ด์Šˆ์— ๋“ฑ๋กํ•ด๋‘˜๊ฒŒ์š”

Copy link
Member

@tgyuuAn tgyuuAn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์‹œ๊ฐ„์ด ์ง€๋‚˜๊ณ  ๋ณด๋‹ˆ๊นŒ...

๋„ˆ๋ฌด ์ปจ๋ฒค์…˜์ด ๋ถ€์กฑํ–ˆ๊ณ .. ์ฝ”๋“œ์˜ ํ’ˆ์งˆ์ด ๋งŽ์ด ๋‚ฎ์•˜๋‹ค๋Š” ๊ฒƒ์„ ๊นจ๋‹ซ๊ฒŒ ๋˜๋„ค์š”..

๊ทธ ๋งŒํผ ์ €ํฌ๊ฐ€ ๋งŽ์ด ์„ฑ์žฅํ–ˆ๋‹ค๋Š” ์ฆ๊ฑฐ๊ฒ ์ฃ ...?!

์†Œ์†Œํ•œ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋ดค์Šต๋‹ˆ๋‹ค.

๊ณ ๋ด‰๋ฐฅ PR์€ ์กฐ๊ธˆ ํž˜๋“œ๋„ค์š” ํ—ˆํ—ˆ...

๊ณ ์ƒํ•˜์…จ์”๋‹ˆ๋‹ค์ž‡ ~ ๐Ÿ‘๐Ÿ‘๐Ÿ‘

@@ -88,7 +88,6 @@ dependencies {

implementation(libs.bundles.lifecycles)
implementation(libs.bundles.materials)
implementation(libs.bundles.composes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compose import ์ œ๊ฑฐํ•˜์‹  ์ด์œ ๊ฐ€ ๋”ฐ๋กœ ์žˆ์„๊นŒ์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app ๋ชจ๋“ˆ์—์„œ๋Š” ์ปดํฌ์ฆˆ ๊ด€๋ จ ์ฝ”๋“œ๊ฐ€ ํ•˜๋‚˜๋„ ์—†์–ด์„œ ์ œ๊ฑฐํ•˜์˜€์Šต๋‹ˆ๋‹ค

Comment on lines 125 to 141
cameraExecutor = newSingleThreadExecutor()
_mImageAnalyzer =
ImageAnalysis.Builder().setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST).setTargetRotation(mPreviewView.display.rotation)
.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_RGBA_8888).build()

_mImageAnalyzer = ImageAnalysis.Builder().setOutputImageRotationEnabled(true).setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.setTargetResolution(Size(720, 1280)).setTargetRotation(Surface.ROTATION_0)
.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_RGBA_8888).build()
mImageAnalyzer.setAnalyzer(cameraExecutor!!) { image ->
if (_bitmapBuffer == null) _bitmapBuffer = Bitmap.createBitmap(image.width, image.height, Bitmap.Config.ARGB_8888)
image.use {
bitmapBuffer.copyPixelsFromBuffer(it.planes[0].buffer)
}
detect(image)
detect()
}

_mPreview = Preview.Builder().setTargetRotation(mPreviewView.display.rotation).build()
_mPreview = Preview.Builder().setTargetResolution(Size(720, 1280)).setTargetRotation(Surface.ROTATION_0).build()
mCameraProvider.bindToLifecycle(fragmentLifeCycleOwner, mCameraSelector, mPreview, mImageAnalyzer)
mPreview.setSurfaceProvider(mPreviewView.surfaceProvider)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ถ€๋ถ„ ์‚ฌ์†Œํ•˜๊ธดํ•œ๋ฐ,

์ €ํฌ๊ฐ€ ์ปจ๋ฒค์…˜์œผ๋กœ ์ •ํ•˜์ง€ ์•Š์•˜๋–ค ๋ถ€๋ถ„์ด๋ผ์„œ..

์ด๋ ‡๊ฒŒ ๋ฉ”์†Œ๋“œ ์ฒด์ด๋‹์ด ์ผ์–ด๋‚  ๋•Œ๋Š” ๊ฐœํ–‰์„ ๋„ฃ์–ด์„œ ๊ตฌ๋ถ„์„ ์‰ฝ๊ฒŒ ํ•˜๋Š” ๊ฒƒ์€ ์–ด๋–จ๊นŒ์š” ??!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋งž์•„์š” ์ „๋ฐ˜์ ์œผ๋กœ ์ฝ”๋“œ ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง€๋„ค์š”
๊ฐœํ–‰ ๋„ฃ์–ด์„œ ๊ฐ€๋…์„ฑ ๋†’์ด๊ณ  ๋ถˆํ•„์š”ํ•œ ์ฝ”๋“œ๋Š” ๋‹ค์‹œ ์ •๋ฆฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค

Comment on lines +161 to +165
data class Object(
val boundingBox: RectF,
val confidence: Int,
val label: String,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object๋ฅผ interface์•ˆ์— ๋„ฃ์œผ์‹  ์ด์œ ๊ฐ€ ์ด์”…ใ„น๊นŒ์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnDetectionListener์˜ ๋ชฉ์ ์ด ๋ทฐ์—์„œ ์•ฝ์˜ ์œ„์น˜์— ์‚ฌ๊ฐํ˜• ๋ฐ•์Šค๋ฅผ ๊ทธ๋ฆฌ๋Š” ๊ฑด๋ฐ์š”.
์ด ๋•Œ ํ™”๋ฉด ์ƒ์—์„œ ์•ฝ์˜ ์œ„์น˜ ์ขŒํ‘œ๊ฐ’๋ฅผ ๋‹ด๊ณ ์žˆ๋Š”๊ฒŒ Object ํด๋ž˜์Šค์ธ๋ฐ
์ด ์ธํ„ฐํŽ˜์ด์Šค์—์„œ๋งŒ ์“ฐ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ด€๊ณ„๋ฅผ ํ™•์‹คํ•˜๊ฒŒ ์ •ํ•ด์ฃผ๊ณ ์ž ์ด๋ ‡๊ฒŒ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

์‹ค์ œ๋กœ ์–ด๋–ป๊ฒŒ ์“ฐ์ด๊ณ  ์žˆ๋Š”์ง€ ์ฝ”๋“œ ๊ฐœ์„ ์  ๊ณ ๋ฏผ ํ•ด๋ณผ๊ฒธ ์ž‘์„ฑํ•ด๋ดค์Šต๋‹ˆ๋‹ค.

๋ฐ‘์— ์‚ฌ์ง„์ฒ˜๋Ÿผ Ai๊ฐ€ ์•ฝ์„ ์ธ์‹ํ–ˆ์„๋•Œ ๋ทฐ์—์„œ ์•ฝ์— ๋Œ€ํ•ด์„œ ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค๋ฅผ ์ณ์ฃผ๊ธฐ ์œ„ํ•œ ์ •๋ณด๋ฅผ ์•ฝ ๋ณ„๋กœ ๋‹ด๋Š” ๊ฑด๋ฐ์š”.

์ด ํด๋ž˜์Šค๊ฐ€ ์žˆ๋Š” OnDetectionListener๋Š” ์นด๋ฉ”๋ผ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” MedicinesDetectorFragment์—์„œ ๊ตฌํ˜„ํ•ด์„œ ์“ฐ์ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํ”„๋ž˜๊ทธ๋จผํŠธ์—์„œ **onDetect()**๋ฅผ ํ˜ธ์ถœ๋ฐ›์•˜์„ ๋•Œ ๋ทฐ์— ๊ทธ๋ฆฌ๊ฒŒ ๋˜์–ด์žˆ์–ด์š”.

image

์ฝ”๋“œ๋ฅผ ์ฝ์–ด๋ณด๋‹ˆ๊นŒ ๋” ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ๊ฐ€ ๋‹ค์ˆ˜์ธ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ธฐ๋Šฅ์ด ๋™์ž‘ํ•˜๋‹ˆ ์ง€๊ธˆ ๋‹น์žฅ ์ˆ˜์ •์€ ํ•˜์ง€ ์•Š๋Š”๊ฒŒ ์ข‹์„๊ฑฐ ๊ฐ™๊ณ  ๋‹ค์Œ์— MVP๋‹จ๊ณ„์—์„œ ๊ฐœ์„ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnDetectionListener์˜ ๋ชฉ์ ์ด ๋ทฐ์—์„œ ์•ฝ์˜ ์œ„์น˜์— ์‚ฌ๊ฐํ˜• ๋ฐ•์Šค๋ฅผ ๊ทธ๋ฆฌ๋Š” ๊ฑด๋ฐ์š”. ์ด ๋•Œ ํ™”๋ฉด ์ƒ์—์„œ ์•ฝ์˜ ์œ„์น˜ ์ขŒํ‘œ๊ฐ’๋ฅผ ๋‹ด๊ณ ์žˆ๋Š”๊ฒŒ Object ํด๋ž˜์Šค์ธ๋ฐ ์ด ์ธํ„ฐํŽ˜์ด์Šค์—์„œ๋งŒ ์“ฐ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ด€๊ณ„๋ฅผ ํ™•์‹คํ•˜๊ฒŒ ์ •ํ•ด์ฃผ๊ณ ์ž ์ด๋ ‡๊ฒŒ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

์‹ค์ œ๋กœ ์–ด๋–ป๊ฒŒ ์“ฐ์ด๊ณ  ์žˆ๋Š”์ง€ ์ฝ”๋“œ ๊ฐœ์„ ์  ๊ณ ๋ฏผ ํ•ด๋ณผ๊ฒธ ์ž‘์„ฑํ•ด๋ดค์Šต๋‹ˆ๋‹ค.

๋ฐ‘์— ์‚ฌ์ง„์ฒ˜๋Ÿผ Ai๊ฐ€ ์•ฝ์„ ์ธ์‹ํ–ˆ์„๋•Œ ๋ทฐ์—์„œ ์•ฝ์— ๋Œ€ํ•ด์„œ ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค๋ฅผ ์ณ์ฃผ๊ธฐ ์œ„ํ•œ ์ •๋ณด๋ฅผ ์•ฝ ๋ณ„๋กœ ๋‹ด๋Š” ๊ฑด๋ฐ์š”.

์ด ํด๋ž˜์Šค๊ฐ€ ์žˆ๋Š” OnDetectionListener๋Š” ์นด๋ฉ”๋ผ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” MedicinesDetectorFragment์—์„œ ๊ตฌํ˜„ํ•ด์„œ ์“ฐ์ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํ”„๋ž˜๊ทธ๋จผํŠธ์—์„œ **onDetect()**๋ฅผ ํ˜ธ์ถœ๋ฐ›์•˜์„ ๋•Œ ๋ทฐ์— ๊ทธ๋ฆฌ๊ฒŒ ๋˜์–ด์žˆ์–ด์š”.

image

์ฝ”๋“œ๋ฅผ ์ฝ์–ด๋ณด๋‹ˆ๊นŒ ๋” ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ๊ฐ€ ๋‹ค์ˆ˜์ธ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ธฐ๋Šฅ์ด ๋™์ž‘ํ•˜๋‹ˆ ์ง€๊ธˆ ๋‹น์žฅ ์ˆ˜์ •์€ ํ•˜์ง€ ์•Š๋Š”๊ฒŒ ์ข‹์„๊ฑฐ ๊ฐ™๊ณ  ๋‹ค์Œ์— MVP๋‹จ๊ณ„์—์„œ ๊ฐœ์„ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์กฐ์˜ค์˜ฟ์Šต๋‹ˆ๋‹ค. !

it.boundingBox,
it.confidence,
it.label,
)
},
detectionResultEntity.inferencedImageSize.width, detectionResultEntity.inferencedImageSize.height,
)
}
}

fun interface OnDetectionListener {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์™€์šฐ fun interface๋Š” ์–ด๋–ค ๊ธฐ๋Šฅ์ธ๊ฐ€์š”..?

abstract fun์ด๋ž‘ ๋น„์Šทํ•œ๊ฑด๊ฐ€..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ธํ„ฐํŽ˜์ด์Šค์— ๋ฉ”์„œ๋“œ๊ฐ€ ํ•˜๋‚˜์ผ ๋•Œ
์ด๊ฑธ ๋‹ค๋ฅธ ๋ฉ”์„œ๋“œ์— ๋žŒ๋‹ค ์ธ์ž๋กœ ๋„ฃ์–ด์„œ ํŽธํ•˜๊ฒŒ ์“ธ์ˆ˜๊ฐ€ ์žˆ๊ฒŒ ๋ผ์š”

Comment on lines +28 to +31
private var _aiModels: List<Module>? = null
private val aiModels get() = _aiModels!!

private var _aiModel: Module? = null
private val aiModel get() = _aiModel!!

private var _metaData: ClassificationMetaDataEntity? = null
private var _metaData: List<ClassificationMetaDataEntity>? = null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๊ฑฐ ์ดˆ๊ธฐ๊ฐ’ null๋กœ ์ฃผ์‹  ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”?

binding๊ฐ™์€ ๊ฒƒ๋“ค์€ nulll๋กœ ์ค˜์„œ onDestroy ์—์„œ null๋‹ค์‹œ ๋Œ€์ž…ํ•ด์„œ ๋ฉ”๋ชจ๋ฆฌ ํšŒ์ˆ˜ํ•˜๋Š”๋ฐ,

์ด ๋ถ€๋ถ„์€ ์ œ๊ฐ€ ์ž˜ ๋ชจ๋ฅด๋Š” ๋ถ€๋ถ„์ด๋ผ ๊ทธ๋Ÿฐ๋ฐ.. ๋‹ค์‹œ null ์ฒ˜๋ฆฌํ•ด์„œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋ฐ˜ํ™˜ํ•  ํ•„์š”๋Š” ์—†์„๊นŒ์š” ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MedicineClassifierImpl๋Š” ์•ฝ์„ ์‹ค์ œ๋กœ Ai๊ฐ€ ๋ถ„๋ฅ˜ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค.

์ด ํด๋ž˜์Šค์—์„œ 80MB ๊ฐ€๋Ÿ‰๋˜๋Š” Ai๋ชจ๋ธ์„ ์ฝ์–ด์™€์„œ ๋ฉ”๋ชจ๋ฆฌ ์ƒ์— ์˜ฌ๋ฆฌ๋Š” ๋กœ์ง์„ ํฌํ•จํ•˜๊ณ  ์žˆ์–ด์š”.

๋งํ•˜์‹  ๊ฒƒ ์ฒ˜๋Ÿผ ๋ฉค๋ฒ„๋ณ€์ˆ˜์— null์„ ๋„ฃ๋Š” ๊ฒฝ์šฐ๋Š” ์ด ์ธ์Šคํ„ด์Šค๊ฐ€ ํ•„์š”์—†์–ด์„œ ์ง€์šธ ๋•Œ ์ผํ…๋ฐ

๋ชจ๋ธ ํŒŒ์ผ ์šฉ๋Ÿ‰์ด ์ข€ ํฌ๋‹ค๋ณด๋‹ˆ null์ฒ˜๋ฆฌ๋กœ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ์‚ญ์ œ, ํ• ๋‹น์„ ์—ฌ๋Ÿฌ ๋ฒˆ ๋ฐ˜๋ณตํ•˜๋Š” ๊ฑด ๋น„ํšจ์œจ์ ์ธ๊ฑฐ ๊ฐ™์•„์„œ
๋ฉ”๋ชจ๋ฆฌ์— ๊ณ„์† ์˜ฌ๋ ค๋‘๊ณ ์ž ์ง€๊ธˆ์ฒ˜๋Ÿผ ๊ตฌํ˜„ํ–ˆ๊ณ  objectํด๋ž˜์Šค๋กœ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

์ฝ”๋“œ ๋‹ค์‹œ ๋ณด๋‹ˆ ๋ฐ‘์— ์ฒ˜๋Ÿผ getํ•„๋“œ๊ฐ€ ์žˆ๋Š”๋ฐ ๊ผญ ํ•„์š”ํ•œ๊ฒŒ ์•„๋‹ˆ๋ผ์„œ
์ด๊ฑธ ์—†์• ๊ณ  Delegates.notNull()๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ฝ”๋“œ๋ฅผ ์ข€ ๋” ์ค„์—ฌ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

    private var _aiModels: List<Module>? = null
    private val aiModels get() = _aiModels!!

    private var _metaData: List<ClassificationMetaDataEntity>? = null
    private val metaData get() = _metaData!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pknujsp ์•„๋‹ˆ๋ฉด lateinit var๊ฐ™์€ ๊ฒƒ์„ ์จ๋„ ๋˜์ง€ ์•Š์„๊นŒ์š” ํ•œ๋ฒˆ๋งŒ ๋Œ€์ž…ํ•˜๋Š” ๊ฑฐ๋ผ๋ฉด

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ทธ๋ ‡๋„ค์š”
ํƒ€์ž…์ด int๊ฐ™์€๊ฒŒ ์•„๋‹ˆ๋ผ์„œ ์œ„์ž„๋ง๊ณ  lateinit์“ฐ๋Š”๊ฒŒ ๋งž์•„์š”

Comment on lines +12 to +21
class LoginRequest(
val email: String,
val password: ByteArray,
)

class LoginResponse(
val userSession: CognitoUserSession,
val attr: CognitoUserDetails,
val newDevice: CognitoDevice? = null,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์–˜๋„ค๋„ data class๋„ ์•„๋‹ˆ๊ณ  ๊ฐ‘์ž๊ธฐ ํ•œ ํŒŒ์ผ ์•ˆ์— ์—ฌ๋Ÿฌ ๊ฐœ์˜ DTO๋“ค์ด ์žˆ์–ด์š”.

์ €ํฌ ์›๋ž˜ ์ด๋ ‡๊ฒŒ ํ–ˆ์—ˆ์—ˆ๋‚˜์š” ๋„˜ ์˜ค๋ž˜๋˜์„œ ๊ธฐ์–ต์ด..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ”Œ์  ์‹œ์ž‘ํ•  ๋•Œ ์ปจ๋ฒค์…˜์„ ๊ตฌ์ฒด์ ์œผ๋กœ ํฌ๊ฒŒ ์ •ํ•˜๊ณ  ๊ฐ€์งˆ ์•Š์•˜์—ˆ์–ด์š”
์ด ๋ถ€๋ถ„ ์ค‘์š”์„ฑ ํฌ๊ฒŒ ๋Š๋ผ๊ณ  ๊ฐ€๋„ค์š”

Comment on lines +22 to +33
return getSession(request).fold(
onSuccess = { userSession ->
getUserAttr(userSession).fold(
onSuccess = { userAttr ->
Result.success(LoginResponse(userSession, userAttr))
},
onFailure = { Result.failure(it) },
)
},
onFailure = { Result.failure(it) },
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fold() ๋ฅผ ์“ฐ์ง€ ์•Š๊ณ  onSuccess, onFailure๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋˜‘๊ฐ™์€ ๋กœ์ง์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š”๋ฐ

ํ˜น์‹œ fold() ๋ฅผ ์ฒ˜์Œ์— ์‚ฌ์šฉํ•˜์‹  ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?!

image

์ €๋„ ์•„๋ฌด๊ฒƒ๋„ ๋ชจ๋ฅด๊ณ  ์‚ฌ์šฉํ•˜๋‹ค๊ฐ€ ์ง„ํ˜ธ๋‹˜์ด๋ž‘ ํ”„๋กœ์ ํŠธ ํ•˜๋ฉด์„œ ๊ณ ์ณค์–ด์„œ ใ… ใ… 

pknu-wap/WAPP#73 (comment)

Copy link
Collaborator Author

@pknujsp pknujsp Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSeesion(), getUserAttr() ์ด ๋‘ ๊ฐœ๊ฐ€ ๋ฐ˜ํ™˜ ํƒ€์ž…์ด ๋‹ฌ๋ผ์„œ onSuccess๋กœ ๊ตฌํ˜„ํ•˜๊ธฐ์—๋Š” ์ข€ ์–ด๋ ค์›€์ด ์žˆ์–ด์„œ fold๋ฅผ ์ผ์–ด์š”.

mapCatching๋กœ ๋ฐ”๊พธ๊ณ  getUserAttr() ๊ฒฐ๊ณผ๊ฐ€ ์‹คํŒจ์ผ ๋•Œ ์˜ˆ์™ธ๋ฅผ ๋˜์ ธ์„œ ์ง€๊ธˆ ์ฝ”๋“œ์˜ fold ๋‚ด์— fold์—์„œ ๋™์ž‘ํ•˜๋Š” ๊ฑฐ๋ž‘
๋˜‘๊ฐ™์€ ๋™์ž‘์„ ํ•˜๋„๋ก ๋ฐ”๊ฟ”์„œ ๋ฐ˜์˜ํ• ๊ฒŒ์šฉ

    override suspend fun login(request: LoginRequest): Result<LoginResponse> = getSession(request).mapCatching { userSession ->
        LoginResponse(userSession, getUserAttr(userSession).getOrElse { throw it })
    }

Comment on lines +21 to +30
override suspend fun changeNickname(changeNicknameParameter: ChangeNicknameParameter): Flow<Result<ChangeNicknameResponse>> = channelFlow {
awsNetworkApi.changeNickname(changeNicknameParameter).onResponse()
.fold(onSuccess = { Result.success(it) }, onFailure = { Result.failure(it) }).also { trySend(it) }
}

override suspend fun changePassword(changePasswordParameter: ChangePasswordParameter): Flow<Result<ChangePasswordResponse>> = channelFlow {
/* val password = WeakReference(aesCoder.encodePassword(changePasswordParameter.email, changePasswordParameter.newPassword)).get()!!
awsNetworkApi.changePassword(ChangePasswordParameter(password.toCharArray())).onResponse()
.fold(onSuccess = { Result.success(it) }, onFailure = { Result.failure(it) }).also { trySend(it) }*/
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์—ฌ๊ธฐ๋„ ์‚ฌ์‹ค flow๋ฅผ ์‚ฌ์šฉํ•  ํ•„์š”๊ฐ€ ์ „ํ˜€ ์—†๋Š” ๋ถ€๋ถ„์ด์—ˆ๋„ค์š”..

ํ‘ํ‘,.. ์ด ๋ถ€๋ถ„๋„ ๋‹ค suspend๋กœ ๊ณ ์ณ์•ผํ•˜๋Š” ๋ถ€๋ถ„์ธ ๊ฒƒ ๊ฐ™์•„์š”.

Copy link
Collaborator Author

@pknujsp pknujsp Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ € ์ด๊ฑฐ ๊ฐœ๋ฐœํ•  ๋•Œ ์ฝ”๋ฃจํ‹ด์„ ์ œ๋Œ€๋กœ ์ฒจ ์จ๋ด์„œ ๋ฌด์ง€์„ฑ์œผ๋กœ flow๋•Œ๋ ค๋ฐ•์€ ๊ฒฝํ–ฅ์ด ์žˆ์–ด์š”
channelFlow๋•Œ๋ฌธ์— ์„œ๋กœ ๊ณ ์ƒํ–ˆ๋˜ ๊ธฐ์–ต์ด ๋‚˜๋„ค์š”

5์›” ์ด๋„ค์š” ใ„ทใ„ท
thumbnail

Comment on lines -27 to +29
lateinit var title: TextView
lateinit var redPoint: TextView
lateinit var inputData: EditText
var title: TextView
var redPoint: TextView
var inputData: EditText
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์—ฌ๊ธฐ lateinit ์ง€์šฐ์‹  ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐ”์ธ๋”ฉ ์–ด๋Œ‘ํ„ฐ ์—ฐ๊ฒฐ์‹œํ‚ค๋‹ค๊ฐ€ ๊ฐ์ฒด ์ดˆ๊ธฐํ™” ์˜ค๋ฅ˜๋‚˜์„œ ์ž ์‹œ ๋นผ๋†จ์—ˆ๋Š”๋ฐ
์ตœ์ข…์ ์œผ๋กœ lateinit ์ด๊ฒŒ ๋ฌธ์ œ๊ฐ€ ์—†๋Š” ๋ถ€๋ถ„์ด๋ผ ๋‹ค์‹œ ๋ณต๊ตฌ์‹œํ‚ค๋Š”๊ฑธ ๊นœ๋นก์“ฐํ–ˆ๋„ค์š”

private val _captureState = MutableSharedFlow<InferenceState<CapturedDetectionEntity>>(replay = 1, extraBufferCapacity = 1)
val captureState get() = _captureState.asSharedFlow()
private val _captureState = MutableSharedFlow<InferenceState<CapturedDetectionEntity>>(replay = 1, extraBufferCapacity = 0)
val captureState: SharedFlow<InferenceState<CapturedDetectionEntity>> = _captureState

private val vibrateDuration = 50L
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๋Ÿฐ ์ƒ์ˆ˜๋Š” ๋Œ€๋ฌธ์ž๋กœ ์ฒ˜๋ฆฌ ํ–ˆ์–ด์•ผ ํ–ˆ๋Š”๋ฐ ๋„ˆ๋ฌด ๋’ค๋Šฆ๊ฒŒ ๋ฐœ๊ฒฌํ–ˆ๋„ค์š”..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๊ฑฐ ๋ฒ”์ธ๋ˆ„๊ตฌ์ฃ  ๋ฌธ์ œ๋„ค์š”
์ƒ์ˆ˜ํ™” ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค ใ…‹ใ…‹ใ…‹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants