Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
refactor: improve project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed May 2, 2024
1 parent 7e8b745 commit 906d1f5
Show file tree
Hide file tree
Showing 114 changed files with 408 additions and 376 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

</activity>
<service
android:name="app.suhasdissa.vibeyou.backend.services.PlayerService"
android:name="app.suhasdissa.vibeyou.utils.services.PlayerService"
android:exported="true"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/suhasdissa/vibeyou/AppContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package app.suhasdissa.vibeyou

import android.content.ContentResolver
import androidx.media3.session.MediaController
import app.suhasdissa.vibeyou.backend.database.SongDatabase
import app.suhasdissa.vibeyou.backend.repository.AuthRepository
import app.suhasdissa.vibeyou.backend.repository.AuthRepositoryImpl
import app.suhasdissa.vibeyou.backend.repository.LocalMusicRepository
import app.suhasdissa.vibeyou.backend.repository.PipedMusicRepository
import app.suhasdissa.vibeyou.backend.repository.PlaylistRepository
import app.suhasdissa.vibeyou.backend.repository.SongDatabaseRepository
import app.suhasdissa.vibeyou.backend.repository.SongDatabaseRepositoryImpl
import app.suhasdissa.vibeyou.data.database.SongDatabase
import com.google.common.util.concurrent.ListenableFuture

