Skip to content

Commit

Permalink
finishing project
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarLkhalil committed Dec 23, 2023
1 parent 7393290 commit ccc0418
Show file tree
Hide file tree
Showing 126 changed files with 7,478 additions and 618 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ localProperties.load(project.rootProject.file("local.properties").inputStream())

android {
namespace = "com.mobilebreakero.destigo"
compileSdk = 33
compileSdk = 34

defaultConfig {
applicationId = "com.mobilebreakero.destigo"
minSdk = 24
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/mobilebreakero/destigo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Modifier
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.navigation.compose.rememberNavController
import com.google.accompanist.navigation.animation.rememberAnimatedNavController
import com.mobilebreakero.auth.ui.common.components.MainViewModel
import com.mobilebreakero.common_ui.components.DestiGoTopAppBar
Expand Down Expand Up @@ -49,7 +50,7 @@ class MainActivity : ComponentActivity() {

setContent {
DestiGoTheme {
val navController = rememberAnimatedNavController()
val navController = rememberNavController()

val startDestination = if (isFirstLaunch) {
WELCOME_SCREEN
Expand Down
81 changes: 66 additions & 15 deletions app/src/main/java/com/mobilebreakero/destigo/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package com.mobilebreakero.destigo.di

import android.content.Context
import com.mobilebreakero.data.mapper.PlacesMapper
import com.mobilebreakero.data.remote.TripApi
import com.mobilebreakero.data.repoimpl.DetailsRepoImplementation
import com.mobilebreakero.data.repoimpl.PhotoRepoImplementation
import com.mobilebreakero.data.repoimpl.RecommededImple
import com.mobilebreakero.data.repoimpl.SearchPlacesRepoImpl
import com.mobilebreakero.data.repoimpl.SearchResultRepoImpl
import com.mobilebreakero.domain.repo.AuthRepository
import com.mobilebreakero.domain.repo.DetailsRepository
import com.mobilebreakero.domain.repo.FireStoreRepository
import com.mobilebreakero.domain.repo.PhotoRepository
import com.mobilebreakero.domain.repo.PostsRepo
import com.mobilebreakero.domain.repo.RecommendedTrips
import com.mobilebreakero.domain.repo.SearchRepository
import com.mobilebreakero.domain.repo.SearchResultRepo
import com.mobilebreakero.domain.repo.TripsRepo
import com.mobilebreakero.domain.usecase.DetailsUseCase
import com.mobilebreakero.domain.usecase.GetPublicTripsUseCase
import com.mobilebreakero.domain.usecase.PhotoUseCase
import com.mobilebreakero.domain.usecase.RecommendedPlaceUseCase
import com.mobilebreakero.domain.usecase.RecommendedUseCase
import com.mobilebreakero.domain.usecase.SearchPlacesUseCase
import com.mobilebreakero.domain.usecase.SearchResultUseCase
import com.mobilebreakero.domain.usecase.auth.AuthUseCase
Expand All @@ -33,37 +39,47 @@ import com.mobilebreakero.domain.usecase.auth.SignOut
import com.mobilebreakero.domain.usecase.auth.SignUpWithEmailAndPassword
import com.mobilebreakero.domain.usecase.auth.UpdateEmail
import com.mobilebreakero.domain.usecase.auth.UpdatePassword
import com.mobilebreakero.domain.usecase.firestore.AddUser
import com.mobilebreakero.domain.usecase.firestore.FireStoreUseCase
import com.mobilebreakero.domain.usecase.firestore.GetUserById
import com.mobilebreakero.domain.usecase.firestore.GetUsers
import com.mobilebreakero.domain.usecase.firestore.UpdateLocation
import com.mobilebreakero.domain.usecase.firestore.UpdateProfilePhoto
import com.mobilebreakero.domain.usecase.firestore.UpdateStatus
import com.mobilebreakero.domain.usecase.firestore.GetInterestedPlaces
import com.mobilebreakero.domain.usecase.firestore.UpdateUser
import com.mobilebreakero.domain.usecase.firestore.UpdateInterestedPlaces
import com.mobilebreakero.domain.usecase.firestore.user.AddUser
import com.mobilebreakero.domain.usecase.firestore.UserUseCase
import com.mobilebreakero.domain.usecase.firestore.user.GetUserById
import com.mobilebreakero.domain.usecase.firestore.user.GetUsers
import com.mobilebreakero.domain.usecase.firestore.user.UpdateLocation
import com.mobilebreakero.domain.usecase.firestore.user.UpdateProfilePhoto
import com.mobilebreakero.domain.usecase.firestore.user.UpdateStatus
import com.mobilebreakero.domain.usecase.firestore.user.GetInterestedPlaces
import com.mobilebreakero.domain.usecase.firestore.user.UpdateUser
import com.mobilebreakero.domain.usecase.firestore.user.UpdateInterestedPlaces
import com.mobilebreakero.domain.usecase.firestore.post.AddCommentUseCase
import com.mobilebreakero.domain.usecase.firestore.post.AddPostUseCase
import com.mobilebreakero.domain.usecase.firestore.post.DeletePostUseCase
import com.mobilebreakero.domain.usecase.firestore.post.GetPostsById
import com.mobilebreakero.domain.usecase.firestore.post.GetPostDetails
import com.mobilebreakero.domain.usecase.firestore.post.GetPostsUseCase
import com.mobilebreakero.domain.usecase.firestore.post.LikePostUseCase
import com.mobilebreakero.domain.usecase.firestore.post.PostUseCase
import com.mobilebreakero.domain.usecase.firestore.PostUseCase
import com.mobilebreakero.domain.usecase.firestore.post.SharePostUseCase
import com.mobilebreakero.domain.usecase.firestore.trips.AddChickList
import com.mobilebreakero.domain.usecase.firestore.trips.AddPlaceVisitDate
import com.mobilebreakero.domain.usecase.firestore.trips.AddPlaces
import com.mobilebreakero.domain.usecase.firestore.trips.AddPublicTrips
import com.mobilebreakero.domain.usecase.firestore.trips.AddTrip
import com.mobilebreakero.domain.usecase.firestore.trips.AddTripJournal
import com.mobilebreakero.domain.usecase.firestore.trips.GetTrips
import com.mobilebreakero.domain.usecase.firestore.trips.TripsUseCase
import com.mobilebreakero.domain.usecase.firestore.TripsUseCase
import com.mobilebreakero.domain.usecase.firestore.trips.UpdatePhoto
import com.mobilebreakero.domain.usecase.firestore.trips.DeleteTrip
import com.mobilebreakero.domain.usecase.firestore.trips.GetPublicTrips
import com.mobilebreakero.domain.usecase.firestore.trips.GetTripDetails
import com.mobilebreakero.domain.usecase.firestore.trips.GetTripsByCategories
import com.mobilebreakero.domain.usecase.firestore.trips.IsPlaceVisited
import com.mobilebreakero.domain.usecase.firestore.trips.UpdatePlacePhoto
import com.mobilebreakero.domain.usecase.firestore.trips.UpdateTripDate
import com.mobilebreakero.domain.usecase.firestore.trips.UpdateTripDays
import com.mobilebreakero.domain.usecase.firestore.trips.UpdateTripName
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent

@Module
Expand Down Expand Up @@ -93,7 +109,7 @@ object AppModule {
@Provides
fun provideFireStoreUseCases(
repo: FireStoreRepository
) = FireStoreUseCase(
) = UserUseCase(
addUser = AddUser(repo),
getUsers = GetUsers(repo),
updateUser = UpdateUser(repo),
Expand All @@ -102,7 +118,7 @@ object AppModule {
updateUserPhotoUrl = UpdateProfilePhoto(repo),
updateUserStatus = UpdateStatus(repo),
updateUserInterestedPlaces = UpdateInterestedPlaces(repo),
getInterestedPlaces = GetInterestedPlaces(repo)
getInterestedPlaces = GetInterestedPlaces(repo),
)


Expand All @@ -117,7 +133,16 @@ object AppModule {
deleteTrip = DeleteTrip(repo),
updatePhoto = UpdatePhoto(repo),
getTripDetails = GetTripDetails(repo),
getTripsByCategories = GetTripsByCategories(repo)
getTripsByCategories = GetTripsByCategories(repo),
addPlaceVisitDate = AddPlaceVisitDate(repo),
updatePlacePhoto = UpdatePlacePhoto(repo),
isVisited = IsPlaceVisited(repo),
addTripJournal = AddTripJournal(repo),
savePublicTrips = AddPublicTrips(repo),
getPublicTrips = GetPublicTrips(repo),
updateTripDate = UpdateTripDate(repo),
updateTripDays = UpdateTripDays(repo),
updateTripName = UpdateTripName(repo),
)


Expand Down Expand Up @@ -174,4 +199,30 @@ object AppModule {
fun providePhotosRepository(api: TripApi): PhotoRepository {
return PhotoRepoImplementation(api)
}

@Provides
fun provideRecomendationUseCase(repo: RecommendedTrips): RecommendedUseCase {
return RecommendedUseCase(repo)
}


@Provides
fun provideRecomendationPlacesUseCase(repo: RecommendedTrips): RecommendedPlaceUseCase {
return RecommendedPlaceUseCase(repo)
}

@Provides
fun provideGetPublicTrips(repo: RecommendedTrips): GetPublicTripsUseCase {
return GetPublicTripsUseCase(repo)
}

@Provides
fun provideRecomdedRepo(context: Context): RecommendedTrips {
return RecommededImple(context)
}

@Provides
fun provideContext(@ApplicationContext context: Context): Context {
return context
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import com.google.firebase.auth.ktx.auth
import com.google.firebase.ktx.Firebase
import com.mobilebreakero.domain.repo.userResponse
import com.mobilebreakero.domain.usecase.firestore.FireStoreUseCase
import com.mobilebreakero.domain.usecase.firestore.UserUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
Expand All @@ -15,7 +15,7 @@ import javax.inject.Inject

@HiltViewModel
class MainViewModel @Inject constructor(
private val useCase: FireStoreUseCase
private val useCase: UserUseCase
) : ViewModel() {

private val firebaseUser = Firebase.auth.currentUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ import androidx.navigation.NavController
import androidx.navigation.compose.currentBackStackEntryAsState
import com.mobilebreakero.common_ui.R
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.ADD_COMMENT
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.ADD_JOURNAL
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.ADD_PLACES_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.CHOOSE_COVER_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.DETAILS_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.HOME_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.PLACES_DETAILS_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.PLAN_CHECK_LIST
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.POSTS_DETAILS
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.PROFILE_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.PUBLIC_TRIP_DETAILS
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.SCAN_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.SIGN_IN_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.SIGN_UP_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.START_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.TRIPS_SCREEN
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.TRIP_DETAILS
import com.mobilebreakero.common_ui.navigation.NavigationRoutes.WELCOME_SCREEN

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -108,6 +112,14 @@ fun TopBarTitle(navController: NavController) {
"Add New Comment"
} else if (currentRoute == POSTS_DETAILS) {
"Post Details"
} else if (currentRoute == PUBLIC_TRIP_DETAILS) {
"Saved Trip Details"
} else if (currentRoute == TRIP_DETAILS) {
"Trip Details"
} else if (currentRoute == ADD_JOURNAL) {
"Trip Journal"
} else if (currentRoute == PLACES_DETAILS_SCREEN) {
"Place Details"
} else {
currentRoute.toString()
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.mobilebreakero.common_ui.components

import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale

fun calculateEndDate(startDate: String, duration: String): String {
val sdf = SimpleDateFormat("MM/dd/yyyy", Locale.getDefault())
val calendar = Calendar.getInstance()

calendar.time = sdf.parse(startDate) ?: Date()
calendar.add(Calendar.DAY_OF_MONTH, duration.toInt())

return sdf.format(calendar.time)
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.FavoriteBorder
import androidx.compose.material.icons.outlined.FavoriteBorder
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion.CenterHorizontally
import androidx.compose.ui.Alignment.Companion.CenterVertically
Expand All @@ -31,16 +36,19 @@ import coil.request.ImageRequest

@Composable
fun CoilImage(
data: String? = null,
data: Any? = null,
contentDescription: String,
modifier: Modifier,
contentScale: ContentScale,
onClick: () -> Unit,
title: String? = null,
desc: String? = null,
onFavoriteClick: () -> Unit
onFavoriteClick: () -> Unit,
saved: Boolean = false
) {

var isSaved by remember { mutableStateOf(saved) }

Box(
modifier = modifier
.clickable { onClick() }
Expand All @@ -60,13 +68,13 @@ fun CoilImage(
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black.copy(alpha = 0.3f))
.background(Color.Black.copy(alpha = 0.2f))
)
Row(
modifier = Modifier
.fillMaxWidth()
.background(Color.Black.copy(alpha = 0.7f))
.height(70.dp)
.background(Color.Black.copy(alpha = 0.4f))
.height(83.dp)
.align(Alignment.BottomStart),
verticalAlignment = CenterVertically,
horizontalArrangement = Arrangement.Center
Expand All @@ -82,7 +90,7 @@ fun CoilImage(
modifier = Modifier
.padding(5.dp)
.align(CenterHorizontally),
fontSize = 14.sp,
fontSize = 12.sp,
color = Color.White
)
}
Expand All @@ -91,22 +99,29 @@ fun CoilImage(
text = desc,
modifier = Modifier
.align(CenterHorizontally),
fontSize = 10.sp,
fontSize = 8.sp,
color = Color.White
)
}
}

}

val icon = if (saved) {
Icons.Filled.FavoriteBorder
} else {
Icons.Outlined.FavoriteBorder
}
Icon(
Icons.Filled.FavoriteBorder,
icon,
tint = Color.White,
contentDescription = "Favorite Icon",
modifier = Modifier
.align(Alignment.TopEnd)
.size(30.dp)
.padding(end = 10.dp, top = 10.dp)
.clickable {
isSaved = !isSaved
onFavoriteClick()
}
)
Expand Down
Loading

0 comments on commit ccc0418

Please sign in to comment.