Maintenance Tasks, workflows, code cleanup

This commit is contained in:
shabinder 2021-05-18 20:02:33 +05:30
parent 68dc52c6a5
commit e7a983fe00
73 changed files with 305 additions and 299 deletions

35
.github/workflows/maintenance.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Maintenance
on:
workflow_dispatch:
schedule:
- cron: '*/30 * * * *' #every 30 minutes
jobs:
build:
name: Test and Build
runs-on: ubuntu-latest
steps:
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 15
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2.3.1
# Run Maintenance Tasks
- name: Android App
run: ./gradlew :maintenance-tasks:run
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
OWNER_NAME: 'Shabinder'
REPO_NAME: 'SpotiFlyer'
BRANCH_NAME: 'main'
FILE_PATH: 'README.md'
IMAGE_DESCRIPTION: 'Analytics'
COMMIT_MESSAGE: 'Analytics Updated'
TAG_NAME: 'HTI'

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ terraform.tfvars
/fastlane/README.md /fastlane/README.md
Gemfile Gemfile
Gemfile.lock Gemfile.lock
/maintenance-tasks/build/

View File

@ -77,7 +77,7 @@ android {
} }
compileOptions { compileOptions {
// Flag to enable support for the new language APIs // Flag to enable support for the new language APIs
isCoreLibraryDesugaringEnabled = true coreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
} }

View File

