Skip to content

Commit 4e96888

Browse files
committed
Merge branch 'develop' into feature/jaino/#289
2 parents 1024f34 + 155b0b4 commit 4e96888

File tree

265 files changed

+9646
-783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+9646
-783
lines changed

app/src/dev/kotlin/com/bff/wespot/AnalyticsModule.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ import javax.inject.Singleton
1313
object AnalyticsModule {
1414
@Provides
1515
@Singleton
16-
fun provideAnalyticsHelper(): AnalyticsHelper {
17-
return DebugAnalyticsHelper()
18-
}
16+
fun provideAnalyticsHelper(): AnalyticsHelper = DebugAnalyticsHelper()
1917
}

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<uses-permission android:name="android.permission.INTERNET" />
55
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
66
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
7+
<uses-permission android:name="android.permission.VIBRATE" />
8+
79
<application
810
android:name=".application.WeSpotApplication"
911
android:allowBackup="true"
@@ -33,15 +35,17 @@
3335
android:name=".main.MainActivity"
3436
android:exported="true"
3537
android:screenOrientation="portrait"
36-
android:windowSoftInputMode="adjustResize" >
38+
android:windowSoftInputMode="adjustResize">
3739
<intent-filter>
3840
<action android:name="android.intent.action.VIEW" />
41+
3942
<category android:name="android.intent.category.DEFAULT" />
4043
<category android:name="android.intent.category.BROWSABLE" />
44+
4145
<data
4246
android:scheme="wespot"
4347
android:host="message"
44-
android:pathPrefix="/"/>
48+
android:pathPrefix="/" />
4549
</intent-filter>
4650
</activity>
4751

app/src/main/kotlin/com/bff/wespot/di/ConfigModule.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ object ConfigModule {
2424
@Singleton
2525
fun provideRemoteConfig(): FirebaseRemoteConfig {
2626
val remoteConfig = FirebaseRemoteConfig.getInstance().apply {
27-
val configSettings = FirebaseRemoteConfigSettings.Builder()
27+
val configSettings = FirebaseRemoteConfigSettings
28+
.Builder()
2829
.setMinimumFetchIntervalInSeconds(3600)
2930
.build()
3031
setConfigSettingsAsync(configSettings)
@@ -38,9 +39,7 @@ object ConfigModule {
3839
@Singleton
3940
fun provideNetworkStateChecker(
4041
@ApplicationContext context: Context,
41-
): NetworkStateChecker {
42-
return NetworkStateChecker(context)
43-
}
42+
): NetworkStateChecker = NetworkStateChecker(context)
4443

4544
@Provides
4645
@Singleton

app/src/main/kotlin/com/bff/wespot/main/MainScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ internal fun MainScreen(
9090
MainTopBar(
9191
isTopNavigationScreen = isTopNavigationScreen,
9292
navController = navController,
93+
navigator = navigator,
9394
)
9495
},
9596
bottomBar = {
@@ -170,7 +171,7 @@ internal fun MainScreen(
170171
)
171172

172173
LaunchedEffect(Unit) {
173-
val versinName = context.packageManager.getPackageInfo(context.packageName, 0).versionName
174+
val versinName = context.packageManager.getPackageInfo(context.packageName, 0).versionName ?: ""
174175
action(MainAction.OnMainScreenEntered(appVersionName = versinName))
175176
}
176177

app/src/main/kotlin/com/bff/wespot/main/component/BottomNavigationTab.kt

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
package com.bff.wespot.main.component
22

3+
import android.os.VibrationEffect
4+
import android.os.Vibrator
35
import androidx.compose.foundation.layout.Arrangement
46
import androidx.compose.foundation.layout.Box
57
import androidx.compose.foundation.layout.Column
68
import androidx.compose.foundation.layout.Row
79
import androidx.compose.foundation.layout.RowScope
810
import androidx.compose.foundation.layout.fillMaxWidth
9-
import androidx.compose.foundation.layout.size
11+
import androidx.compose.foundation.layout.height
12+
import androidx.compose.foundation.layout.padding
1013
import androidx.compose.material3.Icon
1114
import androidx.compose.material3.NavigationBar
1215
import androidx.compose.material3.Text
1316
import androidx.compose.runtime.Composable
17+
import androidx.compose.runtime.LaunchedEffect
18+
import androidx.compose.runtime.getValue
19+
import androidx.compose.runtime.mutableStateOf
20+
import androidx.compose.runtime.remember
21+
import androidx.compose.runtime.setValue
1422
import androidx.compose.ui.Alignment
1523
import androidx.compose.ui.Modifier
1624
import androidx.compose.ui.graphics.painter.Painter
25+
import androidx.compose.ui.platform.LocalContext
1726
import androidx.compose.ui.res.painterResource
1827
import androidx.compose.ui.res.stringResource
1928
import androidx.compose.ui.unit.dp
@@ -31,7 +40,7 @@ internal fun BottomNavigationTab(
3140
) {
3241
NavigationBar(
3342
containerColor = WeSpotThemeManager.colors.naviColor,
34-
modifier = modifier,
43+
modifier = modifier.height(69.dp),
3544
) {
3645
Row(
3746
modifier = Modifier.fillMaxWidth(),
@@ -62,14 +71,42 @@ private fun RowScope.TabItem(
6271
selected: Boolean = false,
6372
onClick: () -> Unit,
6473
) {
74+
val context = LocalContext.current
75+
var hapticEngine by remember { mutableStateOf<VibrationEffect?>(null) }
76+
77+
LaunchedEffect(key1 = Unit) {
78+
val numberOfPulses = 1
79+
val pulseDuration = 40L
80+
val maxAmplitude = 255
81+
82+
val timings = LongArray(numberOfPulses * 2)
83+
val amplitudes = IntArray(numberOfPulses * 2)
84+
85+
for (i in 0 until numberOfPulses) {
86+
val amplitude =
87+
(maxAmplitude * (i + 1) / numberOfPulses)
88+
timings[i * 2 + 1] = pulseDuration
89+
amplitudes[i * 2] = 0
90+
amplitudes[i * 2 + 1] = amplitude
91+
}
92+
93+
hapticEngine = VibrationEffect.createWaveform(timings, amplitudes, -1)
94+
}
95+
6596
Box(
6697
modifier = Modifier
67-
.size(80.dp)
6898
.weight(1f)
69-
.clickableSingle { onClick.invoke() },
99+
.clickableSingle {
100+
hapticEngine?.let {
101+
val vibrate = context.getSystemService(Vibrator::class.java)
102+
vibrate.vibrate(it)
103+
}
104+
onClick.invoke()
105+
},
70106
contentAlignment = Alignment.Center,
71107
) {
72108
Column(
109+
modifier = Modifier.padding(top = 10.dp, bottom = 18.dp),
73110
horizontalAlignment = Alignment.CenterHorizontally,
74111
) {
75112
Icon(
@@ -83,7 +120,7 @@ private fun RowScope.TabItem(
83120

84121
Text(
85122
text = title,
86-
style = StaticTypeScale.Default.body9,
123+
style = StaticTypeScale.Default.body10,
87124
color = if (selected) {
88125
WeSpotThemeManager.colors.abledIconColor
89126
} else {

app/src/main/kotlin/com/bff/wespot/main/component/MainTopBar.kt

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import androidx.compose.material3.Icon
1414
import androidx.compose.material3.IconButton
1515
import androidx.compose.runtime.Composable
1616
import androidx.compose.ui.Modifier
17+
import androidx.compose.ui.platform.LocalContext
1718
import androidx.compose.ui.res.painterResource
1819
import androidx.compose.ui.res.stringResource
1920
import androidx.compose.ui.unit.dp
@@ -26,6 +27,7 @@ import com.bff.wespot.entire.screen.destinations.SettingScreenDestination
2627
import com.bff.wespot.main.model.BarType
2728
import com.bff.wespot.message.screen.destinations.MessageSettingScreenDestination
2829
import com.bff.wespot.navigation.AppNavGraphs
30+
import com.bff.wespot.navigation.Navigator
2931
import com.ramcosta.composedestinations.dynamic.within
3032
import com.ramcosta.composedestinations.navigation.navigate
3133

@@ -34,7 +36,10 @@ import com.ramcosta.composedestinations.navigation.navigate
3436
internal fun MainTopBar(
3537
isTopNavigationScreen: BarType,
3638
navController: NavController,
39+
navigator: Navigator,
3740
) {
41+
val context = LocalContext.current
42+
3843
AnimatedContent(
3944
targetState = isTopNavigationScreen,
4045
transitionSpec = {
@@ -77,6 +82,7 @@ internal fun MainTopBar(
7782
)
7883
}
7984
}
85+
8086
BarType.ENTIRE -> {
8187
IconButton(
8288
modifier = Modifier.padding(end = 8.dp),
@@ -94,6 +100,7 @@ internal fun MainTopBar(
94100
)
95101
}
96102
}
103+
97104
BarType.MESSAGE -> {
98105
Row(modifier = Modifier.padding(end = 16.dp)) {
99106
IconButton(
@@ -127,7 +134,55 @@ internal fun MainTopBar(
127134
}
128135
}
129136
}
130-
BarType.NONE -> { }
137+
138+
BarType.COMMUNITY -> {
139+
Row {
140+
IconButton(
141+
onClick = {
142+
context.startActivity(
143+
navigator.navigateToCommunitySearch(
144+
context,
145+
),
146+
)
147+
},
148+
) {
149+
Icon(
150+
painter = painterResource(drawable.search),
151+
contentDescription = stringResource(R.string.main_search),
152+
)
153+
}
154+
155+
IconButton(
156+
onClick = {
157+
navController.navigateToNavGraph(
158+
navGraph = AppNavGraphs.notification,
159+
)
160+
},
161+
) {
162+
Icon(
163+
painter = painterResource(id = drawable.icn_alarm),
164+
contentDescription = stringResource(
165+
id = com.bff.wespot.designsystem.R.string.notification_icon,
166+
),
167+
)
168+
}
169+
170+
IconButton(
171+
onClick = {
172+
context.startActivity(
173+
navigator.navigateToCommunityAll(context),
174+
)
175+
},
176+
) {
177+
Icon(
178+
painter = painterResource(drawable.all_menu),
179+
contentDescription = stringResource(R.string.main_all),
180+
)
181+
}
182+
}
183+
}
184+
185+
BarType.NONE -> {}
131186
}
132187
},
133188
)

app/src/main/kotlin/com/bff/wespot/main/model/BarType.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ enum class BarType {
55
ENTIRE,
66
MESSAGE,
77
NONE,
8+
COMMUNITY,
89
;
910

1011
fun shouldShowMainLogo(): Boolean =

app/src/main/kotlin/com/bff/wespot/main/state/MainAction.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ import com.bff.wespot.model.notification.PushNotificationData
44
import com.bff.wespot.model.serverDriven.OnBoardingCategory
55

66
sealed class MainAction {
7-
data class OnMainScreenEntered(val appVersionName: String) : MainAction()
8-
data class OnEnteredByPushNotification(val data: PushNotificationData) : MainAction()
9-
data class OnNotificationSet(val isEnableNotification: Boolean) : MainAction()
10-
data class CloseOnBoarding(val category: OnBoardingCategory) : MainAction()
7+
data class OnMainScreenEntered(
8+
val appVersionName: String,
9+
) : MainAction()
10+
data class OnEnteredByPushNotification(
11+
val data: PushNotificationData,
12+
) : MainAction()
13+
data class OnNotificationSet(
14+
val isEnableNotification: Boolean,
15+
) : MainAction()
16+
data class CloseOnBoarding(
17+
val category: OnBoardingCategory,
18+
) : MainAction()
1119
}

app/src/main/kotlin/com/bff/wespot/main/state/MainSideEffect.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import com.bff.wespot.main.model.VersionUpdateType
44
import com.bff.wespot.model.notification.PushNotificationData
55

66
sealed interface MainSideEffect {
7-
data class ShowVersionUpdateDialog(val versionUpdateType: VersionUpdateType) : MainSideEffect
8-
data class NavigateFromPushNotification(val data: PushNotificationData) : MainSideEffect
7+
data class ShowVersionUpdateDialog(
8+
val versionUpdateType: VersionUpdateType,
9+
) : MainSideEffect
10+
data class NavigateFromPushNotification(
11+
val data: PushNotificationData,
12+
) : MainSideEffect
913
}

app/src/main/kotlin/com/bff/wespot/main/viewmodel/MainViewModel.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class MainViewModel @Inject constructor(
3737
private val coroutineDispatcher: CoroutineDispatcher,
3838
private val commonRepository: CommonRepository,
3939
private val remoteConfigRepository: RemoteConfigRepository,
40-
) : ViewModel(), ContainerHost<MainUiState, MainSideEffect> {
40+
) : ViewModel(),
41+
ContainerHost<MainUiState, MainSideEffect> {
4142
override val container = container<MainUiState, MainSideEffect>(
4243
MainUiState(
4344
kakaoChannel = remoteConfigRepository.fetchFromRemoteConfig(
@@ -82,7 +83,8 @@ class MainViewModel @Inject constructor(
8283

8384
checkAppVersionWithLatestVersion(appVersion)
8485

85-
commonRepository.getRestriction()
86+
commonRepository
87+
.getRestriction()
8688
.onSuccess {
8789
reduce {
8890
state.copy(restriction = it)
@@ -139,7 +141,8 @@ class MainViewModel @Inject constructor(
139141

140142
private fun handleNotificationSet(isEnableNotification: Boolean) = intent {
141143
viewModelScope.launch {
142-
userRepository.setFeatureNotificationSetting(isEnableNotification)
144+
userRepository
145+
.setFeatureNotificationSetting(isEnableNotification)
143146
.onFailure {
144147
Timber.e(it)
145148
}

0 commit comments

Comments
 (0)