diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..75e2e61
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml
new file mode 100644
index 0000000..02b915b
--- /dev/null
+++ b/.idea/git_toolbox_prj.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/najudoryeong/mineme/MainActivity.kt b/app/src/main/java/com/najudoryeong/mineme/MainActivity.kt
index 1eab185..942b5cb 100644
--- a/app/src/main/java/com/najudoryeong/mineme/MainActivity.kt
+++ b/app/src/main/java/com/najudoryeong/mineme/MainActivity.kt
@@ -3,19 +3,18 @@ package com.najudoryeong.mineme
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
-import android.view.WindowManager
import androidx.activity.viewModels
import androidx.databinding.DataBindingUtil
-import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
-import androidx.navigation.fragment.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.setupWithNavController
import com.najudoryeong.mineme.common_ui.MainActivityUtil
import com.najudoryeong.mineme.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint
+import com.najudoryeong.mineme.story.R.id.storyFragment
+import com.najudoryeong.mineme.home.R.id.homeFragment
// 하위 모듈이 MainViewModel 코드에 접근할 수 있게 MainViewModelUtil 상속 구현
@@ -47,7 +46,7 @@ class MainActivity : AppCompatActivity(), MainActivityUtil {
// appbar 구성 요소 설정
// 바텀네비게이션과 연결하면 해당 프래그먼트에 네비게이션으로는 backButton x
appBarConfiguration = AppBarConfiguration(
- setOf(R.id.nav_home, R.id.nav_setting, R.id.nav_setting)
+ setOf(homeFragment, storyFragment, R.id.nav_setting)
)
// navController 와 actionbar 연결
diff --git a/app/src/main/java/com/najudoryeong/mineme/MainViewModel.kt b/app/src/main/java/com/najudoryeong/mineme/MainViewModel.kt
index 8bf586b..a4827d0 100644
--- a/app/src/main/java/com/najudoryeong/mineme/MainViewModel.kt
+++ b/app/src/main/java/com/najudoryeong/mineme/MainViewModel.kt
@@ -1,7 +1,5 @@
package com.najudoryeong.mineme
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
diff --git a/app/src/main/java/com/najudoryeong/mineme/MineMeApplication.kt b/app/src/main/java/com/najudoryeong/mineme/MineMeApplication.kt
index 5502347..395f0c8 100644
--- a/app/src/main/java/com/najudoryeong/mineme/MineMeApplication.kt
+++ b/app/src/main/java/com/najudoryeong/mineme/MineMeApplication.kt
@@ -2,7 +2,7 @@ package com.najudoryeong.mineme
import android.app.Application
import android.util.Log
-import com.example.common.util.NATIVE_APP_KEY
+import com.najudoryeong.mineme.common.util.NATIVE_APP_KEY
import com.kakao.sdk.common.KakaoSdk
import com.kakao.sdk.common.util.Utility
import dagger.hilt.android.HiltAndroidApp
@@ -12,11 +12,12 @@ class MineMeApplication : Application() {
override fun onCreate() {
super.onCreate()
KakaoSdk.init(this, NATIVE_APP_KEY)
- //printAppKeyHash()
+ printAppKeyHash()
}
private fun printAppKeyHash() {
val keyHash = Utility.getKeyHash(this)
Log.d("KeyHash", keyHash)
+ //RBBgnAEhRDraP7W34/nu69W5cMc=
}
}
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index df5071e..5387261 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,9 +1,9 @@
-
diff --git a/build.gradle b/build.gradle
index d4a77ef..3c431c0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,6 +17,10 @@ buildscript {
kakao_version = '2.12.1'
dataStorePreferences_version = '1.0.0'
retrofit2Version = '2.9.0'
+ recyclerViewVersion = '1.2.1'
+ swipeRefreshLayoutVersion = '1.1.0'
+ materialVersion='1.8.0'
+ appCompatVersion='1.6.1'
}
diff --git a/common-ui/build.gradle b/common-ui/build.gradle
index bd1fcd6..6115e10 100644
--- a/common-ui/build.gradle
+++ b/common-ui/build.gradle
@@ -38,6 +38,15 @@ android {
dependencies {
+ api project(path: ':common')
+
+
+ // Material
+ api "com.google.android.material:material:$rootProject.materialVersion"
+ api "androidx.appcompat:appcompat:$rootProject.appCompatVersion"
+
+ // RecyclerView
+ api "androidx.recyclerview:recyclerview:$rootProject.recyclerViewVersion"
// Fragment
api "androidx.fragment:fragment:$rootProject.fragment_version"
@@ -57,6 +66,8 @@ dependencies {
implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
kapt "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion"
+ // Refresh
+ api "androidx.swiperefreshlayout:swiperefreshlayout:$rootProject.swipeRefreshLayoutVersion"
// Glide
implementation 'com.github.bumptech.glide:glide:4.14.2'
diff --git a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BaseFragment.kt b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BaseFragment.kt
index b1f3562..7c4f1c2 100644
--- a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BaseFragment.kt
+++ b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BaseFragment.kt
@@ -17,6 +17,8 @@ abstract class BaseFragment(val fragment: FragmentInfoUtil)
// baseFragment를 상속받은 fragment에서만 제한된 작업 initView 에서 진행
abstract fun initView()
+ open fun menuClick(){}
+
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@@ -30,6 +32,8 @@ abstract class BaseFragment(val fragment: FragmentInfoUtil)
setToolbarTitle(getString(fragment.toolbarText))
}
+ setVisibilityNav()
+
return binding.root
}
@@ -41,6 +45,13 @@ abstract class BaseFragment(val fragment: FragmentInfoUtil)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
initView()
initMenu()
+
+ }
+
+ private fun setVisibilityNav() {
+ (activity as MainActivityUtil).run {
+ setVisibilityBottomAppbar(fragment.bottomNavi_visibility)
+ }
}
private fun initMenu() {
@@ -62,12 +73,14 @@ abstract class BaseFragment(val fragment: FragmentInfoUtil)
android.R.id.home -> {
popBackStack()
}
- else -> {}
+ else -> {
+ menuClick()
+ }
}
}
return true
}
}, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
+}
-}
\ No newline at end of file
diff --git a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BindingAdapter.kt b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BindingAdapter.kt
index a1c0ead..64efc1b 100644
--- a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BindingAdapter.kt
+++ b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/BindingAdapter.kt
@@ -1,7 +1,11 @@
package com.najudoryeong.mineme.common_ui
+import android.net.Uri
+import android.view.View
import android.widget.ImageView
import androidx.databinding.BindingAdapter
+import androidx.recyclerview.widget.ListAdapter
+import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
@@ -13,3 +17,24 @@ fun bindImageView(imageView: ImageView, photoUrl: String?) {
.into(imageView)
}
+@BindingAdapter("uri")
+fun bindImageView(imageView: ImageView, uri: Uri?) {
+ Glide.with(imageView.context)
+ .load(uri)
+ .into(imageView)
+}
+
+@BindingAdapter("visible")
+fun setVisibility(view: View, flag: Boolean) {
+ view.visibility = if (flag) View.VISIBLE else View.GONE
+}
+
+@BindingAdapter("adapter", "submitList", requireAll = true)
+fun bindRecyclerView(view: RecyclerView, adapter: RecyclerView.Adapter<*>, submitList: List?) {
+ view.adapter = adapter.apply {
+ stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY
+ (this as ListAdapter).submitList(submitList?.toMutableList())
+ }
+}
+
+
diff --git a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/CalendarUtil.kt b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/CalendarUtil.kt
new file mode 100644
index 0000000..79e8f19
--- /dev/null
+++ b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/CalendarUtil.kt
@@ -0,0 +1,50 @@
+package com.najudoryeong.mineme.common_ui
+
+import android.widget.DatePicker
+import android.widget.TextView
+import java.text.SimpleDateFormat
+import java.util.*
+
+class CalendarUtil {
+ companion object {
+
+ private val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.KOREA)
+
+ private fun Calendar.getYear() = get(Calendar.YEAR)
+ private fun Calendar.getMonth() = get(Calendar.MONTH)+1
+ private fun Calendar.getDay() = get(Calendar.DAY_OF_MONTH)
+
+
+ fun getTodayDate(): String = Calendar.getInstance().let {
+ return "${it.getYear()}-${it.getMonth()}-${it.getDay()}"
+ }
+
+ // private fun getDateFormat(year : String, month: String, day: String) : String = "${year} ${getMonthFormat(month)}"
+
+ fun DatePicker.getDate() = "$year-${month+1}-$dayOfMonth"
+
+ fun parseStringToDate(textView: TextView): Date? =
+ dateFormat.parse(textView.text.toString())
+
+ fun getMonthFormat(month: String): String {
+ return when (month.toInt()) {
+ Calendar.FEBRUARY -> "Feb"
+ Calendar.MARCH -> "Mar"
+ Calendar.APRIL -> "Apr"
+ Calendar.MAY -> "May"
+ Calendar.JUNE -> "Jun"
+ Calendar.JULY -> "Jul"
+ Calendar.AUGUST -> "Aug"
+ Calendar.SEPTEMBER -> "Sep"
+ Calendar.OCTOBER -> "Oct"
+ Calendar.NOVEMBER -> "Nov"
+ Calendar.DECEMBER -> "Dec"
+ else -> throw IllegalArgumentException("Invalid month: $month")
+ }
+ }
+
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/DialogForDatePicker.kt b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/DialogForDatePicker.kt
new file mode 100644
index 0000000..a0cc221
--- /dev/null
+++ b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/DialogForDatePicker.kt
@@ -0,0 +1,62 @@
+package com.najudoryeong.mineme.common_ui
+
+import android.app.Dialog
+import android.content.Context
+import android.graphics.Color
+import android.graphics.drawable.ColorDrawable
+import android.os.Bundle
+import com.najudoryeong.mineme.common_ui.CalendarUtil.Companion.getDate
+import com.najudoryeong.mineme.common_ui.databinding.DialogForDatepickerBinding
+import java.util.*
+
+class DialogForDatePicker(
+ context: Context,
+ private val initDate: Date,
+ private val onClickPositiveButton: (String) -> Unit
+) : Dialog(context) {
+ private lateinit var binding: DialogForDatepickerBinding
+ private var calendar: Calendar = Calendar.getInstance()
+
+ init {
+ calendar.time = initDate
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ binding = DialogForDatepickerBinding.inflate(layoutInflater).apply {
+ datePicker.init(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH),null)
+ positiveButton.setOnClickListener {
+ onClickPositiveButton.invoke(datePicker.getDate())
+ dismiss()
+ }
+ negativeButton.setOnClickListener {
+ dismiss()
+ }
+ }
+ setContentView(binding.root)
+
+ window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ }
+
+ class Builder(private val context: Context) {
+ private lateinit var initDate: Date
+ private var onClickPositiveButton : (String) -> Unit = {}
+
+
+ fun setInitDate(initDate: Date) = apply {
+ this.initDate = initDate
+ }
+
+ fun setOnClickPositiveButton(onClickPositiveButton: (String) -> Unit) = apply {
+ this.onClickPositiveButton = onClickPositiveButton
+ }
+
+
+ fun build() = DialogForDatePicker(
+ context,
+ initDate,
+ onClickPositiveButton
+ )
+ }
+}
\ No newline at end of file
diff --git a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/MainActivityUtil.kt b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/MainActivityUtil.kt
index 18613b8..d422180 100644
--- a/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/MainActivityUtil.kt
+++ b/common-ui/src/main/java/com/najudoryeong/mineme/common_ui/MainActivityUtil.kt
@@ -1,7 +1,5 @@
package com.najudoryeong.mineme.common_ui
-import androidx.fragment.app.Fragment
-
interface MainActivityUtil{
fun setToolbarTitle(newTitle: String)
fun setVisibilityBottomAppbar(visibilityMode : Int)
diff --git a/common-ui/src/main/res/drawable/img_dropdown.xml b/common-ui/src/main/res/drawable/img_dropdown.xml
new file mode 100644
index 0000000..acdbc69
--- /dev/null
+++ b/common-ui/src/main/res/drawable/img_dropdown.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/common-ui/src/main/res/drawable/spinner_shape.xml b/common-ui/src/main/res/drawable/spinner_shape.xml
new file mode 100644
index 0000000..0a44c33
--- /dev/null
+++ b/common-ui/src/main/res/drawable/spinner_shape.xml
@@ -0,0 +1,16 @@
+
+
+ -
+
+
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common-ui/src/main/res/layout/dialog_for_datepicker.xml b/common-ui/src/main/res/layout/dialog_for_datepicker.xml
new file mode 100644
index 0000000..0c42190
--- /dev/null
+++ b/common-ui/src/main/res/layout/dialog_for_datepicker.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/common-ui/src/main/res/layout/dialog_for_permission.xml b/common-ui/src/main/res/layout/dialog_for_permission.xml
index 346d6f4..693e118 100644
--- a/common-ui/src/main/res/layout/dialog_for_permission.xml
+++ b/common-ui/src/main/res/layout/dialog_for_permission.xml
@@ -27,22 +27,26 @@
app:layout_constraintTop_toTopOf="parent" />
@@ -52,10 +56,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
+ android:lineSpacingExtra="2sp"
android:text="확인을 누르시면 동의 및 다음 단계로 넘어갑니다."
+ android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/dialog_button" />
diff --git a/common-ui/src/main/res/layout/item_dropdown.xml b/common-ui/src/main/res/layout/item_dropdown.xml
new file mode 100644
index 0000000..b305adc
--- /dev/null
+++ b/common-ui/src/main/res/layout/item_dropdown.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/common-ui/src/main/res/layout/item_story.xml b/common-ui/src/main/res/layout/item_story.xml
index b9fb288..514a21b 100644
--- a/common-ui/src/main/res/layout/item_story.xml
+++ b/common-ui/src/main/res/layout/item_story.xml
@@ -18,61 +18,57 @@
-
+ android:layout_height="match_parent"
+ app:cardCornerRadius="8dp">
-
+ android:orientation="vertical">
+
-
+ android:scaleType="centerCrop"
+ android:src="@drawable/img_profile" />
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_weight="1"
+ android:fontFamily="@font/cafe24_ssurround"
+ android:gravity="end"
+ android:padding="16dp"
+ android:text="@{date}"
+ android:textColor="#FFFFFF"
+ android:textSize="17sp" />
+
+
+
+
+
+
diff --git a/common-ui/src/main/res/values/strings.xml b/common-ui/src/main/res/values/strings.xml
index 07d090c..122bdd8 100644
--- a/common-ui/src/main/res/values/strings.xml
+++ b/common-ui/src/main/res/values/strings.xml
@@ -5,4 +5,9 @@
확인
New Story
No Story
+
+ - 기록을 위해서 갤러리 위치 접근 동의가 필요해요
+ - 기록을 위해서 갤러리 위치 접근 동의가 필요해요
+ - 기록을 위해서 갤러리 위치 접근 동의가 필요해요
+
\ No newline at end of file
diff --git a/common/build.gradle b/common/build.gradle
index 33da4fd..07d8fef 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -32,6 +32,9 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
+ buildFeatures {
+ dataBinding true
+ }
}
dependencies {
diff --git a/common/src/androidTest/java/com/example/common/ExampleInstrumentedTest.kt b/common/src/androidTest/java/com/najudoryeong/common/ExampleInstrumentedTest.kt
similarity index 95%
rename from common/src/androidTest/java/com/example/common/ExampleInstrumentedTest.kt
rename to common/src/androidTest/java/com/najudoryeong/common/ExampleInstrumentedTest.kt
index 0886bf6..6f6b0a8 100644
--- a/common/src/androidTest/java/com/example/common/ExampleInstrumentedTest.kt
+++ b/common/src/androidTest/java/com/najudoryeong/common/ExampleInstrumentedTest.kt
@@ -1,4 +1,4 @@
-package com.example.common
+package com.najudoryeong.common
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
diff --git a/common/src/main/AndroidManifest.xml b/common/src/main/AndroidManifest.xml
index e6aae30..81f84ad 100644
--- a/common/src/main/AndroidManifest.xml
+++ b/common/src/main/AndroidManifest.xml
@@ -1,11 +1,11 @@
-
-
+
-
-
+
+
\ No newline at end of file
diff --git a/common/src/main/java/com/example/common/data/dto/HomeResponse.kt b/common/src/main/java/com/example/common/data/dto/HomeResponse.kt
deleted file mode 100644
index a918119..0000000
--- a/common/src/main/java/com/example/common/data/dto/HomeResponse.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.example.common.data.dto
-
-import com.example.common.data.entity.HomeData
-
-data class HomeResponse(
- val data: HomeData,
- val success: Boolean
-)
\ No newline at end of file
diff --git a/common/src/main/java/com/example/common/data/dto/LoginResponse.kt b/common/src/main/java/com/example/common/data/dto/LoginResponse.kt
deleted file mode 100644
index 249dc22..0000000
--- a/common/src/main/java/com/example/common/data/dto/LoginResponse.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.example.common.data.dto
-
-import com.example.common.data.entity.LoginData
-
-data class LoginResponse(
- val success: Boolean,
- val data: LoginData
-)
\ No newline at end of file
diff --git a/common/src/main/java/com/example/common/util/Constant.kt b/common/src/main/java/com/example/common/util/Constant.kt
deleted file mode 100644
index f951182..0000000
--- a/common/src/main/java/com/example/common/util/Constant.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.example.common.util
-
-const val NATIVE_APP_KEY = "5162225c94277a85e12566f227145303"
\ No newline at end of file
diff --git a/common/src/main/java/com/example/common/data/dto/CodeRequest.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/CodeRequest.kt
similarity index 50%
rename from common/src/main/java/com/example/common/data/dto/CodeRequest.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/dto/CodeRequest.kt
index 557aeeb..1645044 100644
--- a/common/src/main/java/com/example/common/data/dto/CodeRequest.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/CodeRequest.kt
@@ -1,4 +1,4 @@
-package com.example.common.data.dto
+package com.najudoryeong.mineme.common.data.dto
data class CodeRequest(
val code : String
diff --git a/common/src/main/java/com/najudoryeong/mineme/common/data/dto/CommonResponse.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/CommonResponse.kt
new file mode 100644
index 0000000..d9ae1a4
--- /dev/null
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/CommonResponse.kt
@@ -0,0 +1,6 @@
+package com.najudoryeong.mineme.common.data.dto
+
+data class CommonResponse(
+ val data: T,
+ val success: Boolean
+)
diff --git a/common/src/main/java/com/example/common/data/dto/LoginRequest.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/LoginRequest.kt
similarity index 69%
rename from common/src/main/java/com/example/common/data/dto/LoginRequest.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/dto/LoginRequest.kt
index 177ab77..21aaf25 100644
--- a/common/src/main/java/com/example/common/data/dto/LoginRequest.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/LoginRequest.kt
@@ -1,4 +1,4 @@
-package com.example.common.data.dto
+package com.najudoryeong.mineme.common.data.dto
data class LoginRequest(
val accessToken: String,
diff --git a/common/src/main/java/com/najudoryeong/mineme/common/data/dto/LoginResponse.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/LoginResponse.kt
new file mode 100644
index 0000000..97e4163
--- /dev/null
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/LoginResponse.kt
@@ -0,0 +1,8 @@
+package com.najudoryeong.mineme.common.data.dto
+
+import com.najudoryeong.mineme.common.data.entity.LoginData
+
+data class LoginResponse(
+ val success: Boolean,
+ val data: LoginData
+)
\ No newline at end of file
diff --git a/common/src/main/java/com/example/common/data/dto/NullResponse.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/NullResponse.kt
similarity index 60%
rename from common/src/main/java/com/example/common/data/dto/NullResponse.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/dto/NullResponse.kt
index 7ea3135..15e32ae 100644
--- a/common/src/main/java/com/example/common/data/dto/NullResponse.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/NullResponse.kt
@@ -1,4 +1,4 @@
-package com.example.common.data.dto
+package com.najudoryeong.mineme.common.data.dto
data class NullResponse(
val success: Boolean,
diff --git a/common/src/main/java/com/example/common/data/dto/UserInfoRequest.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/UserInfoRequest.kt
similarity index 62%
rename from common/src/main/java/com/example/common/data/dto/UserInfoRequest.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/dto/UserInfoRequest.kt
index 4ac4985..1d88045 100644
--- a/common/src/main/java/com/example/common/data/dto/UserInfoRequest.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/dto/UserInfoRequest.kt
@@ -1,4 +1,4 @@
-package com.example.common.data.dto
+package com.najudoryeong.mineme.common.data.dto
data class UserInfoRequest(
val nickname: String,
diff --git a/common/src/main/java/com/example/common/data/entity/LoginData.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/entity/LoginData.kt
similarity index 56%
rename from common/src/main/java/com/example/common/data/entity/LoginData.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/entity/LoginData.kt
index 22420d5..7a6af3a 100644
--- a/common/src/main/java/com/example/common/data/entity/LoginData.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/entity/LoginData.kt
@@ -1,4 +1,4 @@
-package com.example.common.data.entity
+package com.najudoryeong.mineme.common.data.entity
data class LoginData(
val jwt: String,
diff --git a/common/src/main/java/com/example/common/data/entity/ProviderName.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/entity/ProviderName.kt
similarity index 57%
rename from common/src/main/java/com/example/common/data/entity/ProviderName.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/entity/ProviderName.kt
index 89a9288..4ed76f9 100644
--- a/common/src/main/java/com/example/common/data/entity/ProviderName.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/entity/ProviderName.kt
@@ -1,4 +1,4 @@
-package com.example.common.data.entity
+package com.najudoryeong.mineme.common.data.entity
enum class ProviderType(providerType: String) {
KAKAO("KAKAO")
diff --git a/common/src/main/java/com/example/common/data/source/AuthService.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/source/AuthService.kt
similarity index 51%
rename from common/src/main/java/com/example/common/data/source/AuthService.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/source/AuthService.kt
index 55a82c3..e80ec17 100644
--- a/common/src/main/java/com/example/common/data/source/AuthService.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/source/AuthService.kt
@@ -1,7 +1,7 @@
-package com.example.common.data.source
+package com.najudoryeong.mineme.common.data.source
-import com.example.common.data.dto.LoginRequest
-import com.example.common.data.dto.LoginResponse
+import com.najudoryeong.mineme.common.data.dto.LoginRequest
+import com.najudoryeong.mineme.common.data.dto.LoginResponse
import retrofit2.http.Body
import retrofit2.http.POST
diff --git a/common/src/main/java/com/example/common/data/source/UserService.kt b/common/src/main/java/com/najudoryeong/mineme/common/data/source/UserService.kt
similarity index 54%
rename from common/src/main/java/com/example/common/data/source/UserService.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/data/source/UserService.kt
index 9176de6..232785e 100644
--- a/common/src/main/java/com/example/common/data/source/UserService.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/data/source/UserService.kt
@@ -1,11 +1,9 @@
-package com.example.common.data.source
+package com.najudoryeong.mineme.common.data.source
-import com.example.common.data.dto.CodeRequest
-import com.example.common.data.dto.HomeResponse
-import com.example.common.data.dto.UserInfoRequest
-import com.example.common.data.dto.NullResponse
+import com.najudoryeong.mineme.common.data.dto.CodeRequest
+import com.najudoryeong.mineme.common.data.dto.UserInfoRequest
+import com.najudoryeong.mineme.common.data.dto.NullResponse
import retrofit2.http.Body
-import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
@@ -24,11 +22,4 @@ interface UserService {
@Body userCodeRequest: CodeRequest
): NullResponse
-
- @GET("api/test/main/info")
- suspend fun getHomeInfo(
- @Header("Authorization") token: String,
- ): HomeResponse
-
-
}
\ No newline at end of file
diff --git a/common/src/main/java/com/example/common/di/DataStoreModule.kt b/common/src/main/java/com/najudoryeong/mineme/common/di/DataStoreModule.kt
similarity index 87%
rename from common/src/main/java/com/example/common/di/DataStoreModule.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/di/DataStoreModule.kt
index 0063ed8..f87a946 100644
--- a/common/src/main/java/com/example/common/di/DataStoreModule.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/di/DataStoreModule.kt
@@ -1,10 +1,10 @@
-package com.example.common.di
+package com.najudoryeong.mineme.common.di
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore
-import com.example.common.domain.usecase.DataStoreUseCase
+import com.najudoryeong.mineme.common.domain.usecase.DataStoreUseCase
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
diff --git a/common/src/main/java/com/example/common/di/NetworkModule.kt b/common/src/main/java/com/najudoryeong/mineme/common/di/NetworkModule.kt
similarity index 77%
rename from common/src/main/java/com/example/common/di/NetworkModule.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/di/NetworkModule.kt
index c8a30f6..376b3ce 100644
--- a/common/src/main/java/com/example/common/di/NetworkModule.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/di/NetworkModule.kt
@@ -1,13 +1,12 @@
-package com.example.common.di
+package com.najudoryeong.mineme.common.di
-import com.example.common.data.source.AuthService
-import com.example.common.data.source.UserService
+import com.najudoryeong.mineme.common.data.source.AuthService
+import com.najudoryeong.mineme.common.data.source.UserService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
-import retrofit2.create
import javax.inject.Singleton
@Module
diff --git a/common/src/main/java/com/najudoryeong/mineme/common/domain/entity/Story.kt b/common/src/main/java/com/najudoryeong/mineme/common/domain/entity/Story.kt
new file mode 100644
index 0000000..51f365e
--- /dev/null
+++ b/common/src/main/java/com/najudoryeong/mineme/common/domain/entity/Story.kt
@@ -0,0 +1,8 @@
+package com.najudoryeong.mineme.common.domain.entity
+
+data class Story(
+ val date: String,
+ val postId: Int,
+ val region: String,
+ val thumbnailImage: String
+)
diff --git a/common/src/main/java/com/example/common/domain/usecase/DataStoreUseCase.kt b/common/src/main/java/com/najudoryeong/mineme/common/domain/usecase/DataStoreUseCase.kt
similarity index 93%
rename from common/src/main/java/com/example/common/domain/usecase/DataStoreUseCase.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/domain/usecase/DataStoreUseCase.kt
index 2e577ee..cf7f389 100644
--- a/common/src/main/java/com/example/common/domain/usecase/DataStoreUseCase.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/domain/usecase/DataStoreUseCase.kt
@@ -1,5 +1,6 @@
-package com.example.common.domain.usecase
+package com.najudoryeong.mineme.common.domain.usecase
+import android.util.Log
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.intPreferencesKey
@@ -30,6 +31,7 @@ class DataStoreUseCase @Inject constructor(
suspend fun editJsonWebToken(jwt: String) {
dataStore.edit {
+ Log.d("test", "edijwt")
it[jsonWebToken_key] = jwt
}
}
diff --git a/common/src/main/java/com/example/common/domain/usecase/UserUseCase.kt b/common/src/main/java/com/najudoryeong/mineme/common/domain/usecase/UserUseCase.kt
similarity index 62%
rename from common/src/main/java/com/example/common/domain/usecase/UserUseCase.kt
rename to common/src/main/java/com/najudoryeong/mineme/common/domain/usecase/UserUseCase.kt
index 852b0cd..f5ab5b8 100644
--- a/common/src/main/java/com/example/common/domain/usecase/UserUseCase.kt
+++ b/common/src/main/java/com/najudoryeong/mineme/common/domain/usecase/UserUseCase.kt
@@ -1,8 +1,6 @@
-package com.example.common.domain.usecase
+package com.najudoryeong.mineme.common.domain.usecase
-import com.example.common.data.dto.HomeResponse
-import com.example.common.data.source.UserService
-import kotlinx.coroutines.launch
+import com.najudoryeong.mineme.common.data.source.UserService
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/common/src/main/java/com/najudoryeong/mineme/common/util/Constant.kt b/common/src/main/java/com/najudoryeong/mineme/common/util/Constant.kt
new file mode 100644
index 0000000..a71e5f3
--- /dev/null
+++ b/common/src/main/java/com/najudoryeong/mineme/common/util/Constant.kt
@@ -0,0 +1,3 @@
+package com.najudoryeong.mineme.common.util
+
+const val NATIVE_APP_KEY = "5162225c94277a85e12566f227145303"
diff --git a/common/src/main/java/com/najudoryeong/mineme/common/util/GalleryObject.kt b/common/src/main/java/com/najudoryeong/mineme/common/util/GalleryObject.kt
new file mode 100644
index 0000000..c9fac79
--- /dev/null
+++ b/common/src/main/java/com/najudoryeong/mineme/common/util/GalleryObject.kt
@@ -0,0 +1,29 @@
+package com.najudoryeong.mineme.common.util
+
+import android.app.Activity.RESULT_OK
+import android.content.Intent
+import android.net.Uri
+import android.widget.Toast
+import androidx.activity.result.ActivityResultLauncher
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.lifecycleScope
+import kotlinx.coroutines.flow.collectLatest
+import kotlinx.coroutines.launch
+
+class GalleryObject {
+
+ companion object {
+
+ fun getImageResult(fragment: Fragment, callback: (Uri)->Unit): ActivityResultLauncher {
+ return fragment.registerForActivityResult(
+ ActivityResultContracts.StartActivityForResult()
+ ) { result ->
+ if (result.resultCode == RESULT_OK) {
+ val imageUri = result.data?.data
+ callback.invoke(imageUri!!)
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/najudoryeong/mineme/common/util/PermissionCallback.kt b/common/src/main/java/com/najudoryeong/mineme/common/util/PermissionCallback.kt
new file mode 100644
index 0000000..d34a1e1
--- /dev/null
+++ b/common/src/main/java/com/najudoryeong/mineme/common/util/PermissionCallback.kt
@@ -0,0 +1,6 @@
+package com.najudoryeong.mineme.common.util
+
+interface PermissionCallback {
+ fun onSuccess()
+ fun onFail()
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/najudoryeong/mineme/common/util/PermissionObject.kt b/common/src/main/java/com/najudoryeong/mineme/common/util/PermissionObject.kt
new file mode 100644
index 0000000..4e4a48a
--- /dev/null
+++ b/common/src/main/java/com/najudoryeong/mineme/common/util/PermissionObject.kt
@@ -0,0 +1,39 @@
+package com.najudoryeong.mineme.common.util
+
+import android.Manifest
+import androidx.activity.result.ActivityResultLauncher
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.fragment.app.Fragment
+
+class PermissionObject {
+ companion object {
+ fun checkPermission(
+ fragment: Fragment,
+ onSuccessCallBack: () -> Unit,
+ onFailCallBack: () -> Unit
+ ): ActivityResultLauncher> {
+ return fragment.registerForActivityResult(
+ ActivityResultContracts.RequestMultiplePermissions()
+ ) { permissions ->
+ if (permissions.all { it.value }) {
+ onSuccessCallBack.invoke()
+ }else{
+ onFailCallBack.invoke()
+ }
+ }
+ }
+
+ }
+
+}
+
+enum class PermissionType(val permissionArray: Array) {
+ GPS(
+ arrayOf(
+ Manifest.permission.ACCESS_COARSE_LOCATION,
+ Manifest.permission.ACCESS_FINE_LOCATION
+ )
+ ),
+ CAMERA(arrayOf(Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE)),
+ NOTIFICATION(arrayOf(Manifest.permission.POST_NOTIFICATIONS))
+}
\ No newline at end of file
diff --git a/foundation/src/test/java/com/example/foundation/ExampleUnitTest.kt b/common/src/test/java/com/najudoryeong/common/ExampleUnitTest.kt
similarity index 90%
rename from foundation/src/test/java/com/example/foundation/ExampleUnitTest.kt
rename to common/src/test/java/com/najudoryeong/common/ExampleUnitTest.kt
index 756bb8c..5dfd46b 100644
--- a/foundation/src/test/java/com/example/foundation/ExampleUnitTest.kt
+++ b/common/src/test/java/com/najudoryeong/common/ExampleUnitTest.kt
@@ -1,4 +1,4 @@
-package com.example.foundation
+package com.najudoryeong.common
import org.junit.Test
diff --git a/foundation/src/androidTest/java/com/example/foundation/ExampleInstrumentedTest.kt b/foundation/src/androidTest/java/com/najudoryeong/foundation/ExampleInstrumentedTest.kt
similarity index 94%
rename from foundation/src/androidTest/java/com/example/foundation/ExampleInstrumentedTest.kt
rename to foundation/src/androidTest/java/com/najudoryeong/foundation/ExampleInstrumentedTest.kt
index 8379c8f..aaf319f 100644
--- a/foundation/src/androidTest/java/com/example/foundation/ExampleInstrumentedTest.kt
+++ b/foundation/src/androidTest/java/com/najudoryeong/foundation/ExampleInstrumentedTest.kt
@@ -1,4 +1,4 @@
-package com.example.foundation
+package com.najudoryeong.foundation
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
diff --git a/foundation/src/main/java/com/example/foundation/di/NetworkModule.kt b/foundation/src/main/java/com/najudoryeong/mineme/foundation/di/NetworkModule.kt
similarity index 90%
rename from foundation/src/main/java/com/example/foundation/di/NetworkModule.kt
rename to foundation/src/main/java/com/najudoryeong/mineme/foundation/di/NetworkModule.kt
index 868a0d8..32108c3 100644
--- a/foundation/src/main/java/com/example/foundation/di/NetworkModule.kt
+++ b/foundation/src/main/java/com/najudoryeong/mineme/foundation/di/NetworkModule.kt
@@ -1,6 +1,6 @@
-package com.example.foundation.di
+package com.najudoryeong.mineme.foundation.di
-import com.example.foundation.util.BASE_URL
+import com.najudoryeong.mineme.foundation.util.BASE_URL
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
diff --git a/foundation/src/main/java/com/example/foundation/util/Constant.kt b/foundation/src/main/java/com/najudoryeong/mineme/foundation/util/Constant.kt
similarity index 52%
rename from foundation/src/main/java/com/example/foundation/util/Constant.kt
rename to foundation/src/main/java/com/najudoryeong/mineme/foundation/util/Constant.kt
index 3fb9bfe..8600db9 100644
--- a/foundation/src/main/java/com/example/foundation/util/Constant.kt
+++ b/foundation/src/main/java/com/najudoryeong/mineme/foundation/util/Constant.kt
@@ -1,4 +1,4 @@
-package com.example.foundation.util
+package com.najudoryeong.mineme.foundation.util
const val BASE_URL = "http://13.125.67.47:18080/"
diff --git a/common/src/test/java/com/example/common/ExampleUnitTest.kt b/foundation/src/test/java/com/najudoryeong/foundation/ExampleUnitTest.kt
similarity index 89%
rename from common/src/test/java/com/example/common/ExampleUnitTest.kt
rename to foundation/src/test/java/com/najudoryeong/foundation/ExampleUnitTest.kt
index 6c9f3e0..9f6738d 100644
--- a/common/src/test/java/com/example/common/ExampleUnitTest.kt
+++ b/foundation/src/test/java/com/najudoryeong/foundation/ExampleUnitTest.kt
@@ -1,4 +1,4 @@
-package com.example.common
+package com.najudoryeong.foundation
import org.junit.Test
diff --git a/home/build.gradle b/home/build.gradle
index 8f10e2d..3375255 100644
--- a/home/build.gradle
+++ b/home/build.gradle
@@ -40,12 +40,10 @@ dependencies {
api project(path: ':common-ui')
api project(path: ':common')
-
// Hilt
implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
kapt "com.google.dagger:hilt-android-compiler:$rootProject.hiltVersion"
- api project(path: ':common-ui')
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
diff --git a/home/src/main/java/com/najudoryeong/mineme/home/data/HomeService.kt b/home/src/main/java/com/najudoryeong/mineme/home/data/HomeService.kt
new file mode 100644
index 0000000..5d5bc4f
--- /dev/null
+++ b/home/src/main/java/com/najudoryeong/mineme/home/data/HomeService.kt
@@ -0,0 +1,16 @@
+package com.najudoryeong.mineme.home.data
+
+import com.najudoryeong.mineme.common.data.dto.CommonResponse
+import com.najudoryeong.mineme.home.domain.entity.HomeData
+import retrofit2.http.GET
+import retrofit2.http.Header
+
+interface HomeService {
+
+ @GET("api/test/main/info")
+ suspend fun readHomeInfo(
+ @Header("Authorization") token: String,
+ ): CommonResponse
+
+
+}
\ No newline at end of file
diff --git a/home/src/main/java/com/najudoryeong/mineme/home/di/NetworkModule.kt b/home/src/main/java/com/najudoryeong/mineme/home/di/NetworkModule.kt
new file mode 100644
index 0000000..2b9ce98
--- /dev/null
+++ b/home/src/main/java/com/najudoryeong/mineme/home/di/NetworkModule.kt
@@ -0,0 +1,21 @@
+package com.najudoryeong.mineme.home.di
+
+import com.najudoryeong.mineme.home.data.HomeService
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import retrofit2.Retrofit
+import javax.inject.Singleton
+
+@Module
+@InstallIn(SingletonComponent::class)
+class NetworkModule {
+
+ @Singleton
+ @Provides
+ fun provideHomeService(retrofit: Retrofit): HomeService {
+ return retrofit.create(HomeService::class.java)
+ }
+
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/example/common/data/entity/HomeData.kt b/home/src/main/java/com/najudoryeong/mineme/home/domain/entity/HomeData.kt
similarity index 55%
rename from common/src/main/java/com/example/common/data/entity/HomeData.kt
rename to home/src/main/java/com/najudoryeong/mineme/home/domain/entity/HomeData.kt
index 49b7b56..9dff144 100644
--- a/common/src/main/java/com/example/common/data/entity/HomeData.kt
+++ b/home/src/main/java/com/najudoryeong/mineme/home/domain/entity/HomeData.kt
@@ -1,39 +1,27 @@
-package com.example.common.data.entity
+package com.najudoryeong.mineme.home.domain.entity
+
+import com.najudoryeong.mineme.common.domain.entity.Story
+
data class HomeData(
val couple: Couple,
- val newStory: NewStory,
+ val newStory: Story,
val widgets: List
)
data class Couple(
- val me: Me,
- val mine: Mine,
+ val me: UserInfo,
+ val mine: UserInfo,
val name: String,
val startDate: String
)
-data class NewStory(
- val date: String,
- val postId: Int,
- val region: String,
- val thumbnailImage: String
-)
-
-data class Mine(
- val birthday: String,
- val description: String,
- val gender: String,
- val instaId: String,
- val nickname: String,
- val profileImage: String
-)
-data class Me(
+data class UserInfo(
val birthday: String,
val description: String,
val gender: String,
diff --git a/home/src/main/java/com/najudoryeong/mineme/home/domain/usecase/HomeUseCase.kt b/home/src/main/java/com/najudoryeong/mineme/home/domain/usecase/HomeUseCase.kt
new file mode 100644
index 0000000..a9ce706
--- /dev/null
+++ b/home/src/main/java/com/najudoryeong/mineme/home/domain/usecase/HomeUseCase.kt
@@ -0,0 +1,16 @@
+package com.najudoryeong.mineme.home.domain.usecase
+
+
+import com.najudoryeong.mineme.home.data.HomeService
+import com.najudoryeong.mineme.home.domain.entity.HomeData
+import javax.inject.Inject
+
+class HomeUseCase @Inject constructor(
+ private val homeService: HomeService
+) {
+ // response를 entity로 변경하는 mapper 역할까지
+ suspend fun readHomeInfo(token: String): HomeData? {
+ val homeInfo = homeService.readHomeInfo(token)
+ return if (homeInfo.success) homeInfo.data else null
+ }
+}
\ No newline at end of file
diff --git a/home/src/main/java/com/najudoryeong/mineme/home/HomeFragment.kt b/home/src/main/java/com/najudoryeong/mineme/home/ui/HomeFragment.kt
similarity index 87%
rename from home/src/main/java/com/najudoryeong/mineme/home/HomeFragment.kt
rename to home/src/main/java/com/najudoryeong/mineme/home/ui/HomeFragment.kt
index 433f8a8..0a74db2 100644
--- a/home/src/main/java/com/najudoryeong/mineme/home/HomeFragment.kt
+++ b/home/src/main/java/com/najudoryeong/mineme/home/ui/HomeFragment.kt
@@ -1,12 +1,9 @@
-package com.najudoryeong.mineme.home
+package com.najudoryeong.mineme.home.ui
-import android.os.Bundle
-import android.view.View
import androidx.activity.OnBackPressedCallback
-import androidx.activity.viewModels
import androidx.fragment.app.viewModels
import com.najudoryeong.mineme.common_ui.BaseFragment
-import com.najudoryeong.mineme.common_ui.MainActivityUtil
+import com.najudoryeong.mineme.home.Home
import com.najudoryeong.mineme.home.databinding.FragmentHomeBinding
import dagger.hilt.android.AndroidEntryPoint
diff --git a/home/src/main/java/com/najudoryeong/mineme/home/HomeViewModel.kt b/home/src/main/java/com/najudoryeong/mineme/home/ui/HomeViewModel.kt
similarity index 52%
rename from home/src/main/java/com/najudoryeong/mineme/home/HomeViewModel.kt
rename to home/src/main/java/com/najudoryeong/mineme/home/ui/HomeViewModel.kt
index 071922a..381b181 100644
--- a/home/src/main/java/com/najudoryeong/mineme/home/HomeViewModel.kt
+++ b/home/src/main/java/com/najudoryeong/mineme/home/ui/HomeViewModel.kt
@@ -1,17 +1,12 @@
-package com.najudoryeong.mineme.home
+package com.najudoryeong.mineme.home.ui
-import android.content.Context
import android.util.Log
-import androidx.databinding.Bindable
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
-import com.example.common.data.dto.HomeResponse
-import com.example.common.data.entity.HomeData
-import com.example.common.data.source.AuthService
-import com.example.common.data.source.UserService
-import com.example.common.domain.usecase.DataStoreUseCase
+import com.najudoryeong.mineme.common.domain.usecase.DataStoreUseCase
+import com.najudoryeong.mineme.home.domain.entity.HomeData
+import com.najudoryeong.mineme.home.domain.usecase.HomeUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
-import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.first
@@ -20,8 +15,7 @@ import javax.inject.Inject
@HiltViewModel
class HomeViewModel @Inject constructor(
- @ApplicationContext private val context: Context,
- private val userService: UserService,
+ private val homeUseCase: HomeUseCase,
private val dataStoreUseCase: DataStoreUseCase
) : ViewModel() {
@@ -31,19 +25,16 @@ class HomeViewModel @Inject constructor(
private val _homeData = MutableStateFlow(null)
val homeData: StateFlow = _homeData
-
fun settingHomeData() {
viewModelScope.launch {
- var a = dataStoreUseCase.bearerJsonWebToken.first()
- if (a == null) a = "bearer test"
- userService.getHomeInfo(a).let {
- if (it.success){
- Log.d("TESTAPI","API넣음")
- if (it.data.newStory.postId == -1){
+ var jwt = dataStoreUseCase.bearerJsonWebToken.first()
+ if (jwt == null) jwt = "bearer test"
+ homeUseCase.readHomeInfo(jwt).let {
+ if (it != null){
+ if (it.newStory.postId == -1){
_isNewStory.value = true
}
- _homeData.value = it.data
-
+ _homeData.value = it
} else {
Log.d("TESTAPI","API실패")
}
diff --git a/home/src/main/java/com/najudoryeong/mineme/home/FragmentObject.kt b/home/src/main/java/com/najudoryeong/mineme/home/util/FragmentObject.kt
similarity index 100%
rename from home/src/main/java/com/najudoryeong/mineme/home/FragmentObject.kt
rename to home/src/main/java/com/najudoryeong/mineme/home/util/FragmentObject.kt
diff --git a/home/src/main/res/layout/fragment_home.xml b/home/src/main/res/layout/fragment_home.xml
index 814f833..aaeb5b2 100644
--- a/home/src/main/res/layout/fragment_home.xml
+++ b/home/src/main/res/layout/fragment_home.xml
@@ -10,7 +10,7 @@
+ type="com.najudoryeong.mineme.home.ui.HomeViewModel" />
@@ -18,7 +18,7 @@
+ tools:context=".ui.HomeFragment">
\ No newline at end of file
diff --git a/onboarding/src/main/AndroidManifest.xml b/onboarding/src/main/AndroidManifest.xml
index 06a6e6d..430bea6 100644
--- a/onboarding/src/main/AndroidManifest.xml
+++ b/onboarding/src/main/AndroidManifest.xml
@@ -5,7 +5,7 @@
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/LoginUtil.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/LoginUtil.kt
index 5292be4..aebd0d6 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/LoginUtil.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/LoginUtil.kt
@@ -25,7 +25,7 @@ class LoginUtil {
context: Context,
onLoginSuccess: (String?) -> Unit
) {
-
+ Log.d("test","로그인시도")
// 카카오계정으로 로그인 공통 callback 구성
// 카카오톡으로 로그인 할 수 없어 카카오계정으로 로그인할 경우 사용됨
val callback: (OAuthToken?, Throwable?) -> Unit = { token, error ->
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/InputCodeFragment.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/InputCodeFragment.kt
similarity index 81%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/InputCodeFragment.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/InputCodeFragment.kt
index 0f1d51a..92fe94c 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/InputCodeFragment.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/InputCodeFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.onboarding
+package com.najudoryeong.mineme.onboarding.ui
import android.os.Bundle
import androidx.fragment.app.Fragment
@@ -6,9 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
-import androidx.navigation.fragment.findNavController
-import com.example.common.data.dto.CodeRequest
-import com.najudoryeong.mineme.common_ui.MainActivityUtil
+import com.najudoryeong.mineme.common.data.dto.CodeRequest
import com.najudoryeong.mineme.onboarding.databinding.FragmentInputCodeBinding
import dagger.hilt.android.AndroidEntryPoint
@@ -37,7 +35,7 @@ class InputCodeFragment : Fragment() {
binding.nextButton.setOnClickListener {
viewModel.getJsonWebToken { JWT ->
viewModel.inputCode(
- JWT!!,CodeRequest(binding.code.text.toString())
+ JWT!!, CodeRequest(binding.code.text.toString())
){
(requireActivity() as SplashActivity).startHomeActivity()
}
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/InputUserInfoFragment.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/InputUserInfoFragment.kt
similarity index 76%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/InputUserInfoFragment.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/InputUserInfoFragment.kt
index f70360d..90c1a85 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/InputUserInfoFragment.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/InputUserInfoFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.onboarding
+package com.najudoryeong.mineme.onboarding.ui
import android.os.Bundle
import androidx.fragment.app.Fragment
@@ -7,10 +7,9 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
-import com.example.common.data.dto.UserInfoRequest
-import com.najudoryeong.mineme.common_ui.MainActivityUtil
+import com.najudoryeong.mineme.common.data.dto.UserInfoRequest
+import com.najudoryeong.mineme.onboarding.R
import com.najudoryeong.mineme.onboarding.databinding.FragmentInputUserInfoBinding
-import com.najudoryeong.mineme.onboarding.databinding.FragmentLoginBinding
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
@@ -33,7 +32,9 @@ class InputUserInfoFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
binding.nextButton.setOnClickListener {
viewModel.getJsonWebToken { JWT ->
- viewModel.inputUserInfo(JWT!!,UserInfoRequest(binding.userName.text.toString(),binding.userBirthDay.text.toString())){
+ viewModel.inputUserInfo(JWT!!,
+ UserInfoRequest(binding.userName.text.toString(),binding.userBirthDay.text.toString())
+ ){
findNavController().navigate(R.id.next)
}
}
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/LoginFragment.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/LoginFragment.kt
similarity index 78%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/LoginFragment.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/LoginFragment.kt
index 96dc472..f7c2420 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/LoginFragment.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/LoginFragment.kt
@@ -1,18 +1,12 @@
-package com.najudoryeong.mineme.onboarding
+package com.najudoryeong.mineme.onboarding.ui
import android.os.Bundle
-import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
-import androidx.activity.addCallback
-import androidx.navigation.fragment.findNavController
-import com.najudoryeong.mineme.common_ui.MainActivityUtil
-import com.najudoryeong.mineme.onboarding.R
import com.najudoryeong.mineme.onboarding.databinding.FragmentLoginBinding
-import com.najudoryeong.mineme.onboarding.databinding.FragmentOnBoardingViewPagerBinding
import dagger.hilt.android.AndroidEntryPoint
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/OnBoardingViewPagerFragment.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/OnBoardingViewPagerFragment.kt
similarity index 57%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/OnBoardingViewPagerFragment.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/OnBoardingViewPagerFragment.kt
index 17fe269..a691e66 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/OnBoardingViewPagerFragment.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/OnBoardingViewPagerFragment.kt
@@ -1,29 +1,43 @@
-package com.najudoryeong.mineme.onboarding
+package com.najudoryeong.mineme.onboarding.ui
-import android.Manifest
import android.os.Build
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.google.android.material.snackbar.Snackbar
+import com.najudoryeong.mineme.common.util.PermissionCallback
+import com.najudoryeong.mineme.common.util.PermissionObject
+import com.najudoryeong.mineme.common.util.PermissionType
import com.najudoryeong.mineme.common_ui.DialogForPermission
+import com.najudoryeong.mineme.onboarding.R
import com.najudoryeong.mineme.onboarding.databinding.FragmentOnBoardingViewPagerBinding
-import com.najudoryeong.mineme.onboarding.viewpagerfragment.OnBoarding1Fragment
-import com.najudoryeong.mineme.onboarding.viewpagerfragment.OnBoarding2Fragment
-import com.najudoryeong.mineme.onboarding.viewpagerfragment.OnBoarding3Fragment
+import com.najudoryeong.mineme.onboarding.ui.viewpagerfragment.OnBoarding1Fragment
+import com.najudoryeong.mineme.onboarding.ui.viewpagerfragment.OnBoarding2Fragment
+import com.najudoryeong.mineme.onboarding.ui.viewpagerfragment.OnBoarding3Fragment
import dagger.hilt.android.AndroidEntryPoint
+//todo companion?
+private val messageArray = arrayOf(
+ "기록을 위해서 갤러리 및\n" +
+ " 위치 접근 동의가 필요해요. ",
+ "사진을 찍기 위해서\n" +
+ "카메라 접근 동의가 필요해요",
+ "알림을 하기 위해서\n" +
+ "푸시 동의가 필요해요."
+)
+
+private val imageArray = arrayOf(R.drawable.img_gps, R.drawable.img_gps, R.drawable.img_gps)
+
@AndroidEntryPoint
-class OnBoardingViewPagerFragment : Fragment() {
+class OnBoardingViewPagerFragment : Fragment(), PermissionCallback {
- companion object{
+ companion object {
var viewpagerNum = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) 3 else 2
}
@@ -33,36 +47,9 @@ class OnBoardingViewPagerFragment : Fragment() {
private var _binding: FragmentOnBoardingViewPagerBinding? = null
private val binding get() = _binding!!
+ private val requestPermissionLauncher = PermissionObject.checkPermission(this, { onSuccess() }, { onFail() })
- //todo companion?
- private val messageArray = arrayOf("gps 권한", "알림 권한", "카메라 권한")
- private val imageArray = arrayOf(R.drawable.img_gps, R.drawable.img_gps, R.drawable.img_gps)
- private val permissionArray = arrayOf(
- arrayOf(
- Manifest.permission.ACCESS_COARSE_LOCATION, // 도시 블록 단위
- Manifest.permission.ACCESS_FINE_LOCATION,
- ),
- arrayOf(Manifest.permission.CAMERA),
- arrayOf(Manifest.permission.POST_NOTIFICATIONS)
- )
-
-
- private val requestPermissionLauncher = registerForActivityResult(
- ActivityResultContracts.RequestMultiplePermissions()
- ) { permissions ->
- if (permissions.all { it.value }) {
- if (binding.viewPager2.currentItem == viewpagerNum - 1) {
- findNavController().navigate(R.id.next)
- viewModel.setViewPagerNum(viewpagerNum)
- }
- binding.viewPager2.currentItem++
- } else {
- Snackbar.make(binding.root, "앱을 사용하기 위해 권한 허용을 해주세요!", Snackbar.LENGTH_SHORT).show()
- }
- }
- private fun requestPermission(permissionArray: Array) =
- requestPermissionLauncher.launch(permissionArray)
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
@@ -87,7 +74,7 @@ class OnBoardingViewPagerFragment : Fragment() {
.setMessage(messageArray[index])
.setImg(imageArray[index])
.setOnClickButton {
- requestPermission(permissionArray[index])
+ requestPermissionLauncher.launch(PermissionType.values()[index].permissionArray)
}.build().show()
}
@@ -113,4 +100,16 @@ class OnBoardingViewPagerFragment : Fragment() {
}
}
}
+
+ override fun onSuccess() {
+ if (binding.viewPager2.currentItem == viewpagerNum - 1) {
+ findNavController().navigate(R.id.next)
+ viewModel.setViewPagerNum(viewpagerNum)
+ }
+ binding.viewPager2.currentItem++
+ }
+
+ override fun onFail() {
+ Snackbar.make(binding.root, "앱을 사용하기 위해 권한 허용을 해주세요!", Snackbar.LENGTH_SHORT).show()
+ }
}
\ No newline at end of file
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/SplashActivity.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/SplashActivity.kt
similarity index 81%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/SplashActivity.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/SplashActivity.kt
index b1e6fe9..14aedab 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/SplashActivity.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/SplashActivity.kt
@@ -1,7 +1,6 @@
-package com.najudoryeong.mineme.onboarding
+package com.najudoryeong.mineme.onboarding.ui
import android.annotation.SuppressLint
-import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.View
@@ -10,6 +9,8 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
+import com.najudoryeong.mineme.onboarding.LoginUtil
+import com.najudoryeong.mineme.onboarding.R
import com.najudoryeong.mineme.onboarding.databinding.ActivitySplashBinding
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@@ -35,14 +36,19 @@ class SplashActivity : AppCompatActivity() {
Log.d("test", "checkJWT")
viewModel.getJsonWebToken { JWT ->
if (JWT != null) {
+ Log.d("test", "startHome")
startHomeActivity()
} else {
+ Log.d("test", "nojwt")
isFirst { permissionNum ->
// 처음이아님 => 카카오 로그인만 다시
if (permissionNum == OnBoardingViewPagerFragment.viewpagerNum) {
+ Log.d("test", "nofirst")
LoginUtil.loginWithKaKao(this) { token ->
viewModel.signup(token = token!!) {
// 로그인 됐다면 다시 jwt 확인
+ Log.d("test", "startHome")
+ startHomeActivity()
checkJWT()
}
}
@@ -56,12 +62,11 @@ class SplashActivity : AppCompatActivity() {
}
fun startHomeActivity(){
- LoginUtil.startMainActivity(this,mainActivityClass)
+ LoginUtil.startMainActivity(this, mainActivityClass)
}
private fun initNav() {
- val navHostFragment =
- supportFragmentManager.findFragmentById(R.id.fragment_containerView) as NavHostFragment
+ val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragment_containerView) as NavHostFragment
navController = navHostFragment.navController
binding.splashScreen.visibility = View.GONE
binding.fragmentContainerView.visibility = View.VISIBLE
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/SplashViewModel.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/SplashViewModel.kt
similarity index 82%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/SplashViewModel.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/SplashViewModel.kt
index af0c95f..9b329ff 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/SplashViewModel.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/SplashViewModel.kt
@@ -1,23 +1,18 @@
-package com.najudoryeong.mineme.onboarding
+package com.najudoryeong.mineme.onboarding.ui
-import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
-import com.example.common.data.dto.CodeRequest
-import com.example.common.data.dto.UserInfoRequest
-import com.example.common.data.source.AuthService
-import com.example.common.data.source.UserService
-import com.example.common.domain.usecase.DataStoreUseCase
+import com.najudoryeong.mineme.common.data.dto.CodeRequest
+import com.najudoryeong.mineme.common.data.dto.UserInfoRequest
+import com.najudoryeong.mineme.common.data.source.UserService
+import com.najudoryeong.mineme.common.domain.usecase.DataStoreUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
-import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel
class SplashViewModel @Inject constructor(
- @ApplicationContext private val context: Context,
- private val authService: AuthService,
private val userService: UserService,
private val dataStoreUseCase: DataStoreUseCase
) : ViewModel() {
@@ -51,7 +46,6 @@ class SplashViewModel @Inject constructor(
dataStoreUseCase.editJsonWebToken("testtoken123")
dataStoreUseCase.editUserCode("testcode123")
callback.invoke()
-
/*
//todo userName
authService.login(LoginRequest(token,ProviderType.KAKAO.name,"test123")).let {
@@ -62,7 +56,6 @@ class SplashViewModel @Inject constructor(
}
}
*/
-
}
}
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding1Fragment.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding1Fragment.kt
similarity index 95%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding1Fragment.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding1Fragment.kt
index 0acccca..9ee576d 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding1Fragment.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding1Fragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.onboarding.viewpagerfragment
+package com.najudoryeong.mineme.onboarding.ui.viewpagerfragment
import android.os.Bundle
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding2Fragment.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding2Fragment.kt
similarity index 93%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding2Fragment.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding2Fragment.kt
index 821b52e..9048c6c 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding2Fragment.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding2Fragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.onboarding.viewpagerfragment
+package com.najudoryeong.mineme.onboarding.ui.viewpagerfragment
import android.os.Bundle
import androidx.fragment.app.Fragment
diff --git a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding3Fragment.kt b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding3Fragment.kt
similarity index 93%
rename from onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding3Fragment.kt
rename to onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding3Fragment.kt
index fb549dc..277ba74 100644
--- a/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/viewpagerfragment/OnBoarding3Fragment.kt
+++ b/onboarding/src/main/java/com/najudoryeong/mineme/onboarding/ui/viewpagerfragment/OnBoarding3Fragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.onboarding.viewpagerfragment
+package com.najudoryeong.mineme.onboarding.ui.viewpagerfragment
import android.os.Bundle
diff --git a/onboarding/src/main/res/layout/activity_splash.xml b/onboarding/src/main/res/layout/activity_splash.xml
index a5f2842..48863d3 100644
--- a/onboarding/src/main/res/layout/activity_splash.xml
+++ b/onboarding/src/main/res/layout/activity_splash.xml
@@ -6,7 +6,7 @@
+ tools:context=".ui.SplashActivity">
+ tools:context=".ui.InputCodeFragment">
+ tools:context=".ui.LoginFragment">
-
diff --git a/onboarding/src/main/res/layout/fragment_on_boarding1.xml b/onboarding/src/main/res/layout/fragment_on_boarding1.xml
index 9a47ade..f56f81c 100644
--- a/onboarding/src/main/res/layout/fragment_on_boarding1.xml
+++ b/onboarding/src/main/res/layout/fragment_on_boarding1.xml
@@ -6,7 +6,7 @@
+ tools:context=".ui.viewpagerfragment.OnBoarding1Fragment">
+ tools:context=".ui.viewpagerfragment.OnBoarding2Fragment">
+ tools:context=".ui.viewpagerfragment.OnBoarding3Fragment">
+ tools:context=".ui.OnBoardingViewPagerFragment">
\ No newline at end of file
diff --git a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingAccountFragment.kt b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingAccountFragment.kt
similarity index 96%
rename from setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingAccountFragment.kt
rename to setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingAccountFragment.kt
index 7d43f0c..8940fa6 100644
--- a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingAccountFragment.kt
+++ b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingAccountFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.setting.fragment
+package com.najudoryeong.mineme.setting.fragment.ui
import android.content.ClipData
diff --git a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingFragment.kt b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingFragment.kt
similarity index 95%
rename from setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingFragment.kt
rename to setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingFragment.kt
index 0622489..fd0519d 100644
--- a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingFragment.kt
+++ b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.setting.fragment
+package com.najudoryeong.mineme.setting.fragment.ui
import androidx.navigation.fragment.findNavController
import com.najudoryeong.mineme.common_ui.BaseFragment
diff --git a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingInquiryFragment.kt b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingInquiryFragment.kt
similarity index 87%
rename from setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingInquiryFragment.kt
rename to setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingInquiryFragment.kt
index d3ca010..8b04ca4 100644
--- a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingInquiryFragment.kt
+++ b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingInquiryFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.setting.fragment
+package com.najudoryeong.mineme.setting.fragment.ui
import com.najudoryeong.mineme.common_ui.BaseFragment
diff --git a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingNoticeFragment.kt b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingNoticeFragment.kt
similarity index 87%
rename from setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingNoticeFragment.kt
rename to setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingNoticeFragment.kt
index 9602db5..2cd2f5d 100644
--- a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingNoticeFragment.kt
+++ b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingNoticeFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.setting.fragment
+package com.najudoryeong.mineme.setting.fragment.ui
import com.najudoryeong.mineme.common_ui.BaseFragment
import com.najudoryeong.mineme.setting.SettingNotice
diff --git a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingNotificationFragment.kt b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingNotificationFragment.kt
similarity index 88%
rename from setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingNotificationFragment.kt
rename to setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingNotificationFragment.kt
index f9700a8..c09a9f7 100644
--- a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingNotificationFragment.kt
+++ b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingNotificationFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.setting.fragment
+package com.najudoryeong.mineme.setting.fragment.ui
import com.najudoryeong.mineme.common_ui.BaseFragment
import com.najudoryeong.mineme.setting.SettingNotification
diff --git a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingSecurityFragment.kt b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingSecurityFragment.kt
similarity index 87%
rename from setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingSecurityFragment.kt
rename to setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingSecurityFragment.kt
index e3f4fe8..83d3542 100644
--- a/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/SettingSecurityFragment.kt
+++ b/setting/src/main/java/com/najudoryeong/mineme/setting/fragment/ui/SettingSecurityFragment.kt
@@ -1,4 +1,4 @@
-package com.najudoryeong.mineme.setting.fragment
+package com.najudoryeong.mineme.setting.fragment.ui
import com.najudoryeong.mineme.common_ui.BaseFragment
import com.najudoryeong.mineme.setting.SettingSecurity
diff --git a/setting/src/main/res/layout/fragment_setting.xml b/setting/src/main/res/layout/fragment_setting.xml
index 39d833a..883d233 100644
--- a/setting/src/main/res/layout/fragment_setting.xml
+++ b/setting/src/main/res/layout/fragment_setting.xml
@@ -8,7 +8,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="22dp"
- tools:context=".fragment.SettingFragment">
+ tools:context=".fragment.ui.SettingFragment">
+ tools:context=".fragment.ui.SettingInquiryFragment">
+ tools:context=".fragment.ui.SettingNoticeFragment">
+ tools:context=".fragment.ui.SettingNotificationFragment">
+ tools:context=".fragment.ui.SettingSecurityFragment">
\ No newline at end of file
diff --git a/story/build.gradle b/story/build.gradle
index 6729bad..79d2587 100644
--- a/story/build.gradle
+++ b/story/build.gradle
@@ -40,6 +40,9 @@ dependencies {
api project(path: ':common-ui')
api project(path: ':common')
+ // Glide
+ implementation 'com.github.bumptech.glide:glide:4.14.2'
+ kapt 'com.github.bumptech.glide:compiler:4.14.2'
// Hilt
implementation "com.google.dagger:hilt-android:$rootProject.hiltVersion"
diff --git a/story/src/main/AndroidManifest.xml b/story/src/main/AndroidManifest.xml
index a5918e6..effa41b 100644
--- a/story/src/main/AndroidManifest.xml
+++ b/story/src/main/AndroidManifest.xml
@@ -1,4 +1,7 @@
-
+
+
+
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/FragmentObject.kt b/story/src/main/java/com/najudoryeong/mineme/story/FragmentObject.kt
deleted file mode 100644
index d1da140..0000000
--- a/story/src/main/java/com/najudoryeong/mineme/story/FragmentObject.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.najudoryeong.mineme.story
-
-import android.view.View
-import com.najudoryeong.mineme.common_ui.FragmentInfoUtil
-
-
-
-object Story : FragmentInfoUtil {
- override val layoutID: Int
- get() = R.layout.fragment_story
- override val toolbarText: Int
- get() = R.string.story
- override val menu: Int
- get() = com.najudoryeong.mineme.common_ui.R.menu.story_menu
- override val bottomNavi_visibility: Int
- get() = View.VISIBLE
-}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/StoryFragment.kt b/story/src/main/java/com/najudoryeong/mineme/story/StoryFragment.kt
deleted file mode 100644
index fd6d19c..0000000
--- a/story/src/main/java/com/najudoryeong/mineme/story/StoryFragment.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.najudoryeong.mineme.story
-
-import com.najudoryeong.mineme.common_ui.BaseFragment
-import com.najudoryeong.mineme.story.databinding.FragmentStoryBinding
-
-class StoryFragment : BaseFragment(Story) {
- override fun initView() {
- binding.apply {
-
- }
- }
-}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/StoryInAdapter.kt b/story/src/main/java/com/najudoryeong/mineme/story/StoryInAdapter.kt
new file mode 100644
index 0000000..476ae35
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/StoryInAdapter.kt
@@ -0,0 +1,56 @@
+package com.najudoryeong.mineme.story
+
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.ListAdapter
+import androidx.recyclerview.widget.RecyclerView
+import com.najudoryeong.mineme.common.domain.entity.Story
+import com.najudoryeong.mineme.story.databinding.ItemStoryInBinding
+
+
+class StoryInAdapter : ListAdapter(StoryInDiffCallback()){
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
+ return StoryInViewHolder(
+ ItemStoryInBinding.inflate(
+ LayoutInflater.from(parent.context),
+ parent,
+ false
+ )
+ )
+ }
+
+ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
+ if (holder is StoryInViewHolder){
+ val story = getItem(position)
+ holder.bind(story)
+ }
+ }
+
+ inner class StoryInViewHolder(private val binding: ItemStoryInBinding) :
+ RecyclerView.ViewHolder(binding.root) {
+ fun bind(storyModel: Story) {
+ with(binding) {
+ story = storyModel
+ itemView.setOnClickListener {
+ // story 상세보기
+ Log.d("testStory","상세보기 클릭")
+ }
+ executePendingBindings()
+ }
+ }
+ }
+
+}
+
+private class StoryInDiffCallback : DiffUtil.ItemCallback() {
+ override fun areItemsTheSame(oldItem: Story, newItem: Story): Boolean {
+ return oldItem === newItem
+ }
+
+ override fun areContentsTheSame(oldItem: Story, newItem: Story): Boolean {
+ return oldItem == newItem
+ }
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/StoryOutAdapter.kt b/story/src/main/java/com/najudoryeong/mineme/story/StoryOutAdapter.kt
new file mode 100644
index 0000000..fabdea7
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/StoryOutAdapter.kt
@@ -0,0 +1,67 @@
+package com.najudoryeong.mineme.story
+
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.lifecycle.LifecycleOwner
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.ListAdapter
+import androidx.recyclerview.widget.RecyclerView
+import com.najudoryeong.mineme.story.databinding.ItemStoryOutBinding
+import com.najudoryeong.mineme.story.domain.entity.StoryListWithDate
+import com.najudoryeong.mineme.story.ui.dummy
+
+
+class StoryOutAdapter: ListAdapter(StoryOutDiffCallback()) {
+
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
+ Log.d("testStory","홀더 만듬")
+
+ return StoryOutViewHolder(
+ ItemStoryOutBinding.inflate(
+ LayoutInflater.from(parent.context),
+ parent,
+ false
+ )
+ )
+ }
+
+ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
+ if (holder is StoryOutViewHolder){
+ val storyListWithDate = getItem(position)
+ holder.bind(storyListWithDate)
+ }
+ }
+
+ override fun getItemCount(): Int {
+ Log.d("testStory", super.getItemCount().toString())
+ return super.getItemCount()
+ }
+
+ inner class StoryOutViewHolder(private val binding: ItemStoryOutBinding) : RecyclerView.ViewHolder(binding.root) {
+ fun bind(storyListWithDate : StoryListWithDate){
+ // 외부 이제 나눈다 날짜별로
+ with(binding) {
+ outRecyclerView.adapter = StoryInAdapter().apply { submitList(storyListWithDate.posts) }
+ yearMonth = getYearMonth(storyListWithDate.year,storyListWithDate.month)
+ executePendingBindings()
+ }
+ }
+
+ private fun getYearMonth(year : String, month : String) : String {
+ return "$year $month"
+ }
+ }
+
+}
+
+private class StoryOutDiffCallback : DiffUtil.ItemCallback() {
+ override fun areItemsTheSame(oldItem: StoryListWithDate, newItem: StoryListWithDate): Boolean {
+ return oldItem === newItem
+ }
+
+ override fun areContentsTheSame(oldItem: StoryListWithDate, newItem: StoryListWithDate): Boolean {
+ return oldItem == newItem
+ }
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/StoryViewModel.kt b/story/src/main/java/com/najudoryeong/mineme/story/StoryViewModel.kt
deleted file mode 100644
index d9253c8..0000000
--- a/story/src/main/java/com/najudoryeong/mineme/story/StoryViewModel.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.najudoryeong.mineme.story
-
-import androidx.lifecycle.ViewModel
-
-class StoryViewModel : ViewModel(){
-
-}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/data/StoryService.kt b/story/src/main/java/com/najudoryeong/mineme/story/data/StoryService.kt
new file mode 100644
index 0000000..fee39da
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/data/StoryService.kt
@@ -0,0 +1,15 @@
+package com.najudoryeong.mineme.story.data
+
+import com.najudoryeong.mineme.common.data.dto.CommonResponse
+import com.najudoryeong.mineme.story.domain.entity.StoryListWithDate
+import retrofit2.http.GET
+import retrofit2.http.Header
+
+interface StoryService {
+
+ @GET("api/v1/story/list")
+ suspend fun readStoryList(
+ @Header("Authorization") token: String,
+ ) : CommonResponse>
+
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/di/NetworkModule.kt b/story/src/main/java/com/najudoryeong/mineme/story/di/NetworkModule.kt
new file mode 100644
index 0000000..e5b4128
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/di/NetworkModule.kt
@@ -0,0 +1,21 @@
+package com.najudoryeong.mineme.story.di
+
+import com.najudoryeong.mineme.story.data.StoryService
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import retrofit2.Retrofit
+import javax.inject.Singleton
+
+@Module
+@InstallIn(SingletonComponent::class)
+class NetworkModule {
+
+ @Singleton
+ @Provides
+ fun provideStoryService(retrofit: Retrofit): StoryService {
+ return retrofit.create(StoryService::class.java)
+ }
+
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/domain/entity/StoryListWithDate.kt b/story/src/main/java/com/najudoryeong/mineme/story/domain/entity/StoryListWithDate.kt
new file mode 100644
index 0000000..a229895
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/domain/entity/StoryListWithDate.kt
@@ -0,0 +1,9 @@
+package com.najudoryeong.mineme.story.domain.entity
+
+import com.najudoryeong.mineme.common.domain.entity.Story
+
+data class StoryListWithDate(
+ val year : String,
+ val month : String,
+ val posts : List
+)
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/domain/usecase/StoryUseCase.kt b/story/src/main/java/com/najudoryeong/mineme/story/domain/usecase/StoryUseCase.kt
new file mode 100644
index 0000000..0065e7e
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/domain/usecase/StoryUseCase.kt
@@ -0,0 +1,12 @@
+package com.najudoryeong.mineme.story.domain.usecase
+
+import com.najudoryeong.mineme.story.domain.entity.StoryListWithDate
+import com.najudoryeong.mineme.story.data.StoryService
+import javax.inject.Inject
+
+class StoryUseCase @Inject constructor(
+ private val storyService : StoryService
+){
+ suspend fun readStoryList(token: String): List = storyService.readStoryList(token).data
+
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/ui/StoryFragment.kt b/story/src/main/java/com/najudoryeong/mineme/story/ui/StoryFragment.kt
new file mode 100644
index 0000000..4b6be88
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/ui/StoryFragment.kt
@@ -0,0 +1,56 @@
+package com.najudoryeong.mineme.story.ui
+
+import android.widget.Toast
+import androidx.fragment.app.viewModels
+import androidx.lifecycle.Lifecycle
+import androidx.lifecycle.lifecycleScope
+import androidx.lifecycle.repeatOnLifecycle
+import androidx.navigation.fragment.findNavController
+import com.najudoryeong.mineme.common_ui.BaseFragment
+import com.najudoryeong.mineme.story.R
+import com.najudoryeong.mineme.story.databinding.FragmentStoryBinding
+import com.najudoryeong.mineme.story.StoryOutAdapter
+import com.najudoryeong.mineme.story.util.StoryFoundationInfo
+import dagger.hilt.android.AndroidEntryPoint
+import kotlinx.coroutines.flow.collectLatest
+import kotlinx.coroutines.launch
+
+@AndroidEntryPoint
+class StoryFragment : BaseFragment(StoryFoundationInfo) {
+
+ private val storyViewModel: StoryViewModel by viewModels()
+ private val storyOutAdapter: StoryOutAdapter by lazy { StoryOutAdapter() }
+
+
+ override fun initView() {
+ binding.apply {
+ //todo callback
+ this.lifecycleOwner = viewLifecycleOwner
+ this.adapter = storyOutAdapter
+ this.viewModel = storyViewModel
+ this.swiperefreshlayout.setOnRefreshListener {
+ storyViewModel.raedStory{
+ swiperefreshlayout.isRefreshing = false
+ }
+ }
+ }
+ storyViewModel.raedStory()
+ toastObserve()
+ }
+
+ override fun menuClick(){
+ findNavController().navigate(R.id.next)
+ }
+
+
+ private fun toastObserve() {
+ lifecycleScope.launch{
+ storyViewModel.toastMessage.collectLatest {
+ if (it.isNotEmpty()){
+ Toast.makeText(context,it,Toast.LENGTH_SHORT).show()
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/ui/StoryViewModel.kt b/story/src/main/java/com/najudoryeong/mineme/story/ui/StoryViewModel.kt
new file mode 100644
index 0000000..49f1b2f
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/ui/StoryViewModel.kt
@@ -0,0 +1,123 @@
+package com.najudoryeong.mineme.story.ui
+
+import android.net.Uri
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.najudoryeong.mineme.common.domain.entity.Story
+import com.najudoryeong.mineme.story.domain.entity.StoryListWithDate
+import com.najudoryeong.mineme.common.domain.usecase.DataStoreUseCase
+import com.najudoryeong.mineme.story.domain.usecase.StoryUseCase
+import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.launch
+import javax.inject.Inject
+
+var dummy: MutableList = mutableListOf(
+ StoryListWithDate(
+ "2020", "03", listOf(
+ Story(
+ "2020-03-01",
+ 1,
+ "마산",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ Story(
+ "2020-03-02",
+ 1,
+ "마산1",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ Story(
+ "2020-03-03",
+ 1,
+ "마산2",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ Story(
+ "2020-03-04",
+ 1,
+ "마산3",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ )
+ ),
+
+ StoryListWithDate(
+ "2020", "04", listOf(
+ Story(
+ "2020-04-01",
+ 1,
+ "마산",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ Story(
+ "2020-04-02",
+ 1,
+ "마산11",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ Story(
+ "2020-04-03",
+ 1,
+ "마산21",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ Story(
+ "2020-04-04",
+ 1,
+ "마산31",
+ "https://upload3.inven.co.kr/upload/2022/03/15/bbs/i16343629296.jpg?MW=800"
+ ),
+ )
+ )
+)
+
+@HiltViewModel
+class StoryViewModel @Inject constructor(
+ private val storyUseCase: StoryUseCase,
+ private val dataStoreUseCase: DataStoreUseCase
+) : ViewModel() {
+
+ private val _imageUri = MutableStateFlow(null)
+ val imageUri: StateFlow = _imageUri
+
+ private val _storyList = MutableStateFlow>(mutableListOf())
+ val storyList: StateFlow> = _storyList
+
+ private val _isApiLoading = MutableStateFlow(true)
+ val isApiLoading: StateFlow = _isApiLoading
+
+
+ private val _toastMessage = MutableStateFlow("")
+ val toastMessage: StateFlow = _toastMessage
+
+ fun raedStory(endApiCallBack: () -> Unit = {}) {
+ viewModelScope.launch {
+ _isApiLoading.value = true
+ //_storyList.value = dummy
+ try {
+ storyUseCase.readStoryList(dataStoreUseCase.bearerJsonWebToken.first()!!).let {
+ _storyList.value = it.toMutableList()
+ }
+ } catch (e: Exception) {
+ // 값을 초기화해서 구독자가 알아차릴 수 있게
+ _toastMessage.value = ""
+ _toastMessage.value = "스토리리스트 가져오는 거 실패"
+ }
+ endApiCallBack.invoke()
+ _isApiLoading.value = false
+ }
+ }
+
+ fun setToastMessage(newMessage : String){
+ _toastMessage.value = ""
+ _toastMessage.value = newMessage
+ }
+
+ fun setImage(newUri: Uri?){
+ _imageUri.value = newUri
+ }
+
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/ui/WriteStoryFragment.kt b/story/src/main/java/com/najudoryeong/mineme/story/ui/WriteStoryFragment.kt
new file mode 100644
index 0000000..cd8a909
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/ui/WriteStoryFragment.kt
@@ -0,0 +1,112 @@
+package com.najudoryeong.mineme.story.ui
+
+import android.content.Intent
+import android.provider.MediaStore
+import android.widget.ArrayAdapter
+import android.widget.TextView
+import android.widget.Toast
+import androidx.fragment.app.viewModels
+import androidx.lifecycle.lifecycleScope
+import com.najudoryeong.mineme.common.util.GalleryObject
+import com.najudoryeong.mineme.common.util.PermissionCallback
+import com.najudoryeong.mineme.common.util.PermissionObject
+import com.najudoryeong.mineme.common.util.PermissionType
+import com.najudoryeong.mineme.common_ui.BaseFragment
+import com.najudoryeong.mineme.common_ui.CalendarUtil.Companion.getTodayDate
+import com.najudoryeong.mineme.common_ui.CalendarUtil.Companion.parseStringToDate
+import com.najudoryeong.mineme.common_ui.DialogForDatePicker
+import com.najudoryeong.mineme.common_ui.R.layout.item_dropdown
+import com.najudoryeong.mineme.story.databinding.FragmentWriteStoryBinding
+import com.najudoryeong.mineme.story.util.WriteStoryFoundationInfo
+import dagger.hilt.android.AndroidEntryPoint
+import kotlinx.coroutines.flow.collectLatest
+import kotlinx.coroutines.launch
+
+
+val doItems = listOf(
+ "위치 없음",
+ "경상북도",
+ "강원도",
+ "무신사",
+ "제주도",
+ "울릉도",
+ "경상남도",
+ "경상북도",
+ "강원도",
+ "무신사",
+ "제주도",
+ "울릉도",
+ "경상남도",
+ "경상북도",
+ "강원도",
+ "무신사",
+ "제주도",
+ "울릉도",
+ "경상남도",
+ "경상북도",
+ "강원도",
+ "무신사",
+ "제주도",
+ "울릉도"
+)
+val siItems = listOf("위치 없음", "마산시1", "마산시4", "마산시2", "마산시3", "마산시6")
+
+@AndroidEntryPoint
+class WriteStoryFragment : BaseFragment(WriteStoryFoundationInfo),
+ PermissionCallback {
+
+ private val storyViewModel: StoryViewModel by viewModels()
+ private val imageResult = GalleryObject.getImageResult(this) { storyViewModel.setImage(it) }
+ private val requestPermissionLauncher = PermissionObject.checkPermission(this, { onSuccess() }, { onFail() })
+
+ override fun initView() {
+
+ val doAdapter = ArrayAdapter(requireContext(), item_dropdown, doItems)
+ val siAdapter = ArrayAdapter(requireContext(), item_dropdown, siItems)
+ binding.apply {
+ viewModel = storyViewModel
+ lifecycleOwner = viewLifecycleOwner
+ doSpinner.adapter = doAdapter
+ siSpinner.adapter = siAdapter
+ date.text = getTodayDate()
+ date.setOnClickListener {
+ DialogForDatePicker.Builder(requireContext())
+ .setInitDate(parseStringToDate(it as TextView)!!)
+ .setOnClickPositiveButton { newDate ->
+ binding.date.text = newDate
+ }
+ .build().show()
+ }
+ picture.setOnClickListener {
+ requestPermissionLauncher.launch(PermissionType.CAMERA.permissionArray)
+ }
+ }
+ toastObserve()
+ }
+
+ override fun menuClick() {
+ Toast.makeText(context, "클릭메뉴", Toast.LENGTH_SHORT).show()
+ }
+
+ private fun toastObserve() {
+ lifecycleScope.launch {
+ storyViewModel.toastMessage.collectLatest {
+ if (it.isNotEmpty()) {
+ Toast.makeText(context, it, Toast.LENGTH_SHORT).show()
+ }
+ }
+ }
+ }
+
+ override fun onSuccess() {
+ val intent = Intent(Intent.ACTION_PICK)
+ intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*")
+ imageResult.launch(intent)
+ }
+
+ override fun onFail() {
+ storyViewModel.setToastMessage("앱을 사용하기 위해 권한을 허용 해주세요")
+ }
+
+
+}
\ No newline at end of file
diff --git a/story/src/main/java/com/najudoryeong/mineme/story/util/FragmentObject.kt b/story/src/main/java/com/najudoryeong/mineme/story/util/FragmentObject.kt
new file mode 100644
index 0000000..067ca89
--- /dev/null
+++ b/story/src/main/java/com/najudoryeong/mineme/story/util/FragmentObject.kt
@@ -0,0 +1,31 @@
+package com.najudoryeong.mineme.story.util
+
+import android.view.View
+import com.najudoryeong.mineme.common_ui.FragmentInfoUtil
+import com.najudoryeong.mineme.story.R
+
+
+// todo hilt?
+object StoryFoundationInfo : FragmentInfoUtil {
+ override val layoutID: Int
+ get() = R.layout.fragment_story
+ override val toolbarText: Int
+ get() = R.string.story
+ override val menu: Int
+ get() = com.najudoryeong.mineme.common_ui.R.menu.story_menu
+ override val bottomNavi_visibility: Int
+ get() = View.VISIBLE
+}
+
+object WriteStoryFoundationInfo : FragmentInfoUtil {
+
+ override val layoutID: Int
+ get() = R.layout.fragment_write_story
+ override val toolbarText: Int
+ get() = R.string.write_story
+ override val menu: Int
+ get() = R.menu.write_story_menu
+ override val bottomNavi_visibility: Int
+ get() = View.GONE
+
+}
\ No newline at end of file
diff --git a/story/src/main/res/drawable/img_complete.xml b/story/src/main/res/drawable/img_complete.xml
new file mode 100644
index 0000000..1afcb11
--- /dev/null
+++ b/story/src/main/res/drawable/img_complete.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/story/src/main/res/drawable/img_nostory.xml b/story/src/main/res/drawable/img_nostory.xml
new file mode 100644
index 0000000..45c9ed1
--- /dev/null
+++ b/story/src/main/res/drawable/img_nostory.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/story/src/main/res/drawable/img_select_picture.xml b/story/src/main/res/drawable/img_select_picture.xml
new file mode 100644
index 0000000..0d2a876
--- /dev/null
+++ b/story/src/main/res/drawable/img_select_picture.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/story/src/main/res/layout/fragment_story.xml b/story/src/main/res/layout/fragment_story.xml
index 82d4fa7..fc63729 100644
--- a/story/src/main/res/layout/fragment_story.xml
+++ b/story/src/main/res/layout/fragment_story.xml
@@ -1,18 +1,89 @@
-
+
+
+
+
+
+
+
+
+
+
+ android:padding="4dp">
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
+ android:layout_height="match_parent">
+
+
+
+
+
+
+
+
+
diff --git a/story/src/main/res/layout/fragment_write_story.xml b/story/src/main/res/layout/fragment_write_story.xml
new file mode 100644
index 0000000..d9cfcd2
--- /dev/null
+++ b/story/src/main/res/layout/fragment_write_story.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/story/src/main/res/layout/item_story_in.xml b/story/src/main/res/layout/item_story_in.xml
new file mode 100644
index 0000000..1610687
--- /dev/null
+++ b/story/src/main/res/layout/item_story_in.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/story/src/main/res/layout/item_story_out.xml b/story/src/main/res/layout/item_story_out.xml
new file mode 100644
index 0000000..703855d
--- /dev/null
+++ b/story/src/main/res/layout/item_story_out.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/story/src/main/res/menu/write_story_menu.xml b/story/src/main/res/menu/write_story_menu.xml
new file mode 100644
index 0000000..c341b14
--- /dev/null
+++ b/story/src/main/res/menu/write_story_menu.xml
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/story/src/main/res/navigation/nav_story.xml b/story/src/main/res/navigation/nav_story.xml
index 4fe5b65..3af1cd1 100644
--- a/story/src/main/res/navigation/nav_story.xml
+++ b/story/src/main/res/navigation/nav_story.xml
@@ -6,6 +6,15 @@
+ android:name="com.najudoryeong.mineme.story.ui.StoryFragment"
+ android:label="StoryFragment" >
+
+
+
\ No newline at end of file
diff --git a/story/src/main/res/values/strings.xml b/story/src/main/res/values/strings.xml
index 157d6cb..607cffa 100644
--- a/story/src/main/res/values/strings.xml
+++ b/story/src/main/res/values/strings.xml
@@ -2,4 +2,5 @@
Hello blank fragment
스토리
+ 스토리 작성
\ No newline at end of file