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

[ISSUE-61] 약속 공유하기 UI 및 카카오톡 공유 기능을 구현합니다 #98

Merged
merged 13 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ android {
}
}

fun getProperty(propertyKey: String): String? {
return gradleLocalProperties(rootDir).getProperty(propertyKey)
}

dependencies {
implementation(project(Modules.PRESENTATION))
implementation(project(Modules.DOMAIN))
Expand Down
13 changes: 11 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@

<activity
android:name=".presentation.ui.createPlan.CreatePlanActivity"
android:exported="false"
android:theme="@style/Theme.Growth" />
android:exported="true"
android:theme="@style/Theme.Growth">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:host="kakaolink"
android:scheme="kakao${KAKAO_APP_KEY}" />
</intent-filter>
</activity>

</application>

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object Versions {
const val HILT = "2.42"
const val HILT_ANDROID = "1.0.0-beta01"
const val JUNIT = "4.13.2"
const val KAKAO_SDK = "2.10.0"
const val KAKAO_SDK = "2.11.0"
const val KOTLIN = "1.6.21"
const val KOTLIN_COROUTINES = "1.5.1"
const val KOTLIN_DATETIMES = "0.4.0"
Expand Down
11 changes: 8 additions & 3 deletions buildSrc/src/main/java/app/ModuleDependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,20 @@ object ModuleDependencies {
)

val materialCalendarView = arrayOf(
DependencyInfo("com.prolificinteractive:material-calendarview", Versions.MATERIAL_CALENDAR, Method.IMPLEMENTATION)
DependencyInfo("com.prolificinteractive:material-calendarview",
Versions.MATERIAL_CALENDAR,
Method.IMPLEMENTATION)
)

val kakaoSdk = arrayOf(
DependencyInfo("com.kakao.sdk:v2-user", Versions.KAKAO_SDK, Method.IMPLEMENTATION)
DependencyInfo("com.kakao.sdk:v2-user", Versions.KAKAO_SDK, Method.IMPLEMENTATION),
DependencyInfo("com.kakao.sdk:v2-share", Versions.KAKAO_SDK, Method.IMPLEMENTATION),
)

val accompanist = arrayOf(
DependencyInfo("com.google.accompanist:accompanist-pager", Versions.ACCOMPANIST_PAGER, Method.IMPLEMENTATION)
DependencyInfo("com.google.accompanist:accompanist-pager",
Versions.ACCOMPANIST_PAGER,
Method.IMPLEMENTATION)
)

val kotlinDateTime = arrayOf(
Expand Down
9 changes: 5 additions & 4 deletions data/src/main/java/com/yapp/growth/data/di/DataModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ internal class DataModule {
@Singleton
@Provides
fun provideGrowthApi(
retrofit: Retrofit
retrofit: Retrofit,
): GrowthApi =
retrofit.create(GrowthApi::class.java)

@Singleton @Provides
@Singleton
@Provides
fun provideJsonAdapterFactory(): Converter.Factory =
MoshiConverterFactory.create(
Moshi.Builder()
.add(KotlinJsonAdapterFactory())
.build())
.add(KotlinJsonAdapterFactory())
.build())
}
2 changes: 2 additions & 0 deletions presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
id(app.Plugins.GOOGLE_SERVICE)
id(app.Plugins.FIREBASE_CRASHLYTICS)
id(app.Plugins.HILT_ANDROID)
id(app.Plugins.SECRETS_GRADLE)
}

android {
Expand Down Expand Up @@ -46,6 +47,7 @@ dependencies {
app.ModuleDependencies.materialCalendarView.implement(this)
app.ModuleDependencies.accompanist.implement(this)
app.ModuleDependencies.kotlinDateTime.implement(this)
app.ModuleDependencies.kakaoSdk.implement(this) // Share 부분만 의존성 추가하는 것이 좋은가..?
Copy link
Member

Choose a reason for hiding this comment

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

good, better 차이의 느낌일 것 같은데
웬만하면 분리해서 의존성을 추가하는게 나을 것 같습니다

Copy link
Member Author

@jihee-dev jihee-dev Jul 18, 2022

Choose a reason for hiding this comment

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

좋아여 네이밍도 kakaoOauth, kakaoShare로 바꾸고 나눠서 의존성 추가해놓겠습니당

Copy link
Member

Choose a reason for hiding this comment

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

죠습니당


implementation(platform(app.ModuleDependencies.FIREBASE_BOM))
implementation(app.ModuleDependencies.FIREBASE_ANALYTICS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.yapp.growth.presentation.theme.MainPurple900
import com.yapp.growth.presentation.theme.PlanzTypography
import com.yapp.growth.presentation.theme.SubCoral

// TODO: PlanzSnackBar, PlanzErrorSnackBar 높이 통일
@Composable
fun PlanzSnackBar(
message: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ val PlanzTypography = Typography(
),
button = TextStyle(
fontFamily = Pretendard,
fontWeight = FontWeight.Medium,
fontWeight = FontWeight.SemiBold,
fontSize = 16.sp,
lineHeight = 24.sp
),
Expand All @@ -70,4 +70,4 @@ val PlanzTypography = Typography(
fontSize = 12.sp,
lineHeight = 18.sp
)
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ import dagger.hilt.android.AndroidEntryPoint
class CreatePlanActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)


setContent {
PlanzTheme {
CreatePlanScreen(
exitCreatePlan = { exitCreatePlan() }
exitCreatePlan = { exitCreatePlan() },
startShareActivity = { intent -> startActivity(intent) }
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.yapp.growth.presentation.ui.createPlan

import android.content.Intent
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.runtime.Composable
Expand All @@ -9,6 +10,7 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.yapp.growth.presentation.ui.createPlan.date.DateScreen
import com.yapp.growth.presentation.ui.createPlan.share.ShareScreen
import com.yapp.growth.presentation.ui.createPlan.theme.ThemeScreen
import com.yapp.growth.presentation.ui.createPlan.timerange.TimeRangeScreen
import com.yapp.growth.presentation.ui.createPlan.title.TitleScreen
Expand All @@ -19,6 +21,7 @@ import com.yapp.growth.presentation.ui.main.manage.respond.RespondPlanScreen
fun CreatePlanScreen(
navController: NavHostController = rememberNavController(),
exitCreatePlan: () -> Unit,
startShareActivity: (Intent) -> Unit,
) {
Scaffold { innerPadding ->
NavHost(
Expand Down Expand Up @@ -68,6 +71,13 @@ fun CreatePlanScreen(
navigateToPreviousScreen = { navController.popBackStack() }
)
}

composable(route = CreatePlanScreenRoute.SHARE.route) {
ShareScreen(
finishCreatePlan = exitCreatePlan,
startShareActivity = { shareIntent -> startShareActivity(shareIntent) }
)
}
}
}
}
Expand All @@ -79,4 +89,5 @@ enum class CreatePlanScreenRoute(val route: String) {
TIME_RANGE("time-range"),
RESPOND_PLAN("respond-plan"),
CONFIRM_PLAN("confirm-plan"),
SHARE("share-plan"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.yapp.growth.presentation.ui.createPlan.share

import com.yapp.growth.base.ViewEvent
import com.yapp.growth.base.ViewSideEffect
import com.yapp.growth.base.ViewState

class ShareContract {
data class ShareViewState(
val shareUrl: String = "planz/link/sample/125", // TODO: 공유 URL
val snackBarType: SnackBarType = SnackBarType.SUCCESS,
) : ViewState {
enum class SnackBarType {
SUCCESS,
FAIL
}
}

sealed class ShareSideEffect : ViewSideEffect {
object FinishCreatePlan : ShareSideEffect()
object CopyShareUrl : ShareSideEffect()
object ShowSuccessSnackBar : ShareSideEffect()
object ShowFailToShareSnackBar : ShareSideEffect()
object SendKakaoShareMessage : ShareSideEffect()
}

sealed class ShareEvent : ViewEvent {
object OnClickExit : ShareEvent()
object OnClickCopy : ShareEvent()
object OnClickShare : ShareEvent()
object FailToShare : ShareEvent()
}
}
Loading