interface AppContainer {
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/app/suhasdissa/vibeyou/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ import androidx.compose.ui.graphics.toArgb
import androidx.core.net.toUri
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.compose.rememberNavController
import app.suhasdissa.vibeyou.backend.viewmodel.PlayerViewModel
import app.suhasdissa.vibeyou.backend.viewmodel.SettingsModel
import app.suhasdissa.vibeyou.ui.components.NavDrawerContent
import app.suhasdissa.vibeyou.navigation.AppNavHost
import app.suhasdissa.vibeyou.navigation.Destination
import app.suhasdissa.vibeyou.navigation.navigateTo
import app.suhasdissa.vibeyou.presentation.components.NavDrawerContent
import app.suhasdissa.vibeyou.presentation.screens.player.model.PlayerViewModel
import app.suhasdissa.vibeyou.presentation.screens.settings.model.SettingsModel
import app.suhasdissa.vibeyou.ui.theme.VibeYouTheme
import app.suhasdissa.vibeyou.utils.ThemeUtil
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import android.content.ComponentName
import android.graphics.Color
import androidx.media3.session.MediaController
import androidx.media3.session.SessionToken
import app.suhasdissa.vibeyou.backend.data.EqualizerData
import app.suhasdissa.vibeyou.backend.database.SongDatabase
import app.suhasdissa.vibeyou.backend.services.PlayerService
import app.suhasdissa.vibeyou.data.database.SongDatabase
import app.suhasdissa.vibeyou.domain.models.primary.EqualizerData
import app.suhasdissa.vibeyou.utils.Pref
import app.suhasdissa.vibeyou.utils.UpdateUtil
import app.suhasdissa.vibeyou.utils.preferences
import app.suhasdissa.vibeyou.utils.services.PlayerService
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.disk.DiskCache
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.api
package app.suhasdissa.vibeyou.data.api

import app.suhasdissa.vibeyou.backend.models.hyper.NextSongsResponse
import retrofit2.http.GET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.api
package app.suhasdissa.vibeyou.data.api

import app.suhasdissa.vibeyou.backend.models.Login
import app.suhasdissa.vibeyou.backend.models.PipedInstance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package app.suhasdissa.vibeyou.backend.database
package app.suhasdissa.vibeyou.data.database

import android.content.Context
import androidx.room.AutoMigration
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import app.suhasdissa.vibeyou.backend.database.dao.PlaylistDao
import app.suhasdissa.vibeyou.backend.database.dao.RawDao
import app.suhasdissa.vibeyou.backend.database.dao.SearchDao
import app.suhasdissa.vibeyou.backend.database.dao.SongsDao
import app.suhasdissa.vibeyou.backend.database.entities.PlaylistEntity
import app.suhasdissa.vibeyou.backend.database.entities.SearchQuery
import app.suhasdissa.vibeyou.backend.database.entities.SongEntity
import app.suhasdissa.vibeyou.backend.database.entities.SongPlaylistMap
import app.suhasdissa.vibeyou.data.database.dao.PlaylistDao
import app.suhasdissa.vibeyou.data.database.dao.RawDao
import app.suhasdissa.vibeyou.data.database.dao.SearchDao
import app.suhasdissa.vibeyou.data.database.dao.SongsDao
import app.suhasdissa.vibeyou.data.database.entities.PlaylistEntity
import app.suhasdissa.vibeyou.data.database.entities.SearchQuery
import app.suhasdissa.vibeyou.data.database.entities.SongEntity
import app.suhasdissa.vibeyou.data.database.entities.SongPlaylistMap

@Database(
entities = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package app.suhasdissa.vibeyou.backend.database.dao
package app.suhasdissa.vibeyou.data.database.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import app.suhasdissa.vibeyou.backend.database.entities.PlaylistEntity
import app.suhasdissa.vibeyou.backend.database.entities.PlaylistWithSongs
import app.suhasdissa.vibeyou.backend.database.entities.SongPlaylistMap
import app.suhasdissa.vibeyou.data.database.entities.PlaylistEntity
import app.suhasdissa.vibeyou.data.database.entities.PlaylistWithSongs
import app.suhasdissa.vibeyou.data.database.entities.SongPlaylistMap
import kotlinx.coroutines.flow.Flow

@Dao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.database.dao
package app.suhasdissa.vibeyou.data.database.dao

import androidx.room.Dao
import androidx.room.RawQuery
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package app.suhasdissa.vibeyou.backend.database.dao
package app.suhasdissa.vibeyou.data.database.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import app.suhasdissa.vibeyou.backend.database.entities.SearchQuery
import app.suhasdissa.vibeyou.data.database.entities.SearchQuery

@Dao
interface SearchDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package app.suhasdissa.vibeyou.backend.database.dao
package app.suhasdissa.vibeyou.data.database.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import app.suhasdissa.vibeyou.backend.database.entities.SongEntity
import app.suhasdissa.vibeyou.data.database.entities.SongEntity
import kotlinx.coroutines.flow.Flow

@Dao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package app.suhasdissa.vibeyou.backend.database.entities
package app.suhasdissa.vibeyou.data.database.entities

import androidx.room.Entity
import androidx.room.PrimaryKey
import app.suhasdissa.vibeyou.backend.data.Album
import app.suhasdissa.vibeyou.domain.models.primary.Album

@Entity(tableName = "playlists")
data class PlaylistEntity(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.database.entities
package app.suhasdissa.vibeyou.data.database.entities

import androidx.room.Embedded
import androidx.room.Junction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.database.entities
package app.suhasdissa.vibeyou.data.database.entities

import androidx.room.Entity
import androidx.room.Index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.database.entities
package app.suhasdissa.vibeyou.data.database.entities

import androidx.room.ColumnInfo
import androidx.room.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.database.entities
package app.suhasdissa.vibeyou.data.database.entities

import androidx.room.ColumnInfo
import androidx.room.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package app.suhasdissa.vibeyou.backend.models.hyper

import androidx.core.net.toUri
import app.suhasdissa.vibeyou.data.database.entities.SongEntity
import app.suhasdissa.vibeyou.domain.models.primary.Song
import kotlinx.serialization.Serializable

@Serializable
data class Song(
val id: String,
val subtitle: String,
val thumbnails: List<Thumbnail>,
val title: String
) {
val asSong: Song
get() {
return Song(
id = id,
title = title,
artistsText = subtitle,
durationText = null,
thumbnailUri = thumbnails.maxByOrNull { it.height }?.url?.toUri()
)
}

val asSongEntity: SongEntity
get() {
return SongEntity(
id = id,
title = title,
artistsText = subtitle,
durationText = null,
thumbnailUrl = thumbnails.maxByOrNull { it.height }?.url
)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.data
package app.suhasdissa.vibeyou.domain.models.primary

import android.net.Uri

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.data
package app.suhasdissa.vibeyou.domain.models.primary

import android.net.Uri

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.data
package app.suhasdissa.vibeyou.domain.models.primary

data class EqualizerBand(
val frequency: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou.backend.data
package app.suhasdissa.vibeyou.domain.models.primary

import android.net.Uri

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import android.os.Environment.getExternalStorageDirectory
import android.provider.MediaStore
import android.text.format.DateUtils
import androidx.core.net.toUri
import app.suhasdissa.vibeyou.backend.data.Album
import app.suhasdissa.vibeyou.backend.data.Artist
import app.suhasdissa.vibeyou.backend.data.Song
import app.suhasdissa.vibeyou.backend.database.dao.SearchDao
import app.suhasdissa.vibeyou.backend.database.entities.SearchQuery
import app.suhasdissa.vibeyou.data.database.dao.SearchDao
import app.suhasdissa.vibeyou.data.database.entities.SearchQuery
import app.suhasdissa.vibeyou.domain.models.primary.Album
import app.suhasdissa.vibeyou.domain.models.primary.Artist
import app.suhasdissa.vibeyou.domain.models.primary.Song
import app.suhasdissa.vibeyou.utils.Pref
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package app.suhasdissa.vibeyou.backend.repository
import android.net.Uri
import android.util.Log
import androidx.core.net.toUri
import app.suhasdissa.vibeyou.backend.data.Album
import app.suhasdissa.vibeyou.backend.data.Artist
import app.suhasdissa.vibeyou.backend.data.Song
import app.suhasdissa.vibeyou.backend.database.dao.SearchDao
import app.suhasdissa.vibeyou.backend.database.dao.SongsDao
import app.suhasdissa.vibeyou.backend.database.entities.SearchQuery
import app.suhasdissa.vibeyou.backend.models.SearchFilter
import app.suhasdissa.vibeyou.backend.models.artists.Channel
import app.suhasdissa.vibeyou.backend.models.artists.ChannelTab
import app.suhasdissa.vibeyou.backend.models.playlists.PlaylistInfo
import app.suhasdissa.vibeyou.data.database.dao.SearchDao
import app.suhasdissa.vibeyou.data.database.dao.SongsDao
import app.suhasdissa.vibeyou.data.database.entities.SearchQuery
import app.suhasdissa.vibeyou.domain.models.primary.Album
import app.suhasdissa.vibeyou.domain.models.primary.Artist
import app.suhasdissa.vibeyou.domain.models.primary.Song
import app.suhasdissa.vibeyou.utils.Pref
import app.suhasdissa.vibeyou.utils.RetrofitHelper
import app.suhasdissa.vibeyou.utils.asAlbum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package app.suhasdissa.vibeyou.backend.repository

import app.suhasdissa.vibeyou.backend.data.Album
import app.suhasdissa.vibeyou.backend.data.Song
import app.suhasdissa.vibeyou.backend.database.dao.PlaylistDao
import app.suhasdissa.vibeyou.backend.database.dao.SongsDao
import app.suhasdissa.vibeyou.backend.database.entities.PlaylistEntity
import app.suhasdissa.vibeyou.backend.database.entities.PlaylistWithSongs
import app.suhasdissa.vibeyou.backend.database.entities.SongPlaylistMap
import app.suhasdissa.vibeyou.data.database.dao.PlaylistDao
import app.suhasdissa.vibeyou.data.database.dao.SongsDao
import app.suhasdissa.vibeyou.data.database.entities.PlaylistEntity
import app.suhasdissa.vibeyou.data.database.entities.PlaylistWithSongs
import app.suhasdissa.vibeyou.data.database.entities.SongPlaylistMap
import app.suhasdissa.vibeyou.domain.models.primary.Album
import app.suhasdissa.vibeyou.domain.models.primary.Song
import app.suhasdissa.vibeyou.utils.asPlaylistEntity
import app.suhasdissa.vibeyou.utils.asSongEntity
import kotlinx.coroutines.Dispatchers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app.suhasdissa.vibeyou.backend.repository

import app.suhasdissa.vibeyou.backend.data.Song
import app.suhasdissa.vibeyou.backend.database.entities.SongEntity
import app.suhasdissa.vibeyou.data.database.entities.SongEntity
import app.suhasdissa.vibeyou.domain.models.primary.Song
import kotlinx.coroutines.flow.Flow

interface SongDatabaseRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package app.suhasdissa.vibeyou.backend.repository

import app.suhasdissa.vibeyou.backend.data.Song
import app.suhasdissa.vibeyou.backend.database.dao.SongsDao
import app.suhasdissa.vibeyou.backend.database.entities.SongEntity
import app.suhasdissa.vibeyou.data.database.dao.SongsDao
import app.suhasdissa.vibeyou.data.database.entities.SongEntity
import app.suhasdissa.vibeyou.domain.models.primary.Song
import app.suhasdissa.vibeyou.utils.asSong
import app.suhasdissa.vibeyou.utils.asSongEntity
import kotlinx.coroutines.flow.Flow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.suhasdissa.vibeyou
package app.suhasdissa.vibeyou.navigation

sealed class Destination(val route: String) {
object PipedMusic : Destination("piped_music")
Expand Down
Loading

0 comments on commit 906d1f5

Please sign in to comment.