mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 01:04:31 +01:00
Maintenance Tasks, workflows, code cleanup
This commit is contained in:
parent
68dc52c6a5
commit
e7a983fe00
35
.github/workflows/maintenance.yml
vendored
Normal file
35
.github/workflows/maintenance.yml
vendored
Normal 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
1
.gitignore
vendored
@ -11,3 +11,4 @@ terraform.tfvars
|
||||
/fastlane/README.md
|
||||
Gemfile
|
||||
Gemfile.lock
|
||||
/maintenance-tasks/build/
|
||||
|
@ -77,7 +77,7 @@ android {
|
||||
}
|
||||
compileOptions {
|
||||
// Flag to enable support for the new language APIs
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
coreLibraryDesugaringEnabled = true
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
@ -31,9 +31,8 @@ repositories {
|
||||
}
|
||||
|
||||
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("io.github.gradle-nexus.publish-plugin:1.1.0")
|
||||
implementation(JetBrains.Compose.gradlePlugin)
|
||||
implementation(JetBrains.Kotlin.gradlePlugin)
|
||||
implementation(JetBrains.Kotlin.serialization)
|
||||
|
@ -36,7 +36,7 @@ object Versions {
|
||||
// Internet
|
||||
const val ktor = "1.5.4"
|
||||
|
||||
const val kotlinxSerialization = "1.2.0"
|
||||
const val kotlinxSerialization = "1.2.1"
|
||||
|
||||
// Database
|
||||
const val sqlDelight = "1.5.0"
|
||||
@ -158,7 +158,7 @@ object JetpackDataStore {
|
||||
}
|
||||
|
||||
object Serialization {
|
||||
val core = "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.kotlinxSerialization}"
|
||||
val json = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinxSerialization}"
|
||||
}
|
||||
|
||||
object SqlDelight {
|
||||
|
@ -28,7 +28,6 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import com.shabinder.common.database.R
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
|
||||
actual fun montserratFont() = FontFamily(
|
||||
Font(R.font.montserrat_light, FontWeight.Light),
|
||||
Font(R.font.montserrat_regular, FontWeight.Normal),
|
||||
|
@ -3,7 +3,6 @@ package com.shabinder.common.uikit
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
@ -10,30 +10,17 @@ import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.AlertDialog
|
||||
import androidx.compose.material.Card
|
||||
import androidx.compose.material.Icon
|
||||
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.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
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)
|
||||
@Composable
|
||||
@ -84,10 +71,12 @@ actual fun DonationDialog(
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 6.dp)
|
||||
.clickable(onClick = {
|
||||
.clickable(
|
||||
onClick = {
|
||||
onDismiss()
|
||||
methods.value.giveDonation()
|
||||
}),
|
||||
}
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(RazorPay(), "Indian Rupee Logo", Modifier.size(32.dp), tint = Color(0xFFCCCCCC))
|
||||
|
@ -2,7 +2,12 @@ package com.shabinder.common.uikit
|
||||
|
||||
import androidx.compose.animation.Crossfade
|
||||
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.graphics.ImageBitmap
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
@ -10,7 +15,6 @@ import com.shabinder.common.di.Picture
|
||||
import com.shabinder.common.di.dispatcherIO
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
||||
@Composable
|
||||
actual fun ImageLoad(
|
||||
link: String,
|
||||
|
@ -20,7 +20,6 @@ package com.shabinder.common.uikit
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import com.shabinder.common.di.Picture
|
||||
|
||||
@Composable
|
||||
expect fun DownloadImageTick()
|
||||
|
@ -3,7 +3,6 @@ package com.shabinder.common.uikit
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.Dp
|
||||
|
||||
|
@ -342,10 +342,12 @@ fun AboutColumn(
|
||||
|
||||
Row(
|
||||
modifier = modifier.fillMaxWidth().padding(vertical = 6.dp)
|
||||
.clickable(onClick = {
|
||||
.clickable(
|
||||
onClick = {
|
||||
isDonationDialogVisible = true
|
||||
donationDialogOpenEvent()
|
||||
}),
|
||||
}
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(Icons.Rounded.CardGiftcard, "Support Developer")
|
||||
|
@ -37,15 +37,16 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
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.filled.Settings
|
||||
import androidx.compose.material.icons.rounded.ArrowBackIosNew
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -17,8 +17,6 @@
|
||||
package com.shabinder.common.uikit
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
enum class ToastDuration(val value: Int) {
|
||||
|
@ -1,2 +1 @@
|
||||
package com.shabinder.common.uikit.dialogs
|
||||
|
||||
|
@ -17,27 +17,17 @@
|
||||
@file:Suppress("FunctionName")
|
||||
package com.shabinder.common.uikit
|
||||
|
||||
import androidx.compose.animation.Crossfade
|
||||
import androidx.compose.foundation.Image
|
||||
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.graphics.ImageBitmap
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.vectorXmlResource
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
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
|
||||
actual fun DownloadImageTick() {
|
||||
|
@ -26,16 +26,13 @@ import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.sizeIn
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Surface
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
@ -72,10 +72,12 @@ actual fun DonationDialog(
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 6.dp)
|
||||
.clickable(onClick = {
|
||||
.clickable(
|
||||
onClick = {
|
||||
onDismiss()
|
||||
methods.value.giveDonation()
|
||||
}),
|
||||
}
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(RazorPay(), "Indian Rupee Logo", Modifier.size(32.dp), tint = Color(0xFFCCCCCC))
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.shabinder.common.uikit
|
||||
|
||||
|
||||
import androidx.compose.animation.Crossfade
|
||||
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.graphics.ImageBitmap
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
|
@ -41,7 +41,6 @@ interface Actions {
|
||||
fun writeMp3Tags(trackDetails: TrackDetails)
|
||||
}
|
||||
|
||||
|
||||
private fun stubActions(): Actions = object : Actions {
|
||||
override val platformActions = StubPlatformActions
|
||||
override fun showPopUpMessage(string: String, long: Boolean) {}
|
||||
|
@ -58,7 +58,5 @@ enum class Status constructor(val value: Int) {
|
||||
else -> NONE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
package com.shabinder.common.models
|
||||
|
||||
actual interface PlatformActions {}
|
||||
actual interface PlatformActions
|
||||
|
||||
actual val StubPlatformActions = object : PlatformActions {}
|
||||
|
@ -2,7 +2,7 @@ package com.shabinder.common.models
|
||||
|
||||
import kotlin.native.concurrent.AtomicReference
|
||||
|
||||
actual interface PlatformActions {}
|
||||
actual interface PlatformActions
|
||||
|
||||
actual val StubPlatformActions = object : PlatformActions {}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.shabinder.common.models
|
||||
|
||||
actual interface PlatformActions {}
|
||||
actual interface PlatformActions
|
||||
actual val StubPlatformActions = object : PlatformActions {}
|
@ -3,8 +3,8 @@ package com.shabinder.common.database
|
||||
import co.touchlab.kermit.Logger
|
||||
import co.touchlab.kermit.NSLogLogger
|
||||
import com.shabinder.database.Database
|
||||
import org.koin.dsl.module
|
||||
import com.squareup.sqldelight.drivers.native.NativeSqliteDriver
|
||||
import org.koin.dsl.module
|
||||
|
||||
@Suppress("RedundantNullableReturnType")
|
||||
actual fun databaseModule() = module {
|
||||
|
@ -18,7 +18,6 @@ package com.shabinder.common.database
|
||||
|
||||
import co.touchlab.kermit.CommonLogger
|
||||
import co.touchlab.kermit.Logger
|
||||
import com.shabinder.database.Database
|
||||
import org.koin.dsl.module
|
||||
|
||||
actual fun databaseModule() = module { single { SpotiFlyerDatabase(null) } }
|
||||
|
@ -24,7 +24,10 @@ import android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET
|
||||
import android.net.NetworkRequest
|
||||
import android.util.Log
|
||||
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.lang.Exception
|
||||
import java.net.InetSocketAddress
|
||||
|
@ -17,13 +17,13 @@
|
||||
package com.shabinder.common.di
|
||||
|
||||
import android.util.Log
|
||||
import com.shabinder.common.models.TrackDetails
|
||||
import java.io.File
|
||||
import com.mpatric.mp3agic.ID3v1Tag
|
||||
import com.mpatric.mp3agic.ID3v24Tag
|
||||
import com.mpatric.mp3agic.Mp3File
|
||||
import com.shabinder.common.models.DownloadResult
|
||||
import com.shabinder.common.models.TrackDetails
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
|
||||
fun Mp3File.removeAllTags(): Mp3File {
|
||||
|
@ -33,7 +33,10 @@ import android.util.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.NotificationCompat
|
||||
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.utils.ParallelExecutor
|
||||
import com.shabinder.common.models.DownloadResult
|
||||
@ -120,7 +123,8 @@ class ForegroundService : Service(), CoroutineScope {
|
||||
|
||||
val downloadObjects: ArrayList<TrackDetails>? = (
|
||||
it.getParcelableArrayListExtra("object") ?: it.extras?.getParcelableArrayList(
|
||||
"object")
|
||||
"object"
|
||||
)
|
||||
)
|
||||
|
||||
downloadObjects?.let { list ->
|
||||
|
@ -37,8 +37,7 @@ fun cleanFiles(directory: AbstractFile,fm: FileManager,logger: Kermit) {
|
||||
if (fm.isDirectory(file)) {
|
||||
cleanFiles(file, fm, logger)
|
||||
} else if (fm.isFile(file)) {
|
||||
if (file.getFullPath().substringAfterLast(".") != "mp3"
|
||||
||
|
||||
if (file.getFullPath().substringAfterLast(".") != "mp3" ||
|
||||
fm.getLength(file) == 0L
|
||||
) {
|
||||
logger.d("Files Cleaning") { "Cleaning ${file.getFullPath()}" }
|
||||
|
@ -25,10 +25,13 @@ import com.shabinder.common.di.providers.SpotifyProvider
|
||||
import com.shabinder.common.di.providers.YoutubeMp3
|
||||
import com.shabinder.common.di.providers.YoutubeMusic
|
||||
import com.shabinder.common.di.providers.YoutubeProvider
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.features.json.*
|
||||
import io.ktor.client.features.json.serializer.*
|
||||
import io.ktor.client.features.logging.*
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.features.json.JsonFeature
|
||||
import io.ktor.client.features.json.serializer.KotlinxSerializer
|
||||
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 org.koin.core.context.startKoin
|
||||
import org.koin.dsl.KoinAppDeclaration
|
||||
|
@ -23,7 +23,8 @@ import com.shabinder.common.di.utils.removeIllegalChars
|
||||
import com.shabinder.common.models.DownloadResult
|
||||
import com.shabinder.common.models.TrackDetails
|
||||
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.http.contentLength
|
||||
import io.ktor.http.isSuccess
|
||||
|
@ -18,8 +18,7 @@ package com.shabinder.common.di
|
||||
|
||||
import com.shabinder.common.models.AllPlatforms
|
||||
import com.shabinder.common.models.TrackDetails
|
||||
import com.shabinder.common.models.methods
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.request.head
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
@ -31,7 +30,6 @@ expect suspend fun downloadTracks(
|
||||
dir: Dir
|
||||
)
|
||||
|
||||
|
||||
// IO-Dispatcher
|
||||
@SharedImmutable
|
||||
expect val dispatcherIO: CoroutineDispatcher
|
||||
|
@ -21,7 +21,6 @@ import com.shabinder.common.di.Dir
|
||||
import com.shabinder.common.di.currentPlatform
|
||||
import com.shabinder.common.di.youtubeMp3.Yt1sMp3
|
||||
import com.shabinder.common.models.AllPlatforms
|
||||
import com.shabinder.common.models.methods
|
||||
import io.ktor.client.HttpClient
|
||||
|
||||
class YoutubeMp3(
|
||||
|
@ -23,7 +23,7 @@ import com.shabinder.common.models.spotify.PagingObjectPlaylistTrack
|
||||
import com.shabinder.common.models.spotify.Playlist
|
||||
import com.shabinder.common.models.spotify.Track
|
||||
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"
|
||||
|
||||
|
@ -22,7 +22,6 @@ package com.shabinder.common.di.utils
|
||||
// Gist: https://gist.github.com/fluidsonic/ba32de21c156bbe8424c8d5fc20dcd8e
|
||||
|
||||
import com.shabinder.common.di.dispatcherIO
|
||||
import com.shabinder.common.models.methods
|
||||
import io.ktor.utils.io.core.Closeable
|
||||
import kotlinx.atomicfu.atomic
|
||||
import kotlinx.coroutines.CancellationException
|
||||
|
@ -16,21 +16,16 @@
|
||||
|
||||
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.serializer
|
||||
import kotlin.native.concurrent.SharedImmutable
|
||||
import kotlin.native.concurrent.ThreadLocal
|
||||
|
||||
@ThreadLocal
|
||||
val json by lazy { Json {
|
||||
val json by lazy {
|
||||
Json {
|
||||
isLenient = true
|
||||
ignoreUnknownKeys = true
|
||||
} }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removing Illegal Chars from File Name
|
||||
|
@ -1,6 +1,6 @@
|
||||
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.models.AllPlatforms
|
||||
import com.shabinder.common.models.DownloadResult
|
||||
@ -63,7 +63,7 @@ suspend fun downloadTrack(
|
||||
|
||||
fetcher.dir.logger.i { "LINK: $videoID -> $link" }
|
||||
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" }
|
||||
downloadFile(link).collect {
|
||||
|
@ -1,7 +1,5 @@
|
||||
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.inject
|
||||
|
||||
|
@ -136,7 +136,8 @@ actual class Dir actual constructor(
|
||||
actual suspend fun clearCache(): Unit = withContext(dispatcherIO) {
|
||||
try {
|
||||
val fileManager = NSFileManager.defaultManager
|
||||
val paths = fileManager.contentsOfDirectoryAtURL(imageCacheURL,
|
||||
val paths = fileManager.contentsOfDirectoryAtURL(
|
||||
imageCacheURL,
|
||||
null,
|
||||
NSDirectoryEnumerationSkipsHiddenFiles,
|
||||
null
|
||||
@ -150,7 +151,6 @@ actual class Dir actual constructor(
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
actual suspend fun saveFileWithMetadata(
|
||||
|
@ -20,7 +20,6 @@ import com.shabinder.common.models.AllPlatforms
|
||||
import com.shabinder.common.models.DownloadResult
|
||||
import com.shabinder.common.models.DownloadStatus
|
||||
import com.shabinder.common.models.TrackDetails
|
||||
import com.shabinder.common.models.methods
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
|
@ -68,9 +68,7 @@ interface SpotiFlyerList {
|
||||
val listAnalytics: Analytics
|
||||
}
|
||||
|
||||
interface Analytics {
|
||||
|
||||
}
|
||||
interface Analytics
|
||||
|
||||
sealed class Output {
|
||||
object Finished : Output()
|
||||
|
@ -19,6 +19,7 @@ package com.shabinder.common.list.integration
|
||||
import co.touchlab.stately.ensureNeverFrozen
|
||||
import com.arkivanov.decompose.ComponentContext
|
||||
import com.arkivanov.decompose.value.Value
|
||||
import com.shabinder.common.caching.Cache
|
||||
import com.shabinder.common.di.Picture
|
||||
import com.shabinder.common.di.utils.asValue
|
||||
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.getStore
|
||||
import com.shabinder.common.models.TrackDetails
|
||||
import com.shabinder.common.caching.Cache
|
||||
|
||||
internal class SpotiFlyerListImpl(
|
||||
componentContext: ComponentContext,
|
||||
|
@ -24,7 +24,6 @@ import com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor
|
||||
import com.shabinder.common.database.getLogger
|
||||
import com.shabinder.common.di.Dir
|
||||
import com.shabinder.common.di.FetchPlatformQueryResult
|
||||
import com.shabinder.common.di.dispatcherIO
|
||||
import com.shabinder.common.di.downloadTracks
|
||||
import com.shabinder.common.list.SpotiFlyerList.State
|
||||
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 kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
internal class SpotiFlyerListStoreProvider(
|
||||
private val dir: Dir,
|
||||
@ -101,7 +99,6 @@ internal class SpotiFlyerListStoreProvider(
|
||||
}
|
||||
dispatch(Result.UpdateTrackList(list.updateTracksStatuses(downloadProgressFlow.replayCache.getOrElse(0) { hashMapOf() })))
|
||||
|
||||
|
||||
val finalList =
|
||||
intent.trackList.filter { it.downloaded == DownloadStatus.NotDownloaded }
|
||||
if (finalList.isNullOrEmpty()) methods.value.showPopUpMessage("All Songs are Processed")
|
||||
|
@ -19,6 +19,7 @@ package com.shabinder.common.main.integration
|
||||
import co.touchlab.stately.ensureNeverFrozen
|
||||
import com.arkivanov.decompose.ComponentContext
|
||||
import com.arkivanov.decompose.value.Value
|
||||
import com.shabinder.common.caching.Cache
|
||||
import com.shabinder.common.di.Picture
|
||||
import com.shabinder.common.di.utils.asValue
|
||||
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.getStore
|
||||
import com.shabinder.common.models.methods
|
||||
import com.shabinder.common.caching.Cache
|
||||
|
||||
internal class SpotiFlyerMainImpl(
|
||||
componentContext: ComponentContext,
|
||||
|
@ -30,7 +30,6 @@ import com.shabinder.common.root.SpotiFlyerRoot.Dependencies
|
||||
import com.shabinder.common.root.callbacks.SpotiFlyerRootCallBacks
|
||||
import com.shabinder.common.root.integration.SpotiFlyerRootImpl
|
||||
import com.shabinder.database.Database
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
|
@ -28,7 +28,7 @@ version = Versions.versionName
|
||||
kotlin {
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions.jvmTarget = "14"
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,5 +28,6 @@ include(
|
||||
":fuzzywuzzy:app",
|
||||
":android",
|
||||
":desktop",
|
||||
":web-app"
|
||||
":web-app",
|
||||
":maintenance-tasks"
|
||||
)
|
Loading…
Reference in New Issue
Block a user