Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mod] 오픈채팅방 유효성검사 #204

Merged
merged 8 commits into from
Mar 7, 2024
Merged
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
android:name=".presentation.ui.joingroup.JoinGroupCodeActivity"
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".presentation.ui.joingroup.JoinGroupSearchActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import org.sopt.pingle.presentation.ui.plan.plansummaryconfirmation.PlanSummaryC
import org.sopt.pingle.presentation.ui.plan.plantitle.PlanTitleFragment
import org.sopt.pingle.util.base.BindingActivity
import org.sopt.pingle.util.component.AllModalDialogFragment
import org.sopt.pingle.util.component.PingleSnackbar
import org.sopt.pingle.util.context.stringOf
import org.sopt.pingle.util.view.PingleFragmentStateAdapter
import org.sopt.pingle.util.view.UiState

Expand Down Expand Up @@ -86,6 +88,18 @@ class PlanActivity : BindingActivity<ActivityPlanBinding>(R.layout.activity_plan
planViewModel.postPlanMeeting()
}

PLAN_OPEN_CHATTING_FRAGMENT_INDEX -> {
if (planViewModel.validityOpenChattingLink()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 if~else문은 checkValidation 등으로 함수화해주면 코드가 더 깔끔해질 것 같아욤

binding.vpPlan.currentItem++
} else {
PingleSnackbar.makeSnackbar(
binding.root,
stringOf(R.string.plan_open_chatting_snackbar),
126
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상수화 해주삼요 ㅋ

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스낵바 로직들이 어떤 것에 대한 스낵바인지 바로바로 알아보기가 어려워서 이거 함수화하거나 공통적으로 알아볼 수 있게 고치면 좋을 거 같아용 나중에 !

)
}
}

else -> {
binding.vpPlan.currentItem++
}
Expand Down Expand Up @@ -175,5 +189,6 @@ class PlanActivity : BindingActivity<ActivityPlanBinding>(R.layout.activity_plan
const val FIRST_PAGE = 0
const val DEFAULT_PROGRESSBAR = 1f
const val SUB_LIST_SIZE = 1
const val PLAN_OPEN_CHATTING_FRAGMENT_INDEX = 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,15 @@ class PlanViewModel @Inject constructor(
}
}

fun validityOpenChattingLink() = planOpenChattingLink.value.startsWith(OPEN_CHATTING_LINK_VALIDITY)

companion object {
const val FIRST_PAGE_POSITION = 0
const val DEFAULT_OLD_POSITION = -1
const val DEFAULT_RECRUITMENT = "1"
const val START_RECRUITMENT = 2
const val END_RECRUITMENT = 99
const val BLANK_STRING = " "
const val OPEN_CHATTING_LINK_VALIDITY = "https://open.kakao.com/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 https:// 없이 open.kakao.com/으로만 시작해도 연결 잘 되지 않나염?,, 이 부분 먼가 고민이 필요할 것 같아요

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 결과..
https://open.kakao.com/o/o
https:open.kakao.com/o/o
open.kakao.com/o/o
/open.kakao.com/o/o
//open.kakao.com/o/o
전부 다 잘 들어가져요.. 쩝

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그러면 링크에 open.kakao.com이 포함되는지 여부로 유효성 검사 진행해줘도 될 것 같고요,, 어찌 됐든 모든 경우의 수를 다 막을 순 없을 것 같아서,, 아요 측에서 이 부분 맡으신 분이랑 어떤 식으로 진행할 건지 논의가 필요할 것 같네요

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 다른 파트와의 논의가 필요할 거 같습니당 ~

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open.kakao.com가 포함되는 방향으로 논의했고 ios 측 답변오면 맞춰서 작업할게요!~

}
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<string name="plan_open_chatting_title">오픈채팅방 링크를\n추가해주세요!</string>
<string name="plan_open_chatting_hint">링크를 입력해주세요</string>
<string name="plan_open_chatting_text_title">채팅방 링크</string>
<string name="plan_open_chatting_snackbar">유효하지 않은 오픈채팅방 링크입니다.</string>

<!-- plan summary confirmation -->
<string name="plan_summary_confirmation_title">핑글을 개최할\n준비 되었나요?</string>
Expand Down
Loading