Skip to content

Commit

Permalink
[FEAT] lgtm navigator를 활용한 미션 생성 가이드 노션 링크 연동 (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
KxxHyoRim committed Feb 2, 2024
1 parent c96a19d commit 03f47eb
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 52 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/com/lgtm/android/di/NavigatorModule.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.lgtm.android.di

import com.lgtm.android.common_ui.navigator.FakeLgtmNavigator
import com.lgtm.android.navigator.LgtmNavigator
import com.lgtm.android.common_ui.navigator.LgtmNavigator
import com.lgtm.android.navigator.LgtmNavigatorImpl
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand All @@ -13,7 +13,7 @@ import dagger.hilt.components.SingletonComponent
interface NavigatorModule {
@Binds
fun bindsLgtmNavigator(
lgtmNavigator: LgtmNavigator
): FakeLgtmNavigator
lgtmNavigatorImpl: LgtmNavigatorImpl,
): LgtmNavigator

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package com.lgtm.android.navigator

import android.content.Context
import android.content.Intent
import android.net.Uri
import com.lgtm.android.auth.ui.SignInActivity
import com.lgtm.android.common_ui.navigator.FakeLgtmNavigator
import com.lgtm.android.common_ui.navigator.LgtmNavigator
import com.lgtm.android.create_mission.CreateMissionActivity
import com.lgtm.android.main.MainActivity
import com.lgtm.android.main.notification.NotificationCenterActivity
Expand All @@ -14,8 +15,8 @@ import com.lgtm.android.mission_recommendation.ui.SuggestionDashboardActivity
import com.lgtm.android.profile.ProfileActivity
import javax.inject.Inject

class LgtmNavigator @Inject constructor(
) : FakeLgtmNavigator {
class LgtmNavigatorImpl @Inject constructor(
) : LgtmNavigator {
override fun navigateToSignIn(context: Context) {
val intent = Intent(context, SignInActivity::class.java)
context.startActivity(intent)
Expand Down Expand Up @@ -68,4 +69,12 @@ class LgtmNavigator @Inject constructor(
val intent = Intent(context, SuggestionDashboardActivity::class.java)
context.startActivity(intent)
}

override fun openUrlInBrowser(context: Context, url: String) {
val intent = Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(url)
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
context.startActivity(intent)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.lgtm.android.common_ui.navigator.FakeLgtmNavigator
import com.lgtm.android.common_ui.navigator.LgtmInjector
import com.lgtm.android.common_ui.navigator.LgtmNavigator
import dagger.hilt.android.EntryPointAccessors

abstract class BaseActivity<T : ViewDataBinding>(
Expand All @@ -16,7 +16,7 @@ abstract class BaseActivity<T : ViewDataBinding>(
protected lateinit var binding: T
var viewModel: BaseViewModel? = null

val lgtmNavigator: FakeLgtmNavigator by lazy {
val lgtmNavigator: LgtmNavigator by lazy {
EntryPointAccessors.fromActivity(
this, LgtmInjector.LgtmNavigatorInjector::class.java
).lgtmNavigator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import com.lgtm.android.common_ui.navigator.FakeLgtmNavigator
import com.lgtm.android.common_ui.navigator.LgtmInjector
import com.lgtm.android.common_ui.navigator.LgtmNavigator
import com.lgtm.android.common_ui.util.KeyboardUtil
import dagger.hilt.android.EntryPointAccessors

Expand All @@ -25,7 +25,7 @@ abstract class BaseFragment<T : ViewDataBinding>(

lateinit var viewModel: BaseViewModel

val lgtmNavigator: FakeLgtmNavigator by lazy {
val lgtmNavigator: LgtmNavigator by lazy {
EntryPointAccessors.fromActivity(
requireActivity(), LgtmInjector.LgtmNavigatorInjector::class.java
).lgtmNavigator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ sealed interface LgtmInjector {
@EntryPoint
@InstallIn(ActivityComponent::class)
interface LgtmNavigatorInjector {
fun lgtmNavigator(): FakeLgtmNavigator
fun lgtmNavigator(): LgtmNavigator
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.lgtm.android.common_ui.navigator

import android.content.Context

interface FakeLgtmNavigator {
interface LgtmNavigator {
fun navigateToSignIn(context: Context)

fun navigateToMain(context: Context)
Expand All @@ -20,4 +20,6 @@ interface FakeLgtmNavigator {
fun navigateToNotificationCenter(context: Context)

fun navigateToRecommendationDashboard(context: Context)
}

fun openUrlInBrowser(context: Context, url: String)
}
2 changes: 1 addition & 1 deletion common-ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<string name="github_url_only">전체공개된 github URL만 입력할 수 있습니다.</string>
<string name="see_create_mission_guide">미션 생성 가이드 보기</string>
<string name="which_stack_to_use">어떤 스택을 사용하시나요?</string>
<string name="choose_over_one">한 개 이상 선택하세요.</string>
<string name="choose_tech_stack_description">미션에서 사용되는 기술 스택을 선택하세요.\n자유로운 코드 리뷰 시 본인이 리뷰 가능한 기술 스택을 선택하세요.</string>
<string name="what_kind_of_mission">어떤 미션인가요?</string>
<string name="mission_description_example">ex) 미션 소개, 구현 요구 사항, 배울 수 있는 것</string>
<string name="recommend_group">이런 사람에게 추천해요.</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.lgtm.android.auth.ui.signup.common

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import androidx.fragment.app.activityViewModels
Expand Down Expand Up @@ -48,11 +46,11 @@ class TermsFragment : BaseFragment<FragmentTermsBinding>(R.layout.fragment_terms
private fun setUpTextViewListener() {
binding.tvTermsService.setOnThrottleClickListener {
shotTermsServiceClickLogging()
openUrlInBrowser(TERMS_SERVICE_URL)
lgtmNavigator.openUrlInBrowser(requireContext(), TERMS_SERVICE_URL)
}
binding.tvTermsPrivacy.setOnThrottleClickListener {
shotTermsPrivacyClickLogging()
openUrlInBrowser(TERMS_PRIVACY_URL)
lgtmNavigator.openUrlInBrowser(requireContext(), TERMS_PRIVACY_URL)
}
}

Expand All @@ -72,14 +70,6 @@ class TermsFragment : BaseFragment<FragmentTermsBinding>(R.layout.fragment_terms
signUpViewModel.shotSwmLogging(scheme)
}

private fun openUrlInBrowser(url: String) {
val intent = Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(url)
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
startActivity(intent)
}

private fun setupViewModel() {
binding.viewModel = signUpViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ class CreateMissionStep1Fragment :
onMissionTitleChanged()
onMissionRepoUrlChanged()
setupNextButtonClickListener()
setupMissionGuideClickListener()
}


private fun setupViewModel() {
binding.viewModel = createMissionViewModel
}
Expand Down Expand Up @@ -63,4 +65,19 @@ class CreateMissionStep1Fragment :
(requireActivity() as? CreateMissionActivity)?.setNextPage()
}
}

private fun setupMissionGuideClickListener() {
binding.clCreateMissionGuide.setOnThrottleClickListener {
openCreateMissionGuideNotion()
}
}

private fun openCreateMissionGuideNotion() {
lgtmNavigator.openUrlInBrowser(requireContext(), CREATE_MISSION_GUIDE_NOTION_URL)
}

companion object {
const val CREATE_MISSION_GUIDE_NOTION_URL =
"https://waiting-keyboard-1b3.notion.site/LGTM-Mission-ec7bc4313a7142a1acab3c9cb5fc3d65?pvs=4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
app:layout_constraintTop_toBottomOf="@id/tv_mission_repo_url_description" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_create_mission_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/choose_over_one"
android:text="@string/choose_tech_stack_description"
android:textAppearance="@style/Body2"
android:textColor="@color/gray_6"
app:layout_constraintStart_toStartOf="@id/tv_stack_to_use"
app:layout_constraintTop_toBottomOf="@id/tv_stack_to_use" />


<com.google.android.material.chip.ChipGroup
android:id="@+id/chip_tech_tag"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.lgtm.android.main.home

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import androidx.fragment.app.viewModels
Expand Down Expand Up @@ -142,16 +140,8 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(R.layout.fragment_home) {
Role.REVIEWER -> "https://www.notion.so/team-hkcc/c1933575315e4b50aedbdd6b39069d3e?pvs=4"
Role.REVIEWEE -> "https://www.notion.so/team-hkcc/5abf8b03763a4f0d90cb2d463f6d46b4?pvs=4"
}
openUrlInBrowser(url)
lgtmNavigator.openUrlInBrowser(requireContext(), url)
}
}

private fun openUrlInBrowser(url: String) {
val intent = Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(url)
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
startActivity(intent)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_
binding.btnNotice.setOnThrottleClickListener {
val url =
"https://team-hkcc.notion.site/4823db3b781e40fdadd0cf61093c5158?v=3cee323345414e318192b89bfe7dd2d0&pvs=4"
openUrlInBrowser(url)
lgtmNavigator.openUrlInBrowser(requireContext(), url)
}
}

private fun setTermsAndPoliciesOnClickListener() {
// 약관 및 정책
binding.btnTermsAndPolicies.setOnThrottleClickListener {
val url = "https://team-hkcc.notion.site/c4f56b4e6e1b46e89c494e5b3919ed8c?pvs=4"
openUrlInBrowser(url)
lgtmNavigator.openUrlInBrowser(requireContext(), url)
}
}

Expand All @@ -109,15 +109,15 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_
Role.REVIEWER -> "https://www.notion.so/team-hkcc/c1933575315e4b50aedbdd6b39069d3e?pvs=4"
Role.REVIEWEE -> "https://www.notion.so/team-hkcc/5abf8b03763a4f0d90cb2d463f6d46b4?pvs=4"
}
openUrlInBrowser(url)
lgtmNavigator.openUrlInBrowser(requireContext(), url)
}
}

private fun setPrivacyPolicy() {
// 개인정보 처리방침
binding.btnPrivacyPolicy.setOnThrottleClickListener {
val url = "https://team-hkcc.notion.site/31a6b7a98d1f4d148bb05cc826d0c9aa?pvs=4"
openUrlInBrowser(url)
lgtmNavigator.openUrlInBrowser(requireContext(), url)
}
}

Expand Down Expand Up @@ -149,17 +149,10 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>(R.layout.fragment_my_
private fun setVersionInfoOnClickListener() {
binding.btnVersionInfo.setOnThrottleClickListener {
val playStoreUrl = "https://play.google.com/store/apps/details?id=com.lgtm.android"
openUrlInBrowser(playStoreUrl)
lgtmNavigator.openUrlInBrowser(requireContext(), playStoreUrl)
}
}

private fun openUrlInBrowser(url: String) {
val intent = Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(url)
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
startActivity(intent)
}

private fun onPressCsCenter() {
// check whether sending email valid
Expand Down

0 comments on commit 03f47eb

Please sign in to comment.