@ -31,9 +31,8 @@ repositories {
} }
dependencies { dependencies {
implementation("com.android.tools.build:gradle:4.2.0") implementation("com.android.tools.build:gradle:4.0.2")
implementation("org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktLint}") implementation("org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktLint}")
//implementation("io.github.gradle-nexus.publish-plugin:1.1.0")
implementation(JetBrains.Compose.gradlePlugin) implementation(JetBrains.Compose.gradlePlugin)
implementation(JetBrains.Kotlin.gradlePlugin) implementation(JetBrains.Kotlin.gradlePlugin)
implementation(JetBrains.Kotlin.serialization) implementation(JetBrains.Kotlin.serialization)

View File

@ -36,7 +36,7 @@ object Versions {
// Internet // Internet
const val ktor = "1.5.4" const val ktor = "1.5.4"
const val kotlinxSerialization = "1.2.0" const val kotlinxSerialization = "1.2.1"
// Database // Database
const val sqlDelight = "1.5.0" const val sqlDelight = "1.5.0"
@ -158,7 +158,7 @@ object JetpackDataStore {
} }
object Serialization { object Serialization {
val core = "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.kotlinxSerialization}" val json = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinxSerialization}"
} }
object SqlDelight { object SqlDelight {

View File

@ -28,7 +28,6 @@ import androidx.compose.ui.text.font.FontWeight
import com.shabinder.common.database.R import com.shabinder.common.database.R
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
actual fun montserratFont() = FontFamily( actual fun montserratFont() = FontFamily(
Font(R.font.montserrat_light, FontWeight.Light), Font(R.font.montserrat_light, FontWeight.Light),
Font(R.font.montserrat_regular, FontWeight.Normal), Font(R.font.montserrat_regular, FontWeight.Normal),

View File

@ -3,7 +3,6 @@ package com.shabinder.common.uikit
import androidx.compose.foundation.ScrollState import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp

View File

@ -10,30 +10,17 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.material.AlertDialog
import androidx.compose.material.Card import androidx.compose.material.Card
import androidx.compose.material.Icon import androidx.compose.material.Icon
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.CardGiftcard
import androidx.compose.material.icons.rounded.Share
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import com.shabinder.common.models.methods import com.shabinder.common.models.methods
import com.shabinder.common.uikit.PaypalLogo
import com.shabinder.common.uikit.RazorPay
import com.shabinder.common.uikit.SpotiFlyerShapes
import com.shabinder.common.uikit.SpotiFlyerTypography
import com.shabinder.common.uikit.colorAccent
@OptIn(ExperimentalAnimationApi::class) @OptIn(ExperimentalAnimationApi::class)
@Composable @Composable
@ -84,10 +71,12 @@ actual fun DonationDialog(
} }
Row( Row(
modifier = Modifier.fillMaxWidth().padding(top = 6.dp) modifier = Modifier.fillMaxWidth().padding(top = 6.dp)
.clickable(onClick = { .clickable(
onClick = {
onDismiss() onDismiss()
methods.value.giveDonation() methods.value.giveDonation()
}), }
),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Icon(RazorPay(), "Indian Rupee Logo", Modifier.size(32.dp), tint = Color(0xFFCCCCCC)) Icon(RazorPay(), "Indian Rupee Logo", Modifier.size(32.dp), tint = Color(0xFFCCCCCC))

View File

@ -2,7 +2,12 @@ package com.shabinder.common.uikit
import androidx.compose.animation.Crossfade import androidx.compose.animation.Crossfade
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.runtime.* import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
@ -10,7 +15,6 @@ import com.shabinder.common.di.Picture
import com.shabinder.common.di.dispatcherIO import com.shabinder.common.di.dispatcherIO
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@Composable @Composable
actual fun ImageLoad( actual fun ImageLoad(
link: String, link: String,

View File

@ -20,7 +20,6 @@ package com.shabinder.common.uikit
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.painter.Painter
import com.shabinder.common.di.Picture
@Composable @Composable
expect fun DownloadImageTick() expect fun DownloadImageTick()

View File

@ -3,7 +3,6 @@ package com.shabinder.common.uikit
import androidx.compose.foundation.ScrollState import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp

View File

@ -342,10 +342,12 @@ fun AboutColumn(
Row( Row(
modifier = modifier.fillMaxWidth().padding(vertical = 6.dp) modifier = modifier.fillMaxWidth().padding(vertical = 6.dp)
.clickable(onClick = { .clickable(
onClick = {
isDonationDialogVisible = true isDonationDialogVisible = true
donationDialogOpenEvent() donationDialogOpenEvent()
}), }
),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Icon(Icons.Rounded.CardGiftcard, "Support Developer") Icon(Icons.Rounded.CardGiftcard, "Support Developer")

View File

@ -37,15 +37,16 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.material.* import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Settings import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.rounded.ArrowBackIosNew import androidx.compose.material.icons.rounded.ArrowBackIosNew
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier

View File

@ -17,8 +17,6 @@
package com.shabinder.common.uikit package com.shabinder.common.uikit
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
enum class ToastDuration(val value: Int) { enum class ToastDuration(val value: Int) {

View File

@ -1,2 +1 @@
package com.shabinder.common.uikit.dialogs package com.shabinder.common.uikit.dialogs

View File

@ -17,27 +17,17 @@
@file:Suppress("FunctionName") @file:Suppress("FunctionName")
package com.shabinder.common.uikit package com.shabinder.common.uikit
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.vectorXmlResource import androidx.compose.ui.res.vectorXmlResource
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.platform.Font import androidx.compose.ui.text.platform.Font
import com.shabinder.common.di.Picture
import com.shabinder.common.di.dispatcherIO
import com.shabinder.common.models.methods
import kotlinx.coroutines.withContext
@Composable @Composable
actual fun DownloadImageTick() { actual fun DownloadImageTick() {

View File

@ -26,16 +26,13 @@ import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.sizeIn import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Surface import androidx.compose.material.Surface
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color

View File

@ -72,10 +72,12 @@ actual fun DonationDialog(
} }
Row( Row(
modifier = Modifier.fillMaxWidth().padding(top = 6.dp) modifier = Modifier.fillMaxWidth().padding(top = 6.dp)
.clickable(onClick = { .clickable(
onClick = {
onDismiss() onDismiss()
methods.value.giveDonation() methods.value.giveDonation()
}), }
),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Icon(RazorPay(), "Indian Rupee Logo", Modifier.size(32.dp), tint = Color(0xFFCCCCCC)) Icon(RazorPay(), "Indian Rupee Logo", Modifier.size(32.dp), tint = Color(0xFFCCCCCC))

View File

@ -1,9 +1,13 @@
package com.shabinder.common.uikit package com.shabinder.common.uikit
import androidx.compose.animation.Crossfade import androidx.compose.animation.Crossfade
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.runtime.* import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale

View File

@ -41,7 +41,6 @@ interface Actions {
fun writeMp3Tags(trackDetails: TrackDetails) fun writeMp3Tags(trackDetails: TrackDetails)
} }
private fun stubActions(): Actions = object : Actions { private fun stubActions(): Actions = object : Actions {
override val platformActions = StubPlatformActions override val platformActions = StubPlatformActions
override fun showPopUpMessage(string: String, long: Boolean) {} override fun showPopUpMessage(string: String, long: Boolean) {}

View File

@ -58,7 +58,5 @@ enum class Status constructor(val value: Int) {
else -> NONE else -> NONE
} }
} }
} }
} }

View File

@ -1,5 +1,5 @@
package com.shabinder.common.models package com.shabinder.common.models
actual interface PlatformActions {} actual interface PlatformActions
actual val StubPlatformActions = object : PlatformActions {} actual val StubPlatformActions = object : PlatformActions {}

View File

@ -2,7 +2,7 @@ package com.shabinder.common.models
import kotlin.native.concurrent.AtomicReference import kotlin.native.concurrent.AtomicReference
actual interface PlatformActions {} actual interface PlatformActions
actual val StubPlatformActions = object : PlatformActions {} actual val StubPlatformActions = object : PlatformActions {}

View File

@ -1,4 +1,4 @@
package com.shabinder.common.models package com.shabinder.common.models
actual interface PlatformActions {} actual interface PlatformActions
actual val StubPlatformActions = object : PlatformActions {} actual val StubPlatformActions = object : PlatformActions {}

View File

@ -3,8 +3,8 @@ package com.shabinder.common.database
import co.touchlab.kermit.Logger import co.touchlab.kermit.Logger
import co.touchlab.kermit.NSLogLogger import co.touchlab.kermit.NSLogLogger
import com.shabinder.database.Database import com.shabinder.database.Database
import org.koin.dsl.module
import com.squareup.sqldelight.drivers.native.NativeSqliteDriver import com.squareup.sqldelight.drivers.native.NativeSqliteDriver
import org.koin.dsl.module
@Suppress("RedundantNullableReturnType") @Suppress("RedundantNullableReturnType")
actual fun databaseModule() = module { actual fun databaseModule() = module {

View File

@ -18,7 +18,6 @@ package com.shabinder.common.database
import co.touchlab.kermit.CommonLogger import co.touchlab.kermit.CommonLogger
import co.touchlab.kermit.Logger import co.touchlab.kermit.Logger
import com.shabinder.database.Database
import org.koin.dsl.module import org.koin.dsl.module
actual fun databaseModule() = module { single { SpotiFlyerDatabase(null) } } actual fun databaseModule() = module { single { SpotiFlyerDatabase(null) } }

View File

@ -24,7 +24,10 @@ import android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET
import android.net.NetworkRequest import android.net.NetworkRequest
import android.util.Log import android.util.Log
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import kotlinx.coroutines.* import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.IOException import java.io.IOException
import java.lang.Exception import java.lang.Exception
import java.net.InetSocketAddress import java.net.InetSocketAddress

View File

@ -17,13 +17,13 @@
package com.shabinder.common.di package com.shabinder.common.di
import android.util.Log import android.util.Log
import com.shabinder.common.models.TrackDetails
import java.io.File
import com.mpatric.mp3agic.ID3v1Tag import com.mpatric.mp3agic.ID3v1Tag
import com.mpatric.mp3agic.ID3v24Tag import com.mpatric.mp3agic.ID3v24Tag
import com.mpatric.mp3agic.Mp3File import com.mpatric.mp3agic.Mp3File
import com.shabinder.common.models.DownloadResult import com.shabinder.common.models.DownloadResult
import com.shabinder.common.models.TrackDetails
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
import java.io.File
import java.io.FileInputStream import java.io.FileInputStream
fun Mp3File.removeAllTags(): Mp3File { fun Mp3File.removeAllTags(): Mp3File {

View File

@ -33,7 +33,10 @@ import android.util.Log
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import co.touchlab.kermit.Kermit import co.touchlab.kermit.Kermit
import com.shabinder.common.di.* import com.shabinder.common.di.Dir
import com.shabinder.common.di.FetchPlatformQueryResult
import com.shabinder.common.di.R
import com.shabinder.common.di.downloadFile
import com.shabinder.common.di.providers.get import com.shabinder.common.di.providers.get
import com.shabinder.common.di.utils.ParallelExecutor import com.shabinder.common.di.utils.ParallelExecutor
import com.shabinder.common.models.DownloadResult import com.shabinder.common.models.DownloadResult
@ -120,7 +123,8 @@ class ForegroundService : Service(), CoroutineScope {
val downloadObjects: ArrayList<TrackDetails>? = ( val downloadObjects: ArrayList<TrackDetails>? = (
it.getParcelableArrayListExtra("object") ?: it.extras?.getParcelableArrayList( it.getParcelableArrayListExtra("object") ?: it.extras?.getParcelableArrayList(
"object") "object"
)
) )
downloadObjects?.let { list -> downloadObjects?.let { list ->

View File

@ -37,8 +37,7 @@ fun cleanFiles(directory: AbstractFile,fm: FileManager,logger: Kermit) {
if (fm.isDirectory(file)) { if (fm.isDirectory(file)) {
cleanFiles(file, fm, logger) cleanFiles(file, fm, logger)
} else if (fm.isFile(file)) { } else if (fm.isFile(file)) {
if (file.getFullPath().substringAfterLast(".") != "mp3" if (file.getFullPath().substringAfterLast(".") != "mp3" ||
||
fm.getLength(file) == 0L fm.getLength(file) == 0L
) { ) {
logger.d("Files Cleaning") { "Cleaning ${file.getFullPath()}" } logger.d("Files Cleaning") { "Cleaning ${file.getFullPath()}" }

View File

@ -25,10 +25,13 @@ import com.shabinder.common.di.providers.SpotifyProvider
import com.shabinder.common.di.providers.YoutubeMp3 import com.shabinder.common.di.providers.YoutubeMp3
import com.shabinder.common.di.providers.YoutubeMusic import com.shabinder.common.di.providers.YoutubeMusic
import com.shabinder.common.di.providers.YoutubeProvider import com.shabinder.common.di.providers.YoutubeProvider
import io.ktor.client.* import io.ktor.client.HttpClient
import io.ktor.client.features.json.* import io.ktor.client.features.json.JsonFeature
import io.ktor.client.features.json.serializer.* import io.ktor.client.features.json.serializer.KotlinxSerializer
import io.ktor.client.features.logging.* import io.ktor.client.features.logging.DEFAULT
import io.ktor.client.features.logging.LogLevel
import io.ktor.client.features.logging.Logger
import io.ktor.client.features.logging.Logging
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import org.koin.core.context.startKoin import org.koin.core.context.startKoin
import org.koin.dsl.KoinAppDeclaration import org.koin.dsl.KoinAppDeclaration

View File

@ -23,7 +23,8 @@ import com.shabinder.common.di.utils.removeIllegalChars
import com.shabinder.common.models.DownloadResult import com.shabinder.common.models.DownloadResult
import com.shabinder.common.models.TrackDetails import com.shabinder.common.models.TrackDetails
import com.shabinder.database.Database import com.shabinder.database.Database
import io.ktor.client.request.* import io.ktor.client.request.HttpRequestBuilder
import io.ktor.client.request.get
import io.ktor.client.statement.HttpStatement import io.ktor.client.statement.HttpStatement
import io.ktor.http.contentLength import io.ktor.http.contentLength
import io.ktor.http.isSuccess import io.ktor.http.isSuccess

View File

@ -18,8 +18,7 @@ package com.shabinder.common.di
import com.shabinder.common.models.AllPlatforms import com.shabinder.common.models.AllPlatforms
import com.shabinder.common.models.TrackDetails import com.shabinder.common.models.TrackDetails
import com.shabinder.common.models.methods import io.ktor.client.request.head
import io.ktor.client.request.*
import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@ -31,7 +30,6 @@ expect suspend fun downloadTracks(
dir: Dir dir: Dir
) )
// IO-Dispatcher // IO-Dispatcher
@SharedImmutable @SharedImmutable
expect val dispatcherIO: CoroutineDispatcher expect val dispatcherIO: CoroutineDispatcher

View File

@ -21,7 +21,6 @@ import com.shabinder.common.di.Dir
import com.shabinder.common.di.currentPlatform import com.shabinder.common.di.currentPlatform
import com.shabinder.common.di.youtubeMp3.Yt1sMp3 import com.shabinder.common.di.youtubeMp3.Yt1sMp3
import com.shabinder.common.models.AllPlatforms import com.shabinder.common.models.AllPlatforms
import com.shabinder.common.models.methods
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
class YoutubeMp3( class YoutubeMp3(

View File

@ -23,7 +23,7 @@ import com.shabinder.common.models.spotify.PagingObjectPlaylistTrack
import com.shabinder.common.models.spotify.Playlist import com.shabinder.common.models.spotify.Playlist
import com.shabinder.common.models.spotify.Track import com.shabinder.common.models.spotify.Track
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.request.* import io.ktor.client.request.get
private val BASE_URL get() = "${corsApi}https://api.spotify.com/v1" private val BASE_URL get() = "${corsApi}https://api.spotify.com/v1"

View File

@ -22,7 +22,6 @@ package com.shabinder.common.di.utils
// Gist: https://gist.github.com/fluidsonic/ba32de21c156bbe8424c8d5fc20dcd8e // Gist: https://gist.github.com/fluidsonic/ba32de21c156bbe8424c8d5fc20dcd8e
import com.shabinder.common.di.dispatcherIO import com.shabinder.common.di.dispatcherIO
import com.shabinder.common.models.methods
import io.ktor.utils.io.core.Closeable import io.ktor.utils.io.core.Closeable
import kotlinx.atomicfu.atomic import kotlinx.atomicfu.atomic
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException

View File

@ -16,21 +16,16 @@
package com.shabinder.common.di.utils package com.shabinder.common.di.utils
import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.serializer
import kotlin.native.concurrent.SharedImmutable
import kotlin.native.concurrent.ThreadLocal import kotlin.native.concurrent.ThreadLocal
@ThreadLocal @ThreadLocal
val json by lazy { Json { val json by lazy {
Json {
isLenient = true isLenient = true
ignoreUnknownKeys = true ignoreUnknownKeys = true
} } }
}
/** /**
* Removing Illegal Chars from File Name * Removing Illegal Chars from File Name

View File

@ -1,6 +1,6 @@
package com.shabinder.common.di package com.shabinder.common.di
import com.shabinder.common.di.providers.getData import com.shabinder.common.di.providers.get
import com.shabinder.common.di.utils.ParallelExecutor import com.shabinder.common.di.utils.ParallelExecutor
import com.shabinder.common.models.AllPlatforms import com.shabinder.common.models.AllPlatforms
import com.shabinder.common.models.DownloadResult import com.shabinder.common.models.DownloadResult
@ -63,7 +63,7 @@ suspend fun downloadTrack(
fetcher.dir.logger.i { "LINK: $videoID -> $link" } fetcher.dir.logger.i { "LINK: $videoID -> $link" }
if (link == null) { if (link == null) {
link = fetcher.youtubeProvider.ytDownloader.getVideo(videoID).get()?.url ?: return link = fetcher.youtubeProvider.ytDownloader?.getVideo(videoID)?.get()?.url ?: return
} }
fetcher.dir.logger.i { "LINK: $videoID -> $link" } fetcher.dir.logger.i { "LINK: $videoID -> $link" }
downloadFile(link).collect { downloadFile(link).collect {

View File

@ -1,7 +1,5 @@
package com.shabinder.common.di package com.shabinder.common.di
import com.shabinder.common.models.DownloadStatus
import kotlinx.coroutines.flow.MutableSharedFlow
import org.koin.core.component.KoinComponent import org.koin.core.component.KoinComponent
import org.koin.core.component.inject import org.koin.core.component.inject

View File

@ -136,7 +136,8 @@ actual class Dir actual constructor(
actual suspend fun clearCache(): Unit = withContext(dispatcherIO) { actual suspend fun clearCache(): Unit = withContext(dispatcherIO) {
try { try {
val fileManager = NSFileManager.defaultManager val fileManager = NSFileManager.defaultManager
val paths = fileManager.contentsOfDirectoryAtURL(imageCacheURL, val paths = fileManager.contentsOfDirectoryAtURL(
imageCacheURL,
null, null,
NSDirectoryEnumerationSkipsHiddenFiles, NSDirectoryEnumerationSkipsHiddenFiles,
null null
@ -150,7 +151,6 @@ actual class Dir actual constructor(
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
} }
actual suspend fun saveFileWithMetadata( actual suspend fun saveFileWithMetadata(

View File

@ -20,7 +20,6 @@ import com.shabinder.common.models.AllPlatforms
import com.shabinder.common.models.DownloadResult import com.shabinder.common.models.DownloadResult
import com.shabinder.common.models.DownloadStatus import com.shabinder.common.models.DownloadStatus
import com.shabinder.common.models.TrackDetails import com.shabinder.common.models.TrackDetails
import com.shabinder.common.models.methods
import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow

View File

@ -68,9 +68,7 @@ interface SpotiFlyerList {
val listAnalytics: Analytics val listAnalytics: Analytics
} }
interface Analytics { interface Analytics
}
sealed class Output { sealed class Output {
object Finished : Output() object Finished : Output()

View File

@ -19,6 +19,7 @@ package com.shabinder.common.list.integration
import co.touchlab.stately.ensureNeverFrozen import co.touchlab.stately.ensureNeverFrozen
import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.value.Value import com.arkivanov.decompose.value.Value
import com.shabinder.common.caching.Cache
import com.shabinder.common.di.Picture import com.shabinder.common.di.Picture
import com.shabinder.common.di.utils.asValue import com.shabinder.common.di.utils.asValue
import com.shabinder.common.list.SpotiFlyerList import com.shabinder.common.list.SpotiFlyerList
@ -28,7 +29,6 @@ import com.shabinder.common.list.store.SpotiFlyerListStore.Intent
import com.shabinder.common.list.store.SpotiFlyerListStoreProvider import com.shabinder.common.list.store.SpotiFlyerListStoreProvider
import com.shabinder.common.list.store.getStore import com.shabinder.common.list.store.getStore
import com.shabinder.common.models.TrackDetails import com.shabinder.common.models.TrackDetails
import com.shabinder.common.caching.Cache
internal class SpotiFlyerListImpl( internal class SpotiFlyerListImpl(
componentContext: ComponentContext, componentContext: ComponentContext,

View File

@ -24,7 +24,6 @@ import com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor
import com.shabinder.common.database.getLogger import com.shabinder.common.database.getLogger
import com.shabinder.common.di.Dir import com.shabinder.common.di.Dir
import com.shabinder.common.di.FetchPlatformQueryResult import com.shabinder.common.di.FetchPlatformQueryResult
import com.shabinder.common.di.dispatcherIO
import com.shabinder.common.di.downloadTracks import com.shabinder.common.di.downloadTracks
import com.shabinder.common.list.SpotiFlyerList.State import com.shabinder.common.list.SpotiFlyerList.State
import com.shabinder.common.list.store.SpotiFlyerListStore.Intent import com.shabinder.common.list.store.SpotiFlyerListStore.Intent
@ -34,7 +33,6 @@ import com.shabinder.common.models.TrackDetails
import com.shabinder.common.models.methods import com.shabinder.common.models.methods
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.withContext
internal class SpotiFlyerListStoreProvider( internal class SpotiFlyerListStoreProvider(
private val dir: Dir, private val dir: Dir,
@ -101,7 +99,6 @@ internal class SpotiFlyerListStoreProvider(
} }
dispatch(Result.UpdateTrackList(list.updateTracksStatuses(downloadProgressFlow.replayCache.getOrElse(0) { hashMapOf() }))) dispatch(Result.UpdateTrackList(list.updateTracksStatuses(downloadProgressFlow.replayCache.getOrElse(0) { hashMapOf() })))
val finalList = val finalList =
intent.trackList.filter { it.downloaded == DownloadStatus.NotDownloaded } intent.trackList.filter { it.downloaded == DownloadStatus.NotDownloaded }
if (finalList.isNullOrEmpty()) methods.value.showPopUpMessage("All Songs are Processed") if (finalList.isNullOrEmpty()) methods.value.showPopUpMessage("All Songs are Processed")

View File

@ -19,6 +19,7 @@ package com.shabinder.common.main.integration
import co.touchlab.stately.ensureNeverFrozen import co.touchlab.stately.ensureNeverFrozen
import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.value.Value import com.arkivanov.decompose.value.Value
import com.shabinder.common.caching.Cache
import com.shabinder.common.di.Picture import com.shabinder.common.di.Picture
import com.shabinder.common.di.utils.asValue import com.shabinder.common.di.utils.asValue
import com.shabinder.common.main.SpotiFlyerMain import com.shabinder.common.main.SpotiFlyerMain
@ -30,7 +31,6 @@ import com.shabinder.common.main.store.SpotiFlyerMainStore.Intent
import com.shabinder.common.main.store.SpotiFlyerMainStoreProvider import com.shabinder.common.main.store.SpotiFlyerMainStoreProvider
import com.shabinder.common.main.store.getStore import com.shabinder.common.main.store.getStore
import com.shabinder.common.models.methods import com.shabinder.common.models.methods
import com.shabinder.common.caching.Cache
internal class SpotiFlyerMainImpl( internal class SpotiFlyerMainImpl(
componentContext: ComponentContext, componentContext: ComponentContext,

View File

@ -30,7 +30,6 @@ import com.shabinder.common.root.SpotiFlyerRoot.Dependencies
import com.shabinder.common.root.callbacks.SpotiFlyerRootCallBacks import com.shabinder.common.root.callbacks.SpotiFlyerRootCallBacks
import com.shabinder.common.root.integration.SpotiFlyerRootImpl import com.shabinder.common.root.integration.SpotiFlyerRootImpl
import com.shabinder.database.Database import com.shabinder.database.Database
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow

View File

@ -28,7 +28,7 @@ version = Versions.versionName
kotlin { kotlin {
jvm { jvm {
compilations.all { compilations.all {
kotlinOptions.jvmTarget = "14" kotlinOptions.jvmTarget = "1.8"
} }
} }

View File

@ -28,5 +28,6 @@ include(
":fuzzywuzzy:app", ":fuzzywuzzy:app",
":android", ":android",
":desktop", ":desktop",
":web-app" ":web-app",
":maintenance-tasks"
) )