diff --git a/.gitignore b/.gitignore index e83a6374..5e28a168 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ .externalNativeBuild .cxx local.properties +key.jks +/app/release/app-release.apk +/app/release/output-metadata.json \ No newline at end of file diff --git a/app/src/main/java/com/toyou/toyouandroid/domain/social/repostitory/SocialRepository.kt b/app/src/main/java/com/toyou/toyouandroid/domain/social/repostitory/SocialRepository.kt index 66bbf79e..32300f2e 100644 --- a/app/src/main/java/com/toyou/toyouandroid/domain/social/repostitory/SocialRepository.kt +++ b/app/src/main/java/com/toyou/toyouandroid/domain/social/repostitory/SocialRepository.kt @@ -13,21 +13,20 @@ class SocialRepository(private val tokenStorage: TokenStorage) { suspend fun getFriendsData() = client.getFriends("Bearer ${tokenStorage.getAccessToken().toString()}") - suspend fun patchApproveFriend( - request: RequestFriend - ){ - try { + suspend fun patchApproveFriend(request: RequestFriend): Boolean { + return try { val response = client.patchApprove("Bearer ${tokenStorage.getAccessToken().toString()}", friend = request) - // 응답 처리 if (response.isSuccess) { - Log.d("친구승인 성공!", response.message) + Log.d("SocialRepository", "친구승인 성공: ${response.message}") + true // 성공하면 true 반환 } else { - Log.d("친구승인 실패!", response.message) + Log.d("SocialRepository", "친구승인 실패: ${response.message}") + false // 실패하면 false 반환 } } catch (e: Exception) { e.printStackTrace() Log.d("친구승인 실패!", e.message.toString()) - + false // 예외 발생 시 false 반환 } } diff --git a/app/src/main/java/com/toyou/toyouandroid/fcm/MyFirebaseMessagingService.kt b/app/src/main/java/com/toyou/toyouandroid/fcm/MyFirebaseMessagingService.kt index 94e7e457..2f4e179b 100644 --- a/app/src/main/java/com/toyou/toyouandroid/fcm/MyFirebaseMessagingService.kt +++ b/app/src/main/java/com/toyou/toyouandroid/fcm/MyFirebaseMessagingService.kt @@ -6,65 +6,65 @@ import android.app.NotificationManager import android.app.PendingIntent import android.content.Context import android.content.Intent +import android.content.SharedPreferences import android.content.pm.PackageManager -import android.net.Uri import android.os.Build -import android.provider.Settings -import android.util.Log -import android.widget.Toast -import androidx.activity.result.contract.ActivityResultContracts -import androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale import androidx.core.app.NotificationCompat import androidx.core.content.ContextCompat -import androidx.lifecycle.viewModelScope -import com.google.android.material.snackbar.Snackbar import com.google.firebase.messaging.FirebaseMessaging import com.google.firebase.messaging.FirebaseMessagingService import com.google.firebase.messaging.RemoteMessage import com.toyou.toyouandroid.R import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.utils.TokenStorage -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch +import timber.log.Timber class MyFirebaseMessagingService : FirebaseMessagingService() { - private lateinit var tokenStorage: TokenStorage + private var sharedPreferences: SharedPreferences? = null override fun onCreate() { super.onCreate() - // TokenStorage 초기화 tokenStorage = TokenStorage(applicationContext) - + sharedPreferences = getSharedPreferences("FCM_PREFERENCES", Context.MODE_PRIVATE) } override fun onNewToken(token: String) { super.onNewToken(token) - Log.d("FCM Token", "FCM 토큰: $token") - + Timber.d("FCM 토큰: %s", token) tokenStorage.saveFcmToken(token) - Log.d("FCM Token 저장", "토큰이 저장되었습니다: $token") + Timber.d("토큰이 저장되었습니다: %s", token) + // 구독 여부가 저장되어 있으면 구독 + val isSubscribed = sharedPreferences?.getBoolean("isSubscribed", true) + if (isSubscribed == true) { + subscribeToTopic() + } + } + + fun subscribeToTopic() { FirebaseMessaging.getInstance().subscribeToTopic("allUsers") .addOnCompleteListener { task -> if (task.isSuccessful) { - Log.d("FCM", "topic 구독 성공'") + Timber.d("topic 구독 성공") + sharedPreferences?.edit()?.putBoolean("isSubscribed", true)?.apply() } else { - Log.e("FCM",task.exception.toString()) + Timber.e(task.exception, "구독 실패") } } + } - /*FirebaseMessaging.getInstance().unsubscribeFromTopic("alarm") + fun unsubscribeFromTopic() { + FirebaseMessaging.getInstance().unsubscribeFromTopic("allUsers") .addOnCompleteListener { task -> if (task.isSuccessful) { - Log.d("FCM", "topic 구독 취소 성공") + Timber.d("topic 구독 취소 성공") + sharedPreferences?.edit()?.putBoolean("isSubscribed", false)?.apply() } else { - Log.e("FCM", task.exception.toString()) + Timber.e(task.exception, "구독 취소 실패") } - }*/ - + } } override fun onMessageReceived(remoteMessage: RemoteMessage) { @@ -77,7 +77,7 @@ class MyFirebaseMessagingService : FirebaseMessagingService() { sendNotification(it.title, it.body) } } else { - Log.d("FCM", "알림 권한이 없어 알림을 표시할 수 없습니다.") + Timber.tag("FCM").d("알림 권한이 없어 알림을 표시할 수 없습니다.") } } diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/emotionstamp/HomeOptionFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/emotionstamp/HomeOptionFragment.kt index 8e195dd6..d5c2706a 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/emotionstamp/HomeOptionFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/emotionstamp/HomeOptionFragment.kt @@ -19,8 +19,8 @@ import com.toyou.toyouandroid.data.onboarding.service.AuthService import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.presentation.fragment.notice.NoticeDialog import com.toyou.toyouandroid.presentation.fragment.notice.NoticeDialogViewModel -import com.toyou.toyouandroid.presentation.fragment.onboarding.AuthViewModelFactory import com.toyou.toyouandroid.presentation.fragment.home.HomeViewModel +import com.toyou.toyouandroid.presentation.viewmodel.HomeViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel import com.toyou.toyouandroid.presentation.viewmodel.UserViewModelFactory import com.toyou.toyouandroid.utils.TokenManager @@ -53,18 +53,14 @@ class HomeOptionFragment : Fragment() { homeOptionViewModel = ViewModelProvider( this, - AuthViewModelFactory( - authService, - tokenStorage, + HomeViewModelFactory( tokenManager ) )[HomeOptionViewModel::class.java] homeViewModel = ViewModelProvider( this, - AuthViewModelFactory( - authService, - tokenStorage, + HomeViewModelFactory( tokenManager ) )[HomeViewModel::class.java] diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/HomeFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/HomeFragment.kt index dfe4d4cd..d02bf7b4 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/HomeFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/HomeFragment.kt @@ -9,7 +9,6 @@ import android.widget.Toast import androidx.activity.OnBackPressedCallback import androidx.constraintlayout.widget.ConstraintLayout import androidx.fragment.app.Fragment -import androidx.fragment.app.activityViewModels import androidx.lifecycle.ViewModelProvider import androidx.navigation.NavController import androidx.navigation.Navigation @@ -29,12 +28,12 @@ import com.toyou.toyouandroid.data.onboarding.service.AuthService import com.toyou.toyouandroid.data.record.service.RecordService import com.toyou.toyouandroid.domain.record.RecordRepository import com.toyou.toyouandroid.network.NetworkModule -import com.toyou.toyouandroid.presentation.fragment.notice.NoticeViewModelFactory -import com.toyou.toyouandroid.presentation.fragment.onboarding.AuthViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.NoticeViewModelFactory import com.toyou.toyouandroid.presentation.fragment.record.CardInfoViewModel -import com.toyou.toyouandroid.presentation.fragment.record.RecordViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.RecordViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.CardViewModel import com.toyou.toyouandroid.presentation.viewmodel.CardViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.HomeViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel import com.toyou.toyouandroid.presentation.viewmodel.UserViewModelFactory import com.toyou.toyouandroid.utils.TokenManager @@ -70,8 +69,10 @@ class HomeFragment : Fragment() { val tokenStorage = TokenStorage(requireContext()) val authService = NetworkModule.getClient().create(AuthService::class.java) val tokenManager = TokenManager(authService, tokenStorage) + val noticeService = AuthNetworkModule.getClient().create(NoticeService::class.java) val noticeRepository = NoticeRepository(noticeService) + val recordService = AuthNetworkModule.getClient().create(RecordService::class.java) val recordRepository = RecordRepository(recordService) @@ -82,7 +83,7 @@ class HomeFragment : Fragment() { viewModel = ViewModelProvider( this, - AuthViewModelFactory(authService, tokenStorage, tokenManager) + HomeViewModelFactory(tokenManager) )[HomeViewModel::class.java] binding.lifecycleOwner = viewLifecycleOwner diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageFragment.kt index cb282b08..bbe7354d 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageFragment.kt @@ -1,7 +1,9 @@ package com.toyou.toyouandroid.presentation.fragment.mypage import android.content.ContentValues.TAG +import android.content.Context import android.content.Intent +import android.content.SharedPreferences import android.graphics.Color import android.net.Uri import android.os.Bundle @@ -19,11 +21,13 @@ import com.toyou.toyouandroid.databinding.FragmentMypageBinding import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.presentation.fragment.onboarding.SignupNicknameViewModel import com.toyou.toyouandroid.data.onboarding.service.AuthService +import com.toyou.toyouandroid.network.AuthNetworkModule import com.toyou.toyouandroid.network.NetworkModule -import com.toyou.toyouandroid.presentation.fragment.onboarding.AuthViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.AuthViewModelFactory import com.toyou.toyouandroid.presentation.fragment.home.HomeViewModel +import com.toyou.toyouandroid.presentation.viewmodel.HomeViewModelFactory import com.toyou.toyouandroid.utils.TokenManager -import com.toyou.toyouandroid.utils.ViewModelManager +import com.toyou.toyouandroid.presentation.viewmodel.ViewModelManager import com.toyou.toyouandroid.utils.TokenStorage import com.toyou.toyouandroid.utils.TutorialStorage import timber.log.Timber @@ -44,11 +48,15 @@ class MypageFragment : Fragment() { private lateinit var homeViewModel: HomeViewModel + private var sharedPreferences: SharedPreferences? = null + private val mypageViewModel: MypageViewModel by activityViewModels { val tokenStorage = TokenStorage(requireContext()) val authService: AuthService = NetworkModule.getClient().create(AuthService::class.java) val tokenManager = TokenManager(authService, tokenStorage) - AuthViewModelFactory(authService, tokenStorage, tokenManager) + + val authService2: AuthService = AuthNetworkModule.getClient().create(AuthService::class.java) + AuthViewModelFactory(authService2, tokenStorage, tokenManager) } override fun onCreateView( @@ -64,13 +72,13 @@ class MypageFragment : Fragment() { homeViewModel = ViewModelProvider( this, - AuthViewModelFactory( - authService, - tokenStorage, + HomeViewModelFactory( tokenManager ) )[HomeViewModel::class.java] + sharedPreferences = requireActivity().getSharedPreferences("FCM_PREFERENCES", Context.MODE_PRIVATE) + return binding.root } @@ -96,30 +104,24 @@ class MypageFragment : Fragment() { } binding.mypageOpinion.setOnClickListener { - val i = Intent(Intent.ACTION_VIEW) - i.data = Uri.parse("https://forms.gle/fJweAP16cT4Tc3cA6") - startActivity(i) + redirectLink("https://forms.gle/fJweAP16cT4Tc3cA6") } binding.mypageOpinionBtn.setOnClickListener{ - val i = Intent(Intent.ACTION_VIEW) - i.data = Uri.parse("https://forms.gle/fJweAP16cT4Tc3cA6") - startActivity(i) + redirectLink("https://forms.gle/fJweAP16cT4Tc3cA6") } binding.mypageContact.setOnClickListener { - val i = Intent(Intent.ACTION_VIEW) - i.data = Uri.parse("http://pf.kakao.com/_xiuPIn/chat") - startActivity(i) + redirectLink("http://pf.kakao.com/_xiuPIn/chat") } binding.mypageContactBtn.setOnClickListener{ - val i = Intent(Intent.ACTION_VIEW) - i.data = Uri.parse("http://pf.kakao.com/_xiuPIn/chat") - startActivity(i) + redirectLink("http://pf.kakao.com/_xiuPIn/chat") } - binding.mypageTermsOfUse.setOnClickListener {} + binding.mypageTermsOfUse.setOnClickListener { + redirectLink("https://sumptuous-metacarpal-d3a.notion.site/1437c09ca64e80fb88f6d8ab881ffee3") + } // 사용자 닉네임 설정 nicknameViewModel.nickname.observe(viewLifecycleOwner) { nickname -> @@ -147,6 +149,8 @@ class MypageFragment : Fragment() { mypageViewModel.setLogoutSuccess(false) viewModelManager.resetAllViewModels() + Timber.d("로그아웃 후 로그인 화면으로 이동") + navController.navigate(R.id.action_navigation_mypage_to_login_fragment) } } @@ -203,12 +207,12 @@ class MypageFragment : Fragment() { } else { Timber.tag(TAG).i("연결 끊기 성공. SDK에서 토큰 삭제 됨") - //mypageViewModel.fcmTokenDelete(nicknameViewModel.nickname.toString()) } } // 회원 탈퇴 후 튜토리얼 다시 보이도록 설정 TutorialStorage(requireContext()).setTutorialNotShown() + sharedPreferences?.edit()?.putBoolean("isSubscribed", true)?.apply() mypageViewModel.kakaoSignOut() mypageDialog?.dismiss() @@ -236,6 +240,11 @@ class MypageFragment : Fragment() { mypageDialog?.dismiss() } + private fun redirectLink(uri: String) { + val i = Intent(Intent.ACTION_VIEW) + i.data = Uri.parse(uri) + startActivity(i) + } override fun onDestroyView() { super.onDestroyView() _binding = null diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageViewModel.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageViewModel.kt index edaf5585..1e27a6a3 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageViewModel.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageViewModel.kt @@ -44,13 +44,19 @@ class MypageViewModel( _logoutSuccess.value = true tokenStorage.clearTokens() } else { - val errorMessage = response.errorBody()?.string() ?: "Unknown error" + val errorMessage = response.errorBody()?.string() ?: "Unknown error: ${response.message()}" Timber.e("API Error: $errorMessage") _logoutSuccess.value = false - tokenManager.refreshToken( - onSuccess = { kakaoLogout() }, - onFailure = { Timber.e("Failed to refresh token and kakao logout") } - ) + + // 토큰 만료 시 토큰 갱신 후 로그아웃 재시도 + if (response.code() == 401) { + tokenManager.refreshToken( + onSuccess = { kakaoLogout() }, // 토큰 갱신 후 로그아웃 재시도 + onFailure = { Timber.e("Failed to refresh token and kakao logout") } + ) + } else { + _logoutSuccess.value = false + } } } diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/NoticeSettingFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/NoticeSettingFragment.kt index 41017b55..2cd7a76b 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/NoticeSettingFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/NoticeSettingFragment.kt @@ -1,14 +1,19 @@ package com.toyou.toyouandroid.presentation.fragment.mypage +import android.content.Context +import android.content.SharedPreferences import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.Toast import androidx.fragment.app.Fragment import androidx.navigation.NavController import androidx.navigation.Navigation import com.toyou.toyouandroid.R import com.toyou.toyouandroid.databinding.FragmentNoticeSettingBinding +import com.toyou.toyouandroid.fcm.MyFirebaseMessagingService +import timber.log.Timber class NoticeSettingFragment : Fragment() { @@ -18,6 +23,9 @@ class NoticeSettingFragment : Fragment() { private val binding: FragmentNoticeSettingBinding get() = requireNotNull(_binding){"FragmentNoticeSettingBinding -> null"} + private lateinit var myFirebaseMessagingService: MyFirebaseMessagingService + private lateinit var sharedPreferences: SharedPreferences + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -36,6 +44,32 @@ class NoticeSettingFragment : Fragment() { binding.noticeSettingBackLayout.setOnClickListener { navController.navigate(R.id.action_navigation_notice_setting_to_mypage_fragment) } + + myFirebaseMessagingService = MyFirebaseMessagingService() + sharedPreferences = + context?.getSharedPreferences("FCM_PREFERENCES", Context.MODE_PRIVATE) ?: return + + // 기존 구독 상태를 SharedPreferences에서 불러오기 + val isSubscribed = sharedPreferences.getBoolean("isSubscribed", false) + + // SwitchCompat 초기 상태 설정 + binding.noticeToggle.isChecked = isSubscribed + + Timber.d("현재 구독 상태: %b", isSubscribed) + + binding.noticeToggle.setOnCheckedChangeListener { _, isChecked -> + if (isChecked) { + myFirebaseMessagingService.subscribeToTopic() + Timber.d("구독됨") + Toast.makeText(context, "알림 수신을 동의하였습니다", Toast.LENGTH_SHORT).show() + } else { + myFirebaseMessagingService.unsubscribeFromTopic() + Timber.d("구독 취소됨") + Toast.makeText(context, "알림 수신을 거부하였습니다", Toast.LENGTH_SHORT).show() + } + + sharedPreferences.edit().putBoolean("isSubscribed", isChecked).apply() + } } override fun onDestroyView() { diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/ProfileFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/ProfileFragment.kt index 0abe3635..18582620 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/ProfileFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/ProfileFragment.kt @@ -18,8 +18,10 @@ import com.toyou.toyouandroid.R import com.toyou.toyouandroid.databinding.FragmentProfileBinding import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.data.onboarding.service.AuthService +import com.toyou.toyouandroid.network.AuthNetworkModule import com.toyou.toyouandroid.network.NetworkModule -import com.toyou.toyouandroid.presentation.fragment.onboarding.AuthViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.AuthViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.HomeViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel import com.toyou.toyouandroid.presentation.viewmodel.UserViewModelFactory import com.toyou.toyouandroid.utils.TokenManager @@ -41,7 +43,9 @@ class ProfileFragment : Fragment() { val tokenStorage = TokenStorage(requireContext()) val authService: AuthService = NetworkModule.getClient().create(AuthService::class.java) val tokenManager = TokenManager(authService, tokenStorage) - AuthViewModelFactory(authService, tokenStorage, tokenManager) + + val authService2: AuthService = AuthNetworkModule.getClient().create(AuthService::class.java) + AuthViewModelFactory(authService2, tokenStorage, tokenManager) } override fun onCreateView( @@ -58,9 +62,7 @@ class ProfileFragment : Fragment() { viewModel = ViewModelProvider( this, - AuthViewModelFactory( - authService, - tokenStorage, + HomeViewModelFactory( tokenManager ) )[ProfileViewModel::class.java] diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapter.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapter.kt index fd925ba7..c689576c 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapter.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapter.kt @@ -91,15 +91,12 @@ class NoticeAdapter( removeItem(this.layoutPosition) } - binding.noticeLayout.setOnClickListener { - listener.onFriendRequestAcceptClick(item) - } - binding.noticeFriendRequestBtn.setOnClickListener { // 친구 요청 수락 버튼 클릭 후 알림 메시지 제거 - val name = item.nickname - Timber.d(name) - listener.onFriendRequestApprove(name, item.alarmId, this.layoutPosition) + Timber.d(item.nickname) + listener.onFriendRequestApprove(item.nickname, item.alarmId, this.layoutPosition) + viewModel.deleteNotice(item.alarmId, this.layoutPosition) + removeItem(this.layoutPosition) } binding.executePendingBindings() diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapterListener.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapterListener.kt index 5a31b00a..ef50efa5 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapterListener.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeAdapterListener.kt @@ -3,7 +3,6 @@ package com.toyou.toyouandroid.presentation.fragment.notice interface NoticeAdapterListener { fun onDeleteNotice(alarmId: Int, position: Int) fun onFriendRequestApprove(name: String, alarmId: Int, position: Int) - fun onFriendRequestAcceptClick(item: NoticeItem.NoticeFriendRequestItem) fun onFriendRequestAcceptedItemClick(item: NoticeItem.NoticeFriendRequestAcceptedItem) fun onFriendCardItemClick(item: NoticeItem.NoticeCardCheckItem) } \ No newline at end of file diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeFragment.kt index 6d4d4bbc..c9b7bde2 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeFragment.kt @@ -21,6 +21,7 @@ import com.toyou.toyouandroid.data.onboarding.service.AuthService import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.presentation.viewmodel.CardViewModel import com.toyou.toyouandroid.presentation.viewmodel.CardViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.NoticeViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.SocialViewModel import com.toyou.toyouandroid.presentation.viewmodel.SocialViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel @@ -39,17 +40,16 @@ class NoticeFragment : Fragment(), NoticeAdapterListener { private val binding: FragmentNoticeBinding get() = requireNotNull(_binding){"FragmentNoticeBinding -> null"} - private lateinit var viewModel: NoticeViewModel private val noticeDialogViewModel: NoticeDialogViewModel by activityViewModels() private lateinit var listener: NoticeAdapterListener private var noticeAdapter: NoticeAdapter? = null + private var noticeDialog: NoticeDialog? = null + private lateinit var viewModel: NoticeViewModel private lateinit var userViewModel: UserViewModel private lateinit var socialViewModel : SocialViewModel private lateinit var cardViewModel: CardViewModel - private var noticeDialog: NoticeDialog? = null - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -67,14 +67,17 @@ class NoticeFragment : Fragment(), NoticeAdapterListener { this, NoticeViewModelFactory(noticeRepository, tokenManager) )[NoticeViewModel::class.java] + cardViewModel = ViewModelProvider( requireActivity(), CardViewModelFactory(tokenStorage) )[CardViewModel::class.java] + userViewModel = ViewModelProvider( requireActivity(), UserViewModelFactory(tokenStorage) )[UserViewModel::class.java] + socialViewModel = ViewModelProvider( requireActivity(), SocialViewModelFactory(tokenStorage) @@ -94,26 +97,6 @@ class NoticeFragment : Fragment(), NoticeAdapterListener { socialViewModel.patchApproveNotice(name, myName, alarmId, position) } - override fun onFriendRequestAcceptClick(item: NoticeItem.NoticeFriendRequestItem) { - socialViewModel.approveSuccess.observe(viewLifecycleOwner) { result -> - if (result != null) { - if (result.isSuccess) { - navController.navigate(R.id.action_navigation_notice_to_social_fragment) - - socialViewModel.resetApproveSuccess() // 메서드 호출하여 상태 초기화 - } else { - noticeDialogViewModel.setDialogData( - title = "존재하지 않는 \n 사용자입니다", - leftButtonText = "확인", - leftButtonClickAction = { checkUserNone() }, - ) - noticeDialog = NoticeDialog() - noticeDialog?.show(parentFragmentManager, "CustomDialog") - } - } - } - } - override fun onFriendRequestAcceptedItemClick(item: NoticeItem.NoticeFriendRequestAcceptedItem) { navController.navigate(R.id.action_navigation_notice_to_social_fragment) } @@ -155,14 +138,17 @@ class NoticeFragment : Fragment(), NoticeAdapterListener { socialViewModel.approveSuccess.observe(viewLifecycleOwner) { result -> if (result != null) { if (result.isSuccess) { - // API 호출이 성공했으므로 아이템 삭제 - viewModel.deleteNotice(result.alarmId, result.position) // 알림 삭제 - noticeAdapter?.removeItem(result.position) // 어댑터에 아이템 삭제 요청 navController.navigate(R.id.action_navigation_notice_to_social_fragment) - Toast.makeText(requireContext(), "친구 요청을 수락했습니다", Toast.LENGTH_SHORT).show() - socialViewModel.resetApproveSuccess() // 메서드 호출하여 상태 초기화 + } else { + noticeDialogViewModel.setDialogData( + title = "존재하지 않는 \n 사용자입니다", + leftButtonText = "확인", + leftButtonClickAction = { checkUserNone() }, + ) + noticeDialog = NoticeDialog() + noticeDialog?.show(parentFragmentManager, "CustomDialog") } } } @@ -201,7 +187,6 @@ class NoticeFragment : Fragment(), NoticeAdapterListener { override fun onFriendRequestApprove(name: String, alarmId: Int, position: Int) {} override fun onDeleteNotice(alarmId: Int, position: Int) {} - override fun onFriendRequestAcceptClick(item: NoticeItem.NoticeFriendRequestItem) {} override fun onFriendRequestAcceptedItemClick(item: NoticeItem.NoticeFriendRequestAcceptedItem) {} override fun onFriendCardItemClick(item: NoticeItem.NoticeCardCheckItem) {} diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginFragment.kt index c079eb59..54509fbb 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginFragment.kt @@ -9,7 +9,7 @@ import android.view.View import android.view.ViewGroup import androidx.activity.OnBackPressedCallback import androidx.fragment.app.Fragment -import androidx.lifecycle.ViewModelProvider +import androidx.fragment.app.activityViewModels import androidx.navigation.NavController import androidx.navigation.Navigation import com.kakao.sdk.auth.model.OAuthToken @@ -21,9 +21,11 @@ import com.toyou.toyouandroid.databinding.FragmentLoginBinding import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.data.onboarding.service.AuthService +import com.toyou.toyouandroid.presentation.viewmodel.AuthViewModelFactory import com.toyou.toyouandroid.utils.TokenManager import com.toyou.toyouandroid.utils.TokenStorage import com.toyou.toyouandroid.utils.TutorialStorage +import timber.log.Timber class LoginFragment : Fragment() { @@ -33,29 +35,22 @@ class LoginFragment : Fragment() { get() = requireNotNull(_binding){"FragmentLoginBinding -> null"} private lateinit var tutorialStorage: TutorialStorage - private lateinit var loginViewModel: LoginViewModel + + private val loginViewModel: LoginViewModel by activityViewModels{ + val tokenStorage = TokenStorage(requireContext()) + val authService = NetworkModule.getClient().create(AuthService::class.java) + val tokenManager = TokenManager(authService, tokenStorage) + + AuthViewModelFactory(authService, tokenStorage, tokenManager) + } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?, ): View { - _binding = FragmentLoginBinding.inflate(inflater, container, false) - val tokenStorage = TokenStorage(requireContext()) - val authService = NetworkModule.getClient().create(AuthService::class.java) - val tokenManager = TokenManager(authService, tokenStorage) - - loginViewModel = ViewModelProvider( - this, - AuthViewModelFactory( - authService, - tokenStorage, - tokenManager - ) - )[LoginViewModel::class.java] - tutorialStorage = TutorialStorage(requireContext()) return binding.root @@ -65,7 +60,6 @@ class LoginFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - // MainActivity의 메소드를 호출하여 바텀 네비게이션 뷰 숨기기 (requireActivity() as MainActivity).hideBottomNavigation(true) @@ -121,18 +115,27 @@ class LoginFragment : Fragment() { loginViewModel.loginSuccess.observe(viewLifecycleOwner) { isSuccess -> if (isSuccess) { - loginViewModel.setLoginSuccess(false) + Timber.d("로그인 성공했으므로 토큰 존재 여부 검사") + loginViewModel.setLoginSuccess(false) // 초기화 + loginViewModel.setInitialization(false) // 초기화 loginViewModel.checkIfTokenExists() // 토큰이 저장되었는지 확인 후 이동 } } loginViewModel.checkIfTokenExists.observe(viewLifecycleOwner) { isChecked -> - if (isChecked) { - // 서비스 이용자일 경우 튜토리얼 테스트 - checkTutorial() - } else { - // 토큰이 존재하지 않을 경우 신규 가입 - navController.navigate(R.id.action_navigation_login_to_signup_agree_fragment) + if (loginViewModel.isInitialization.value == false) { // 초기화 상태에서만 관찰 + if (isChecked) { + // 서비스 이용자일 경우 튜토리얼 검증 + Timber.d("서비스 이용자이므로 튜토리얼 검증") + checkTutorial() + loginViewModel.setInitialization(true) // 초기화 + loginViewModel.setIfTokenExists(false) // 토큰 상태 초기화 + } else { + // 토큰이 존재하지 않을 경우 신규 가입 + Timber.d("토큰이 존재하지 않으므로 신규 가입") + loginViewModel.setInitialization(true) // 초기화 + navController.navigate(R.id.action_navigation_login_to_signup_agree_fragment) + } } } } @@ -144,6 +147,7 @@ class LoginFragment : Fragment() { } else { // 튜토리얼을 본 적이 있으면 홈 화면으로 바로 이동 // 액세스 토큰이 있으면 홈 화면으로 이동 + Timber.d("액세스 토큰이 있으므로 홈 화면으로 이동") navController.navigate(R.id.action_navigation_login_to_home_fragment) } } diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginViewModel.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginViewModel.kt index 4ce4abcb..2e20fda2 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginViewModel.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginViewModel.kt @@ -11,7 +11,6 @@ import com.toyou.toyouandroid.network.AuthNetworkModule import com.toyou.toyouandroid.data.onboarding.dto.request.SignUpRequest import com.toyou.toyouandroid.data.onboarding.dto.response.SignUpResponse import com.toyou.toyouandroid.data.onboarding.service.AuthService -import com.toyou.toyouandroid.utils.TokenManager import com.toyou.toyouandroid.utils.TokenStorage import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -39,6 +38,18 @@ class LoginViewModel( private val _checkIfTokenExists = MutableLiveData() val checkIfTokenExists: LiveData get() = _checkIfTokenExists + private val _isInitialization = MutableLiveData() + val isInitialization: LiveData get() = _isInitialization + + fun setIfTokenExists(value: Boolean) { + _checkIfTokenExists.value = value + Timber.d("checkIfTokenExists: $value") + } + + fun setInitialization(value: Boolean) { + _isInitialization.value = value + } + fun checkIfTokenExists() { tokenStorage.let { storage -> val accessToken = storage.getAccessToken() @@ -66,7 +77,6 @@ class LoginViewModel( // 암호화된 토큰 저장소에 저장 tokenStorage.saveTokens(newAccessToken, newRefreshToken) - TokenManager(authService, tokenStorage).setAccessToken(newAccessToken) sendTokenToServer(tokenStorage.getFcmToken().toString()) // 인증 네트워크 모듈에 access token 저장 diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupAgreeFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupAgreeFragment.kt index b8184782..35afc4fd 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupAgreeFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupAgreeFragment.kt @@ -1,5 +1,7 @@ package com.toyou.toyouandroid.presentation.fragment.onboarding +import android.content.Intent +import android.net.Uri import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -45,6 +47,19 @@ class SignupAgreeFragment : Fragment() { navController.popBackStack() } + binding.signupAgreeDetails3.setOnClickListener{ + termsOfUseLink() + } + binding.signupAgreeDetails4.setOnClickListener{ + termsOfUseLink() + } + binding.signupAgreeArrow3.setOnClickListener{ + termsOfUseLink() + } + binding.signupAgreeArrow4.setOnClickListener{ + termsOfUseLink() + } + val checkboxLayouts = listOf( binding.checkbox1Layout, binding.checkbox2Layout, @@ -96,6 +111,12 @@ class SignupAgreeFragment : Fragment() { } } + private fun termsOfUseLink() { + val i = Intent(Intent.ACTION_VIEW) + i.data = Uri.parse("https://sumptuous-metacarpal-d3a.notion.site/1437c09ca64e80fb88f6d8ab881ffee3") + startActivity(i) + } + override fun onDestroyView() { super.onDestroyView() _binding = null diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupNicknameFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupNicknameFragment.kt index a7f9f30b..ee6d3e5b 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupNicknameFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupNicknameFragment.kt @@ -10,13 +10,19 @@ import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.lifecycle.ViewModelProvider import androidx.navigation.NavController import androidx.navigation.fragment.findNavController import com.toyou.toyouandroid.R +import com.toyou.toyouandroid.data.onboarding.service.AuthService import com.toyou.toyouandroid.databinding.FragmentSignupnicknameBinding +import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.presentation.fragment.home.HomeViewModel -import com.toyou.toyouandroid.utils.ViewModelManager +import com.toyou.toyouandroid.presentation.viewmodel.HomeViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.ViewModelManager +import com.toyou.toyouandroid.utils.TokenManager +import com.toyou.toyouandroid.utils.TokenStorage class SignupNicknameFragment : Fragment() { @@ -24,9 +30,11 @@ class SignupNicknameFragment : Fragment() { private var _binding: FragmentSignupnicknameBinding? = null private val binding: FragmentSignupnicknameBinding get() = requireNotNull(_binding){"FragmentSignupnicknameBinding -> null"} + private val viewModel: SignupNicknameViewModel by activityViewModels() private val nicknameViewModel: SignupNicknameViewModel by activityViewModels() - private val homeViewModel: HomeViewModel by activityViewModels() + + private lateinit var homeViewModel: HomeViewModel private lateinit var viewModelManager: ViewModelManager override fun onCreateView( @@ -34,8 +42,17 @@ class SignupNicknameFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { - _binding = FragmentSignupnicknameBinding.inflate(inflater, container, false) + + val tokenStorage = TokenStorage(requireContext()) + val authService: AuthService = NetworkModule.getClient().create(AuthService::class.java) + val tokenManager = TokenManager(authService, tokenStorage) + + homeViewModel = ViewModelProvider( + this, + HomeViewModelFactory(tokenManager) + )[HomeViewModel::class.java] + binding.viewModel = viewModel binding.lifecycleOwner = this @@ -72,7 +89,6 @@ class SignupNicknameFragment : Fragment() { }) binding.signupNicknameBtn.setOnClickListener{ -// nicknameViewModel.changeNickname(1) navController.navigate(R.id.action_navigation_signup_nickname_to_signup_status_fragment) } diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupStatusFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupStatusFragment.kt index ef063ccc..a1bb5718 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupStatusFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupStatusFragment.kt @@ -6,6 +6,7 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.lifecycle.ViewModelProvider import androidx.navigation.NavController import androidx.navigation.fragment.findNavController import com.toyou.toyouandroid.R @@ -14,6 +15,7 @@ import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.data.onboarding.dto.request.SignUpRequest import com.toyou.toyouandroid.data.onboarding.service.AuthService +import com.toyou.toyouandroid.presentation.viewmodel.AuthViewModelFactory import com.toyou.toyouandroid.utils.TokenManager import com.toyou.toyouandroid.utils.TokenStorage import com.toyou.toyouandroid.utils.TutorialStorage @@ -25,20 +27,18 @@ class SignupStatusFragment : Fragment() { private var _binding: FragmentSignupstatusBinding? = null private val binding: FragmentSignupstatusBinding get() = requireNotNull(_binding){"FragmentSignupstatusBinding -> null"} + private val signUpStatusViewModel: SignupStatusViewModel by activityViewModels() private val signupNicknameViewModel: SignupNicknameViewModel by activityViewModels() private lateinit var tutorialStorage: TutorialStorage - private val authService: AuthService = NetworkModule.getClient().create(AuthService::class.java) - private lateinit var tokenStorage: TokenStorage - private val tokenManager = TokenManager(authService, tokenStorage) - - private val loginViewModel: LoginViewModel by activityViewModels { - AuthViewModelFactory( - authService, - tokenStorage, - tokenManager - ) + + private val loginViewModel: LoginViewModel by activityViewModels{ + val tokenStorage = TokenStorage(requireContext()) + val authService = NetworkModule.getClient().create(AuthService::class.java) + val tokenManager = TokenManager(authService, tokenStorage) + + AuthViewModelFactory(authService, tokenStorage, tokenManager) } override fun onCreateView( @@ -46,12 +46,12 @@ class SignupStatusFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { - _binding = FragmentSignupstatusBinding.inflate(inflater, container, false) + binding.viewModel = signUpStatusViewModel binding.lifecycleOwner = this - tokenStorage = TokenStorage(requireContext()) + tutorialStorage = TutorialStorage(requireContext()) return binding.root } diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SplashFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SplashFragment.kt index 9fc1b987..978ca308 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SplashFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SplashFragment.kt @@ -17,6 +17,7 @@ import com.toyou.toyouandroid.databinding.FragmentSplashBinding import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.data.onboarding.service.AuthService +import com.toyou.toyouandroid.presentation.viewmodel.AuthViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel import com.toyou.toyouandroid.presentation.viewmodel.UserViewModelFactory import com.toyou.toyouandroid.utils.TokenManager @@ -26,14 +27,13 @@ class SplashFragment : Fragment() { private lateinit var navController: NavController private var _binding: FragmentSplashBinding? = null + private val binding: FragmentSplashBinding + get() = requireNotNull(_binding){"FragmentSplashBinding -> null"} + private lateinit var database: UserDatabase private lateinit var loginViewModel: LoginViewModel private lateinit var userViewModel: UserViewModel - - private val binding: FragmentSplashBinding - get() = requireNotNull(_binding){"FragmentSplashBinding -> null"} - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -45,10 +45,16 @@ class SplashFragment : Fragment() { val tokenStorage = TokenStorage(requireContext()) val authService = NetworkModule.getClient().create(AuthService::class.java) val tokenManager = TokenManager(authService, tokenStorage) + loginViewModel = ViewModelProvider( this, - AuthViewModelFactory(authService, tokenStorage, tokenManager) + AuthViewModelFactory( + authService, + tokenStorage, + tokenManager + ) )[LoginViewModel::class.java] + userViewModel = ViewModelProvider( requireActivity(), UserViewModelFactory(tokenStorage) diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/CalendarFriendRecordFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/CalendarFriendRecordFragment.kt index 28285eb6..a359a6d5 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/CalendarFriendRecordFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/CalendarFriendRecordFragment.kt @@ -21,7 +21,7 @@ import com.toyou.toyouandroid.domain.record.RecordRepository import com.toyou.toyouandroid.data.record.service.RecordService import com.toyou.toyouandroid.model.calendar.FriendDate import com.toyou.toyouandroid.network.NetworkModule -import com.toyou.toyouandroid.presentation.fragment.record.RecordViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.RecordViewModelFactory import com.toyou.toyouandroid.utils.TokenManager import com.toyou.toyouandroid.utils.TokenStorage import com.toyou.toyouandroid.utils.calendar.FriendDates @@ -38,8 +38,6 @@ class CalendarFriendRecordFragment : Fragment(), OnFriendDateClickListener { private val binding: FragmentCalendarFriendrecordBinding get() = requireNotNull(_binding){"FragmentCalendarFriendrecordBinding -> null"} - private lateinit var friendRecordViewModel: FriendRecordViewModel - private var calendar = Calendar.getInstance() private val startCalendar: Calendar = Calendar.getInstance().apply { time = Date() @@ -51,6 +49,8 @@ class CalendarFriendRecordFragment : Fragment(), OnFriendDateClickListener { private var currentYear: Int = -1 private var currentMonth: Int = -1 + private lateinit var friendRecordViewModel: FriendRecordViewModel + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardContainerFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardContainerFragment.kt index a0116140..474d5796 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardContainerFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardContainerFragment.kt @@ -17,7 +17,7 @@ import com.toyou.toyouandroid.domain.record.RecordRepository import com.toyou.toyouandroid.network.AuthNetworkModule import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.presentation.base.MainActivity -import com.toyou.toyouandroid.presentation.fragment.record.RecordViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.RecordViewModelFactory import com.toyou.toyouandroid.utils.TokenManager import com.toyou.toyouandroid.utils.TokenStorage import timber.log.Timber diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardDetailFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardDetailFragment.kt index d81725ac..656c3b4a 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardDetailFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardDetailFragment.kt @@ -16,7 +16,7 @@ import com.toyou.toyouandroid.databinding.CardLayoutRecordBinding import com.toyou.toyouandroid.domain.record.RecordRepository import com.toyou.toyouandroid.network.AuthNetworkModule import com.toyou.toyouandroid.network.NetworkModule -import com.toyou.toyouandroid.presentation.fragment.record.RecordViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.RecordViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel import com.toyou.toyouandroid.presentation.viewmodel.UserViewModelFactory import com.toyou.toyouandroid.ui.home.adapter.CardPreviewListAdapter diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/CalendarMyRecordFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/CalendarMyRecordFragment.kt index 68f7754f..bb826855 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/CalendarMyRecordFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/CalendarMyRecordFragment.kt @@ -19,7 +19,7 @@ import com.toyou.toyouandroid.domain.record.RecordRepository import com.toyou.toyouandroid.data.record.service.RecordService import com.toyou.toyouandroid.model.calendar.MyDate import com.toyou.toyouandroid.network.NetworkModule -import com.toyou.toyouandroid.presentation.fragment.record.RecordViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.RecordViewModelFactory import com.toyou.toyouandroid.utils.TokenManager import com.toyou.toyouandroid.utils.TokenStorage import com.toyou.toyouandroid.utils.calendar.MyDates diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardContainerFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardContainerFragment.kt index 4ab5a4b3..62a67cb4 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardContainerFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardContainerFragment.kt @@ -22,7 +22,7 @@ import com.toyou.toyouandroid.network.NetworkModule import com.toyou.toyouandroid.presentation.base.MainActivity import com.toyou.toyouandroid.presentation.fragment.record.CalendarDialog import com.toyou.toyouandroid.presentation.fragment.record.CalendarDialogViewModel -import com.toyou.toyouandroid.presentation.fragment.record.RecordViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.RecordViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel import com.toyou.toyouandroid.presentation.viewmodel.UserViewModelFactory import com.toyou.toyouandroid.utils.TokenManager diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardDetailFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardDetailFragment.kt index e2a8dedf..7ed41b3f 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardDetailFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardDetailFragment.kt @@ -17,7 +17,7 @@ import com.toyou.toyouandroid.databinding.CardLayoutRecordBinding import com.toyou.toyouandroid.domain.record.RecordRepository import com.toyou.toyouandroid.network.AuthNetworkModule import com.toyou.toyouandroid.network.NetworkModule -import com.toyou.toyouandroid.presentation.fragment.record.RecordViewModelFactory +import com.toyou.toyouandroid.presentation.viewmodel.RecordViewModelFactory import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel import com.toyou.toyouandroid.presentation.viewmodel.UserViewModelFactory import com.toyou.toyouandroid.ui.home.adapter.CardPreviewListAdapter diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/SocialFragment.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/SocialFragment.kt index 0b0ff622..669b21ef 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/SocialFragment.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/SocialFragment.kt @@ -13,14 +13,12 @@ import android.widget.TextView import android.widget.Toast import androidx.core.os.bundleOf import androidx.fragment.app.Fragment -import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import androidx.navigation.NavController import androidx.navigation.Navigation import androidx.recyclerview.widget.LinearLayoutManager import com.toyou.toyouandroid.R import com.toyou.toyouandroid.databinding.FragmentSocialBinding -import com.toyou.toyouandroid.presentation.fragment.home.RVMarginItemDecoration import com.toyou.toyouandroid.presentation.viewmodel.SocialViewModel import com.toyou.toyouandroid.presentation.fragment.social.adapter.SocialRVAdapter import com.toyou.toyouandroid.presentation.viewmodel.SocialViewModelFactory @@ -54,15 +52,13 @@ class SocialFragment : Fragment() { )[UserViewModel::class.java] socialViewModel.getFriendsData() - - } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View? { + ): View { _binding = FragmentSocialBinding.inflate(inflater, container, false) addFriendLinearLayout = binding.addFriendLinear @@ -89,10 +85,10 @@ class SocialFragment : Fragment() { // addItemDecoration(RVMarginItemDecoration(margin,false)) } - socialViewModel.friends.observe(viewLifecycleOwner, Observer { friends -> + socialViewModel.friends.observe(viewLifecycleOwner) { friends -> socialAdapter.setFriendData(friends) socialAdapter.notifyDataSetChanged() - }) + } binding.searchBtn.setOnClickListener { @@ -103,7 +99,7 @@ class SocialFragment : Fragment() { socialViewModel.getSearchData(searchName) } - socialViewModel.isFriend.observe(viewLifecycleOwner, Observer { isFriend -> + socialViewModel.isFriend.observe(viewLifecycleOwner) { isFriend -> if (isFriend == "400" || isFriend == "401") { addNotExist(isFriend) }else if (isFriend == "no"){ @@ -113,33 +109,33 @@ class SocialFragment : Fragment() { else { addFriendView(isFriend, binding.searchEt.text.toString()) } - }) + } - socialViewModel.friendRequestCompleted.observe(viewLifecycleOwner, Observer { isCompleted -> + socialViewModel.friendRequestCompleted.observe(viewLifecycleOwner) { isCompleted -> if (isCompleted) { // 친구 요청이 완료되었을 때 addFriendView 제거 if (addFriendLinearLayout.childCount > 0) { addFriendLinearLayout.removeViewAt(addFriendLinearLayout.childCount - 1) } socialViewModel.resetFriendRequest() - Toast.makeText(requireContext(), "친구 요청을 보냈습니다.", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), "친구 요청을 보냈습니다", Toast.LENGTH_SHORT).show() } - }) + } - socialViewModel.friendRequestCanceled.observe(viewLifecycleOwner, Observer { isCanceled -> + socialViewModel.friendRequestCanceled.observe(viewLifecycleOwner) { isCanceled -> if (isCanceled) { // 친구 요청이 완료되었을 때 addFriendView 제거 if (addFriendLinearLayout.childCount > 0) { addFriendLinearLayout.removeViewAt(addFriendLinearLayout.childCount - 1) } socialViewModel.resetFriendRequestCanceled() - Toast.makeText(requireContext(), "친구 요청을 수락했습니다.", Toast.LENGTH_SHORT).show() + Toast.makeText(requireContext(), "친구 요청을 수락했습니다", Toast.LENGTH_SHORT).show() } - }) + } - socialViewModel.friendRequestRemove.observe(viewLifecycleOwner, Observer { isCanceled -> + socialViewModel.friendRequestRemove.observe(viewLifecycleOwner) { isCanceled -> if (isCanceled) { // 친구 요청이 완료되었을 때 addFriendView 제거 if (addFriendLinearLayout.childCount > 0) { @@ -148,7 +144,7 @@ class SocialFragment : Fragment() { } socialViewModel.resetFriendRequestRemove() } - }) + } val dialog = CustomDialogFragment() val btn = arrayOf("취소", "확인") @@ -214,18 +210,18 @@ class SocialFragment : Fragment() { stateBtn.apply { when(isFriend) { "REQUEST_SENT" -> { - stateBtn.setText("취소하기") + stateBtn.text = "취소하기" stateBtn.setBackgroundResource(R.drawable.r10_red_container) } "REQUEST_RECEIVED" -> { - stateBtn.setText("친구 수락") + stateBtn.text = "친구 수락" stateBtn.setBackgroundResource(R.drawable.r10_red_container) } "FRIEND" -> { - stateBtn.setText("친구") + stateBtn.text = "친구" } "NOT_FRIEND" -> { - stateBtn.setText("친구 요청") + stateBtn.text = "친구 요청" } } } diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/AuthViewModelFactory.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/AuthViewModelFactory.kt similarity index 57% rename from app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/AuthViewModelFactory.kt rename to app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/AuthViewModelFactory.kt index eeef1030..401d67d5 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/AuthViewModelFactory.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/AuthViewModelFactory.kt @@ -1,13 +1,10 @@ -package com.toyou.toyouandroid.presentation.fragment.onboarding +package com.toyou.toyouandroid.presentation.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import com.toyou.toyouandroid.data.onboarding.service.AuthService -import com.toyou.toyouandroid.presentation.fragment.emotionstamp.HomeOptionViewModel -import com.toyou.toyouandroid.presentation.fragment.home.HomeViewModel import com.toyou.toyouandroid.presentation.fragment.mypage.MypageViewModel -import com.toyou.toyouandroid.presentation.fragment.mypage.ProfileViewModel -import com.toyou.toyouandroid.presentation.viewmodel.UserViewModel +import com.toyou.toyouandroid.presentation.fragment.onboarding.LoginViewModel import com.toyou.toyouandroid.utils.TokenManager import com.toyou.toyouandroid.utils.TokenStorage @@ -23,15 +20,6 @@ class AuthViewModelFactory( } else if (modelClass.isAssignableFrom(UserViewModel::class.java)) { @Suppress("UNCHECKED_CAST") return UserViewModel(tokenStorage) as T - } else if (modelClass.isAssignableFrom(HomeOptionViewModel::class.java)) { - @Suppress("UNCHECKED_CAST") - return HomeOptionViewModel(tokenManager) as T - } else if (modelClass.isAssignableFrom(HomeViewModel::class.java)) { - @Suppress("UNCHECKED_CAST") - return HomeViewModel(tokenManager) as T - } else if (modelClass.isAssignableFrom(ProfileViewModel::class.java)) { - @Suppress("UNCHECKED_CAST") - return ProfileViewModel(tokenManager) as T } else if (modelClass.isAssignableFrom(MypageViewModel::class.java)) { @Suppress("UNCHECKED_CAST") return MypageViewModel(authService, tokenStorage, tokenManager) as T diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/HomeViewModelFactory.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/HomeViewModelFactory.kt new file mode 100644 index 00000000..4d7fcbc3 --- /dev/null +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/HomeViewModelFactory.kt @@ -0,0 +1,26 @@ +package com.toyou.toyouandroid.presentation.viewmodel + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import com.toyou.toyouandroid.presentation.fragment.emotionstamp.HomeOptionViewModel +import com.toyou.toyouandroid.presentation.fragment.home.HomeViewModel +import com.toyou.toyouandroid.presentation.fragment.mypage.ProfileViewModel +import com.toyou.toyouandroid.utils.TokenManager + +class HomeViewModelFactory( + private val tokenManager: TokenManager +) : ViewModelProvider.Factory { + override fun create(modelClass: Class): T { + if (modelClass.isAssignableFrom(HomeOptionViewModel::class.java)) { + @Suppress("UNCHECKED_CAST") + return HomeOptionViewModel(tokenManager) as T + } else if (modelClass.isAssignableFrom(HomeViewModel::class.java)) { + @Suppress("UNCHECKED_CAST") + return HomeViewModel(tokenManager) as T + } else if (modelClass.isAssignableFrom(ProfileViewModel::class.java)) { + @Suppress("UNCHECKED_CAST") + return ProfileViewModel(tokenManager) as T + } + throw IllegalArgumentException("Unknown ViewModel class") + } +} \ No newline at end of file diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeViewModelFactory.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/NoticeViewModelFactory.kt similarity index 83% rename from app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeViewModelFactory.kt rename to app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/NoticeViewModelFactory.kt index 9a4a5da6..7e8201b9 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeViewModelFactory.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/NoticeViewModelFactory.kt @@ -1,8 +1,9 @@ -package com.toyou.toyouandroid.presentation.fragment.notice +package com.toyou.toyouandroid.presentation.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import com.toyou.toyouandroid.domain.notice.NoticeRepository +import com.toyou.toyouandroid.presentation.fragment.notice.NoticeViewModel import com.toyou.toyouandroid.utils.TokenManager class NoticeViewModelFactory( diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/RecordViewModelFactory.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/RecordViewModelFactory.kt similarity index 93% rename from app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/RecordViewModelFactory.kt rename to app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/RecordViewModelFactory.kt index 8042df34..8eb84cc8 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/RecordViewModelFactory.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/RecordViewModelFactory.kt @@ -1,8 +1,9 @@ -package com.toyou.toyouandroid.presentation.fragment.record +package com.toyou.toyouandroid.presentation.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import com.toyou.toyouandroid.domain.record.RecordRepository +import com.toyou.toyouandroid.presentation.fragment.record.CardInfoViewModel import com.toyou.toyouandroid.presentation.fragment.record.friend.FriendCardViewModel import com.toyou.toyouandroid.presentation.fragment.record.friend.FriendRecordViewModel import com.toyou.toyouandroid.presentation.fragment.record.my.MyCardViewModel diff --git a/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/SocialViewModel.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/SocialViewModel.kt index 6a5797c8..b2609fc7 100644 --- a/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/SocialViewModel.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/SocialViewModel.kt @@ -317,32 +317,32 @@ class SocialViewModel(private val tokenStorage: TokenStorage) : ViewModel() { viewModelScope.launch { try { _friendRequest.value?.let { request -> - Timber.d("Sending friend approval request for: $name") - repository.patchApproveFriend(request) - Timber.d("Friend approval request sent successfully for: $name") - _approveSuccess.postValue(ApprovalResult(true, alarmId, position)) // 성공 시 LiveData 업데이트 - } ?: run { - Timber.e("Friend request is null") - _approveSuccess.postValue(ApprovalResult(false, alarmId, position)) - } + val isApproved = repository.patchApproveFriend(request) - _friendRequestCanceled.postValue(true) - Timber.d("Friend request canceled state updated") + if (isApproved) { + _approveSuccess.postValue(ApprovalResult(true, alarmId, position)) + } else { + _approveSuccess.postValue(ApprovalResult(false, alarmId, position)) + } - retrieveTokenFromServer(name) - _retrieveToken.value?.let { tokens -> - Timber.d("Retrieved tokens: $tokens") - for (token in tokens) { - postFCM(myName, token, 2) - Timber.d("FCM sent to token: $token") + retrieveTokenFromServer(name) + _retrieveToken.value?.let { tokens -> + Timber.d("Retrieved tokens: $tokens") + for (token in tokens) { + postFCM(myName, token, 2) + Timber.d("FCM sent to token: $token") + } + } ?: run { + Timber.e("Token retrieval failed") } } ?: run { - Timber.e("Token retrieval failed") + Timber.e("Friend request is null") + _approveSuccess.postValue(ApprovalResult(false, alarmId, position)) } } catch (e: Exception) { Timber.e("Exception occurred: ${e.message}") - _approveSuccess.postValue(ApprovalResult(false, alarmId, position)) // 실패 시 LiveData 업데이트 + _approveSuccess.postValue(ApprovalResult(false, alarmId, position)) } } } @@ -352,27 +352,20 @@ class SocialViewModel(private val tokenStorage: TokenStorage) : ViewModel() { viewModelScope.launch { try { _friendRequest.value?.let { request -> - Log.d("patchApprove", "Sending friend approval request for: $name") repository.patchApproveFriend(request) - Log.d("patchApprove", "Friend approval request sent successfully for: $name") } ?: run { - Log.e("patchApprove", "Friend request is null") } _friendRequestCanceled.postValue(true) - Log.d("patchApprove", "Friend request canceled state updated") retrieveTokenFromServer(name) _retrieveToken.value?.let { tokens -> - Log.d("patchApprove", "Retrieved tokens: $tokens") for (token in tokens) { postFCM(myName, token, 2) - Log.d("patchApprove", "FCM sent to token: $token") } } ?: run { - Log.e("patchApprove", "Token retrieval failed") } } catch (e: Exception) { - Log.e("patchApprove", "Exception occurred: ${e.message}") + Timber.e("Exception occurred: ${e.message}") } } } diff --git a/app/src/main/java/com/toyou/toyouandroid/utils/ViewModelManager.kt b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/ViewModelManager.kt similarity index 88% rename from app/src/main/java/com/toyou/toyouandroid/utils/ViewModelManager.kt rename to app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/ViewModelManager.kt index eeba9d5c..b4dcc046 100644 --- a/app/src/main/java/com/toyou/toyouandroid/utils/ViewModelManager.kt +++ b/app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/ViewModelManager.kt @@ -1,4 +1,4 @@ -package com.toyou.toyouandroid.utils +package com.toyou.toyouandroid.presentation.viewmodel import com.toyou.toyouandroid.presentation.fragment.onboarding.SignupNicknameViewModel import com.toyou.toyouandroid.presentation.fragment.home.HomeViewModel diff --git a/app/src/main/java/com/toyou/toyouandroid/utils/TokenManager.kt b/app/src/main/java/com/toyou/toyouandroid/utils/TokenManager.kt index 71f20e25..57c7079a 100644 --- a/app/src/main/java/com/toyou/toyouandroid/utils/TokenManager.kt +++ b/app/src/main/java/com/toyou/toyouandroid/utils/TokenManager.kt @@ -10,12 +10,6 @@ import timber.log.Timber class TokenManager(private val authService: AuthService, private val tokenStorage: TokenStorage) { - private var accessToken: String? = null - - fun setAccessToken(token: String) { - accessToken = token - } - fun refreshToken(onSuccess: (String) -> Unit, onFailure: () -> Unit) { authService.reissue(tokenStorage.getRefreshToken().toString()).enqueue(object : Callback { diff --git a/app/src/main/res/drawable/background_calendar.xml b/app/src/main/res/drawable/background_calendar.xml new file mode 100644 index 00000000..5e26e6fa --- /dev/null +++ b/app/src/main/res/drawable/background_calendar.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/checkbox_checked.xml b/app/src/main/res/drawable/checkbox_checked.xml index 2cb8974a..bc3f7403 100644 --- a/app/src/main/res/drawable/checkbox_checked.xml +++ b/app/src/main/res/drawable/checkbox_checked.xml @@ -1,9 +1,9 @@ - - + android:width="28dp" + android:height="28dp" + android:viewportWidth="28" + android:viewportHeight="28"> + diff --git a/app/src/main/res/drawable/checkbox_uncheck.xml b/app/src/main/res/drawable/checkbox_uncheck.xml index 94cf39d4..6ef698f9 100644 --- a/app/src/main/res/drawable/checkbox_uncheck.xml +++ b/app/src/main/res/drawable/checkbox_uncheck.xml @@ -1,9 +1,9 @@ + android:width="28dp" + android:height="28dp" + android:viewportWidth="28" + android:viewportHeight="28"> diff --git a/app/src/main/res/drawable/signupnickname_input.xml b/app/src/main/res/drawable/signupnickname_input.xml index 7fd1bd8d..f7d82278 100644 --- a/app/src/main/res/drawable/signupnickname_input.xml +++ b/app/src/main/res/drawable/signupnickname_input.xml @@ -1,9 +1,7 @@ - - \ No newline at end of file diff --git a/app/src/main/res/drawable/tutorial_step_1.png b/app/src/main/res/drawable/tutorial_step_1.png index c7f9e310..78f8d9d4 100644 Binary files a/app/src/main/res/drawable/tutorial_step_1.png and b/app/src/main/res/drawable/tutorial_step_1.png differ diff --git a/app/src/main/res/drawable/tutorial_step_5.png b/app/src/main/res/drawable/tutorial_step_5.png index dd69075d..f350d1d4 100644 Binary files a/app/src/main/res/drawable/tutorial_step_5.png and b/app/src/main/res/drawable/tutorial_step_5.png differ diff --git a/app/src/main/res/layout/fragment_calendar_friendrecord.xml b/app/src/main/res/layout/fragment_calendar_friendrecord.xml index e973e711..da217aa9 100644 --- a/app/src/main/res/layout/fragment_calendar_friendrecord.xml +++ b/app/src/main/res/layout/fragment_calendar_friendrecord.xml @@ -17,7 +17,7 @@ android:layout_width="360dp" android:layout_height="wrap_content" android:padding="8dp" - android:background="@drawable/signupnickname_input" + android:background="@drawable/background_calendar" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -28,7 +28,10 @@ android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" - android:padding="16dp" + android:paddingStart="30dp" + android:paddingEnd="30dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" android:visibility="visible" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -116,6 +119,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" + android:layout_marginStart="20dp" android:text="@string/calendar_my_record_date" android:textColor="@color/black" app:layout_constraintStart_toStartOf="@+id/login_container" diff --git a/app/src/main/res/layout/fragment_calendar_myrecord.xml b/app/src/main/res/layout/fragment_calendar_myrecord.xml index 99037316..d8cfe3d7 100644 --- a/app/src/main/res/layout/fragment_calendar_myrecord.xml +++ b/app/src/main/res/layout/fragment_calendar_myrecord.xml @@ -16,8 +16,7 @@ android:id="@+id/login_container" android:layout_width="360dp" android:layout_height="wrap_content" - android:padding="8dp" - android:background="@drawable/signupnickname_input" + android:background="@drawable/background_calendar" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -28,8 +27,11 @@ android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" - android:padding="16dp" android:visibility="visible" + android:paddingStart="30dp" + android:paddingEnd="30dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"> diff --git a/app/src/main/res/layout/fragment_record.xml b/app/src/main/res/layout/fragment_record.xml index 4257e021..35b84070 100644 --- a/app/src/main/res/layout/fragment_record.xml +++ b/app/src/main/res/layout/fragment_record.xml @@ -39,6 +39,20 @@ + + + + diff --git a/app/src/main/res/layout/fragment_signupagree.xml b/app/src/main/res/layout/fragment_signupagree.xml index cdb329eb..ec103eeb 100644 --- a/app/src/main/res/layout/fragment_signupagree.xml +++ b/app/src/main/res/layout/fragment_signupagree.xml @@ -121,8 +121,8 @@ @@ -328,7 +328,8 @@ android:text="@string/next_button" android:textColor="@{viewModel.nextButtonTextColor}" style="@style/sc_m13" - app:layout_constraintStart_toStartOf="@id/guideline_next_v" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@id/guideline_next_h" /> diff --git a/app/src/main/res/layout/fragment_signupnickname.xml b/app/src/main/res/layout/fragment_signupnickname.xml index ac5393be..923d09ab 100644 --- a/app/src/main/res/layout/fragment_signupnickname.xml +++ b/app/src/main/res/layout/fragment_signupnickname.xml @@ -160,7 +160,8 @@ android:textColor="@{viewModel.nextButtonTextColor}" style="@style/sc_m13" android:enabled="@{viewModel.isNextButtonEnabled}" - app:layout_constraintStart_toStartOf="@id/guideline_next_v" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@id/guideline_next_h" /> diff --git a/app/src/main/res/layout/fragment_signupstatus.xml b/app/src/main/res/layout/fragment_signupstatus.xml index 20090a30..8a0b505a 100644 --- a/app/src/main/res/layout/fragment_signupstatus.xml +++ b/app/src/main/res/layout/fragment_signupstatus.xml @@ -172,7 +172,8 @@ android:textColor="@{viewModel.nextButtonTextColor}" style="@style/sc_m13" android:enabled="@{viewModel.isNextButtonEnabled()}" - app:layout_constraintStart_toStartOf="@id/guideline_next_v" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@id/guideline_next_h" />