Skip to content

Commit

Permalink
More Premium Concession
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaailashsharma committed Aug 18, 2024
1 parent 95046fa commit 9885304
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 126 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/ai/travel/app/home/ui/PersonalRoutes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fun NewRouteCard(
.padding(16.dp)
.clickable(interactionSource = MutableInteractionSource(), indication = null,
onClick = {
if (items <= 1) {
if (items <= 3) {
navController.navigate(Screens.NewTrip.route)
} else {
navController.navigate(Screens.PremiumScreen.route)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fun MapsSearchBar(
dataStore.countMapsToken(mapsCountToken.value + 1)
}
withContext(Dispatchers.Main) {
if (mapsCountToken.value <= 3) {
if (mapsCountToken.value <= 15) {
viewModel.searchPlace(index)
} else {
navController.navigate(Screens.PremiumScreen.route)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun NavController(
// TripDetailsScreen(viewModel = homeViewModel, paddingValues = paddingValues)
}
composable(Screens.Profile.route) {
NewProfileScreen(navHostController)
NewProfileScreen(navHostController, paddingValues = paddingValues)
}
composable(Screens.Routes.route) {
MapsSearchScreen(viewModel = mapsViewModel, navController = navHostController)
Expand Down
273 changes: 150 additions & 123 deletions app/src/main/java/ai/travel/app/profile/NewProfileScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ContactPage
import androidx.compose.material.icons.filled.EditNote
Expand Down Expand Up @@ -68,6 +71,7 @@ import kotlinx.coroutines.launch
@Composable
fun NewProfileScreen(
navController: NavHostController,
paddingValues: PaddingValues
) {
val context = LocalContext.current
val dataStore = UserDatastore(context)
Expand All @@ -81,144 +85,167 @@ fun NewProfileScreen(
modifier = Modifier
.fillMaxSize()
.background(appGradient)
.verticalScroll(rememberScrollState())
) {

Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 35.dp, bottom = 7.dp),
horizontalArrangement = Arrangement.Center
) {
ProfileImage(
imageUrl = pfp,
modifier = Modifier
.size(100.dp)
.border(
width = 1.dp,
color = lightText,
shape = CircleShape
)
.padding(3.dp)
.clip(CircleShape),
)
}
Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 7.dp),
horizontalArrangement = Arrangement.Center
) {
Text(
text = name ?: "User Name",
color = textColor,
fontSize = 20.sp,
fontFamily = monteSB,
)
}
Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 7.dp),
horizontalArrangement = Arrangement.Center
) {
Text(
text = myPhoneNumber ?: "Phone Number",
color = textColor,
fontSize = 12.sp,
fontFamily = monteSB,
softWrap = true,
modifier = Modifier.padding(end = 7.dp)
)
}
Spacer(modifier = Modifier.height(30.dp))

Card(
colors = CardDefaults.cardColors(
containerColor = CardBackground.copy(0.8f)
),
elevation = CardDefaults.cardElevation(10.dp),
Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 35.dp, bottom = 7.dp),
horizontalArrangement = Arrangement.Center
) {
ProfileImage(
imageUrl = pfp,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp)
) {
Column {

RepeatedProfileInfo(
icon = Icons.Filled.EditNote,
text = "Edit Profile"
)
RepeatedProfileInfo(
icon = Icons.Filled.Notifications,
text = "Notifications"
.size(100.dp)
.border(
width = 1.dp,
color = lightText,
shape = CircleShape
)
}
.padding(3.dp)
.clip(CircleShape),
)
}
Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 7.dp),
horizontalArrangement = Arrangement.Center
) {
Text(
text = name ?: "User Name",
color = textColor,
fontSize = 20.sp,
fontFamily = monteSB,
)
}
Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 7.dp),
horizontalArrangement = Arrangement.Center
) {
Text(
text = myPhoneNumber ?: "Phone Number",
color = textColor,
fontSize = 12.sp,
fontFamily = monteSB,
softWrap = true,
modifier = Modifier.padding(end = 7.dp)
)
}
Spacer(modifier = Modifier.height(30.dp))

Card(
colors = CardDefaults.cardColors(
containerColor = CardBackground.copy(0.8f)
),
elevation = CardDefaults.cardElevation(10.dp),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp)
) {
Column {

RepeatedProfileInfo(
icon = Icons.Filled.Notifications,
text = "Notifications"
)
}

Spacer(modifier = Modifier.height(30.dp))
}

Card(
colors = CardDefaults.cardColors(
containerColor = CardBackground.copy(0.8f)
),
elevation = CardDefaults.cardElevation(10.dp),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp)
) {
Column {

RepeatedProfileInfo(
icon = Icons.Filled.SupportAgent,
text = "Help and Support"
)
RepeatedProfileInfo(
icon = Icons.Filled.ContactPage,
text = "Contact Us"
)
RepeatedProfileInfo(
icon = Icons.Filled.PrivacyTip,
text = "Privacy Policy"
)
}
Spacer(modifier = Modifier.height(30.dp))

}
Card(
colors = CardDefaults.cardColors(
containerColor = CardBackground.copy(0.8f)
),
elevation = CardDefaults.cardElevation(10.dp),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp)
) {
Column {

Button(
onClick = {
coroutineScope.launch {
dataStore.saveName("")
dataStore.savePfp("")
dataStore.saveName("")
dataStore.saveGender("")
dataStore.saveLoginStatus(false)
}
Firebase.auth.signOut()
navController.navigate(Screens.Login.route)
},
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFFFD5065),
contentColor = Color.White
),
shape = RoundedCornerShape(35.dp),
modifier = Modifier
.fillMaxWidth()
.padding(50.dp)
) {
Text(
text = "Logout",
color = Color.White,
fontSize = 18.sp,
fontFamily = monteSB,
modifier = Modifier.padding(bottom = 4.dp),
maxLines = 1,
softWrap = true
RepeatedProfileInfo(
icon = Icons.Filled.SupportAgent,
text = "Help and Support"
)
RepeatedProfileInfo(
icon = Icons.Filled.ContactPage,
text = "Contact Us"
)
}

}
}

Button(
onClick = {
coroutineScope.launch {
dataStore.saveName("")
dataStore.savePfp("")
dataStore.saveName("")
dataStore.saveGender("")
dataStore.saveLoginStatus(false)
}
Firebase.auth.signOut()
navController.navigate(Screens.Login.route)
},
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFFFD5065),
contentColor = Color.White
),
shape = RoundedCornerShape(35.dp),
modifier = Modifier
.fillMaxWidth()
.padding(top = 50.dp, start = 50.dp, end = 50.dp, bottom = 10.dp)
) {
Text(
text = "Logout",
color = Color.White,
fontSize = 18.sp,
fontFamily = monteSB,
modifier = Modifier.padding(bottom = 4.dp),
maxLines = 1,
softWrap = true
)
}

Button(
onClick = {
coroutineScope.launch {
dataStore.saveName("")
dataStore.savePfp("")
dataStore.saveName("")
dataStore.saveGender("")
dataStore.saveLoginStatus(false)
}
Firebase.auth.signOut()
navController.navigate(Screens.Login.route)
},
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFFFD5065),
contentColor = Color.White
),
shape = RoundedCornerShape(35.dp),
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 5.dp, horizontal = 50.dp)
) {
Text(
text = "Delete Account",
color = Color.White,
fontSize = 18.sp,
fontFamily = monteSB,
modifier = Modifier.padding(bottom = 4.dp),
maxLines = 1,
softWrap = true
)
}
}
}


@Composable
Expand Down

0 comments on commit 9885304

Please sign in to comment.