From f8db57c5b37e6e80a6b673752dc657c867e1ae1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Mon, 18 Mar 2024 01:20:28 +0900 Subject: [PATCH 01/19] =?UTF-8?q?Chore=20:=20Sdk=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EB=B0=8F=20=EC=95=8C=EB=A6=BC=20=EA=B6=8C?= =?UTF-8?q?=ED=95=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++-- app/src/main/AndroidManifest.xml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 45671f18..e81c7552 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ plugins { } android { - compileSdk 32 + compileSdk 33 Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) @@ -14,7 +14,7 @@ android { defaultConfig { applicationId "com.dongyang.android.youdongknowme" minSdk 24 - targetSdk 32 + targetSdk 33 versionCode 5 versionName "1.0.3" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e8dd9271..9e44f80d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,6 +7,9 @@ android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" /> + Date: Mon, 18 Mar 2024 01:21:20 +0900 Subject: [PATCH 02/19] =?UTF-8?q?design=20:=20=EA=B6=8C=ED=95=9C=20?= =?UTF-8?q?=EC=8A=A4=EC=9C=84=EC=B9=98=20=EA=B8=B0=EB=B3=B8=20=ED=85=8C?= =?UTF-8?q?=EB=91=90=EB=A6=AC=20=EC=83=89=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_onboarding_permission.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_onboarding_permission.xml b/app/src/main/res/layout/activity_onboarding_permission.xml index 78334ecd..d7e70a5a 100644 --- a/app/src/main/res/layout/activity_onboarding_permission.xml +++ b/app/src/main/res/layout/activity_onboarding_permission.xml @@ -58,7 +58,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/onboarding_permission_step" - app:strokeColor="@color/blue300" + app:strokeColor="@color/gray300" app:strokeWidth="3dp"> Date: Mon, 18 Mar 2024 01:32:53 +0900 Subject: [PATCH 03/19] =?UTF-8?q?refactor=20:=20=EC=98=A8=EB=B3=B4?= =?UTF-8?q?=EB=94=A9=20=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=EC=9D=98=20?= =?UTF-8?q?=EA=B6=8C=ED=95=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OnboardingPermissionActivity.kt | 56 ++++++++++++++----- .../ui/view/setting/SettingViewModel.kt | 9 +++ 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index 5363d67a..a48dfc68 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -1,14 +1,20 @@ package com.dongyang.android.youdongknowme.ui.view.permission import android.Manifest +import android.app.Activity import android.content.Intent +import android.content.pm.PackageManager import android.content.res.ColorStateList +import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat +import androidx.lifecycle.lifecycleScope import com.dongyang.android.youdongknowme.R import com.dongyang.android.youdongknowme.databinding.ActivityOnboardingPermissionBinding import com.dongyang.android.youdongknowme.standard.base.BaseActivity import com.dongyang.android.youdongknowme.ui.view.main.MainActivity import com.dongyang.android.youdongknowme.ui.view.setting.SettingViewModel +import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.launch import org.koin.androidx.viewmodel.ext.android.viewModel class OnboardingPermissionActivity : @@ -16,10 +22,10 @@ class OnboardingPermissionActivity : override val layoutResourceId: Int = R.layout.activity_onboarding_permission override val viewModel: SettingViewModel by viewModel() + val permission = Manifest.permission.POST_NOTIFICATIONS - override fun initStartView() { - setPermission(false) + override fun initStartView() { viewModel.checkAccessAlarm() viewModel.getUserDepartment() @@ -35,23 +41,47 @@ class OnboardingPermissionActivity : finish() } + setPermissionSwitch(false) + binding.switchPermission.setOnCheckedChangeListener { compoundButton, _ -> + val isPermissionGranted = isPermissionGranted(this@OnboardingPermissionActivity) + if (compoundButton.isChecked) { - setPermission(true) - binding.switchPermission.compoundDrawableTintList = - ColorStateList.valueOf(ContextCompat.getColor(this, R.color.blue300)) + if (isPermissionGranted) { + setPermissionSwitch(true) + } else { + requestPermission(0) + setPermissionSwitch(false) + } } else { - setPermission(false) - binding.switchPermission.compoundDrawableTintList = - ColorStateList.valueOf(ContextCompat.getColor(this, R.color.gray300)) - binding.switchPermission.setTextColor(getColor(R.color.gray300)) + setPermissionSwitch(false) } } } - private fun setPermission(boolean: Boolean) { - binding.switchPermission.isChecked = boolean - viewModel.setIsAccessSchoolAlarm(boolean) - viewModel.setIsAccessDepartAlarm(boolean) + private fun setPermissionSwitch(isChecked: Boolean) { + val resources = if (isChecked) { + R.color.blue300 + } else { + R.color.gray300 + } + + binding.switchPermission.compoundDrawableTintList = + ColorStateList.valueOf(ContextCompat.getColor(this, resources)) + binding.switchPermission.setTextColor(getColor(resources)) + binding.mvSwitchPermission.strokeColor = getColor(resources) + + binding.switchPermission.isChecked = isChecked + viewModel.setIsAccessSchoolAlarm(isChecked) + viewModel.setIsAccessDepartAlarm(isChecked) } + + private fun isPermissionGranted(activity: Activity): Boolean = + ContextCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED + + private fun requestPermission(requestCode: Int) = + ActivityCompat.requestPermissions( + this@OnboardingPermissionActivity, + arrayOf(permission), requestCode + ) } \ No newline at end of file diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt index 1895cb2d..71bbef2b 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt @@ -4,6 +4,8 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import com.dongyang.android.youdongknowme.data.repository.SettingRepository import com.dongyang.android.youdongknowme.standard.base.BaseViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow /* 설정 뷰모델 */ class SettingViewModel(private val settingRepository: SettingRepository) : BaseViewModel() { @@ -17,6 +19,9 @@ class SettingViewModel(private val settingRepository: SettingRepository) : BaseV private val _myDepartment: MutableLiveData = MutableLiveData() val myDepartment: LiveData get() = _myDepartment + private val _permissionState = MutableStateFlow(false) + val permissionState: StateFlow = _permissionState + fun checkAccessAlarm() { val isAccessSchoolAlarm = settingRepository.getIsAccessSchoolAlarm() _isAccessSchoolAlarm.postValue(isAccessSchoolAlarm) @@ -37,4 +42,8 @@ class SettingViewModel(private val settingRepository: SettingRepository) : BaseV val myDepartment = settingRepository.getUserDepartment() _myDepartment.postValue(myDepartment) } + + fun updatePermissionState(isAllowed: Boolean) { + _permissionState.value = isAllowed + } } \ No newline at end of file From bf65980aa05de680e86c90fca9a17cdc652e6c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Mon, 18 Mar 2024 01:50:14 +0900 Subject: [PATCH 04/19] =?UTF-8?q?refactor=20:=20=EA=B6=8C=ED=95=9C=20?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=20=ED=99=95=EC=9E=A5=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OnboardingPermissionActivity.kt | 26 ++++--------------- .../ui/view/setting/SettingViewModel.kt | 9 ------- .../ui/view/util/RequestPermission.kt | 19 ++++++++++++++ 3 files changed, 24 insertions(+), 30 deletions(-) create mode 100644 app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index a48dfc68..d0c187a2 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -1,29 +1,21 @@ package com.dongyang.android.youdongknowme.ui.view.permission -import android.Manifest -import android.app.Activity import android.content.Intent -import android.content.pm.PackageManager import android.content.res.ColorStateList -import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat -import androidx.lifecycle.lifecycleScope import com.dongyang.android.youdongknowme.R import com.dongyang.android.youdongknowme.databinding.ActivityOnboardingPermissionBinding import com.dongyang.android.youdongknowme.standard.base.BaseActivity import com.dongyang.android.youdongknowme.ui.view.main.MainActivity import com.dongyang.android.youdongknowme.ui.view.setting.SettingViewModel -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch +import com.dongyang.android.youdongknowme.ui.view.util.RequestPermission import org.koin.androidx.viewmodel.ext.android.viewModel -class OnboardingPermissionActivity : +class OnboardingPermissionActivity(private val requestPermission: RequestPermission) : BaseActivity() { override val layoutResourceId: Int = R.layout.activity_onboarding_permission override val viewModel: SettingViewModel by viewModel() - val permission = Manifest.permission.POST_NOTIFICATIONS - override fun initStartView() { viewModel.checkAccessAlarm() @@ -44,13 +36,14 @@ class OnboardingPermissionActivity : setPermissionSwitch(false) binding.switchPermission.setOnCheckedChangeListener { compoundButton, _ -> - val isPermissionGranted = isPermissionGranted(this@OnboardingPermissionActivity) + val isPermissionGranted = + requestPermission.isPermissionGranted() if (compoundButton.isChecked) { if (isPermissionGranted) { setPermissionSwitch(true) } else { - requestPermission(0) + requestPermission.requestPermission(0) setPermissionSwitch(false) } } else { @@ -75,13 +68,4 @@ class OnboardingPermissionActivity : viewModel.setIsAccessSchoolAlarm(isChecked) viewModel.setIsAccessDepartAlarm(isChecked) } - - private fun isPermissionGranted(activity: Activity): Boolean = - ContextCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED - - private fun requestPermission(requestCode: Int) = - ActivityCompat.requestPermissions( - this@OnboardingPermissionActivity, - arrayOf(permission), requestCode - ) } \ No newline at end of file diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt index 71bbef2b..1895cb2d 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/setting/SettingViewModel.kt @@ -4,8 +4,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import com.dongyang.android.youdongknowme.data.repository.SettingRepository import com.dongyang.android.youdongknowme.standard.base.BaseViewModel -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow /* 설정 뷰모델 */ class SettingViewModel(private val settingRepository: SettingRepository) : BaseViewModel() { @@ -19,9 +17,6 @@ class SettingViewModel(private val settingRepository: SettingRepository) : BaseV private val _myDepartment: MutableLiveData = MutableLiveData() val myDepartment: LiveData get() = _myDepartment - private val _permissionState = MutableStateFlow(false) - val permissionState: StateFlow = _permissionState - fun checkAccessAlarm() { val isAccessSchoolAlarm = settingRepository.getIsAccessSchoolAlarm() _isAccessSchoolAlarm.postValue(isAccessSchoolAlarm) @@ -42,8 +37,4 @@ class SettingViewModel(private val settingRepository: SettingRepository) : BaseV val myDepartment = settingRepository.getUserDepartment() _myDepartment.postValue(myDepartment) } - - fun updatePermissionState(isAllowed: Boolean) { - _permissionState.value = isAllowed - } } \ No newline at end of file diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt new file mode 100644 index 00000000..278b2ce8 --- /dev/null +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt @@ -0,0 +1,19 @@ +package com.dongyang.android.youdongknowme.ui.view.util + +import android.Manifest +import android.app.Activity +import android.content.pm.PackageManager +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat + +class RequestPermission(private val activity: Activity) { + private val permission = Manifest.permission.POST_NOTIFICATIONS + + fun isPermissionGranted(): Boolean = + ContextCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED + + fun requestPermission(requestCode: Int) = + ActivityCompat.requestPermissions( + activity, arrayOf(permission), requestCode + ) +} \ No newline at end of file From 1b0632d3bb64261e18d361f0d00155c501679fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Mon, 18 Mar 2024 02:43:50 +0900 Subject: [PATCH 05/19] =?UTF-8?q?refactor=20:=20SplashActivity=EC=9D=98=20?= =?UTF-8?q?BaseActivity=20=EC=83=81=EC=86=8D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/splash/SplashActivity.kt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index f1bb17e1..e43ec0bc 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -3,12 +3,11 @@ package com.dongyang.android.youdongknowme.ui.view.splash import android.annotation.SuppressLint import android.content.Intent import android.os.Build -import android.os.Bundle import android.view.View -import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.lifecycleScope +import com.dongyang.android.youdongknowme.R import com.dongyang.android.youdongknowme.databinding.ActivitySplashBinding -import com.dongyang.android.youdongknowme.ui.view.depart.DepartActivity +import com.dongyang.android.youdongknowme.standard.base.BaseActivity import com.dongyang.android.youdongknowme.ui.view.depart.OnboardingDepartActivity import com.dongyang.android.youdongknowme.ui.view.main.MainActivity import kotlinx.coroutines.Job @@ -17,25 +16,26 @@ import kotlinx.coroutines.launch import org.koin.androidx.viewmodel.ext.android.viewModel @SuppressLint("CustomSplashScreen") -class SplashActivity : AppCompatActivity() { +class SplashActivity () : + BaseActivity() { - private var intentJob: Job? = null - private lateinit var binding: ActivitySplashBinding - private val viewModel: SplashViewModel by viewModel() + override val layoutResourceId: Int = R.layout.activity_splash + override val viewModel: SplashViewModel by viewModel() - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - binding = ActivitySplashBinding.inflate(layoutInflater) - setContentView(binding.root) + private var intentJob: Job? = null + override fun initStartView() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { val content: View = findViewById(android.R.id.content) content.viewTreeObserver.addOnPreDrawListener { false } } viewModel.checkFirstLaunch() + } + + override fun initDataBinding() = Unit + override fun initAfterBinding() { intentJob = lifecycleScope.launch { delay(SPLASH_TIME_MILLIS) From ca712ba2f807d6d7bd7426cb33acbe9146dc78a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:01:02 +0900 Subject: [PATCH 06/19] =?UTF-8?q?fix=20:=20=EC=98=A4=EB=A5=98=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B8=ED=95=9C=20=ED=99=95=EC=9E=A5=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/util/RequestPermission.kt | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt deleted file mode 100644 index 278b2ce8..00000000 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/util/RequestPermission.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.dongyang.android.youdongknowme.ui.view.util - -import android.Manifest -import android.app.Activity -import android.content.pm.PackageManager -import androidx.core.app.ActivityCompat -import androidx.core.content.ContextCompat - -class RequestPermission(private val activity: Activity) { - private val permission = Manifest.permission.POST_NOTIFICATIONS - - fun isPermissionGranted(): Boolean = - ContextCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED - - fun requestPermission(requestCode: Int) = - ActivityCompat.requestPermissions( - activity, arrayOf(permission), requestCode - ) -} \ No newline at end of file From 65d554dc5b0f22205596e13e4c2eca975f0233f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:01:15 +0900 Subject: [PATCH 07/19] =?UTF-8?q?refactor=20:=20splash=20viewModel=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../youdongknowme/ui/view/splash/SplashViewModel.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashViewModel.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashViewModel.kt index 87eb9e41..66464bc8 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashViewModel.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashViewModel.kt @@ -1,16 +1,18 @@ package com.dongyang.android.youdongknowme.ui.view.splash +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData import com.dongyang.android.youdongknowme.data.repository.SplashRepository import com.dongyang.android.youdongknowme.standard.base.BaseViewModel class SplashViewModel(private val splashRepository: SplashRepository) : BaseViewModel() { - private var _isFirstLaunch: Boolean = false - val isFirstLaunch: Boolean get() = _isFirstLaunch + private val _isFirstLaunch: MutableLiveData = MutableLiveData(false) + val isFirstLaunch: LiveData get() = _isFirstLaunch fun checkFirstLaunch() { if (splashRepository.getIsFirstLaunch()) { - _isFirstLaunch = true + _isFirstLaunch.value = true } } } \ No newline at end of file From 1d0da5d43bc0febe7745832b0f2fab538e2333f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:02:10 +0900 Subject: [PATCH 08/19] =?UTF-8?q?refactor=20:=20=EC=8A=A4=ED=94=8C?= =?UTF-8?q?=EB=9E=98=EC=8B=9C=20=ED=99=94=EB=A9=B4=20=EC=B2=98=EC=9D=8C=20?= =?UTF-8?q?=EC=8B=9C=EC=9E=91=EC=8B=9C=20=EA=B6=8C=ED=95=9C=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/splash/SplashActivity.kt | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index e43ec0bc..63bfcba6 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -1,9 +1,13 @@ package com.dongyang.android.youdongknowme.ui.view.splash +import android.Manifest import android.annotation.SuppressLint import android.content.Intent +import android.content.pm.PackageManager import android.os.Build import android.view.View +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat import androidx.lifecycle.lifecycleScope import com.dongyang.android.youdongknowme.R import com.dongyang.android.youdongknowme.databinding.ActivitySplashBinding @@ -16,13 +20,12 @@ import kotlinx.coroutines.launch import org.koin.androidx.viewmodel.ext.android.viewModel @SuppressLint("CustomSplashScreen") -class SplashActivity () : - BaseActivity() { +class SplashActivity() : BaseActivity() { override val layoutResourceId: Int = R.layout.activity_splash override val viewModel: SplashViewModel by viewModel() - private var intentJob: Job? = null + private var intentJob: Job? = null override fun initStartView() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { @@ -39,10 +42,25 @@ class SplashActivity () : intentJob = lifecycleScope.launch { delay(SPLASH_TIME_MILLIS) - if(viewModel.isFirstLaunch) { + if (viewModel.isFirstLaunch.value == true) { val intent = Intent(this@SplashActivity, OnboardingDepartActivity::class.java) - startActivity(intent) - finish() + + if (PackageManager.PERMISSION_DENIED == ContextCompat.checkSelfPermission( + this@SplashActivity, + Manifest.permission.POST_NOTIFICATIONS + ) + ) { + // 권한 설정이 안되어 있는 경우 + ActivityCompat.requestPermissions( + this@SplashActivity, + arrayOf(Manifest.permission.POST_NOTIFICATIONS), + 100 + ) + } else { + // 권한 설정이 이미 되어 있는 경우 + startActivity(intent) + finish() + } } else { val intent = Intent(this@SplashActivity, MainActivity::class.java) startActivity(intent) @@ -51,6 +69,25 @@ class SplashActivity () : } } + override fun onRequestPermissionsResult( + requestCode: Int, + permissions: Array, + grantResults: IntArray + ) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) + if (requestCode == 100) { + // 권한 설정 결과 처리 + val intent = if (viewModel.isFirstLaunch.value == true) { + Intent(this@SplashActivity, OnboardingDepartActivity::class.java) + } else { + Intent(this@SplashActivity, MainActivity::class.java) + } + startActivity(intent) + finish() + } + } + + override fun onBackPressed() { intentJob?.cancel() super.onBackPressed() From 94f289b135ead96e391ab108705ed9ec390002d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:03:21 +0900 Subject: [PATCH 09/19] =?UTF-8?q?refactor=20:=20=EA=B6=8C=ED=95=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=ED=99=95=EC=9E=A5=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 스플래시에서 권한 설정 후 화면이 넘어오면서 스위치 조정에 이상이 있음. 수정 필요. --- .../OnboardingPermissionActivity.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index d0c187a2..e412e390 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -1,17 +1,19 @@ package com.dongyang.android.youdongknowme.ui.view.permission +import android.Manifest import android.content.Intent +import android.content.pm.PackageManager import android.content.res.ColorStateList +import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import com.dongyang.android.youdongknowme.R import com.dongyang.android.youdongknowme.databinding.ActivityOnboardingPermissionBinding import com.dongyang.android.youdongknowme.standard.base.BaseActivity import com.dongyang.android.youdongknowme.ui.view.main.MainActivity import com.dongyang.android.youdongknowme.ui.view.setting.SettingViewModel -import com.dongyang.android.youdongknowme.ui.view.util.RequestPermission import org.koin.androidx.viewmodel.ext.android.viewModel -class OnboardingPermissionActivity(private val requestPermission: RequestPermission) : +class OnboardingPermissionActivity() : BaseActivity() { override val layoutResourceId: Int = R.layout.activity_onboarding_permission @@ -20,6 +22,7 @@ class OnboardingPermissionActivity(private val requestPermission: RequestPermiss override fun initStartView() { viewModel.checkAccessAlarm() viewModel.getUserDepartment() + setPermissionSwitch(false) setSpanText(this, binding.tvPermissionTitleMain, startIdx = 0, endIdx = 9) } @@ -33,18 +36,17 @@ class OnboardingPermissionActivity(private val requestPermission: RequestPermiss finish() } - setPermissionSwitch(false) - binding.switchPermission.setOnCheckedChangeListener { compoundButton, _ -> - val isPermissionGranted = - requestPermission.isPermissionGranted() - if (compoundButton.isChecked) { - if (isPermissionGranted) { + if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission( + this, Manifest.permission.POST_NOTIFICATIONS + ) + ) { setPermissionSwitch(true) } else { - requestPermission.requestPermission(0) - setPermissionSwitch(false) + ActivityCompat.requestPermissions( + this, arrayOf(Manifest.permission.POST_NOTIFICATIONS), 100 + ) } } else { setPermissionSwitch(false) From efa468cc816029a6e6056acb3b31992366ffd66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Thu, 21 Mar 2024 07:42:59 +0900 Subject: [PATCH 10/19] =?UTF-8?q?refactor=20:=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EA=B6=8C=ED=95=9C=20=EA=B1=B0=EB=B6=80=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=95=8C=EB=A6=BC=20->=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85=20=ED=99=94=EB=A9=B4=EC=9C=BC=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/permission/OnboardingPermissionActivity.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index e412e390..df6f6886 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -4,6 +4,9 @@ import android.Manifest import android.content.Intent import android.content.pm.PackageManager import android.content.res.ColorStateList +import android.net.Uri +import android.provider.Settings +import android.provider.Settings.ACTION_SETTINGS import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import com.dongyang.android.youdongknowme.R @@ -38,15 +41,15 @@ class OnboardingPermissionActivity() : binding.switchPermission.setOnCheckedChangeListener { compoundButton, _ -> if (compoundButton.isChecked) { + setPermissionSwitch(false) if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission( this, Manifest.permission.POST_NOTIFICATIONS ) ) { setPermissionSwitch(true) } else { - ActivityCompat.requestPermissions( - this, arrayOf(Manifest.permission.POST_NOTIFICATIONS), 100 - ) + val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:" + this.packageName)) + startActivity(intent) } } else { setPermissionSwitch(false) From 573e462671a43e951f1427681a0c487cfb3c1d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Thu, 21 Mar 2024 07:44:17 +0900 Subject: [PATCH 11/19] =?UTF-8?q?refactor=20:=20=EB=AF=B8=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=20=ED=98=B8=EC=B6=9C=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F?= =?UTF-8?q?=20=EC=9E=90=EB=8F=99=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../youdongknowme/ui/view/depart/DepartActivity.kt | 2 +- .../view/permission/OnboardingPermissionActivity.kt | 5 ++--- .../youdongknowme/ui/view/splash/SplashActivity.kt | 11 +++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt index 3f7e1438..ad744a4a 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt @@ -45,7 +45,7 @@ class DepartActivity : BaseActivity(), D // 포지션 선택 시 스낵바를 통해 알림 표시 if (it != -1) getDepart(items) } - + binding.toolbarDepart.btnToolbarExit.setOnClickListener { finish() } } diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index df6f6886..9a7abc9d 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -6,8 +6,6 @@ import android.content.pm.PackageManager import android.content.res.ColorStateList import android.net.Uri import android.provider.Settings -import android.provider.Settings.ACTION_SETTINGS -import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import com.dongyang.android.youdongknowme.R import com.dongyang.android.youdongknowme.databinding.ActivityOnboardingPermissionBinding @@ -48,7 +46,8 @@ class OnboardingPermissionActivity() : ) { setPermissionSwitch(true) } else { - val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:" + this.packageName)) + val intent = + Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:" + this.packageName)) startActivity(intent) } } else { diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index 63bfcba6..ac505b58 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -46,15 +46,12 @@ class SplashActivity() : BaseActivity() val intent = Intent(this@SplashActivity, OnboardingDepartActivity::class.java) if (PackageManager.PERMISSION_DENIED == ContextCompat.checkSelfPermission( - this@SplashActivity, - Manifest.permission.POST_NOTIFICATIONS + this@SplashActivity, Manifest.permission.POST_NOTIFICATIONS ) ) { // 권한 설정이 안되어 있는 경우 ActivityCompat.requestPermissions( - this@SplashActivity, - arrayOf(Manifest.permission.POST_NOTIFICATIONS), - 100 + this@SplashActivity, arrayOf(Manifest.permission.POST_NOTIFICATIONS), 100 ) } else { // 권한 설정이 이미 되어 있는 경우 @@ -70,9 +67,7 @@ class SplashActivity() : BaseActivity() } override fun onRequestPermissionsResult( - requestCode: Int, - permissions: Array, - grantResults: IntArray + requestCode: Int, permissions: Array, grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (requestCode == 100) { From 60783d9bdbf69f01155e625c1bfe45b16fb8cc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Thu, 21 Mar 2024 07:46:07 +0900 Subject: [PATCH 12/19] =?UTF-8?q?Comment=20:=20=EA=B6=8C=ED=95=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/permission/OnboardingPermissionActivity.kt | 4 ++++ .../android/youdongknowme/ui/view/splash/SplashActivity.kt | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index 9a7abc9d..ef255b3d 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -39,18 +39,22 @@ class OnboardingPermissionActivity() : binding.switchPermission.setOnCheckedChangeListener { compoundButton, _ -> if (compoundButton.isChecked) { + // 온보딩 알림 스위치를 활성화 setPermissionSwitch(false) if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission( this, Manifest.permission.POST_NOTIFICATIONS ) ) { + // 알림 권한이 허용 상태 setPermissionSwitch(true) } else { + // 알림 권한이 미허용 상태 val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:" + this.packageName)) startActivity(intent) } } else { + // 온보딩 알림 스위치 비활성화 setPermissionSwitch(false) } } diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index ac505b58..099d6524 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -49,12 +49,12 @@ class SplashActivity() : BaseActivity() this@SplashActivity, Manifest.permission.POST_NOTIFICATIONS ) ) { - // 권한 설정이 안되어 있는 경우 + // 알림 권한 설정 허용 ActivityCompat.requestPermissions( this@SplashActivity, arrayOf(Manifest.permission.POST_NOTIFICATIONS), 100 ) } else { - // 권한 설정이 이미 되어 있는 경우 + // 알림 권한 설정 미허용 startActivity(intent) finish() } From de9eff3990f6dbd7c005e9b627b5ac93dabd2906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Thu, 21 Mar 2024 07:53:54 +0900 Subject: [PATCH 13/19] =?UTF-8?q?refactor=20:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=9D=B8=EC=9E=90=20=ED=98=B8=EC=B6=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/permission/OnboardingPermissionActivity.kt | 2 +- .../android/youdongknowme/ui/view/splash/SplashActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index ef255b3d..7485e3ca 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -14,7 +14,7 @@ import com.dongyang.android.youdongknowme.ui.view.main.MainActivity import com.dongyang.android.youdongknowme.ui.view.setting.SettingViewModel import org.koin.androidx.viewmodel.ext.android.viewModel -class OnboardingPermissionActivity() : +class OnboardingPermissionActivity : BaseActivity() { override val layoutResourceId: Int = R.layout.activity_onboarding_permission diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index 099d6524..03adce34 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -20,7 +20,7 @@ import kotlinx.coroutines.launch import org.koin.androidx.viewmodel.ext.android.viewModel @SuppressLint("CustomSplashScreen") -class SplashActivity() : BaseActivity() { +class SplashActivity : BaseActivity() { override val layoutResourceId: Int = R.layout.activity_splash override val viewModel: SplashViewModel by viewModel() From 34a62c3b4572df9591750c4aba7bc2d5505175c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Thu, 21 Mar 2024 07:54:47 +0900 Subject: [PATCH 14/19] =?UTF-8?q?refactor=20:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=20=EB=B3=80=ED=99=94=20=EC=9E=AC=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/youdongknowme/ui/view/depart/DepartActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt index ad744a4a..3f7e1438 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/DepartActivity.kt @@ -45,7 +45,7 @@ class DepartActivity : BaseActivity(), D // 포지션 선택 시 스낵바를 통해 알림 표시 if (it != -1) getDepart(items) } - + binding.toolbarDepart.btnToolbarExit.setOnClickListener { finish() } } From 9591efd9680885c6e62bce2e00489efdd1ded181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Sun, 24 Mar 2024 07:06:47 +0900 Subject: [PATCH 15/19] =?UTF-8?q?refactor=20:=20=EC=8A=A4=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EC=B2=B4=ED=81=AC=20=EC=B4=88=EA=B8=B0=ED=99=94=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/permission/OnboardingPermissionActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index 7485e3ca..cf86284e 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -39,8 +39,10 @@ class OnboardingPermissionActivity : binding.switchPermission.setOnCheckedChangeListener { compoundButton, _ -> if (compoundButton.isChecked) { + // 권환 확인 전 스위치 초기화 + binding.switchPermission.isChecked = false + // 온보딩 알림 스위치를 활성화 - setPermissionSwitch(false) if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission( this, Manifest.permission.POST_NOTIFICATIONS ) From 6d7944034a87555ddfa74c0621943fc22c716cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Sun, 24 Mar 2024 07:08:32 +0900 Subject: [PATCH 16/19] =?UTF-8?q?style=20:=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EB=A7=A4=EA=B0=9C=EB=B3=80=EC=88=98=20=EC=A4=84=EB=B0=94?= =?UTF-8?q?=EA=BF=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Son Myeongji <114990782+m6z1@users.noreply.github.com> --- .../android/youdongknowme/ui/view/splash/SplashActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index 03adce34..b7051fb9 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -67,7 +67,9 @@ class SplashActivity : BaseActivity() { } override fun onRequestPermissionsResult( - requestCode: Int, permissions: Array, grantResults: IntArray + requestCode: Int, + permissions: Array, + grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (requestCode == 100) { From 45a682faade82fbc56c4d1524dc8905acfa40df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Sun, 24 Mar 2024 07:17:34 +0900 Subject: [PATCH 17/19] =?UTF-8?q?style=20:=20=EC=9E=90=EB=8F=99=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/permission/OnboardingPermissionActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index cf86284e..54b95025 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -41,7 +41,7 @@ class OnboardingPermissionActivity : if (compoundButton.isChecked) { // 권환 확인 전 스위치 초기화 binding.switchPermission.isChecked = false - + // 온보딩 알림 스위치를 활성화 if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission( this, Manifest.permission.POST_NOTIFICATIONS From f740b0f64d53d2c4e4632cd4b0745886fc72d63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Sun, 24 Mar 2024 07:17:49 +0900 Subject: [PATCH 18/19] =?UTF-8?q?refactor=20:=20requestCode=20=EC=83=81?= =?UTF-8?q?=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/youdongknowme/ui/view/splash/SplashActivity.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index b7051fb9..d27cf54f 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -51,7 +51,7 @@ class SplashActivity : BaseActivity() { ) { // 알림 권한 설정 허용 ActivityCompat.requestPermissions( - this@SplashActivity, arrayOf(Manifest.permission.POST_NOTIFICATIONS), 100 + this@SplashActivity, arrayOf(Manifest.permission.POST_NOTIFICATIONS), REQUEST_PERMISSION_CODE ) } else { // 알림 권한 설정 미허용 @@ -72,7 +72,7 @@ class SplashActivity : BaseActivity() { grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) - if (requestCode == 100) { + if (requestCode == REQUEST_PERMISSION_CODE) { // 권한 설정 결과 처리 val intent = if (viewModel.isFirstLaunch.value == true) { Intent(this@SplashActivity, OnboardingDepartActivity::class.java) @@ -97,5 +97,6 @@ class SplashActivity : BaseActivity() { companion object { private const val SPLASH_TIME_MILLIS = 1_500L + private const val REQUEST_PERMISSION_CODE = 100 } } \ No newline at end of file From 1e21f3844d437caedbf41f48ca59d2567dae740e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=9D=AC=EC=9A=B0?= <84004687+huiwoo-jo@users.noreply.github.com> Date: Sun, 24 Mar 2024 07:26:06 +0900 Subject: [PATCH 19/19] =?UTF-8?q?refactor=20:=20intent=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/view/depart/OnboardingDepartActivity.kt | 7 +++++++ .../android/youdongknowme/ui/view/main/MainActivity.kt | 8 ++++++++ .../ui/view/permission/OnboardingPermissionActivity.kt | 2 +- .../youdongknowme/ui/view/splash/SplashActivity.kt | 10 +++++----- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/OnboardingDepartActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/OnboardingDepartActivity.kt index b744af8b..4a17e2b6 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/OnboardingDepartActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/depart/OnboardingDepartActivity.kt @@ -1,5 +1,6 @@ package com.dongyang.android.youdongknowme.ui.view.depart +import android.content.Context import android.content.Intent import androidx.recyclerview.widget.LinearLayoutManager import com.dongyang.android.youdongknowme.R @@ -73,4 +74,10 @@ class OnboardingDepartActivity : BaseActivity() { override fun initDataBinding() {} override fun initAfterBinding() {} + + companion object { + fun createIntent(context: Context): Intent { + return Intent(context, MainActivity::class.java) + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt index 54b95025..6d6af0a3 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/permission/OnboardingPermissionActivity.kt @@ -32,7 +32,7 @@ class OnboardingPermissionActivity : override fun initAfterBinding() { binding.btnPermissionComplete.setOnClickListener { - val intent = Intent(this@OnboardingPermissionActivity, MainActivity::class.java) + val intent = MainActivity.createIntent(this@OnboardingPermissionActivity) startActivity(intent) finish() } diff --git a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt index d27cf54f..5bd26d49 100644 --- a/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt +++ b/app/src/main/java/com/dongyang/android/youdongknowme/ui/view/splash/SplashActivity.kt @@ -43,7 +43,7 @@ class SplashActivity : BaseActivity() { delay(SPLASH_TIME_MILLIS) if (viewModel.isFirstLaunch.value == true) { - val intent = Intent(this@SplashActivity, OnboardingDepartActivity::class.java) + val intent = OnboardingDepartActivity.createIntent(this@SplashActivity) if (PackageManager.PERMISSION_DENIED == ContextCompat.checkSelfPermission( this@SplashActivity, Manifest.permission.POST_NOTIFICATIONS @@ -59,7 +59,7 @@ class SplashActivity : BaseActivity() { finish() } } else { - val intent = Intent(this@SplashActivity, MainActivity::class.java) + intent = MainActivity.createIntent(this@SplashActivity) startActivity(intent) finish() } @@ -74,10 +74,10 @@ class SplashActivity : BaseActivity() { super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (requestCode == REQUEST_PERMISSION_CODE) { // 권한 설정 결과 처리 - val intent = if (viewModel.isFirstLaunch.value == true) { - Intent(this@SplashActivity, OnboardingDepartActivity::class.java) + intent = if (viewModel.isFirstLaunch.value == true) { + OnboardingDepartActivity.createIntent(this@SplashActivity) } else { - Intent(this@SplashActivity, MainActivity::class.java) + MainActivity.createIntent(this@SplashActivity) } startActivity(intent) finish()