Skip to content

Commit

Permalink
-Unused Resource Impl
Browse files Browse the repository at this point in the history
  • Loading branch information
KhubaibKhan4 committed Oct 20, 2024
1 parent 15519db commit ba3a0da
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class AppActivity : ComponentActivity() {
}

private fun proceedWithTask() {
// Proceed with video download logic

}
}

Expand Down
6 changes: 3 additions & 3 deletions composeApp/src/iosMain/kotlin/org/company/app/App.ios.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ actual class VideoDownloader {

actual fun HttpClientConfig<*>.setupHttpCache() {
install(HttpCache) {
val cacheDir = File("cache_directory") // Set your desired cache directory
val cacheDir = File("cache_directory")
val cacheStorage = object : HttpCacheStorage() {
private val cache = HashMap<String, HttpCacheEntry>()

Expand All @@ -106,10 +106,10 @@ actual fun HttpClientConfig<*>.setupHttpCache() {
}

override fun store(url: Url, value: HttpCacheEntry) {
if (cache.size < 10 * 1024 * 1024) { // Check if cache size is less than 10MB
if (cache.size < 10 * 1024 * 1024) {
cache[url.toString()] = value
} else {
// Handle cache size limit, e.g., evict oldest entries or similar

}
}
}
Expand Down
8 changes: 0 additions & 8 deletions composeApp/src/jsMain/kotlin/org/company/app/App.js.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ internal actual fun ShareManager(title: String, videoUrl: String) {
window.open(url = videoUrl, "_blank")
}


private fun extractVideoId(url: String): String {
val videoIdRegex =
Regex("""(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})""")
val matchResult = videoIdRegex.find(url)
return matchResult?.groupValues?.get(1) ?: "default_video_id"
}

internal actual fun UserRegion(): String {
return js("window.navigator.language.slice(-2)")
}
Expand Down
15 changes: 0 additions & 15 deletions composeApp/src/jvmMain/kotlin/org/company/app/App.jvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,13 @@ internal actual fun provideShortCuts() {
return
}

fun splitLinkForVideoId(
url: String?,
): String {
return url?.substringAfter("v=").toString()
}

private fun openYouTubeVideo(videoUrl: String) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
Desktop.getDesktop().browse(URI(videoUrl))
}
}

@Composable
internal actual fun ShareManager(title: String, videoUrl: String) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
Desktop.getDesktop().browse(URI(videoUrl))
}
}

fun splitLinkForShotsVideoId(url: String?): String {
return url!!.split("v=").get(1)
}

internal actual fun UserRegion(): String {
val currentLocale: Locale = Locale.getDefault()
Expand Down

0 comments on commit ba3a0da

Please sign in to comment.