mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-25 02:14:32 +01:00
Build Fixes and more
This commit is contained in:
parent
ba9f3a36aa
commit
363f0663c7
@ -91,8 +91,7 @@ class MainActivity : ComponentActivity() {
|
||||
private val trackStatusFlow = MutableSharedFlow<HashMap<String, DownloadStatus>>(1)
|
||||
private var permissionGranted = mutableStateOf(true)
|
||||
private val internetAvailability by lazy { ConnectionLiveData(applicationContext) }
|
||||
|
||||
private val rootComponent = spotiFlyerRoot(defaultComponentContext())
|
||||
private lateinit var rootComponent: SpotiFlyerRoot
|
||||
// private val visibleChild get(): SpotiFlyerRoot.Child = root.routerState.value.activeChild.instance
|
||||
|
||||
// Variable for storing instance of our service class
|
||||
@ -105,7 +104,7 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
// This app draws behind the system bars, so we want to handle fitting system windows
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
|
||||
rootComponent = spotiFlyerRoot(defaultComponentContext())
|
||||
setContent {
|
||||
SpotiFlyerTheme {
|
||||
Surface(contentColor = colorOffWhite) {
|
||||
|
@ -51,15 +51,15 @@ internal class AndroidAnalyticsManager(private val mainActivity: Activity) : Ana
|
||||
Countly.sharedInstance().consent().removeConsentAll()
|
||||
}
|
||||
|
||||
override fun sendView(name: String, extras: Map<String, Any>) {
|
||||
override fun sendView(name: String, extras: MutableMap<String, Any>) {
|
||||
Countly.sharedInstance().views().recordView(name, extras)
|
||||
}
|
||||
|
||||
override fun sendEvent(eventName: String, extras: Map<String, Any>) {
|
||||
override fun sendEvent(eventName: String, extras: MutableMap<String, Any>) {
|
||||
Countly.sharedInstance().events().recordEvent(eventName, extras)
|
||||
}
|
||||
|
||||
override fun sendCrashReport(error: Throwable, extras: Map<String, Any>) {
|
||||
override fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any>) {
|
||||
Countly.sharedInstance().crashes().recordUnhandledException(error, extras)
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +145,7 @@ class AndroidFileManager(
|
||||
}
|
||||
SuspendableEvent.success(trackDetails.outputFilePath)
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
if (songFile.exists()) songFile.delete()
|
||||
logger.e { "${songFile.absolutePath} could not be created" }
|
||||
SuspendableEvent.error(e)
|
||||
|
@ -15,9 +15,9 @@ class AndroidMediaConverter : MediaConverter() {
|
||||
progressCallbacks: (Long) -> Unit,
|
||||
) = executeSafelyInPool {
|
||||
val kbpsArg = if (audioQuality == AudioQuality.UNKNOWN) "" else "-b:a ${audioQuality.kbps}k"
|
||||
|
||||
// -acodec libmp3lame
|
||||
val session = FFmpegKit.execute(
|
||||
"-i $inputFilePath -y $kbpsArg -acodec libmp3lame -vn $outputFilePath"
|
||||
"-i $inputFilePath -y $kbpsArg -vn $outputFilePath"
|
||||
)
|
||||
|
||||
when (session.returnCode.value) {
|
||||
|
@ -9,10 +9,10 @@ interface AnalyticsManager {
|
||||
fun giveConsent()
|
||||
fun isTracking(): Boolean
|
||||
fun revokeConsent()
|
||||
fun sendView(name: String, extras: Map<String, Any> = emptyMap())
|
||||
fun sendEvent(eventName: String, extras: Map<String, Any> = emptyMap())
|
||||
fun sendView(name: String, extras: MutableMap<String, Any> = mutableMapOf())
|
||||
fun sendEvent(eventName: String, extras: MutableMap<String, Any> = mutableMapOf())
|
||||
fun track(event: AnalyticsAction) = event.track(this)
|
||||
fun sendCrashReport(error: Throwable, extras: Map<String, Any> = emptyMap())
|
||||
fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any> = mutableMapOf())
|
||||
|
||||
companion object {
|
||||
abstract class AnalyticsAction {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.shabinder.common.core_components.analytics
|
||||
|
||||
sealed class AnalyticsEvent(private val eventName: String, private val extras: Map<String, Any> = emptyMap()): AnalyticsManager.Companion.AnalyticsAction() {
|
||||
sealed class AnalyticsEvent(private val eventName: String, private val extras: MutableMap<String, Any> = mutableMapOf()): AnalyticsManager.Companion.AnalyticsAction() {
|
||||
|
||||
override fun track(analyticsManager: AnalyticsManager) = analyticsManager.sendEvent(eventName,extras)
|
||||
|
||||
|
@ -2,7 +2,7 @@ package com.shabinder.common.core_components.analytics
|
||||
|
||||
import com.shabinder.common.core_components.analytics.AnalyticsManager.Companion.AnalyticsAction
|
||||
|
||||
sealed class AnalyticsView(private val viewName: String, private val extras: Map<String, Any> = emptyMap()) : AnalyticsAction() {
|
||||
sealed class AnalyticsView(private val viewName: String, private val extras: MutableMap<String, Any> = mutableMapOf()) : AnalyticsAction() {
|
||||
override fun track(analyticsManager: AnalyticsManager) = analyticsManager.sendView(viewName,extras)
|
||||
|
||||
object HomeScreen: AnalyticsView("home_screen")
|
||||
|
@ -43,21 +43,21 @@ internal class DesktopAnalyticsManager(
|
||||
Countly.onConsentRemoval(*featuresSet)
|
||||
}
|
||||
|
||||
override fun sendView(name: String, extras: Map<String, Any>) {
|
||||
override fun sendView(name: String, extras: MutableMap<String, Any>) {
|
||||
Countly.api().view(name)
|
||||
}
|
||||
|
||||
override fun sendEvent(eventName: String, extras: Map<String, Any>) {
|
||||
override fun sendEvent(eventName: String, extras: MutableMap<String, Any>) {
|
||||
Countly.api().event(eventName)
|
||||
.setSegmentation(extras.filterValues { it is String } as? Map<String, String> ?: emptyMap()).record()
|
||||
.setSegmentation(extras.filterValues { it is String } as? MutableMap<String, String> ?: emptyMap()).record()
|
||||
}
|
||||
|
||||
override fun sendCrashReport(error: Throwable, extras: Map<String, Any>) {
|
||||
override fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any>) {
|
||||
Countly.api().addCrashReport(
|
||||
error,
|
||||
extras.getOrDefault("fatal", true) as Boolean,
|
||||
error.javaClass.simpleName,
|
||||
extras.filterValues { it is String } as? Map<String, String> ?: emptyMap()
|
||||
extras.filterValues { it is String } as? MutableMap<String, String> ?: emptyMap()
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,11 @@ private val webAnalytics =
|
||||
|
||||
override fun revokeConsent() {}
|
||||
|
||||
override fun sendView(name: String, extras: Map<String, Any>) {}
|
||||
override fun sendView(name: String, extras: MutableMap<String, Any>) {}
|
||||
|
||||
override fun sendEvent(eventName: String, extras: Map<String, Any>) {}
|
||||
override fun sendEvent(eventName: String, extras: MutableMap<String, Any>) {}
|
||||
|
||||
override fun sendCrashReport(error: Throwable, extras: Map<String, Any>) {}
|
||||
override fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any>) {}
|
||||
}
|
||||
|
||||
actual fun analyticsModule() = module {
|
||||
|
@ -124,6 +124,7 @@ class FetchPlatformQueryResult(
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
// if videoID wasn't present || fetching using video ID failed
|
||||
if (downloadLink.isNullOrBlank()) {
|
||||
|
||||
@ -144,7 +145,6 @@ class FetchPlatformQueryResult(
|
||||
downloadLink = queryResult.component1()
|
||||
}
|
||||
}
|
||||
}
|
||||
return if (downloadLink.isNullOrBlank()) SuspendableEvent.error(
|
||||
SpotiFlyerException.DownloadLinkFetchFailed(errorTrace)
|
||||
) else SuspendableEvent.success(downloadLink.requireNotNull())
|
||||
|
Loading…
Reference in New Issue
Block a user