Skip to content

Commit

Permalink
Merge pull request #254 from tukcomCD2024/android_al
Browse files Browse the repository at this point in the history
Android
  • Loading branch information
Chan3711 authored Jun 20, 2024
2 parents 2c93f6d + b89c642 commit 46b7e27
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ class HomeFragment : Fragment() {
val settingLayoutView = popupView.findViewById<RelativeLayout>(R.id.logoutLayout)
settingLayoutView.setOnClickListener {
auth.signOut()
SharedPreferencesUtil.saveLoggedInStatus(requireContext(), false)
val loginIntent = Intent(requireContext(), LoginActivity::class.java)
startActivity(loginIntent)
requireActivity().finish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
// 알림 클릭 시 실행할 액티비티 설정
val intent = Intent(this, QuizActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_UPDATE_CURRENT)
intent.putExtra("fromNotification", true)
val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE)

// 알림 생성
val notificationBuilder = NotificationCompat.Builder(this, "default")
Expand Down
19 changes: 13 additions & 6 deletions android/app/src/main/java/com/example/sharenote/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.appcompat.app.AppCompatActivity

class SplashActivity : AppCompatActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash)
Expand All @@ -17,11 +16,19 @@ class SplashActivity : AppCompatActivity() {
supportActionBar?.hide()

val handler = Handler(Looper.getMainLooper())
handler.postDelayed(Runnable {
Intent(this, LoginActivity::class.java).apply {
startActivity(this)
finish()
handler.postDelayed({
val targetActivity = if (intent.getBooleanExtra("fromNotification", false)) {
QuizActivity::class.java
} else {
if (SharedPreferencesUtil.isLoggedIn(this)) {
MainActivity::class.java
} else {
LoginActivity::class.java
}
}
val nextIntent = Intent(this, targetActivity)
startActivity(nextIntent)
finish()
}, 3000) // 3초 후(3000) 스플래시 화면을 닫습니다
}
}
}

0 comments on commit 46b7e27

Please sign in to comment.