From c1025ca75f07585538790f568f3f5c23a1763aeb Mon Sep 17 00:00:00 2001 From: KanuKim97 <74421057+KanuKim97@users.noreply.github.com> Date: Fri, 9 Jun 2023 20:28:34 +0900 Subject: [PATCH] 1. fix Gradle Version - JAVA VERSION 1.8 -> VERSION 17 2. fix #27 Issue 3. fix domain, data AndroidManifest.xml - delete tag 4. add annotation on DispatcherModule.kt, DispatcherQualifier.kt, AlertDialogModule.kt 5. rename TickerRemoteModule.kt -> BithumbApiModule.kt 6. delete MainDispatcher Each Views --- app/build.gradle | 10 ++-- .../koin_apps/module/AlertDialogModule.kt | 2 +- ...kerRemoteModule.kt => BithumbApiModule.kt} | 2 +- .../koin_apps/module/DispatcherModule.kt | 2 +- .../koin_apps/module/TickerDBModule.kt | 2 +- .../DispatcherQualifier.kt | 4 +- .../koin_apps/presenter/LiveTimeActivity.kt | 23 ++----- .../koin_apps/presenter/LogoActivity.kt | 31 +++------- .../koin_apps/presenter/MainActivity.kt | 47 +++++++-------- .../koin_apps/presenter/OrderBookFragment.kt | 60 +++++++------------ .../koin_apps/presenter/SelectKoinActivity.kt | 22 +++---- .../SelectRecyclerAdapter.kt | 8 +-- .../presenter/viewModel/SelectViewModel.kt | 4 +- build.gradle | 2 +- data/build.gradle | 8 +-- data/src/main/AndroidManifest.xml | 9 +-- domain/build.gradle | 8 +-- domain/src/main/AndroidManifest.xml | 9 +-- gradle.properties | 22 ++----- gradle/wrapper/gradle-wrapper.properties | 3 +- 20 files changed, 90 insertions(+), 188 deletions(-) rename app/src/main/java/com/example/koin_apps/module/{TickerRemoteModule.kt => BithumbApiModule.kt} (98%) diff --git a/app/build.gradle b/app/build.gradle index 2020a7b..85d631b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,13 +28,13 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { freeCompilerArgs += [ "-Xjvm-default=all"] - jvmTarget = '1.8' + jvmTarget = '17' } buildFeatures { viewBinding = true } @@ -50,8 +50,8 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation "androidx.navigation:navigation-fragment-ktx:2.5.3" - implementation "androidx.navigation:navigation-ui-ktx:2.5.3" + implementation "androidx.navigation:navigation-fragment-ktx:2.6.0" + implementation "androidx.navigation:navigation-ui-ktx:2.6.0" // Android material implementation 'com.google.android.material:material:1.9.0' diff --git a/app/src/main/java/com/example/koin_apps/module/AlertDialogModule.kt b/app/src/main/java/com/example/koin_apps/module/AlertDialogModule.kt index 8b0a2e6..e0f8fe4 100644 --- a/app/src/main/java/com/example/koin_apps/module/AlertDialogModule.kt +++ b/app/src/main/java/com/example/koin_apps/module/AlertDialogModule.kt @@ -9,7 +9,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent import javax.inject.Singleton -/** AlertDialog Module **/ +/** AlertDialogBuilder Module **/ @Module @InstallIn(SingletonComponent::class) object AlertDialogModule { diff --git a/app/src/main/java/com/example/koin_apps/module/TickerRemoteModule.kt b/app/src/main/java/com/example/koin_apps/module/BithumbApiModule.kt similarity index 98% rename from app/src/main/java/com/example/koin_apps/module/TickerRemoteModule.kt rename to app/src/main/java/com/example/koin_apps/module/BithumbApiModule.kt index 4f65759..32ea570 100644 --- a/app/src/main/java/com/example/koin_apps/module/TickerRemoteModule.kt +++ b/app/src/main/java/com/example/koin_apps/module/BithumbApiModule.kt @@ -17,7 +17,7 @@ import javax.inject.Singleton /** Bithumb Public Api Module **/ @Module @InstallIn(SingletonComponent::class) -object TickerRemoteModule { +object BithumbApiModule { @Provides fun providesBaseUrl(): String = Constants.BITHUMB_PUBLIC_API_URL diff --git a/app/src/main/java/com/example/koin_apps/module/DispatcherModule.kt b/app/src/main/java/com/example/koin_apps/module/DispatcherModule.kt index f93b0e5..8bde424 100644 --- a/app/src/main/java/com/example/koin_apps/module/DispatcherModule.kt +++ b/app/src/main/java/com/example/koin_apps/module/DispatcherModule.kt @@ -10,7 +10,7 @@ import dagger.hilt.components.SingletonComponent import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers -/** Coroutine Dispatcher Module **/ +/** Coroutine Dispatcher Module (IO, Main, Default) **/ @Module @InstallIn(SingletonComponent::class) object DispatcherModule { diff --git a/app/src/main/java/com/example/koin_apps/module/TickerDBModule.kt b/app/src/main/java/com/example/koin_apps/module/TickerDBModule.kt index f9882e6..f5e3bfd 100644 --- a/app/src/main/java/com/example/koin_apps/module/TickerDBModule.kt +++ b/app/src/main/java/com/example/koin_apps/module/TickerDBModule.kt @@ -13,7 +13,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent import javax.inject.Singleton -/** Room Database Module **/ +/** Room ORM (Local Database) Module **/ @Module @InstallIn(SingletonComponent::class) object TickerDBModule { diff --git a/app/src/main/java/com/example/koin_apps/module/coroutineDispatcher/DispatcherQualifier.kt b/app/src/main/java/com/example/koin_apps/module/coroutineDispatcher/DispatcherQualifier.kt index 6b27b85..247ad93 100644 --- a/app/src/main/java/com/example/koin_apps/module/coroutineDispatcher/DispatcherQualifier.kt +++ b/app/src/main/java/com/example/koin_apps/module/coroutineDispatcher/DispatcherQualifier.kt @@ -2,15 +2,17 @@ package com.example.koin_apps.module.coroutineDispatcher import javax.inject.Qualifier -/** Coroutine Dispatcher Qualifier **/ +/** Coroutine IoDispatcher Qualifier **/ @Retention(AnnotationRetention.RUNTIME) @Qualifier annotation class IoDispatcher +/** Coroutine DefaultDispatcher Qualifier **/ @Retention(AnnotationRetention.RUNTIME) @Qualifier annotation class DefaultDispatcher +/** Coroutine MainDispatcher Qualifier **/ @Retention(AnnotationRetention.RUNTIME) @Qualifier annotation class MainDispatcher diff --git a/app/src/main/java/com/example/koin_apps/presenter/LiveTimeActivity.kt b/app/src/main/java/com/example/koin_apps/presenter/LiveTimeActivity.kt index 2bbae8f..3102d35 100644 --- a/app/src/main/java/com/example/koin_apps/presenter/LiveTimeActivity.kt +++ b/app/src/main/java/com/example/koin_apps/presenter/LiveTimeActivity.kt @@ -3,25 +3,18 @@ package com.example.koin_apps.presenter import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.activity.viewModels -import androidx.lifecycle.lifecycleScope import com.example.koin_apps.R -import com.example.koin_apps.module.coroutineDispatcher.MainDispatcher import com.example.koin_apps.databinding.ActivityLiveTimeBinding import com.example.koin_apps.presenter.viewModel.LiveTimeViewModel import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.launch -import javax.inject.Inject @AndroidEntryPoint class LiveTimeActivity : AppCompatActivity() { - @MainDispatcher @Inject lateinit var mainDispatcher: CoroutineDispatcher - private val liveTimeBinding by lazy { ActivityLiveTimeBinding.inflate(layoutInflater) } private val liveTimeViewModel: LiveTimeViewModel by viewModels() - private val orderBookFragment = OrderBookFragment() - private val fragmentBundle = Bundle() + private val orderBookFragment: OrderBookFragment = OrderBookFragment() + private val fragmentBundle: Bundle = Bundle() private val ticker: String by lazy { setTicker() } override fun onCreate(savedInstanceState: Bundle?) { @@ -34,7 +27,6 @@ class LiveTimeActivity : AppCompatActivity() { supportFragmentManager.beginTransaction() .replace(R.id.FragmentLayout, orderBookFragment) - .addToBackStack(null) .commit() setContentView(liveTimeBinding.root) @@ -50,14 +42,9 @@ class LiveTimeActivity : AppCompatActivity() { private fun updateTickerTitle() { liveTimeBinding.coinTitle.text = ticker } private fun updateTickerInfo() = liveTimeViewModel.tickerLiveViewData.observe(this) { - lifecycleScope.launch(mainDispatcher) { - liveTimeBinding.tickerWon.text = - getString(R.string.tickerWon, it.closingPrice.toString()) - liveTimeBinding.Flucatate24H.text = - getString(R.string.ticker_Flucatate_won24H, it.fluctate_24H.toString()) - liveTimeBinding.FlucatateRate24H.text = - getString(R.string.ticker_Flucatate_rate24H, it.fluctate_Rate.toString()) - } + liveTimeBinding.tickerWon.text = getString(R.string.tickerWon, it.closingPrice.toString()) + liveTimeBinding.Flucatate24H.text = getString(R.string.ticker_Flucatate_won24H, it.fluctate_24H.toString()) + liveTimeBinding.FlucatateRate24H.text = getString(R.string.ticker_Flucatate_rate24H, it.fluctate_Rate.toString()) } } diff --git a/app/src/main/java/com/example/koin_apps/presenter/LogoActivity.kt b/app/src/main/java/com/example/koin_apps/presenter/LogoActivity.kt index a3f8de7..5b01dbe 100644 --- a/app/src/main/java/com/example/koin_apps/presenter/LogoActivity.kt +++ b/app/src/main/java/com/example/koin_apps/presenter/LogoActivity.kt @@ -4,44 +4,29 @@ import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.activity.viewModels -import androidx.lifecycle.lifecycleScope -import com.example.koin_apps.common.Constants -import com.example.koin_apps.module.coroutineDispatcher.MainDispatcher import com.example.koin_apps.databinding.ActivityLogoBinding import com.example.koin_apps.presenter.viewModel.LogoViewModel import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.* -import javax.inject.Inject @AndroidEntryPoint class LogoActivity : AppCompatActivity() { - @MainDispatcher @Inject lateinit var mainDispatcher: CoroutineDispatcher - private val logoBinding by lazy { ActivityLogoBinding.inflate(layoutInflater) } private val logoViewModel: LogoViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - updateUI() - setContentView(logoBinding.root) - } - private fun updateUI() { - logoViewModel.readAllTicker.observe(this) { ticker -> - if (ticker != null) { - lifecycleScope.launch(mainDispatcher) { - delay(Constants.DELAY_TIME_MILLIS) - startActivity(Intent(this@LogoActivity, MainActivity::class.java)) - finish() - } + logoViewModel.readAllTicker.observe(this) { tickerList -> + if (tickerList != null) { + startActivity(Intent(this, MainActivity::class.java)) + finish() } else { - lifecycleScope.launch(mainDispatcher) { - delay(Constants.DELAY_TIME_MILLIS) - startActivity(Intent(this@LogoActivity, SelectKoinActivity::class.java)) - finish() - } + startActivity(Intent(this, SelectKoinActivity::class.java)) + finish() } } + + setContentView(logoBinding.root) } } \ No newline at end of file diff --git a/app/src/main/java/com/example/koin_apps/presenter/MainActivity.kt b/app/src/main/java/com/example/koin_apps/presenter/MainActivity.kt index c45009a..5bb85f2 100644 --- a/app/src/main/java/com/example/koin_apps/presenter/MainActivity.kt +++ b/app/src/main/java/com/example/koin_apps/presenter/MainActivity.kt @@ -5,34 +5,36 @@ import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.activity.viewModels import androidx.appcompat.app.AlertDialog -import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView import com.example.koin_apps.R -import com.example.koin_apps.module.coroutineDispatcher.MainDispatcher import com.example.koin_apps.presenter.adapter.recyclerViewAdapter.MainRecyclerAdapter import com.example.koin_apps.presenter.viewModel.MainViewModel import com.example.koin_apps.databinding.ActivityMainBinding import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Job -import kotlinx.coroutines.launch import javax.inject.Inject @AndroidEntryPoint class MainActivity : AppCompatActivity() { - @MainDispatcher @Inject lateinit var mainDispatcher: CoroutineDispatcher @Inject lateinit var alertDialog: AlertDialog.Builder private val mainActivityBinding by lazy { ActivityMainBinding.inflate(layoutInflater) } + private val mainRecyclerView by lazy { mainActivityBinding.mainRecyclerView } private val mainViewModel: MainViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - - mainActivityBinding.mainRecyclerView.layoutManager = LinearLayoutManager(this) - fetchTickerDB() - updateUI() + initRecyclerView() + + mainViewModel.tickerAllData.observe(this) { tickerList -> + if (tickerList != null) { + mainRecyclerView.adapter = MainRecyclerAdapter(this, tickerList) + } else { + showDataNullDialog() + } + } mainActivityBinding.addCoinBtn.setOnClickListener { startActivity(Intent(this, SelectKoinActivity::class.java)) @@ -41,23 +43,18 @@ class MainActivity : AppCompatActivity() { setContentView(mainActivityBinding.root) } - private fun updateUI() = mainViewModel.tickerAllData.observe(this) { ticker -> - if(ticker != null) { - lifecycleScope.launch(mainDispatcher) { - mainActivityBinding.mainRecyclerView.adapter = - MainRecyclerAdapter(this@MainActivity, ticker) - } - } else { lifecycleScope.launch(mainDispatcher) { showDataNullDialog() } } - } + private fun fetchTickerDB(): Job = mainViewModel.fetchAllTickerData() - private fun showDataNullDialog(): AlertDialog = - alertDialog - .setIcon(R.drawable.ic_dangerous) - .setTitle(R.string.NullDialog_Title) - .setMessage(R.string.NullDialog_Content) - .setPositiveButton(R.string.NullDialog_okBtn, null) - .show() + private fun initRecyclerView(): RecyclerView = mainActivityBinding.mainRecyclerView.apply { + layoutManager = LinearLayoutManager(this@MainActivity) + setHasFixedSize(true) + } - private fun fetchTickerDB(): Job = mainViewModel.fetchAllTickerData() + private fun showDataNullDialog(): AlertDialog = alertDialog + .setIcon(R.drawable.ic_dangerous) + .setTitle(R.string.NullDialog_Title) + .setMessage(R.string.NullDialog_Content) + .setPositiveButton(R.string.NullDialog_okBtn, null) + .show() } \ No newline at end of file diff --git a/app/src/main/java/com/example/koin_apps/presenter/OrderBookFragment.kt b/app/src/main/java/com/example/koin_apps/presenter/OrderBookFragment.kt index d66ffdb..caafc10 100644 --- a/app/src/main/java/com/example/koin_apps/presenter/OrderBookFragment.kt +++ b/app/src/main/java/com/example/koin_apps/presenter/OrderBookFragment.kt @@ -6,23 +6,16 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.viewModels -import androidx.lifecycle.lifecycleScope import com.example.koin_apps.R -import com.example.koin_apps.module.coroutineDispatcher.MainDispatcher import com.example.koin_apps.presenter.adapter.listViewAdapter.OrderBookAskListAdapter import com.example.koin_apps.presenter.adapter.listViewAdapter.OrderBookBidListAdapter import com.example.koin_apps.presenter.adapter.listViewAdapter.TransactionListAdapter import com.example.koin_apps.databinding.FragmentOrderBookBinding import com.example.koin_apps.presenter.viewModel.OrderBookViewModel import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.launch -import javax.inject.Inject @AndroidEntryPoint class OrderBookFragment : Fragment() { - @MainDispatcher @Inject lateinit var mainDispatcher: CoroutineDispatcher - private var _orderBookBinding: FragmentOrderBookBinding? = null private val orderBookBinding get() = _orderBookBinding!! private val orderBookViewModel: OrderBookViewModel by viewModels() @@ -44,9 +37,26 @@ class OrderBookFragment : Fragment() { } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - updateTickerTextView() - updateTransactionList() - updateOrderBookList() + orderBookViewModel.tickerData.observe(viewLifecycleOwner) { result -> + orderBookBinding.orderBookTickerInfo.text = getString( + R.string.orderBook_Ticker_Info, + result.closingPrice.toString(), + result.prevClosingPrice.toString(), + result.maxPrice.toString(), + result.minPrice.toString(), + result.unitsTraded_24H.toString() + ) + } + + orderBookViewModel.transactionData.observe(viewLifecycleOwner) { result -> + orderBookBinding.transactionList.adapter = TransactionListAdapter(result) + } + + orderBookViewModel.orderBookData.observe(viewLifecycleOwner) { result -> + orderBookBinding.orderBookAskList.adapter = OrderBookAskListAdapter(result.asks!!) + orderBookBinding.orderBookBidList.adapter = OrderBookBidListAdapter(result.bids!!) + } + } override fun onDestroyView() { @@ -56,34 +66,4 @@ class OrderBookFragment : Fragment() { private fun setTicker(): String = arguments?.getString("coinTitle").toString() - private fun updateTickerTextView() = orderBookViewModel.tickerData - .observe(viewLifecycleOwner) { result -> - lifecycleScope.launch(mainDispatcher) { - orderBookBinding.orderBookTickerInfo.text = - getString( - R.string.orderBook_Ticker_Info, - result.closingPrice.toString(), - result.prevClosingPrice.toString(), - result.maxPrice.toString(), - result.minPrice.toString(), - result.unitsTraded_24H.toString() - ) - } - } - - private fun updateTransactionList() = orderBookViewModel.transactionData - .observe(viewLifecycleOwner) { result -> - lifecycleScope.launch(mainDispatcher) { - orderBookBinding.transactionList.adapter = TransactionListAdapter(result) - } - } - - private fun updateOrderBookList() = orderBookViewModel.orderBookData - .observe(viewLifecycleOwner) { result -> - lifecycleScope.launch(mainDispatcher) { - orderBookBinding.orderBookAskList.adapter = OrderBookAskListAdapter(result.asks!!) - orderBookBinding.orderBookBidList.adapter = OrderBookBidListAdapter(result.bids!!) - } - } - } \ No newline at end of file diff --git a/app/src/main/java/com/example/koin_apps/presenter/SelectKoinActivity.kt b/app/src/main/java/com/example/koin_apps/presenter/SelectKoinActivity.kt index 53f47da..2f7be9c 100644 --- a/app/src/main/java/com/example/koin_apps/presenter/SelectKoinActivity.kt +++ b/app/src/main/java/com/example/koin_apps/presenter/SelectKoinActivity.kt @@ -3,35 +3,30 @@ package com.example.koin_apps.presenter import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle -import android.util.Log import androidx.activity.viewModels import androidx.recyclerview.widget.LinearLayoutManager -import com.example.koin_apps.common.Constants -import com.example.koin_apps.module.coroutineDispatcher.MainDispatcher import com.example.koin_apps.presenter.adapter.recyclerViewAdapter.SelectRecyclerAdapter import com.example.koin_apps.databinding.ActivitySelectKoinBinding import com.example.koin_apps.presenter.viewModel.SelectViewModel import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Job -import javax.inject.Inject @AndroidEntryPoint class SelectKoinActivity : AppCompatActivity() { - @MainDispatcher @Inject lateinit var mainDispatcher: CoroutineDispatcher - - private lateinit var selectRecyclerAdapter: SelectRecyclerAdapter private val selectKoinBinding by lazy { ActivitySelectKoinBinding.inflate(layoutInflater) } private val selectViewModel: SelectViewModel by viewModels() + private lateinit var selectRecyclerAdapter: SelectRecyclerAdapter + private val selectedTickerList: List by lazy { selectRecyclerAdapter.getSelectedItems() } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) initRecyclerView() updateTickerList() + selectKoinBinding.compSelectBtn.setOnClickListener { - storeTicker() - Log.d(Constants.LOG_TAG, "${getSelectedItems()}") + storeTicker(selectedTickerList) startActivity(Intent(this, MainActivity::class.java)) } @@ -48,9 +43,6 @@ class SelectKoinActivity : AppCompatActivity() { selectKoinBinding.CoinRecyclerView.adapter = selectRecyclerAdapter } - private fun getSelectedItems() = selectRecyclerAdapter.getSelectedItems() - - private fun storeTicker(): Job = - selectViewModel.storeTickerTitle(selectRecyclerAdapter.getSelectedItems()) - + private fun storeTicker(selectedTickers: List): Job = + selectViewModel.storeTickerTitle(selectedTickers) } \ No newline at end of file diff --git a/app/src/main/java/com/example/koin_apps/presenter/adapter/recyclerViewAdapter/SelectRecyclerAdapter.kt b/app/src/main/java/com/example/koin_apps/presenter/adapter/recyclerViewAdapter/SelectRecyclerAdapter.kt index 96716af..ef603e6 100644 --- a/app/src/main/java/com/example/koin_apps/presenter/adapter/recyclerViewAdapter/SelectRecyclerAdapter.kt +++ b/app/src/main/java/com/example/koin_apps/presenter/adapter/recyclerViewAdapter/SelectRecyclerAdapter.kt @@ -1,10 +1,8 @@ package com.example.koin_apps.presenter.adapter.recyclerViewAdapter -import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView -import com.example.koin_apps.common.Constants import com.example.koin_apps.databinding.SelectCoinviewItemBinding import javax.inject.Inject @@ -21,18 +19,14 @@ class SelectRecyclerAdapter @Inject constructor( binding.checkCoin.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { selectedTickerList.add(ticker) - Log.d(Constants.LOG_TAG, "$selectedTickerList") } else { selectedTickerList.remove(ticker) - Log.d(Constants.LOG_TAG, "$selectedTickerList") } } } } - fun getSelectedItems(): List { - return selectedTickerList.toList() - } + fun getSelectedItems(): List = selectedTickerList.toList() override fun onCreateViewHolder( parent: ViewGroup, diff --git a/app/src/main/java/com/example/koin_apps/presenter/viewModel/SelectViewModel.kt b/app/src/main/java/com/example/koin_apps/presenter/viewModel/SelectViewModel.kt index 8546886..88ea433 100644 --- a/app/src/main/java/com/example/koin_apps/presenter/viewModel/SelectViewModel.kt +++ b/app/src/main/java/com/example/koin_apps/presenter/viewModel/SelectViewModel.kt @@ -1,6 +1,5 @@ package com.example.koin_apps.presenter.viewModel -import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel @@ -8,7 +7,6 @@ import androidx.lifecycle.viewModelScope import com.example.domain.entity.TickerEntity import com.example.domain.usecase.apiUseCase.GetTickerAllUseCase import com.example.domain.usecase.databaseUseCase.InsertTickerUseCase -import com.example.koin_apps.common.Constants import com.example.koin_apps.module.coroutineDispatcher.IoDispatcher import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineDispatcher @@ -33,7 +31,7 @@ class SelectViewModel @Inject constructor( } fun storeTickerTitle(tickerList: List): Job = viewModelScope.launch(ioDispatcher) { - tickerList.forEach { insertTickerUseCase(TickerEntity(it)) } + tickerList.forEach { insertTickerUseCase(TickerEntity(it)).collect { } } } override fun onCleared() { diff --git a/build.gradle b/build.gradle index dbb1640..2959af7 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.0.2' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0' } } diff --git a/data/build.gradle b/data/build.gradle index b455fcd..af1448d 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -13,8 +13,6 @@ android { defaultConfig { minSdk 26 targetSdk 33 - versionCode 1 - versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -26,11 +24,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } } diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml index bf4d7c4..ecebd57 100644 --- a/data/src/main/AndroidManifest.xml +++ b/data/src/main/AndroidManifest.xml @@ -1,11 +1,4 @@ - - - + \ No newline at end of file diff --git a/domain/build.gradle b/domain/build.gradle index 3d29b0d..e0a7dda 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -13,8 +13,6 @@ android { defaultConfig { minSdk 26 targetSdk 33 - versionCode 1 - versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -26,11 +24,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } } diff --git a/domain/src/main/AndroidManifest.xml b/domain/src/main/AndroidManifest.xml index bf4d7c4..ecebd57 100644 --- a/domain/src/main/AndroidManifest.xml +++ b/domain/src/main/AndroidManifest.xml @@ -1,11 +1,4 @@ - - - + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ca36a32..8eabed2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,22 +1,8 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app"s APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true -# Automatically convert third-party libraries to use AndroidX android.enableJetifier=true -# Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -org.gradle.unsafe.configuration-cache=true \ No newline at end of file +org.gradle.unsafe.configuration-cache=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2c45cea..3ffebc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Sep 16 21:52:29 KST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME