Skip to content

Commit 91404c8

Browse files
authored
Merge pull request #79 from git-jr/feat/tela_selecao_perfil
[ISSUE-77] - tela seleção de perfil
2 parents cc82927 + 73e43c7 commit 91404c8

File tree

41 files changed

+1063
-19
lines changed

Some content is hidden

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

41 files changed

+1063
-19
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies {
88

99
implementation(projects.featureFavorites)
1010
implementation(projects.featureListStreams)
11+
implementation(projects.featureProfile)
1112
implementation(projects.coreShared)
1213
implementation(projects.coreSharedUi)
1314
implementation(projects.coreNavigation)

app/src/main/java/com/codandotv/streamplayerapp/navigation/NavigationGraph.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
55
import androidx.compose.material3.Scaffold
66
import androidx.compose.material3.Text
77
import androidx.compose.runtime.Composable
8-
import androidx.compose.runtime.saveable.rememberSaveable
98
import androidx.compose.ui.graphics.Color
109
import androidx.navigation.NavController
1110
import androidx.navigation.NavGraphBuilder
@@ -17,6 +16,7 @@ import com.codandotv.streamplayerapp.core_navigation.routes.BottomNavRoutes
1716
import com.codandotv.streamplayerapp.core_navigation.routes.Routes
1817
import com.codandotv.streamplayerapp.feature_list_streams.detail.presentation.navigation.detailStreamNavGraph
1918
import com.codandotv.streamplayerapp.feature_list_streams.list.presentation.navigation.listStreamsNavGraph
19+
import com.codandotv.streamplayerapp.feature_profile.profile.presentation.navigation.profilePickerStreamNavGraph
2020
import com.codandotv.streamplayerapp.splah.presentation.navigation.splashNavGraph
2121

2222
@Composable
@@ -29,6 +29,7 @@ fun NavigationGraph(navController: NavHostController) {
2929
temporaryFun(BottomNavRoutes.NEWS, navController)
3030
temporaryFun(BottomNavRoutes.SCENES, navController)
3131
temporaryFun(BottomNavRoutes.DOWNLOADS, navController)
32+
profilePickerStreamNavGraph(navController = navController)
3233
}
3334
}
3435

build-logic/src/main/java/Config.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ object Config {
1010
object BuildField {
1111
const val host_debug = "\"https://api.themoviedb.org/3/\""
1212
const val host_release = "\"https://api.themoviedb.org/3/\""
13+
const val api_profile_debug = "\"https://demo3364084.mockable.io/\""
14+
const val api_profile_release = "\"https://demo3364084.mockable.io/\""
1315

1416
private const val tmdb_token_name_debug = "TMDB_BEARER_TOKEN_DEBUG"
1517
private const val tmdb_token_name_release = "TMDB_BEARER_TOKEN_RELEASE"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
package com.codandotv.streamplayerapp.core_navigation.routes
22

3+
import com.codandotv.streamplayerapp.core_navigation.routes.BottomNavRoutes.PARAM.PROFILE_ID
4+
35
object BottomNavRoutes {
46
const val HOME = "bottomHome"
7+
const val HOME_COMPLETE = "$HOME?$PROFILE_ID={$PROFILE_ID}"
58
const val GAMES = "bottomGames"
69
const val NEWS = "bottomNews"
710
const val SCENES = "bottomScenes"
811
const val DOWNLOADS = "bottomDownloads"
12+
13+
object PARAM {
14+
const val PROFILE_ID = "userId"
15+
}
916
}

core-navigation/src/main/java/com/codandotv/streamplayerapp/core_navigation/routes/Routes.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ object Routes {
66
const val DETAIL = "DetailList/"
77
const val DETAIL_COMPLETE = "${DETAIL}{${ID}}"
88
const val Splash = "splash"
9+
const val PROFILE_PICKER = "profilePicker"
910

1011
object PARAM {
1112
const val ID = "id"

core-networking/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ android {
66
debug {
77
buildConfigField("String", "HOST", Config.BuildField.host_debug)
88
buildConfigField("String", "API_BEARER_AUTH", Config.BuildField.api_bearer_debug)
9+
buildConfigField("String", "PROFILE", Config.BuildField.api_profile_debug)
10+
911
}
1012
getByName("release") {
1113
buildConfigField("String", "HOST", Config.BuildField.host_release)
1214
buildConfigField("String", "API_BEARER_AUTH", Config.BuildField.api_bearer_release)
15+
buildConfigField("String", "PROFILE", Config.BuildField.api_profile_release)
1316
}
1417
}
1518
}

core-networking/src/main/java/com/codandotv/streamplayerapp/core_networking/di/NetworkModule.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ object NetworkModule {
1818
BuildConfig.HOST
1919
}
2020

21+
single(QualifierProfile) {
22+
BuildConfig.PROFILE
23+
}
24+
2125
single {
2226
Moshi.Builder()
2327
.add(KotlinJsonAdapterFactory())
@@ -56,6 +60,14 @@ object NetworkModule {
5660
)
5761
}
5862

63+
single(QualifierProfileRetrofit) {
64+
provideRetrofit(
65+
okHttpClient = get(),
66+
moshi = get(),
67+
baseUrl = get(QualifierProfile)
68+
)
69+
}
70+
5971
single {
6072
provideOkhttp(
6173
get(QualifierAuthInterceptor),

core-networking/src/main/java/com/codandotv/streamplayerapp/core_networking/di/QualifierNetworking.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ object QualifierHost : Qualifier {
88
get() = "QualifierHost"
99
}
1010

11+
object QualifierProfile : Qualifier {
12+
override val value: QualifierValue
13+
get() = "QualifierProfile"
14+
}
15+
16+
object QualifierProfileRetrofit : Qualifier {
17+
override val value: QualifierValue
18+
get() = "QualifierProfileRetrofit"
19+
}
20+
21+
1122
object QualifierLoggerInterceptor : Qualifier {
1223
override val value: QualifierValue
1324
get() = "QualifierLoggerInterceptor"
@@ -16,4 +27,5 @@ object QualifierLoggerInterceptor : Qualifier {
1627
object QualifierAuthInterceptor : Qualifier {
1728
override val value: QualifierValue
1829
get() = "QualifierAuthInterceptor"
19-
}
30+
}
31+

core-shared-ui/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ dependencies {
1111
implementation(libs.bundles.androidSupport)
1212
implementation(libs.android.youtube.player)
1313
testImplementation(libs.bundles.test)
14+
implementation(libs.coil)
1415
}

core-shared-ui/src/main/java/com/codandotv/streamplayerapp/core_shared_ui/widget/StreamPlayerTopBar.kt

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,34 @@ import androidx.compose.ui.graphics.Color
2727
import androidx.compose.ui.res.painterResource
2828
import androidx.compose.ui.res.stringResource
2929
import androidx.compose.ui.unit.dp
30+
import coil.compose.AsyncImage
3031
import com.codandotv.streamplayerapp.core.shared.ui.R
32+
import com.codandotv.streamplayerapp.core_shared.extension.empty
3133
import com.codandotv.streamplayerapp.core_shared_ui.resources.Colors
3234
import com.codandotv.streamplayerapp.core_shared_ui.theme.ThemePreview
3335
import com.codandotv.streamplayerapp.core_shared_ui.theme.ThemePreviews
3436

3537
@OptIn(ExperimentalMaterial3Api::class)
3638
@Composable
37-
fun StreamPlayerTopBar(scrollBehavior: TopAppBarScrollBehavior) {
39+
fun StreamPlayerTopBar(
40+
scrollBehavior: TopAppBarScrollBehavior,
41+
onNavigateProfilePicker: () -> Unit = {},
42+
onSelectedProfilePicture: String
43+
) {
3844
Box(modifier = Modifier.background(color = Colors.Dark10)) {
39-
StreamPlayerTopBar()
45+
StreamPlayerTopBar(
46+
onNavigateProfilePicker = { onNavigateProfilePicker() },
47+
profilePicture = onSelectedProfilePicture
48+
)
4049
StreamPlayerOptionsTopBar(modifier = Modifier.padding(top = 50.dp), scrollBehavior)
4150
}
4251
}
4352

4453
@Composable
45-
private fun StreamPlayerTopBar() {
54+
private fun StreamPlayerTopBar(
55+
onNavigateProfilePicker: () -> Unit = {},
56+
profilePicture: String
57+
) {
4658
Row(
4759
modifier = Modifier
4860
.height(50.dp)
@@ -75,15 +87,16 @@ private fun StreamPlayerTopBar() {
7587

7688
IconButton(
7789
modifier = Modifier.fillMaxHeight(),
78-
onClick = { /* todo */ }
90+
onClick = { onNavigateProfilePicker() }
7991
) {
80-
Icon(
92+
AsyncImage(
8193
modifier = Modifier
8294
.height(24.dp)
8395
.clip(RoundedCornerShape(4.dp)),
84-
painter = painterResource(R.drawable.perfil_fake),
85-
contentDescription = stringResource(id = R.string.icon_profile),
86-
tint = Color.Unspecified,
96+
model = profilePicture,
97+
error = painterResource(id = R.drawable.perfil_fake),
98+
placeholder = painterResource(id = R.drawable.perfil_fake),
99+
contentDescription = stringResource(id = R.string.icon_profile)
87100
)
88101
}
89102
}
@@ -130,7 +143,9 @@ fun StreamPlayerTopBarPreview() {
130143
StreamPlayerTopBar(
131144
scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior(
132145
rememberTopAppBarState()
133-
)
146+
),
147+
onNavigateProfilePicker = {},
148+
onSelectedProfilePicture = String.empty()
134149
)
135150
}
136151
}

0 commit comments

Comments
 (0)