Skip to content

Commit

Permalink
Merge pull request #98 from YAPP-Github/feature/issue-61-share-plan-ui
Browse files Browse the repository at this point in the history
[ISSUE-61] 약속 공유하기 UI 및 카카오톡 공유 기능을 구현합니다
  • Loading branch information
jihee-dev authored Jul 18, 2022
2 parents d5f9c0e + fefb802 commit b8a1e2d
Show file tree
Hide file tree
Showing 17 changed files with 492 additions and 60 deletions.
7 changes: 1 addition & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import common.GradleUtil.implement

plugins {
Expand Down Expand Up @@ -58,10 +57,6 @@ android {
}
}

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

dependencies {
implementation(project(Modules.PRESENTATION))
implementation(project(Modules.DOMAIN))
Expand All @@ -70,7 +65,7 @@ dependencies {
app.ModuleDependencies.hilt.implement(this)
app.ModuleDependencies.hiltAndroid.implement(this)
app.ModuleDependencies.timber.implement(this)
app.ModuleDependencies.kakaoSdk.implement(this)
app.ModuleDependencies.kakaoOAuth.implement(this)

implementation(platform(app.ModuleDependencies.FIREBASE_BOM))
implementation(app.ModuleDependencies.FIREBASE_ANALYTICS)
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
19 changes: 13 additions & 6 deletions buildSrc/src/main/java/app/ModuleDependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,26 @@ 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)
)
val kakaoOAuth =
arrayOf(DependencyInfo("com.kakao.sdk:v2-user", Versions.KAKAO_SDK, Method.IMPLEMENTATION))
val kakaoShare =
arrayOf(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(
DependencyInfo("org.jetbrains.kotlinx:kotlinx-datetime", Versions.KOTLIN_DATETIMES, Method.IMPLEMENTATION)
DependencyInfo("org.jetbrains.kotlinx:kotlinx-datetime",
Versions.KOTLIN_DATETIMES,
Method.IMPLEMENTATION)
)

const val FIREBASE_BOM = "com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}"
Expand Down
3 changes: 1 addition & 2 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import common.GradleUtil.implement

plugins {
Expand Down Expand Up @@ -34,7 +33,7 @@ dependencies {
app.ModuleDependencies.okhttp.implement(this)
app.ModuleDependencies.hilt.implement(this)
app.ModuleDependencies.timber.implement(this)
app.ModuleDependencies.kakaoSdk.implement(this)
app.ModuleDependencies.kakaoOAuth.implement(this)
app.ModuleDependencies.kotlinDateTime.implement(this)

implementation(platform(app.ModuleDependencies.FIREBASE_BOM))
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())
}
3 changes: 3 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,8 @@ dependencies {
app.ModuleDependencies.materialCalendarView.implement(this)
app.ModuleDependencies.accompanist.implement(this)
app.ModuleDependencies.kotlinDateTime.implement(this)
app.ModuleDependencies.kakaoOAuth.implement(this)
app.ModuleDependencies.kakaoShare.implement(this)

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

0 comments on commit b8a1e2d

Please sign in to comment.