Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #10

Merged
merged 4 commits into from
Oct 27, 2024
Merged

Dev #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ android {
applicationId "com.myAllVideoBrowser"
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode 2
versionName "0.0.2"
versionCode 3
versionName "0.0.3"
testInstrumentationRunner "util.TestRunner"
javaCompileOptions {
annotationProcessorOptions {
Expand Down Expand Up @@ -119,7 +119,7 @@ dependencies {

// optional - GCMNetworkManager support
implementation('androidx.work:work-gcm:2.9.1')
implementation 'androidx.fragment:fragment-ktx:1.8.2'
implementation 'androidx.fragment:fragment-ktx:1.8.4'
// optional - Test helpers
androidTestImplementation('androidx.work:work-testing:2.9.1')

Expand All @@ -128,9 +128,6 @@ dependencies {

implementation 'androidx.legacy:legacy-support-v4:1.0.0'

implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.4'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4'

implementation('androidx.concurrent:concurrent-futures-ktx:1.2.0')

// Testing
Expand All @@ -148,7 +145,9 @@ dependencies {

// Life cycle
implementation deps.lifecycle.extensions
implementation 'androidx.lifecycle:lifecycle-common-java8:2.8.4'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.8.6'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.6'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.6'
testImplementation 'androidx.arch.core:core-testing:2.2.0'
androidTestImplementation 'androidx.arch.core:core-testing:2.2.0'

Expand Down Expand Up @@ -191,17 +190,14 @@ dependencies {
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version)
implementation 'io.reactivex.rxjava3:rxjava:3.1.8'
implementation 'io.reactivex.rxjava3:rxjava:3.1.9'

implementation 'com.github.farimarwat.youtubedl-android:ffmpeg:1.0.22'
implementation 'com.github.farimarwat.youtubedl-android:library:1.0.22'
implementation 'com.github.farimarwat.youtubedl-android:common:1.0.22'
// implementation 'com.github.farimarwat.youtubedl-android:ffmpeg:1.0.22'
// implementation 'com.github.farimarwat.youtubedl-android:library:1.0.22'
// implementation 'com.github.farimarwat.youtubedl-android:common:1.0.22'

// implementation 'com.github.yausername.youtubedl-android:library:-SNAPSHOT'
//
// implementation 'com.github.yausername.youtubedl-android:ffmpeg:-SNAPSHOT'
//
// implementation 'com.github.yausername.youtubedl-android:aria2c:-SNAPSHOT'
implementation("io.github.junkfood02.youtubedl-android:library:0.17.1")
implementation("io.github.junkfood02.youtubedl-android:ffmpeg:0.17.1")

implementation 'com.github.bumptech.glide:glide:4.16.0'

Expand All @@ -211,7 +207,7 @@ dependencies {

implementation 'androidx.core:core-ktx:1.13.1'

implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3'

implementation 'org.jsoup:jsoup:1.18.1'

Expand All @@ -221,7 +217,7 @@ dependencies {

implementation 'commons-lang:commons-lang:2.6'

var media3_version = '1.4.0'
var media3_version = '1.4.1'

// For media playback using ExoPlayer
implementation "androidx.media3:media3-exoplayer:$media3_version"
Expand Down
19 changes: 10 additions & 9 deletions app/src/main/java/com/myAllVideoBrowser/DLApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ open class DLApplication : DaggerApplication() {
@Inject
lateinit var workerFactory: DaggerWorkerFactory

@Inject
lateinit var sharedPrefHelper: SharedPrefHelper

@Inject
lateinit var fileUtil: FileUtil

Expand All @@ -48,7 +51,7 @@ open class DLApplication : DaggerApplication() {

ContextUtils.initApplicationContext(applicationContext)

initializeFileUtils(applicationContext)
initializeFileUtils()

val file: File = fileUtil.folderDir
val ctx = applicationContext
Expand All @@ -73,15 +76,13 @@ open class DLApplication : DaggerApplication() {
}
}

private fun initializeFileUtils(applicationContext: Context?) {
if (applicationContext != null) {
val isExternal = SharedPrefHelper(applicationContext).getIsExternalUse()
val isAppDir = SharedPrefHelper(applicationContext).getIsAppDirUse()
private fun initializeFileUtils() {
val isExternal = sharedPrefHelper.getIsExternalUse()
val isAppDir = sharedPrefHelper.getIsAppDirUse()

FileUtil.IS_EXTERNAL_STORAGE_USE = isExternal
FileUtil.IS_APP_DATA_DIR_USE = isAppDir
FileUtil.INITIIALIZED = true
}
FileUtil.IS_EXTERNAL_STORAGE_USE = isExternal
FileUtil.IS_APP_DATA_DIR_USE = isAppDir
FileUtil.INITIIALIZED = true
}

private fun initializeYoutubeDl() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.myAllVideoBrowser.ui.main.home.browser.homeTab

import android.annotation.SuppressLint
import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableField
import androidx.lifecycle.viewModelScope
Expand Down Expand Up @@ -86,10 +85,9 @@ class BrowserHomeViewModel @Inject constructor(
}.onErrorReturn {
emptyList()
}.take(1).observeOn(baseSchedulers.single)
.subscribeOn(baseSchedulers.computation) // MAIN_TH
.subscribeOn(baseSchedulers.computation)
}

@SuppressLint("CheckResult")
private fun updateTopPages() {
viewModelScope.launch(executorSingle) {
val pages = try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ class WebTabFragment : BaseWebTabFragment() {
webView?.setLayerType(View.LAYER_TYPE_HARDWARE, null)
webView?.isScrollbarFadingEnabled = true

CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
// TODO: turn on third-party from settings
// CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)

webSettings?.apply {
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
setSupportZoom(true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.myAllVideoBrowser.ui.main.progress

import android.net.Uri
import androidx.annotation.VisibleForTesting
import androidx.databinding.ObservableField
import androidx.lifecycle.viewModelScope
Expand All @@ -12,7 +11,7 @@ import com.myAllVideoBrowser.ui.main.base.BaseViewModel
import com.myAllVideoBrowser.util.ContextUtils
import com.myAllVideoBrowser.util.FileUtil
import com.myAllVideoBrowser.util.downloaders.generic_downloader.models.VideoTaskState
import com.myAllVideoBrowser.util.downloaders.custom_downloader_service.CustomRegularDownloader
import com.myAllVideoBrowser.util.downloaders.custom_downloader.CustomRegularDownloader
import com.myAllVideoBrowser.util.downloaders.youtubedl_downloader.YoutubeDlDownloader
import io.reactivex.rxjava3.core.BackpressureStrategy
import io.reactivex.rxjava3.core.Observable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.myAllVideoBrowser.util.downloaders.custom_downloader_service
package com.myAllVideoBrowser.util.downloaders.custom_downloader

import com.myAllVideoBrowser.util.AppLogger
import okhttp3.Headers.Companion.toHeaders
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.myAllVideoBrowser.util.downloaders.custom_downloader_service
package com.myAllVideoBrowser.util.downloaders.custom_downloader

import android.content.Context
import androidx.work.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.myAllVideoBrowser.util.downloaders.custom_downloader_service
package com.myAllVideoBrowser.util.downloaders.custom_downloader

import android.annotation.SuppressLint
import android.content.Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ class YoutubeDlDownloaderWorker(appContext: Context, workerParams: WorkerParamet
}

disposable = Observable.fromCallable<YoutubeDLResponse> {
YoutubeDL.getInstance().execute(request, taskId, { pr, _, line ->
YoutubeDL.getInstance().execute(request, taskId) { pr, _, line ->
if (line.contains("[download] Destination:")) {
isDownloadJustStarted = true
}
if (line.contains("[download] 0")) {
if (line.contains(Regex("""\[download] {3}\d+"""))) {
isDownloadOk = true
}

Expand Down Expand Up @@ -340,7 +340,6 @@ class YoutubeDlDownloaderWorker(appContext: Context, workerParams: WorkerParamet
return@execute
}
}
}) { _, _ ->
}
}.doOnError {
handleError(taskId, url, progressCached, it, tmpFile.name, name)
Expand Down
2 changes: 1 addition & 1 deletion versions.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext.deps = [:]
def versions = [:]
versions.gradle_plugin = '8.3.2'
versions.kotlin = '2.0.0'
versions.kotlin = '2.0.20'
versions.arch_core = "1.1.1"
versions.room = "2.4.3"
versions.lifecycle = "1.1.1"
Expand Down