Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/jaino/#75
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Aug 9, 2024
2 parents 4c426d0 + 6424235 commit b27c69c
Show file tree
Hide file tree
Showing 91 changed files with 1,992 additions and 283 deletions.
1 change: 1 addition & 0 deletions .github/workflows/opened-pr-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
echo KAKAO_APP_KEY=\"${{ secrets.KAKAO_APP_KEY }}\" >> ./local.properties
echo SCHEME_KAKAO_APP_KEY=\"${{ secrets.SCHEME_KAKAO_APP_KEY }}\" >> ./local.properties
echo MOCK_BASE_URL=\"${{ secrets.MOCK_BASE_URL }}\" >> ./local.properties
echo FACEBOOK_APP_ID=\"${{ secrets.FACEBOOK_APP_ID }}\" >> ./local.properties
- name: add google-services.json
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
Expand Down
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ android {

defaultConfig {
buildConfigField("String", "KAKAO_APP_KEY", properties.getProperty("KAKAO_APP_KEY"))

buildConfigField("String", "FACEBOOK_APP_ID", properties.getProperty("FACEBOOK_APP_ID"))

manifestPlaceholders["SCHEME_KAKAO_APP_KEY"] =
properties.getProperty("SCHEME_KAKAO_APP_KEY")
}
Expand Down
22 changes: 13 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<application
Expand Down Expand Up @@ -29,7 +28,9 @@

<activity
android:name=".MainActivity"
android:exported="false" />
android:exported="false"
android:windowSoftInputMode="adjustResize"/>


<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
Expand All @@ -47,12 +48,15 @@
</intent-filter>
</activity>

<service android:name=".PushNotificationService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.bff.wespot.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>

</manifest>
10 changes: 10 additions & 0 deletions app/src/main/kotlin/com/bff/wespot/AppNavGraphs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.navigation.NavDestination.Companion.hierarchy
import androidx.navigation.NavGraph
import androidx.navigation.NavHostController
import com.bff.wespot.entire.screen.screen.destinations.AccountSettingScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.BlockListScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.EntireScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.NotificationSettingScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.RevokeConfirmScreenDestination
Expand All @@ -26,7 +27,10 @@ import com.bff.wespot.message.screen.destinations.ReceiverSelectionScreenDestina
import com.bff.wespot.message.screen.destinations.ReservedMessageScreenDestination
import com.bff.wespot.message.viewmodel.SendViewModel
import com.bff.wespot.notification.screen.destinations.NotificationScreenDestination
import com.bff.wespot.navigation.Navigator
import com.bff.wespot.vote.screen.destinations.CharacterSettingScreenDestination
import com.bff.wespot.vote.screen.destinations.IndividualVoteScreenDestination
import com.bff.wespot.vote.screen.destinations.IntroductionScreenDestination
import com.bff.wespot.vote.screen.destinations.VoteHomeScreenDestination
import com.bff.wespot.vote.screen.destinations.VoteResultScreenDestination
import com.bff.wespot.vote.screen.destinations.VoteStorageScreenDestination
Expand All @@ -53,6 +57,8 @@ object AppNavGraphs {
VoteResultScreenDestination,
VoteStorageScreenDestination,
IndividualVoteScreenDestination,
CharacterSettingScreenDestination,
IntroductionScreenDestination,
).routedIn(this)
.associateBy { it.route }
}
Expand Down Expand Up @@ -84,6 +90,7 @@ object AppNavGraphs {
AccountSettingScreenDestination,
RevokeScreenDestination,
RevokeConfirmScreenDestination,
BlockListScreenDestination,
).routedIn(this)
.associateBy { it.route }
}
Expand Down Expand Up @@ -153,6 +160,7 @@ fun DestinationScopeWithNoDependencies<*>.currentNavigator(): CommonNavGraphNavi
@Composable
internal fun AppNavigation(
navController: NavHostController,
navigator: Navigator,
modifier: Modifier = Modifier,
) {
val engine = rememberNavHostEngine(
Expand All @@ -172,8 +180,10 @@ internal fun AppNavigation(
modifier = modifier,
dependenciesContainerBuilder = {
dependency(currentNavigator())
dependency(navigator)
dependency(sendViewModel)
dependency(votingViewModel)
dependency(navigator)
},
)
}
Expand Down
24 changes: 23 additions & 1 deletion app/src/main/kotlin/com/bff/wespot/CommonNavGraphNavigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package com.bff.wespot

import androidx.navigation.NavController
import com.bff.wespot.entire.screen.screen.AccountSettingNavigator
import com.bff.wespot.entire.screen.screen.BlockListNavigator
import com.bff.wespot.entire.screen.screen.EntireNavigator
import com.bff.wespot.entire.screen.screen.NotificationSettingNavigator
import com.bff.wespot.entire.screen.screen.SettingNavigator
import com.bff.wespot.entire.screen.screen.destinations.AccountSettingScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.BlockListScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.NotificationSettingScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.RevokeConfirmScreenDestination
import com.bff.wespot.entire.screen.screen.destinations.RevokeScreenDestination
Expand All @@ -29,14 +31,19 @@ import com.bff.wespot.message.screen.send.ReceiverSelectionNavigator
import com.bff.wespot.message.screen.send.ReceiverSelectionScreenArgs
import com.bff.wespot.notification.screen.NotificationNavigator
import com.bff.wespot.notification.screen.destinations.NotificationScreenDestination
import com.bff.wespot.vote.screen.CharacterSettingNavigator
import com.bff.wespot.vote.screen.IndividualVoteArgs
import com.bff.wespot.vote.screen.IndividualVoteNavigator
import com.bff.wespot.vote.screen.IntroductionArgs
import com.bff.wespot.vote.screen.IntroductionNavigator
import com.bff.wespot.vote.screen.VoteNavigator
import com.bff.wespot.vote.screen.VoteResultNavigator
import com.bff.wespot.vote.screen.VoteResultScreenArgs
import com.bff.wespot.vote.screen.VoteStorageNavigator
import com.bff.wespot.vote.screen.VotingNavigator
import com.bff.wespot.vote.screen.destinations.CharacterSettingScreenDestination
import com.bff.wespot.vote.screen.destinations.IndividualVoteScreenDestination
import com.bff.wespot.vote.screen.destinations.IntroductionScreenDestination
import com.bff.wespot.vote.screen.destinations.VoteResultScreenDestination
import com.bff.wespot.vote.screen.destinations.VoteStorageScreenDestination
import com.bff.wespot.vote.screen.destinations.VotingScreenDestination
Expand All @@ -58,12 +65,15 @@ class CommonNavGraphNavigator(
AccountSettingNavigator,
RevokeNavigator,
RevokeConfirmNavigator,
BlockListNavigator,
VotingNavigator,
VoteResultNavigator,
VoteStorageNavigator,
ReservedMessageNavigator,
IndividualVoteNavigator,
NotificationNavigator {
NotificationNavigator,
CharacterSettingNavigator,
IntroductionNavigator {
override fun navigateUp() {
navController.navigateUp()
}
Expand Down Expand Up @@ -135,4 +145,16 @@ class CommonNavGraphNavigator(
override fun navigateToIndividualVote(args: IndividualVoteArgs) {
navController.navigate(IndividualVoteScreenDestination(args) within navGraph)
}

override fun navigateToBlockListScreen() {
navController.navigate(BlockListScreenDestination within navGraph)
}

override fun navigateToCharacterScreen() {
navController.navigate(CharacterSettingScreenDestination within navGraph)
}

override fun navigateToIntroduction(args: IntroductionArgs) {
navController.navigate(IntroductionScreenDestination(args) within navGraph)
}
}
15 changes: 12 additions & 3 deletions app/src/main/kotlin/com/bff/wespot/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,32 @@ import com.bff.wespot.designsystem.component.header.WSTopBar
import com.bff.wespot.designsystem.theme.StaticTypeScale
import com.bff.wespot.designsystem.theme.WeSpotTheme
import com.bff.wespot.designsystem.theme.WeSpotThemeManager
import com.bff.wespot.navigation.Navigator
import com.ramcosta.composedestinations.navigation.navigate
import com.ramcosta.composedestinations.spec.NavGraphSpec
import dagger.hilt.android.AndroidEntryPoint
import timber.log.Timber
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
@Inject
lateinit var navigator: Navigator

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setContent {
WeSpotTheme {
MainScreen()
MainScreen(navigator)
}
}
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun MainScreen() {
private fun MainScreen(navigator: Navigator) {
val navController = rememberNavController()

val checkScreen by navController.checkCurrentScreen()
Expand Down Expand Up @@ -113,7 +118,11 @@ private fun MainScreen() {
}
},
) {
AppNavigation(navController = navController, modifier = Modifier.padding(it))
AppNavigation(
navController = navController,
modifier = Modifier.padding(it),
navigator = navigator,
)
}
}

Expand Down
79 changes: 79 additions & 0 deletions app/src/main/kotlin/com/bff/wespot/NavigatorImpl.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package com.bff.wespot

import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.net.Uri
import com.bff.wespot.auth.AuthActivity
import com.bff.wespot.navigation.Navigator
import com.bff.wespot.navigation.util.buildIntent
import javax.inject.Inject


class NavigatorImpl @Inject constructor() : Navigator {
private val sharingName = listOf(
"instagram",
"kakao",
)

override fun navigateToMain(
context: Context,
): Intent {
Expand All @@ -21,4 +29,75 @@ class NavigatorImpl @Inject constructor() : Navigator {
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
return intent
}

override fun navigateToSharing(context: Context) {
val sendIntent = Intent(Intent.ACTION_SEND)
sendIntent.setType("text/plain")

val chooser: MutableList<Intent> = mutableListOf()
val resInfo = context.packageManager.queryIntentActivities(sendIntent, 0)

if (resInfo.isEmpty()) {
return
}

val kakaoIntent = Intent(Intent.ACTION_SEND).apply {
setComponent(
ComponentName(
"com.kakao.talk",
"com.kakao.talk.activity.IntentFilterActivity",
)
)
putExtra(Intent.EXTRA_SUBJECT, "메시지 제목")
putExtra(Intent.EXTRA_TEXT, "메시지 내용")
setType("text/plain")
}

chooser.add(kakaoIntent)

val instaIntent = Intent(Intent.ACTION_SEND).apply {
setComponent(
ComponentName(
"com.instagram.android",
"com.instagram.direct.share.handler.DirectShareHandlerActivity",
),
)
setType("text/plain")
putExtra(Intent.EXTRA_SUBJECT, "메시지 제목")
putExtra(Intent.EXTRA_TEXT, "메시지 내용")
}

chooser.add(instaIntent)

val choser = Intent.createChooser(chooser.removeAt(0), "타이틀")
choser.putExtra(Intent.EXTRA_INITIAL_INTENTS, chooser.toTypedArray())
context.startActivity(choser)
}

override fun navigateToInstaStory(context: Context, file: Uri): Intent {
val intent = Intent("com.instagram.share.ADD_TO_STORY")
.apply {
setDataAndType(null, "image/*")
}
if (intent.resolveActivity(context.packageManager) == null) {
redirectToPlayStoreForInstagram(context)
}

intent.apply {
putExtra("source_application", BuildConfig.FACEBOOK_APP_ID)
setDataAndType(file, "image/jpeg")
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}

return intent
}

private fun redirectToPlayStoreForInstagram(context: Context) {
val appStoreIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=com.instagram.android"),
)
appStoreIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(appStoreIntent)
}
}
8 changes: 8 additions & 0 deletions app/src/main/res/xml/provider_paths.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<paths>
<cache-path
name="shared_images"
path="images/" />
</paths>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AndroidApplicationPlugin : Plugin<Project> {
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.android")
apply("com.bff.wespot.lint")
}

extensions.configure<ApplicationExtension> {
Expand Down
7 changes: 1 addition & 6 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
plugins {
alias(libs.plugins.wespot.android.library)
alias(libs.plugins.wespot.android.hilt)
}

android {
namespace = "com.bff.wespot.core.common"
alias(libs.plugins.wespot.jvm.library)
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.bff.wespot.common.di.extensions
package com.bff.wespot.common.extension

import com.bff.wespot.model.exception.NetworkException

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun LocalDateTime.toDateString(): String {
}

fun Long.toDateString(date: String): String =
when(this) {
when (this) {
0L -> {
"오늘"
}
Expand All @@ -44,9 +44,8 @@ fun Long.toDateString(date: String): String =
}
}


private fun String.toKoreanWeekDay() =
when(this) {
when (this) {
"MONDAY" -> "월요일"
"TUESDAY" -> "화요일"
"WEDNESDAY" -> "수요일"
Expand All @@ -55,4 +54,4 @@ private fun String.toKoreanWeekDay() =
"SATURDAY" -> "토요일"
"SUNDAY" -> "일요일"
else -> ""
}
}
Loading

0 comments on commit b27c69c

Please sign in to comment.