Skip to content

Commit

Permalink
Merge pull request #97 from Team-Umbba/fix/#94
Browse files Browse the repository at this point in the history
[Fix/#94] 온보딩 화면 QA 반영
  • Loading branch information
yeoncheong authored Jul 20, 2023
2 parents 526583c + 368412c commit a650524
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class InviteCodeDialogFragment(private val inviteUserName: String, private val i
binding.btnSendInvitation.setOnClickListener {
val defaultFeed = FeedTemplate(
content = Content(
title = "${inviteUserName}으로부터 초대가 왔어요. \\n초대 코드 : $inviteCode",
description = "과거로 떠나 함께 추억을 나누고, \\n공감대를 형성해보세요.",
title = "${inviteUserName}으로부터 초대가 왔어요.\n초대 코드 : $inviteCode",
description = "과거로 떠나 함께 추억을 나누고,\n공감대를 형성해보세요.",
imageUrl = "https://github.com/Team-Umbba/Umbba-iOS/assets/75068759/64ba7265-9148-4f06-8235-de5f4030e92f",
link = Link(
webUrl = "https://developers.kakao.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class InputInfoActivity : BindingActivity<ActivityInputInfoBinding>(R.layout.act
with(binding) {
btnNext.isEnabled =
layoutInputName.error.isNullOrEmpty() && layoutInputYear.error.isNullOrEmpty() && etYear.text.toString()
.isNotEmpty() && etName.text.toString().isNotEmpty()
.isNotEmpty() && etName.text.toString().isNotEmpty() && (chip1.isChecked || chip2.isChecked)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class NotifyTimeActivity :
BindingActivity<ActivityNotifyTimeBinding>(R.layout.activity_notify_time),
View.OnClickListener {

private val viewModel by viewModels<QuestViewModel>() { ViewModelFactory(this) }

private val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean ->
if (isGranted) {
// 알림권한 허용 o
Expand All @@ -40,6 +38,7 @@ class NotifyTimeActivity :
super.onCreate(savedInstanceState)
binding.clickListener = this

setTimeText()
askNotificationPermission()
goOnboardingFinishActivity()
}
Expand All @@ -50,6 +49,27 @@ class NotifyTimeActivity :
}
}

private fun setTimeText() {
val time = intent.getStringExtra("time").toString()
Log.e("yeonjin", "setTime : $time")
var hour = time.substring(0, 2).toInt()
val minute = time.substring(3, 5)
var hourText = ""
when (hour) {
1, 2, 3, 4, 5 -> hourText = "새벽"
6, 7, 8, 9, 10, 11 -> hourText = "아침"
12, 13, 14, 15, 16, 17 -> hourText = ""
18, 19, 20 -> hourText = "저녁"
21, 22, 23, 24 -> hourText = ""
}
if (hour >= 13) { hour %= 12 }
if (minute == "00") {
binding.tvTitle.text = "매일 ${hourText} ${hour}시에\n교신을 보내줄게"
} else {
binding.tvTitle.text = "매일 ${hourText} ${hour}시 반에\n교신을 보내줄게"
}
}

private fun askNotificationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class OnboardingFinishActivity :
}

private fun goBack() {
binding.btnBack1.setOnClickListener {
finish()
}
binding.btnBack2.setOnClickListener {
finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,21 @@ class SetTimeActivity : BindingActivity<ActivitySetTimeBinding>(R.layout.activit
}

private fun setTime() {
val timeFormat = "kk:mm"
val hour =
if (binding.tpTime.hour == 0) {
"24"
} else if (binding.tpTime.hour >= 1 || binding.tpTime.hour <= 9){
"0${binding.tpTime.hour}"
} else {
binding.tpTime.hour
}
val minute =
if (binding.tpTime.minute == 0) {
"00"
} else {
binding.tpTime.minute
"30"
}
time = "${binding.tpTime.hour}:$minute".format(timeFormat)
time = "$hour:$minute"
}

private fun setQuestList(questData: Array<String>?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ class QuestActivity : BindingActivity<ActivityQuestBinding>(R.layout.activity_qu
viewModel.setReceiveInfo(userData, questList)
viewModel.isPostSuccess.observe(this) {
if (it) {
startActivity(Intent(this, NotifyTimeActivity::class.java))
val time = viewModel.notifyTime.value
Log.e("yeonjin", "server 연결 : $time")
startActivity(Intent(this, NotifyTimeActivity::class.java).apply {
putExtra("time", time)
})
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class QuestViewModel(private val onboardingRepositoryImpl: OnboardingRepositoryI
)
).onSuccess {
Log.e("yeonjin", "setReceiveInfo 성공")
_isPostSuccess.value = true
Log.e("yeonjin", "setReceiveInfo time : ${it.data.pushTime}")
notifyTime.value = it.data.pushTime
_isPostSuccess.value = true
}.onFailure {
Log.e("yeonjin", "setReceiveInfo 실패")
_isPostSuccess.value = false
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_notify_time.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
android:layout_marginStart="28dp"
android:layout_marginTop="24dp"
android:text="@string/timemachine_description"
android:textColor="@color/umbba_black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/layout_appbar" />

Expand All @@ -40,8 +41,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="8dp"
android:text="@string/go_past_title"
android:textColor="@color/black"
android:textColor="@color/umbba_black"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timemachine_description" />

Expand Down

0 comments on commit a650524

Please sign in to comment.