Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added detailed project stats use-case #74

Merged
merged 15 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/runConfigurations/All_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/runConfigurations/Search_Unit_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.jacob.wakatimeapp.navigation

import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import com.jacob.wakatimeapp.details.ui.DetailsPageNavigator
import com.jacob.wakatimeapp.details.ui.DetailsPageScreen
import com.jacob.wakatimeapp.home.ui.HomePageNavigator
import com.jacob.wakatimeapp.home.ui.HomePageScreen
import com.jacob.wakatimeapp.login.ui.LoginPageNavigator
Expand Down Expand Up @@ -31,3 +33,7 @@ fun HomePage(
@Destination
fun SearchProjects(searchProjectsNavigator: SearchProjectsNavigator) =
SearchProjectsScreen(navigator = searchProjectsNavigator)

@Composable
@Destination
fun DetailsPage(navigator: DetailsPageNavigator) = DetailsPageScreen(navigator = navigator)
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.jacob.wakatimeapp.navigation

import com.jacob.wakatimeapp.details.ui.DetailsPageNavigator
import com.jacob.wakatimeapp.home.ui.HomePageNavigator
import com.jacob.wakatimeapp.login.ui.LoginPageNavigator
import com.jacob.wakatimeapp.navigation.destinations.DetailsPageDestination
import com.jacob.wakatimeapp.navigation.destinations.HomePageDestination
import com.jacob.wakatimeapp.navigation.destinations.SearchProjectsDestination
import com.jacob.wakatimeapp.search.ui.SearchProjectsNavigator
Expand All @@ -10,16 +12,20 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator
class ApplicationNavigator(private val navigator: DestinationsNavigator) :
HomePageNavigator by HomePageNavigatorImpl(navigator),
LoginPageNavigator by LoginPageNavigatorImpl(navigator),
SearchProjectsNavigator by SearchPageNavigatorImpl(navigator)
SearchProjectsNavigator by SearchPageNavigatorImpl(navigator),
DetailsPageNavigator by DetailsPageNavigatorImpl(navigator)

class LoginPageNavigatorImpl(private val navigator: DestinationsNavigator) : LoginPageNavigator {
override fun toHomePage() = navigator.navigate(HomePageDestination)
}

class HomePageNavigatorImpl(private val navigator: DestinationsNavigator) : HomePageNavigator {
override fun toDetailsPage() = navigator.navigate(HomePageDestination)
override fun toDetailsPage() = navigator.navigate(DetailsPageDestination)
override fun toSearchPage() = navigator.navigate(SearchProjectsDestination)
}

class SearchPageNavigatorImpl(private val navigator: DestinationsNavigator) :
SearchProjectsNavigator

class DetailsPageNavigatorImpl(private val navigator: DestinationsNavigator) :
DetailsPageNavigator
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.jacob.wakatimeapp.core.common.data.dtos

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
class DependencyDTO

@Serializable
data class EditorDTO(
val decimal: String,
val digital: String,
val hours: Int,
val minutes: Int,
val name: String,
val percent: Double,
val seconds: Int,
val text: String,
@SerialName("total_seconds") val totalSeconds: Double,
)

@Serializable
data class LanguageDTO(
val decimal: String,
val digital: String,
val hours: Int,
val minutes: Int,
val name: String,
val percent: Double,
val seconds: Int,
val text: String,
@SerialName("total_seconds") val totalSeconds: Double,
)

@Serializable
data class MachineDTO(
val decimal: String,
val digital: String,
val hours: Int,
val minutes: Int,
val name: String,
val percent: Double,
val seconds: Int,
val text: String,
@SerialName("machine_name_id") val machineNameId: String,
@SerialName("total_seconds") val totalSeconds: Double,
)

@Serializable
data class OperatingSystemDTO(
val decimal: String,
val digital: String,
val hours: Int,
val minutes: Int,
val name: String,
val percent: Double,
val seconds: Int,
val text: String,
@SerialName("total_seconds") val totalSeconds: Double,
)

@Serializable
data class EntityDTO(
val decimal: String,
val digital: String,
val hours: Int,
val minutes: Int,
val name: String,
val percent: Double,
val seconds: Int,
val text: String,
val type: String,
@SerialName("total_seconds") val totalSeconds: Double,
)

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ data class ProjectDTO(
val text: String,
@SerialName("total_seconds") val totalSeconds: Double,
) {

fun isUnknownProject() =
name == "Unknown Project"
val isUnknownProject = name == "Unknown Project"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.jacob.wakatimeapp.core.common.data.dtos

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class ProjectDetailsDTO(
val data: List<DataDTO>,
val page: Int,
val total: Int,
@SerialName("next_page") val nextPage: Int,
@SerialName("prev_page") val prevPage: Int,
@SerialName("total_pages") val totalPages: Int,
) {
@Serializable
data class DataDTO(
val id: String,
val name: String,
val repository: RepositoryDTO?,
val url: String,
@SerialName("created_at") val createdAt: String,
@SerialName("human_readable_last_heartbeat_at") val humanReadableLastHeartbeatAt: String,
@SerialName("last_heartbeat_at") val lastHeartbeatAt: String,
) {
@Serializable
data class RepositoryDTO(
val description: String?,
val name: String,
@SerialName("created_at") val createdAt: String,
@SerialName("full_name") val fullName: String,
@SerialName("html_url") val htmlUrl: String,
@SerialName("last_synced_at") val lastSyncedAt: String?,
@SerialName("modified_at") val modifiedAt: String,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.jacob.wakatimeapp.core.common.di

import android.content.Context
import com.jacob.wakatimeapp.core.common.utils.DefaultInstantProvider
import com.jacob.wakatimeapp.core.common.utils.InstantProvider
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -13,14 +16,22 @@ import net.openid.appauth.AuthorizationService

@Module
@InstallIn(SingletonComponent::class)
object CommonModule {
@Singleton
@Provides
@Suppress("InjectDispatcher")
fun provideCoroutineContext(): CoroutineContext = Dispatchers.IO
@Suppress("UnnecessaryAbstractClass")
abstract class CommonModule {

@Singleton
@Provides
fun provideAuthorizationService(@ApplicationContext context: Context) =
AuthorizationService(context)
@Binds
abstract fun provideInstantProvider(impl: DefaultInstantProvider): InstantProvider

companion object {

@Singleton
@Provides
@Suppress("InjectDispatcher")
fun provideCoroutineContext(): CoroutineContext = Dispatchers.IO

@Singleton
@Provides
fun provideAuthorizationService(@ApplicationContext context: Context) =
AuthorizationService(context)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jacob.wakatimeapp.home.domain
package com.jacob.wakatimeapp.core.common.utils

import javax.inject.Inject
import kotlinx.datetime.Clock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.jacob.wakatimeapp.core.models

@Deprecated("Too vague, totalTime and range properties can be derived from dailyStats property")
data class Stats(
val totalTime: Time,
val dailyStats: List<DailyStats>,
Expand Down
Loading